From 957af3d1ecfd440f5609e0f1a95aa3279d4fd27c Mon Sep 17 00:00:00 2001 From: gamer147 Date: Fri, 5 Jun 2026 17:22:20 -0400 Subject: [PATCH] feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files) Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves. --- SVSim.BattleEngine/COPIED.manifest.tsv | 1788 +++++++++++++++ SVSim.BattleEngine/Engine/AchievementInfo.cs | 4 + .../Engine/AchievementInfoDetail.cs | 6 + .../Engine/AchievementWindowBase.cs | 777 +++++++ SVSim.BattleEngine/Engine/ActiveAnimation.cs | 356 +++ SVSim.BattleEngine/Engine/AddDamageInfo.cs | 22 + SVSim.BattleEngine/Engine/AlleyField.cs | 77 + .../Engine/AnimationOrTween/Direction.cs | 8 + SVSim.BattleEngine/Engine/AreaSelInfo.cs | 530 +++++ SVSim.BattleEngine/Engine/ArenaColosseum.cs | 346 +++ SVSim.BattleEngine/Engine/ArenaCompetition.cs | 206 ++ SVSim.BattleEngine/Engine/ArenaData.cs | 80 + .../Engine/ArenaEntryDataBase.cs | 16 + SVSim.BattleEngine/Engine/ArenaField.cs | 80 + .../Engine/ArenaNextSceneSelector.cs | 101 + .../Engine/ArenaResultAnimationAgent.cs | 204 ++ .../Engine/ArenaResultAnimationHandler.cs | 22 + .../Engine/ArenaResultReporter.cs | 63 + SVSim.BattleEngine/Engine/ArenaTwoPickData.cs | 24 + SVSim.BattleEngine/Engine/AspectCamera.cs | 76 + .../Engine/AttackSelectControl.cs | 528 +++++ .../Engine/BattleCardIconAnimations.cs | 487 ++++ SVSim.BattleEngine/Engine/BattleCoroutine.cs | 52 + .../Engine/BattleFinishSendBase.cs | 49 + ...BattleFinishToOpponentDisConnectChecker.cs | 149 ++ .../Engine/BattleKeywordInfoListMgr.cs | 423 ++++ .../Engine/BattlePlayerVfxCreatorBase.cs | 69 + .../Engine/BattleSettingBaseData.cs | 36 + .../Engine/BattleSettingData.cs | 157 ++ .../Engine/BattleStageChoiceObject.cs | 36 + .../Engine/BattleStageChoiceWindow.cs | 468 ++++ .../Engine/BattleStopChecker.cs | 24 + SVSim.BattleEngine/Engine/BattleUtility.cs | 67 + SVSim.BattleEngine/Engine/BetterList.cs | 229 ++ .../Engine/BothBattlePlayerFilter.cs | 11 + SVSim.BattleEngine/Engine/CardCreatorBase.cs | 404 ++++ SVSim.BattleEngine/Engine/CardMake.cs | 175 ++ .../Engine/CardPanelMaintenancePlate.cs | 21 + .../Engine/CardSelectListUI_Positioning.cs | 210 ++ SVSim.BattleEngine/Engine/CardShaderDefine.cs | 39 + SVSim.BattleEngine/Engine/CastleField.cs | 182 ++ SVSim.BattleEngine/Engine/ChallengeConfig.cs | 6 + SVSim.BattleEngine/Engine/ChallengeData.cs | 43 + .../Engine/ChangeAffiliationVfx.cs | 52 + .../Engine/ChantCountAddModifier.cs | 21 + .../Engine/ChantCountSetModifier.cs | 21 + .../Engine/ChantFieldBattleCard.cs | 120 + SVSim.BattleEngine/Engine/CharIdx.cs | 28 + .../Engine/Charactor3dInformation.cs | 430 ++++ SVSim.BattleEngine/Engine/ChateauField.cs | 110 + .../Engine/Class3dPostImageEffect.cs | 339 +++ .../Engine/Class3dScreenOverlay.cs | 343 +++ .../Engine/ClassBattleCardBase.cs | 387 ++++ SVSim.BattleEngine/Engine/ClassCharaExp.cs | 8 + SVSim.BattleEngine/Engine/ClassSkinPlate.cs | 208 ++ .../Engine/ClassSkinPurchasePage.cs | 691 ++++++ .../Engine/ColosseumBattleFinish.cs | 4 + .../Engine/ColosseumBattleFinishDetail.cs | 3 + .../Engine/ColosseumResultAnimationAgent.cs | 220 ++ .../Engine/ColosseumResultAnimationHandler.cs | 22 + .../Engine/ColosseumResultReporter.cs | 63 + .../Engine/ConnectionReportTrigger.cs | 12 + .../Engine/ConnectionReporter.cs | 51 + SVSim.BattleEngine/Engine/ConventionList.cs | 16 + .../Engine/ConventionListPlate.cs | 59 + SVSim.BattleEngine/Engine/ConventionListUI.cs | 86 + SVSim.BattleEngine/Engine/CostAddModifier.cs | 24 + SVSim.BattleEngine/Engine/CostCurveUI.cs | 195 ++ SVSim.BattleEngine/Engine/CostHalfModifier.cs | 17 + .../Engine/CostHalfRoundUpModifier.cs | 19 + SVSim.BattleEngine/Engine/CostSetModifier.cs | 24 + .../Engine/Cute/AssetBundleObject.cs | 17 + .../Engine/Cute/AssetManager.cs | 1554 +++++++++++++ SVSim.BattleEngine/Engine/Cute/AssetObject.cs | 16 + SVSim.BattleEngine/Engine/Cute/AsyncJob.cs | 182 ++ .../Engine/Cute/AudioManager.cs | 808 +++++++ SVSim.BattleEngine/Engine/Cute/BootNetwork.cs | 93 + SVSim.BattleEngine/Engine/Cute/BootSystem.cs | 145 ++ SVSim.BattleEngine/Engine/Cute/CryptAES.cs | 248 +++ .../Engine/Cute/Cryptographer.cs | 144 ++ .../Engine/Cute/CustomPreference.cs | 318 +++ .../Engine/Cute/CuteNetworkDefine.cs | 190 ++ .../Engine/Cute/DebugManager.cs | 102 + .../Engine/Cute/DeviceManager.cs | 284 +++ .../Engine/Cute/GameStartCheckTask.cs | 139 ++ .../Engine/Cute/GetiCloudUserDataTask.cs | 77 + .../Engine/Cute/HangulManager.cs | 224 ++ .../Engine/Cute/IAchievementCallback.cs | 18 + SVSim.BattleEngine/Engine/Cute/ILocalKVS.cs | 20 + .../Engine/Cute/LocalSqliteKVS.cs | 281 +++ .../Engine/Cute/ManifestDatahashKVS.cs | 123 ++ .../Engine/Cute/MovieManager.cs | 217 ++ SVSim.BattleEngine/Engine/Cute/MoviePlayer.cs | 155 ++ SVSim.BattleEngine/Engine/Cute/ParallelJob.cs | 36 + .../Engine/Cute/PaymentPCFinishTask.cs | 69 + .../Engine/Cute/QualityManager.cs | 340 +++ .../Engine/Cute/SavedataManager.cs | 90 + SVSim.BattleEngine/Engine/Cute/SignUpTask.cs | 72 + .../Engine/Cute/SoftwareResetBase.cs | 48 + SVSim.BattleEngine/Engine/Cute/SoundData.cs | 17 + SVSim.BattleEngine/Engine/Cute/TimeData.cs | 77 + SVSim.BattleEngine/Engine/Cute/TimeUtil.cs | 147 ++ SVSim.BattleEngine/Engine/Cute/Toolbox.cs | 65 + SVSim.BattleEngine/Engine/Cute/URLScheme.cs | 180 ++ .../Engine/Cute/UpdateiCloudUserDataTask.cs | 47 + .../Engine/Cute/WebViewManager.cs | 276 +++ SVSim.BattleEngine/Engine/Debug.cs | 129 ++ SVSim.BattleEngine/Engine/DeckDecisionUI.cs | 245 ++ SVSim.BattleEngine/Engine/DegreeInfo.cs | 4 + SVSim.BattleEngine/Engine/DegreeInfoDetail.cs | 6 + .../Engine/DepthBlurAndBloom.cs | 46 + SVSim.BattleEngine/Engine/DialogSupport.cs | 133 ++ SVSim.BattleEngine/Engine/DoMatchingBase.cs | 103 + SVSim.BattleEngine/Engine/DoMatchingData.cs | 4 + SVSim.BattleEngine/Engine/DoMatchingDetail.cs | 41 + .../Engine/DofDiffusionBloomOverlayParam.cs | 295 +++ SVSim.BattleEngine/Engine/Effect.cs | 305 +++ .../Engine/Effect3dInformation.cs | 479 ++++ SVSim.BattleEngine/Engine/EmblemInfo.cs | 4 + SVSim.BattleEngine/Engine/EmblemInfoDetail.cs | 6 + SVSim.BattleEngine/Engine/EmitHandUtility.cs | 112 + SVSim.BattleEngine/Engine/EnemyAICoroutine.cs | 52 + .../Engine/EnemyClassBattleCard.cs | 28 + .../Engine/EventBattleResult.cs | 6 + SVSim.BattleEngine/Engine/FadeUtility.cs | 140 ++ SVSim.BattleEngine/Engine/FieldBattleCard.cs | 112 + SVSim.BattleEngine/Engine/FontChanger.cs | 91 + SVSim.BattleEngine/Engine/ForestField.cs | 122 + SVSim.BattleEngine/Engine/ForestNightField.cs | 11 + .../Engine/FramerateProfiler.cs | 51 + SVSim.BattleEngine/Engine/FreeMatchFinish.cs | 4 + .../Engine/FreeMatchFinishDetail.cs | 3 + .../Engine/FreeMatchResultAnimationAgent.cs | 175 ++ .../Engine/FreeMatchResultAnimationHandler.cs | 22 + .../Engine/FreeMatchResultReporter.cs | 63 + SVSim.BattleEngine/Engine/FriendApply.cs | 42 + SVSim.BattleEngine/Engine/FriendInfo.cs | 9 + SVSim.BattleEngine/Engine/FriendInfoDetail.cs | 10 + SVSim.BattleEngine/Engine/GachaObj.cs | 34 + SVSim.BattleEngine/Engine/GateField.cs | 83 + SVSim.BattleEngine/Engine/Gungnir.cs | 303 +++ SVSim.BattleEngine/Engine/HandViewBase.cs | 194 ++ SVSim.BattleEngine/Engine/HillField.cs | 105 + SVSim.BattleEngine/Engine/HillRiotingField.cs | 9 + SVSim.BattleEngine/Engine/IDInput.cs | 166 ++ .../Engine/InPlayCardControl.cs | 115 + SVSim.BattleEngine/Engine/InPlayViewBase.cs | 145 ++ .../Engine/InitializeRoomBattle.cs | 26 + .../Engine/InviteFriendBattle.cs | 8 + SVSim.BattleEngine/Engine/IronField.cs | 85 + SVSim.BattleEngine/Engine/LaboratoryField.cs | 109 + .../Engine/LaboratoryNightField.cs | 11 + SVSim.BattleEngine/Engine/LifeAddModifier.cs | 23 + .../Engine/LifeMultiplyModifier.cs | 23 + SVSim.BattleEngine/Engine/LifeSetModifier.cs | 23 + .../Engine/LitJson/ArrayMetadata.cs | 52 + .../Engine/LitJson/Condition.cs | 10 + .../Engine/LitJson/ExporterFunc.cs | 4 + .../Engine/LitJson/FsmContext.cs | 12 + .../Engine/LitJson/IJsonWrapper.cs | 48 + .../Engine/LitJson/IOrderedDictionary.cs | 14 + .../Engine/LitJson/ImporterFunc.cs | 4 + SVSim.BattleEngine/Engine/LitJson/JsonData.cs | 873 ++++++++ .../Engine/LitJson/JsonException.cs | 40 + .../Engine/LitJson/JsonMapper.cs | 748 +++++++ .../Engine/LitJson/JsonMockWrapper.cs | 210 ++ .../Engine/LitJson/JsonReader.cs | 366 +++ .../Engine/LitJson/JsonToken.cs | 17 + SVSim.BattleEngine/Engine/LitJson/JsonType.cs | 13 + .../Engine/LitJson/JsonWriter.cs | 435 ++++ SVSim.BattleEngine/Engine/LitJson/Lexer.cs | 753 +++++++ .../Engine/LitJson/ObjectMetadata.cs | 53 + .../LitJson/OrderedDictionaryEnumerator.cs | 39 + .../Engine/LitJson/ParserToken.cs | 24 + .../Engine/LitJson/PropertyMetadata.cs | 13 + .../Engine/LitJson/WrapperFactory.cs | 3 + .../Engine/LitJson/WriterContext.cs | 14 + SVSim.BattleEngine/Engine/Load.cs | 4 + SVSim.BattleEngine/Engine/LoadDetail.cs | 594 +++++ SVSim.BattleEngine/Engine/LoadingBase.cs | 184 ++ SVSim.BattleEngine/Engine/LoadingInScene.cs | 428 ++++ SVSim.BattleEngine/Engine/Localization.cs | 527 +++++ SVSim.BattleEngine/Engine/MailData.cs | 40 + SVSim.BattleEngine/Engine/MailDataDetail.cs | 10 + SVSim.BattleEngine/Engine/MailResult.cs | 4 + SVSim.BattleEngine/Engine/MailTop.cs | 4 + SVSim.BattleEngine/Engine/MatchFinishBase.cs | 39 + .../Engine/MatchingCoroutine.cs | 5 + .../Engine/MatchingIPv6Toggle.cs | 30 + .../Engine/Matching_Colosseum.cs | 56 + SVSim.BattleEngine/Engine/Matching_Free.cs | 58 + .../Engine/Matching_RankMatch.cs | 48 + SVSim.BattleEngine/Engine/Matching_Room.cs | 256 +++ SVSim.BattleEngine/Engine/Matching_TwoPick.cs | 48 + .../Engine/MaxLifeAddModifier.cs | 12 + .../Engine/MaxLifeSetModifier.cs | 14 + SVSim.BattleEngine/Engine/MecanimSceneBase.cs | 235 ++ SVSim.BattleEngine/Engine/MecanimStateBase.cs | 95 + SVSim.BattleEngine/Engine/MissionInfo.cs | 4 + .../Engine/MissionInfoDetail.cs | 138 ++ SVSim.BattleEngine/Engine/MotionUtils.cs | 301 +++ SVSim.BattleEngine/Engine/MyPageBanner.cs | 294 +++ SVSim.BattleEngine/Engine/MyPageBannerBase.cs | 749 +++++++ .../Engine/MyPageBattleCampaign.cs | 105 + SVSim.BattleEngine/Engine/MyPageCardDetail.cs | 157 ++ SVSim.BattleEngine/Engine/MyPageCardPanel.cs | 156 ++ .../Engine/MyPageCardPanelAnimation.cs | 301 +++ SVSim.BattleEngine/Engine/MyPageCenterCard.cs | 766 +++++++ SVSim.BattleEngine/Engine/MyPageCharaMenu.cs | 370 ++++ SVSim.BattleEngine/Engine/MyPageHomeStatic.cs | 88 + SVSim.BattleEngine/Engine/MyPageItem.cs | 314 +++ SVSim.BattleEngine/Engine/MyPageItemArena.cs | 1280 +++++++++++ SVSim.BattleEngine/Engine/MyPageItemBattle.cs | 1174 ++++++++++ SVSim.BattleEngine/Engine/MyPageItemCard.cs | 371 ++++ SVSim.BattleEngine/Engine/MyPageItemHome.cs | 580 +++++ SVSim.BattleEngine/Engine/MyPageItemShop.cs | 443 ++++ .../Engine/MyPageItemSoroPlay.cs | 244 ++ SVSim.BattleEngine/Engine/MyPageMenu.cs | 1321 +++++++++++ .../Engine/MyPageShopCrystalApeal.cs | 93 + SVSim.BattleEngine/Engine/MyPageSubBanner.cs | 79 + SVSim.BattleEngine/Engine/NGUIDebug.cs | 146 ++ SVSim.BattleEngine/Engine/NGUIMath.cs | 1033 +++++++++ SVSim.BattleEngine/Engine/NGUITools.cs | 1653 ++++++++++++++ SVSim.BattleEngine/Engine/Nat2Field.cs | 50 + SVSim.BattleEngine/Engine/Nat3Field.cs | 88 + SVSim.BattleEngine/Engine/Nat4Field.cs | 80 + SVSim.BattleEngine/Engine/NateField.cs | 110 + .../Engine/NetworkBattleGenericTool.cs | 852 +++++++ .../Engine/NetworkBattleSenderDefine.cs | 8 + SVSim.BattleEngine/Engine/NetworkLog.cs | 31 + .../Engine/NetworkMatchNextSceneSelector.cs | 90 + .../Engine/NetworkOperationCollection.cs | 245 ++ .../Engine/NetworkRecoveryBattleData.cs | 18 + .../Engine/NetworkReplayBattleReceiver.cs | 12 + .../NetworkReplayBattleSetupCardEvent.cs | 37 + .../NetworkSkillPreprocessConditionCheck.cs | 59 + ...workSkillRandomEachSameBaseCardIdFilter.cs | 26 + .../NetworkSkillRandomSelectUntilFilter.cs | 37 + .../NetworkSkillTargetLastTargetFilter.cs | 49 + .../Engine/NetworkSkill_attach_skill.cs | 43 + .../Engine/NetworkSkill_attack_by_life.cs | 17 + .../Engine/NetworkSkill_attack_count.cs | 24 + .../NetworkSkill_attract_skill_target.cs | 7 + .../Engine/NetworkSkill_banish.cs | 16 + .../Engine/NetworkSkill_bp_modifier.cs | 15 + .../NetworkSkill_cant_activate_fanfare.cs | 31 + .../Engine/NetworkSkill_cant_attack.cs | 18 + .../Engine/NetworkSkill_cant_evolution.cs | 7 + .../Engine/NetworkSkill_cant_play.cs | 17 + .../Engine/NetworkSkill_change_affiliation.cs | 33 + .../Engine/NetworkSkill_change_cemetery.cs | 23 + ...rkSkill_change_super_skybound_art_count.cs | 19 + .../NetworkSkill_change_union_burst_count.cs | 32 + .../NetworkSkill_change_white_ritual_stack.cs | 26 + .../Engine/NetworkSkill_chant_count_change.cs | 24 + ...clear_destroyed_and_discarded_card_list.cs | 20 + .../NetworkSkill_consume_ep_modifier.cs | 17 + .../Engine/NetworkSkill_copy_skill.cs | 21 + .../Engine/NetworkSkill_cost_change.cs | 262 +++ .../Engine/NetworkSkill_damage.cs | 34 + .../Engine/NetworkSkill_damage_cut.cs | 17 + .../Engine/NetworkSkill_damage_modifier.cs | 17 + .../Engine/NetworkSkill_destroy.cs | 15 + .../Engine/NetworkSkill_discard.cs | 19 + .../Engine/NetworkSkill_drain.cs | 18 + .../Engine/NetworkSkill_evolve.cs | 19 + .../Engine/NetworkSkill_extra_turn.cs | 21 + .../Engine/NetworkSkill_force_avarice.cs | 32 + .../Engine/NetworkSkill_force_berserk.cs | 32 + .../Engine/NetworkSkill_force_skill_target.cs | 7 + .../Engine/NetworkSkill_force_wrath.cs | 20 + .../NetworkSkill_fusion_metamorphose.cs | 24 + .../NetworkSkill_generic_value_modifier.cs | 120 + .../Engine/NetworkSkill_guard.cs | 17 + .../Engine/NetworkSkill_heal.cs | 21 + .../Engine/NetworkSkill_ignore_guard.cs | 17 + .../Engine/NetworkSkill_independent.cs | 17 + .../Engine/NetworkSkill_indestructible.cs | 18 + .../Engine/NetworkSkill_invoke_skill.cs | 38 + .../Engine/NetworkSkill_killer.cs | 18 + .../Engine/NetworkSkill_lose.cs | 23 + .../Engine/NetworkSkill_metamorphose.cs | 23 + .../Engine/NetworkSkill_not_be_attacked.cs | 18 + .../Engine/NetworkSkill_play_count_change.cs | 20 + .../NetworkSkill_possess_ep_modifier.cs | 28 + .../Engine/NetworkSkill_power_down.cs | 34 + .../Engine/NetworkSkill_power_modifier.cs | 24 + .../Engine/NetworkSkill_powerup.cs | 57 + .../Engine/NetworkSkill_pp_modifier.cs | 26 + .../Engine/NetworkSkill_quick.cs | 18 + .../Engine/NetworkSkill_random_array.cs | 57 + .../Engine/NetworkSkill_reflection.cs | 17 + .../Engine/NetworkSkill_remove_by_banish.cs | 7 + .../Engine/NetworkSkill_remove_by_destroy.cs | 17 + .../Engine/NetworkSkill_repeat_skill.cs | 17 + .../Engine/NetworkSkill_return_card.cs | 25 + .../Engine/NetworkSkill_rob_skill.cs | 21 + .../Engine/NetworkSkill_rush.cs | 17 + .../Engine/NetworkSkill_select.cs | 7 + .../Engine/NetworkSkill_shield.cs | 18 + .../Engine/NetworkSkill_shortage_deck_win.cs | 16 + .../Engine/NetworkSkill_sneak.cs | 18 + .../Engine/NetworkSkill_special_lose.cs | 20 + .../Engine/NetworkSkill_special_win.cs | 20 + .../Engine/NetworkSkill_stack_white_ritual.cs | 22 + .../Engine/NetworkSkill_summon_card.cs | 17 + .../Engine/NetworkSkill_summon_token.cs | 18 + .../Engine/NetworkSkill_token_draw.cs | 122 + .../Engine/NetworkSkill_trigger.cs | 17 + .../Engine/NetworkSkill_unite.cs | 15 + .../Engine/NetworkSkill_untouchable.cs | 18 + .../Engine/NetworkSkill_update_deck.cs | 44 + .../Engine/NetworkStandardBattleMgr.cs | 485 ++++ SVSim.BattleEngine/Engine/NetworkStatus.cs | 63 + .../Engine/NetworkUserInfoData.cs | 532 +++++ SVSim.BattleEngine/Engine/NetworkUtility.cs | 25 + .../Engine/NetworkWatchBattleData.cs | 105 + .../Engine/NetworkWatchBattleReceiver.cs | 266 +++ .../NetworkWatchBattleSetupCardEvent.cs | 120 + .../Engine/NewReplayOperateReceive.cs | 312 +++ .../Engine/NewReplayOperationCollection.cs | 924 ++++++++ .../Engine/NtDataTranslateInfo.cs | 212 ++ .../Engine/NtDataTranslateManager.cs | 248 +++ SVSim.BattleEngine/Engine/NullBattleCard.cs | 94 + .../Engine/NullBattlePlayerFilter.cs | 11 + .../Engine/NullDetailPanelControl.cs | 104 + .../Engine/NullNextSceneSelector.cs | 16 + .../Engine/NullOperationCollection.cs | 103 + .../Engine/NullSkillApplyInformation.cs | 1462 ++++++++++++ .../Engine/NullStatusPanelControl.cs | 89 + .../Engine/NullTurnPanelControl.cs | 20 + .../Engine/OffenseAddModifier.cs | 16 + .../Engine/OffenseMultiplyModifier.cs | 16 + .../Engine/OffenseSetModifier.cs | 16 + SVSim.BattleEngine/Engine/OpenURLOnClick.cs | 15 + .../Engine/OpponentBattlePlayerFilter.cs | 10 + SVSim.BattleEngine/Engine/PackOpen.cs | 4 + .../Engine/PlayQueueViewBase.cs | 204 ++ .../Engine/PlayerClassBattleCard.cs | 28 + .../Engine/PlayerDrawCardToHandVfx.cs | 90 + SVSim.BattleEngine/Engine/PlazField.cs | 114 + SVSim.BattleEngine/Engine/PlazRiotingField.cs | 39 + SVSim.BattleEngine/Engine/PracticeFinish.cs | 4 + .../Engine/PracticeFinishDetail.cs | 26 + .../Engine/PracticeNextSceneSelector.cs | 81 + .../Engine/PracticePuzzleFinishData.cs | 26 + .../Engine/PracticePuzzleNextSceneSelector.cs | 87 + .../Engine/PracticePuzzleReportEndAgent.cs | 11 + .../Engine/PracticePuzzleResultReporter.cs | 117 + .../Engine/PracticeReportEndAgent.cs | 11 + .../Engine/PracticeResultAnimationAgent.cs | 173 ++ .../Engine/PracticeResultAnimationHandler.cs | 22 + .../Engine/PracticeResultReporter.cs | 90 + SVSim.BattleEngine/Engine/PrefabMgr.cs | 143 ++ SVSim.BattleEngine/Engine/PriConnField.cs | 69 + .../Engine/PuzzleBattleManager.cs | 543 +++++ SVSim.BattleEngine/Engine/QuestFinish.cs | 4 + .../Engine/QuestNextSceneSelector.cs | 170 ++ .../Engine/QuestReportEndAgent.cs | 11 + .../Engine/QuestResultReporter.cs | 111 + .../QuestSpecialResultAnimationAgent.cs | 282 +++ .../QuestSpecialResultAnimationHandler.cs | 27 + .../Engine/QuestStageIdFilter.cs | 22 + .../Engine/RandomValueFilter.cs | 19 + SVSim.BattleEngine/Engine/RankMatchFinish.cs | 4 + .../Engine/RankMatchFinishDetail.cs | 47 + .../Engine/RankMatchResultAnimationAgent.cs | 351 +++ .../Engine/RankMatchResultAnimationHandler.cs | 22 + .../Engine/RankMatchResultReporter.cs | 63 + SVSim.BattleEngine/Engine/ReadMail.cs | 4 + SVSim.BattleEngine/Engine/ReadMailDetail.cs | 10 + SVSim.BattleEngine/Engine/RealTime.cs | 8 + .../Engine/RealTimeNetworkAgent.cs | 1788 +++++++++++++++ .../Engine/ReceiveFriendApplyInfo.cs | 9 + .../Engine/ReceiveFriendApplyInfoDetail.cs | 8 + .../Engine/RecoveryOperateMgr.cs | 58 + .../Engine/RecoveryOperateReceive.cs | 78 + .../Engine/RecoveryOperationCollection.cs | 80 + SVSim.BattleEngine/Engine/RegisterAlter.cs | 64 + SVSim.BattleEngine/Engine/RegisterAttach.cs | 208 ++ .../Engine/RegisterCopyToken.cs | 53 + SVSim.BattleEngine/Engine/RegisterDeckOut.cs | 19 + .../Engine/RegisterEnhanceTrigger.cs | 184 ++ .../Engine/RegisterEvolution.cs | 23 + SVSim.BattleEngine/Engine/RegisterExtract.cs | 51 + SVSim.BattleEngine/Engine/RegisterFilter.cs | 349 +++ SVSim.BattleEngine/Engine/RegisterFusion.cs | 25 + .../Engine/RegisterMetamorphoseData.cs | 81 + .../Engine/RegisterOpenMyCards.cs | 31 + .../Engine/RegisterPlayerParameter.cs | 33 + SVSim.BattleEngine/Engine/RegisterScan.cs | 505 +++++ .../Engine/RegisterShortageDeckWin.cs | 27 + .../Engine/RegisterSkillConditionCheck.cs | 1466 ++++++++++++ .../Engine/RegisterSpecialWin.cs | 17 + .../Engine/RegisterStateChangeCard.cs | 115 + SVSim.BattleEngine/Engine/RegisterTool.cs | 279 +++ SVSim.BattleEngine/Engine/RegisterValidate.cs | 557 +++++ .../Engine/RepeatSkillEffectVfx.cs | 17 + .../Engine/ReplayBattleEnemy.cs | 264 +++ .../Engine/ReplayBattlePlayer.cs | 779 +++++++ .../Engine/ReplayExecutionInfoCreator.cs | 20 + .../Engine/ReplayMoveTurnItem.cs | 20 + .../Engine/ReplayMoveTurnPanel.cs | 10 + .../Engine/ReplayOperateReceive.cs | 17 + .../Engine/ReplayOperationCollection.cs | 27 + SVSim.BattleEngine/Engine/Reward.cs | 12 + .../Engine/RivayleBackalleyField.cs | 72 + SVSim.BattleEngine/Engine/RivayleField.cs | 100 + .../Engine/RoomBattleMatching.cs | 4 + .../Engine/RoomBattleMatchingDetail.cs | 8 + SVSim.BattleEngine/Engine/RoomMatchFinish.cs | 4 + .../Engine/RoomMatchFinishDetail.cs | 3 + .../Engine/RoomMatchReportEndAgent.cs | 11 + .../Engine/RoomMatchResultAnimationAgent.cs | 251 +++ .../Engine/RoomMatchResultAnimationHandler.cs | 22 + .../Engine/RoomMatchResultReporter.cs | 66 + .../Engine/RoomTwoPickBeforeBattleInfo.cs | 50 + SVSim.BattleEngine/Engine/RoomTwoPickInfo.cs | 20 + SVSim.BattleEngine/Engine/RoyalPalaceField.cs | 146 ++ .../Engine/RoyalPalaceNightField.cs | 11 + SVSim.BattleEngine/Engine/SearchUserInfo.cs | 9 + .../Engine/SearchUserInfoDetail.cs | 4 + .../Engine/SelfBattlePlayerFilter.cs | 10 + .../Engine/SendFriendApplyInfo.cs | 9 + .../Engine/SendFriendApplyInfoDetail.cs | 10 + .../Engine/ShopSupplyCardPanel.cs | 29 + SVSim.BattleEngine/Engine/SimpleCardDetail.cs | 411 ++++ SVSim.BattleEngine/Engine/SingleBattleMgr.cs | 434 ++++ .../Engine/SingleExecutionInfoCreator.cs | 20 + .../Engine/SingleSkill_attach_skill.cs | 32 + .../Engine/SkillAbilityAccelerateFilter.cs | 45 + .../Engine/SkillAbilityBurialRiteFilter.cs | 27 + .../Engine/SkillAbilityCantAttackAllFilter.cs | 27 + .../Engine/SkillAbilityCrystallizeFilter.cs | 45 + .../SkillAbilityDestroyWhiteRitualFilter.cs | 16 + .../Engine/SkillAbilityDrainFilter.cs | 36 + .../Engine/SkillAbilityEnhanceFilter.cs | 38 + .../Engine/SkillAbilityFusionFilter.cs | 28 + .../Engine/SkillAbilityGuardFilter.cs | 36 + .../Engine/SkillAbilityKillerFilter.cs | 36 + .../Engine/SkillAbilityNecromanceFilter.cs | 27 + .../Engine/SkillAbilityQuickFilter.cs | 36 + .../Engine/SkillAbilityReanimateFilter.cs | 28 + .../Engine/SkillAbilityRushFilter.cs | 36 + .../Engine/SkillAbilitySneakFilter.cs | 38 + .../Engine/SkillAbilitySpellChargeFilter.cs | 41 + .../SkillAbilityStackWhiteRitualFilter.cs | 11 + .../SkillAbilitySuperSkyboundArtFilter.cs | 38 + .../Engine/SkillAbilityUnionBurstFilter.cs | 38 + .../Engine/SkillAbilityWhenAttackFilter.cs | 16 + .../Engine/SkillAbilityWhenDestroyFilter.cs | 29 + .../Engine/SkillAbilityWhenEvolveFilter.cs | 27 + .../Engine/SkillAbilityWhenFightFilter.cs | 16 + .../Engine/SkillAbilityWhenPlayFilter.cs | 37 + ...lityWhenPlayNoSelectAndBurialRiteFilter.cs | 28 + .../Engine/SkillAbilityWhiteRitualFilter.cs | 16 + .../Engine/SkillAllCardFilter.cs | 10 + .../Engine/SkillAttachingAbilityFilter.cs | 27 + .../Engine/SkillAttackIsLarger.cs | 11 + .../Engine/SkillAttackedCardFilter.cs | 18 + .../Engine/SkillAvariceCardFilter.cs | 26 + .../Engine/SkillBothClanFilter.cs | 31 + .../Engine/SkillCalcFifthRoundDown.cs | 15 + .../Engine/SkillCalcHalfRoundDown.cs | 15 + .../Engine/SkillCalcHalfRoundUp.cs | 16 + .../Engine/SkillCalcMaxFilter.cs | 15 + .../Engine/SkillCalcMinFilter.cs | 15 + .../Engine/SkillCalcQuarterRoundUp.cs | 16 + .../Engine/SkillCalcSumFilter.cs | 15 + .../Engine/SkillCardFilterBase.cs | 30 + .../Engine/SkillCardTurnDestroyedFilter.cs | 20 + .../Engine/SkillCemeteryFilter.cs | 31 + .../Engine/SkillChantFieldFilter.cs | 11 + .../Engine/SkillChoiceSelectFilter.cs | 28 + SVSim.BattleEngine/Engine/SkillClanFilter.cs | 25 + SVSim.BattleEngine/Engine/SkillClassFilter.cs | 11 + .../Engine/SkillCompareFuncCreator.cs | 122 + .../Engine/SkillConditionAttachingAbility.cs | 35 + .../Engine/SkillConditionAttackerIsOther.cs | 21 + .../Engine/SkillConditionAttackerIsSelf.cs | 21 + .../Engine/SkillConditionAvarice.cs | 41 + .../Engine/SkillConditionAwake.cs | 31 + .../SkillConditionBeAttackedIsDestroy.cs | 23 + .../Engine/SkillConditionBeAttackedIsOther.cs | 21 + .../Engine/SkillConditionBeAttackedIsSelf.cs | 21 + .../Engine/SkillConditionBurialRite.cs | 50 + .../SkillConditionDeckSelfSummonedSelf.cs | 21 + .../SkillConditionDisplayOtherUsersMessage.cs | 21 + .../Engine/SkillConditionEvolvableTurn.cs | 30 + .../Engine/SkillConditionHalfLife.cs | 40 + .../SkillConditionHealingCardIsClass.cs | 30 + .../Engine/SkillConditionInHandIsOther.cs | 27 + .../Engine/SkillConditionInHandIsSelf.cs | 27 + .../SkillConditionIsInplayCardFilter.cs | 18 + .../SkillConditionIsReanimateCardFilter.cs | 18 + .../Engine/SkillConditionMeLanguage.cs | 22 + .../Engine/SkillConditionOddEvenOffense.cs | 36 + .../SkillConditionOddEvenSpellCharge.cs | 37 + SVSim.BattleEngine/Engine/SkillConditionPP.cs | 46 + .../Engine/SkillConditionPlayCount.cs | 30 + .../Engine/SkillConditionReanimatedSelf.cs | 21 + .../Engine/SkillConditionResonance.cs | 27 + .../Engine/SkillConditionShortageDeckWin.cs | 21 + .../Engine/SkillConditionTrigger.cs | 29 + .../Engine/SkillConditionTurn.cs | 29 + .../Engine/SkillConditionWrath.cs | 40 + ...killCostNoDuplicationRandomSelectFilter.cs | 44 + .../SkillEnvironmentalAttachedTurnFilter.cs | 26 + .../Engine/SkillEnvironmentalBpFilter.cs | 12 + .../Engine/SkillEnvironmentalCemeteryCount.cs | 14 + .../Engine/SkillEnvironmentalCharaIdFilter.cs | 17 + .../SkillEnvironmentalDeckBanishCount.cs | 12 + .../SkillEnvironmentalDefaultDamageFilter.cs | 12 + .../Engine/SkillEnvironmentalEPFilter.cs | 12 + ...SkillEnvironmentalFirstPlayerTurnFilter.cs | 16 + .../SkillEnvironmentalFixedDamageFilter.cs | 12 + .../Engine/SkillEnvironmentalGameBuffCount.cs | 17 + ...ntalGameConditionFulfilledTurnPlaycount.cs | 25 + ...SkillEnvironmentalGameDiscardSkillCount.cs | 17 + ...SkillEnvironmentalGameFusionCountFilter.cs | 14 + ...EnvironmentalGameMetamorphoseSkillCount.cs | 17 + .../SkillEnvironmentalGameNecromanceCount.cs | 12 + .../SkillEnvironmentalGamePlayCountFilter.cs | 15 + ...ironmentalGameResonanceStartCountFilter.cs | 12 + .../SkillEnvironmentalGameReturnSkillCount.cs | 17 + ...lEnvironmentalGameSuperSkyboundArtCount.cs | 14 + .../SkillEnvironmentalGameUsedEpCount.cs | 12 + .../SkillEnvironmentalGameUsedPpCount.cs | 12 + ...ronmentalGameUsedWhiteRitualCountFilter.cs | 12 + ...lEnvironmentalJatelantBanishCountFilter.cs | 22 + ...nmentalJatelantDamageAndHealCountFilter.cs | 22 + ...ronmentalJatelantSummonTokenCountFilter.cs | 22 + ...nmentalLastInplayWhiteRitualStackFilter.cs | 12 + .../SkillEnvironmentalLastNecromanceCount.cs | 12 + ...ntalLastUsedWhiteRitualStackCountFilter.cs | 12 + .../Engine/SkillEnvironmentalMaxEPFilter.cs | 16 + .../Engine/SkillEnvironmentalMaxPPFilter.cs | 12 + .../Engine/SkillEnvironmentalPPFilter.cs | 12 + .../Engine/SkillEnvironmentalPlayCount.cs | 27 + .../Engine/SkillEnvironmentalRallyCount.cs | 12 + ...killEnvironmentalSecondPlayerTurnFilter.cs | 16 + .../SkillEnvironmentalShortageDeckLose.cs | 20 + ...SkillEnvironmentalTurnDiscardSkillCount.cs | 19 + .../SkillEnvironmentalTurnEnhanceCardCount.cs | 19 + .../SkillEnvironmentalTurnEvolveCount.cs | 23 + .../Engine/SkillEnvironmentalTurnFilter.cs | 12 + ...ironmentalTurnResonanceStartCountFilter.cs | 12 + .../SkillEnvironmentalTurnReturnSkillCount.cs | 19 + .../SkillEnvironmentalTurnUsedEpCount.cs | 12 + .../SkillEnvironmentalTurnWhenHealingCount.cs | 22 + .../SkillEnvironmentalUsableEPFilter.cs | 16 + .../Engine/SkillEvolutionCardFilter.cs | 18 + .../Engine/SkillExclutionApplyFilter.cs | 41 + .../Engine/SkillExclutionNoneFilter.cs | 10 + SVSim.BattleEngine/Engine/SkillFieldFilter.cs | 11 + .../SkillFusionIngredientCardListFilter.cs | 17 + .../Engine/SkillGetOffCardListFilter.cs | 15 + .../Engine/SkillGetOnCardListFilter.cs | 15 + .../SkillIdNoDuplicationRandomSelectFilter.cs | 65 + .../Engine/SkillInOrderFromOldestFilter.cs | 50 + .../Engine/SkillIncludeSelfCardFilter.cs | 21 + .../Engine/SkillIsBuffDetailFilter.cs | 30 + .../SkillIsFusionInfoOrIsNotSideLogFilter.cs | 32 + .../SkillIsInvokeSideLogorBuffDetailFilter.cs | 46 + .../Engine/SkillIsOwnerFilter.cs | 26 + .../Engine/SkillIsWatchFilter.cs | 24 + SVSim.BattleEngine/Engine/SkillKeywordInfo.cs | 140 ++ .../Engine/SkillLastBurialRiteCardFilter.cs | 17 + SVSim.BattleEngine/Engine/SkillLastFilter.cs | 16 + .../Engine/SkillLastTargetTribeFilter.cs | 32 + .../Engine/SkillLeaderSkinIdFilter.cs | 38 + .../Engine/SkillLifeIsLarger.cs | 11 + .../SkillLimitUpperCountFromNewestFilter.cs | 27 + .../SkillLimitUpperCountFromOldestFilter.cs | 26 + .../Engine/SkillLoadTargetFilter.cs | 17 + .../Engine/SkillMultiClanFilter.cs | 31 + ...lNoDuplicationRandomSelectInOrderFilter.cs | 78 + .../Engine/SkillNotChantFieldFilter.cs | 11 + SVSim.BattleEngine/Engine/SkillNullFilter.cs | 11 + .../Engine/SkillOnlyOneCardFilter.cs | 28 + .../Engine/SkillOnlyOneFilter.cs | 33 + ...killParameterActivatedRandomArrayFilter.cs | 22 + .../Engine/SkillParameterAttackCountFilter.cs | 33 + .../Engine/SkillParameterBaseCardIdFilter.cs | 35 + .../Engine/SkillParameterBaseCostFilter.cs | 21 + .../Engine/SkillParameterBaseLifeFilter.cs | 21 + .../Engine/SkillParameterBaseOffenseFilter.cs | 21 + .../Engine/SkillParameterBuffCountFilter.cs | 35 + .../SkillParameterBuffLifeCountFilter.cs | 35 + .../SkillParameterChangeMaxLifeCountFilter.cs | 22 + .../Engine/SkillParameterChantCountFilter.cs | 21 + .../Engine/SkillParameterChargeCountFilter.cs | 25 + .../Engine/SkillParameterCostFilter.cs | 21 + .../Engine/SkillParameterDestroyFilter.cs | 18 + .../SkillParameterDestroyedByAbilityFilter.cs | 39 + ...ameterDestroyedByCardIdAndAbilityFilter.cs | 54 + .../SkillParameterDestroyedByCardIdFilter.cs | 29 + .../Engine/SkillParameterDestroyedByFilter.cs | 38 + ...llParameterDistinctRandomSelectedFilter.cs | 37 + .../Engine/SkillParameterFusionCountFilter.cs | 11 + .../Engine/SkillParameterHasSkillFilter.cs | 18 + .../Engine/SkillParameterHealCountFilter.cs | 11 + .../Engine/SkillParameterHealValueFilter.cs | 17 + .../Engine/SkillParameterIdFilter.cs | 64 + .../Engine/SkillParameterIsChaosFilter.cs | 24 + .../Engine/SkillParameterIsTurnFilter.cs | 18 + .../Engine/SkillParameterIsUnlimitedFilter.cs | 22 + .../Engine/SkillParameterLastLifeFilter.cs | 35 + .../Engine/SkillParameterLifeFilter.cs | 21 + .../Engine/SkillParameterLoadTargetCardId.cs | 28 + .../SkillParameterMaxAttackCountFilter.cs | 22 + .../Engine/SkillParameterMaxLifeFilter.cs | 23 + .../Engine/SkillParameterOffenseFilter.cs | 21 + ...killParameterPreviousTurnAttackedFilter.cs | 18 + .../Engine/SkillParameterRandomArrayFilter.cs | 18 + .../Engine/SkillParameterRarityFilter.cs | 22 + .../Engine/SkillParameterReturnedByFilter.cs | 30 + .../SkillParameterSelectAttackCountFilter.cs | 11 + .../SkillParameterSelectBaseCardIdFilter.cs | 11 + .../SkillParameterSelectBaseCostFilter.cs | 11 + .../SkillParameterSelectBaseLifeFilter.cs | 11 + .../SkillParameterSelectBaseOffenseFilter.cs | 11 + .../SkillParameterSelectBuffCountFilter.cs | 11 + ...ParameterSelectChangeMaxLifeCountFilter.cs | 11 + .../SkillParameterSelectChantCountFilter.cs | 11 + .../SkillParameterSelectChargeCountFilter.cs | 11 + .../Engine/SkillParameterSelectCostFilter.cs | 11 + .../Engine/SkillParameterSelectDamageCount.cs | 18 + ...illParameterSelectEvenChargeCountFilter.cs | 11 + ...lParameterSelectFixedGenericValueFilter.cs | 24 + ...terSelectFixedGenericValueInitialFilter.cs | 20 + .../SkillParameterSelectGenericValueFilter.cs | 29 + .../Engine/SkillParameterSelectIdFilter.cs | 11 + .../SkillParameterSelectLastCostFilter.cs | 11 + .../SkillParameterSelectLastLifeFilter.cs | 11 + ...illParameterSelectLastUsedPpCountFilter.cs | 11 + .../Engine/SkillParameterSelectLifeFilter.cs | 11 + ...killParameterSelectMaxAttackCountFilter.cs | 11 + .../SkillParameterSelectMaxLifeFilter.cs | 11 + ...killParameterSelectOddChargeCountFilter.cs | 11 + .../SkillParameterSelectOffenseFilter.cs | 11 + ...ParameterSelectRandomGenericValueFilter.cs | 18 + ...lParameterSelectRemainActionCountFilter.cs | 42 + ...erSelectRemainActionCountFromSelfFilter.cs | 36 + ...llParameterSelectSkyboundArtCountFilter.cs | 11 + ...ameterSelectSuperSkyboundArtCountFilter.cs | 11 + ...illParameterSelectUnionBurstCountFilter.cs | 11 + ...llParameterSelectWhiteRitualCountFilter.cs | 11 + ...SkillParameterSkillActivatedCountFilter.cs | 11 + .../SkillParameterSkillHealValueFilter.cs | 11 + ...illParameterSkillIdActivatedCountFilter.cs | 18 + .../SkillParameterStrictDestroyFilter.cs | 27 + ...ameterThisTurnSkillActivatedCountFilter.cs | 11 + ...ParameterTurnAcceleratedCardCountFilter.cs | 18 + ...meterTurnAcceleratedCardCountTextFilter.cs | 16 + .../SkillParameterTurnAmountValueFilter.cs | 60 + .../SkillParameterTurnBuffCountFilter.cs | 18 + ...ParameterTurnCausedDamageFromUnitFilter.cs | 45 + .../SkillParameterTurnDamageCountFilter.cs | 18 + ...SkillParameterTurnDamageCountTextFilter.cs | 16 + .../SkillParameterTurnDamageValueFilter.cs | 45 + .../SkillParameterTurnFusionCountFilter.cs | 18 + ...SkillParameterTurnFusionCountTextFilter.cs | 18 + .../SkillParameterTurnHealCountFilter.cs | 18 + .../SkillParameterTurnHealCountTextFilter.cs | 16 + .../SkillParameterTurnHealValueFilter.cs | 18 + .../SkillParameterTurnPlayOtherCountFilter.cs | 22 + .../SkillParameterTurnPpAddCountFilter.cs | 18 + .../Engine/SkillParameterTurnStartLife.cs | 26 + .../SkillParameterTurnSummonCountFilter.cs | 12 + .../Engine/SkillPlayCardTypeFilter.cs | 39 + .../SkillPlayMomentSpellChargeFilter.cs | 11 + .../Engine/SkillPlayMomentTribeFilter.cs | 37 + .../Engine/SkillPreprocessAnyCondition.cs | 40 + .../Engine/SkillPreprocessBurialRite.cs | 158 ++ .../Engine/SkillPreprocessConditionCheck.cs | 66 + .../Engine/SkillPreprocessDamageAfterStop.cs | 49 + .../Engine/SkillPreprocessDamageGiveStop.cs | 33 + .../Engine/SkillPreprocessDestroyTribe.cs | 140 ++ .../Engine/SkillPreprocessDontActivate.cs | 30 + .../Engine/SkillPreprocessDontSelectStart.cs | 15 + .../Engine/SkillPreprocessEvolutionEndStop.cs | 34 + .../SkillPreprocessFixedGenericValue.cs | 54 + .../SkillPreprocessInPlayPeriodOfTime.cs | 29 + .../SkillPreprocessIsActivateSummonCard.cs | 37 + .../Engine/SkillPreprocessNecromance.cs | 77 + .../Engine/SkillPreprocessOncePerAction.cs | 23 + .../Engine/SkillPreprocessOpenCard.cs | 90 + .../Engine/SkillPreprocessPeriodBase.cs | 29 + .../Engine/SkillPreprocessRandomArrayIndex.cs | 41 + .../Engine/SkillPreprocessRandomCount.cs | 28 + .../SkillPreprocessReferencePrevious.cs | 31 + .../SkillPreprocessReflectionAfterStop.cs | 33 + .../SkillPreprocessRemoveAfterAction.cs | 119 + .../SkillPreprocessRemoveFromInPlayStop.cs | 44 + .../SkillPreprocessSelfTurnEndRemove.cs | 58 + ...ActivateCountBySimultaneousBuffingCards.cs | 46 + ...ateCountBySimultaneousDestroyedCardList.cs | 44 + ...ActivateCountBySimultaneousSummonedCard.cs | 48 + .../SkillPreprocessSkillAfterStopBase.cs | 75 + .../Engine/SkillPreprocessSkillId.cs | 24 + ...cessSkillStopAndRemoveByWhenSummonOther.cs | 79 + .../Engine/SkillPreprocessTimesPerBase.cs | 34 + .../Engine/SkillPreprocessTimesPerGame.cs | 7 + .../Engine/SkillPreprocessTimesPerTurn.cs | 104 + .../SkillPreprocessTurnEndPeriodOfStopTime.cs | 45 + .../Engine/SkillPreprocessTurnEndRemove.cs | 40 + .../SkillPreprocessTurnEndSkillAfterStop.cs | 37 + .../Engine/SkillPreprocessTurnEndStop.cs | 43 + .../SkillPreprocessTurnEndStopAndRemove.cs | 51 + .../Engine/SkillPreprocessTurnStartSkill.cs | 60 + ...cessTurnStartSkillAfterPeriodOfStopTime.cs | 39 + .../SkillPreprocessTurnStartSkillAfterStop.cs | 33 + .../Engine/SkillPreprocessTurnStartStop.cs | 45 + .../Engine/SkillPreprocessUnitAttackStop.cs | 43 + .../SkillPreprocessUseEvolutionPoint.cs | 46 + .../Engine/SkillPreprocessUsePp.cs | 32 + .../SkillPreprocessWhenEvolveEndRemove.cs | 44 + ...essWrappingAndAddingSkillActivatedCount.cs | 27 + .../SkillRandomEachSameBaseCardIdFilter.cs | 46 + .../Engine/SkillRandomSelectFilter.cs | 90 + .../Engine/SkillRandomSelectUntilFilter.cs | 61 + ...ResidentPreprocessReturnHandActiveReset.cs | 41 + .../Engine/SkillSelectAllFilter.cs | 14 + .../Engine/SkillSelectIndexFilter.cs | 32 + .../Engine/SkillSelectNullFilter.cs | 15 + .../Engine/SkillSelectableCardFilter.cs | 18 + .../Engine/SkillSpellAndFieldFilter.cs | 11 + SVSim.BattleEngine/Engine/SkillSpellFilter.cs | 11 + .../Engine/SkillSummonMomentTribeFilter.cs | 37 + .../SkillTargetAcceleratedCardfilter.cs | 22 + .../Engine/SkillTargetAttackerFilter.cs | 22 + .../Engine/SkillTargetBanishedCardFilter.cs | 20 + .../SkillTargetBanishedLastTargetFilter.cs | 18 + .../SkillTargetBattleStartDeckFilter.cs | 11 + .../Engine/SkillTargetBeAttackedFilter.cs | 22 + .../SkillTargetBeforeTransformCardFilter.cs | 23 + .../Engine/SkillTargetBurialRiteCardFilter.cs | 23 + .../SkillTargetBurialRiteCardListFilter.cs | 15 + ...lTargetBurialRiteThisTurnCardListFilter.cs | 15 + ...killTargetCantAttackAllLastTargetFilter.cs | 18 + ...killTargetCantAttackAllReturnCardFilter.cs | 21 + .../Engine/SkillTargetCemeteryFilter.cs | 11 + .../SkillTargetChantCountChangeCardsFilter.cs | 20 + .../Engine/SkillTargetChosenCardsFilter.cs | 24 + .../SkillTargetCrystallizedCardfilter.cs | 22 + .../Engine/SkillTargetDamagedCardFilter.cs | 13 + .../SkillTargetDeckBanishedCardListFilter.cs | 13 + .../Engine/SkillTargetDeckDrawCardFilter.cs | 20 + .../Engine/SkillTargetDeckFilter.cs | 11 + .../Engine/SkillTargetDeckSelfFilter.cs | 20 + .../Engine/SkillTargetDestroyedCardFilter.cs | 20 + .../SkillTargetDestroyedCardListFilter.cs | 14 + .../SkillTargetDestroyedLastTargetFilter.cs | 19 + ...llTargetDestroyedThisTurnCardListFilter.cs | 17 + ...argetDestroyedWhenDestroyCardListFilter.cs | 11 + .../SkillTargetDiscardCardListFilter.cs | 13 + .../Engine/SkillTargetDiscardFilter.cs | 20 + ...killTargetDiscardThisTurnCardListFilter.cs | 16 + .../Engine/SkillTargetDiscardedCardFilter.cs | 20 + .../SkillTargetDrewOverHandLimitFilter.cs | 21 + .../Engine/SkillTargetDrewSkillFilter.cs | 28 + .../Engine/SkillTargetEnhanceCardfilter.cs | 22 + ...killTargetEqualOrLessCostFromLastTarget.cs | 38 + .../Engine/SkillTargetEvolutionCardFilter.cs | 20 + .../SkillTargetEvolvedCardListFilter.cs | 11 + .../Engine/SkillTargetFightTargetFilter.cs | 23 + .../SkillTargetFusionIngredientCardsFilter.cs | 20 + ...onIngredientedCardListIncludeThisFusion.cs | 29 + ...argetFusionIngredientedThisTurnCardList.cs | 15 + .../SkillTargetFusionThisTurnCardList.cs | 11 + .../SkillTargetGameAcceleratedCardsFilter.cs | 21 + ...rgetGameAcceleratedCardsOtherSelfFilter.cs | 20 + ...SkillTargetGameAddUpdateDeckCardsFilter.cs | 16 + .../SkillTargetGameCrystallizedCardsFilter.cs | 16 + .../SkillTargetGameDeckDrawCardsFilter.cs | 15 + .../Engine/SkillTargetGameDrawCardsFilter.cs | 16 + ...etGameFusionIngredientedAndDiscardCards.cs | 15 + .../SkillTargetGameFusionIngredientedCards.cs | 15 + .../Engine/SkillTargetGameLeftCardsFilter.cs | 15 + .../Engine/SkillTargetGamePlayCardsFilter.cs | 15 + ...SkillTargetGamePlayCardsOtherSelfFilter.cs | 26 + .../SkillTargetGameQuickAttackCardsFilter.cs | 15 + .../SkillTargetGameSkillActivatedFilter.cs | 16 + .../SkillTargetGameSummonCardsFilter.cs | 16 + .../SkillTargetGameSummonCardsOtherFilter.cs | 27 + .../Engine/SkillTargetGiveDamageCardFilter.cs | 22 + .../SkillTargetHandBanishedCardFilter.cs | 22 + .../SkillTargetHandBanishedCardListFilter.cs | 13 + ...argetHandBanishedThisTurnCardListFilter.cs | 16 + .../Engine/SkillTargetHandFilter.cs | 11 + .../SkillTargetHandOtherOldestFilter.cs | 20 + .../Engine/SkillTargetHandOtherSelfFilter.cs | 21 + .../Engine/SkillTargetHandSelfFilter.cs | 20 + .../Engine/SkillTargetHealingCardFilter.cs | 23 + .../Engine/SkillTargetInHandCardFilter.cs | 20 + .../Engine/SkillTargetInPlayFilter.cs | 11 + .../SkillTargetInPlayOtherSelfFilter.cs | 20 + .../Engine/SkillTargetInPlaySelfFilter.cs | 20 + .../Engine/SkillTargetInplayAndHandFilter.cs | 18 + .../SkillTargetInplayBanishedCardFilter.cs | 22 + ...SkillTargetInplayBanishedCardListFilter.cs | 13 + ...getInplayBanishedThisTurnCardListFilter.cs | 16 + .../SkillTargetInplayBuffingCardsFilter.cs | 20 + .../SkillTargetInplayDebuffingCardsFilter.cs | 20 + .../SkillTargetInplayLastTargetFilter.cs | 18 + ...illTargetInplayMetamorphosedCardsFilter.cs | 11 + .../SkillTargetInplaySelfAndClassFilter.cs | 23 + .../Engine/SkillTargetLastTargetFilter.cs | 50 + .../Engine/SkillTargetLeftCardsFilter.cs | 20 + .../SkillTargetLeftThisTurnCardListFilter.cs | 18 + .../SkillTargetLoadBurialRiteTargetFilter.cs | 17 + .../Engine/SkillTargetLoadTargetFilter.cs | 17 + .../Engine/SkillTargetMainPlaceFilter.cs | 17 + .../Engine/SkillTargetNecromanceFilter.cs | 13 + .../SkillTargetNewerInPlayOtherSelfFilter.cs | 19 + .../Engine/SkillTargetNotDamagedCardFilter.cs | 13 + .../SkillTargetNotUniqueBaseCardIdFilter.cs | 19 + .../Engine/SkillTargetNullFilter.cs | 11 + .../SkillTargetOtherThanBeAttackedFilter.cs | 21 + ...SkillTargetOverCostFromLastTargetFilter.cs | 34 + .../SkillTargetPastSummonCardsFilter.cs | 31 + .../Engine/SkillTargetPlayedCardFilter.cs | 20 + .../Engine/SkillTargetReanimatedCardFilter.cs | 19 + ...lTargetReanimatedThisTurnCardListFilter.cs | 18 + .../SkillTargetReceivedDamageCardFilter.cs | 20 + .../Engine/SkillTargetReturnCardFilter.cs | 20 + .../Engine/SkillTargetReturnSkillFilter.cs | 30 + ...SkillTargetReturnThisTurnCardListFilter.cs | 18 + .../Engine/SkillTargetSelectedCardsFilter.cs | 30 + .../Engine/SkillTargetSelfFilter.cs | 17 + .../Engine/SkillTargetShortageDeckWinCards.cs | 20 + .../SkillTargetSkillDrawCardListFilter.cs | 16 + .../Engine/SkillTargetSkillDrewCardFilter.cs | 14 + .../SkillTargetSkillSummonedCardFilter.cs | 11 + .../SkillTargetSkillSummonedCardIdFilter.cs | 15 + .../SkillTargetSkillUpdateDeckCardFilter.cs | 14 + .../Engine/SkillTargetSummonedCardFilter.cs | 15 + ...rgetThroughFusionIngredientedCardFilter.cs | 35 + .../Engine/SkillTargetTokenDrawCardFilter.cs | 20 + .../Engine/SkillTargetTurnDrawCardsFilter.cs | 15 + .../Engine/SkillTargetTurnPlayCardsFilter.cs | 15 + ...SkillTargetTurnPlayCardsOtherSelfFilter.cs | 39 + .../SkillTargetTurnSummonCardsFilter.cs | 21 + .../SkillTargetTurnTokenDrawSkillIdFilter.cs | 25 + .../SkillTargetUniqueBaseCardIDCardFilter.cs | 11 + .../Engine/SkillTextVariableComareFilter.cs | 26 + SVSim.BattleEngine/Engine/SkillTribeFilter.cs | 24 + .../Engine/SkillTurnDestroyedFilter.cs | 30 + .../Engine/SkillUniqueBaseCardIDCardFilter.cs | 11 + .../Engine/SkillUniqueBaseCostCountFilter.cs | 20 + .../Engine/SkillUniqueTribeCountFilter.cs | 24 + .../Engine/SkillUnitAndAllFieldFilter.cs | 11 + .../Engine/SkillUnitAndChantFieldFilter.cs | 11 + .../Engine/SkillUnitAndClassFilter.cs | 11 + .../Engine/SkillUnitAndNotChantField.cs | 11 + SVSim.BattleEngine/Engine/SkillUnitFilter.cs | 16 + .../SkillUpdateDeckMomentTribeFilter.cs | 37 + .../Engine/SkillUserSelectFilter.cs | 30 + .../Engine/Skill_attack_by_life.cs | 67 + .../Engine/Skill_attract_skill_target.cs | 58 + SVSim.BattleEngine/Engine/Skill_banish.cs | 77 + .../Engine/Skill_bp_modifier.cs | 54 + .../Engine/Skill_can_play_self.cs | 14 + .../Engine/Skill_cant_activate_fanfare.cs | 77 + .../Skill_cant_activate_shortage_deck_win.cs | 70 + .../Engine/Skill_cant_attack.cs | 120 + .../Engine/Skill_cant_evolution.cs | 74 + SVSim.BattleEngine/Engine/Skill_cant_play.cs | 97 + .../Engine/Skill_change_affiliation.cs | 144 ++ .../Engine/Skill_change_cemetery.cs | 47 + .../Engine/Skill_change_rally_count.cs | 21 + .../Engine/Skill_change_skybound_art_count.cs | 34 + .../Skill_change_super_skybound_art_count.cs | 44 + .../Engine/Skill_change_union_burst_count.cs | 41 + .../Engine/Skill_change_white_ritual_stack.cs | 58 + .../Engine/Skill_chant_count_change.cs | 127 ++ SVSim.BattleEngine/Engine/Skill_choice.cs | 16 + ...clear_destroyed_and_discarded_card_list.cs | 26 + .../Engine/Skill_clear_summoned_card_list.cs | 27 + .../Engine/Skill_consume_ep_modifier.cs | 82 + SVSim.BattleEngine/Engine/Skill_copy_skill.cs | 12 + .../Engine/Skill_cost_change.cs | 372 ++++ SVSim.BattleEngine/Engine/Skill_damage.cs | 465 ++++ SVSim.BattleEngine/Engine/Skill_damage_cut.cs | 200 ++ .../Engine/Skill_damage_modifier.cs | 65 + SVSim.BattleEngine/Engine/Skill_destroy.cs | 35 + SVSim.BattleEngine/Engine/Skill_discard.cs | 58 + SVSim.BattleEngine/Engine/Skill_drain.cs | 70 + SVSim.BattleEngine/Engine/Skill_draw.cs | 55 + SVSim.BattleEngine/Engine/Skill_evolve.cs | 134 ++ .../Engine/Skill_evolve_to_other.cs | 14 + SVSim.BattleEngine/Engine/Skill_extra_turn.cs | 38 + .../Engine/Skill_force_avarice.cs | 62 + .../Engine/Skill_force_berserk.cs | 67 + .../Engine/Skill_force_skill_target.cs | 58 + .../Engine/Skill_force_wrath.cs | 62 + SVSim.BattleEngine/Engine/Skill_fusion.cs | 14 + .../Engine/Skill_generic_value_modifier.cs | 64 + SVSim.BattleEngine/Engine/Skill_getoff.cs | 82 + SVSim.BattleEngine/Engine/Skill_geton.cs | 37 + SVSim.BattleEngine/Engine/Skill_guard.cs | 87 + SVSim.BattleEngine/Engine/Skill_heal.cs | 68 + .../Engine/Skill_heal_modifier.cs | 63 + .../Engine/Skill_ignore_guard.cs | 58 + .../Engine/Skill_independent.cs | 62 + .../Engine/Skill_indestructible.cs | 62 + .../Engine/Skill_invoke_emote.cs | 21 + .../Engine/Skill_invoke_skill.cs | 135 ++ .../Engine/Skill_invoke_voice.cs | 18 + SVSim.BattleEngine/Engine/Skill_killer.cs | 63 + .../Skill_life_zero_activate_leon_skill.cs | 18 + SVSim.BattleEngine/Engine/Skill_loop_skill.cs | 49 + SVSim.BattleEngine/Engine/Skill_lose.cs | 126 ++ .../Skill_no_duplication_random_array.cs | 77 + SVSim.BattleEngine/Engine/Skill_none.cs | 16 + ...ot_attached_resident_chant_count_change.cs | 14 + .../Engine/Skill_not_be_attacked.cs | 78 + .../Engine/Skill_not_be_debuffed.cs | 60 + .../Engine/Skill_not_decrease_pp.cs | 45 + .../Engine/Skill_play_count_change.cs | 42 + .../Engine/Skill_possess_ep_modifier.cs | 112 + SVSim.BattleEngine/Engine/Skill_power_down.cs | 276 +++ .../Engine/Skill_power_modifier.cs | 44 + .../Engine/Skill_pp_modifier.cs | 147 ++ SVSim.BattleEngine/Engine/Skill_quick.cs | 64 + .../Engine/Skill_random_array.cs | 126 ++ .../Engine/Skill_random_attack.cs | 33 + SVSim.BattleEngine/Engine/Skill_reflection.cs | 84 + .../Engine/Skill_remove_by_banish.cs | 33 + .../Engine/Skill_remove_by_destroy.cs | 55 + .../Engine/Skill_repeat_skill.cs | 70 + .../Engine/Skill_return_card.cs | 83 + SVSim.BattleEngine/Engine/Skill_rob_skill.cs | 12 + SVSim.BattleEngine/Engine/Skill_rush.cs | 84 + SVSim.BattleEngine/Engine/Skill_select.cs | 14 + SVSim.BattleEngine/Engine/Skill_shield.cs | 120 + .../Engine/Skill_shortage_deck_win.cs | 59 + SVSim.BattleEngine/Engine/Skill_sneak.cs | 68 + .../Engine/Skill_special_lose.cs | 57 + .../Engine/Skill_special_token_draw.cs | 186 ++ .../Engine/Skill_special_win.cs | 75 + .../Engine/Skill_spell_charge.cs | 85 + .../Engine/Skill_stack_white_ritual.cs | 56 + .../Engine/Skill_summon_card.cs | 181 ++ .../Engine/Skill_summon_token.cs | 259 +++ SVSim.BattleEngine/Engine/Skill_token_draw.cs | 462 ++++ .../Engine/Skill_token_draw_modifier.cs | 67 + SVSim.BattleEngine/Engine/Skill_trigger.cs | 50 + .../Engine/Skill_turn_start_fixed_pp.cs | 48 + SVSim.BattleEngine/Engine/Skill_unite.cs | 106 + .../Engine/Skill_untouchable.cs | 69 + .../Engine/Skill_update_deck.cs | 298 +++ .../Engine/SkyboundArtCountAddModifier.cs | 21 + .../Engine/SpecialArenaField.cs | 100 + .../Engine/SpecialCrystalInfo.cs | 53 + SVSim.BattleEngine/Engine/SpellBattleCard.cs | 135 ++ .../Engine/SpellSelectableCardFilter.cs | 16 + SVSim.BattleEngine/Engine/SpringPosition.cs | 113 + .../Engine/Sqlite3Plugin/DBProxy.cs | 152 ++ .../Engine/Sqlite3Plugin/PreparedQuery.cs | 57 + .../Engine/Sqlite3Plugin/Query.cs | 90 + SVSim.BattleEngine/Engine/StageField.cs | 277 +++ .../Engine/StartPickMultiCardVfx.cs | 89 + SVSim.BattleEngine/Engine/StockEmitMgr.cs | 116 + SVSim.BattleEngine/Engine/StoryCardPanel.cs | 20 + SVSim.BattleEngine/Engine/StoryChapterData.cs | 404 ++++ SVSim.BattleEngine/Engine/StoryFinish.cs | 4 + .../Engine/StoryFinishDetail.cs | 29 + SVSim.BattleEngine/Engine/StoryInfo.cs | 17 + .../Engine/StoryLeaderSelect.cs | 18 + .../Engine/StoryLeaderSelectData.cs | 11 + .../Engine/StoryNextSceneSelector.cs | 252 +++ .../Engine/StoryReportEndAgent.cs | 11 + .../Engine/StoryResultAnimationAgent.cs | 206 ++ .../Engine/StoryResultAnimationHandler.cs | 22 + .../Engine/StoryResultReporter.cs | 107 + SVSim.BattleEngine/Engine/StorySectionData.cs | 172 ++ .../SuperSkyboundArtCountAddModifier.cs | 21 + SVSim.BattleEngine/Engine/TaskManager.cs | 181 ++ SVSim.BattleEngine/Engine/TempleField.cs | 130 ++ SVSim.BattleEngine/Engine/TempleNightField.cs | 11 + SVSim.BattleEngine/Engine/TurnPanelControl.cs | 242 ++ SVSim.BattleEngine/Engine/TweenColor.cs | 153 ++ SVSim.BattleEngine/Engine/TweenRotation.cs | 93 + SVSim.BattleEngine/Engine/UIBase_Textuer.cs | 8 + SVSim.BattleEngine/Engine/UICardList.cs | 1430 ++++++++++++ SVSim.BattleEngine/Engine/UIKeyNavigation.cs | 321 +++ SVSim.BattleEngine/Engine/UIOrthoCamera.cs | 28 + SVSim.BattleEngine/Engine/UIPopupList.cs | 933 ++++++++ SVSim.BattleEngine/Engine/UITweenAlpha.cs | 242 ++ .../Engine/UnionBurstCountAddModifier.cs | 21 + SVSim.BattleEngine/Engine/UnitBattleCard.cs | 516 +++++ SVSim.BattleEngine/Engine/User.cs | 8 + SVSim.BattleEngine/Engine/UserCard.cs | 16 + SVSim.BattleEngine/Engine/UserConfig.cs | 50 + SVSim.BattleEngine/Engine/UserCrystalCount.cs | 92 + SVSim.BattleEngine/Engine/UserDegree.cs | 14 + SVSim.BattleEngine/Engine/UserEmblem.cs | 14 + SVSim.BattleEngine/Engine/UserFriend.cs | 38 + SVSim.BattleEngine/Engine/UserInfo.cs | 12 + .../Engine/UserPromotionMatch.cs | 20 + SVSim.BattleEngine/Engine/UserRank.cs | 78 + SVSim.BattleEngine/Engine/UserTutorial.cs | 66 + .../Engine/UtilityDrumrollScroll.cs | 162 ++ .../Engine/VellsarDesertField.cs | 84 + SVSim.BattleEngine/Engine/VideoHostingUtil.cs | 790 +++++++ .../Engine/VirtualBattleEnemy.cs | 71 + .../Engine/VirtualBattlePlayer.cs | 71 + .../Engine/VoiceDictionaries.cs | 152 ++ SVSim.BattleEngine/Engine/VolcanoField.cs | 144 ++ SVSim.BattleEngine/Engine/VoteData.cs | 24 + .../Engine/WatchOperateReceive.cs | 17 + .../Engine/WatchOperationCollection.cs | 494 +++++ .../Engine/WatchTouchControl.cs | 122 + .../Engine/WatchTurnEndTimeController.cs | 27 + .../Wizard.AutoTest/AutoTestBattleMgr.cs | 103 + .../Wizard.Battle.Card/IVirtualBattleCard.cs | 6 + .../Wizard.Battle.Mulligan/MulliganMgrBase.cs | 152 ++ .../MulliganOperateControl.cs | 510 +++++ .../NetworkMulliganMgr.cs | 133 ++ .../OpponentMulliganView.cs | 44 + .../PlayerMulliganCardSortOutVfx.cs | 52 + .../SingleMulliganMgr.cs | 74 + .../OperationSimulator.cs | 179 ++ .../SimulateRandomSelectFilter.cs | 39 + .../TurnEndOperationCommand.cs | 18 + .../Wizard.Battle.Phase/LoadingPhase.cs | 32 + .../Engine/Wizard.Battle.Phase/MainPhase.cs | 169 ++ .../Wizard.Battle.Phase/MulliganPhaseBase.cs | 112 + .../NetworkMulliganPhase.cs | 149 ++ .../Wizard.Battle.Phase/OpeningPhase.cs | 32 + .../Wizard.Battle.Phase/PhaseCreatorBase.cs | 46 + .../RecoveryAfterMulliganPhase.cs | 161 ++ ...ecoveryNetworkBeforeSubmitMulliganPhase.cs | 14 + .../Class3dCharacterBase.cs | 532 +++++ .../ClassCharacterBase.cs | 202 ++ .../HighRankSpineClassCharacter.cs | 447 ++++ .../SpineObject.cs | 379 ++++ .../Debug722006NullVfx.cs | 8 + .../OperationRecorderBase.cs | 188 ++ .../RecoveryManagerBase.cs | 281 +++ .../RecoveryRecordManagerBase.cs | 183 ++ .../Wizard.Battle.Sound/LeaderSoundManager.cs | 51 + .../Wizard.Battle.Touch/ITouchProcessor.cs | 15 + .../Wizard.Battle.UI/IClassInfomationUI.cs | 31 + .../Engine/Wizard.Battle.UI/LogType.cs | 88 + .../Engine/Wizard.Battle.UI/SkillGainType.cs | 47 + .../HandCardFrameEffectType.cs | 12 + .../Wizard.Battle.View/HandParameter.cs | 65 + .../Wizard.Battle.View/IBattleCardView.cs | 185 ++ .../Wizard.Battle.View/IBattlePlayerView.cs | 193 ++ .../IClassBattleCardView.cs | 18 + .../Engine/Wizard.Battle.View/IPlayerView.cs | 126 ++ .../NetworkOpponentInnerOptionsBuilder.cs | 24 + .../Wizard.Battle/NullInnerOptionsBuilder.cs | 38 + .../PlayerInnerOptionsBuilder.cs | 31 + .../Engine/Wizard.Bingo/BingoDrawTask.cs | 117 + .../Engine/Wizard.Bingo/BingoInfoTask.cs | 224 ++ .../CardSelectListUIBase.cs | 888 ++++++++ .../CardSelectListUI_State_CardDrag.cs | 629 ++++++ .../CardSelectListUI_State_Edit.cs | 350 +++ .../Wizard.DeckCardEdit/DeckCardEditUI.cs | 1961 +++++++++++++++++ .../Engine/Wizard.DeckCardEdit/DeckSave.cs | 278 +++ .../FirstDisplayPageIndexGetterBase.cs | 22 + .../IFirstDisplayPageIndexGetter.cs | 8 + .../QuestFirstDisplayPageIndexGetter.cs | 33 + .../Wizard.Dialog.Setting/ItemButton.cs | 121 + .../Engine/Wizard.Dialog.Setting/ItemGrid.cs | 52 + .../Engine/Wizard.Dialog.Setting/ItemLabel.cs | 40 + .../Wizard.Dialog.Setting/ItemSelect.cs | 305 +++ .../Wizard.Dialog.Setting/ItemSlider.cs | 116 + .../Wizard.Dialog.Setting/ItemToggle.cs | 232 ++ .../Wizard.Dialog.Setting/SettingBase.cs | 688 ++++++ .../Engine/Wizard.ErrorDialog/Dialog.cs | 120 + .../Wizard.Lottery/LotteryApplyDialog.cs | 44 + .../Wizard.Lottery/LotteryLoadTaskData.cs | 78 + .../Wizard.Lottery/LotteryMissionData.cs | 57 + .../CandidateCard.cs | 32 + .../CandidateChaos.cs | 85 + .../CandidateClass.cs | 56 + .../Deck.cs | 47 + .../EntryInfo.cs | 26 + .../MyMasterRanking.cs | 56 + .../RankingPeriod.cs | 70 + .../RankingPeriodList.cs | 46 + .../RankingUser.cs | 57 + .../ItemAcquireHistory.cs | 33 + .../BattleResult.cs | 27 + .../CandidateCardInfo.cs | 24 + .../Entry.cs | 24 + .../Finish.cs | 11 + .../FinishDetail.cs | 10 + .../TwoPickInfo.cs | 154 ++ .../DoMatchingResponse.cs | 20 + .../BuildDeckBuyTask.cs | 85 + .../BuildDeckProductInfo.cs | 83 + .../BuildDeckPurchaseInfo.cs | 40 + .../BuildDeckSeriesPurchaseInfo.cs | 20 + .../ItemPurchaseBuyTask.cs | 35 + .../ItemPurchaseData.cs | 30 + .../ItemPurchaseInfo.cs | 10 + .../MonthlyRanking.cs | 29 + .../MyMasterPointHistories.cs | 44 + .../Ranking.cs | 33 + .../SkinBuyMultiRewardTask.cs | 34 + .../SkinBuyMultiTask.cs | 38 + .../SkinBuySingleTask.cs | 38 + .../SkinProductInfo.cs | 38 + .../SkinPurchaseInfo.cs | 10 + .../SkinSeriesPurchaseInfo.cs | 54 + .../SleeveProductInfo.cs | 16 + .../SleevePurchaseInfo.cs | 10 + .../SleeveSeriesPurchaseInfo.cs | 14 + .../GachaPointExchangeInfoTask.cs | 51 + .../GachaPointExchangeTask.cs | 38 + .../SpotCardExchangeInfoTask.cs | 77 + .../SpotCardExchangeTask.cs | 35 + .../ItemAcquireHistoryInfo.cs | 24 + .../Engine/Wizard/AIAccelerate.cs | 32 + .../Engine/Wizard/AIAfterAttackBanish.cs | 47 + .../Engine/Wizard/AIAfterAttackDraw.cs | 32 + .../Engine/Wizard/AIAfterAttackEvo.cs | 53 + .../Engine/Wizard/AIAfterAttackHeal.cs | 38 + .../Engine/Wizard/AIAfterClashDamage.cs | 46 + .../Engine/Wizard/AIAfterClashHeal.cs | 41 + .../Engine/Wizard/AIAllyDiscardBonus.cs | 37 + .../AIAttachEventToBattleModuleUtility.cs | 343 +++ .../AIAttachedTagLeaveStopInformation.cs | 26 + .../AIAttachedTagStopPreprocessOption.cs | 11 + .../AIAttachedTagTurnEndStopInformation.cs | 26 + .../AIAttachedTagTurnStartStopInformation.cs | 26 + .../Engine/Wizard/AIAttackAddDeck.cs | 33 + .../Engine/Wizard/AIAttackAttachTag.cs | 57 + .../Engine/Wizard/AIAttackAttackableCount.cs | 51 + .../Engine/Wizard/AIAttackBreakAttackTwice.cs | 16 + .../Engine/Wizard/AIAttackBreakDamage.cs | 46 + .../Engine/Wizard/AIAttackBreakEvo.cs | 20 + .../Engine/Wizard/AIAttackBreakRecoverPp.cs | 28 + .../Engine/Wizard/AIAttackBuff.cs | 100 + .../Engine/Wizard/AIAttackDamage.cs | 120 + .../Engine/Wizard/AIAttackDestroy.cs | 95 + .../Engine/Wizard/AIAttackDiscard.cs | 67 + .../Engine/Wizard/AIAttackEvo.cs | 35 + .../Engine/Wizard/AIAttackHandBuff.cs | 100 + .../Engine/Wizard/AIAttackMove.cs | 20 + .../Engine/Wizard/AIAttackOrClashBanish.cs | 57 + .../Wizard/AIAttackOrClashBarrierBase.cs | 76 + .../Wizard/AIAttackOrClashDamageClip.cs | 54 + .../Engine/Wizard/AIAttackOrClashHeal.cs | 41 + .../Wizard/AIAttackOrClashKeywordSkill.cs | 38 + .../Wizard/AIAttackOrClashRemoveSkill.cs | 24 + .../Engine/Wizard/AIAttackOrClashRemoveTag.cs | 36 + .../Engine/Wizard/AIAttackOrClashShield.cs | 52 + .../Wizard/AIAttackOrClashSpellboost.cs | 51 + .../Engine/Wizard/AIAttackOrClashToken.cs | 45 + .../Engine/Wizard/AIAttackSetStatus.cs | 118 + .../Wizard/AIAttackSimulationUtility.cs | 156 ++ .../Wizard/AIAttackSubtractCountdown.cs | 51 + .../Engine/Wizard/AIAttackTagSimulator.cs | 115 + .../AIAutoEvolutionSimulationUtility.cs | 87 + .../Engine/Wizard/AIBanishAttachTag.cs | 57 + .../AIBarrierAfterDamageStopInformation.cs | 23 + .../Wizard/AIBarrierLeaveStopInformation.cs | 37 + .../Wizard/AIBarrierSimulationUtility.cs | 296 +++ .../Wizard/AIBarrierStopPreprocessOption.cs | 12 + .../Wizard/AIBarrierTurnEndStopInformation.cs | 33 + .../AIBarrierTurnStartStopInformation.cs | 33 + .../Engine/Wizard/AIBattleInfoReceiver.cs | 121 + .../Wizard/AIBattleSimulationLauncher.cs | 75 + .../Engine/Wizard/AIBattleStartData.cs | 13 + .../Engine/Wizard/AIBattleStartDetail.cs | 28 + .../Engine/Wizard/AIBattleStartTask.cs | 54 + .../Wizard/AIBestFusionPatternCalculator.cs | 188 ++ .../AIBonusArgumentWithIgnoreInBattle.cs | 42 + .../Engine/Wizard/AIBounceDamage.cs | 53 + .../Engine/Wizard/AIBreakAddStack.cs | 52 + .../Engine/Wizard/AIBreakAttachTag.cs | 57 + .../Engine/Wizard/AIBreakBuff.cs | 71 + .../Engine/Wizard/AIBreakDamage.cs | 54 + .../Engine/Wizard/AIBreakDestroy.cs | 48 + .../Engine/Wizard/AIBreakHeal.cs | 51 + .../Wizard/AIBreakRecoverAttackableCount.cs | 36 + .../Engine/Wizard/AIBreakRecoverPp.cs | 38 + .../Engine/Wizard/AIBreakSetLeaderMaxLife.cs | 34 + .../Engine/Wizard/AIBuffBuff.cs | 71 + .../Engine/Wizard/AIBuffDamage.cs | 63 + .../Engine/Wizard/AIBuffDestroy.cs | 48 + .../Engine/Wizard/AIBuffDraw.cs | 30 + SVSim.BattleEngine/Engine/Wizard/AIBuffEvo.cs | 20 + .../Engine/Wizard/AIBuffHeal.cs | 50 + .../Engine/Wizard/AIBuffRecoverPp.cs | 36 + .../Engine/Wizard/AIBuffRush.cs | 51 + .../Engine/Wizard/AIBuffShield.cs | 54 + .../Engine/Wizard/AIBuffSimulationUtility.cs | 110 + .../Wizard/AIBuffStopPreprocessOption.cs | 9 + .../Engine/Wizard/AIBuffToken.cs | 38 + .../Wizard/AIBuffTurnEndStopInformation.cs | 18 + .../Engine/Wizard/AIBurialRite.cs | 47 + .../Wizard/AIBurialRiteSimulationUtility.cs | 115 + .../Engine/Wizard/AIChangeInplayAttachTag.cs | 47 + .../Wizard/AIChangeInplayCannotAttack.cs | 42 + .../Engine/Wizard/AIChangeInplayCannotPlay.cs | 53 + .../Wizard/AIChangeInplayFixRemoveType.cs | 74 + .../AIChangeInplayImmediateBarrierBase.cs | 62 + .../AIChangeInplayImmediateDamageClip.cs | 99 + .../AIChangeInplayImmediateDamageCut.cs | 43 + .../AIChangeInplayImmediateDamageModifier.cs | 67 + .../AIChangeInplayImmediateIndestructible.cs | 37 + .../AIChangeInplayImmediateKeywordSkill.cs | 86 + .../AIChangeInplayImmediateLifeLowerLimit.cs | 31 + .../Wizard/AIChangeInplayImmediateShield.cs | 31 + .../Engine/Wizard/AIChangePpTotalBuff.cs | 60 + .../Engine/Wizard/AIChoiceBrave.cs | 27 + .../Engine/Wizard/AIChoiceTagArgument.cs | 84 + .../Engine/Wizard/AIChoiceTransform.cs | 25 + .../Engine/Wizard/AIChoiceTransformUtility.cs | 45 + .../Engine/Wizard/AIClashBuff.cs | 18 + .../Engine/Wizard/AIClashDamage.cs | 119 + .../Engine/Wizard/AIClashDestroy.cs | 52 + .../Engine/Wizard/AIConsoleUtility.cs | 24 + .../Engine/Wizard/AICrystalize.cs | 28 + .../Engine/Wizard/AIDamagedBonus.cs | 44 + .../Engine/Wizard/AIDamagedBuff.cs | 63 + .../Engine/Wizard/AIDamagedCantUnderAttack.cs | 17 + .../Engine/Wizard/AIDamagedDamage.cs | 99 + .../Engine/Wizard/AIDamagedHeal.cs | 63 + .../Engine/Wizard/AIDamagedToken.cs | 38 + .../Engine/Wizard/AIDelayTurnEndTime.cs | 42 + .../AIDelayTurnEndTimePolicyCollection.cs | 23 + .../Engine/Wizard/AIDiscardDamage.cs | 55 + .../Engine/Wizard/AIDiscardHeal.cs | 41 + .../Engine/Wizard/AIDiscardUtility.cs | 259 +++ .../Engine/Wizard/AIDiscardedToken.cs | 43 + .../Engine/Wizard/AIEarthRite.cs | 48 + .../Engine/Wizard/AIEmoteOnTurnTransition.cs | 56 + .../Engine/Wizard/AIEmoteUtility.cs | 9 + SVSim.BattleEngine/Engine/Wizard/AIEnhance.cs | 18 + .../Wizard/AIEvaluateBonusFromOhterUtility.cs | 259 +++ .../Engine/Wizard/AIEvoAddDeck.cs | 69 + .../Engine/Wizard/AIEvoAddStack.cs | 69 + .../Engine/Wizard/AIEvoAttachTag.cs | 105 + .../Engine/Wizard/AIEvoAttackableCount.cs | 60 + .../Engine/Wizard/AIEvoBanish.cs | 61 + .../Engine/Wizard/AIEvoBounce.cs | 53 + SVSim.BattleEngine/Engine/Wizard/AIEvoBuff.cs | 88 + .../Engine/Wizard/AIEvoChangeCost.cs | 86 + .../Engine/Wizard/AIEvoDamage.cs | 122 + .../Engine/Wizard/AIEvoDamageCut.cs | 65 + .../Engine/Wizard/AIEvoDestroy.cs | 54 + .../Engine/Wizard/AIEvoDiscard.cs | 77 + SVSim.BattleEngine/Engine/Wizard/AIEvoEvo.cs | 37 + .../Engine/Wizard/AIEvoGiveBasicSkill.cs | 83 + .../Engine/Wizard/AIEvoHandBuff.cs | 100 + .../Engine/Wizard/AIEvoHandMetamorphose.cs | 62 + .../Engine/Wizard/AIEvoHandSelect.cs | 32 + SVSim.BattleEngine/Engine/Wizard/AIEvoHeal.cs | 64 + .../Engine/Wizard/AIEvoMetamorphose.cs | 75 + .../Engine/Wizard/AIEvoReanimate.cs | 51 + .../Engine/Wizard/AIEvoRecoverPp.cs | 52 + .../Engine/Wizard/AIEvoSetLeaderMaxLife.cs | 56 + .../Engine/Wizard/AIEvoSetStatus.cs | 81 + .../Engine/Wizard/AIEvoShield.cs | 70 + .../Engine/Wizard/AIEvoSubtractCountdown.cs | 71 + .../Engine/Wizard/AIEvoTagArgument.cs | 109 + .../Engine/Wizard/AIEvoToken.cs | 59 + .../Engine/Wizard/AIEvoTokenDraw.cs | 49 + .../Engine/Wizard/AIEvolMove.cs | 22 + .../Wizard/AIEvolveToOtherTagArgument.cs | 70 + .../Engine/Wizard/AIEvolvedAttackable.cs | 17 + .../Engine/Wizard/AIEvolvedAttackableCount.cs | 36 + .../Engine/Wizard/AIEvolvedSkill.cs | 38 + .../AIFilteringActivateCountArgument.cs | 25 + .../Engine/Wizard/AIFilteringUtility.cs | 833 +++++++ .../Wizard/AIFiltersAndSelectTypeArgument.cs | 68 + .../Engine/Wizard/AIFiltersArgument.cs | 77 + .../Engine/Wizard/AIFirstMoveBonus.cs | 53 + .../Wizard/AIFunctionResultHashCalculator.cs | 32 + SVSim.BattleEngine/Engine/Wizard/AIFusion.cs | 26 + .../Engine/Wizard/AIFusionDraw.cs | 31 + .../Engine/Wizard/AIFusionMetamorphose.cs | 39 + .../Engine/Wizard/AIFusionMove.cs | 22 + .../Engine/Wizard/AIGameStartAttachTag.cs | 60 + .../Engine/Wizard/AIGenerateTag.cs | 68 + .../Engine/Wizard/AIGetOffEvo.cs | 32 + .../Engine/Wizard/AIGetOffMetamorphose.cs | 67 + SVSim.BattleEngine/Engine/Wizard/AIGetOn.cs | 16 + .../Engine/Wizard/AIGetOnBanish.cs | 43 + .../Engine/Wizard/AIGetOnDamage.cs | 52 + .../Engine/Wizard/AIGetOnEvo.cs | 39 + .../Engine/Wizard/AIGetOnSimulationUtility.cs | 120 + .../Engine/Wizard/AIGiveSkill.cs | 26 + .../Engine/Wizard/AIGlobalEmptyList.cs | 25 + .../Engine/Wizard/AIHandPtnCalculator.cs | 145 ++ .../Engine/Wizard/AIHealAttachTag.cs | 98 + .../Engine/Wizard/AIHealBuff.cs | 68 + .../Engine/Wizard/AIHealDamage.cs | 59 + SVSim.BattleEngine/Engine/Wizard/AIHealEvo.cs | 33 + .../Engine/Wizard/AIHealHeal.cs | 46 + .../Engine/Wizard/AIHealToken.cs | 39 + .../Engine/Wizard/AIInstantAttackUtility.cs | 391 ++++ .../Engine/Wizard/AILastwordAddCemetery.cs | 27 + .../Engine/Wizard/AILastwordAddDeck.cs | 33 + .../Engine/Wizard/AILastwordAttachTag.cs | 77 + .../Engine/Wizard/AILastwordBanish.cs | 32 + .../Engine/Wizard/AILastwordBuff.cs | 57 + .../Engine/Wizard/AILastwordDamage.cs | 45 + .../Engine/Wizard/AILastwordDamageClip.cs | 60 + .../Engine/Wizard/AILastwordDestroy.cs | 34 + .../Engine/Wizard/AILastwordDraw.cs | 30 + .../Engine/Wizard/AILastwordEvo.cs | 48 + .../Engine/Wizard/AILastwordHeal.cs | 41 + .../Engine/Wizard/AILastwordMetamorphose.cs | 59 + .../Engine/Wizard/AILastwordReanimate.cs | 69 + .../Engine/Wizard/AILastwordRemoveSkill.cs | 37 + .../Engine/Wizard/AILastwordSetStatus.cs | 58 + .../Engine/Wizard/AILastwordShield.cs | 51 + .../Wizard/AILastwordSubtractCountdown.cs | 55 + .../Engine/Wizard/AILastwordToken.cs | 89 + .../Wizard/AILeaderLifeEvaluationUtility.cs | 49 + .../Engine/Wizard/AILeaveAttachTag.cs | 57 + .../Engine/Wizard/AILeaveBanish.cs | 32 + .../Engine/Wizard/AILeaveDamage.cs | 51 + .../Engine/Wizard/AILeaveHeal.cs | 56 + .../Engine/Wizard/AILeaveToken.cs | 43 + .../Engine/Wizard/AILethalSimulator.cs | 321 +++ .../Engine/Wizard/AIMathematicsLibrary.cs | 129 ++ .../Engine/Wizard/AIModifyValue.cs | 34 + SVSim.BattleEngine/Engine/Wizard/AIMove.cs | 13 + .../Engine/Wizard/AINecromance.cs | 65 + .../Engine/Wizard/AINecromanceAddCemetery.cs | 31 + .../Engine/Wizard/AINecromanceAttachTag.cs | 68 + .../Engine/Wizard/AINecromanceDamage.cs | 67 + .../Engine/Wizard/AINecromanceHeal.cs | 58 + .../Engine/Wizard/AIOtherAttackAttachTag.cs | 65 + .../Engine/Wizard/AIOtherAttackBuff.cs | 124 ++ .../Engine/Wizard/AIOtherAttackDamage.cs | 99 + .../Engine/Wizard/AIOtherAttackHeal.cs | 51 + .../Engine/Wizard/AIOtherAttackRemoveTag.cs | 44 + .../Engine/Wizard/AIOtherAttackToken.cs | 39 + .../Engine/Wizard/AIOtherBanishAddCemetery.cs | 27 + .../Engine/Wizard/AIOtherBanishToken.cs | 39 + .../Engine/Wizard/AIOtherBattleBonusRate.cs | 53 + .../Engine/Wizard/AIOtherBreakBonus.cs | 33 + .../Engine/Wizard/AIOtherDamagedBanish.cs | 37 + .../Engine/Wizard/AIOtherDamagedDamage.cs | 87 + .../Engine/Wizard/AIOtherDamagedHeal.cs | 49 + .../Wizard/AIOtherDamagedSetLeaderMaxLife.cs | 34 + .../Wizard/AIOtherDamagedSubtractCountdown.cs | 50 + .../Engine/Wizard/AIOtherEvoAddCemetery.cs | 42 + .../Engine/Wizard/AIOtherEvoAttachTag.cs | 57 + .../Engine/Wizard/AIOtherEvoBanish.cs | 49 + .../Engine/Wizard/AIOtherEvoBonus.cs | 24 + .../Engine/Wizard/AIOtherEvoBounce.cs | 53 + .../Engine/Wizard/AIOtherEvoBuff.cs | 82 + .../Engine/Wizard/AIOtherEvoDamage.cs | 100 + .../Engine/Wizard/AIOtherEvoDestroy.cs | 109 + .../Engine/Wizard/AIOtherEvoDraw.cs | 46 + .../Engine/Wizard/AIOtherEvoEvo.cs | 47 + .../Engine/Wizard/AIOtherEvoHeal.cs | 59 + .../Engine/Wizard/AIOtherEvoShield.cs | 56 + .../Wizard/AIOtherEvoSubtractCountdown.cs | 63 + .../Engine/Wizard/AIOtherEvoTagArgument.cs | 70 + .../Engine/Wizard/AIOtherEvoToken.cs | 55 + .../Engine/Wizard/AIOtherEvoTokenDraw.cs | 51 + .../Engine/Wizard/AIOtherLeaveDamage.cs | 64 + .../Engine/Wizard/AIOtherLeaveToken.cs | 39 + .../Engine/Wizard/AIOtherPlayBonus.cs | 33 + .../Engine/Wizard/AIOtherPlayBonusRate.cs | 32 + .../Wizard/AIOtherPlayoutDamageBonus.cs | 32 + .../Engine/Wizard/AIOtherSummonAddCemetery.cs | 35 + .../Engine/Wizard/AIOtherSummonAttachTag.cs | 74 + .../Engine/Wizard/AIOtherSummonBanish.cs | 53 + .../Engine/Wizard/AIOtherSummonBarrierBase.cs | 57 + .../Engine/Wizard/AIOtherSummonBuff.cs | 78 + .../Engine/Wizard/AIOtherSummonDamage.cs | 56 + .../Engine/Wizard/AIOtherSummonDamageClip.cs | 31 + .../Engine/Wizard/AIOtherSummonDamageCut.cs | 31 + .../Engine/Wizard/AIOtherSummonDestroy.cs | 48 + .../Engine/Wizard/AIOtherSummonDraw.cs | 33 + .../Engine/Wizard/AIOtherSummonEvo.cs | 27 + .../Engine/Wizard/AIOtherSummonHeal.cs | 48 + .../Wizard/AIOtherSummonKeywordSkill.cs | 136 ++ .../Wizard/AIOtherSummonSubtractCountdown.cs | 57 + .../Engine/Wizard/AIOtherWhenPlayAttachTag.cs | 66 + .../Engine/Wizard/AIOtherWhenPlayBounce.cs | 71 + .../Engine/Wizard/AIOtherWhenPlayBuff.cs | 104 + .../Engine/Wizard/AIOtherWhenPlayDamage.cs | 95 + .../Engine/Wizard/AIOtherWhenPlayDestroy.cs | 79 + .../Engine/Wizard/AIOtherWhenPlayEvo.cs | 31 + .../Wizard/AIOtherWhenPlayKeywordSkill.cs | 37 + .../Engine/Wizard/AIOtherWhenPlayRecoverPp.cs | 57 + .../Engine/Wizard/AIOtherWhenPlayRemoveTag.cs | 45 + .../Wizard/AIOtherWhenPlayTagArgument.cs | 44 + .../Engine/Wizard/AIOtherWhenPlayToken.cs | 68 + .../Engine/Wizard/AIPlayBreak.cs | 20 + .../Wizard/AIPlayCardSimulationUtility.cs | 251 +++ .../Engine/Wizard/AIPlayMove.cs | 23 + .../Engine/Wizard/AIPlayOnSkillUtility.cs | 53 + .../Engine/Wizard/AIPlayOutChecker.cs | 264 +++ .../Engine/Wizard/AIPlayPtnUtility.cs | 57 + .../Engine/Wizard/AIPlaySkipIfEvo.cs | 22 + .../Engine/Wizard/AIPlaySkipTagArgument.cs | 16 + .../Engine/Wizard/AIPlaySkipWithAction.cs | 28 + .../Wizard/AIPlaySkipWithActionIfEvo.cs | 33 + .../Engine/Wizard/AIPlaySkipWithEvo.cs | 22 + .../Wizard/AIPlaySkipWithFilteredTargets.cs | 40 + .../Wizard/AIPlayTagInitializingUtility.cs | 303 +++ .../Wizard/AIPlayTokenSimulationUtility.cs | 216 ++ .../Engine/Wizard/AIPlayptnBaseStatsRate.cs | 28 + .../Wizard/AIPlayptnBaseStatsRateUtility.cs | 33 + .../Wizard/AIPreprocessSimulationUtility.cs | 179 ++ .../Engine/Wizard/AIRealBattleCardSearcher.cs | 113 + .../Engine/Wizard/AIReincarnationUtility.cs | 94 + .../Engine/Wizard/AIRemoveByDestroy.cs | 21 + .../Engine/Wizard/AIRemoveSkill.cs | 79 + .../Engine/Wizard/AIRemoveTagUtility.cs | 25 + .../Engine/Wizard/AIResonanceDamage.cs | 40 + .../Wizard/AIResonanceGiveBasicSkill.cs | 38 + .../Engine/Wizard/AIResonanceHeal.cs | 41 + .../Wizard/AIRuleBaseBattleSimulator.cs | 103 + .../Engine/Wizard/AIScriptArgumentToken.cs | 51 + .../Wizard/AIScriptExpressionCalculator.cs | 1384 ++++++++++++ .../Engine/Wizard/AIScriptFunctionToken.cs | 33 + .../Engine/Wizard/AIScriptIDToken.cs | 33 + .../Engine/Wizard/AIScriptNumericToken.cs | 14 + .../Wizard/AIScriptOperatorSymbolToken.cs | 14 + .../Engine/Wizard/AIScriptParser.cs | 1454 ++++++++++++ .../Engine/Wizard/AIScriptTextToken.cs | 30 + .../Engine/Wizard/AIScriptVariableToken.cs | 26 + .../Wizard/AISelectLogicArgumentBase.cs | 64 + .../Engine/Wizard/AISelectTargetPattern.cs | 7 + .../Engine/Wizard/AISetTribe.cs | 25 + .../Engine/Wizard/AISimulationUtility.cs | 746 +++++++ .../Engine/Wizard/AISkillSimulationUtility.cs | 495 +++++ SVSim.BattleEngine/Engine/Wizard/AIStack.cs | 43 + .../Engine/Wizard/AIStackCountUtility.cs | 20 + .../Engine/Wizard/AISummonAttachTag.cs | 83 + .../Engine/Wizard/AISummonBanAttack.cs | 43 + .../Engine/Wizard/AISummonBanish.cs | 55 + .../Engine/Wizard/AISummonBuff.cs | 89 + .../Engine/Wizard/AISummonDamage.cs | 58 + .../Engine/Wizard/AISummonDestroy.cs | 61 + .../Engine/Wizard/AISummonEvo.cs | 25 + .../Engine/Wizard/AISummonHeal.cs | 46 + .../Engine/Wizard/AISummonKeywordSkill.cs | 68 + .../Engine/Wizard/AISummonTokenUtility.cs | 520 +++++ .../Wizard/AITargetSelectFilteringUtility.cs | 182 ++ .../Wizard/AITargetSelectTagArgument.cs | 69 + .../Engine/Wizard/AITargetSelectUtility.cs | 184 ++ .../Engine/Wizard/AITestGlobal.cs | 6 + .../Wizard/AITimeOverAttackSimulator.cs | 301 +++ .../Engine/Wizard/AITokenDrawUtility.cs | 42 + ...ITokenIdHolderCandidateRangeInformation.cs | 105 + .../Engine/Wizard/AITribeSimulationUtility.cs | 55 + .../AITriggerAndTargetFiltersTagBase.cs | 118 + .../Engine/Wizard/AITurnEndAddDeck.cs | 58 + .../Engine/Wizard/AITurnEndAttachTag.cs | 89 + .../Engine/Wizard/AITurnEndBanAttack.cs | 53 + .../Engine/Wizard/AITurnEndBanish.cs | 51 + .../Engine/Wizard/AITurnEndBarrierBase.cs | 63 + .../Engine/Wizard/AITurnEndBounce.cs | 60 + .../Engine/Wizard/AITurnEndBuff.cs | 146 ++ .../Engine/Wizard/AITurnEndDamage.cs | 193 ++ .../Engine/Wizard/AITurnEndDamageClip.cs | 31 + .../Engine/Wizard/AITurnEndDamageCut.cs | 31 + .../Engine/Wizard/AITurnEndDestroy.cs | 81 + .../Engine/Wizard/AITurnEndDiscard.cs | 65 + .../Engine/Wizard/AITurnEndDraw.cs | 77 + .../Engine/Wizard/AITurnEndEvo.cs | 43 + .../Engine/Wizard/AITurnEndHeal.cs | 54 + .../Engine/Wizard/AITurnEndKeywordSkill.cs | 74 + .../Engine/Wizard/AITurnEndMetamorphose.cs | 55 + .../Engine/Wizard/AITurnEndRemoveTag.cs | 61 + .../Wizard/AITurnEndSetLeaderMaxLife.cs | 88 + .../Engine/Wizard/AITurnEndShield.cs | 20 + .../Wizard/AITurnEndSubtractCountdown.cs | 54 + .../Engine/Wizard/AITurnEndToken.cs | 72 + .../Engine/Wizard/AITurnStartAttachTag.cs | 57 + .../Engine/Wizard/AITurnStartBarrierBase.cs | 54 + .../Engine/Wizard/AITurnStartDamage.cs | 87 + .../Engine/Wizard/AITurnStartDamageCut.cs | 31 + .../Engine/Wizard/AITurnStartShield.cs | 20 + .../Wizard/AITurnStartSubtractCountdown.cs | 36 + .../Engine/Wizard/AITurnStartTagArgument.cs | 42 + .../Engine/Wizard/AIUnknownAction.cs | 9 + .../AIUntouchableLeaveStopInformation.cs | 15 + .../Engine/Wizard/AIUseMinArgument.cs | 30 + .../Engine/Wizard/AIVirtualAttackSimulator.cs | 151 ++ .../Engine/Wizard/AIVirtualCardStatusInfo.cs | 39 + .../Wizard/AIVirtualEvolutionSimulator.cs | 82 + .../Engine/Wizard/AIVirtualPlaySimulator.cs | 103 + .../AIVirtualTargetSelectSimulationInfo.cs | 105 + .../Wizard/AIVirtualTargetSelectSimulator.cs | 469 ++++ .../Wizard/AIVirtualTurnEndSimulator.cs | 23 + .../AIWhenAttackOrWhenFightTagArgument.cs | 39 + .../AIWhenAttackSelfAndOtherTagArgument.cs | 17 + .../Wizard/AIWhenChangeInplayTagArgument.cs | 76 + .../Engine/Wizard/AIWhenPlayAddCemetery.cs | 39 + .../Engine/Wizard/AIWhenPlayAddDeck.cs | 72 + .../Engine/Wizard/AIWhenPlayAttachStyle.cs | 51 + .../Engine/Wizard/AIWhenPlayAttachTag.cs | 143 ++ .../Wizard/AIWhenPlayAttackableCount.cs | 65 + .../Engine/Wizard/AIWhenPlayBanAttack.cs | 84 + .../Engine/Wizard/AIWhenPlayBanish.cs | 112 + .../Engine/Wizard/AIWhenPlayBarrierBase.cs | 53 + .../Wizard/AIWhenPlayBonusInSimulation.cs | 23 + .../Engine/Wizard/AIWhenPlayBounce.cs | 112 + .../Engine/Wizard/AIWhenPlayBuff.cs | 155 ++ .../Engine/Wizard/AIWhenPlayChangeClass.cs | 57 + .../Engine/Wizard/AIWhenPlayChangeCost.cs | 102 + .../Engine/Wizard/AIWhenPlayChangeTribe.cs | 57 + .../Engine/Wizard/AIWhenPlayCopyTag.cs | 76 + .../Engine/Wizard/AIWhenPlayDamage.cs | 155 ++ .../Engine/Wizard/AIWhenPlayDamageClip.cs | 31 + .../Engine/Wizard/AIWhenPlayDamageCut.cs | 31 + .../Engine/Wizard/AIWhenPlayDestroy.cs | 131 ++ .../Engine/Wizard/AIWhenPlayDiscard.cs | 132 ++ .../Engine/Wizard/AIWhenPlayEvo.cs | 43 + .../Engine/Wizard/AIWhenPlayHandBuff.cs | 104 + .../Wizard/AIWhenPlayHandMetamorphose.cs | 90 + .../Engine/Wizard/AIWhenPlayHandSelect.cs | 16 + .../Engine/Wizard/AIWhenPlayHeal.cs | 117 + .../Engine/Wizard/AIWhenPlayKeywordSkill.cs | 67 + .../Engine/Wizard/AIWhenPlayMetamorphose.cs | 80 + .../Wizard/AIWhenPlayModifyConsumeEp.cs | 54 + .../Engine/Wizard/AIWhenPlayNotBeAttacked.cs | 47 + .../Engine/Wizard/AIWhenPlayReanimate.cs | 66 + .../AIWhenPlayRecoverAttackableCount.cs | 43 + .../Engine/Wizard/AIWhenPlayRecoverPp.cs | 56 + .../Wizard/AIWhenPlayRemoveKeywordSkill.cs | 54 + .../Engine/Wizard/AIWhenPlayRemoveSkill.cs | 57 + .../Engine/Wizard/AIWhenPlaySelect.cs | 62 + .../Wizard/AIWhenPlaySetLeaderMaxLife.cs | 42 + .../Engine/Wizard/AIWhenPlaySetMaxStatus.cs | 120 + .../Engine/Wizard/AIWhenPlayShield.cs | 20 + .../Engine/Wizard/AIWhenPlaySpellboost.cs | 141 ++ .../Wizard/AIWhenPlaySubtractCountdown.cs | 64 + .../Engine/Wizard/AIWhenPlaySummonHandCard.cs | 48 + .../Engine/Wizard/AIWhenPlaySummonToken.cs | 67 + .../Engine/Wizard/AIWhenPlayTagArgument.cs | 115 + .../Wizard/AIWhenPlayTokenArgumentBase.cs | 119 + .../Engine/Wizard/AIWhenPlayTokenDraw.cs | 45 + .../Engine/Wizard/AchievementImpl.cs | 391 ++++ .../Engine/Wizard/AllLabelColorChanger.cs | 221 ++ .../Wizard/AllyPlayBonusPolicyCollection.cs | 43 + .../AllyPlayBonusRatePolicyCollection.cs | 27 + .../Engine/Wizard/AreaSelectClearReward.cs | 296 +++ .../Engine/Wizard/ArenaConfigDialog.cs | 235 ++ .../Engine/Wizard/AvatarBattleAllInfo.cs | 103 + .../Wizard/BarrierBonusPolicyCollection.cs | 26 + .../Engine/Wizard/BaseProductDetail.cs | 63 + .../Engine/Wizard/BaseShopPurchasePage.cs | 132 ++ .../Engine/Wizard/BattleMenuUserPanel.cs | 14 + .../Engine/Wizard/BattlePassGaugeInfo.cs | 91 + .../Engine/Wizard/BattlePassGuage.cs | 158 ++ .../Engine/Wizard/BattlePassLevelInfo.cs | 16 + .../Engine/Wizard/BattlePassMonthlyMission.cs | 76 + .../Engine/Wizard/BattlePassResultPanel.cs | 173 ++ .../Engine/Wizard/BattleSequencer.cs | 305 +++ .../Engine/Wizard/BattleStartUserPanel.cs | 14 + .../Engine/Wizard/BestInPlayMoveAI.cs | 215 ++ .../Engine/Wizard/BestOpenSpaceAttackAI.cs | 204 ++ .../Engine/Wizard/BrowserURL.cs | 11 + .../Engine/Wizard/CampaignBattleWin.cs | 77 + .../Engine/Wizard/CampaignRewardInfo.cs | 22 + .../Engine/Wizard/CardCreateTask.cs | 35 + .../Engine/Wizard/CardDestructTask.cs | 35 + .../Wizard/CardMasterLocalFileUtility.cs | 142 ++ .../Engine/Wizard/CardProtectTask.cs | 47 + .../Wizard/CardSelectListConfirmPagerView.cs | 402 ++++ .../Engine/Wizard/CardSkillHashUtility.cs | 92 + SVSim.BattleEngine/Engine/Wizard/ChaosUtil.cs | 19 + .../Wizard/ChapterObjectCenteringSupporter.cs | 9 + .../Engine/Wizard/CheckSpecialTitleTask.cs | 40 + .../Wizard/CheckTimeSlipRotationPeriodTask.cs | 9 + .../Engine/Wizard/ChoiceVirtualCard.cs | 51 + .../Engine/Wizard/ClassInfomationOrder.cs | 17 + .../Engine/Wizard/ClassSelectionButton.cs | 56 + .../Engine/Wizard/ClassSkinDetailWindow.cs | 56 + SVSim.BattleEngine/Engine/Wizard/ClassUtil.cs | 21 + SVSim.BattleEngine/Engine/Wizard/ColorCode.cs | 47 + .../Engine/Wizard/CompetitionBattleFinish.cs | 11 + .../Wizard/CompetitionBattleFinishDetail.cs | 6 + .../Wizard/CompetitionResultAnimationAgent.cs | 187 ++ .../CompetitionResultAnimationHandler.cs | 24 + .../Wizard/CompetitionResultReporter.cs | 64 + .../Engine/Wizard/CompleteDeckDecideDialog.cs | 89 + .../Engine/Wizard/ConventionInfoTask.cs | 23 + .../Engine/Wizard/ConvertTime.cs | 141 ++ .../Wizard/CrossOverClassInfomationOrder.cs | 14 + SVSim.BattleEngine/Engine/Wizard/Crossover.cs | 164 ++ .../Engine/Wizard/CrossoverPortalParam.cs | 18 + .../Engine/Wizard/CrossoverRestrictedCard.cs | 60 + .../Engine/Wizard/CrossoverRewardInfo.cs | 35 + .../Engine/Wizard/CsvColumns.cs | 25 + SVSim.BattleEngine/Engine/Wizard/Data.cs | 448 ++++ .../Engine/Wizard/DeckAutoCreateTask.cs | 77 + .../Wizard/DeckBuildShortageCardView.cs | 212 ++ .../Engine/Wizard/DeckCopyDialog.cs | 122 + .../Engine/Wizard/DeckInfoTask.cs | 62 + .../Engine/Wizard/DeckListUtility.cs | 329 +++ .../Engine/Wizard/DeckSelectUI.cs | 471 ++++ .../Engine/Wizard/DeckSelectUIDialog.cs | 282 +++ .../Engine/Wizard/DeckSelectUIDialogTitle.cs | 194 ++ .../Engine/Wizard/DegreeHelper.cs | 87 + .../Engine/Wizard/DialogCreator.cs | 102 + .../Engine/Wizard/DialogItemPurchase.cs | 22 + .../Engine/Wizard/DialogSubText.cs | 16 + .../DisableLethalCheckPolicyCollection.cs | 23 + .../Engine/Wizard/DiscardedVirtualCard.cs | 28 + .../Engine/Wizard/DrumrollDialog.cs | 42 + .../Engine/Wizard/EffectUtility.cs | 21 + .../EmoOnLeaderDamagedPolicyCollection.cs | 29 + .../Wizard/EmoOnTurnEndPolicyCollection.cs | 28 + .../Wizard/EmoOnTurnStartPolicyCollection.cs | 29 + .../Engine/Wizard/EmptyDeckInfo.cs | 18 + .../Engine/Wizard/EncryptData.cs | 5 + .../Engine/Wizard/EnemyAINull.cs | 83 + .../Engine/Wizard/EnemyAIUtil.cs | 409 ++++ .../Engine/Wizard/EnemyHandVirtualCard.cs | 86 + .../Engine/Wizard/EpValuePolicyCollection.cs | 26 + .../Engine/Wizard/EvaluationType.cs | 8 + .../Engine/Wizard/ExchangeConfirmDialog.cs | 22 + SVSim.BattleEngine/Engine/Wizard/Field1005.cs | 71 + SVSim.BattleEngine/Engine/Wizard/Field1006.cs | 143 ++ SVSim.BattleEngine/Engine/Wizard/Field1007.cs | 80 + SVSim.BattleEngine/Engine/Wizard/Field1008.cs | 172 ++ SVSim.BattleEngine/Engine/Wizard/Field1009.cs | 96 + SVSim.BattleEngine/Engine/Wizard/Field1010.cs | 77 + SVSim.BattleEngine/Engine/Wizard/Field1011.cs | 99 + SVSim.BattleEngine/Engine/Wizard/Field1012.cs | 78 + SVSim.BattleEngine/Engine/Wizard/Field51.cs | 125 ++ SVSim.BattleEngine/Engine/Wizard/Field52.cs | 126 ++ SVSim.BattleEngine/Engine/Wizard/Field61.cs | 98 + SVSim.BattleEngine/Engine/Wizard/Field62.cs | 89 + SVSim.BattleEngine/Engine/Wizard/Field71.cs | 88 + SVSim.BattleEngine/Engine/Wizard/Field72.cs | 83 + SVSim.BattleEngine/Engine/Wizard/Field73.cs | 91 + SVSim.BattleEngine/Engine/Wizard/Field74.cs | 76 + SVSim.BattleEngine/Engine/Wizard/Field75.cs | 104 + SVSim.BattleEngine/Engine/Wizard/Field76.cs | 93 + .../Engine/Wizard/FilteringSleeveSelection.cs | 77 + SVSim.BattleEngine/Engine/Wizard/FirstTips.cs | 362 +++ .../Engine/Wizard/FixedRemoveType.cs | 8 + SVSim.BattleEngine/Engine/Wizard/Footer.cs | 405 ++++ .../Engine/Wizard/FormatBehaviorManager.cs | 64 + .../Engine/Wizard/FormatChangeUI.cs | 202 ++ .../Wizard/FreeCardPackCampaignFinishTask.cs | 41 + .../Engine/Wizard/FullSimulationAI.cs | 338 +++ .../Engine/Wizard/GachaPointExchangePlate.cs | 115 + .../Engine/Wizard/GachaUIParam.cs | 14 + .../GameStartAttachTagPolicyCollection.cs | 25 + .../Engine/Wizard/GatheringMyPageInfo.cs | 58 + .../Engine/Wizard/GatheringRule.cs | 176 ++ .../Engine/Wizard/GetCardMasterTask.cs | 40 + .../Wizard/GetSelectSkinOwnedStatusTask.cs | 54 + .../Engine/Wizard/GuildNotification.cs | 22 + .../Engine/Wizard/IAIRemoveTagArgument.cs | 10 + .../Engine/Wizard/IAITurnEndArgument.cs | 8 + .../Wizard/InCompleteDeckDecideDialog.cs | 116 + .../Engine/Wizard/InplayMovePatternFilter.cs | 50 + .../Engine/Wizard/ItemPurchase.cs | 279 +++ .../Engine/Wizard/ItemPurchasePlate.cs | 93 + .../Engine/Wizard/LabelDefine.cs | 50 + SVSim.BattleEngine/Engine/Wizard/LocalLog.cs | 828 +++++++ .../Engine/Wizard/LocalizeJson.cs | 226 ++ .../Engine/Wizard/LootBoxDialogUtility.cs | 71 + .../Engine/Wizard/Mastershop.cs | 71 + .../Engine/Wizard/Matching_Competition.cs | 52 + .../Engine/Wizard/Matching_Sealed.cs | 51 + .../Engine/Wizard/MaterialDefine.cs | 13 + .../Engine/Wizard/MissionInfoTask.cs | 43 + .../Wizard/ModUnitRatePolicyCollection.cs | 24 + .../Wizard/MoveFirstBonusPolicyCollection.cs | 93 + .../Engine/Wizard/MovieSubtitles.cs | 116 + SVSim.BattleEngine/Engine/Wizard/MyPage.cs | 8 + .../Engine/Wizard/MyPageBGInfo.cs | 31 + .../Engine/Wizard/MyPageCustomBGControl.cs | 520 +++++ .../Engine/Wizard/MyPageDetail.cs | 84 + .../Wizard/MyPageMaintenanceNotification.cs | 51 + .../Wizard/MyPageMyPageNotificationDetail.cs | 58 + .../Engine/Wizard/MyPageNotifications.cs | 21 + .../Engine/Wizard/MyRotationAbilityGroup.cs | 25 + .../Engine/Wizard/MyRotationAllInfo.cs | 223 ++ .../MypageReceiveSpecialTreasureTask.cs | 53 + .../Wizard/MypageTreasureBoxCpOpenTask.cs | 58 + .../Wizard/NetworkSkill_spell_charge.cs | 41 + SVSim.BattleEngine/Engine/Wizard/NetworkUI.cs | 278 +++ .../Engine/Wizard/OptionSettingWindow.cs | 1232 +++++++++++ SVSim.BattleEngine/Engine/Wizard/PackInfo.cs | 10 + .../Engine/Wizard/PackOpenTask.cs | 167 ++ .../Wizard/PlayBreakPolicyCollection.cs | 24 + .../Engine/Wizard/PlaySimulationInfo.cs | 17 + .../Engine/Wizard/PlaySkipIfEvoInformation.cs | 46 + .../PlaySkipWithActionIfEvoInformation.cs | 33 + .../Wizard/PlaySkipWithActionInformation.cs | 40 + .../Engine/Wizard/PlayedTogetherHistory.cs | 52 + .../Engine/Wizard/PlayedTogetherInfo.cs | 8 + ...layerEmoOnLeaderDamagedPolicyCollection.cs | 29 + .../PlayerEmoOnTurnEndPolicyCollection.cs | 28 + .../PlayerEmoOnTurnStartPolicyCollection.cs | 29 + .../Engine/Wizard/PlayerPrefsWrapper.cs | 519 +++++ .../Engine/Wizard/PlayerStaticData.cs | 820 +++++++ .../Wizard/PlayptnBonusPolicyCollection.cs | 25 + .../Wizard/PolicyCollectionWithSingleType.cs | 40 + .../Wizard/PolicyCollectionWithTypeCreator.cs | 75 + .../Engine/Wizard/PracticeData.cs | 66 + .../Engine/Wizard/PracticeDataMgr.cs | 36 + .../Engine/Wizard/PracticeFinishTask.cs | 88 + .../Wizard/PracticePuzzleMissionData.cs | 32 + .../Wizard/PremiumCardConversionTask.cs | 38 + .../Engine/Wizard/Prerelease.cs | 84 + .../Engine/Wizard/ProductDetailPlate.cs | 24 + .../Engine/Wizard/PurchaseRewardDialog.cs | 439 ++++ .../Engine/Wizard/PuzzleAnimation.cs | 153 ++ .../Engine/Wizard/PuzzleQuestSelectGroup.cs | 52 + .../Engine/Wizard/PuzzleUtil.cs | 88 + .../Engine/Wizard/QuestCampaignDialog.cs | 69 + .../Engine/Wizard/QuestDeckListTask.cs | 54 + .../QuestLastUsedDeckSaveDataManager.cs | 239 ++ .../Engine/Wizard/QuestMissionInfo.cs | 31 + .../Engine/Wizard/QuestMissionInfoTask.cs | 20 + .../Engine/Wizard/QuestOpenInfo.cs | 32 + .../Engine/Wizard/QuestPointInfoTask.cs | 43 + .../Wizard/QuestPuzzleSelectionButton.cs | 122 + .../Wizard/QuestRewardReceiveAllTask.cs | 31 + .../Engine/Wizard/RankWinnerReward.cs | 177 ++ .../Wizard/RedEtherCampaignResultData.cs | 82 + .../Wizard/RedEtherCampaignRewardData.cs | 31 + .../Engine/Wizard/ReplayInfo.cs | 8 + .../Engine/Wizard/ReplayInfoItem.cs | 62 + .../Engine/Wizard/RewardConfirmDialog.cs | 98 + .../Engine/Wizard/RewardConfirmView.cs | 115 + .../Engine/Wizard/RewardConfirmViewItem.cs | 121 + .../Wizard/RoomNonPossessionCardCampaign.cs | 10 + .../Engine/Wizard/RoomRuleInfo.cs | 96 + .../Engine/Wizard/RoomTwoPickMultiDeckInfo.cs | 88 + SVSim.BattleEngine/Engine/Wizard/RubyText.cs | 910 ++++++++ .../Engine/Wizard/SealedCardInfo.cs | 30 + .../Engine/Wizard/SealedClassInfo.cs | 16 + .../Engine/Wizard/SealedData.cs | 366 +++ .../Engine/Wizard/SealedMyPageResponseData.cs | 36 + .../Wizard/SelectCardPurchaseConfirmDialog.cs | 109 + .../Engine/Wizard/SelectSkinCardDialog.cs | 402 ++++ .../Engine/Wizard/SelectSkinCardPlate.cs | 214 ++ .../Wizard/SetReferenceIdPolicyCollection.cs | 23 + .../SetReferenceTribePolicyCollection.cs | 35 + SVSim.BattleEngine/Engine/Wizard/SetUp.cs | 261 +++ .../Engine/Wizard/ShopCommonSaleInfo.cs | 22 + .../Engine/Wizard/ShopCommonUtility.cs | 376 ++++ .../Engine/Wizard/ShopDrumrollScrollItem.cs | 89 + .../Engine/Wizard/ShopNotification.cs | 75 + .../Engine/Wizard/ShopPanelAppealItem.cs | 111 + .../Engine/Wizard/SimulationSetting.cs | 20 + .../Engine/Wizard/SkinProductDetail.cs | 65 + .../Engine/Wizard/SleeveBuyTask.cs | 38 + .../Engine/Wizard/SoftwareReset.cs | 67 + .../Engine/Wizard/SpecialTreasureInfo.cs | 36 + .../Engine/Wizard/SpeedChallengeInfo.cs | 43 + .../Engine/Wizard/SpineDisplay.cs | 223 ++ .../Engine/Wizard/SpotCardExchange.cs | 350 +++ .../Engine/Wizard/SpotCardExchangeDialog.cs | 53 + .../Engine/Wizard/SpotCardExchangeInfo.cs | 50 + .../Engine/Wizard/StarterClassSelectDialog.cs | 84 + .../Engine/Wizard/StoryFinishTask.cs | 142 ++ .../Engine/Wizard/StoryNotification.cs | 27 + .../Engine/Wizard/StorySectionBtn.cs | 175 ++ .../Engine/Wizard/StorySelectPage.cs | 408 ++++ .../Engine/Wizard/SubClassSelectDialog.cs | 115 + .../Engine/Wizard/SummonedVirtualCard.cs | 30 + .../Engine/Wizard/SupplyLabelPlate.cs | 25 + .../Engine/Wizard/SupplyLabelPlateListUI.cs | 30 + .../Wizard/TagCollectionWithSingleType.cs | 60 + .../Wizard/TagCollectionWithTypeCreator.cs | 753 +++++++ .../Engine/Wizard/ToolboxGame.cs | 86 + .../Engine/Wizard/TransformBackup.cs | 30 + .../Engine/Wizard/TreasureBoxCp.cs | 107 + .../Engine/Wizard/TreasureCpBoxTextPanel.cs | 9 + SVSim.BattleEngine/Engine/Wizard/Tuple.cs | 14 + .../Engine/Wizard/UIAtlasManager.cs | 476 ++++ .../Engine/Wizard/UIPageIndicator.cs | 45 + .../Engine/Wizard/UIParticleEffectManager.cs | 69 + SVSim.BattleEngine/Engine/Wizard/UIUtil.cs | 254 +++ .../Wizard/UnitBonusPolicyCollection.cs | 24 + .../Engine/Wizard/WebViewHelper.cs | 393 ++++ .../Engine/Wizard/WebViewScreen.cs | 17 + SVSim.BattleEngine/Engine/YuwanField.cs | 83 + SVSim.BattleEngine/Engine/llField.cs | 82 + SVSim.BattleEngine/Shim/External/LooseEnds.cs | 50 + .../Shim/External/ThirdParty.cs | 44 + .../Shim/GodObjects/GodObjects.cs | 61 + .../Shim/UnityEngine/UnityShim.cs | 166 ++ SVSim.BattleEngine/Shim/View/VfxShim.cs | 114 + .../Shim/View/ViewUiTouchStubs.cs | 86 + 1795 files changed, 166536 insertions(+) create mode 100644 SVSim.BattleEngine/Engine/AchievementInfo.cs create mode 100644 SVSim.BattleEngine/Engine/AchievementInfoDetail.cs create mode 100644 SVSim.BattleEngine/Engine/AchievementWindowBase.cs create mode 100644 SVSim.BattleEngine/Engine/ActiveAnimation.cs create mode 100644 SVSim.BattleEngine/Engine/AddDamageInfo.cs create mode 100644 SVSim.BattleEngine/Engine/AlleyField.cs create mode 100644 SVSim.BattleEngine/Engine/AnimationOrTween/Direction.cs create mode 100644 SVSim.BattleEngine/Engine/AreaSelInfo.cs create mode 100644 SVSim.BattleEngine/Engine/ArenaColosseum.cs create mode 100644 SVSim.BattleEngine/Engine/ArenaCompetition.cs create mode 100644 SVSim.BattleEngine/Engine/ArenaData.cs create mode 100644 SVSim.BattleEngine/Engine/ArenaEntryDataBase.cs create mode 100644 SVSim.BattleEngine/Engine/ArenaField.cs create mode 100644 SVSim.BattleEngine/Engine/ArenaNextSceneSelector.cs create mode 100644 SVSim.BattleEngine/Engine/ArenaResultAnimationAgent.cs create mode 100644 SVSim.BattleEngine/Engine/ArenaResultAnimationHandler.cs create mode 100644 SVSim.BattleEngine/Engine/ArenaResultReporter.cs create mode 100644 SVSim.BattleEngine/Engine/ArenaTwoPickData.cs create mode 100644 SVSim.BattleEngine/Engine/AspectCamera.cs create mode 100644 SVSim.BattleEngine/Engine/AttackSelectControl.cs create mode 100644 SVSim.BattleEngine/Engine/BattleCardIconAnimations.cs create mode 100644 SVSim.BattleEngine/Engine/BattleCoroutine.cs create mode 100644 SVSim.BattleEngine/Engine/BattleFinishSendBase.cs create mode 100644 SVSim.BattleEngine/Engine/BattleFinishToOpponentDisConnectChecker.cs create mode 100644 SVSim.BattleEngine/Engine/BattleKeywordInfoListMgr.cs create mode 100644 SVSim.BattleEngine/Engine/BattlePlayerVfxCreatorBase.cs create mode 100644 SVSim.BattleEngine/Engine/BattleSettingBaseData.cs create mode 100644 SVSim.BattleEngine/Engine/BattleSettingData.cs create mode 100644 SVSim.BattleEngine/Engine/BattleStageChoiceObject.cs create mode 100644 SVSim.BattleEngine/Engine/BattleStageChoiceWindow.cs create mode 100644 SVSim.BattleEngine/Engine/BattleStopChecker.cs create mode 100644 SVSim.BattleEngine/Engine/BattleUtility.cs create mode 100644 SVSim.BattleEngine/Engine/BetterList.cs create mode 100644 SVSim.BattleEngine/Engine/BothBattlePlayerFilter.cs create mode 100644 SVSim.BattleEngine/Engine/CardCreatorBase.cs create mode 100644 SVSim.BattleEngine/Engine/CardMake.cs create mode 100644 SVSim.BattleEngine/Engine/CardPanelMaintenancePlate.cs create mode 100644 SVSim.BattleEngine/Engine/CardSelectListUI_Positioning.cs create mode 100644 SVSim.BattleEngine/Engine/CardShaderDefine.cs create mode 100644 SVSim.BattleEngine/Engine/CastleField.cs create mode 100644 SVSim.BattleEngine/Engine/ChallengeConfig.cs create mode 100644 SVSim.BattleEngine/Engine/ChallengeData.cs create mode 100644 SVSim.BattleEngine/Engine/ChangeAffiliationVfx.cs create mode 100644 SVSim.BattleEngine/Engine/ChantCountAddModifier.cs create mode 100644 SVSim.BattleEngine/Engine/ChantCountSetModifier.cs create mode 100644 SVSim.BattleEngine/Engine/ChantFieldBattleCard.cs create mode 100644 SVSim.BattleEngine/Engine/CharIdx.cs create mode 100644 SVSim.BattleEngine/Engine/Charactor3dInformation.cs create mode 100644 SVSim.BattleEngine/Engine/ChateauField.cs create mode 100644 SVSim.BattleEngine/Engine/Class3dPostImageEffect.cs create mode 100644 SVSim.BattleEngine/Engine/Class3dScreenOverlay.cs create mode 100644 SVSim.BattleEngine/Engine/ClassBattleCardBase.cs create mode 100644 SVSim.BattleEngine/Engine/ClassCharaExp.cs create mode 100644 SVSim.BattleEngine/Engine/ClassSkinPlate.cs create mode 100644 SVSim.BattleEngine/Engine/ClassSkinPurchasePage.cs create mode 100644 SVSim.BattleEngine/Engine/ColosseumBattleFinish.cs create mode 100644 SVSim.BattleEngine/Engine/ColosseumBattleFinishDetail.cs create mode 100644 SVSim.BattleEngine/Engine/ColosseumResultAnimationAgent.cs create mode 100644 SVSim.BattleEngine/Engine/ColosseumResultAnimationHandler.cs create mode 100644 SVSim.BattleEngine/Engine/ColosseumResultReporter.cs create mode 100644 SVSim.BattleEngine/Engine/ConnectionReportTrigger.cs create mode 100644 SVSim.BattleEngine/Engine/ConnectionReporter.cs create mode 100644 SVSim.BattleEngine/Engine/ConventionList.cs create mode 100644 SVSim.BattleEngine/Engine/ConventionListPlate.cs create mode 100644 SVSim.BattleEngine/Engine/ConventionListUI.cs create mode 100644 SVSim.BattleEngine/Engine/CostAddModifier.cs create mode 100644 SVSim.BattleEngine/Engine/CostCurveUI.cs create mode 100644 SVSim.BattleEngine/Engine/CostHalfModifier.cs create mode 100644 SVSim.BattleEngine/Engine/CostHalfRoundUpModifier.cs create mode 100644 SVSim.BattleEngine/Engine/CostSetModifier.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/AssetBundleObject.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/AssetManager.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/AssetObject.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/AsyncJob.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/AudioManager.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/BootNetwork.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/BootSystem.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/CryptAES.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/Cryptographer.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/CustomPreference.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/CuteNetworkDefine.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/DebugManager.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/DeviceManager.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/GameStartCheckTask.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/GetiCloudUserDataTask.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/HangulManager.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/IAchievementCallback.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/ILocalKVS.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/LocalSqliteKVS.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/ManifestDatahashKVS.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/MovieManager.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/MoviePlayer.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/ParallelJob.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/PaymentPCFinishTask.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/QualityManager.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/SavedataManager.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/SignUpTask.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/SoftwareResetBase.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/SoundData.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/TimeData.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/TimeUtil.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/Toolbox.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/URLScheme.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/UpdateiCloudUserDataTask.cs create mode 100644 SVSim.BattleEngine/Engine/Cute/WebViewManager.cs create mode 100644 SVSim.BattleEngine/Engine/Debug.cs create mode 100644 SVSim.BattleEngine/Engine/DeckDecisionUI.cs create mode 100644 SVSim.BattleEngine/Engine/DegreeInfo.cs create mode 100644 SVSim.BattleEngine/Engine/DegreeInfoDetail.cs create mode 100644 SVSim.BattleEngine/Engine/DepthBlurAndBloom.cs create mode 100644 SVSim.BattleEngine/Engine/DialogSupport.cs create mode 100644 SVSim.BattleEngine/Engine/DoMatchingBase.cs create mode 100644 SVSim.BattleEngine/Engine/DoMatchingData.cs create mode 100644 SVSim.BattleEngine/Engine/DoMatchingDetail.cs create mode 100644 SVSim.BattleEngine/Engine/DofDiffusionBloomOverlayParam.cs create mode 100644 SVSim.BattleEngine/Engine/Effect.cs create mode 100644 SVSim.BattleEngine/Engine/Effect3dInformation.cs create mode 100644 SVSim.BattleEngine/Engine/EmblemInfo.cs create mode 100644 SVSim.BattleEngine/Engine/EmblemInfoDetail.cs create mode 100644 SVSim.BattleEngine/Engine/EmitHandUtility.cs create mode 100644 SVSim.BattleEngine/Engine/EnemyAICoroutine.cs create mode 100644 SVSim.BattleEngine/Engine/EnemyClassBattleCard.cs create mode 100644 SVSim.BattleEngine/Engine/EventBattleResult.cs create mode 100644 SVSim.BattleEngine/Engine/FadeUtility.cs create mode 100644 SVSim.BattleEngine/Engine/FieldBattleCard.cs create mode 100644 SVSim.BattleEngine/Engine/FontChanger.cs create mode 100644 SVSim.BattleEngine/Engine/ForestField.cs create mode 100644 SVSim.BattleEngine/Engine/ForestNightField.cs create mode 100644 SVSim.BattleEngine/Engine/FramerateProfiler.cs create mode 100644 SVSim.BattleEngine/Engine/FreeMatchFinish.cs create mode 100644 SVSim.BattleEngine/Engine/FreeMatchFinishDetail.cs create mode 100644 SVSim.BattleEngine/Engine/FreeMatchResultAnimationAgent.cs create mode 100644 SVSim.BattleEngine/Engine/FreeMatchResultAnimationHandler.cs create mode 100644 SVSim.BattleEngine/Engine/FreeMatchResultReporter.cs create mode 100644 SVSim.BattleEngine/Engine/FriendApply.cs create mode 100644 SVSim.BattleEngine/Engine/FriendInfo.cs create mode 100644 SVSim.BattleEngine/Engine/FriendInfoDetail.cs create mode 100644 SVSim.BattleEngine/Engine/GachaObj.cs create mode 100644 SVSim.BattleEngine/Engine/GateField.cs create mode 100644 SVSim.BattleEngine/Engine/Gungnir.cs create mode 100644 SVSim.BattleEngine/Engine/HandViewBase.cs create mode 100644 SVSim.BattleEngine/Engine/HillField.cs create mode 100644 SVSim.BattleEngine/Engine/HillRiotingField.cs create mode 100644 SVSim.BattleEngine/Engine/IDInput.cs create mode 100644 SVSim.BattleEngine/Engine/InPlayCardControl.cs create mode 100644 SVSim.BattleEngine/Engine/InPlayViewBase.cs create mode 100644 SVSim.BattleEngine/Engine/InitializeRoomBattle.cs create mode 100644 SVSim.BattleEngine/Engine/InviteFriendBattle.cs create mode 100644 SVSim.BattleEngine/Engine/IronField.cs create mode 100644 SVSim.BattleEngine/Engine/LaboratoryField.cs create mode 100644 SVSim.BattleEngine/Engine/LaboratoryNightField.cs create mode 100644 SVSim.BattleEngine/Engine/LifeAddModifier.cs create mode 100644 SVSim.BattleEngine/Engine/LifeMultiplyModifier.cs create mode 100644 SVSim.BattleEngine/Engine/LifeSetModifier.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/ArrayMetadata.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/Condition.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/ExporterFunc.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/FsmContext.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/IJsonWrapper.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/IOrderedDictionary.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/ImporterFunc.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/JsonData.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/JsonException.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/JsonMapper.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/JsonMockWrapper.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/JsonReader.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/JsonToken.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/JsonType.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/JsonWriter.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/Lexer.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/ObjectMetadata.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/OrderedDictionaryEnumerator.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/ParserToken.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/PropertyMetadata.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/WrapperFactory.cs create mode 100644 SVSim.BattleEngine/Engine/LitJson/WriterContext.cs create mode 100644 SVSim.BattleEngine/Engine/Load.cs create mode 100644 SVSim.BattleEngine/Engine/LoadDetail.cs create mode 100644 SVSim.BattleEngine/Engine/LoadingBase.cs create mode 100644 SVSim.BattleEngine/Engine/LoadingInScene.cs create mode 100644 SVSim.BattleEngine/Engine/Localization.cs create mode 100644 SVSim.BattleEngine/Engine/MailData.cs create mode 100644 SVSim.BattleEngine/Engine/MailDataDetail.cs create mode 100644 SVSim.BattleEngine/Engine/MailResult.cs create mode 100644 SVSim.BattleEngine/Engine/MailTop.cs create mode 100644 SVSim.BattleEngine/Engine/MatchFinishBase.cs create mode 100644 SVSim.BattleEngine/Engine/MatchingCoroutine.cs create mode 100644 SVSim.BattleEngine/Engine/MatchingIPv6Toggle.cs create mode 100644 SVSim.BattleEngine/Engine/Matching_Colosseum.cs create mode 100644 SVSim.BattleEngine/Engine/Matching_Free.cs create mode 100644 SVSim.BattleEngine/Engine/Matching_RankMatch.cs create mode 100644 SVSim.BattleEngine/Engine/Matching_Room.cs create mode 100644 SVSim.BattleEngine/Engine/Matching_TwoPick.cs create mode 100644 SVSim.BattleEngine/Engine/MaxLifeAddModifier.cs create mode 100644 SVSim.BattleEngine/Engine/MaxLifeSetModifier.cs create mode 100644 SVSim.BattleEngine/Engine/MecanimSceneBase.cs create mode 100644 SVSim.BattleEngine/Engine/MecanimStateBase.cs create mode 100644 SVSim.BattleEngine/Engine/MissionInfo.cs create mode 100644 SVSim.BattleEngine/Engine/MissionInfoDetail.cs create mode 100644 SVSim.BattleEngine/Engine/MotionUtils.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageBanner.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageBannerBase.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageBattleCampaign.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageCardDetail.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageCardPanel.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageCardPanelAnimation.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageCenterCard.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageCharaMenu.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageHomeStatic.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageItem.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageItemArena.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageItemBattle.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageItemCard.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageItemHome.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageItemShop.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageItemSoroPlay.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageMenu.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageShopCrystalApeal.cs create mode 100644 SVSim.BattleEngine/Engine/MyPageSubBanner.cs create mode 100644 SVSim.BattleEngine/Engine/NGUIDebug.cs create mode 100644 SVSim.BattleEngine/Engine/NGUIMath.cs create mode 100644 SVSim.BattleEngine/Engine/NGUITools.cs create mode 100644 SVSim.BattleEngine/Engine/Nat2Field.cs create mode 100644 SVSim.BattleEngine/Engine/Nat3Field.cs create mode 100644 SVSim.BattleEngine/Engine/Nat4Field.cs create mode 100644 SVSim.BattleEngine/Engine/NateField.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkBattleGenericTool.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkBattleSenderDefine.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkLog.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkMatchNextSceneSelector.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkOperationCollection.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkRecoveryBattleData.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkReplayBattleReceiver.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkReplayBattleSetupCardEvent.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkillPreprocessConditionCheck.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkillRandomEachSameBaseCardIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkillRandomSelectUntilFilter.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkillTargetLastTargetFilter.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_attach_skill.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_attack_by_life.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_attack_count.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_attract_skill_target.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_banish.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_bp_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_cant_activate_fanfare.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_cant_attack.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_cant_evolution.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_cant_play.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_change_affiliation.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_change_cemetery.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_change_super_skybound_art_count.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_change_union_burst_count.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_change_white_ritual_stack.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_chant_count_change.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_clear_destroyed_and_discarded_card_list.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_consume_ep_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_copy_skill.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_cost_change.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_damage.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_damage_cut.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_damage_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_destroy.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_discard.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_drain.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_evolve.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_extra_turn.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_force_avarice.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_force_berserk.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_force_skill_target.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_force_wrath.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_fusion_metamorphose.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_generic_value_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_guard.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_heal.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_ignore_guard.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_independent.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_indestructible.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_invoke_skill.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_killer.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_lose.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_metamorphose.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_not_be_attacked.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_play_count_change.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_possess_ep_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_power_down.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_power_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_powerup.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_pp_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_quick.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_random_array.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_reflection.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_remove_by_banish.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_remove_by_destroy.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_repeat_skill.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_return_card.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_rob_skill.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_rush.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_select.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_shield.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_shortage_deck_win.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_sneak.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_special_lose.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_special_win.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_stack_white_ritual.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_summon_card.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_summon_token.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_token_draw.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_trigger.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_unite.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_untouchable.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkSkill_update_deck.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkStandardBattleMgr.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkStatus.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkUserInfoData.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkUtility.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkWatchBattleData.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkWatchBattleReceiver.cs create mode 100644 SVSim.BattleEngine/Engine/NetworkWatchBattleSetupCardEvent.cs create mode 100644 SVSim.BattleEngine/Engine/NewReplayOperateReceive.cs create mode 100644 SVSim.BattleEngine/Engine/NewReplayOperationCollection.cs create mode 100644 SVSim.BattleEngine/Engine/NtDataTranslateInfo.cs create mode 100644 SVSim.BattleEngine/Engine/NtDataTranslateManager.cs create mode 100644 SVSim.BattleEngine/Engine/NullBattleCard.cs create mode 100644 SVSim.BattleEngine/Engine/NullBattlePlayerFilter.cs create mode 100644 SVSim.BattleEngine/Engine/NullDetailPanelControl.cs create mode 100644 SVSim.BattleEngine/Engine/NullNextSceneSelector.cs create mode 100644 SVSim.BattleEngine/Engine/NullOperationCollection.cs create mode 100644 SVSim.BattleEngine/Engine/NullSkillApplyInformation.cs create mode 100644 SVSim.BattleEngine/Engine/NullStatusPanelControl.cs create mode 100644 SVSim.BattleEngine/Engine/NullTurnPanelControl.cs create mode 100644 SVSim.BattleEngine/Engine/OffenseAddModifier.cs create mode 100644 SVSim.BattleEngine/Engine/OffenseMultiplyModifier.cs create mode 100644 SVSim.BattleEngine/Engine/OffenseSetModifier.cs create mode 100644 SVSim.BattleEngine/Engine/OpenURLOnClick.cs create mode 100644 SVSim.BattleEngine/Engine/OpponentBattlePlayerFilter.cs create mode 100644 SVSim.BattleEngine/Engine/PackOpen.cs create mode 100644 SVSim.BattleEngine/Engine/PlayQueueViewBase.cs create mode 100644 SVSim.BattleEngine/Engine/PlayerClassBattleCard.cs create mode 100644 SVSim.BattleEngine/Engine/PlayerDrawCardToHandVfx.cs create mode 100644 SVSim.BattleEngine/Engine/PlazField.cs create mode 100644 SVSim.BattleEngine/Engine/PlazRiotingField.cs create mode 100644 SVSim.BattleEngine/Engine/PracticeFinish.cs create mode 100644 SVSim.BattleEngine/Engine/PracticeFinishDetail.cs create mode 100644 SVSim.BattleEngine/Engine/PracticeNextSceneSelector.cs create mode 100644 SVSim.BattleEngine/Engine/PracticePuzzleFinishData.cs create mode 100644 SVSim.BattleEngine/Engine/PracticePuzzleNextSceneSelector.cs create mode 100644 SVSim.BattleEngine/Engine/PracticePuzzleReportEndAgent.cs create mode 100644 SVSim.BattleEngine/Engine/PracticePuzzleResultReporter.cs create mode 100644 SVSim.BattleEngine/Engine/PracticeReportEndAgent.cs create mode 100644 SVSim.BattleEngine/Engine/PracticeResultAnimationAgent.cs create mode 100644 SVSim.BattleEngine/Engine/PracticeResultAnimationHandler.cs create mode 100644 SVSim.BattleEngine/Engine/PracticeResultReporter.cs create mode 100644 SVSim.BattleEngine/Engine/PrefabMgr.cs create mode 100644 SVSim.BattleEngine/Engine/PriConnField.cs create mode 100644 SVSim.BattleEngine/Engine/PuzzleBattleManager.cs create mode 100644 SVSim.BattleEngine/Engine/QuestFinish.cs create mode 100644 SVSim.BattleEngine/Engine/QuestNextSceneSelector.cs create mode 100644 SVSim.BattleEngine/Engine/QuestReportEndAgent.cs create mode 100644 SVSim.BattleEngine/Engine/QuestResultReporter.cs create mode 100644 SVSim.BattleEngine/Engine/QuestSpecialResultAnimationAgent.cs create mode 100644 SVSim.BattleEngine/Engine/QuestSpecialResultAnimationHandler.cs create mode 100644 SVSim.BattleEngine/Engine/QuestStageIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/RandomValueFilter.cs create mode 100644 SVSim.BattleEngine/Engine/RankMatchFinish.cs create mode 100644 SVSim.BattleEngine/Engine/RankMatchFinishDetail.cs create mode 100644 SVSim.BattleEngine/Engine/RankMatchResultAnimationAgent.cs create mode 100644 SVSim.BattleEngine/Engine/RankMatchResultAnimationHandler.cs create mode 100644 SVSim.BattleEngine/Engine/RankMatchResultReporter.cs create mode 100644 SVSim.BattleEngine/Engine/ReadMail.cs create mode 100644 SVSim.BattleEngine/Engine/ReadMailDetail.cs create mode 100644 SVSim.BattleEngine/Engine/RealTime.cs create mode 100644 SVSim.BattleEngine/Engine/RealTimeNetworkAgent.cs create mode 100644 SVSim.BattleEngine/Engine/ReceiveFriendApplyInfo.cs create mode 100644 SVSim.BattleEngine/Engine/ReceiveFriendApplyInfoDetail.cs create mode 100644 SVSim.BattleEngine/Engine/RecoveryOperateMgr.cs create mode 100644 SVSim.BattleEngine/Engine/RecoveryOperateReceive.cs create mode 100644 SVSim.BattleEngine/Engine/RecoveryOperationCollection.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterAlter.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterAttach.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterCopyToken.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterDeckOut.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterEnhanceTrigger.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterEvolution.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterExtract.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterFilter.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterFusion.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterMetamorphoseData.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterOpenMyCards.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterPlayerParameter.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterScan.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterShortageDeckWin.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterSkillConditionCheck.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterSpecialWin.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterStateChangeCard.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterTool.cs create mode 100644 SVSim.BattleEngine/Engine/RegisterValidate.cs create mode 100644 SVSim.BattleEngine/Engine/RepeatSkillEffectVfx.cs create mode 100644 SVSim.BattleEngine/Engine/ReplayBattleEnemy.cs create mode 100644 SVSim.BattleEngine/Engine/ReplayBattlePlayer.cs create mode 100644 SVSim.BattleEngine/Engine/ReplayExecutionInfoCreator.cs create mode 100644 SVSim.BattleEngine/Engine/ReplayMoveTurnItem.cs create mode 100644 SVSim.BattleEngine/Engine/ReplayMoveTurnPanel.cs create mode 100644 SVSim.BattleEngine/Engine/ReplayOperateReceive.cs create mode 100644 SVSim.BattleEngine/Engine/ReplayOperationCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Reward.cs create mode 100644 SVSim.BattleEngine/Engine/RivayleBackalleyField.cs create mode 100644 SVSim.BattleEngine/Engine/RivayleField.cs create mode 100644 SVSim.BattleEngine/Engine/RoomBattleMatching.cs create mode 100644 SVSim.BattleEngine/Engine/RoomBattleMatchingDetail.cs create mode 100644 SVSim.BattleEngine/Engine/RoomMatchFinish.cs create mode 100644 SVSim.BattleEngine/Engine/RoomMatchFinishDetail.cs create mode 100644 SVSim.BattleEngine/Engine/RoomMatchReportEndAgent.cs create mode 100644 SVSim.BattleEngine/Engine/RoomMatchResultAnimationAgent.cs create mode 100644 SVSim.BattleEngine/Engine/RoomMatchResultAnimationHandler.cs create mode 100644 SVSim.BattleEngine/Engine/RoomMatchResultReporter.cs create mode 100644 SVSim.BattleEngine/Engine/RoomTwoPickBeforeBattleInfo.cs create mode 100644 SVSim.BattleEngine/Engine/RoomTwoPickInfo.cs create mode 100644 SVSim.BattleEngine/Engine/RoyalPalaceField.cs create mode 100644 SVSim.BattleEngine/Engine/RoyalPalaceNightField.cs create mode 100644 SVSim.BattleEngine/Engine/SearchUserInfo.cs create mode 100644 SVSim.BattleEngine/Engine/SearchUserInfoDetail.cs create mode 100644 SVSim.BattleEngine/Engine/SelfBattlePlayerFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SendFriendApplyInfo.cs create mode 100644 SVSim.BattleEngine/Engine/SendFriendApplyInfoDetail.cs create mode 100644 SVSim.BattleEngine/Engine/ShopSupplyCardPanel.cs create mode 100644 SVSim.BattleEngine/Engine/SimpleCardDetail.cs create mode 100644 SVSim.BattleEngine/Engine/SingleBattleMgr.cs create mode 100644 SVSim.BattleEngine/Engine/SingleExecutionInfoCreator.cs create mode 100644 SVSim.BattleEngine/Engine/SingleSkill_attach_skill.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityAccelerateFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityBurialRiteFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityCantAttackAllFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityCrystallizeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityDestroyWhiteRitualFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityDrainFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityEnhanceFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityFusionFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityGuardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityKillerFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityNecromanceFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityQuickFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityReanimateFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityRushFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilitySneakFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilitySpellChargeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityStackWhiteRitualFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilitySuperSkyboundArtFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityUnionBurstFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityWhenAttackFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityWhenDestroyFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityWhenEvolveFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityWhenFightFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityWhenPlayFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityWhenPlayNoSelectAndBurialRiteFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAbilityWhiteRitualFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAllCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAttachingAbilityFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAttackIsLarger.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAttackedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillAvariceCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillBothClanFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillCalcFifthRoundDown.cs create mode 100644 SVSim.BattleEngine/Engine/SkillCalcHalfRoundDown.cs create mode 100644 SVSim.BattleEngine/Engine/SkillCalcHalfRoundUp.cs create mode 100644 SVSim.BattleEngine/Engine/SkillCalcMaxFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillCalcMinFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillCalcQuarterRoundUp.cs create mode 100644 SVSim.BattleEngine/Engine/SkillCalcSumFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillCardFilterBase.cs create mode 100644 SVSim.BattleEngine/Engine/SkillCardTurnDestroyedFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillCemeteryFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillChantFieldFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillChoiceSelectFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillClanFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillClassFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillCompareFuncCreator.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionAttachingAbility.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionAttackerIsOther.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionAttackerIsSelf.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionAvarice.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionAwake.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionBeAttackedIsDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionBeAttackedIsOther.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionBeAttackedIsSelf.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionBurialRite.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionDeckSelfSummonedSelf.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionDisplayOtherUsersMessage.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionEvolvableTurn.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionHalfLife.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionHealingCardIsClass.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionInHandIsOther.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionInHandIsSelf.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionIsInplayCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionIsReanimateCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionMeLanguage.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionOddEvenOffense.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionOddEvenSpellCharge.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionPP.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionPlayCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionReanimatedSelf.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionResonance.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionShortageDeckWin.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionTrigger.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionTurn.cs create mode 100644 SVSim.BattleEngine/Engine/SkillConditionWrath.cs create mode 100644 SVSim.BattleEngine/Engine/SkillCostNoDuplicationRandomSelectFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalAttachedTurnFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalBpFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalCemeteryCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalCharaIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalDeckBanishCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalDefaultDamageFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalEPFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalFirstPlayerTurnFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalFixedDamageFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGameBuffCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGameConditionFulfilledTurnPlaycount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGameDiscardSkillCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGameFusionCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGameMetamorphoseSkillCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGameNecromanceCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGamePlayCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGameResonanceStartCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGameReturnSkillCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGameSuperSkyboundArtCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGameUsedEpCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGameUsedPpCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalGameUsedWhiteRitualCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalJatelantBanishCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalJatelantDamageAndHealCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalJatelantSummonTokenCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalLastInplayWhiteRitualStackFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalLastNecromanceCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalLastUsedWhiteRitualStackCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalMaxEPFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalMaxPPFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalPPFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalPlayCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalRallyCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalSecondPlayerTurnFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalShortageDeckLose.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalTurnDiscardSkillCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalTurnEnhanceCardCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalTurnEvolveCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalTurnFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalTurnResonanceStartCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalTurnReturnSkillCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalTurnUsedEpCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalTurnWhenHealingCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEnvironmentalUsableEPFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillEvolutionCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillExclutionApplyFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillExclutionNoneFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillFieldFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillFusionIngredientCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillGetOffCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillGetOnCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillIdNoDuplicationRandomSelectFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillInOrderFromOldestFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillIncludeSelfCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillIsBuffDetailFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillIsFusionInfoOrIsNotSideLogFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillIsInvokeSideLogorBuffDetailFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillIsOwnerFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillIsWatchFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillKeywordInfo.cs create mode 100644 SVSim.BattleEngine/Engine/SkillLastBurialRiteCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillLastFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillLastTargetTribeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillLeaderSkinIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillLifeIsLarger.cs create mode 100644 SVSim.BattleEngine/Engine/SkillLimitUpperCountFromNewestFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillLimitUpperCountFromOldestFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillLoadTargetFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillMultiClanFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillNoDuplicationRandomSelectInOrderFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillNotChantFieldFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillNullFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillOnlyOneCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillOnlyOneFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterActivatedRandomArrayFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterAttackCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterBaseCardIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterBaseCostFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterBaseLifeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterBaseOffenseFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterBuffCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterBuffLifeCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterChangeMaxLifeCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterChantCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterChargeCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterCostFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterDestroyFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterDestroyedByAbilityFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterDestroyedByCardIdAndAbilityFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterDestroyedByCardIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterDestroyedByFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterDistinctRandomSelectedFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterFusionCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterHasSkillFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterHealCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterHealValueFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterIsChaosFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterIsTurnFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterIsUnlimitedFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterLastLifeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterLifeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterLoadTargetCardId.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterMaxAttackCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterMaxLifeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterOffenseFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterPreviousTurnAttackedFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterRandomArrayFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterRarityFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterReturnedByFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectAttackCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectBaseCardIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectBaseCostFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectBaseLifeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectBaseOffenseFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectBuffCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectChangeMaxLifeCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectChantCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectChargeCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectCostFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectDamageCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectEvenChargeCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectFixedGenericValueFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectFixedGenericValueInitialFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectGenericValueFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectLastCostFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectLastLifeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectLastUsedPpCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectLifeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectMaxAttackCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectMaxLifeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectOddChargeCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectOffenseFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectRandomGenericValueFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectRemainActionCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectRemainActionCountFromSelfFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectSkyboundArtCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectSuperSkyboundArtCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectUnionBurstCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSelectWhiteRitualCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSkillActivatedCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSkillHealValueFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterSkillIdActivatedCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterStrictDestroyFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterThisTurnSkillActivatedCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnAcceleratedCardCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnAcceleratedCardCountTextFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnAmountValueFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnBuffCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnCausedDamageFromUnitFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnDamageCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnDamageCountTextFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnDamageValueFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnFusionCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnFusionCountTextFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnHealCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnHealCountTextFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnHealValueFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnPlayOtherCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnPpAddCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnStartLife.cs create mode 100644 SVSim.BattleEngine/Engine/SkillParameterTurnSummonCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPlayCardTypeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPlayMomentSpellChargeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPlayMomentTribeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessAnyCondition.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessBurialRite.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessConditionCheck.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessDamageAfterStop.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessDamageGiveStop.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessDestroyTribe.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessDontActivate.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessDontSelectStart.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessEvolutionEndStop.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessFixedGenericValue.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessInPlayPeriodOfTime.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessIsActivateSummonCard.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessNecromance.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessOncePerAction.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessOpenCard.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessPeriodBase.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessRandomArrayIndex.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessRandomCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessReferencePrevious.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessReflectionAfterStop.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessRemoveAfterAction.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessRemoveFromInPlayStop.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessSelfTurnEndRemove.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessSkillActivateCountBySimultaneousBuffingCards.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessSkillActivateCountBySimultaneousDestroyedCardList.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessSkillActivateCountBySimultaneousSummonedCard.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessSkillAfterStopBase.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessSkillId.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessSkillStopAndRemoveByWhenSummonOther.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessTimesPerBase.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessTimesPerGame.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessTimesPerTurn.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessTurnEndPeriodOfStopTime.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessTurnEndRemove.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessTurnEndSkillAfterStop.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessTurnEndStop.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessTurnEndStopAndRemove.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessTurnStartSkill.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessTurnStartSkillAfterPeriodOfStopTime.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessTurnStartSkillAfterStop.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessTurnStartStop.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessUnitAttackStop.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessUseEvolutionPoint.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessUsePp.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessWhenEvolveEndRemove.cs create mode 100644 SVSim.BattleEngine/Engine/SkillPreprocessWrappingAndAddingSkillActivatedCount.cs create mode 100644 SVSim.BattleEngine/Engine/SkillRandomEachSameBaseCardIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillRandomSelectFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillRandomSelectUntilFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillResidentPreprocessReturnHandActiveReset.cs create mode 100644 SVSim.BattleEngine/Engine/SkillSelectAllFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillSelectIndexFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillSelectNullFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillSelectableCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillSpellAndFieldFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillSpellFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillSummonMomentTribeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetAcceleratedCardfilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetAttackerFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetBanishedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetBanishedLastTargetFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetBattleStartDeckFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetBeAttackedFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetBeforeTransformCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetBurialRiteCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetBurialRiteCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetBurialRiteThisTurnCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetCantAttackAllLastTargetFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetCantAttackAllReturnCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetCemeteryFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetChantCountChangeCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetChosenCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetCrystallizedCardfilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDamagedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDeckBanishedCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDeckDrawCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDeckFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDeckSelfFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDestroyedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDestroyedCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDestroyedLastTargetFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDestroyedThisTurnCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDestroyedWhenDestroyCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDiscardCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDiscardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDiscardThisTurnCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDiscardedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDrewOverHandLimitFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetDrewSkillFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetEnhanceCardfilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetEqualOrLessCostFromLastTarget.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetEvolutionCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetEvolvedCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetFightTargetFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetFusionIngredientCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetFusionIngredientedCardListIncludeThisFusion.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetFusionIngredientedThisTurnCardList.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetFusionThisTurnCardList.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameAcceleratedCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameAcceleratedCardsOtherSelfFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameAddUpdateDeckCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameCrystallizedCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameDeckDrawCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameDrawCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameFusionIngredientedAndDiscardCards.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameFusionIngredientedCards.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameLeftCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGamePlayCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGamePlayCardsOtherSelfFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameQuickAttackCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameSkillActivatedFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameSummonCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGameSummonCardsOtherFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetGiveDamageCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetHandBanishedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetHandBanishedCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetHandBanishedThisTurnCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetHandFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetHandOtherOldestFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetHandOtherSelfFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetHandSelfFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetHealingCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInHandCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInPlayFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInPlayOtherSelfFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInPlaySelfFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInplayAndHandFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInplayBanishedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInplayBanishedCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInplayBanishedThisTurnCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInplayBuffingCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInplayDebuffingCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInplayLastTargetFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInplayMetamorphosedCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetInplaySelfAndClassFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetLastTargetFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetLeftCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetLeftThisTurnCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetLoadBurialRiteTargetFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetLoadTargetFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetMainPlaceFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetNecromanceFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetNewerInPlayOtherSelfFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetNotDamagedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetNotUniqueBaseCardIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetNullFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetOtherThanBeAttackedFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetOverCostFromLastTargetFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetPastSummonCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetPlayedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetReanimatedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetReanimatedThisTurnCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetReceivedDamageCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetReturnCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetReturnSkillFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetReturnThisTurnCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetSelectedCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetSelfFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetShortageDeckWinCards.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetSkillDrawCardListFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetSkillDrewCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetSkillSummonedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetSkillSummonedCardIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetSkillUpdateDeckCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetSummonedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetThroughFusionIngredientedCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetTokenDrawCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetTurnDrawCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetTurnPlayCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetTurnPlayCardsOtherSelfFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetTurnSummonCardsFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetTurnTokenDrawSkillIdFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTargetUniqueBaseCardIDCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTextVariableComareFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTribeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillTurnDestroyedFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillUniqueBaseCardIDCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillUniqueBaseCostCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillUniqueTribeCountFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillUnitAndAllFieldFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillUnitAndChantFieldFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillUnitAndClassFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillUnitAndNotChantField.cs create mode 100644 SVSim.BattleEngine/Engine/SkillUnitFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillUpdateDeckMomentTribeFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SkillUserSelectFilter.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_attack_by_life.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_attract_skill_target.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_banish.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_bp_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_can_play_self.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_cant_activate_fanfare.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_cant_activate_shortage_deck_win.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_cant_attack.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_cant_evolution.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_cant_play.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_change_affiliation.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_change_cemetery.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_change_rally_count.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_change_skybound_art_count.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_change_super_skybound_art_count.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_change_union_burst_count.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_change_white_ritual_stack.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_chant_count_change.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_choice.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_clear_destroyed_and_discarded_card_list.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_clear_summoned_card_list.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_consume_ep_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_copy_skill.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_cost_change.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_damage.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_damage_cut.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_damage_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_destroy.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_discard.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_drain.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_draw.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_evolve.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_evolve_to_other.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_extra_turn.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_force_avarice.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_force_berserk.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_force_skill_target.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_force_wrath.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_fusion.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_generic_value_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_getoff.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_geton.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_guard.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_heal.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_heal_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_ignore_guard.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_independent.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_indestructible.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_invoke_emote.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_invoke_skill.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_invoke_voice.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_killer.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_life_zero_activate_leon_skill.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_loop_skill.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_lose.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_no_duplication_random_array.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_none.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_not_attached_resident_chant_count_change.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_not_be_attacked.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_not_be_debuffed.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_not_decrease_pp.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_play_count_change.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_possess_ep_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_power_down.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_power_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_pp_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_quick.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_random_array.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_random_attack.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_reflection.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_remove_by_banish.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_remove_by_destroy.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_repeat_skill.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_return_card.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_rob_skill.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_rush.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_select.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_shield.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_shortage_deck_win.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_sneak.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_special_lose.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_special_token_draw.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_special_win.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_spell_charge.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_stack_white_ritual.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_summon_card.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_summon_token.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_token_draw.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_token_draw_modifier.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_trigger.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_turn_start_fixed_pp.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_unite.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_untouchable.cs create mode 100644 SVSim.BattleEngine/Engine/Skill_update_deck.cs create mode 100644 SVSim.BattleEngine/Engine/SkyboundArtCountAddModifier.cs create mode 100644 SVSim.BattleEngine/Engine/SpecialArenaField.cs create mode 100644 SVSim.BattleEngine/Engine/SpecialCrystalInfo.cs create mode 100644 SVSim.BattleEngine/Engine/SpellBattleCard.cs create mode 100644 SVSim.BattleEngine/Engine/SpellSelectableCardFilter.cs create mode 100644 SVSim.BattleEngine/Engine/SpringPosition.cs create mode 100644 SVSim.BattleEngine/Engine/Sqlite3Plugin/DBProxy.cs create mode 100644 SVSim.BattleEngine/Engine/Sqlite3Plugin/PreparedQuery.cs create mode 100644 SVSim.BattleEngine/Engine/Sqlite3Plugin/Query.cs create mode 100644 SVSim.BattleEngine/Engine/StageField.cs create mode 100644 SVSim.BattleEngine/Engine/StartPickMultiCardVfx.cs create mode 100644 SVSim.BattleEngine/Engine/StockEmitMgr.cs create mode 100644 SVSim.BattleEngine/Engine/StoryCardPanel.cs create mode 100644 SVSim.BattleEngine/Engine/StoryChapterData.cs create mode 100644 SVSim.BattleEngine/Engine/StoryFinish.cs create mode 100644 SVSim.BattleEngine/Engine/StoryFinishDetail.cs create mode 100644 SVSim.BattleEngine/Engine/StoryInfo.cs create mode 100644 SVSim.BattleEngine/Engine/StoryLeaderSelect.cs create mode 100644 SVSim.BattleEngine/Engine/StoryLeaderSelectData.cs create mode 100644 SVSim.BattleEngine/Engine/StoryNextSceneSelector.cs create mode 100644 SVSim.BattleEngine/Engine/StoryReportEndAgent.cs create mode 100644 SVSim.BattleEngine/Engine/StoryResultAnimationAgent.cs create mode 100644 SVSim.BattleEngine/Engine/StoryResultAnimationHandler.cs create mode 100644 SVSim.BattleEngine/Engine/StoryResultReporter.cs create mode 100644 SVSim.BattleEngine/Engine/StorySectionData.cs create mode 100644 SVSim.BattleEngine/Engine/SuperSkyboundArtCountAddModifier.cs create mode 100644 SVSim.BattleEngine/Engine/TaskManager.cs create mode 100644 SVSim.BattleEngine/Engine/TempleField.cs create mode 100644 SVSim.BattleEngine/Engine/TempleNightField.cs create mode 100644 SVSim.BattleEngine/Engine/TurnPanelControl.cs create mode 100644 SVSim.BattleEngine/Engine/TweenColor.cs create mode 100644 SVSim.BattleEngine/Engine/TweenRotation.cs create mode 100644 SVSim.BattleEngine/Engine/UIBase_Textuer.cs create mode 100644 SVSim.BattleEngine/Engine/UICardList.cs create mode 100644 SVSim.BattleEngine/Engine/UIKeyNavigation.cs create mode 100644 SVSim.BattleEngine/Engine/UIOrthoCamera.cs create mode 100644 SVSim.BattleEngine/Engine/UIPopupList.cs create mode 100644 SVSim.BattleEngine/Engine/UITweenAlpha.cs create mode 100644 SVSim.BattleEngine/Engine/UnionBurstCountAddModifier.cs create mode 100644 SVSim.BattleEngine/Engine/UnitBattleCard.cs create mode 100644 SVSim.BattleEngine/Engine/User.cs create mode 100644 SVSim.BattleEngine/Engine/UserCard.cs create mode 100644 SVSim.BattleEngine/Engine/UserConfig.cs create mode 100644 SVSim.BattleEngine/Engine/UserCrystalCount.cs create mode 100644 SVSim.BattleEngine/Engine/UserDegree.cs create mode 100644 SVSim.BattleEngine/Engine/UserEmblem.cs create mode 100644 SVSim.BattleEngine/Engine/UserFriend.cs create mode 100644 SVSim.BattleEngine/Engine/UserInfo.cs create mode 100644 SVSim.BattleEngine/Engine/UserPromotionMatch.cs create mode 100644 SVSim.BattleEngine/Engine/UserRank.cs create mode 100644 SVSim.BattleEngine/Engine/UserTutorial.cs create mode 100644 SVSim.BattleEngine/Engine/UtilityDrumrollScroll.cs create mode 100644 SVSim.BattleEngine/Engine/VellsarDesertField.cs create mode 100644 SVSim.BattleEngine/Engine/VideoHostingUtil.cs create mode 100644 SVSim.BattleEngine/Engine/VirtualBattleEnemy.cs create mode 100644 SVSim.BattleEngine/Engine/VirtualBattlePlayer.cs create mode 100644 SVSim.BattleEngine/Engine/VoiceDictionaries.cs create mode 100644 SVSim.BattleEngine/Engine/VolcanoField.cs create mode 100644 SVSim.BattleEngine/Engine/VoteData.cs create mode 100644 SVSim.BattleEngine/Engine/WatchOperateReceive.cs create mode 100644 SVSim.BattleEngine/Engine/WatchOperationCollection.cs create mode 100644 SVSim.BattleEngine/Engine/WatchTouchControl.cs create mode 100644 SVSim.BattleEngine/Engine/WatchTurnEndTimeController.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.AutoTest/AutoTestBattleMgr.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Card/IVirtualBattleCard.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/MulliganMgrBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/MulliganOperateControl.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/NetworkMulliganMgr.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/OpponentMulliganView.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/PlayerMulliganCardSortOutVfx.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/SingleMulliganMgr.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Operation/OperationSimulator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Operation/SimulateRandomSelectFilter.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Operation/TurnEndOperationCommand.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Phase/LoadingPhase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Phase/MainPhase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Phase/MulliganPhaseBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Phase/NetworkMulliganPhase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Phase/OpeningPhase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Phase/PhaseCreatorBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Phase/RecoveryAfterMulliganPhase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Phase/RecoveryNetworkBeforeSubmitMulliganPhase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/Class3dCharacterBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/ClassCharacterBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/HighRankSpineClassCharacter.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/SpineObject.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/Debug722006NullVfx.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/OperationRecorderBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/RecoveryManagerBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/RecoveryRecordManagerBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Sound/LeaderSoundManager.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.Touch/ITouchProcessor.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.UI/IClassInfomationUI.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.UI/LogType.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.UI/SkillGainType.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.View/HandCardFrameEffectType.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.View/HandParameter.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.View/IBattleCardView.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.View/IBattlePlayerView.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.View/IClassBattleCardView.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle.View/IPlayerView.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle/NetworkOpponentInnerOptionsBuilder.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle/NullInnerOptionsBuilder.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Battle/PlayerInnerOptionsBuilder.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Bingo/BingoDrawTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Bingo/BingoInfoTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/CardSelectListUIBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/CardSelectListUI_State_CardDrag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/CardSelectListUI_State_Edit.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/DeckCardEditUI.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/DeckSave.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/FirstDisplayPageIndexGetterBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/IFirstDisplayPageIndexGetter.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/QuestFirstDisplayPageIndexGetter.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemButton.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemGrid.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemLabel.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemSelect.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemSlider.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemToggle.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/SettingBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.ErrorDialog/Dialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryApplyDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryLoadTaskData.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryMissionData.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/CandidateCard.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/CandidateChaos.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/CandidateClass.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/Deck.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/EntryInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/MyMasterRanking.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/RankingPeriod.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/RankingPeriodList.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/RankingUser.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData/ItemAcquireHistory.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick/BattleResult.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick/CandidateCardInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick/Entry.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena/Finish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena/FinishDetail.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena/TwoPickInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Battle/DoMatchingResponse.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckBuyTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckProductInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckPurchaseInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckSeriesPurchaseInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseBuyTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseData.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Ranking/MonthlyRanking.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Ranking/MyMasterPointHistories.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Ranking/Ranking.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinBuyMultiRewardTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinBuyMultiTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinBuySingleTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinProductInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinPurchaseInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinSeriesPurchaseInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SleevePurchase/SleeveProductInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SleevePurchase/SleevePurchaseInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SleevePurchase/SleeveSeriesPurchaseInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/GachaPointExchangeInfoTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/GachaPointExchangeTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/SpotCardExchangeInfoTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/SpotCardExchangeTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData/ItemAcquireHistoryInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAccelerate.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAfterAttackBanish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAfterAttackDraw.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAfterAttackEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAfterAttackHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAfterClashDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAfterClashHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAllyDiscardBonus.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttachEventToBattleModuleUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttachedTagLeaveStopInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttachedTagStopPreprocessOption.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttachedTagTurnEndStopInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttachedTagTurnStartStopInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackAddDeck.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackAttackableCount.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackBreakAttackTwice.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackBreakDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackBreakEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackBreakRecoverPp.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackDiscard.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackHandBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackMove.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashBanish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashBarrierBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashDamageClip.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashKeywordSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashRemoveSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashRemoveTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashShield.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashSpellboost.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackSetStatus.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackSimulationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackSubtractCountdown.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAttackTagSimulator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIAutoEvolutionSimulationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBanishAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBarrierAfterDamageStopInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBarrierLeaveStopInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBarrierSimulationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBarrierStopPreprocessOption.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBarrierTurnEndStopInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBarrierTurnStartStopInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBattleInfoReceiver.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBattleSimulationLauncher.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBattleStartData.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBattleStartDetail.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBattleStartTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBestFusionPatternCalculator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBonusArgumentWithIgnoreInBattle.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBounceDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBreakAddStack.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBreakAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBreakBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBreakDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBreakDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBreakHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBreakRecoverAttackableCount.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBreakRecoverPp.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBreakSetLeaderMaxLife.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffDraw.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffRecoverPp.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffRush.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffShield.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffSimulationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffStopPreprocessOption.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBuffTurnEndStopInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBurialRite.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIBurialRiteSimulationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangeInplayAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangeInplayCannotAttack.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangeInplayCannotPlay.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangeInplayFixRemoveType.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateBarrierBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateDamageClip.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateDamageCut.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateDamageModifier.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateIndestructible.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateKeywordSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateLifeLowerLimit.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateShield.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChangePpTotalBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChoiceBrave.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChoiceTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChoiceTransform.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIChoiceTransformUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIClashBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIClashDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIClashDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIConsoleUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AICrystalize.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIDamagedBonus.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIDamagedBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIDamagedCantUnderAttack.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIDamagedDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIDamagedHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIDamagedToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIDelayTurnEndTime.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIDelayTurnEndTimePolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIDiscardDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIDiscardHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIDiscardUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIDiscardedToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEarthRite.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEmoteOnTurnTransition.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEmoteUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEnhance.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvaluateBonusFromOhterUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoAddDeck.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoAddStack.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoAttackableCount.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoBanish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoBounce.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoChangeCost.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoDamageCut.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoDiscard.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoGiveBasicSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoHandBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoHandMetamorphose.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoHandSelect.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoMetamorphose.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoReanimate.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoRecoverPp.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoSetLeaderMaxLife.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoSetStatus.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoShield.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoSubtractCountdown.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvoTokenDraw.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvolMove.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvolveToOtherTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvolvedAttackable.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvolvedAttackableCount.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIEvolvedSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIFilteringActivateCountArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIFilteringUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIFiltersAndSelectTypeArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIFiltersArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIFirstMoveBonus.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIFunctionResultHashCalculator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIFusion.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIFusionDraw.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIFusionMetamorphose.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIFusionMove.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIGameStartAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIGenerateTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIGetOffEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIGetOffMetamorphose.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIGetOn.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIGetOnBanish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIGetOnDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIGetOnEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIGetOnSimulationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIGiveSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIGlobalEmptyList.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIHandPtnCalculator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIHealAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIHealBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIHealDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIHealEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIHealHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIHealToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIInstantAttackUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordAddCemetery.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordAddDeck.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordBanish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordDamageClip.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordDraw.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordMetamorphose.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordReanimate.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordRemoveSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordSetStatus.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordShield.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordSubtractCountdown.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILastwordToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILeaderLifeEvaluationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILeaveAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILeaveBanish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILeaveDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILeaveHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILeaveToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AILethalSimulator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIMathematicsLibrary.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIModifyValue.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIMove.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AINecromance.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AINecromanceAddCemetery.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AINecromanceAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AINecromanceDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AINecromanceHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherAttackAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherAttackBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherAttackDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherAttackHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherAttackRemoveTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherAttackToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherBanishAddCemetery.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherBanishToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherBattleBonusRate.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherBreakBonus.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedBanish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedSetLeaderMaxLife.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedSubtractCountdown.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoAddCemetery.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBanish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBonus.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBounce.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoDraw.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoShield.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoSubtractCountdown.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherEvoTokenDraw.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherLeaveDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherLeaveToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherPlayBonus.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherPlayBonusRate.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherPlayoutDamageBonus.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonAddCemetery.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonBanish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonBarrierBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDamageClip.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDamageCut.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDraw.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonKeywordSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherSummonSubtractCountdown.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayBounce.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayKeywordSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayRecoverPp.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayRemoveTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlayBreak.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlayCardSimulationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlayMove.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlayOnSkillUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlayOutChecker.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlayPtnUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlaySkipIfEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlaySkipTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithAction.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithActionIfEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithFilteredTargets.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlayTagInitializingUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlayTokenSimulationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlayptnBaseStatsRate.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPlayptnBaseStatsRateUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIPreprocessSimulationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIRealBattleCardSearcher.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIReincarnationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIRemoveByDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIRemoveSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIRemoveTagUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIResonanceDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIResonanceGiveBasicSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIResonanceHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIRuleBaseBattleSimulator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIScriptArgumentToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIScriptExpressionCalculator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIScriptFunctionToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIScriptIDToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIScriptNumericToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIScriptOperatorSymbolToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIScriptParser.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIScriptTextToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIScriptVariableToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISelectLogicArgumentBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISelectTargetPattern.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISetTribe.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISimulationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISkillSimulationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIStack.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIStackCountUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISummonAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISummonBanAttack.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISummonBanish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISummonBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISummonDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISummonDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISummonEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISummonHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISummonKeywordSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AISummonTokenUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITargetSelectFilteringUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITargetSelectTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITargetSelectUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITestGlobal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITimeOverAttackSimulator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITokenDrawUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITokenIdHolderCandidateRangeInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITribeSimulationUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITriggerAndTargetFiltersTagBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndAddDeck.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndBanAttack.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndBanish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndBarrierBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndBounce.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndDamageClip.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndDamageCut.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndDiscard.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndDraw.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndKeywordSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndMetamorphose.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndRemoveTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndSetLeaderMaxLife.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndShield.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndSubtractCountdown.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnEndToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnStartAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnStartBarrierBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnStartDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnStartDamageCut.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnStartShield.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnStartSubtractCountdown.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AITurnStartTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIUnknownAction.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIUntouchableLeaveStopInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIUseMinArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIVirtualAttackSimulator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIVirtualCardStatusInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIVirtualEvolutionSimulator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIVirtualPlaySimulator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIVirtualTargetSelectSimulationInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIVirtualTargetSelectSimulator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIVirtualTurnEndSimulator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenAttackOrWhenFightTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenAttackSelfAndOtherTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenChangeInplayTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAddCemetery.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAddDeck.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAttachStyle.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAttachTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAttackableCount.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBanAttack.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBanish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBarrierBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBonusInSimulation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBounce.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayChangeClass.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayChangeCost.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayChangeTribe.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayCopyTag.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamageClip.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamageCut.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDestroy.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDiscard.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayEvo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHandBuff.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHandMetamorphose.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHandSelect.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHeal.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayKeywordSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayMetamorphose.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayModifyConsumeEp.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayNotBeAttacked.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayReanimate.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRecoverAttackableCount.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRecoverPp.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRemoveKeywordSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRemoveSkill.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySelect.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySetLeaderMaxLife.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySetMaxStatus.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayShield.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySpellboost.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySubtractCountdown.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySummonHandCard.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySummonToken.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayTokenArgumentBase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AIWhenPlayTokenDraw.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AchievementImpl.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AllLabelColorChanger.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AllyPlayBonusPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AllyPlayBonusRatePolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AreaSelectClearReward.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ArenaConfigDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/AvatarBattleAllInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BarrierBonusPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BaseProductDetail.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BaseShopPurchasePage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BattleMenuUserPanel.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BattlePassGaugeInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BattlePassGuage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BattlePassLevelInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BattlePassMonthlyMission.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BattlePassResultPanel.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BattleSequencer.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BattleStartUserPanel.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BestInPlayMoveAI.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BestOpenSpaceAttackAI.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/BrowserURL.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CampaignBattleWin.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CampaignRewardInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CardCreateTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CardDestructTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CardMasterLocalFileUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CardProtectTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CardSelectListConfirmPagerView.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CardSkillHashUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ChaosUtil.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ChapterObjectCenteringSupporter.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CheckSpecialTitleTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CheckTimeSlipRotationPeriodTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ChoiceVirtualCard.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ClassInfomationOrder.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ClassSelectionButton.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ClassSkinDetailWindow.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ClassUtil.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ColorCode.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CompetitionBattleFinish.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CompetitionBattleFinishDetail.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CompetitionResultAnimationAgent.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CompetitionResultAnimationHandler.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CompetitionResultReporter.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CompleteDeckDecideDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ConventionInfoTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ConvertTime.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CrossOverClassInfomationOrder.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Crossover.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CrossoverPortalParam.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CrossoverRestrictedCard.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CrossoverRewardInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/CsvColumns.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Data.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DeckAutoCreateTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DeckBuildShortageCardView.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DeckCopyDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DeckInfoTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DeckListUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DeckSelectUI.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DeckSelectUIDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DeckSelectUIDialogTitle.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DegreeHelper.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DialogCreator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DialogItemPurchase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DialogSubText.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DisableLethalCheckPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DiscardedVirtualCard.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/DrumrollDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/EffectUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/EmoOnLeaderDamagedPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/EmoOnTurnEndPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/EmoOnTurnStartPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/EmptyDeckInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/EncryptData.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/EnemyAINull.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/EnemyAIUtil.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/EnemyHandVirtualCard.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/EpValuePolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/EvaluationType.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ExchangeConfirmDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field1005.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field1006.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field1007.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field1008.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field1009.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field1010.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field1011.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field1012.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field51.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field52.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field61.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field62.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field71.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field72.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field73.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field74.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field75.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Field76.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/FilteringSleeveSelection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/FirstTips.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/FixedRemoveType.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Footer.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/FormatBehaviorManager.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/FormatChangeUI.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/FreeCardPackCampaignFinishTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/FullSimulationAI.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/GachaPointExchangePlate.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/GachaUIParam.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/GameStartAttachTagPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/GatheringMyPageInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/GatheringRule.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/GetCardMasterTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/GetSelectSkinOwnedStatusTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/GuildNotification.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/IAIRemoveTagArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/IAITurnEndArgument.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/InCompleteDeckDecideDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/InplayMovePatternFilter.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ItemPurchase.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ItemPurchasePlate.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/LabelDefine.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/LocalLog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/LocalizeJson.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/LootBoxDialogUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Mastershop.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Matching_Competition.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Matching_Sealed.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MaterialDefine.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MissionInfoTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ModUnitRatePolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MoveFirstBonusPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MovieSubtitles.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MyPage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MyPageBGInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MyPageCustomBGControl.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MyPageDetail.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MyPageMaintenanceNotification.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MyPageMyPageNotificationDetail.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MyPageNotifications.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MyRotationAbilityGroup.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MyRotationAllInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MypageReceiveSpecialTreasureTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/MypageTreasureBoxCpOpenTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/NetworkSkill_spell_charge.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/NetworkUI.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/OptionSettingWindow.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PackInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PackOpenTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlayBreakPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlaySimulationInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlaySkipIfEvoInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlaySkipWithActionIfEvoInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlaySkipWithActionInformation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlayedTogetherHistory.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlayedTogetherInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlayerEmoOnLeaderDamagedPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlayerEmoOnTurnEndPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlayerEmoOnTurnStartPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlayerPrefsWrapper.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlayerStaticData.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PlayptnBonusPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PolicyCollectionWithSingleType.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PolicyCollectionWithTypeCreator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PracticeData.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PracticeDataMgr.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PracticeFinishTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PracticePuzzleMissionData.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PremiumCardConversionTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Prerelease.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ProductDetailPlate.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PurchaseRewardDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PuzzleAnimation.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PuzzleQuestSelectGroup.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/PuzzleUtil.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/QuestCampaignDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/QuestDeckListTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/QuestLastUsedDeckSaveDataManager.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/QuestMissionInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/QuestMissionInfoTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/QuestOpenInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/QuestPointInfoTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/QuestPuzzleSelectionButton.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/QuestRewardReceiveAllTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/RankWinnerReward.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignResultData.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignRewardData.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ReplayInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ReplayInfoItem.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/RewardConfirmDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/RewardConfirmView.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/RewardConfirmViewItem.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/RoomNonPossessionCardCampaign.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/RoomRuleInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/RoomTwoPickMultiDeckInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/RubyText.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SealedCardInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SealedClassInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SealedData.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SealedMyPageResponseData.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SelectCardPurchaseConfirmDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SelectSkinCardDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SelectSkinCardPlate.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SetReferenceIdPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SetReferenceTribePolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SetUp.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ShopCommonSaleInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ShopCommonUtility.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ShopDrumrollScrollItem.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ShopNotification.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ShopPanelAppealItem.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SimulationSetting.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SkinProductDetail.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SleeveBuyTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SoftwareReset.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SpecialTreasureInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SpeedChallengeInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SpineDisplay.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SpotCardExchange.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SpotCardExchangeDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SpotCardExchangeInfo.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/StarterClassSelectDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/StoryFinishTask.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/StoryNotification.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/StorySectionBtn.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/StorySelectPage.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SubClassSelectDialog.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SummonedVirtualCard.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SupplyLabelPlate.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/SupplyLabelPlateListUI.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/TagCollectionWithSingleType.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/TagCollectionWithTypeCreator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/ToolboxGame.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/TransformBackup.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/TreasureBoxCp.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/TreasureCpBoxTextPanel.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/Tuple.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/UIAtlasManager.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/UIPageIndicator.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/UIParticleEffectManager.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/UIUtil.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/UnitBonusPolicyCollection.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/WebViewHelper.cs create mode 100644 SVSim.BattleEngine/Engine/Wizard/WebViewScreen.cs create mode 100644 SVSim.BattleEngine/Engine/YuwanField.cs create mode 100644 SVSim.BattleEngine/Engine/llField.cs create mode 100644 SVSim.BattleEngine/Shim/External/LooseEnds.cs create mode 100644 SVSim.BattleEngine/Shim/External/ThirdParty.cs create mode 100644 SVSim.BattleEngine/Shim/GodObjects/GodObjects.cs create mode 100644 SVSim.BattleEngine/Shim/UnityEngine/UnityShim.cs create mode 100644 SVSim.BattleEngine/Shim/View/VfxShim.cs create mode 100644 SVSim.BattleEngine/Shim/View/ViewUiTouchStubs.cs diff --git a/SVSim.BattleEngine/COPIED.manifest.tsv b/SVSim.BattleEngine/COPIED.manifest.tsv index 2e4ba63..046f7e1 100644 --- a/SVSim.BattleEngine/COPIED.manifest.tsv +++ b/SVSim.BattleEngine/COPIED.manifest.tsv @@ -1,34 +1,69 @@ # engine-relpath source-relpath sha256 patched(0|1) AchievedInfo.cs AchievedInfo.cs ea4a48fc79056999864843575ad2158855147d67f610cf0da6bce7ac2fc8ec3a 0 +AchievementInfo.cs AchievementInfo.cs 822021c9dd75a53d1e85bb97871f53ee0fb8bd92924a3209d35458d381c76e7a 0 +AchievementInfoDetail.cs AchievementInfoDetail.cs 9e1b20906951b38e6b0bd58aef69a2446a034aad14654b5832897def3fcfbaf5 0 +AchievementWindowBase.cs AchievementWindowBase.cs ced3e84a9c3c7085d64769f68ed54edfca7e637d14934978dfe98c966c459048 0 +ActiveAnimation.cs ActiveAnimation.cs 9ed4752c84da57a2d43ecf9c4f2e4f38f919ec959926046c4789abe82bba9f25 0 +AddDamageInfo.cs AddDamageInfo.cs 064839ffc0cb82bdcd15d929f33cc09c9732f68e3f95e1566d4aa1db6c61b730 0 AddTargetInfo.cs AddTargetInfo.cs 622c5cdc7421909489a00b7017670cadce81b74d0860dedbc662ab4faf6fd82a 0 +AlleyField.cs AlleyField.cs 138c25529e56d11ec28a82ae570ccee4fb1df1f52a258faaff4705afbebf13dc 0 +AnimationOrTween/Direction.cs AnimationOrTween/Direction.cs 7c497cb72737f19f0a3ce12c5cceb3ad7d4ba5b9fb5c43c5abab047e8fe3c59c 0 ApiType.cs ApiType.cs 36dd6f7ae87a7caa985eebb0de02f709f7276c48068b1db2f28dcfd1fdc826be 0 ApplySkillTargetFilterCollection.cs ApplySkillTargetFilterCollection.cs 286c92d6dee5ffb49b9d62e5064bdd303fa5dc523e7e29b3ef8ec03f2e185b8b 0 +AreaSelInfo.cs AreaSelInfo.cs ef8322fa8a622cb44b3e8ff1dc03b85f784d7397bfdf4b6018993489e5eeb35f 0 +ArenaColosseum.cs ArenaColosseum.cs 66b067b705e632eae13711062dad303f645fefe0eb92c7ea53faca6e11c1b3f1 0 +ArenaCompetition.cs ArenaCompetition.cs b93a87591acb5ab3e3e56a477ffbd2e9fd6a22a9fc0b46e29ace3553bbf4f279 0 +ArenaData.cs ArenaData.cs 03b256eb428d73a1b51df1bbea80f883256bea98e97b7c6410a79f5097bd76e0 0 +ArenaEntryDataBase.cs ArenaEntryDataBase.cs c952da76cb1ec0102c1f5b6ab3e858c59387811531043a489b5ef96b9286e01d 0 +ArenaField.cs ArenaField.cs ffd6e156fa2abe44f29e9f16304290fe8544e3f08a2d273f88823efec7e50d8c 0 +ArenaNextSceneSelector.cs ArenaNextSceneSelector.cs d9e4338e53fc085a892edb2cd7348764736ec35d475239d7b2a95ac67ede4e58 0 +ArenaResultAnimationAgent.cs ArenaResultAnimationAgent.cs 0d8142cdeb937bb6b2b37d9e34de3ddaeccf6c8ddfad7a15b49601e8ac154dea 0 +ArenaResultAnimationHandler.cs ArenaResultAnimationHandler.cs b24d6cff35b7521f83f362b5b8e44411ab33a19cb2b074bf64b4b18f4c8007d5 0 +ArenaResultReporter.cs ArenaResultReporter.cs 329f0ee53824a157dd9b240582f1bfa901da4d099856d47449bf3758d404d097 0 +ArenaTwoPickData.cs ArenaTwoPickData.cs d63a8dbd3ba6ff149bdfc5f651a23a0bcd02ee4cb03940460002cdeb22836c7f 0 ArrowControl.cs ArrowControl.cs 884ed3b803390467ba85ed67ae9edb7c6ce13e9fb46dc4221f87f086bad6ef0d 0 +AspectCamera.cs AspectCamera.cs 31f9273af0f4de11118ee062d16e6fcc4cf8bf37012af1ec81b14d6d58377eb9 0 AttachedSkillInformation.cs AttachedSkillInformation.cs 4596525861f9328a006ae767cb5687d37742ca4296f04446a715859705117435 0 AttachingAbilityInfo.cs AttachingAbilityInfo.cs dc7a858f5db686f046ffb9b7d004c3d513d2f6bd87e62737db7af3dc97429ce5 0 +AttackSelectControl.cs AttackSelectControl.cs 11e98f485db0cf64820b945ae46e2b1d72d85a218ca899d41e7d24289cbc7ad0 0 BMFont.cs BMFont.cs 1228c62e3a837d18284ce8047861a1f90cc7702df5b008fb4ce0b812f299b69a 0 BMGlyph.cs BMGlyph.cs 24ed29cc0a20d8b9bc91f2cd5607efd7f992b7f64d2dd885e58b5bf21ff5cb46 0 BMSymbol.cs BMSymbol.cs 0252903edf4666d2456e20c524783bf1647ce6ef559ac631ac287abc1ef4178d 0 BackGroundBase.cs BackGroundBase.cs b45dfcd6593e604dfc630dbd09ed09003fbc03ce5d5ca3d9c10f021331647f7f 0 BattleCamera.cs BattleCamera.cs 35cd1b3cfb6d5c9932a5b9777983b01fede0c8638a4ade7637a18318048ff2d7 0 BattleCardBase.cs BattleCardBase.cs b105aec032149ab0a1730c6e06e25530699851707150ad4b72e24fe6d17fd50f 0 +BattleCardIconAnimations.cs BattleCardIconAnimations.cs b92ae5d235191bf076a2997b4cd85bb9bd9a7689a388014bdac7390d271f428d 0 BattleControl.cs BattleControl.cs 1638d42a0eb5e0291da90b24a62db923c6ed66eca5a114010f39ba265b2e7bb2 0 +BattleCoroutine.cs BattleCoroutine.cs 52951b72da7d4605ff9ea8beb7e109b5634c0827bdcec30949c50fb36b75b6fa 0 BattleEnemy.cs BattleEnemy.cs e2c1e600cfa860ec5472508d52313db65b1bf8abfa1c28716e75e52a206c1a0c 0 BattleFinishParam.cs BattleFinishParam.cs 46ebca81cf025b911875d261bd9ab664392b66bbe0fcc86a48be93c80ed92d11 0 +BattleFinishSendBase.cs BattleFinishSendBase.cs 47a2e85409008b9e39579f7da0c312be4179954336e7bbc9f68a922f93757d08 0 +BattleFinishToOpponentDisConnectChecker.cs BattleFinishToOpponentDisConnectChecker.cs ec4b9678aa85a1eaacef626a6e07c20274535a4fca97db841fefc53be7f5381e 0 +BattleKeywordInfoListMgr.cs BattleKeywordInfoListMgr.cs a014170d0b3f5499635bcc2e29755dc2f3125d5a5a28b1741a4abc74b4abcf86 0 BattleLifeTimeSharedObject.cs BattleLifeTimeSharedObject.cs ab8bc3703d268752a1de56ab5d3e9ebd276980c20076eb0ca300838b3db13d5f 0 BattleManagerBase.cs BattleManagerBase.cs b4181eac7af0ed578835ea75b7003e1b3466331006a35cd84b40139825680eb7 0 BattleMenuMgr.cs BattleMenuMgr.cs 7418699063e01641d0df1ed16773a9ac9418f418cc047fc18c5892eb7971d361 0 BattlePlayer.cs BattlePlayer.cs 001409844b46ddaf0a5edbce4e015749ece61053adf725a978987d7063a02632 0 BattlePlayerBase.cs BattlePlayerBase.cs 9d3a665158706460a52900008dcfcdf575dbe08cb6d3cc05e63e718b2885b51b 0 +BattlePlayerVfxCreatorBase.cs BattlePlayerVfxCreatorBase.cs abcacc4b7a020259aa01cd08e31c1dd1abd8f87e482a64f9610032c453fa9fc4 0 BattleResultUIController.cs BattleResultUIController.cs d127088f56f60a0f3c3b5803e7254ecc3f966ad600aafad9cbd23683c45f4adb 0 +BattleSettingBaseData.cs BattleSettingBaseData.cs 57fdad819d3665fae83b35eb6b6d282461a92ed003dc618121e7a4f70b3152af 0 +BattleSettingData.cs BattleSettingData.cs dbf96af7489d434970b976ba065ddf8c9605754a9df727572e5c889404040291 0 +BattleStageChoiceObject.cs BattleStageChoiceObject.cs 1b474a12f067e6c9a05a7c9ec204d362f4e58f32eba6c9c947e7dc39c0d5eaa9 0 +BattleStageChoiceWindow.cs BattleStageChoiceWindow.cs 3fd7e4a2c933b9ab84b5148620dc510f89f95c4afb32814ad2e1cee98bbeff62 0 BattleStartControl.cs BattleStartControl.cs 3a790ddfdc9a1e9e3852ad4dab830074e4bc09925d54d53955ad838a42729a81 0 +BattleStopChecker.cs BattleStopChecker.cs 63f2c45b9493528468030b0c92917c3ec14b1c1d15735dd8b9dd603acb9f66c8 0 BattleUIContainer.cs BattleUIContainer.cs 3e6933c0efae7f1ea44f18faef01f77f187fa8af03ece36ccfc6dab3bb0d4b81 0 +BattleUtility.cs BattleUtility.cs 2fb4d029e53be602f954503ffbc0ebfadc62c8e6615a822a8a642bd07b179642 0 +BetterList.cs BetterList.cs 3fff32bb27bc6ed52ed8cebcebd1b70d0c83b8d49a008d15ad884237706e8471 0 Bgm.cs Bgm.cs 0563a3cfd7d3496978c1e8118976e8e176010f260a09a6d5021d6fb2cd7fd424 0 +BothBattlePlayerFilter.cs BothBattlePlayerFilter.cs d9b5460d0154326c4bfd32227da8987e9410dd94fd31be079960167e4b78b9de 0 BuffCountInfo.cs BuffCountInfo.cs a8ca34862f1d83c9c99a702eb5c4bd02e799ad2b9127f4c380b940029e884214 0 BuffDetailInfoUI.cs BuffDetailInfoUI.cs bef5b52e085808e650d013187963b8a8bcfe6c6623a253cb9707d6fac740cab4 0 BuffInfo.cs BuffInfo.cs 820575948ba2de316270e52a8009838b00ed7c6a834e37883372be24f6b07fdd 0 CantPlayCardFilterInfo.cs CantPlayCardFilterInfo.cs d83ea7282348ee3cf8b391748ec6720fa8a928ddb27020f8ee0191ea242d073d 0 CardBasePrm.cs CardBasePrm.cs e34d9f9bbf52dfe2a0b30cd56d5e900e711ac1423cd26d23dde627e6066c08c4 0 +CardCreatorBase.cs CardCreatorBase.cs 45a8375791df42ad905864765fe42d596e4d56614fe18f2d90df79b14e57f5c2 0 CardDataModel.cs CardDataModel.cs 5414f42ee02aa9fe5ed6ad2d88352a13f95f8127b81445a97dbadcde4110263e 0 CardDetailBase.cs CardDetailBase.cs 4759ffd1c1bf7dca9caa832224a498180d4c76366ff4a10866215eb748e5839c 0 CardDetailFilterCategory.cs CardDetailFilterCategory.cs b1285bd337493dc31ed03fb32b4fff63470235fd90dcd57ca677f253bd47d0d5 0 @@ -38,53 +73,161 @@ CardDetailFilterOffButton.cs CardDetailFilterOffButton.cs bbafe2b972e7fa91691301 CardDetailUI.cs CardDetailUI.cs db47e28623ffe64d90d49efefee8067ca6ce6653aed7882b7dc609cbb4c99e44 0 CardFilterKeyWordMaster.cs CardFilterKeyWordMaster.cs 2cb03086fa87e8135697828f96f8d839ce41f0a6b33d6028f8a985368c0e7b37 0 CardKeyWordCache.cs CardKeyWordCache.cs 27a1609fe451c9544ba050cd5d475be4ed9d5a065bef7bae1665213e177dbf09 0 +CardMake.cs CardMake.cs 948dbc828d0501576c93029d14181acc497eedeb7bb79592256bdc5a6b5af6f7 0 CardPack.cs CardPack.cs 193e08432c2dfb038c6eaff0b85f4dd50d39a8cb98d4f80583954b71a6919652 0 CardPackManager.cs CardPackManager.cs 08e789fd9a2c673d1947a4681804177f53a02ec0402390df630ea57395974514 0 +CardPanelMaintenancePlate.cs CardPanelMaintenancePlate.cs 0e77e5bf178933540af910b41d0ce7b2900b7eb261500352658a1ad52899f77a 0 +CardSelectListUI_Positioning.cs CardSelectListUI_Positioning.cs 31cb2574730de1af9a45f5b4569bf98ed48294c92a4ba2f3d1c61139ebc18f77 0 +CardShaderDefine.cs CardShaderDefine.cs dcc5f9ffbaadd9b58e191799b9d2581a50347c064482ec750775ebfa6cd242ac 0 CardTemplate.cs CardTemplate.cs 65399570d29ca06364b36aa0dece7591db03f01b6093a25c1e37eaa58a26a515 0 +CastleField.cs CastleField.cs cc7dda019991a151d0c6ef6f2044f72bda38528bf0a1b68a893ad15a1ceddcdd 0 CausedDamageCardParameterModifier.cs CausedDamageCardParameterModifier.cs 0376e7579b73800801bc049d121018a3575950737c35f871b485714921bf0a94 0 +ChallengeConfig.cs ChallengeConfig.cs 1f4e462c80a278fb1337c3173db675dac465c3ec3aabe330c7cb5db3f22e3447 0 +ChallengeData.cs ChallengeData.cs 97d920e88d32a6250a70a8e28c9dc46b5a64ef2b7dfb68e09075667cda06b244 0 +ChangeAffiliationVfx.cs ChangeAffiliationVfx.cs 24b75de653446ad964a050f8c493c0128a068f92d592a030b24c77eb40dd2100 0 +ChantCountAddModifier.cs ChantCountAddModifier.cs 9ad3d307986ca7bdde52eacbeb6314741b1601b4d2f6c344552df1904d26186a 0 +ChantCountSetModifier.cs ChantCountSetModifier.cs f800ee0b26519e2b7362af2c7aeca2120f7205a600acf1c659d2993a1783afe7 0 +ChantFieldBattleCard.cs ChantFieldBattleCard.cs e4a822d3a612543f37d223dbe7a751e3a30eace2cc2d40f49159d5534c27156c 0 +CharIdx.cs CharIdx.cs 7ff22de9e540d981db8eae5af20c74279edcc9f6526722a4783b253d4cdf96b8 0 +Charactor3dInformation.cs Charactor3dInformation.cs adf2decd42c9fbbb8d25001cb13c09daa3c5b5b966bb90c5e7e66b90685cf0b5 0 +ChateauField.cs ChateauField.cs baa59d3f23b02ab28c5ad5d262e41f01f812a4a771e63c647973d0ea5f898b6f 0 +Class3dPostImageEffect.cs Class3dPostImageEffect.cs f2bc26e2c6675c4be1daf97a625679aa6c89a86f5938e70c092584c8243061b7 0 +Class3dScreenOverlay.cs Class3dScreenOverlay.cs 21232996507eb29bd12c7f9d7530e8b3343a06b05260697038afc48c7530f019 0 +ClassBattleCardBase.cs ClassBattleCardBase.cs 3fcc1ab079f0b7d1b30873026971ef8bedb013e4f46ee49b4a9532968703b4f5 0 +ClassCharaExp.cs ClassCharaExp.cs 716ff126337cb011392a0aa189a0122c3eaf0e0bd6552ac13cd72ef040925955 0 ClassCharaPrm.cs ClassCharaPrm.cs 39f8c6b747beeb52b55996623c1ed36eee3c3bc27ea9955be9b257b845e0b2c6 0 ClassInformationUIController.cs ClassInformationUIController.cs dd8ae4d1a449c6ee5c03ebdca8e609bd3201299f2d145f87e0886bd7ba47ac39 0 +ClassSkinPlate.cs ClassSkinPlate.cs 5aab70386f16f29066a8c4d03887e9d0429a016b529af259e543da425be3fa98 0 +ClassSkinPurchasePage.cs ClassSkinPurchasePage.cs 74edd9b280bb306476fe89678512915dfc377a5d86369dcbbf493f03dda2645a 0 +ColosseumBattleFinish.cs ColosseumBattleFinish.cs 18dbacfbfbe0b305d484fe97f57e75a8448e1833ce0d2f905258b3e08cc7e4da 0 +ColosseumBattleFinishDetail.cs ColosseumBattleFinishDetail.cs b666569fbebdaa212c977a907ae272dddbd8b34d76435acac2e03d4a4c6092b2 0 +ColosseumResultAnimationAgent.cs ColosseumResultAnimationAgent.cs 94516a64af44aba18eb5104283aa0e41ef4bdb87423bd857742eec53fb57a916 0 +ColosseumResultAnimationHandler.cs ColosseumResultAnimationHandler.cs 7a2f79975efe09d891db158be9065a9edf2068af37d20ed02529109fd01300b5 0 +ColosseumResultReporter.cs ColosseumResultReporter.cs 6e9ca923733f01c6c20aeb544c5ce5c0e58284bb2d480b1b5faa65ce7f24e060 0 ConditionSkillFilterCollection.cs ConditionSkillFilterCollection.cs b8fc3d9621a1f8ae7aaffbaac618bdaba36b63b036a37b611d9a798e2e68a8aa 0 +ConnectionReportTrigger.cs ConnectionReportTrigger.cs c78d2c39db8a484c95b7e47c7bbdd16d050942c012531f286a188d5df33d3ca6 0 +ConnectionReporter.cs ConnectionReporter.cs 64f1c1133af6cd674763ed612d837a14bbc5ce1908afc9f3a93ff6b6cc18577f 0 ConventionInfo.cs ConventionInfo.cs f4199507123b62b5da1633608e877cf0d9ed4ecf26a1671d520dfa2c8ee3026a 0 +ConventionList.cs ConventionList.cs d0271cd5a5029c3ccf3fff460d093070d97fc13c1871573bd980733c6a21ad9c 0 +ConventionListPlate.cs ConventionListPlate.cs 367921469919006a00056b6899bad8ff06c7ffcebe0142abe71b40a206b61ac2 0 +ConventionListUI.cs ConventionListUI.cs 71ef763a92802844e97010920f4fe83430f2376b0349d5ce7333c0586a48d358 0 +CostAddModifier.cs CostAddModifier.cs 0627378794b72cb0f38a5a0b14aa70b03a02de4335074f21836b248e16c35ea9 0 +CostCurveUI.cs CostCurveUI.cs 75c41420986c2e5acbce33837dd0d475a50fb5a1bb3e3abcf0d2b813984e4f9a 0 +CostHalfModifier.cs CostHalfModifier.cs 21e90484e832afa41ec4f9e6244762a32b0a162f1ab940329d7a994ecce73347 0 +CostHalfRoundUpModifier.cs CostHalfRoundUpModifier.cs 92e2a80e70e590d861036e69c77beb5a48c52012885e62876240bed3a059fa70 0 +CostSetModifier.cs CostSetModifier.cs f6821df3735ce643be552bb7b919ccb8c75a1c22135daf01ef28a6eed9bf7c02 0 +Cute\AssetBundleObject.cs Cute\AssetBundleObject.cs 8bb313efedc9c4ceea5ecc22768952299393dfa30e532c9d411e48f622929d2e 0 Cute\AssetErrorState.cs Cute\AssetErrorState.cs b33ad3fb7e2ef3fe360dd4bfb4fa165c6545fea387978a19954be38534aafc5f 0 Cute\AssetHandle.cs Cute\AssetHandle.cs 1d8a2e86416732f74946f33dcc83668475124040ac512495fb78581a21c6e504 0 +Cute\AssetManager.cs Cute\AssetManager.cs 05ccbc063b6465ab8e55e70b9fca9fea6a62b2f888dfac7ad8aaa9c57c6f5d47 0 +Cute\AssetObject.cs Cute\AssetObject.cs c739b1f221168cd883e8663a2680c487ea72e09d6612451184247bdc56a01b1e 0 Cute\AssetRequestContext.cs Cute\AssetRequestContext.cs 6b2494166728d2c202cb050c3ce0a06b635295895e48f03c6fd9397ea07177b5 0 +Cute\AsyncJob.cs Cute\AsyncJob.cs 5e02641f0b1d264d5fc74a31652543d970ae65943d3cfd96e477a835520863a2 0 +Cute\AudioManager.cs Cute\AudioManager.cs 5e0cce94bcfad63266cd298aef89bb383e541f5802aa19dc9692db02047e6529 0 +Cute\BootNetwork.cs Cute\BootNetwork.cs 99769dd6c38b2ee2ef7ad02e14530c658576e5c4a2188ed1cbcdd563f68443f6 0 +Cute\BootSystem.cs Cute\BootSystem.cs 61afa7a7c8df705504031629965440d491603dec531b047a36b9294f255ee04e 0 Cute\Certification.cs Cute\Certification.cs 8c143ee5f98e99332bbd1d6ec091d7590004b3b7215f1dc234d39bb5402f8531 0 +Cute\CryptAES.cs Cute\CryptAES.cs d3022b9e1be75bc07e57aef61093717a84b60383608eba5daa9b7dc6605b1e75 0 +Cute\Cryptographer.cs Cute\Cryptographer.cs f61bc1f4727d323004c443c9db30a4f221db3309be2cb14d6f51fc6a39590908 0 +Cute\CustomPreference.cs Cute\CustomPreference.cs ddc46cc13bf2728e4fcee7db550ec093ec3acf651ea48d3dbb5f5099d5a20f89 0 +Cute\CuteNetworkDefine.cs Cute\CuteNetworkDefine.cs 4d83e9f5fbd6546ff6d16568a41ff885eaf9406275cc033c015b2aeab7203074 0 +Cute\DebugManager.cs Cute\DebugManager.cs 046c827677e5060f5a78b5d095b349e6956f3fe9a6183d51e411389755b37654 0 +Cute\DeviceManager.cs Cute\DeviceManager.cs 1cfdf166a10ee8c25d00d8aa8b4679d3aebf72bd98d50a1c465d55e357059734 0 +Cute\GameStartCheckTask.cs Cute\GameStartCheckTask.cs 549e76d44bb9692e45701c6bd09ea441a495e8f7e7fe7acdf508583c44e2b5a5 0 +Cute\GetiCloudUserDataTask.cs Cute\GetiCloudUserDataTask.cs 2cb7e8beebe14a4507d57e6f5bb29ddc97c3fd8ccafbd903386f14aa679e9b41 0 +Cute\HangulManager.cs Cute\HangulManager.cs 5d49693ea1bc8e9c60c356f2495fe2d10f218861a7894197d6b4129dff4aebf9 0 +Cute\IAchievementCallback.cs Cute\IAchievementCallback.cs 2da279d18d01267260283e79c2962362a72e5612eb137c7f4cb6bd7aac60d661 0 +Cute\ILocalKVS.cs Cute\ILocalKVS.cs 9a335a9930a14555431a147bd25a10809dfba3d7fffea2a74354e0c36e4c356e 0 Cute\INetworkUI.cs Cute\INetworkUI.cs f9c167ca8b2919b6a9a31518e9517a032aa67f6444239aa070e884c397c3b70b 0 +Cute\LocalSqliteKVS.cs Cute\LocalSqliteKVS.cs 75f8091265f3795e846c9a6ad45f8e3e469f1012e0f8568bc21f7a5912357808 0 +Cute\ManifestDatahashKVS.cs Cute\ManifestDatahashKVS.cs 0eae9523c5fdafac69d67396e8b4b26bdca8749abe59feaf5775c1b92148602f 0 +Cute\MovieManager.cs Cute\MovieManager.cs afe69325463e327cf9875f8a310f1b3c410652a13b144a7313920229e49df112 0 +Cute\MoviePlayer.cs Cute\MoviePlayer.cs 146ae8ae35cedc1f977609b0dcb271ef46ef0def022b8c5de7720968bd7ca63f 0 Cute\NetworkManager.cs Cute\NetworkManager.cs 0045133deabae1d9d7323c1496d1e373c5fe4a1b731a81ed01ecac3500826ae1 0 Cute\NetworkTask.cs Cute\NetworkTask.cs dddf8a492571b5d0ae698a7e472c86f75a746d5ca0e7b34b08184cc820459acd 0 +Cute\ParallelJob.cs Cute\ParallelJob.cs a6008b18295410cefa08fc98b6b9c4010c9a424120c322d86a050c2999f1750e 0 +Cute\PaymentPCFinishTask.cs Cute\PaymentPCFinishTask.cs b8ec9fe1f1741a9525cb675d0b400b218c6d6b851f2eacaa104832afb44b627d 0 Cute\PostParams.cs Cute\PostParams.cs 075f4ac38426adb7885083dd0638d902737d83d34c4b36befd8cef000ff4f2b1 0 +Cute\QualityManager.cs Cute\QualityManager.cs c6bb9c24b798af63b951d77bf525604ad725c9f14eadccce016f0c91497beacf 0 Cute\ResourcesManager.cs Cute\ResourcesManager.cs 71d3f4d1e0d685fcc86ecb163a7c0509fc8455329c16cdb6d2a8a6044207f924 0 +Cute\SavedataManager.cs Cute\SavedataManager.cs 5646f2abab140a3b680014dd7d642989be1b1e041292d0f60c814546a27d8130 0 +Cute\SignUpTask.cs Cute\SignUpTask.cs 12bc4a5ca60ba8e2305e5a1aa786a85911d9684005f38dea5469b67f42fb69c1 0 Cute\SkipCuteCheckResultCodes.cs Cute\SkipCuteCheckResultCodes.cs 9e61d6dca2c37a5cb99be5f4657fcd1789504cea08a9f234e35cfe5bc0c9b346 0 +Cute\SoftwareResetBase.cs Cute\SoftwareResetBase.cs 3f12519bbe890a1cecb09928deb13e8f22ee6a4230884f63a53e7ec22d7114e0 0 +Cute\SoundData.cs Cute\SoundData.cs 48133c9aece96639bb8d52c28e0aeef4b9e41fcaefee31d11a75c34ba355c96e 0 +Cute\TimeData.cs Cute\TimeData.cs d1bb7dbdb7c456739a7949b2348121660df2ca5fba8f7797df275133b5691ddf 0 +Cute\TimeUtil.cs Cute\TimeUtil.cs e1216cb3cf4bf4add6b239fa718ad5bfb62dcd704f66f4737b23461b03f70c9c 0 +Cute\Toolbox.cs Cute\Toolbox.cs 1f33c50878dd0f2f2947ee38040fba727212db75b0a4fd783709e1f63eeeaaa0 0 +Cute\URLScheme.cs Cute\URLScheme.cs e4a3c1b69dba941cda308d19b8c0e73af0c317c0834d8031d7702471a233cc11 0 +Cute\UpdateiCloudUserDataTask.cs Cute\UpdateiCloudUserDataTask.cs 51b42f384a60587c64b7fa4e73ad23b0122cc03ff297ffd0d806043cce84586a 0 Cute\Utility.cs Cute\Utility.cs b81416aeee0d4e21d0793bf97ee0f88ab47d366f5cbd10207e402fe56fbb3554 0 +Cute\WebViewManager.cs Cute\WebViewManager.cs b2ffdc6e77cb1f7f391a7ee4a1e7829c70ba7330c1e5e587b4294e15e3da2bd0 0 DamageCardParameterModifier.cs DamageCardParameterModifier.cs 18471abb1ceed9dadd836b4692b4e0ce1e0a5f1d89e66819de2b763b4d460fb9 0 DamageClippingInfo.cs DamageClippingInfo.cs d13af6e8d482d4bd5d25e4f3cb66ab8dc03706e12dcd05576957c243cc9cefe8 0 DamageCutInfo.cs DamageCutInfo.cs badd6bab1f1419beb65cb033261c7e6b6ff1b0fdb8b5cfbeaa5690de3d26d8c8 0 DamageInfo.cs DamageInfo.cs 5c8ace7ed08f5a2b17b94041d029976515795a6521c62fae4c1017761ec1c256 0 DamageModifier.cs DamageModifier.cs 3e5115d7fc848170b4a12b9e83e7b29d4eea9f8ad99dd1922d8fd548ec39d547 0 DataMgr.cs DataMgr.cs e26d86f920c1c4fa975100bca4e120da223aa00fdf2c7afe55555685039de048 0 +Debug.cs Debug.cs b4f865824033417f743baa3ac8f75d9a6268aaff551b10a8c975797e52b9a774 0 DeckData.cs DeckData.cs 6e55b1b948e5e0b023b2bcfda8ba3ba3349137ce7902bc954f448ea150ad8dff 0 +DeckDecisionUI.cs DeckDecisionUI.cs c860e82f9d92cc1a6ca9569185947f949731136a14f6923844f0d4f869b9e4e3 0 +DegreeInfo.cs DegreeInfo.cs 1bef2f1b36023d033923cac8f96972380ed7e20a42b7114c67b4a29515fd02a1 0 +DegreeInfoDetail.cs DegreeInfoDetail.cs 41c09ccb25ccd6a1628a1d56079767434a6fa5228bad103eaee88b12a8d00659 0 +DepthBlurAndBloom.cs DepthBlurAndBloom.cs fddb16fe8e4701ffa5687fa2f6e1d10e37e4713163e6c64ae2b1070b7bf7774b 0 DetailMgr.cs DetailMgr.cs b9c05d782358a88ff7efe57f4d75c24bd9e8c11fb661f368c038e30a44293ba7 0 DetailPanelControl.cs DetailPanelControl.cs f14d798412cb1e071966ed715d863c42a24b34993de3cc2235bc9780daedc0c5 0 DialogBase.cs DialogBase.cs 29b1a74e1b413b9c7a6026a95855be50e17c9c9d9ded48fd29e50f1dddbe2bbf 0 +DialogSupport.cs DialogSupport.cs 38ea3efbeca826ccfcdde55f4454987ee703c1bd70d3009f5914b8552d81e8e9 0 DisconnectToDispChecker.cs DisconnectToDispChecker.cs eff0b9cffe1f860c52f1541d859903e7c04b0b9533e8e9fb17db419c111b20af 0 DisconnectToLoseChecker.cs DisconnectToLoseChecker.cs 62eb9d5ba9924579904be303dd687dc472a7846abcf897eaa9d71dd8cf3c564e 0 +DoMatchingBase.cs DoMatchingBase.cs f859fc6b06d6152ae6b2d1c6133ad2ac88efb8c0f1fa042ec3ce756c8e4eec32 0 +DoMatchingData.cs DoMatchingData.cs 39c301c522c5c10656a1150e2d0dd41da276594109f0b3d936e8c585dedd4bc7 0 +DoMatchingDetail.cs DoMatchingDetail.cs 962c8b822ff950ae48fb3980dbfcfddfda3b4bc5d8ad9426685c0239d40927e4 0 +DofDiffusionBloomOverlayParam.cs DofDiffusionBloomOverlayParam.cs 80a1a215e14dc04a0206f2c8f7cdbbf6931e9b98d5e6ca4c61e54c01ff6192b9 0 +Effect.cs Effect.cs 3a262efdcdf78cd70cebc47f2e13c37d59121b0f65cd4425576dbff5e7c3ffe6 0 +Effect3dInformation.cs Effect3dInformation.cs cbc8e10d2755feed8707d5fcc98e14a1d152e3f21a9e519d5b3990b0a45335cb 0 EffectBattle.cs EffectBattle.cs 948c157c1c662f13946de84a8d82a9e791eedc9d0e4033e260aa960b001ddbe6 0 EffectIdx.cs EffectIdx.cs 5a1bb1179ec2ae8c4e552ab9dfb859718b54c683382bec84518f1ad437c9dfe1 0 +EmblemInfo.cs EmblemInfo.cs 21fb353975ce1e929d9a88bdab9a69c32c751768cb9148293e29a8a504f9b1ee 0 +EmblemInfoDetail.cs EmblemInfoDetail.cs a6f8597d09808fa9634e52ad8482f2c715e043cbda29b14d9fac2d59ec74d47c 0 +EmitHandUtility.cs EmitHandUtility.cs 1912ad3e82e968b5e0fce6fe1339bf9ae17bcfa3019558b7848a9df9d656b54d 0 +EnemyAICoroutine.cs EnemyAICoroutine.cs a199f7894f26de72a798cb8f66c853bb23dd761a98d70a9fdfc0c1049fc6c50e 0 +EnemyClassBattleCard.cs EnemyClassBattleCard.cs 5919e0aff71c63ab89cdd942261e776abd3a3882536bc036c20f1b89159c2d70 0 +EventBattleResult.cs EventBattleResult.cs 4175af8625db01292947338f264c8aee51a48e9ef5785fc2c99ad19a5a546d85 0 EventDelegate.cs EventDelegate.cs 46aac74b8f69ad3bbff976d609890b06d39bdcaac8d750dbc08edb7350fe20bd 0 ExecutionInfoCreatorBase.cs ExecutionInfoCreatorBase.cs 66231c001020d1bd54233645c2462edefd3af69adb166a4230e738915687a4d3 0 +FadeUtility.cs FadeUtility.cs 21735efdf8f885c091421350cfaadd1b2eddc1a3ffe4f5ddc84784260636b04d 0 +FieldBattleCard.cs FieldBattleCard.cs d0cf47325d0374752ab098fd364b886e7fa9e9367d6d2c59da71d03f200cbb6d 0 FilterController.cs FilterController.cs 383faac09c95684862201a8ee7cb0384bd00bad97e17b967a2e2a0e4babe3969 0 FinishTaskBase.cs FinishTaskBase.cs bcce8f5f8457978804ac2b8142a5c038e8113a67c6ba081226355bb2b4aeb93c 0 FlexibleGrid.cs FlexibleGrid.cs 5ae686e596cc48092f7c71a8d4dde5963b777c406372cf8a68d4b274ad7332a6 0 +FontChanger.cs FontChanger.cs 9955da2526e537b944363985d3ff4f478aafc0e70c579be5d86256bb02760b80 0 +ForestField.cs ForestField.cs 3b43cc5aa968be5293e7ecb0fb58d9d76345ebdcd60cb7b3cafcfbaa9a2d1000 0 +ForestNightField.cs ForestNightField.cs fab43d11be900120a1c2894254ad675835029d1b0fe477ee3eb3358343061d91 0 +FramerateProfiler.cs FramerateProfiler.cs 8491f82747ce03e65dfca19664face88e9ecad1bf0c5abf2895e2073a3293fa3 0 +FreeMatchFinish.cs FreeMatchFinish.cs 226857922d2601d5c1634cc9d841427abb4c60d71595f886ce61c2d155d86723 0 +FreeMatchFinishDetail.cs FreeMatchFinishDetail.cs e5609ec95ead85a50478586695b92f1f38e402f550447b158e4099284bfc1fac 0 +FreeMatchResultAnimationAgent.cs FreeMatchResultAnimationAgent.cs 82042a6173b89b23ebd811430d07f95e364226316db1d17955ac1f8b1c16532e 0 +FreeMatchResultAnimationHandler.cs FreeMatchResultAnimationHandler.cs b636ad47ac36e858a240814b07601e7eb0d320ad4f5e0c6b9a989de2c09609c8 0 +FreeMatchResultReporter.cs FreeMatchResultReporter.cs 64093ca40666419d15bcfeb44cd37d3b6615069c36b4210e807b8be5e9909ca4 0 +FriendApply.cs FriendApply.cs 301bbcbf3a488283fff97e6af6a764d576a34ae1dea8793420d7681b337fb490 0 +FriendInfo.cs FriendInfo.cs c6e448c307821d45c04840cf185e6ec64991514b7b5e9f0e33fd322e259a9db8 0 +FriendInfoDetail.cs FriendInfoDetail.cs 969b8b156330d258e54dd88747d22e24f8e691efb68d97204a2c0da7b1700586 0 FusionIngredientInfo.cs FusionIngredientInfo.cs f27ea653c65be64dbf872e64dfca4ac1da361eb347a96b2d05836b79452c8510 0 +GachaObj.cs GachaObj.cs ed8ef737f4254948f1e99fa49487dda56893096d472cfceaf4d68593ee81c7f2 0 GachaUI.cs GachaUI.cs 9a2717c4c7488d1ac985e3f297efc5a0d2b1f11154257f120db4716b9562a280 0 +GateField.cs GateField.cs 7e46608dfc593222fb0364424b87944064f061d736b93d69d2c531f1645b7d18 0 Global.cs Global.cs 176c8351aa9f1c5529fa0ed3ae8514fef117d4274034ec358ac1b7ee4fafb782 0 GuardInfo.cs GuardInfo.cs f90debeff49492f32e54241fe88120353c9e640c63e40e5368e37aca46cbe4d7 0 +Gungnir.cs Gungnir.cs f0a18179c8b88c4faaece7f01be63ddf3fdbeb922e47ec6f0eb12af590620d22 0 HandControl.cs HandControl.cs 9aeab0b0a03df8cacdf83ad032bac91bf6ded7add818ab8df390b2204de9bb32 0 HandTRSCalculatorBase.cs HandTRSCalculatorBase.cs 3bed5bc4be8df4ae6e175ea80edee9dddba777cf3e60a98beb3c330f3b276591 0 +HandViewBase.cs HandViewBase.cs cda88f849da13685b457e2d7d539ac39e2ac26b7cd3d1ac46f09af540f7d5be9 0 HeaderData.cs HeaderData.cs a5698b093069f218b38ae292b57bf7f322b1130e4d6c8bb2b48d652833834a5f 0 HealCardParameterModifier.cs HealCardParameterModifier.cs cebc61aded873da74065beee795a016e0c4eb41535457ab363a01ab7fbe7f491 0 HealModifier.cs HealModifier.cs 688d22e29bfba314775da3a007292f615d7f1285ad65af67925189310755d7f2 0 +HillField.cs HillField.cs 4c8038db8752952e434e76f1b32c9899710bbd9e3220532bb9fa9e336f06f20e 0 +HillRiotingField.cs HillRiotingField.cs d3d663ce3ced642f955fc444a2e69f1b4b8fae0075a06c6a13d8d076250b7f28 0 IBattlePlayerReadOnlyInfo.cs IBattlePlayerReadOnlyInfo.cs 92458acdee05e34f03501eb096f4f9a62e046bb23beab303feeda08a65b16a96 0 IBattlePlayerSkill.cs IBattlePlayerSkill.cs 0f6483b6c68d14b3df16714d80e7a699fe77dd8364fd9a526ca4d71ea938ca93 0 IBattlePlayerVfxCreator.cs IBattlePlayerVfxCreator.cs ede7ac5540d0302302ff09323aa610a7f0465de170696134fd9cda3b88625873 0 @@ -97,6 +240,7 @@ ICardOffenseModifier.cs ICardOffenseModifier.cs d96faf26fcb1ae05e2625f1b20c69a92 ICardSkyboundArtCountModifier.cs ICardSkyboundArtCountModifier.cs 0b8d0621f791bb61046d66cdfdda2abd7a672e2fdc1d83732b715965746d4997 0 ICardSuperSkyboundArtCountModifier.cs ICardSuperSkyboundArtCountModifier.cs 7e68ca567e78d46a21d036b965cde68182fe1070ea9d4f750e1eb236efd06556 0 ICardUnionBurstCountModifier.cs ICardUnionBurstCountModifier.cs ba967c6dc5d5a202fc6ded3b788b4fbd14d2a840fb2ce0858c6dc9f332a4fbfc 0 +IDInput.cs IDInput.cs 6366e6c23d9c954bb08d8052040e04953528b02084c380a9f6004581758d8934 0 IDetailPanelControl.cs IDetailPanelControl.cs f705759bfd1ee67cb2fd89727c9c5bc3fa339e1a45ecdba0f1deffa5d7464e71 0 INextSceneSelector.cs INextSceneSelector.cs 52d188563368337f2653d41f54ed6ba915911929134b6bef628f6cd72c820c95 0 IPpModifier.cs IPpModifier.cs 95a83890b06528d37c73dea24b75a3dcd23dfd532508bcb90463e34a5811d19e 0 @@ -117,118 +261,955 @@ ISkillTargetFilter.cs ISkillTargetFilter.cs 83e6544879ae037b683c722ef64a84eb11c5 IStatusPanelControl.cs IStatusPanelControl.cs 0b3209f41c2c553a04ea57d686fa023ec1cccdbaebbc87a27796e5757f1820dd 0 ITurnEndButtonUI.cs ITurnEndButtonUI.cs f56729cec651078c6ad204c92a465359206ec4099cc2089ab5075adcd130a401 0 ITurnPanelControl.cs ITurnPanelControl.cs 92439feb3a6faf563e1d2673a4bf20c671be1300731d5594d1fb9d9947016036 0 +InPlayCardControl.cs InPlayCardControl.cs f7c85d9d8554057500bf89c7d299c88d42acdf004673489753e4c82e7c904363 0 InPlayCardReflection.cs InPlayCardReflection.cs 230a498f9a9239da76fd43e1356c2420606b53ba4dc7fd74eee475d44ab2b39c 0 +InPlayViewBase.cs InPlayViewBase.cs a7de0b0b6ca4f4615b61d4614cc28a1761583cd9af3b7900b4ee7fabc8fac0e7 0 +InitializeRoomBattle.cs InitializeRoomBattle.cs b3263760af6e03fd808bd289ec482e575852567d4f1631503c63170b0bef7061 0 InputDialog.cs InputDialog.cs cdca35d6b09423bd6995c573d775d05a5548b5fa5e9d29329f5e1883226e840d 0 InputMgr.cs InputMgr.cs 581fa15080fb3a88827b415e1da7b27624df5b6990bc3901ab73fab64a2c22ba 0 +InviteFriendBattle.cs InviteFriendBattle.cs f1c14f9d25baffa1414175af2bdb9cee3188a3d914bd29d4c5925a08f9b3160b 0 +IronField.cs IronField.cs 689150823ae55cf49abda584ecbc7a41893e25f04f9fb5a390342f8be2de1ead 0 JudgeResultFailedToRetryChecker.cs JudgeResultFailedToRetryChecker.cs de1009153f15895bec6f0540db81859a4f57812ca5c44f5db9c2b3bd6d907f2d 0 +LaboratoryField.cs LaboratoryField.cs 294c70c4ba7ca09b01025a3494dbf1af61095babbc5dfb166489689cf5f7a2b8 0 +LaboratoryNightField.cs LaboratoryNightField.cs a4026bf07382df824e1745660551947413d56180a25b58af64428ee0850bd5c2 0 +LifeAddModifier.cs LifeAddModifier.cs 8b797af998bb65706eae297c265df3387bc98ee3c6542fbcd24412c9ca606725 0 +LifeMultiplyModifier.cs LifeMultiplyModifier.cs 4493ed744ece0bf47c795eda8fe983b96d78c17c0c6220703339475857010038 0 +LifeSetModifier.cs LifeSetModifier.cs 3d0f4eddc8fda00e181825bd5e72e1785af2a843ecf70b8f15a5b3df911a2a98 0 +LitJson/ArrayMetadata.cs LitJson/ArrayMetadata.cs c4b50df21d2e7d0f370282620da4e9635d278671020263aa2a0ab7acbd474e6a 0 +LitJson/Condition.cs LitJson/Condition.cs f89fd6405782b1b3ec746ca7fb687a0c906dd4443d6526f2960c9154259dce4e 0 +LitJson/ExporterFunc.cs LitJson/ExporterFunc.cs 01472fa8ae8870059385b2520fab5759bf6b1a2d3ce59f1b65f2c76759c03117 0 +LitJson/FsmContext.cs LitJson/FsmContext.cs 77581edfad3c6c8d9263374f8030ff56a393e6e3c17126e28006efac3fd4863d 0 +LitJson/IJsonWrapper.cs LitJson/IJsonWrapper.cs 38abdbb16581143c277054ce9bde6c9cc797e5f43dcffb748eb17a84c8252cf3 0 +LitJson/IOrderedDictionary.cs LitJson/IOrderedDictionary.cs 9e2efe63a3a0613fbf5de99106b633467cc97586ca14cd43dfc9016e2b4b45b8 0 +LitJson/ImporterFunc.cs LitJson/ImporterFunc.cs bfa950afdaeb0eb4ed730e89339f09c167f5b4dc788dba3a17921701350aa2b2 0 +LitJson/JsonData.cs LitJson/JsonData.cs 216a3e6fa34e583af9e88d0be662af774c8f911674902df7f56ddfe5ec94627b 0 +LitJson/JsonException.cs LitJson/JsonException.cs abfd12b161286d1a03fa0b7dfbf85c758fa22ad50c7e84dcf0c43bef9cc436f9 0 +LitJson/JsonMapper.cs LitJson/JsonMapper.cs 63d272e8d4e9f2bff8034be583a28767ca7a244b867d30b06676a772b2d0cf9b 0 +LitJson/JsonMockWrapper.cs LitJson/JsonMockWrapper.cs 3f211a3384ccb5804e581332d593c4c3322e9d5e1e0d5417b1bae7c61dc00a2f 0 +LitJson/JsonReader.cs LitJson/JsonReader.cs 3e7ddbe3459f7c08e3dce516f7243afcd7bcc9a579238b4959404bb7527bff65 0 +LitJson/JsonToken.cs LitJson/JsonToken.cs 921f25993dafa3e84b495d622a79d7e4402f859198ed1915493b52bd9fdf84e0 0 +LitJson/JsonType.cs LitJson/JsonType.cs aace2461ab45b84603de7ceaf1396ee7741c2c30d6254e234c14cb3faad339cc 0 +LitJson/JsonWriter.cs LitJson/JsonWriter.cs 0c65ee328b1484795a9b337648eedd243408d4edd641978fa6d7a29456d4d7d0 0 +LitJson/Lexer.cs LitJson/Lexer.cs f5899d48a748ddff8aa7fc72514405989290b1b46c2f213c656b15571fe36da7 0 +LitJson/ObjectMetadata.cs LitJson/ObjectMetadata.cs 238f8c4723bb0885e5aa85157596b59104ea089c06f7b1fa6ead0734753ffa36 0 +LitJson/OrderedDictionaryEnumerator.cs LitJson/OrderedDictionaryEnumerator.cs cbb2d3594bf217e103541de1853d49075e923fc58752d39416fed8c41f88a22c 0 +LitJson/ParserToken.cs LitJson/ParserToken.cs fbbaf4542df887b3301d5ada43c93f6f7748b1b28f75f04f6d3d7ab81a9169f9 0 +LitJson/PropertyMetadata.cs LitJson/PropertyMetadata.cs 3a305fbea81449f91d1d22a1e3482f7d5558ba9374b5345d3be50af3cc5437ca 0 +LitJson/WrapperFactory.cs LitJson/WrapperFactory.cs 2aafd3dbae34d41864abb0e84229e6163fa7a4fe857f3972f2949de1a0badcd7 0 +LitJson/WriterContext.cs LitJson/WriterContext.cs 39416dea3b7218c555f5988a5464a133ee34ec8c12739bd7e241abddd8932a47 0 +Load.cs Load.cs a68f95fd46d5b9961f8b40424d093ee3ab9a21e168992034c66f81adb66dcc1d 0 +LoadDetail.cs LoadDetail.cs aa01efaaaca68bd8899b41ba90ef228c3d5b7f9ccaf9e7937b476a1bc9886342 0 +LoadingBase.cs LoadingBase.cs 0f63fc8676b84b1b8c36bf51f41b241c74e236abbff1e07b2612233f3f4f04d2 0 +LoadingInScene.cs LoadingInScene.cs 9ae449b0ba5668e3d3d8d1d0ae340514617ac705d364c9be8993efe6afe4ddb1 0 +Localization.cs Localization.cs 07d154439612a9a8e6e49ec7edd9f5fc0a7af965d231291c96c0057d991e4a48 0 +MailData.cs MailData.cs 8229d3b651b4df09e52def59da26a70635224c3e8f80437d01c7a1012be8f942 0 +MailDataDetail.cs MailDataDetail.cs 61caaf9762aff044c3f675a4899b47a31af0872a70f1035d822755842fd2ad3e 0 +MailResult.cs MailResult.cs 373b73be1b55a04ddeaa492c150031556aa71144e4b662c609da6ac5f02aa75f 0 +MailTop.cs MailTop.cs d0a6aa8517f07f2faa06f0eab7925f48ffee5a88784a3fc23229e4a5a53ccaf5 0 MasterLocalizeSetting.cs MasterLocalizeSetting.cs 99ee729dbe167dcd0435d6d30cbe2c19f52c6537900f83c822e32279dc93d9f0 0 +MatchFinishBase.cs MatchFinishBase.cs 03abdd14a4dbe15e4c489a2e21e39b0a87419ca3ab4f48e6cd195e3364fac8ad 0 Matching.cs Matching.cs 29098aea9c23bd2902e2a8d873d17f28c10b8035d68958386737a8f74b46f278 0 MatchingBase.cs MatchingBase.cs a7ab09602771607df180013c0b564aa561d0e71e6bbe06c294bd72163ccf290f 0 +MatchingCoroutine.cs MatchingCoroutine.cs 742e67e22f9bb1ac34e7828737ded1e709100091aadb9ddbb20ded863bc503b3 0 +MatchingIPv6Toggle.cs MatchingIPv6Toggle.cs 7d1f158ec6dbbb7f4c82bfc5e390248fc4b7e5c3688b303e5c0ad7a4686c5b5b 0 MatchingIntervalActionBase.cs MatchingIntervalActionBase.cs 59e27d024cdf6fceac658a8610925f92df34622b5f9a3c1506185dabc6ead1bd 0 MatchingNetworkConnectChecker.cs MatchingNetworkConnectChecker.cs 883ea96d00d6ce260920709ce14ccf3df66872a3718b318012291330c1188881 0 MatchingRetryDomatching.cs MatchingRetryDomatching.cs 462d1f6cb226ab558be7a30f4e656ed50bbbc5db2b12768396d7a081020dbecf 0 MatchingRetryLoaded.cs MatchingRetryLoaded.cs 25bded3bbbb7524ae5bdd4c8037bb5fb3bc6a9ddf940629e51b51147e1a9c77c 0 MatchingTimeChecker.cs MatchingTimeChecker.cs 3c3d0428a3314139818552cbd6ced313fdf2de9fa326887cfe85a7213f3ebc34 0 +Matching_Colosseum.cs Matching_Colosseum.cs aa8b3b9d199ebbb3c0597b64bd7ae3bac97ee122a5a2c4ac456d14a615063035 0 +Matching_Free.cs Matching_Free.cs 69799da01a20bc9143e999d7fda9f407de49cebddf59266124c251810cfa92b6 0 +Matching_RankMatch.cs Matching_RankMatch.cs 34072abd51e1134cae5bb2ef3d4e8d992c58aec94f5bb845035f7c088bd92cc6 0 +Matching_Room.cs Matching_Room.cs 82e93f2493482a7107d00265b5025a51b9f05dfd6e1402eeb693622e4542e36c 0 +Matching_TwoPick.cs Matching_TwoPick.cs 8ad94923cf196a14235de02d7cbcb3eb1edd840158368afe2c92dc29ba872b55 0 +MaxLifeAddModifier.cs MaxLifeAddModifier.cs 410eb577b9e19074d555fdc89b773a0399f08e3b4d6513ddcfafe3c67dc5b467 0 +MaxLifeSetModifier.cs MaxLifeSetModifier.cs e4103f7d5abd5a91b83c08613a35d3da2b208ebc7655206c00fe2c7718fbd85a 0 +MecanimSceneBase.cs MecanimSceneBase.cs 92369606696d42d4a610216fd48e13aa1592bbfc5e0f98f53afc3e5264d3fbed 0 +MecanimStateBase.cs MecanimStateBase.cs 8aebc2fffebf571b953804cca24acf6a73902ffe3b35c53e8e8076691121039f 0 +MissionInfo.cs MissionInfo.cs 2577e5c3f988a6acc5810ff4642988b8324415e4e361fe54a37c593b0fe7b82b 0 +MissionInfoDetail.cs MissionInfoDetail.cs 4caacd77a98f00dbc81b5111933dcc5eccc86bd558a44f37485f2bd253b6bf87 0 +MotionUtils.cs MotionUtils.cs 59de592e4cf7fc0b7d210b22473fbec6484d175342bb8030165fdce550b75392 0 +MyPageBanner.cs MyPageBanner.cs 05fde135c8ebfb7565f3a126a617b9464db000ca698326c44b6fe688e7ddf020 0 +MyPageBannerBase.cs MyPageBannerBase.cs 5f28a583638d2a7d2d94846c631f8183728a6231b5017776695b66e09380b6b1 0 +MyPageBattleCampaign.cs MyPageBattleCampaign.cs cf0c74f3a1a8d6a5c8c3543576b2baf54fc35a74e942636c97f4dfccd144386f 0 +MyPageCardDetail.cs MyPageCardDetail.cs 4b548b516453c0c57b141b726ce2fdd2fa5afd46d41bd6c766c7034b2741ba6c 0 +MyPageCardPanel.cs MyPageCardPanel.cs 111ac76db5bca2338825e7c23a6de818d1f733c64f1095d0332e8bf16d74985e 0 +MyPageCardPanelAnimation.cs MyPageCardPanelAnimation.cs 32d7b814da547640a945234ef0acfdb650ec4b5077e2990168eb2b83ce981d8e 0 +MyPageCenterCard.cs MyPageCenterCard.cs 5d28300e7152fa4aee1da77a276fcb3ac85b34d626351fb7517867e0526fa83a 0 +MyPageCharaMenu.cs MyPageCharaMenu.cs 0826444ea3cfb5570782348870a7299383cc5221255e2347874373c1878864b9 0 +MyPageHomeStatic.cs MyPageHomeStatic.cs 3ca9ecb0d96a525764a94376fdf8e90753aec62af290b6e71e397e2a1f2d82d4 0 +MyPageItem.cs MyPageItem.cs 7e444a5a89806181e29f531252319964134a5e5eeff279571fd4c6e26648a6d5 0 +MyPageItemArena.cs MyPageItemArena.cs 234f20802ded5a336ebe8c5065ebb065d8ba66c77e88a18f0607d2ad1a01f6f8 0 +MyPageItemBattle.cs MyPageItemBattle.cs 7b4558a9961278e622422bff36fa62c33a768e50a253817ca86882dc2df7a101 0 +MyPageItemCard.cs MyPageItemCard.cs 5208e1a3b85f40dce4d15659b088187ce8cecd08c70e235a8192ed26b623f220 0 +MyPageItemHome.cs MyPageItemHome.cs 3371963cc4f46b440c2a1b9728efbee344f198bc0a7ad7c9facf289835310dac 0 +MyPageItemShop.cs MyPageItemShop.cs b79fe8a7eec72c12ad5a4d30af96f4267af7416b158e64e1bab0c85c1d7910df 0 +MyPageItemSoroPlay.cs MyPageItemSoroPlay.cs 4d8c66dadbfaf424a4d93433d649fdd5f62a212eda6bd0d742f477a27a6583e9 0 +MyPageMenu.cs MyPageMenu.cs 6f744dd9f5ed6757b3fd0eaac530d2f65294071eb8f07e3c96885d4cfa18473c 0 +MyPageShopCrystalApeal.cs MyPageShopCrystalApeal.cs e5c97ef9321cd21f0f785dd3226c1c6bd835fc0545dd694493122b022e20881c 0 +MyPageSubBanner.cs MyPageSubBanner.cs 213ce1f505160cd0b5f818888e21126f02dad87b309ece0cbe7c428712980b2d 0 +NGUIDebug.cs NGUIDebug.cs 05afba3513d85fd7ba2ddfc4371abf4ce3507a199b108ef6e4f7d91ababa48dd 0 +NGUIMath.cs NGUIMath.cs 94de0adbafc338c60718685c01cf41f35950617ed0e4fd6ad41b19af506c315b 0 NGUIText.cs NGUIText.cs 559ef7a20fcde5f9598f3711079ec82573652e26f52d674cfc4ab375eafe78d1 0 +NGUITools.cs NGUITools.cs fd94664e614d4621b0db9492527aff89560bd60e97861d119231036c552586ec 0 +Nat2Field.cs Nat2Field.cs e88af89f0bf45a0b124aa0b2e9450fed9619402d343a570bfaf7df2e18c08be0 0 +Nat3Field.cs Nat3Field.cs 6b05e595b5a36ad4862461c02404c37194820d3ca96e77fc314e380fbddfdfab 0 +Nat4Field.cs Nat4Field.cs 582be3b3d22bed077a105861bdbcbd5e564bb709b771377f980aaed098e6ccec 0 +NateField.cs NateField.cs fea9100df495f60716a7e330e466ea94881e61789d606526c5aaadf4504b19e3 0 NetworkBattleData.cs NetworkBattleData.cs 73c823febb4d40b508b72cc946fcc47211d89e93c4906cbeca43beab971d69d3 0 NetworkBattleDefine.cs NetworkBattleDefine.cs 4d0a39b09dd5ad11786645dc4365148d945ea11e690f735d3eb541ebb7ce604a 0 +NetworkBattleGenericTool.cs NetworkBattleGenericTool.cs 38d7965e7e25aa31d7e56abd5797b1b02a99bfd96426ffd87a43ffc15ce9895a 0 NetworkBattleIntervalCheckerBase.cs NetworkBattleIntervalCheckerBase.cs c0e67a2a6b7476342c4dd71eff51b8dfef322c719fd8b1ac6300223d71949170 0 NetworkBattleManagerBase.cs NetworkBattleManagerBase.cs e0fd242d61995e9a667928f7c868fbe29abdfa7b57349229077b7f75a8607a97 0 NetworkBattleReceiver.cs NetworkBattleReceiver.cs 9ef6c34fa7bae735988c7adcb455c0245b5d37bbee58a6b29f4484bad9cec3eb 0 NetworkBattleSender.cs NetworkBattleSender.cs d0f2db29f75fd594abf47bb4c784754b27f128ee079dd962be42a0732d8f6ac8 0 +NetworkBattleSenderDefine.cs NetworkBattleSenderDefine.cs 29361da723e2f26f8717934068dde41b5437109b4df039b396a24967e9a19d6a 0 NetworkBattleSetupBurialRitePlay.cs NetworkBattleSetupBurialRitePlay.cs 9bf090ee9a93e60cc2768b747144550296348e3bde55cf2fd492c74414adb664 0 NetworkBattleSetupCardEvent.cs NetworkBattleSetupCardEvent.cs e3dbe93577757850ccd51596efff3df669fa2be43c7db86970fdd2f1aac1fad0 0 NetworkBattleSetupValidateEvent.cs NetworkBattleSetupValidateEvent.cs 9bf2ecfd29a963530c88f58f6002e73154b80571438629cbf367e7a7a142928e 0 NetworkConsistency.cs NetworkConsistency.cs 46c2b57e8b0a5bdb71b4a7020d729e528a4f02dca4bd039929df0ce8896d4795 0 NetworkExecutionInfoCreator.cs NetworkExecutionInfoCreator.cs 89e65032a5504837b829716759802d32359100db4f5390b66a36bddc2f6010c9 0 +NetworkLog.cs NetworkLog.cs a1c5fcdb35a5ce00aceda3fd90062530770d917b9fd797b62a8f28c6eaa85f53 0 +NetworkMatchNextSceneSelector.cs NetworkMatchNextSceneSelector.cs 3f8708e5031523b308897c815e5ee5df12e2aefc43edb503bb94e3fbd763a7a9 0 +NetworkOperationCollection.cs NetworkOperationCollection.cs 021cdb1734ce14912b202d51e5da4f1954e89594cca5ca46b465a6b05a6453ba 0 NetworkOperationCollectionBase.cs NetworkOperationCollectionBase.cs a360f399fb1d35b94e70b3578b446b373c1e465f9e12e05fac075c8643d7a305 0 +NetworkRecoveryBattleData.cs NetworkRecoveryBattleData.cs 78b0408c9459cde1b83a8e2916f4aba7638d4359dd415ef455bcd592b3189907 0 NetworkReplayBattleMgr.cs NetworkReplayBattleMgr.cs 7d9c0df07f3e2f87c9206cefcff5d4a241241fdd466d335ff9daaf6dd3d1d93b 0 +NetworkReplayBattleReceiver.cs NetworkReplayBattleReceiver.cs 97bb893fe2bd72f8a76a32d7ba4b5f39560f2582746c6f79fc1731fc736ebf0b 0 +NetworkReplayBattleSetupCardEvent.cs NetworkReplayBattleSetupCardEvent.cs c47b22696e40047696a9930048b204c90fe3187b3f97e7be9a6738af21e07cdd 0 +NetworkSkillPreprocessConditionCheck.cs NetworkSkillPreprocessConditionCheck.cs cede49edf0902f168cea487e7f5177267209659cbcaf616ec4bfa51c73aaba63 0 +NetworkSkillRandomEachSameBaseCardIdFilter.cs NetworkSkillRandomEachSameBaseCardIdFilter.cs b9283ebdd92353c49d333762d342d970534463949df1a519a88f3aba41ccee2b 0 +NetworkSkillRandomSelectUntilFilter.cs NetworkSkillRandomSelectUntilFilter.cs 5b4bf744d3f5eee6671d210a56bdf7c1ae64a09b2e9e528acf6749316cbe7c56 0 +NetworkSkillTargetLastTargetFilter.cs NetworkSkillTargetLastTargetFilter.cs 37082ba3a6b88aeb5f07cc27aac568aa1b73c178a8de22691c358bc6cbd4e005 0 +NetworkSkill_attach_skill.cs NetworkSkill_attach_skill.cs eef295e050c324a9011ce40de9efe44e019545184a50fb4c842cd9b698e81fa2 0 +NetworkSkill_attack_by_life.cs NetworkSkill_attack_by_life.cs 3ac56869de89b76edad9345e5cb6ba2dd4f70599840f73227d48134afeb34433 0 +NetworkSkill_attack_count.cs NetworkSkill_attack_count.cs 7b1bd3d504ae5b3a07f3db2951ffdfa99174ed12e9378518ffb0f7f848acde32 0 +NetworkSkill_attract_skill_target.cs NetworkSkill_attract_skill_target.cs 9db684600da5964a43ca36618583db60d628e2a76379c68e482a528b432f3a42 0 +NetworkSkill_banish.cs NetworkSkill_banish.cs 7685e6e63cf48e50a1c4875b44c4041c846fe039ac53219f0c774843d70c7759 0 +NetworkSkill_bp_modifier.cs NetworkSkill_bp_modifier.cs bfdee5d490b1e14ce04ffb3d682bf80711a0f067b36debf4796c85f18837a0a6 0 +NetworkSkill_cant_activate_fanfare.cs NetworkSkill_cant_activate_fanfare.cs f1682edb92d9bf9e5f8fbbeacdf1c8ba3177755be0fe2a12d05aadde67ccb73a 0 +NetworkSkill_cant_attack.cs NetworkSkill_cant_attack.cs e0412aaaf9a4badf7ca16965ca77878eba824aca46181b027c7bb0a3ef5769a4 0 +NetworkSkill_cant_evolution.cs NetworkSkill_cant_evolution.cs 57326c49600183ed389a923533d15264158421b99c8b16974a8e8b01fb849339 0 +NetworkSkill_cant_play.cs NetworkSkill_cant_play.cs d2f7787b17e71ca4890b48230487aec3845d4f616d878d902663553c01a12c23 0 +NetworkSkill_change_affiliation.cs NetworkSkill_change_affiliation.cs 04bad21d9cc1793001fc4697d6539dd60e4d4b20fd0c7b68a5d377b4b1207401 0 +NetworkSkill_change_cemetery.cs NetworkSkill_change_cemetery.cs eac24a8a7863aea01a2b82eef53b1a74bfcccd38597285099cb6dce15bcb7902 0 +NetworkSkill_change_super_skybound_art_count.cs NetworkSkill_change_super_skybound_art_count.cs 03a2fd07b0f83517625ba4545cfa43d33d04573ed83253393450a6b3ae433cca 0 +NetworkSkill_change_union_burst_count.cs NetworkSkill_change_union_burst_count.cs 0ddc36f5eda5f6e7a2a0f5a010f95f17d396d987028024d79b4826f9e6fc2cfc 0 +NetworkSkill_change_white_ritual_stack.cs NetworkSkill_change_white_ritual_stack.cs a66d3ea8b29e7cd57a176cd7f2f71088f7b21ab3067beb794d7760fbd635f3a5 0 +NetworkSkill_chant_count_change.cs NetworkSkill_chant_count_change.cs 2ab65f35b05716b6d7db913bc671e84930cede77692a01bce3e0817d3862097c 0 +NetworkSkill_clear_destroyed_and_discarded_card_list.cs NetworkSkill_clear_destroyed_and_discarded_card_list.cs 21c69c9c632c069b1ae0fdf0254a79b883e65790c201c448d3d5ac449fdd43c1 0 +NetworkSkill_consume_ep_modifier.cs NetworkSkill_consume_ep_modifier.cs 66261c2c144c7077de197f21aa1615b25b81fd1548d01a28e6d318766813435f 0 +NetworkSkill_copy_skill.cs NetworkSkill_copy_skill.cs f4e7d13b59f19f0b7b248099db2d24629202f45abc12e63b414b3906ebbf42ce 0 +NetworkSkill_cost_change.cs NetworkSkill_cost_change.cs 90e547619022b7f670bd82506e2e9d8f909df5fa348b2c833d40c020743e88c3 0 +NetworkSkill_damage.cs NetworkSkill_damage.cs 802609478a691b7163fbe68a6326fb37aa076e57efe43b0db29a22b2a349305a 0 +NetworkSkill_damage_cut.cs NetworkSkill_damage_cut.cs 9e93410d4ef26c5a8c30cc8d37c0f13aa7db1e8de8472f4a2ac98646e3534763 0 +NetworkSkill_damage_modifier.cs NetworkSkill_damage_modifier.cs f9d7d4ef8c9c3acbf03490da3fe6260a149b2e816cb625cc4f36c986091e3cba 0 +NetworkSkill_destroy.cs NetworkSkill_destroy.cs 06b75e93f71f4d1b5ffb1a876d92eb92566bd2c69da00d190df9d2031e52ef2f 0 +NetworkSkill_discard.cs NetworkSkill_discard.cs a3bc1bebe796aabfc9669147426da28916ecfad08333421cad0bb4876936ce0f 0 +NetworkSkill_drain.cs NetworkSkill_drain.cs 30e78f22a63cea51d3ec63b7172b390fe22b1a282bd2b352124f5eb766a126b3 0 +NetworkSkill_evolve.cs NetworkSkill_evolve.cs aad49b25299849ddf8db8b99149167b5ab4d72b784f195a96e9520024c2b1a5b 0 +NetworkSkill_extra_turn.cs NetworkSkill_extra_turn.cs 120ebab828fedecd7453197a9e1987336e1e2ad57af069a02285f2b653842b5b 0 +NetworkSkill_force_avarice.cs NetworkSkill_force_avarice.cs 49b1430c02b92f92a00a04a6993c6fa90074707918cab12db02c7afe131d3988 0 +NetworkSkill_force_berserk.cs NetworkSkill_force_berserk.cs 92a2d734917e9780f8213a73f85817aef067f0091b1c971492edccb26d906849 0 +NetworkSkill_force_skill_target.cs NetworkSkill_force_skill_target.cs 90b933abd7cd9aae39b0efd22b76cfe7245739fdaf9970246b9604f4e6126232 0 +NetworkSkill_force_wrath.cs NetworkSkill_force_wrath.cs 552d9beed60ce47969c5b03e8c426204d9df78a4e5815148ccb7dcfcd2fd3d15 0 +NetworkSkill_fusion_metamorphose.cs NetworkSkill_fusion_metamorphose.cs 352fc69f83ac4d992cd7f675c425067268ae3b99b3ebd60c2cf0db89c1171877 0 +NetworkSkill_generic_value_modifier.cs NetworkSkill_generic_value_modifier.cs ae2362a723bcc8970088fdec73c3bae6848492cdbbeeacb10b51aee8d3abca3b 0 +NetworkSkill_guard.cs NetworkSkill_guard.cs 9c71aa57207fe77ef4b0f31b54b1a572c332c8009ca9512d756870c2fc041d4f 0 +NetworkSkill_heal.cs NetworkSkill_heal.cs afff106dfe153b376ea0430541bf00e4bd8b8b12961ff71eaf7e4e1878f4dda8 0 +NetworkSkill_ignore_guard.cs NetworkSkill_ignore_guard.cs 69243ec712cc7b0a013b4ebd419f31a2eb9fdadaff81926f6fc7ce9a372639d1 0 +NetworkSkill_independent.cs NetworkSkill_independent.cs 5e2a4a791487cfaf94daa08622598e8fdc96c4370a0ecb3e1ebf88b55b00a465 0 +NetworkSkill_indestructible.cs NetworkSkill_indestructible.cs 004cb298100c951da55c6f3d23d897e90e32ea0dbaf722e9adc7da9d36b4c095 0 +NetworkSkill_invoke_skill.cs NetworkSkill_invoke_skill.cs 38f3fe265bbcad278e5b50823e7be2b5298bbd70f0e3ccf87d58dedf4dc0612b 0 +NetworkSkill_killer.cs NetworkSkill_killer.cs 5403bb782ac858c23e0a58ce9a4108239525075088083ed05a515b66d3c0490d 0 +NetworkSkill_lose.cs NetworkSkill_lose.cs 8ca0e958f180c2ca2268219c2f639e90f236449a7b3ff2374fdc8e6df3fdbef7 0 +NetworkSkill_metamorphose.cs NetworkSkill_metamorphose.cs 040c4ee5577fd1ea1e1e844fb594552508e8ccbdfa95bb6e06dea3085cf3c04c 0 +NetworkSkill_not_be_attacked.cs NetworkSkill_not_be_attacked.cs a38e751a66b8d95cacda691e5f00f2d1f8caace78e0480713bcb640af1ada72c 0 +NetworkSkill_play_count_change.cs NetworkSkill_play_count_change.cs 81d540414fde3819fc138861fc5fb70071b07f6a09d94cfcb6e8e22ab9f5d2fc 0 +NetworkSkill_possess_ep_modifier.cs NetworkSkill_possess_ep_modifier.cs c6aa30874fa7d49f8c2bd2eaa0ad7cea466b2d4c8e134ae33d8f0bc7ea6bedd4 0 +NetworkSkill_power_down.cs NetworkSkill_power_down.cs 2c8e43314c35a1ba0df8a0ef0282ce2ad695c31f04ecef7531f2d731848242fa 0 +NetworkSkill_power_modifier.cs NetworkSkill_power_modifier.cs 2d024655b1d69109ff07a8b2a2a2d4e5e756f3d6ec4a85b5ef2ee2ad82f90dcc 0 +NetworkSkill_powerup.cs NetworkSkill_powerup.cs 80ca2b552631913a55dd6881e45cdb1b689b6fb3c53bffac16f844c49de3ceec 0 +NetworkSkill_pp_modifier.cs NetworkSkill_pp_modifier.cs 6d52b52cda57cfa41ddbd3bee8175f0e257b2a1a6e285ef6bfd8bf78056e9938 0 +NetworkSkill_quick.cs NetworkSkill_quick.cs da02a5aaa5e9a09b7a22930a1708341fcd91c7807350cbea511b544f0c205db8 0 +NetworkSkill_random_array.cs NetworkSkill_random_array.cs 7dcbe440f95ff2d2d03fe444e5b0541159965f8e79411046c6114b7bdbe7ed3b 0 +NetworkSkill_reflection.cs NetworkSkill_reflection.cs 860a27eef9a494c614d66cd1b03b4c8e3eef43ec8124c28b97a395a13c6e08b3 0 +NetworkSkill_remove_by_banish.cs NetworkSkill_remove_by_banish.cs 392119cb01a31e331d0a72f7833a99b5d8d75004bc7a376d1d52cd6fca399d91 0 +NetworkSkill_remove_by_destroy.cs NetworkSkill_remove_by_destroy.cs 1bbfa35c4bd64ceb4f1fb118b10847fb73645525828b67c51ede1ba546936bcd 0 +NetworkSkill_repeat_skill.cs NetworkSkill_repeat_skill.cs e9cf75a5e9d6d46bed5096bfa4e567850716dd9f97076d0f21e1796b845f0161 0 +NetworkSkill_return_card.cs NetworkSkill_return_card.cs 62ffc15fb69555e0fc6d5c0ac0365f4afa1171f620b803c22516f602446ad1db 0 +NetworkSkill_rob_skill.cs NetworkSkill_rob_skill.cs 735da050be50bb4852f5bd078570d29916789ce24ab3af68b54797f026f7db14 0 +NetworkSkill_rush.cs NetworkSkill_rush.cs 125f689c411c259522341711b05aeed548f7f955fcdf01d2836b4a21f4ddbdc7 0 +NetworkSkill_select.cs NetworkSkill_select.cs a61f53d362e8f8b983f124d521d9299fb3343c0e8e177dcbebbc3895047f1ecf 0 +NetworkSkill_shield.cs NetworkSkill_shield.cs 54ba7a2516f5aad3fdada7a3b3e3cce2942f939b5b7085f9b4b0a18d008c76d9 0 +NetworkSkill_shortage_deck_win.cs NetworkSkill_shortage_deck_win.cs 1d31d6f66c7f4a7fa6e13a6be74b308a71ac01fc24359c70fced88c1c887a2c2 0 +NetworkSkill_sneak.cs NetworkSkill_sneak.cs b7d7c08f603f59f16e5a47c9033dbde3d44ebab3ea99990deab8a4c8687e3310 0 +NetworkSkill_special_lose.cs NetworkSkill_special_lose.cs 0183c7d280e78506df1a5600a584e34ec614709f9679cc6946f3b1edb97969b4 0 +NetworkSkill_special_win.cs NetworkSkill_special_win.cs 563e541841c9d68af7bf84b706895eb8274591ba8657f275de6751a8a09d7fed 0 +NetworkSkill_stack_white_ritual.cs NetworkSkill_stack_white_ritual.cs 9d30be6b9963fb74dc8e0b29e60b705c98fc4451bac320ce3ba3ffe9d37cd2df 0 +NetworkSkill_summon_card.cs NetworkSkill_summon_card.cs e7aff097db443c197f25e2d9409f4196335ef80f263ceccb96595dbfb6fda64f 0 +NetworkSkill_summon_token.cs NetworkSkill_summon_token.cs d8afedbdd480a73ed2050913d81c5a5b89676fa5347e651d1ba01ccbaf1eb639 0 +NetworkSkill_token_draw.cs NetworkSkill_token_draw.cs cdb78c2b35905f4237bb26b8a910c3b2594e3a68e8174aa2751b3185fc01698b 0 +NetworkSkill_trigger.cs NetworkSkill_trigger.cs 0f5742055fe157236f2bb6d5fd93e09a747b41f846dc4054291c70dd89e60e59 0 +NetworkSkill_unite.cs NetworkSkill_unite.cs cdf3c7aeea2ab4d3326a5d007b107e80d842fa4d594ee571b2b4df3068f91285 0 +NetworkSkill_untouchable.cs NetworkSkill_untouchable.cs cb6f041c9048249efc64f8c1b51e5d49dae48d45d3669e535d1baf0ad54ae1da 0 +NetworkSkill_update_deck.cs NetworkSkill_update_deck.cs 999ac6d41a7d7e9e3c7606b4c821ea674093653f09d0384ca7a882af70742dd4 0 +NetworkStandardBattleMgr.cs NetworkStandardBattleMgr.cs 0992fee723419c4dad06d5428cf59df2289436c24c992f2abf54b268d04d9e7b 0 +NetworkStatus.cs NetworkStatus.cs 4ccd398bea16d02235ce58767ae6d338b86411dd5a8f30a0357fddecf8fad4d7 0 NetworkTouchControl.cs NetworkTouchControl.cs fa433ec9d3570dc5916fa848f1f43a29da1a123a9dfe732b28ae8693938fc729 0 +NetworkUserInfoData.cs NetworkUserInfoData.cs 677c34802826f819ef211764a4dd33ee22e26b96f70c832cb5eb3925c9de4725 0 +NetworkUtility.cs NetworkUtility.cs 1f23a8c5b4e7c4d07a01f20efa71a198b3bdc72fd898e4a07f8afbd5ec2532ee 0 +NetworkWatchBattleData.cs NetworkWatchBattleData.cs 193aa36e40d3f3a09013a8589871a16f914214286942591eabcb0b97230c717d 0 NetworkWatchBattleMgr.cs NetworkWatchBattleMgr.cs 9bebf4e2efd881d958b9ff30ef5a058f92843dce25adff104eb3186376216062 0 +NetworkWatchBattleReceiver.cs NetworkWatchBattleReceiver.cs 6a4cf1ad6b8c1f961716442805d37253d9cf7a154294499a93a101244a9412fd 0 +NetworkWatchBattleSetupCardEvent.cs NetworkWatchBattleSetupCardEvent.cs 8b1f497fb4119aba2f7104d82e0814dbf56b31311589d74f6dbfb076a52bd3ec 0 NewReplayBattleMgr.cs NewReplayBattleMgr.cs d4feb1e6bea904b6e4f67228555b41b20f4b49d0a6117ed6b47071091d043844 0 +NewReplayOperateReceive.cs NewReplayOperateReceive.cs 35eaae0f7fd9bf69a615fc7db2daa66254588243a58470487412f8bbd06219c6 0 +NewReplayOperationCollection.cs NewReplayOperationCollection.cs d0c6dfefb02ec6ec66f202f1bc1bbfd05c63d66ad2038a766a6ce9a545a3bf9c 0 NguiObjs.cs NguiObjs.cs efcf4f0ef3e881ef8a9a4c760c9b9e990ff5747f3c5450565ac7b08af2c7fe67 0 NotBeAttackedInfo.cs NotBeAttackedInfo.cs cf27c240017e3c5276d3b065dca43373d346bb29043a203115f9c5f33fe41ed7 0 NotConsumeEpModifierInfo.cs NotConsumeEpModifierInfo.cs 00aef49ba7e742cd19278a692954a92c8a5e872d0fb41bc54ed831242a86c745 0 NotMulliganEndToJudgeChecker.cs NotMulliganEndToJudgeChecker.cs 80febf55e54e431a6cf8c3264baa180f1a48d57bbf4d97c020aa23d37dbaa90d 0 NotTurnEndToLoseChecker.cs NotTurnEndToLoseChecker.cs a8874bbac8694e89090b0b13eb7ddaee90ff8f1d6e873873ac1e492b18a09814 0 NotTurnStartToLoseChecker.cs NotTurnStartToLoseChecker.cs 346d048a258240b0943432ad93d305d26418debdc57e17c95ed6b2062f8eeecf 0 +NtDataTranslateInfo.cs NtDataTranslateInfo.cs 70f2e47dfd6a5e7302c116f2c58898e5518c74062b4295ac9ae07419499dee1d 0 +NtDataTranslateManager.cs NtDataTranslateManager.cs 4063c0681776b01e828e83f159b806804e22d0a4cef942420ad352f5891ebd5d 0 +NullBattleCard.cs NullBattleCard.cs 5cd7b46b3bd1a40c5ada04e175f331f4a885e0805a3ac221eaabe832820e3c1e 0 +NullBattlePlayerFilter.cs NullBattlePlayerFilter.cs 8529798e07d72f054b13bb680445d302992dde2828272066af7e46502104dd5b 0 +NullDetailPanelControl.cs NullDetailPanelControl.cs 23191faed4f557714b777369da21d97219e3f71ab6fad72ef21f2558b78b067b 0 +NullNextSceneSelector.cs NullNextSceneSelector.cs cd2669c1c2e3d84b2fcb31c2c670dc1beaa336ff2b460f52fa3d7e32b81bf00d 0 +NullOperationCollection.cs NullOperationCollection.cs c3886781dcb423b1d045a7aee74fb139aa16fe927ed2ff4fb96a929a22969efb 0 +NullSkillApplyInformation.cs NullSkillApplyInformation.cs 22d0b0e5e341249065c4f256772d66f328da2bd390bbf89fc7a003625483dc0c 0 +NullStatusPanelControl.cs NullStatusPanelControl.cs 78238e8cbf895ca2513e74d23322a2a8fefa728ddf1407a110dbb0f02a53d271 0 +NullTurnPanelControl.cs NullTurnPanelControl.cs 4c65fd3cca218efa16563934404a0054026e915908f4bbbeea4f87d5a197c360 0 +OffenseAddModifier.cs OffenseAddModifier.cs 5f3150bfdb6cc9b4f581ca0d1e82b05d649a6eb86542aa8eaa777961e40f5fc2 0 +OffenseMultiplyModifier.cs OffenseMultiplyModifier.cs bbe0e1023839d6f97ce887615cada33d6c12eb9b1cd1ab09bc4ed3ff06c88317 0 +OffenseSetModifier.cs OffenseSetModifier.cs 2100c8a68ca22b7d74e79d62fbd378b83a9a053332b1f10163dd8fed1b7adda2 0 +OpenURLOnClick.cs OpenURLOnClick.cs d2d823441976fdb025023fb4f5605c95a5d7bde38f1869dd1b31fa0eae8dc389 0 OperateMgr.cs OperateMgr.cs e850a929de25ffac21dc85de267235a530e4671ad5edf8652cca9c5be8418028 0 OperateReceive.cs OperateReceive.cs cd94427cdfe2b43ccd2bb815dcf7373e2a3caa3f7dc23901b0abf2c6e312f742 0 OperateReceiveChecker.cs OperateReceiveChecker.cs 990b8d1af1e29c852c7b3b8edabc5aa10be41f95ac8b9288a125918c1875a6ed 0 +OpponentBattlePlayerFilter.cs OpponentBattlePlayerFilter.cs e0459ce382416e8c30a02e56163a18436370e09749e70baefec9ffd775b839e1 0 OpponentNotTurnEndToWinChecker.cs OpponentNotTurnEndToWinChecker.cs 002da6bb2303a75d863ad19c5a5bb6380abffcf4f7293f47200220f0fa703917 0 OpponentNotTurnStartToWinChecker.cs OpponentNotTurnStartToWinChecker.cs 6413b3b356d23a1f3a39eca87e786c70c66b6c8483c058fba5e44756cb5d2905 0 OpponentRecoveryToDispChecker.cs OpponentRecoveryToDispChecker.cs 6e8de98a40a364b5bc06b7bd0ee1c3a2202a1c7dc730e9afba4215770d096920 0 +PackOpen.cs PackOpen.cs 2ccd3afaff9e8a3365e56b357bf2daf3bab4df292002e0948c0981e31ea39f54 0 PackOpenDetail.cs PackOpenDetail.cs 59540a83a0f103a8113e416485c1f2fe5495f0ab5d80899da778069a6ac26743 0 PanelMgr.cs PanelMgr.cs 5b0d5fd19f49134ad0a708e7263f8d68ef636a33a0212776191602c4b9074dae 0 PlayHandCardReflection.cs PlayHandCardReflection.cs 934c893708573d24787ba3ad9b678ea465b749715f68cbda53ca00d427fe70e0 0 +PlayQueueViewBase.cs PlayQueueViewBase.cs c6829c45500f1c4911e8fe41bb66711e61417521de911513042fe09fb55c50cd 0 +PlayerClassBattleCard.cs PlayerClassBattleCard.cs 1cab6fed6be2d2bfc08d2f2ce1c2f78fa5710a3d3000972619105da408392ae7 0 +PlayerDrawCardToHandVfx.cs PlayerDrawCardToHandVfx.cs 2fcb442801159327adda940d47a0d7cd9ea5ea77d4072fadaeea40cf6dfc57b0 0 +PlazField.cs PlazField.cs 5b1e5ade9d15cb05c2748944bb1fe44de3cf3a0e665c6b3d68fc0d0d67d853e6 0 +PlazRiotingField.cs PlazRiotingField.cs 47f33cc59e41c02777eba97c51d3d1df341d13ebef42f6f5b5156bfe870ef74b 0 PpAddModifier.cs PpAddModifier.cs d7c541e03d3a6b6b4427c9156b4139d759ab3a6e8e5b896adf11acf854468735 0 +PracticeFinish.cs PracticeFinish.cs fa520381cabe07d5971ec8471c9fdcc79d5ba582c1d50d67d43c4546b9f2bbf0 0 +PracticeFinishDetail.cs PracticeFinishDetail.cs 47b753253f64bd4d862b462d9c323da76fb2b8f2775fc9bd5a181994a5acc37e 0 +PracticeNextSceneSelector.cs PracticeNextSceneSelector.cs d250b5c94fb8d5a87de906b8c3cf5bc1b7e1ff931b0ea13d08ef67603b60a25b 0 +PracticePuzzleFinishData.cs PracticePuzzleFinishData.cs 35dbad2dafcefc5871c9b36312cb1cb82128bdb66e160c6d6381f6ccd3fb124e 0 +PracticePuzzleNextSceneSelector.cs PracticePuzzleNextSceneSelector.cs 788a2a04042f93566fd580d7238754b5b57c884404196af6e382b83cba26bd70 0 +PracticePuzzleReportEndAgent.cs PracticePuzzleReportEndAgent.cs f7ee7ee538f1f18d6339208a47927c6609dff6b7db37e1b7c119cd547e73042b 0 +PracticePuzzleResultReporter.cs PracticePuzzleResultReporter.cs cdb89dc7bd2573d7ec19cf6c5a944dd28724fd22438f3fd1a0fff33567291913 0 +PracticeReportEndAgent.cs PracticeReportEndAgent.cs 5c8b61cd5040bb95f5742824d695cddab6991439c4cd3c26fadc36f28a8f9fd5 0 +PracticeResultAnimationAgent.cs PracticeResultAnimationAgent.cs 57f7191176a295bc4c17026aa408e589d7fa10643e4f68f3d9fee85233172a1f 0 +PracticeResultAnimationHandler.cs PracticeResultAnimationHandler.cs d600eb03d9b567e1072ad6420c75f36b17548680cb44a42ebf0e34cb573cd0ff 0 +PracticeResultReporter.cs PracticeResultReporter.cs 4fece157f0161a257e32ab2106f6d7db44d4bde0d2fef2b803cd2ca6260a0c22 0 Prediction.cs Prediction.cs 536228a52cfca4db3c40d419472dc575278a0785a280040a33203c62691c7976 0 +PrefabMgr.cs PrefabMgr.cs 889ee1b9782467f82ef5ce88da54d55213d76bc7a044abff5837c10d562576cb 0 +PriConnField.cs PriConnField.cs c410f6b85dc9d94959caf1879f9d600be46fc880e6f2a3dd6f594c4b1aee5f2b 0 +PuzzleBattleManager.cs PuzzleBattleManager.cs f96e0a25d8e148a6704bf4624095cbf8453f800a73cc96f73bfc15e894536072 0 +QuestFinish.cs QuestFinish.cs a64f425ff026f670b995b33c462b81aecb0d956f6c6e4da98e2d4d98b5d41220 0 QuestFinishDetail.cs QuestFinishDetail.cs 488d190e160ff8dd616403fbf006ded58d40bd7e02a6d77b4df443283dfb11cb 0 +QuestNextSceneSelector.cs QuestNextSceneSelector.cs 765b1a0efd54ad7c15b70be5c74eb27e3bb67cb0d3cafb49af2712965af1ae47 0 +QuestReportEndAgent.cs QuestReportEndAgent.cs 41f821b8c5c7baecec8705288b01e4b59bdf99323f6470f587c19f22e02d4d40 0 +QuestResultReporter.cs QuestResultReporter.cs 51c2880f3a0494628b49f88cd7339efc02485063fc593f7a4d4f0ab0a17f6ada 0 QuestSpecialBattleResult.cs QuestSpecialBattleResult.cs 44e08cfe0fd128f5e1bafe8a0a819a71225dbe3645bafd7f329f43c56a1acaf1 0 +QuestSpecialResultAnimationAgent.cs QuestSpecialResultAnimationAgent.cs 3a6b2f465e817442a592750da069d4cdcb1be2be8848ad1ad3d61c9465e13653 0 +QuestSpecialResultAnimationHandler.cs QuestSpecialResultAnimationHandler.cs bd38c76846501e9e6848cda0ad495ffa5b813ae84254d265ae5ebb2e9ef1cfe8 0 +QuestStageIdFilter.cs QuestStageIdFilter.cs 870380926e451311aa1c52c98d9c2538a8543b35ef2a77e41fb7ae37f65fef94 0 +RandomValueFilter.cs RandomValueFilter.cs 77593f5542a4bf70d0d5f65441b91503d2fd08ef82b6d7837404e47df9cbeaa7 0 RankInfo.cs RankInfo.cs 1f79848feee9570d337bdd7a7779a716cbd05141ca901d1ef8667e44ecea672d 0 RankMatchBattleResult.cs RankMatchBattleResult.cs f6c59a1c10cded1b4465bcb9a4ca3b26eb6de8c60db0b9437210001666cd5703 0 +RankMatchFinish.cs RankMatchFinish.cs 6a07d132875232efa0814504c4eecc9e8be3f58da2db52767818ee0806968ec5 0 +RankMatchFinishDetail.cs RankMatchFinishDetail.cs 35da07b82ae8bf3c651eb02f62d88695edb119592993a0daf50d0be71d150650 0 +RankMatchResultAnimationAgent.cs RankMatchResultAnimationAgent.cs b1811588cb086686785788b3d88efbe5493a3b57c81341ce64c903a34412fc4d 0 +RankMatchResultAnimationHandler.cs RankMatchResultAnimationHandler.cs 66a39d4c42bd87e3d8449e8f9071ddaaf7c94b23a3241e75ddc435df8a574ddb 0 +RankMatchResultReporter.cs RankMatchResultReporter.cs 957e37a3685c4f6377892befa871e60c8471b944dc8f76d80b7b08c7c8521a92 0 +ReadMail.cs ReadMail.cs c4821b3923bf6f8dbe88688c3246db024b4bc7781ac3d2b86c5c309ba2c1eb5f 0 +ReadMailDetail.cs ReadMailDetail.cs 199ca00be327e37b802772e09ace306bf588b5dcd3b9017bd8a580634ccf6882 0 +RealTime.cs RealTime.cs da424360abc0f0569c8da46271c2734ce5f514f802630a86ebf42fcba30fa75b 0 +RealTimeNetworkAgent.cs RealTimeNetworkAgent.cs ac4c8a6f6c8400736edb447aa4c4463cef8d1e6a19f15bcc7990603053cd719a 0 +ReceiveFriendApplyInfo.cs ReceiveFriendApplyInfo.cs ecee225b7bc644459695784dbbc20a97818f9ca7fb62bfa81577c5a2ae1d5de6 0 +ReceiveFriendApplyInfoDetail.cs ReceiveFriendApplyInfoDetail.cs d9f55b1ab75c25a702a930a6a50117ac4302cb6fdad96ca4f70b21a9478f0086 0 ReceiveIntervalTrigger.cs ReceiveIntervalTrigger.cs 7a5b285c9acf441c4a97e08243228c9a55e3a81657911fe59d775db0956205a7 0 ReceivePlayActionsReflectionBase.cs ReceivePlayActionsReflectionBase.cs 6ffcef690e2a73d946b9af88612c18a819ff02013333d940ec958144b34e445d 0 ReceivedReward.cs ReceivedReward.cs 790befcadc8b35b0067eb88a127210a625dbf639ba1b5d5829d5e434569e9c1f 0 +RecoveryOperateMgr.cs RecoveryOperateMgr.cs 4a107e2bef7889ecffbf500ed3f4b56205c611e84f25a450f0ffa4cf40809504 0 +RecoveryOperateReceive.cs RecoveryOperateReceive.cs 84e33ae28bcd79e5376a0ef448881280e378a595614d3ec7038d360efb861eb9 0 +RecoveryOperationCollection.cs RecoveryOperationCollection.cs 57597229de28acdbd55d40699d95d4c8a4c470f681410a9d75ed6ffe4a45d1a5 0 RecoveryToDispChecker.cs RecoveryToDispChecker.cs e5f6b0b7a4ed72ae2fb7466083109da654797f0a53b0d956e7bcebc20de47423 0 ReflectionInfo.cs ReflectionInfo.cs 6c52f52fa1003907d7f37ac9cac83be02069791e91f47ce500dc686716c2600f 0 RegisterActionBase.cs RegisterActionBase.cs 9e101ce8eeaed30cb02f8263d3b43f07bd57c40e868c291ca3dd8e5d6b9652a3 0 RegisterActionManager.cs RegisterActionManager.cs dafa07d8b8beea14456ada306ffb47898391089361a04a7e56d9c01f6736a978 0 +RegisterAlter.cs RegisterAlter.cs 71f274fa4dc4a7e20aa2a7ec84259f24a8ff204e7d112d190715842c1607aed5 0 +RegisterAttach.cs RegisterAttach.cs a1073c9e0beb3403421f762b56752fc138f2eaf4efe0c9ce525e691f27835b47 0 RegisterChoiceAdd.cs RegisterChoiceAdd.cs ebd7a55f46204db08be667eb3eb5716a88ea723e0515a63c5a9678513d584f81 0 +RegisterCopyToken.cs RegisterCopyToken.cs 0d18db819ca168a8f1c89bf4cdbe6472221510cf7029db1279c9b2c62352b43a 0 +RegisterDeckOut.cs RegisterDeckOut.cs aacec98ddf2a97fec3c06f6fee3309251d17b3a3ef30ef7af5777241f110d7ef 0 +RegisterEnhanceTrigger.cs RegisterEnhanceTrigger.cs 6ae80e2e9274a5961d57e86a01756dfb851edfc38a5df6c7c1ac3b3f4b992a10 0 +RegisterEvolution.cs RegisterEvolution.cs 7913c5d94b10bfcfaea3eb3f3f52d2b505dd15fd6431e00307caa967c026987a 0 +RegisterExtract.cs RegisterExtract.cs 0511c2e0ce3516d627ce4284c46d6c83f5dbe0a0809d8563b51525d8feafaaea 0 +RegisterFilter.cs RegisterFilter.cs a4f323658602948e32a4b9ddef2e3b6a35540e1bd9f273dffa2bd06272b30bbd 0 +RegisterFusion.cs RegisterFusion.cs 9fad0a9cd989a74569aaee6bb29fb03aa8a5fc60c9a843bc2d40c14677f216d1 0 RegisterLotCardBase.cs RegisterLotCardBase.cs 0eaa82c60bc5c3a4cda5f11e43b2046258be409435659981f9e28076585d4953 0 +RegisterMetamorphoseData.cs RegisterMetamorphoseData.cs d2da9001d5dba0107bb0e96d5cd5802ffdac10141d5346f46692226d325ccb43 0 +RegisterOpenMyCards.cs RegisterOpenMyCards.cs bbc85f37d83266f1bba8da24c4967831013a84688e5e822d1e1314aaca314665 0 +RegisterPlayerParameter.cs RegisterPlayerParameter.cs 7b1862b642c09e9bc47f8ba3897fe7878af52a984f9b5448cbb0f895e746e837 0 +RegisterScan.cs RegisterScan.cs 25cd0ba7c22b1c1bad9c8705346dd26e63d3fa87ec74c0005dae78f69834ad02 0 +RegisterShortageDeckWin.cs RegisterShortageDeckWin.cs 30369d01c40064ffc6eb5e2ddbb674af36f5f68a349438ed6e5eb293e98bf3d2 0 +RegisterSkillConditionCheck.cs RegisterSkillConditionCheck.cs 97e3189933a0a6f6cac86e228aa5629cda4fdd52a830adb2e295d8364d07f3c1 0 +RegisterSpecialWin.cs RegisterSpecialWin.cs 42aaa086b7a6f0b14538fc92347a832b4e432605bea4e3861218cfccc508bc82 0 +RegisterStateChangeCard.cs RegisterStateChangeCard.cs ba906084130c2dd3b4c97c0d3aff81ec9b34002cbcfc95d7ecfe199b14f3d61a 0 RegisterTargetBase.cs RegisterTargetBase.cs 8203159714f9b6739c4fe81aa59ad7989ec5e200495253e3f6303ad06a9069ea 0 RegisterToken.cs RegisterToken.cs db7b950af0ed7b687763ac8b31df8e6ba8cd4a412a81166123a72652373b8e15 0 +RegisterTool.cs RegisterTool.cs 53ece2ae42a89cae85fc0c4a329208df9b3710f1796d12b580bb9f82d581e589 0 RegisterUnapproved.cs RegisterUnapproved.cs 892dbaa7aa6b42439ba26596ffaf627ccce24a2c0607e288083ea03e6eec8d2c 0 +RegisterValidate.cs RegisterValidate.cs 7e340d1eb14223d5d737c65d671d621e569b07643088ac98fbcdbbf67185a6ae 0 +RepeatSkillEffectVfx.cs RepeatSkillEffectVfx.cs 9fcde080384545146771cefecdb340f7531557302c92935beae2c5ce1e58b2bc 0 RepeatSkillInfo.cs RepeatSkillInfo.cs 77144681a151c5f93934b0fc16cca2265a30d4d36e955c6fd369b32aefb1bf07 0 RepeatTimer.cs RepeatTimer.cs 43f45ef4bd6b0b0bc7e2e1a02029631bda78a932b62f71f151864596086c6253 0 ReplaceReceivedCard.cs ReplaceReceivedCard.cs 99a47b992de88d1d9433c31d10a9bc438a06cf25d618fb36d37c2efe827b62e5 0 +ReplayBattleEnemy.cs ReplayBattleEnemy.cs 0cd9edf444148dcced5f0cad667456456882a921474f174ae287ba14438f51fa 0 +ReplayBattlePlayer.cs ReplayBattlePlayer.cs 09ebef15f39bb79b464433d2f046ef416a556dd2b2b59d4738e97b42cd20bcb6 0 ReplayDetailInfo.cs ReplayDetailInfo.cs 49705ba9302bd646d306eb153ae870102b6a45cf51bc989d6ce7c65e77b5b816 0 +ReplayExecutionInfoCreator.cs ReplayExecutionInfoCreator.cs be484ac0171d68795e901539d17cd53168072c47e83f095959bb8eb9ac277f85 0 ReplayMoveTurnButton.cs ReplayMoveTurnButton.cs a4eff325fcfbbdedd9b6c3bbc6416190ee72a13ccf18e33eba417c3937ad8547 0 +ReplayMoveTurnItem.cs ReplayMoveTurnItem.cs 82c04d3244e3b6f46322d969ea080dc6c2ae5e82806125a3585519b961c068d5 0 +ReplayMoveTurnPanel.cs ReplayMoveTurnPanel.cs 4e9ce337088992a503cad1389c20d2ef699e2cc40b5bd35e64289f8ab493a33b 0 +ReplayOperateReceive.cs ReplayOperateReceive.cs 97f022471eebff107b95c1f2465fa3920761ef08601f27d7ad6a5366c16202f5 0 +ReplayOperationCollection.cs ReplayOperationCollection.cs 3a4aa5d5069982ad8e320ed954182f8d12bb4523cba27897539ca53eb25dc5c5 0 ResourceHandler.cs ResourceHandler.cs 4aee3875b0074af62154f817dd7042fe873830923e9b0d9a2099085641441e62 0 ResultAnimationAgent.cs ResultAnimationAgent.cs b0cd2cae790fa1427c69e96cfcf164f38d4a58aff8fcd60f08d1a9a8273a9c15 0 +Reward.cs Reward.cs b5270d953033a0ecb0874e5721846dc4d797916bfcbd4973c0dea5d359b8ede7 0 RewardObjectInfo.cs RewardObjectInfo.cs 7f8065f9dd3062ee8c31a3cdbde05ad4ae8880df2992263a316e7bee833211fe 0 +RivayleBackalleyField.cs RivayleBackalleyField.cs 52ff935248c68d70ec31e67d6f214789f9854c11ff175d12621bc0cd7fc4c9b7 0 +RivayleField.cs RivayleField.cs 9b69b1048560d224f4d3ddd17c582720b1b67fb9694ad30263575280166de234 0 +RoomBattleMatching.cs RoomBattleMatching.cs c45c33d2b1a471bd59943a860664bb145130c9b2d048103e7b5dc487acc4970e 0 +RoomBattleMatchingDetail.cs RoomBattleMatchingDetail.cs f3585e9c69dbb3549d7ba0c34b195fa95a92122534cab9d16d0b22a3c871f2af 0 +RoomMatchFinish.cs RoomMatchFinish.cs 03e6a59f109b8d6ae000bc899a882ee9bb64d4361406c727198dc619a0010209 0 +RoomMatchFinishDetail.cs RoomMatchFinishDetail.cs 3f80cc80214fe7f025c8d2c9378639ed5f81f9b086966fbe27bc6f5f0c74fba5 0 +RoomMatchReportEndAgent.cs RoomMatchReportEndAgent.cs 71940f832ce3ddb524ecb0a2c73b4cce3ff19085dbd083ec90cce48f763e281a 0 +RoomMatchResultAnimationAgent.cs RoomMatchResultAnimationAgent.cs 7abf3ac0a21cecfbcc077fb04e23a4f9018bd93e58a3c5a2526d9fcf8d8035ed 0 +RoomMatchResultAnimationHandler.cs RoomMatchResultAnimationHandler.cs bc5daed457f26684b513af0dec35cf3aa7914b6b1eff94b03b184732f7eb8399 0 +RoomMatchResultReporter.cs RoomMatchResultReporter.cs 49a82269147d91fb7bb0d81a373efa050938f6423bceb252a37f80f0089d588f 0 +RoomTwoPickBeforeBattleInfo.cs RoomTwoPickBeforeBattleInfo.cs bdddd9845f5376a14e363ec5e50e085015696210ba2fffccef9952046c9c4a5d 0 +RoomTwoPickInfo.cs RoomTwoPickInfo.cs f50c6d3d8fedcdef3955c965521fb8475ecd2604f3d68771f8a7a442f282d8f8 0 +RoyalPalaceField.cs RoyalPalaceField.cs 61ca2695cd743a780c38c7e57ef0baf601a7f804606a923740e1fdd8ef7a5001 0 +RoyalPalaceNightField.cs RoyalPalaceNightField.cs e8aafcaf579ea288e944f3a4c4327a544d0a8dc5cbe6e195b01ffe455f1651a0 0 RushInfo.cs RushInfo.cs f1e143f55de9f46018d4b81e24cce86885019ea8a2777ca90a36573ee95645cd 0 SBattleLoad.cs SBattleLoad.cs 8338806083822a3cb30f4f98c5906601ff2b9456ad11181468f529e3e3c289df 0 Se.cs Se.cs 1e701d14d8c51f1522870ada9a2109a8f5e98d27de5ddfeb51f57241589356fb 0 +SearchUserInfo.cs SearchUserInfo.cs 3e851e9e9137c2a6f9309abbef95ca4d9ea1b63b05385fee31ae8fbc7f3c364f 0 +SearchUserInfoDetail.cs SearchUserInfoDetail.cs b4b7513b8ff37ff823127bf5eed72a3fa5faebb0fa95c3d2157c144904cf34f7 0 +SelfBattlePlayerFilter.cs SelfBattlePlayerFilter.cs 1276b12a289d59b36f2a037c1fbd20f7f2894f1f9dff674f3574e4c40b75502f 0 SendCardDataMaker.cs SendCardDataMaker.cs 074a19f77a59be5859a486c9731f3f6df4e4960ff12245e8e3a9f92c071c30de 0 +SendFriendApplyInfo.cs SendFriendApplyInfo.cs 28a60bd3a4421a8cfe1531ceac2ecd78eec64ebc7de20736892d65cef1836579 0 +SendFriendApplyInfoDetail.cs SendFriendApplyInfoDetail.cs c6efa3a67633162dc822f528e60dd1a9aa6b4a48c0d2fd0d8fcd34b24417c2d2 0 SendIntervalTrigger.cs SendIntervalTrigger.cs ac92d11f73c9cd58a08b07f2d852028a646ee049df17439d023f05ba627878b5 0 SendKeyActionDataManager.cs SendKeyActionDataManager.cs b74f41da4e4f704e0300026d9af6e27a1374370214a6f77694db5dd01c726fd6 0 SetShaderGlobalColorBG.cs SetShaderGlobalColorBG.cs 605e1b276a8dc8cc0bdb083470de6fd462e168a827200f932aac8d5b67245934 0 ShieldInfo.cs ShieldInfo.cs c7ca21d0fd446587d0e2ce1e80b29055ea4ef2f6c154a18eaa279543aba8eb1e 0 +ShopSupplyCardPanel.cs ShopSupplyCardPanel.cs b8f62fbaaccb2d9ab0260c8e9865d919646a10c197c4daeaedcff460ff50d29e 0 SideLogControl.cs SideLogControl.cs fc18a896a557607eef7a5c103ef0baf6c61ddc52a099b905dc7ea1cd48896108 0 +SimpleCardDetail.cs SimpleCardDetail.cs 9ab323d687845ca53a27651b08d9747140a1f85ecf88d29c00274da105f894c9 0 +SingleBattleMgr.cs SingleBattleMgr.cs 777e5bbb7292df308fa612fed9883b4b10c24451a945e56fd741bf1fe2d9b4ad 0 +SingleExecutionInfoCreator.cs SingleExecutionInfoCreator.cs 1a64285907bf4fb29138cfcabeae99834a6730d2857de0cd82efb3e0ddf52f52 0 +SingleSkill_attach_skill.cs SingleSkill_attach_skill.cs 65e7581c82c4bf84cf738fbd1a605670b87f9623ad7ff561a3fc1c6713c80cb9 0 +SkillAbilityAccelerateFilter.cs SkillAbilityAccelerateFilter.cs b13d84c14d8d8a6d3d58258b9f6c8525bf17063a7b0bdf48614c4ede1343ff91 0 +SkillAbilityBurialRiteFilter.cs SkillAbilityBurialRiteFilter.cs 003b61178157d70cc51128d79e163dde19631155c2c89f6656b98f28b63f2851 0 +SkillAbilityCantAttackAllFilter.cs SkillAbilityCantAttackAllFilter.cs 6998cc6f15d12ba49b5aea79d4f2e80620c998f23d82685ac7bda2164ca07ed6 0 +SkillAbilityCrystallizeFilter.cs SkillAbilityCrystallizeFilter.cs 71759194a6e8e971463f33932ecad64d986913755db05452cc4420d863a9657a 0 +SkillAbilityDestroyWhiteRitualFilter.cs SkillAbilityDestroyWhiteRitualFilter.cs 540873e176ec10d0f6f6ebab01dd33d12e7a6e76edddfb0334bfbf15d41b7782 0 +SkillAbilityDrainFilter.cs SkillAbilityDrainFilter.cs 57ce62879c799506a49720d4588cf1854056ab4ce8198ce5fb4b63195e3cd03a 0 +SkillAbilityEnhanceFilter.cs SkillAbilityEnhanceFilter.cs edc757221cbb3a68096802fce83434b62c06041c207d458197c4a878ffe97019 0 +SkillAbilityFusionFilter.cs SkillAbilityFusionFilter.cs 1b6f46083d16d2946ee73f27a07ac4d157f9500aa1516599a5ef44ee551d49f7 0 +SkillAbilityGuardFilter.cs SkillAbilityGuardFilter.cs 832b64f0c42796f9b53acee2ce2563e722b5ab3f597506d3cb221189c70cc4ee 0 +SkillAbilityKillerFilter.cs SkillAbilityKillerFilter.cs 9e675870660460bae90b870f05419cd9b2a9ca087950f4eaab6c0b82530fb0bb 0 +SkillAbilityNecromanceFilter.cs SkillAbilityNecromanceFilter.cs 690a3d2c899c21b04c878a0291dc017e9723863c50385665ea5298145a9026bd 0 +SkillAbilityQuickFilter.cs SkillAbilityQuickFilter.cs c471c14d5c9709b046b3cacd0b582fbc400976d27aee102248fa1e29033b6bc5 0 +SkillAbilityReanimateFilter.cs SkillAbilityReanimateFilter.cs f1016db8eb1fbc10ed5b4129370e1499212db5e0c5b7bb74de48d8570392b12a 0 +SkillAbilityRushFilter.cs SkillAbilityRushFilter.cs 0ce921a42ac94c5f10346e1bd38cdb56697c0015105c91d9210f5e5a95eb8221 0 +SkillAbilitySneakFilter.cs SkillAbilitySneakFilter.cs 2f87d8e288b972f2dd5aedbed8dea1efd8c9258609387720e77e1154a529690a 0 +SkillAbilitySpellChargeFilter.cs SkillAbilitySpellChargeFilter.cs 4918ae19eed3074c150226778cedc52061d25018b74180cad83f36dfd349a855 0 +SkillAbilityStackWhiteRitualFilter.cs SkillAbilityStackWhiteRitualFilter.cs 78aa99f4f78e2dc11b148c56f23aaf945a2c912bb1b7ca43fe47cb2609d65dbb 0 +SkillAbilitySuperSkyboundArtFilter.cs SkillAbilitySuperSkyboundArtFilter.cs b0f7c4dfc798f51285231bcf38c15712faf117baca8dfd7bc94ae64b01d41c51 0 +SkillAbilityUnionBurstFilter.cs SkillAbilityUnionBurstFilter.cs d2b9a821dbd6ff0a1840ae3aeada954a4895e84a5ff283e6b77ade298152876e 0 +SkillAbilityWhenAttackFilter.cs SkillAbilityWhenAttackFilter.cs d9209ed4a8ed5e74b7974f7eeb35d9e83cad87dfade7719c680e69194d9881c0 0 +SkillAbilityWhenDestroyFilter.cs SkillAbilityWhenDestroyFilter.cs cbf2373e2d2ef5546a27c86c5515332d245121a2b2786e54b2d8a6e832ad2972 0 +SkillAbilityWhenEvolveFilter.cs SkillAbilityWhenEvolveFilter.cs 70acbd0b265359626800acaf7653ebd4fdf0976c5e0471bdd2c4497f4f496230 0 +SkillAbilityWhenFightFilter.cs SkillAbilityWhenFightFilter.cs f691df6002268cc5ca18279a19d9dc055f2b6b2d21c48912b20914b518f60a6f 0 +SkillAbilityWhenPlayFilter.cs SkillAbilityWhenPlayFilter.cs ce3b01f8f86cfa2e2a9cc12e3e0e4d2cad18a1cf0291366a1b4a663050f55808 0 +SkillAbilityWhenPlayNoSelectAndBurialRiteFilter.cs SkillAbilityWhenPlayNoSelectAndBurialRiteFilter.cs 16d8ead66c9f26477dbe5d855d455c4ce99c8d997940cbc8c584f0a1ed0de869 0 +SkillAbilityWhiteRitualFilter.cs SkillAbilityWhiteRitualFilter.cs 9625126efca319109cc03ec8ab47e7d8eddf5eddef3c498c0a45963b07c4194f 0 +SkillAllCardFilter.cs SkillAllCardFilter.cs 2b6e3d2badb2bff860a2949a99fab0ce0d3303e8a7aacc5022a2dd663ac0350d 0 SkillAnyConditionFilter.cs SkillAnyConditionFilter.cs 3fc4096e72dbbc726a9cc29c35d862f044fe2e71ced1f29a1828f0865f5cbf11 0 SkillApplyInformation.cs SkillApplyInformation.cs 26e8eaaf3ae8e7580ff1f4e2f4a483fd31e916434bc3d73b6bf4f0fd7aaaa0eb 0 +SkillAttachingAbilityFilter.cs SkillAttachingAbilityFilter.cs ebee36d1613962e881bd1f6ca31aa3df2ec48f653fbc55d43c0e39af716397a6 0 +SkillAttackIsLarger.cs SkillAttackIsLarger.cs 26be7189429d6fddf88030500fd47e7d73c99e5a12f4872bcece34da94f36c73 0 +SkillAttackedCardFilter.cs SkillAttackedCardFilter.cs 7f88aee3f28a011b8b15a029abdada68b63bdb4388bf73dad50101e85c73179c 0 +SkillAvariceCardFilter.cs SkillAvariceCardFilter.cs 5c35923f668cdeb9b085baab3ea2d716987ccabe92a6ea28ac906ecec989b632 0 SkillBase.cs SkillBase.cs bad47547ef24dd88e1c9144ff9de058ed614c639b4f2fa8ff32e6c901ae877f4 0 SkillBaseCopy.cs SkillBaseCopy.cs 8fdedd8c85095d7179de8bba365e25c7603bd7ed126627b9e56a167d90c36636 0 SkillBaseSummon.cs SkillBaseSummon.cs 0f8e928872f7faa449c2ca044ef344e930b32eae563a02eac46dd784dd238320 0 +SkillBothClanFilter.cs SkillBothClanFilter.cs 619a5e7237fd2fa270ab6623dec1a54a42d4b41ce73feda7013f898647e8ce7d 0 +SkillCalcFifthRoundDown.cs SkillCalcFifthRoundDown.cs 38b134a2884a4ce6e21f0a37c5b6831f9a0d3f9cfcf7a74fd7d8715bf309c5ac 0 +SkillCalcHalfRoundDown.cs SkillCalcHalfRoundDown.cs a2d20209d49771ffc3b05db648ce02ed3c1667edb5755dcce73db3e77d96af4e 0 +SkillCalcHalfRoundUp.cs SkillCalcHalfRoundUp.cs 93d19fc0d58e58418a9a27870b51d68c2e12b8cff3c8e37cf2617aed5f54a6be 0 +SkillCalcMaxFilter.cs SkillCalcMaxFilter.cs c3174c5bdb0d3dc390815dfd052c4439e24269e17ecaacdb3c1d82e2c99914d4 0 +SkillCalcMinFilter.cs SkillCalcMinFilter.cs 2093d5624f8d14547ab8bba56bc1cad1ce6f11ca3076464b0e1ca3391b229a3c 0 +SkillCalcQuarterRoundUp.cs SkillCalcQuarterRoundUp.cs 2e7f1a4f21d56ade23a8da2cb83d18ccc7ec15839999c5dec377b47772136065 0 +SkillCalcSumFilter.cs SkillCalcSumFilter.cs 7021c4bf6f14ddf4dc96a1c3dddabadfe4aa3cbb6d9c46a396478ca5125c4091 0 SkillCardCountFilter.cs SkillCardCountFilter.cs 051f8cef087213aafd73d68eb30ab8e2537cecae22f67f858ac8b6ff855135f1 0 +SkillCardFilterBase.cs SkillCardFilterBase.cs dd3d02fe4a4a789f9fae0bf38683c64412bec638ab2f8b37f1bb05fab3c96118 0 SkillCardLimitUpperCountFilter.cs SkillCardLimitUpperCountFilter.cs a93e29158387ac9c2bf136aad4adfd53ff5f8f11c9fe3fa4befb1bd64c913c99 0 +SkillCardTurnDestroyedFilter.cs SkillCardTurnDestroyedFilter.cs 6a0a1393aa3d7a072892860601aa2489cb345d65bb530168ad7ed255b41f3aaa 0 +SkillCemeteryFilter.cs SkillCemeteryFilter.cs 2a9a2534bc08f13237b44757a1a159c13073f36f56476a0e85bacdbe6d49c1d4 0 +SkillChantFieldFilter.cs SkillChantFieldFilter.cs e93382cad397d8f627d617915d3415c1463e56b7a84cfffa818155b77e06a1eb 0 +SkillChoiceSelectFilter.cs SkillChoiceSelectFilter.cs 99dd76f9bd1661a1ded15c1b71d60760aedad45a448e9c0145cd9cd0d44ee4c1 0 +SkillClanFilter.cs SkillClanFilter.cs d8496655bc4515bef819358ca750c0f208f91f8e518e9b2724058d2eac3d2fb9 0 +SkillClassFilter.cs SkillClassFilter.cs 85fe680f42ea892d73ac3553d0ae801559d889f45c763952db547389db536f4f 0 SkillCollectionBase.cs SkillCollectionBase.cs 3d20acf096e5f879635a17005897b250eff32785e0c0abbca06353fe6c8318d4 0 +SkillCompareFuncCreator.cs SkillCompareFuncCreator.cs 70533207660884a8e261aff4b151f0b1c859fa80ec5699418e507eb0491a928c 0 +SkillConditionAttachingAbility.cs SkillConditionAttachingAbility.cs 71e011113524e7b8ab5fc9c7aaac1fee2404e690b01306efa79f57510e77dd82 0 +SkillConditionAttackerIsOther.cs SkillConditionAttackerIsOther.cs e93f0e1e9fd8e7001d46180e3ceb351b8be037d3385c6c61ca3c37b19e1ae108 0 +SkillConditionAttackerIsSelf.cs SkillConditionAttackerIsSelf.cs 704ea048939619e4e04e2731a6fc1ae0aa26062b1700bf2c66bb6bc6532b35f2 0 +SkillConditionAvarice.cs SkillConditionAvarice.cs aa4b667642beba5cbdbc93afb24e071dedd5325429e40ba45bff59cde118bd7c 0 +SkillConditionAwake.cs SkillConditionAwake.cs b34378fc7e7c5f9406764d48cecdc0f4db2a9539fb83bf8492eaa905e68d8463 0 +SkillConditionBeAttackedIsDestroy.cs SkillConditionBeAttackedIsDestroy.cs d65e32aaa786154cf7bbe664281bd8457c85c8e66ec5dbe793c289c0749e125a 0 +SkillConditionBeAttackedIsOther.cs SkillConditionBeAttackedIsOther.cs 14e1636d4c59f9f566209565aaecf4a6039a7ad7c6c5b1a323edf8e679daee99 0 +SkillConditionBeAttackedIsSelf.cs SkillConditionBeAttackedIsSelf.cs d0126eda459ad7536059f050a6c5ae0cdea9d90b72aee8535f4c2a1f95898515 0 +SkillConditionBurialRite.cs SkillConditionBurialRite.cs 2bd84088d2d195574d05744c9bb68a09a89684f1290f5a4cc52bcaa1346a3f41 0 SkillConditionCheckerOption.cs SkillConditionCheckerOption.cs 6bb1f2c1abf0be55acda4c52272039d3d88e8af6c916517ae2218741a3b1ca36 0 +SkillConditionDeckSelfSummonedSelf.cs SkillConditionDeckSelfSummonedSelf.cs 32ad523514649d2820a67811c2a20ec6f5d926b14d8bcc2857705e15c04611e1 0 +SkillConditionDisplayOtherUsersMessage.cs SkillConditionDisplayOtherUsersMessage.cs 2d551f92dc7fc06472432cc98ce64b6ddca397d47168e8b9d46afaa8748185e0 0 +SkillConditionEvolvableTurn.cs SkillConditionEvolvableTurn.cs 23cd0c05392d348a90d52e63820a19d8260ff472400bd448d083a1f19e836c9f 0 +SkillConditionHalfLife.cs SkillConditionHalfLife.cs a8fdebf7a60e759664c03a1a540bf11972fb40e978de4a64b7e4642412f03777 0 +SkillConditionHealingCardIsClass.cs SkillConditionHealingCardIsClass.cs 83f13a4f4873139f2c7dd6b6fa7f5ac9f3807f508219c74fbd15c1c76ab8dd64 0 +SkillConditionInHandIsOther.cs SkillConditionInHandIsOther.cs 21c14f4ab18d07d70b556322bc74aaa3447e67214da82a46b279977596cad68c 0 +SkillConditionInHandIsSelf.cs SkillConditionInHandIsSelf.cs b66ceb7c8502f8324763646e6c276312d95a481fc081166b67d5fdbfdc2d40d7 0 +SkillConditionIsInplayCardFilter.cs SkillConditionIsInplayCardFilter.cs 9f9a9f51afd056e74aeb6ab859b5c3b14a24ba2cd150a7f23172042347ce9e91 0 +SkillConditionIsReanimateCardFilter.cs SkillConditionIsReanimateCardFilter.cs caa2909ff09b6f6eb01019401e9980499922731489d6c49c1a925e1cbe28dfe4 0 +SkillConditionMeLanguage.cs SkillConditionMeLanguage.cs 70acfc2c579c9c61f06a4e9482b6ad641eea9ec3f0efc503fa9752b670949ec9 0 +SkillConditionOddEvenOffense.cs SkillConditionOddEvenOffense.cs a1fd5e100fd4749aff17b4dc4592fdddfafb1d0bc9a18c4912cb42f5086f7ae6 0 +SkillConditionOddEvenSpellCharge.cs SkillConditionOddEvenSpellCharge.cs d6ec2d78b39a64c2214c7e823e3b5b9b0ff35595119968c2fee029e443de0085 0 +SkillConditionPP.cs SkillConditionPP.cs 2af89d07848c0d13dd45e0aec5a863b30541465b7cf3f9da695776e0c2de6c8c 0 +SkillConditionPlayCount.cs SkillConditionPlayCount.cs 96f6c32d446a16beda9d302f4f7aac8a2830bd9eec9f3b93a900cb8a0b626dd0 0 +SkillConditionReanimatedSelf.cs SkillConditionReanimatedSelf.cs edd883f67c912033722738b8efe2f9b63e0ae0c02251c2e0a3699aceb8a5f5c3 0 +SkillConditionResonance.cs SkillConditionResonance.cs 946c2149a15043c397f0bc285121108cd3dcfea9c761de4da132afe95dc7ae68 0 +SkillConditionShortageDeckWin.cs SkillConditionShortageDeckWin.cs 66288d3392b233c1d5b421a6e126cd16cccdfaded236a8fa53e42879d47a9259 0 +SkillConditionTrigger.cs SkillConditionTrigger.cs c74394dff692febf5b19adcb1355c7286c72e46d13721c0594fdac3aec68f83d 0 +SkillConditionTurn.cs SkillConditionTurn.cs ca3962c0836af1494969f63f46112ffd63b47ccf8df5c5bbe5abbaaa89c436ec 0 +SkillConditionWrath.cs SkillConditionWrath.cs cd03ac1c3faf43862c54274dd1888c3576fd249f04f0213e7472dd2038ec9cb6 0 +SkillCostNoDuplicationRandomSelectFilter.cs SkillCostNoDuplicationRandomSelectFilter.cs 5ac4f9efe63702cc14afbdff65b90fb88d09390ea0bee38a6957335df8f14169 0 SkillCreator.cs SkillCreator.cs 6b90cd32dea619058e1cf942bdd288981495f7711a76bff8ccc9e2787e3f6439 0 +SkillEnvironmentalAttachedTurnFilter.cs SkillEnvironmentalAttachedTurnFilter.cs 39baba20fe5acbb45e3add067f5a45debadc8dabf546b437841566a31a310f77 0 +SkillEnvironmentalBpFilter.cs SkillEnvironmentalBpFilter.cs 53b3237b149fa520629fabdaf6035153cadbbd11c708d75ada746d9afa7d3394 0 +SkillEnvironmentalCemeteryCount.cs SkillEnvironmentalCemeteryCount.cs a53c09d22b1258860aba9ddf4b4aab585e52412423282b08fa72c7a78549dc28 0 +SkillEnvironmentalCharaIdFilter.cs SkillEnvironmentalCharaIdFilter.cs d45bd92ed94833ae1ab839c15be7a3bdeab340629ccdfb052f13439f2de8a82f 0 +SkillEnvironmentalDeckBanishCount.cs SkillEnvironmentalDeckBanishCount.cs 6942eee2cae6c9e45b7eb3e07f23487cc14f4d73ffc3eeb2ac5217827c589ac7 0 +SkillEnvironmentalDefaultDamageFilter.cs SkillEnvironmentalDefaultDamageFilter.cs 89e7600ddb8284a14ad95607313c8f6ae8ab595015f7cd934af8e0688c39804f 0 +SkillEnvironmentalEPFilter.cs SkillEnvironmentalEPFilter.cs d6a119dded51968c26deb8501ddd85765f39acf59a3b3e5994444455db801a30 0 +SkillEnvironmentalFirstPlayerTurnFilter.cs SkillEnvironmentalFirstPlayerTurnFilter.cs aa5f27270312e51bb39f8c9de6fa9bc360a7d740048eab37e658394f6e89dba0 0 +SkillEnvironmentalFixedDamageFilter.cs SkillEnvironmentalFixedDamageFilter.cs 3260d38460b08e8c8c2c9bc9c1d93c59d2c6d5f424084cf9210924174180e42d 0 +SkillEnvironmentalGameBuffCount.cs SkillEnvironmentalGameBuffCount.cs 9c3c4fec9403aab5284ab770a45fe61a49691445321d3a489a5dcbafa8d4b04a 0 +SkillEnvironmentalGameConditionFulfilledTurnPlaycount.cs SkillEnvironmentalGameConditionFulfilledTurnPlaycount.cs 398051e0c3a44d5fe82ded534f1bfe07b67de6f812bf196efe950fa31d5003c9 0 +SkillEnvironmentalGameDiscardSkillCount.cs SkillEnvironmentalGameDiscardSkillCount.cs 27f2b1a304a83053d46b888adf581ee1700f59688057a3954e5ee7f2c5391037 0 +SkillEnvironmentalGameFusionCountFilter.cs SkillEnvironmentalGameFusionCountFilter.cs 445ffbf2989f7bb7f0e92983214e57d34fe947a8f36e64523198aa200277af7d 0 +SkillEnvironmentalGameMetamorphoseSkillCount.cs SkillEnvironmentalGameMetamorphoseSkillCount.cs 10a250b2c38a0ef50435a5914acb4bfe9c247d57c81497cc17ef200f32af1e03 0 +SkillEnvironmentalGameNecromanceCount.cs SkillEnvironmentalGameNecromanceCount.cs 5190de7ac29637dbc9a776450641198b868f81a2feae0a6ba65e693cb7fce17f 0 +SkillEnvironmentalGamePlayCountFilter.cs SkillEnvironmentalGamePlayCountFilter.cs fc0304b22d2c5f4c42fcca9ff937a40eaea68b1ef89607a968bcf5e01e19d251 0 +SkillEnvironmentalGameResonanceStartCountFilter.cs SkillEnvironmentalGameResonanceStartCountFilter.cs cefb1004eb97460f1c164f266524e3eac167a626e2d1b29dd611a70ca99fb3f1 0 +SkillEnvironmentalGameReturnSkillCount.cs SkillEnvironmentalGameReturnSkillCount.cs cda4cacd09c06132ed39f4656c5b72eaa09bd0f5716c2677edd5297ce5f6dd46 0 +SkillEnvironmentalGameSuperSkyboundArtCount.cs SkillEnvironmentalGameSuperSkyboundArtCount.cs dd3d8d58944dc2064b524ac5364bf66d9d1e61d95fc0dbe31f47706a647a138e 0 +SkillEnvironmentalGameUsedEpCount.cs SkillEnvironmentalGameUsedEpCount.cs a2ad6e5403f3a87455609007e4235de1849e6b7c02e50625e682bd3b24a75a95 0 +SkillEnvironmentalGameUsedPpCount.cs SkillEnvironmentalGameUsedPpCount.cs 76b7ebdd3d831d6ea58f2913eaa33c197e2168f52a0cdb5d707853e711304da7 0 +SkillEnvironmentalGameUsedWhiteRitualCountFilter.cs SkillEnvironmentalGameUsedWhiteRitualCountFilter.cs b1c4598e13bfcfea5db643e7ff08866457722d5ea39fbb96d085617154047143 0 +SkillEnvironmentalJatelantBanishCountFilter.cs SkillEnvironmentalJatelantBanishCountFilter.cs cdbac439e0933ed0225e16490a3280e3449b073af8badcc5f09caba141687892 0 +SkillEnvironmentalJatelantDamageAndHealCountFilter.cs SkillEnvironmentalJatelantDamageAndHealCountFilter.cs e94a35be6fd99951703afb0c4fa8d50bd96cf8ebab8f67a6f573a33d3992ce54 0 +SkillEnvironmentalJatelantSummonTokenCountFilter.cs SkillEnvironmentalJatelantSummonTokenCountFilter.cs 0d9f88a9a5d992d04ea4fa4538ea33756232709e076acb0af50546a44fea2815 0 +SkillEnvironmentalLastInplayWhiteRitualStackFilter.cs SkillEnvironmentalLastInplayWhiteRitualStackFilter.cs 73283288e2ea756cb92e681fe67ddbc93a07d07cf7b0b1a4faa0d5a46c7b3504 0 +SkillEnvironmentalLastNecromanceCount.cs SkillEnvironmentalLastNecromanceCount.cs 7710b643cb5f9c2b47b1e254c81c4bb59fb7df75f226bd729991e91414c75b6b 0 +SkillEnvironmentalLastUsedWhiteRitualStackCountFilter.cs SkillEnvironmentalLastUsedWhiteRitualStackCountFilter.cs 0609ae3f0a39671aafba6842309f3ce5966cfe10b19ec9754151d5c01e167a98 0 +SkillEnvironmentalMaxEPFilter.cs SkillEnvironmentalMaxEPFilter.cs 9f67af166d697233bec1b81d95191a9e7fae4ec52112043ef3175858ed86b1b0 0 +SkillEnvironmentalMaxPPFilter.cs SkillEnvironmentalMaxPPFilter.cs d38ea57baad93702261efb4e0b828c920555eebda4062fd9b98e0fc7090c4eba 0 +SkillEnvironmentalPPFilter.cs SkillEnvironmentalPPFilter.cs 3d0be3d6809f4677a0ee7ce723179f35367ef9912d5bbc01ee36d8f352812e1b 0 +SkillEnvironmentalPlayCount.cs SkillEnvironmentalPlayCount.cs 2457f95ff90fbb994219cf365704f43267cb809afce75cdbab86d413f52dd77a 0 +SkillEnvironmentalRallyCount.cs SkillEnvironmentalRallyCount.cs 8b00991eafeb4b95f2b94d666e2449a177d40270683eb050715a0621b1ce1c46 0 +SkillEnvironmentalSecondPlayerTurnFilter.cs SkillEnvironmentalSecondPlayerTurnFilter.cs 4acb5aefc770909fc139b90b234d2ea575bd99ff58715835362d427fbd36f384 0 +SkillEnvironmentalShortageDeckLose.cs SkillEnvironmentalShortageDeckLose.cs a20607c176536e78eecbc50474a813d194cafbec1858df31282faa7b874837af 0 +SkillEnvironmentalTurnDiscardSkillCount.cs SkillEnvironmentalTurnDiscardSkillCount.cs 67508ebb8935003aa236fcf6490d0ceba9c5d637af91b0d2f1ab7ec30ea0617d 0 +SkillEnvironmentalTurnEnhanceCardCount.cs SkillEnvironmentalTurnEnhanceCardCount.cs 8dfb9c9ea36c05e2d12e3e90d27e1038143e60fa20262c44ee05d04d09fda110 0 +SkillEnvironmentalTurnEvolveCount.cs SkillEnvironmentalTurnEvolveCount.cs 19b72d5ad17ae4bf7a27a1f9eadd24958f1494c70d1a786d1fb68efc96f407a7 0 +SkillEnvironmentalTurnFilter.cs SkillEnvironmentalTurnFilter.cs a20833507347e78d37aa79323199f3d8875e02e07b5060802f47aee8185d5619 0 +SkillEnvironmentalTurnResonanceStartCountFilter.cs SkillEnvironmentalTurnResonanceStartCountFilter.cs f620b57b8a13ad3b0d546d9393d5c7de5408b7a9bea33735088a68a4fdf38000 0 +SkillEnvironmentalTurnReturnSkillCount.cs SkillEnvironmentalTurnReturnSkillCount.cs 944093b36e19deb661554b242c19c1ea30726a4f539f4196188cff68dc2fa2a4 0 +SkillEnvironmentalTurnUsedEpCount.cs SkillEnvironmentalTurnUsedEpCount.cs 63f060bd878c076d6e7f8f38a6e2539a03681bfe58bc2ee4e409212f6dc290ab 0 +SkillEnvironmentalTurnWhenHealingCount.cs SkillEnvironmentalTurnWhenHealingCount.cs fee0e9fc2e5759782be93d932d654d98e3efede2b4897f3e4a4db999355ee174 0 +SkillEnvironmentalUsableEPFilter.cs SkillEnvironmentalUsableEPFilter.cs ba383ecce69442829d20797a9100dabf9fd0559168539e2698ba5fd7d365f410 0 +SkillEvolutionCardFilter.cs SkillEvolutionCardFilter.cs abc82fb7e664ee6680e4dc49562160d0b770723b5f3dbc16397495f8204e3beb 0 +SkillExclutionApplyFilter.cs SkillExclutionApplyFilter.cs 8336af5b9f405d4456b21c5d3d398dabd89fa5d7890122f7952bdcdaa7eb42bf 0 +SkillExclutionNoneFilter.cs SkillExclutionNoneFilter.cs b0c0aceb80ed5df6052d3d99d4cd016d674c7711c67b10ebce36fd8442819c6d 0 +SkillFieldFilter.cs SkillFieldFilter.cs 8e17cd95c501a21f5015f521fbeb59d908217c2678607f5931dd51981461bc1e 0 SkillFilterCollectionBase.cs SkillFilterCollectionBase.cs 3f89c34a04e4690ab3bbbdd14fd444c1d56787e6c806ac23e6725377e066db43 0 SkillFilterCreator.cs SkillFilterCreator.cs c632b38c3d58fc93226ba2e2c331af3f193dbbb252073186ae3fd0940acc554b 0 SkillFilterVariable.cs SkillFilterVariable.cs 8afc7dcc5b2bf19e9030a470c4f1cc02b900fa7300994460f473f82136359202 0 +SkillFusionIngredientCardListFilter.cs SkillFusionIngredientCardListFilter.cs 0235084c101137cf9bac5db21883a65e5d3da81e89d92350a5b21eee7e115f50 0 +SkillGetOffCardListFilter.cs SkillGetOffCardListFilter.cs e355a5bd0bb5ec8de0023380b857cf71eca51f738f5b5353be3d0f967594c317 0 +SkillGetOnCardListFilter.cs SkillGetOnCardListFilter.cs 0b0cebbcbceee16a9becc71e3cc039f9106fa0620c37fec9a71e1ec407f31b68 0 +SkillIdNoDuplicationRandomSelectFilter.cs SkillIdNoDuplicationRandomSelectFilter.cs 3458949c29ee0b64f607ee9e6cac81b3fbcbb2968426fab2f19de1724428edb4 0 +SkillInOrderFromOldestFilter.cs SkillInOrderFromOldestFilter.cs b2c34d2ab08e26db635b517d81fd5763dc3f576479fde5125e21031ecb7b7286 0 +SkillIncludeSelfCardFilter.cs SkillIncludeSelfCardFilter.cs 42aecc1b49a25c77c40aa7d18c7df224e6abc671c1dbcff8bf121d898c9fbb67 0 +SkillIsBuffDetailFilter.cs SkillIsBuffDetailFilter.cs 3e7bdd34966e9a4344f0dbbb63eee4962633aaea9d1fd9d96df93ce9f0604aee 0 +SkillIsFusionInfoOrIsNotSideLogFilter.cs SkillIsFusionInfoOrIsNotSideLogFilter.cs a2f0bf856abd9dc67b052ea5ffe5c2ffa450dcd228f43f83e4b89c9334cf81bb 0 +SkillIsInvokeSideLogorBuffDetailFilter.cs SkillIsInvokeSideLogorBuffDetailFilter.cs 748df1f1d7bb37afd9b009e05b85b5d625003475c706bf5b9283ecfc705b160b 0 +SkillIsOwnerFilter.cs SkillIsOwnerFilter.cs fd74f1e9b68c64ca489b9900f2f1522679e02a96e8b13cae2739fb5a8825e23b 0 +SkillIsWatchFilter.cs SkillIsWatchFilter.cs e2fe74ff425cea1e523de99bad8504335a0e9648ded0891a6f943608c167c817 0 +SkillKeywordInfo.cs SkillKeywordInfo.cs 6f9287194e614f834e34ab8442cd677cc1e8fb5dfbded48ccc2843628b33b53c 0 +SkillLastBurialRiteCardFilter.cs SkillLastBurialRiteCardFilter.cs 3947eea272a4ee44f2f8846dcef992f2f7d22c0321688763fe41b7bb01cf5309 0 +SkillLastFilter.cs SkillLastFilter.cs 8aa0e717f1a7e2cc390896ee5ceef5314e521b4600ef661aba92bac38fbe9bcb 0 +SkillLastTargetTribeFilter.cs SkillLastTargetTribeFilter.cs abb19cd49069e57b87486929bc19e6b574bb5bb2a1a563a530fd5960b11c5258 0 +SkillLeaderSkinIdFilter.cs SkillLeaderSkinIdFilter.cs 669c484423ca9d2a192a9ee2d25e09ae28f29121ba9b062b0aa11af4ef2e4824 0 +SkillLifeIsLarger.cs SkillLifeIsLarger.cs 1e6145afcd075a9f414360c39fda53b33a7dc219d2b9a4e5af3e4eb0778bb29c 0 +SkillLimitUpperCountFromNewestFilter.cs SkillLimitUpperCountFromNewestFilter.cs 34cbf7b2bd9a35bb507c9b6971c0b0303ca59ae1caf95aada075a8a75300ef9b 0 +SkillLimitUpperCountFromOldestFilter.cs SkillLimitUpperCountFromOldestFilter.cs b908d7842d545e23e8a9fb5308456c997ace4447f315bbdb56aba0aef97f1967 0 +SkillLoadTargetFilter.cs SkillLoadTargetFilter.cs 798c62b84f05eae5b1685d107f68930b3033f9e3872caca25fcdce05280085e2 0 +SkillMultiClanFilter.cs SkillMultiClanFilter.cs 327d215ad248cc9e0111ea010170b18354c3858bb0e3e0f0f633048c121f0cc4 0 +SkillNoDuplicationRandomSelectInOrderFilter.cs SkillNoDuplicationRandomSelectInOrderFilter.cs 8d4bb62d34c66a108e9e953e0aff9a5a6d5d18b5ca1fd1c2a8b098d00ad9cdbe 0 +SkillNotChantFieldFilter.cs SkillNotChantFieldFilter.cs 958edf8c2014f86873b37676bec5fa153ca806db5bce37a2b6dfd5439a6cf67b 0 +SkillNullFilter.cs SkillNullFilter.cs ec698204e3b030f2c37cefcce9cc233bdfe132201819e6060aba0e0d80854265 0 +SkillOnlyOneCardFilter.cs SkillOnlyOneCardFilter.cs 322cbcdaea00af76dc8bcdbdb370c713a3effc5255068955e484483f12f4efec 0 +SkillOnlyOneFilter.cs SkillOnlyOneFilter.cs b1033505e0b52ab71833eca60800b71de3361f59a60857b8e71d395ea3a51b7f 0 SkillOptionValue.cs SkillOptionValue.cs 3cc7356d400b83acf6b5e8b26e752d52a9500607ede2e0ca46144f981b67b08b 0 SkillOrFilter.cs SkillOrFilter.cs a7ae3aa228e461e2a961fdbc2abd98f7e733638eac38a11675394063002b8e8e 0 SkillParameter.cs SkillParameter.cs 4f76863bf2f9e3beb45821fc02a8871ac818cc82b7893466a7e5ce45fde7cd53 0 +SkillParameterActivatedRandomArrayFilter.cs SkillParameterActivatedRandomArrayFilter.cs 4cc9ba69b0c7cb56d51669ca5ec48df3123a9b720667e07ec50e654418b1f9e3 0 +SkillParameterAttackCountFilter.cs SkillParameterAttackCountFilter.cs 68aeb7c87d61a4f7bd05230f44392c22fd461fc34c403ea91187627e3dc3d22d 0 +SkillParameterBaseCardIdFilter.cs SkillParameterBaseCardIdFilter.cs 03e1008573711655aedf352c7dbb88b34558b14089328142cb90410bc721576e 0 +SkillParameterBaseCostFilter.cs SkillParameterBaseCostFilter.cs ab4d42f1770a3b6a2a23874877fb0e4c8634df8de5cd2f502a17f1417fbb99e6 0 +SkillParameterBaseLifeFilter.cs SkillParameterBaseLifeFilter.cs a8d9f61ebe8e24f9dd5c59f18fe3f0c19c33075f2b03f2b04e9c1fb52e48c9b5 0 +SkillParameterBaseOffenseFilter.cs SkillParameterBaseOffenseFilter.cs 0eba4ec03bf7fac3c33dfec1c8f18fbf0184ddf1b7dd0af8ae20117325fbb602 0 +SkillParameterBuffCountFilter.cs SkillParameterBuffCountFilter.cs 28dff06c91341b2b42e9b3ed2d137a394534f362c6be9bc061dee86bdd31d343 0 +SkillParameterBuffLifeCountFilter.cs SkillParameterBuffLifeCountFilter.cs 036a01cb7fccd701b392bbd72f9561afd901e166b1c7b0bc6d18b2909fd0b4a8 0 +SkillParameterChangeMaxLifeCountFilter.cs SkillParameterChangeMaxLifeCountFilter.cs 8c87d09a205fc30618da017c04b201bb3f8a36e4281b61418853b33a61136690 0 +SkillParameterChantCountFilter.cs SkillParameterChantCountFilter.cs 1069a224165f738b384bdd9b34242982e5c20213d2214b4e09e965a8613f3b3b 0 +SkillParameterChargeCountFilter.cs SkillParameterChargeCountFilter.cs c7398650b6f708b280a005a19b441a424b99c558f273e07474a0244eee7d523a 0 +SkillParameterCostFilter.cs SkillParameterCostFilter.cs 044214ea8e3120d41f581f1cb533197110a59b215b154a4114744d8c1d8c444b 0 +SkillParameterDestroyFilter.cs SkillParameterDestroyFilter.cs 883df0291bf0ef692ac1ae687b725fa6b213f979f159a5ac0797793d00f56005 0 +SkillParameterDestroyedByAbilityFilter.cs SkillParameterDestroyedByAbilityFilter.cs 3ebb8f146304944ec3446f4b6a47edfb7f0e34287d60375da20c2fa94bc47497 0 +SkillParameterDestroyedByCardIdAndAbilityFilter.cs SkillParameterDestroyedByCardIdAndAbilityFilter.cs e2af6daefb164cf24059429055080c901577f37d2acf655002e7937ebf7b3598 0 +SkillParameterDestroyedByCardIdFilter.cs SkillParameterDestroyedByCardIdFilter.cs faad2046c10a45769b28b62041b8e6976fb3068726e5c732eabf4a56021951c0 0 +SkillParameterDestroyedByFilter.cs SkillParameterDestroyedByFilter.cs fd3f168625ce0791d9660f47f49624e8e481d1c8c95ecc4b927b8c8387605924 0 +SkillParameterDistinctRandomSelectedFilter.cs SkillParameterDistinctRandomSelectedFilter.cs dcc16c75ff49d0b147e7a270d9733b3f122f08c8cc4b0614c35590faf7e1770b 0 +SkillParameterFusionCountFilter.cs SkillParameterFusionCountFilter.cs 121613efbdbce29bc04a55bb2ddbb37cb270b25c0ec9ffb46706c9e40616ade3 0 +SkillParameterHasSkillFilter.cs SkillParameterHasSkillFilter.cs 7f6d6d2931e3241171fb83753ff4465cb4dfbdd5d127f1aa22058531ec305272 0 +SkillParameterHealCountFilter.cs SkillParameterHealCountFilter.cs 2adf008ed8eb6db6093756c6c2421366c5c49f0c5ef0cc0902587edda1076fae 0 +SkillParameterHealValueFilter.cs SkillParameterHealValueFilter.cs e94632d9a1414a45b85a1762c1326dc51515554351617358080c5042f13013a7 0 +SkillParameterIdFilter.cs SkillParameterIdFilter.cs f48526cec8cb1b5d1c5bd72f74d7f6d628e44f0707dba5afec9e89b12ed9f471 0 +SkillParameterIsChaosFilter.cs SkillParameterIsChaosFilter.cs db55e85cb4984e0f733b3f7b52180d429184124d26dbad1a86ee07edf7793fb0 0 +SkillParameterIsTurnFilter.cs SkillParameterIsTurnFilter.cs 763d51998f0f14ce04be1abf212a30a68b04db64e141091c97e17a2426acb707 0 +SkillParameterIsUnlimitedFilter.cs SkillParameterIsUnlimitedFilter.cs 7abe4ed828679f6f38c27fa24e6564b0db34c2efc0dbde4fce31e88e51520c70 0 +SkillParameterLastLifeFilter.cs SkillParameterLastLifeFilter.cs 7b3fab233313b98797bee3fcb22d00393b726723e42261fa6ba320e1c6d50e3c 0 +SkillParameterLifeFilter.cs SkillParameterLifeFilter.cs 567ed093343f855e927fed4a9b6b42df8104a26075c37d9bb6d24a84ce4adcb4 0 +SkillParameterLoadTargetCardId.cs SkillParameterLoadTargetCardId.cs 35bf812b7825445023702d85f3a8cbf825acce44e83db348651dea6b5823e9b8 0 +SkillParameterMaxAttackCountFilter.cs SkillParameterMaxAttackCountFilter.cs 22c8e30c4048e63e9d1f14a6bfa2d761b6749cfe02780a8345fd227db0907b7b 0 +SkillParameterMaxLifeFilter.cs SkillParameterMaxLifeFilter.cs c206c13030fb6407e266564502831239fa9d8ed36348479cb8c30ebc8a192f78 0 +SkillParameterOffenseFilter.cs SkillParameterOffenseFilter.cs d69ef663e0ab4f75da11807f80f2128710ba558e547d45d52cd2302c3ef6fbf4 0 +SkillParameterPreviousTurnAttackedFilter.cs SkillParameterPreviousTurnAttackedFilter.cs 01f026c68474b45723c39132e6d34bab907ce38200c6d97836a537dd966f1d43 0 +SkillParameterRandomArrayFilter.cs SkillParameterRandomArrayFilter.cs 6c2e7b885b754f4dd4ef837916d059fd64421c61d3729ffab05c0afbe06f57e8 0 +SkillParameterRarityFilter.cs SkillParameterRarityFilter.cs 5c74bafe6763a2427fe11e182af0a1e5b7b26a29c5c8cc39a6ba765cafe6ac1b 0 +SkillParameterReturnedByFilter.cs SkillParameterReturnedByFilter.cs e842514149549ea27b7ccb525f8cb19072eb947839c2fdd61147a90f7504611a 0 +SkillParameterSelectAttackCountFilter.cs SkillParameterSelectAttackCountFilter.cs 5228529021abac7a5097bd9765a1335124f2d1d849b8f582bbf16215453ebad0 0 +SkillParameterSelectBaseCardIdFilter.cs SkillParameterSelectBaseCardIdFilter.cs 7eb550c57f3c56c52ae61c6c2f21d25a05e3c397fc9035b971c3d5db334a5b23 0 +SkillParameterSelectBaseCostFilter.cs SkillParameterSelectBaseCostFilter.cs 805f7e9164498429efdab18efe53515a34838347783fc262c22f036dfe5f664b 0 +SkillParameterSelectBaseLifeFilter.cs SkillParameterSelectBaseLifeFilter.cs 30362fb2fbb93822d40f44a45e48370c0d44d0f2ba5aaf4557a829f1e0358e08 0 +SkillParameterSelectBaseOffenseFilter.cs SkillParameterSelectBaseOffenseFilter.cs 2cb5d3f70b3e1c1744f62650210fe6bf1b3ab0cc0b61eb4fb833945aa9f1164e 0 +SkillParameterSelectBuffCountFilter.cs SkillParameterSelectBuffCountFilter.cs c5659ef882b1c01d2c2d7372919f053c9de8a2a24d1e22b4103af84f87b1551e 0 +SkillParameterSelectChangeMaxLifeCountFilter.cs SkillParameterSelectChangeMaxLifeCountFilter.cs c952c16d719e017d23b5797b9e3d05a60f266db09f329ce397ba5acda26c230c 0 +SkillParameterSelectChantCountFilter.cs SkillParameterSelectChantCountFilter.cs af33d4c7180219304ea96624f92b1107763cc4021817a426835fb4e1dc67f882 0 +SkillParameterSelectChargeCountFilter.cs SkillParameterSelectChargeCountFilter.cs ccc6f4b628a34afb3b713180a6c0752170302a6bbe81b46e37818e217ca88466 0 +SkillParameterSelectCostFilter.cs SkillParameterSelectCostFilter.cs 1f744da024a2ab019fe914120e906f2f2d286b02e94134dcc49be48e99ce0efb 0 +SkillParameterSelectDamageCount.cs SkillParameterSelectDamageCount.cs bdc0f7637e749d1d4145027abc09e0204d38301c783b689fdd9593b0a66103d6 0 +SkillParameterSelectEvenChargeCountFilter.cs SkillParameterSelectEvenChargeCountFilter.cs bf0557362e91a6fa122b8c5a4871cd8710528bdc4d893c846ae374d99b031f3f 0 +SkillParameterSelectFixedGenericValueFilter.cs SkillParameterSelectFixedGenericValueFilter.cs a3e34ff6813da358aa71119cf5df6552e1ec0111ed0c8aab9cdb336602e37139 0 +SkillParameterSelectFixedGenericValueInitialFilter.cs SkillParameterSelectFixedGenericValueInitialFilter.cs a8e42faf8760e178bef147c95b873718757da8d0adbc44b3ec6e31cdbe4d2981 0 +SkillParameterSelectGenericValueFilter.cs SkillParameterSelectGenericValueFilter.cs e240a54112450512eb9fb941bf2a1d09e398c2c728e3dadeb74fbf8179566625 0 +SkillParameterSelectIdFilter.cs SkillParameterSelectIdFilter.cs 7f7276e8c699f2dc209892ef0c4d11580d1ec81eafad7dcf617dba2db3922d91 0 +SkillParameterSelectLastCostFilter.cs SkillParameterSelectLastCostFilter.cs b7cecd4466804084249f4e0b69d9d6afdd2d6047e4f4848532783f1bffaccd23 0 +SkillParameterSelectLastLifeFilter.cs SkillParameterSelectLastLifeFilter.cs 630f3b49aa605f20a5f5df5e5de7ff54ff8fe100c54c268aeb8cd525873e472f 0 +SkillParameterSelectLastUsedPpCountFilter.cs SkillParameterSelectLastUsedPpCountFilter.cs 833d6d398ed876e33573f834dc14d73bfd8f07b9b0ff6b33ba824e4f6a3091a8 0 +SkillParameterSelectLifeFilter.cs SkillParameterSelectLifeFilter.cs 890eb7eba88fd109233e6b508397011d57f6f0720d107751fa87b983fb4745cd 0 +SkillParameterSelectMaxAttackCountFilter.cs SkillParameterSelectMaxAttackCountFilter.cs 7025a246fc47958208f6d20a645e0e29fb6fab037157cd643e84a844f708a357 0 +SkillParameterSelectMaxLifeFilter.cs SkillParameterSelectMaxLifeFilter.cs f557e88df340150a289b956f7780dc6e5be63f917045530cc59da61e869816c8 0 +SkillParameterSelectOddChargeCountFilter.cs SkillParameterSelectOddChargeCountFilter.cs 485310e00eb24c9dbe0c8b85abf0dc1d5d541cb0587f845779f10c2446647029 0 +SkillParameterSelectOffenseFilter.cs SkillParameterSelectOffenseFilter.cs 56c9f6201f7f78af7bbfe53328a3b57443106f718f240ec8062e948e6e8fd154 0 +SkillParameterSelectRandomGenericValueFilter.cs SkillParameterSelectRandomGenericValueFilter.cs 79379b0f29db45e43ef535384c327e2fd708556bfa215842bcfd5e86a4568bca 0 +SkillParameterSelectRemainActionCountFilter.cs SkillParameterSelectRemainActionCountFilter.cs 12bace95f350b92835a76be223cae0ec7ecc1483d86f810169876df774edc4c7 0 +SkillParameterSelectRemainActionCountFromSelfFilter.cs SkillParameterSelectRemainActionCountFromSelfFilter.cs 471a3f88007614eb5f59bda83a2dcceb4eb95efd17cf7f457b705d5ac6fdd90f 0 +SkillParameterSelectSkyboundArtCountFilter.cs SkillParameterSelectSkyboundArtCountFilter.cs 6231bae23b784d33424280b1014adbda30edd21839c1c43ac55e37d343af79b2 0 +SkillParameterSelectSuperSkyboundArtCountFilter.cs SkillParameterSelectSuperSkyboundArtCountFilter.cs bcf7da624aefbe5e167993a9ae484e4aa44555977d2c759e78fea8e9869f01a6 0 +SkillParameterSelectUnionBurstCountFilter.cs SkillParameterSelectUnionBurstCountFilter.cs 04db936a13814a1f06dfede18001a71c9f28b4ac18a3f195a1af0bce211303c3 0 +SkillParameterSelectWhiteRitualCountFilter.cs SkillParameterSelectWhiteRitualCountFilter.cs 327bafdd153e370a13c38464a3784b57d225e9ddf07fd02aa5888926b15616cd 0 +SkillParameterSkillActivatedCountFilter.cs SkillParameterSkillActivatedCountFilter.cs 090509336d0a8c02034277a0c2a4ec6e207b834cb467d5313999a1e89895a868 0 +SkillParameterSkillHealValueFilter.cs SkillParameterSkillHealValueFilter.cs 1d8a4c771cca276106bae074ff9baad77cbf1933caf176ca82b7ae1fb36e08d2 0 +SkillParameterSkillIdActivatedCountFilter.cs SkillParameterSkillIdActivatedCountFilter.cs 60f879dea4a53ced3d2437a256a244dae720aedde45376d9cc4279b2b237b6a4 0 +SkillParameterStrictDestroyFilter.cs SkillParameterStrictDestroyFilter.cs 8261403d48421c3d0c8c3f6ec71ab0c8f7a5643ee2abe60715c4bf63113812b1 0 +SkillParameterThisTurnSkillActivatedCountFilter.cs SkillParameterThisTurnSkillActivatedCountFilter.cs d5a8c7c1380aaec8da4f33674f92082140047e829a4c14c398eda8d4d746367f 0 +SkillParameterTurnAcceleratedCardCountFilter.cs SkillParameterTurnAcceleratedCardCountFilter.cs f9a71daadb1bc53993b2a181be74e8767b27eacbf503ab0456970ec25a23f405 0 +SkillParameterTurnAcceleratedCardCountTextFilter.cs SkillParameterTurnAcceleratedCardCountTextFilter.cs 65fda0c7bfe401a47db945b4370c0faf89d9bd536d748c4e4972c9b73467840e 0 +SkillParameterTurnAmountValueFilter.cs SkillParameterTurnAmountValueFilter.cs 5acc85d742e7de3e9d7465252ba4cfbbb8a93ceb9fd91ae24411c5e8eddde918 0 +SkillParameterTurnBuffCountFilter.cs SkillParameterTurnBuffCountFilter.cs e5230e6b7d4df34af984aab7f8554cc1f01eaf89f604c8f5a8513b0881e2a027 0 +SkillParameterTurnCausedDamageFromUnitFilter.cs SkillParameterTurnCausedDamageFromUnitFilter.cs 39cfd0dd59e9a68b219b33716705fd198c7c6f3d4d7a29ff05d9aea85160b6fb 0 +SkillParameterTurnDamageCountFilter.cs SkillParameterTurnDamageCountFilter.cs 6b89fb05212fd5f27c8f5b20b2714932217a283a4affc7499a6d257f75cd3101 0 +SkillParameterTurnDamageCountTextFilter.cs SkillParameterTurnDamageCountTextFilter.cs 96e44f9b0424457884086749e380e394c17888e5b33f3f8ab21f7b6f7ce5d8bd 0 +SkillParameterTurnDamageValueFilter.cs SkillParameterTurnDamageValueFilter.cs 59e01e9f32a84de862a750b1a6ef128c36b7e8dd1880ef98b7ae768b578fe85f 0 +SkillParameterTurnFusionCountFilter.cs SkillParameterTurnFusionCountFilter.cs ecbd1868fb2c7fd20d73ab0390b82471807ecc60c1df0f6129ebd54e52890786 0 +SkillParameterTurnFusionCountTextFilter.cs SkillParameterTurnFusionCountTextFilter.cs ae0db5a5af834c8c4fe0b457f0f5174f9c8f040e1cbf7b38170bf276e15d05c8 0 +SkillParameterTurnHealCountFilter.cs SkillParameterTurnHealCountFilter.cs aa0ecbfa926288c0ee61d71c5f4130d0cf38d8f22a9fff9379c569f19ad233bc 0 +SkillParameterTurnHealCountTextFilter.cs SkillParameterTurnHealCountTextFilter.cs d1f505323c4aad873f23e1c57b2fc948fd128a81d268d74cba0396cb247c9b2b 0 +SkillParameterTurnHealValueFilter.cs SkillParameterTurnHealValueFilter.cs 1dd20697fdf4ea206a88c025b47a637e4aa3c48df999ce26e7096cd410bbda27 0 +SkillParameterTurnPlayOtherCountFilter.cs SkillParameterTurnPlayOtherCountFilter.cs fb90e3cd2ebd9ed034915630e9c7c8be1ee8d32939bcd18703a1291bf1b98371 0 +SkillParameterTurnPpAddCountFilter.cs SkillParameterTurnPpAddCountFilter.cs fcaa5e807afcc9f724dbbde6790611bfac9e8877bd2b08e7b0520182aeac035f 0 +SkillParameterTurnStartLife.cs SkillParameterTurnStartLife.cs 3f598db0b19b38f7d2dcae99a1deb38983c5bf8a844b2d1b74ca41e506d5d7cc 0 +SkillParameterTurnSummonCountFilter.cs SkillParameterTurnSummonCountFilter.cs 3e928e3cbf3bce470076a74d600e4a3f9628369c1109e3ef83288cd18a22a006 0 +SkillPlayCardTypeFilter.cs SkillPlayCardTypeFilter.cs 73d2913ff240f116a43c5f13245086ef74efc3008e9d20e22ba8a984fe76faff 0 +SkillPlayMomentSpellChargeFilter.cs SkillPlayMomentSpellChargeFilter.cs 5cb6a8f5c8b954a6c2a1874e27e36a4c81e92aadef5b8b85156c90a0495309d0 0 +SkillPlayMomentTribeFilter.cs SkillPlayMomentTribeFilter.cs fddaa3bdf4c32168ce0e5145d73b1b0b8a4f4c5dff02644c6b81622d82f4f800 0 +SkillPreprocessAnyCondition.cs SkillPreprocessAnyCondition.cs a33a1835e184e5e17ff808f13b444727315fd0cf99af24179019002727be00c6 0 SkillPreprocessBase.cs SkillPreprocessBase.cs a91852ca6857a209f0784f092cf3ae86f1daf55f9f70b4fab6e89712811f4497 0 +SkillPreprocessBurialRite.cs SkillPreprocessBurialRite.cs d838b3a33c23102caadeccbb5086cc47d209d5a02d5f19df30af55d187f4b88f 0 +SkillPreprocessConditionCheck.cs SkillPreprocessConditionCheck.cs 6c61323767a0ee32e9afb0a48fffbb5dfbcfa18a8f81dba1665a45d275ea057d 0 +SkillPreprocessDamageAfterStop.cs SkillPreprocessDamageAfterStop.cs a9bae89db4941fc502010fe38d10e0970bbe3a716e48b989a3f709e9153a4475 0 +SkillPreprocessDamageGiveStop.cs SkillPreprocessDamageGiveStop.cs 6ea9900aef6d855d0dce474b90397dc14ed9ad7182c16b54c9baa753ada94d42 0 +SkillPreprocessDestroyTribe.cs SkillPreprocessDestroyTribe.cs 3ddcc280da34f14a95a095d6ebe470c8694d5423b66c700f4f9094d2502f2195 0 +SkillPreprocessDontActivate.cs SkillPreprocessDontActivate.cs ee031394e82630cda07cfed34a6498f542ae98abc3a1ea5ac565172b06b732ea 0 +SkillPreprocessDontSelectStart.cs SkillPreprocessDontSelectStart.cs 989d305bf8319f50642f3eec59e8687185cc3597d618613e62b5a39e4839135e 0 +SkillPreprocessEvolutionEndStop.cs SkillPreprocessEvolutionEndStop.cs 7234230b7eab0ecf51fa4e5ba4a460f751437dbb9232dcf4aae58fbd458e3bd4 0 +SkillPreprocessFixedGenericValue.cs SkillPreprocessFixedGenericValue.cs fce8887a83c599bc665b1c69a233f2fcdf53045917350e19e83d12d85dc795d5 0 +SkillPreprocessInPlayPeriodOfTime.cs SkillPreprocessInPlayPeriodOfTime.cs 2d190cbc723ca9b56cf295d976c7fded0c1a6a8c7eec1a28efdd30be61b3db8d 0 +SkillPreprocessIsActivateSummonCard.cs SkillPreprocessIsActivateSummonCard.cs d4da3540f656dfd45c2825a2446986961681fcde0b113285ddba90a3c2d69e51 0 +SkillPreprocessNecromance.cs SkillPreprocessNecromance.cs d11bcf498871f57f9eda0e2efb9882e9cd4da0ea96ca47e6433e67ea6f391c6d 0 +SkillPreprocessOncePerAction.cs SkillPreprocessOncePerAction.cs 24ae2a450500a11c2cb6bfee853e53afde5a78f664f2efcc1892646198678ad9 0 +SkillPreprocessOpenCard.cs SkillPreprocessOpenCard.cs 022d259b515a1a152b78de0c0fb2af73f01962b61d808926c0c62674ebd98630 0 +SkillPreprocessPeriodBase.cs SkillPreprocessPeriodBase.cs c67f2c92519ed300af22f404619dd025bd6aa204be373980934472d24df2d2fb 0 +SkillPreprocessRandomArrayIndex.cs SkillPreprocessRandomArrayIndex.cs b416cdfa41f083f0edcfe9e42d9eef3c790849aa2e9b3f5310d6cd5ac24f0223 0 +SkillPreprocessRandomCount.cs SkillPreprocessRandomCount.cs 41a16ebb68e7632cd78d3508f5216364632ca28fac6287b33c7abd19a81388ab 0 +SkillPreprocessReferencePrevious.cs SkillPreprocessReferencePrevious.cs d9f48bf59161d3967cbc6f1a46259cefb7cb57edfd91e9cf613c034c36494759 0 +SkillPreprocessReflectionAfterStop.cs SkillPreprocessReflectionAfterStop.cs 706c9d6e1e978efbaf996b422b14bbc914b3bca5b0aa161cb691b049ce4becb6 0 +SkillPreprocessRemoveAfterAction.cs SkillPreprocessRemoveAfterAction.cs 25c1743ccbcbe0c8a54836fcc44a4f4f16ab81b5ab3a0be0df9d7ba1a3561eee 0 +SkillPreprocessRemoveFromInPlayStop.cs SkillPreprocessRemoveFromInPlayStop.cs 7e1ae543a5ddf21802621cc3c5799f1c6cc118b93511db995ebeb4efc9fa179f 0 +SkillPreprocessSelfTurnEndRemove.cs SkillPreprocessSelfTurnEndRemove.cs d0d7efe3c53bf761514e5d6858953a644ef13e3a019f8bc7517aadec65ff60fe 0 +SkillPreprocessSkillActivateCountBySimultaneousBuffingCards.cs SkillPreprocessSkillActivateCountBySimultaneousBuffingCards.cs 3bafeda4792e30e082e4c3cb9d6fbfe5c630a3ba159e5190c1fb89368cbc5f2d 0 +SkillPreprocessSkillActivateCountBySimultaneousDestroyedCardList.cs SkillPreprocessSkillActivateCountBySimultaneousDestroyedCardList.cs 98980519b1e76db111c132424675a4cf74c24d08a3ae983d76c94ec9a3374f37 0 +SkillPreprocessSkillActivateCountBySimultaneousSummonedCard.cs SkillPreprocessSkillActivateCountBySimultaneousSummonedCard.cs 0a2ca7fd55cab7ea59fe3cd50e4f892ad82d8c2e7f4f32df0df516e9a3f74c75 0 +SkillPreprocessSkillAfterStopBase.cs SkillPreprocessSkillAfterStopBase.cs 4fc54de11d70774a8357304be4dd2864265727ffb182fe0a40c026fa0fea1016 0 +SkillPreprocessSkillId.cs SkillPreprocessSkillId.cs 062afa2d37f0821e95de45cac14bd5a91f0e40fbfda859f0e5d93c6aa8c88601 0 +SkillPreprocessSkillStopAndRemoveByWhenSummonOther.cs SkillPreprocessSkillStopAndRemoveByWhenSummonOther.cs f5347984f944cd12528c29ff8c0b25ddcfe4ae6d132770a2f8e11ee345a1c986 0 +SkillPreprocessTimesPerBase.cs SkillPreprocessTimesPerBase.cs da7bbf6c0dd996e23c71d246736494b8b6557b3907bf1887c2f76307f439dd5f 0 +SkillPreprocessTimesPerGame.cs SkillPreprocessTimesPerGame.cs 86495eab0914f6d87c3bbdedfc3d8b2b9a88e4480bda79d66b7ac33c5a8030b9 0 +SkillPreprocessTimesPerTurn.cs SkillPreprocessTimesPerTurn.cs 8295b5dd1d2146653e7d5cf456409fb0d7a3127eaa35b9497a99847f8077a746 0 +SkillPreprocessTurnEndPeriodOfStopTime.cs SkillPreprocessTurnEndPeriodOfStopTime.cs 60f3c9e94ba5b23980a9a98c11ca6b091e11c7b0e259a49adeee3f02f6fa0b17 0 +SkillPreprocessTurnEndRemove.cs SkillPreprocessTurnEndRemove.cs bdee75ed1688cdac7d99d2a46bc098d9f121e529d05eba001a2020084702a15f 0 +SkillPreprocessTurnEndSkillAfterStop.cs SkillPreprocessTurnEndSkillAfterStop.cs 2bc5a968092d60bf8c1bb2fa3d233c891d1bbf43dc3871f6a37699a06c902900 0 +SkillPreprocessTurnEndStop.cs SkillPreprocessTurnEndStop.cs 3c95fc7040be4060ea7f5b28b61e0a65bf82e04b9db9385c0d8fc85661cfe7ca 0 +SkillPreprocessTurnEndStopAndRemove.cs SkillPreprocessTurnEndStopAndRemove.cs 58afb39a582f6d2d9ca7fb879fec61700be7d1876ec9bab3d2f9a7754cfeafdb 0 +SkillPreprocessTurnStartSkill.cs SkillPreprocessTurnStartSkill.cs bce5bbf795a6788229eb5e5649c539f075b8acbe1abd802d92c43795182d9b01 0 +SkillPreprocessTurnStartSkillAfterPeriodOfStopTime.cs SkillPreprocessTurnStartSkillAfterPeriodOfStopTime.cs 1e7f05693608cb0a8755c6ce272decd8cd1e21d0c3b5c7c33e707b1068c36758 0 +SkillPreprocessTurnStartSkillAfterStop.cs SkillPreprocessTurnStartSkillAfterStop.cs 850697230ffd1ac484f091b69c23a72a5e2dee092576a40b60125b27dfedc2ff 0 +SkillPreprocessTurnStartStop.cs SkillPreprocessTurnStartStop.cs 92aa94717765f57b359e79ec445a0c39582427a873241c3acda197aa61da6c11 0 +SkillPreprocessUnitAttackStop.cs SkillPreprocessUnitAttackStop.cs 8d4cf572943e67861ea9b031e149c0712738bdb3ae49a102412ac6da5dfac73b 0 +SkillPreprocessUseEvolutionPoint.cs SkillPreprocessUseEvolutionPoint.cs 3b8717cbb4d193ed60d7c052710277c40a5f0947b178146ba3bc51548a5ad3ab 0 +SkillPreprocessUsePp.cs SkillPreprocessUsePp.cs d60a388ce354d83c87c63036db1dcee5a6adcf73c6d7280910a72ba2f8716466 0 +SkillPreprocessWhenEvolveEndRemove.cs SkillPreprocessWhenEvolveEndRemove.cs fa86b21ca304bec0590cb2f23e1b0c7ef9ab4217edb3789fca6cb89d36475ee5 0 +SkillPreprocessWrappingAndAddingSkillActivatedCount.cs SkillPreprocessWrappingAndAddingSkillActivatedCount.cs 3e8a1e39d96730366029c0d838e69c75e1d6803206ade94b80edccd4a6881058 0 SkillProcessor.cs SkillProcessor.cs 902564f33d55b95dbe4774ffade51622403936e89d3cf1dffd5febe637ef8de1 0 +SkillRandomEachSameBaseCardIdFilter.cs SkillRandomEachSameBaseCardIdFilter.cs 78e17a97c5306f72cf9f1cf3082a166fd9bdc0237ada718d704dd296c3d61aed 0 +SkillRandomSelectFilter.cs SkillRandomSelectFilter.cs d7ff89f4d0af7b7b5fcded27b234568469ae790bbb18d562eab97e9110cfd671 0 +SkillRandomSelectUntilFilter.cs SkillRandomSelectUntilFilter.cs e64462b034662bfe2f27a7f618b13e88bb07e67aaeb8de8833c8ba65910bba75 0 +SkillResidentPreprocessReturnHandActiveReset.cs SkillResidentPreprocessReturnHandActiveReset.cs 8c209867c7e862e35e8d5bc8030c177cd9319ef8dc9aa37c773d8ebe878b2cc9 0 +SkillSelectAllFilter.cs SkillSelectAllFilter.cs 80fecf2fe8e3ca5eb5f2dffe7a7622e3530205b8e233e0acede47c70ed7619cd 0 +SkillSelectIndexFilter.cs SkillSelectIndexFilter.cs f4f8f93f2061956ff3f868b40c877529a17bd89bb2249c4ecbfb25b69ae9390a 0 +SkillSelectNullFilter.cs SkillSelectNullFilter.cs 4bfa6ae6724cb4a6593b0071794512ac6cd32baf8319dec6ba532b640162b2cc 0 +SkillSelectableCardFilter.cs SkillSelectableCardFilter.cs 7190e02013e260667b80bf6f57f19dcd530a38e3e3dd4dca63ed19223a801b9e 0 +SkillSpellAndFieldFilter.cs SkillSpellAndFieldFilter.cs ce2d69d56a413323f2c76fdf00d8e385da05a8b116908d173e1c0aab1be6b599 0 +SkillSpellFilter.cs SkillSpellFilter.cs cddca871f85eca2ec0e3a0756f03b347d0f14c145cfb5faffdde577e64078dd8 0 +SkillSummonMomentTribeFilter.cs SkillSummonMomentTribeFilter.cs 696f48f4e1adc7fbaf7fc95261d14540f6132403bbd89824e8446607e6458b77 0 +SkillTargetAcceleratedCardfilter.cs SkillTargetAcceleratedCardfilter.cs 76cdc15b00665276544a3555dda14f42e6cb6dc287ed3bcfade823c090765d78 0 +SkillTargetAttackerFilter.cs SkillTargetAttackerFilter.cs 7f4299dbe4e8232e1a48a35c5bcba77d475519bcf9b664fccc539b69bc1e6356 0 +SkillTargetBanishedCardFilter.cs SkillTargetBanishedCardFilter.cs ccafb933ab0efe326d18e10484818cdba1fef59946e5acadba7c15aea6865c87 0 +SkillTargetBanishedLastTargetFilter.cs SkillTargetBanishedLastTargetFilter.cs f85153525969b973498db95232d2a975e4fca23b4dc38b7f15eea6401414c411 0 +SkillTargetBattleStartDeckFilter.cs SkillTargetBattleStartDeckFilter.cs bccd1bdbe921129c355f9a19ffc4586e39d6f28e0a510baac87b073445184e22 0 +SkillTargetBeAttackedFilter.cs SkillTargetBeAttackedFilter.cs 59d2f981518f9fc82d866af015589a5cec8d098758a10a7ac5ba29113517f60d 0 +SkillTargetBeforeTransformCardFilter.cs SkillTargetBeforeTransformCardFilter.cs 42d8f9f14675340edc5241d77f2562824235b9b5988893d17550721e07cd1239 0 +SkillTargetBurialRiteCardFilter.cs SkillTargetBurialRiteCardFilter.cs 78224af2f8903e050cb776c0258d1448fa322c91bd61fba4f76645f8049b2f0b 0 +SkillTargetBurialRiteCardListFilter.cs SkillTargetBurialRiteCardListFilter.cs 978ad18a4672a82b6c73c4798c3cefbc866c90bdf7612002dfa821d59e2c567c 0 +SkillTargetBurialRiteThisTurnCardListFilter.cs SkillTargetBurialRiteThisTurnCardListFilter.cs 6b2fc5837cd065c53a5e72c12b22a4ebd06d3e1ce88b492ff4fe60284508838e 0 +SkillTargetCantAttackAllLastTargetFilter.cs SkillTargetCantAttackAllLastTargetFilter.cs 59cf1760a5ef2d2ab6049066a8213ef583aaf464b1f8ed7e7f8de3a7937a8ec7 0 +SkillTargetCantAttackAllReturnCardFilter.cs SkillTargetCantAttackAllReturnCardFilter.cs c6e60dc06367eb7083a5b861d33f74cf275cb4e87adeff993eb701ff2c0d0280 0 +SkillTargetCemeteryFilter.cs SkillTargetCemeteryFilter.cs b7363ca6ad4b371ec058fa55c9b7b8b61065eafcb9d28f5174e87fcc1ed4419d 0 +SkillTargetChantCountChangeCardsFilter.cs SkillTargetChantCountChangeCardsFilter.cs b6122d6c38064ad4014f01bb2bf652d1fa3d291de320ec19889faebb62a0d8e1 0 +SkillTargetChosenCardsFilter.cs SkillTargetChosenCardsFilter.cs c1ce3e83cd86f6ef3f8e94b71e837b6b1dbf2c89036d4397e4267cd2652191dc 0 +SkillTargetCrystallizedCardfilter.cs SkillTargetCrystallizedCardfilter.cs 12eeb8bbc98e36848358c4ae3da2ebb35b05b9290532f625aedd05479b285baa 0 +SkillTargetDamagedCardFilter.cs SkillTargetDamagedCardFilter.cs 473ecf0c5aa1691f0b970dae447e922ecc37ec1855ef9a2602d0623e3bb7e5c0 0 +SkillTargetDeckBanishedCardListFilter.cs SkillTargetDeckBanishedCardListFilter.cs 24aa9c24ce7c345a59c0da03ff961f13d49f2e6f0004b3fd47772f699fb0a7db 0 +SkillTargetDeckDrawCardFilter.cs SkillTargetDeckDrawCardFilter.cs 784fca3bde3b2b95bb8f21b88c60aa43929fb1bc94b3a585b2ded1d390374d43 0 +SkillTargetDeckFilter.cs SkillTargetDeckFilter.cs 9aa5c5ed118dc4d8071edae5643cbb9f07a8eb813982705b2c0fc356fbba228a 0 +SkillTargetDeckSelfFilter.cs SkillTargetDeckSelfFilter.cs 32004d3d9cf16379ee5ae88562ea7d6ff290d73a0678f5a01b2c48854f8a2cd4 0 +SkillTargetDestroyedCardFilter.cs SkillTargetDestroyedCardFilter.cs e208e52c74daf93e1b6d6a20d2bd1c406acaba0af9fd55b82542297371ca1b6c 0 +SkillTargetDestroyedCardListFilter.cs SkillTargetDestroyedCardListFilter.cs 54558c83262511758b19cbe08094064c920bfb01abb04ae63692038b634fae65 0 +SkillTargetDestroyedLastTargetFilter.cs SkillTargetDestroyedLastTargetFilter.cs 0135abeeecce983f28fb9d530596d493b880d4a5037909a910118c503fb483cd 0 +SkillTargetDestroyedThisTurnCardListFilter.cs SkillTargetDestroyedThisTurnCardListFilter.cs 2fc676957a10af37bfd631debb1ece6159ffcee2f46d5554e7aab4214a67c9e8 0 +SkillTargetDestroyedWhenDestroyCardListFilter.cs SkillTargetDestroyedWhenDestroyCardListFilter.cs dcf005e427827ae79c202aad1e4ae9588305b0bc3079c7fee63519269fedf7e5 0 +SkillTargetDiscardCardListFilter.cs SkillTargetDiscardCardListFilter.cs 3a92cdceac0ddb6de87352f9788c9172f881b1ce814af29b438a26c207c5286e 0 +SkillTargetDiscardFilter.cs SkillTargetDiscardFilter.cs e873324f9fff2facc2c81da18a61b57a46ebb777831d9869956779666eaa4fc3 0 +SkillTargetDiscardThisTurnCardListFilter.cs SkillTargetDiscardThisTurnCardListFilter.cs fd25af698e8c86ed2cca2384c220a0c1ae8705e5a8172b5728ddbf6e134f0508 0 +SkillTargetDiscardedCardFilter.cs SkillTargetDiscardedCardFilter.cs c1f08e41ee959fc1d0d0012d29f3bb138f14754e8b4d3359513de81c367c5f87 0 +SkillTargetDrewOverHandLimitFilter.cs SkillTargetDrewOverHandLimitFilter.cs 92e6c2b5f7cd8e197c5d7c9f83f1b07404617398f8cfe0225fe800ee3ee162fb 0 +SkillTargetDrewSkillFilter.cs SkillTargetDrewSkillFilter.cs f93d59e543ba97e77f0d9c08f1cad38708627acd193135a72cc0b361d52d68a7 0 +SkillTargetEnhanceCardfilter.cs SkillTargetEnhanceCardfilter.cs 4ee1bda330ac852678d7e4cfb96e88ebe4a9a2eea63d38a56fb1607d24771d13 0 +SkillTargetEqualOrLessCostFromLastTarget.cs SkillTargetEqualOrLessCostFromLastTarget.cs 68507fdde0e55e6eedb430071b3b7fbf6cb5d7f7cfc394c73e455c099fc63746 0 +SkillTargetEvolutionCardFilter.cs SkillTargetEvolutionCardFilter.cs 0362696fb1dc788d02517a7086ffdc4019f08703dcf3cc77610d06454c6e77fb 0 +SkillTargetEvolvedCardListFilter.cs SkillTargetEvolvedCardListFilter.cs b15c1303bd63cf992a32991bcb2667d08e8db5527e52f20df0e8954a2ed17b4a 0 +SkillTargetFightTargetFilter.cs SkillTargetFightTargetFilter.cs 9d40905ce3582f24c7edadc6cf96c03791d6a1abc7ba4b933aa24dc9e0ee3a6a 0 +SkillTargetFusionIngredientCardsFilter.cs SkillTargetFusionIngredientCardsFilter.cs c3131b03dab016f0a0e2406951bc22ae7dfe9dee0f0b2f36a2073f2d82c4784a 0 +SkillTargetFusionIngredientedCardListIncludeThisFusion.cs SkillTargetFusionIngredientedCardListIncludeThisFusion.cs e7768bd31e3389235916940ad575f0063929a364186126539ac8fa660ae7c447 0 +SkillTargetFusionIngredientedThisTurnCardList.cs SkillTargetFusionIngredientedThisTurnCardList.cs ec6aad9a4eb1ea2589e01e965b5bd8d4290252f49b548c747398680ff529691b 0 +SkillTargetFusionThisTurnCardList.cs SkillTargetFusionThisTurnCardList.cs 42adf7ccd869c86d3b4dc3f09c1f707baa793c36a5e2c09fe978e82987137067 0 +SkillTargetGameAcceleratedCardsFilter.cs SkillTargetGameAcceleratedCardsFilter.cs 23d2bbcb35bae2dc94fb597f6fa17a7329b83744c644ef246b20a635b6eff3f8 0 +SkillTargetGameAcceleratedCardsOtherSelfFilter.cs SkillTargetGameAcceleratedCardsOtherSelfFilter.cs eeb28730c3db5e3636fb81665d16e3eb2616b9b67f2e8f63d598b49ec95fe31a 0 +SkillTargetGameAddUpdateDeckCardsFilter.cs SkillTargetGameAddUpdateDeckCardsFilter.cs a4cc93baf0964019292c63fd955f53edadc77f9eb0d2104bd30202e942a0b5f9 0 +SkillTargetGameCrystallizedCardsFilter.cs SkillTargetGameCrystallizedCardsFilter.cs 20a3440a1863a77890c24c316768493ce628d807b7d34589aa9f06b20bdb2e40 0 +SkillTargetGameDeckDrawCardsFilter.cs SkillTargetGameDeckDrawCardsFilter.cs f8d50666a8859c8f167b2808f968d2be2bf8a54f71c347c0dff7f87140ff51cb 0 +SkillTargetGameDrawCardsFilter.cs SkillTargetGameDrawCardsFilter.cs 1ffdf32799da30cf12c0b385bbb7029cc6a9753a091390b52b57a122faffd464 0 +SkillTargetGameFusionIngredientedAndDiscardCards.cs SkillTargetGameFusionIngredientedAndDiscardCards.cs 144383ffd09897e853d46faac9f1f9afaa980ca1abe71314ce270610587f2b73 0 +SkillTargetGameFusionIngredientedCards.cs SkillTargetGameFusionIngredientedCards.cs 3cf5025255f0668a42afef82852da9821ac00449a3777bbd9714027f4098fd76 0 +SkillTargetGameLeftCardsFilter.cs SkillTargetGameLeftCardsFilter.cs 04ef8cedc5858e40443a9dbcf4cf71378082e724dbc8b1f8f1a9e2fe07a475be 0 +SkillTargetGamePlayCardsFilter.cs SkillTargetGamePlayCardsFilter.cs 29fff9a500552d9b4921c42de6d436e99e8d62afc32619b00348b28809b8dc12 0 +SkillTargetGamePlayCardsOtherSelfFilter.cs SkillTargetGamePlayCardsOtherSelfFilter.cs d15c6d3a5f9764616cc8e84b5a154007af5c9a95841c685175af2aa66f4c4cc1 0 +SkillTargetGameQuickAttackCardsFilter.cs SkillTargetGameQuickAttackCardsFilter.cs c09700dfcee9e154c89d0fcdc978650618463f21e93c3c0598bda5860289b974 0 +SkillTargetGameSkillActivatedFilter.cs SkillTargetGameSkillActivatedFilter.cs 686feaf45a98a5c819cba1aa2c76d86551d2daaa4f87b8902a5a7b087bfcca62 0 +SkillTargetGameSummonCardsFilter.cs SkillTargetGameSummonCardsFilter.cs 40fdea19cc7bb0304994f584c85ec76c1fbf06b21596d60901ac39bbe6836ee3 0 +SkillTargetGameSummonCardsOtherFilter.cs SkillTargetGameSummonCardsOtherFilter.cs 5cca7f820b8f2c2bba7a5c6162ccd4862c5960b537772f0e789fc1ea13b22668 0 +SkillTargetGiveDamageCardFilter.cs SkillTargetGiveDamageCardFilter.cs acf92af14adf205b06ece2f8779ac4961b61d96602bedb352eb906d8f4971fe5 0 +SkillTargetHandBanishedCardFilter.cs SkillTargetHandBanishedCardFilter.cs 39d18c23cfb9514d1bd668ecb2505d91af0b344128550d11a5af29d4717a7d12 0 +SkillTargetHandBanishedCardListFilter.cs SkillTargetHandBanishedCardListFilter.cs 58a9484affddccc52b765f9242c1d219318d43a291f552db8bc0082a30490a11 0 +SkillTargetHandBanishedThisTurnCardListFilter.cs SkillTargetHandBanishedThisTurnCardListFilter.cs b4832d5d8369871e2436bb300c9515af4f001bbaf4c0398490fd97371585fd0e 0 +SkillTargetHandFilter.cs SkillTargetHandFilter.cs 8ea8afa3c3c807bb4917723540d4d487c1fb13d93c4870c8b82b960362691d83 0 +SkillTargetHandOtherOldestFilter.cs SkillTargetHandOtherOldestFilter.cs a5cc797f744572ad95219c367fa74b2168843cf830e88c25902ae1a329b6242d 0 +SkillTargetHandOtherSelfFilter.cs SkillTargetHandOtherSelfFilter.cs e6d3ddd82ab515569ab9170769eb2f3fc3f5ea8a2e50c7fb8d6793273e087929 0 +SkillTargetHandSelfFilter.cs SkillTargetHandSelfFilter.cs 22cade9748f6d046eac6b933ee22d58b62c7d5ecbb6b8d0b70324379f81a7c8a 0 +SkillTargetHealingCardFilter.cs SkillTargetHealingCardFilter.cs 7b71765a65c4ae2070752f0e538a781eeec440702d57a7471681bdc662f0d5af 0 +SkillTargetInHandCardFilter.cs SkillTargetInHandCardFilter.cs 90f715bbe76f9f4c5156f135e4dd7b4054578d17e35fdd239c68316a2397b284 0 +SkillTargetInPlayFilter.cs SkillTargetInPlayFilter.cs 9b5217adb53ad3ca0bf31ee40ac1c1309cb16cff9f20e6f4b1b280a7f5d4693e 0 +SkillTargetInPlayOtherSelfFilter.cs SkillTargetInPlayOtherSelfFilter.cs 2d700d8e36402098ec0f0c3402c8d4af0f209482f19c2c6dd388c8e462380b0a 0 +SkillTargetInPlaySelfFilter.cs SkillTargetInPlaySelfFilter.cs 126ba8e376f98fd22d9ff3208745dd8397b540aa2942fc9b01f7a605fe9e9146 0 +SkillTargetInplayAndHandFilter.cs SkillTargetInplayAndHandFilter.cs d07f316375c7a5ce55743ad3d051af2157e7b4d222c635761c365b4763128948 0 +SkillTargetInplayBanishedCardFilter.cs SkillTargetInplayBanishedCardFilter.cs 27e4f2604f91a1f1e14f8747bb9d8219a0ca0a751226094f28da9fdcca10c2ad 0 +SkillTargetInplayBanishedCardListFilter.cs SkillTargetInplayBanishedCardListFilter.cs 64f22911ec75d097906413b76515f58c5f433556dcd6d03e2c9ebbb31d6b53b6 0 +SkillTargetInplayBanishedThisTurnCardListFilter.cs SkillTargetInplayBanishedThisTurnCardListFilter.cs cf5562a8a01f8522a6282a1ddba9268a983bc2d06d3b0b68c0333d9c886af040 0 +SkillTargetInplayBuffingCardsFilter.cs SkillTargetInplayBuffingCardsFilter.cs 19fb404f0e0873b5a157f8dba49824d66e194697cc556c2211e8b249aa84f671 0 +SkillTargetInplayDebuffingCardsFilter.cs SkillTargetInplayDebuffingCardsFilter.cs dd6f0242db2054cb6e0b3b403a4f59a13691bc304582c691d67b12b13da7e0ff 0 +SkillTargetInplayLastTargetFilter.cs SkillTargetInplayLastTargetFilter.cs b3182eb0c17f025939e21560c563d4f99e58dbd9c9aa5423461e7044ccc4b1ac 0 +SkillTargetInplayMetamorphosedCardsFilter.cs SkillTargetInplayMetamorphosedCardsFilter.cs dd6455716f5971e93d13d12e203ab1cbc117c01a558c9646dddb946b45498f3e 0 +SkillTargetInplaySelfAndClassFilter.cs SkillTargetInplaySelfAndClassFilter.cs 1c5d88e217df3b86cccf3f99eb25844d63f3f7d57dc187b4ce169c12097b272d 0 +SkillTargetLastTargetFilter.cs SkillTargetLastTargetFilter.cs 3b3bca46dc7b2e6eba53aaa6dcdcf4930187c89bcbc6d636f0efea8c9fc3e708 0 +SkillTargetLeftCardsFilter.cs SkillTargetLeftCardsFilter.cs eba901b7df4d22e39f4f30cac134b02cd8c2607d206535757758b42b0b7fbea6 0 +SkillTargetLeftThisTurnCardListFilter.cs SkillTargetLeftThisTurnCardListFilter.cs 68de8b9a86d2eefadf3dff07f33f25f4e7fc9606f666607014171983a2fee753 0 +SkillTargetLoadBurialRiteTargetFilter.cs SkillTargetLoadBurialRiteTargetFilter.cs e840f87b0aab2fc9cd1e62e08e98b846f07c3cb53df9c13aa0e84cf74dc0b4de 0 +SkillTargetLoadTargetFilter.cs SkillTargetLoadTargetFilter.cs 224dec42e3dbf059d6294a083865b53fd6b0f1ff180b159e82793e9d8bc3c678 0 +SkillTargetMainPlaceFilter.cs SkillTargetMainPlaceFilter.cs e48c2d7f25bf44cb39f28e3ecf13432f2cebc34c8f9fbd26f1a8db739b98d6d5 0 +SkillTargetNecromanceFilter.cs SkillTargetNecromanceFilter.cs 8d2ed11933657b98d7f1d87ab3fdb41e0727cb2ed1d1df74c54925ffe08ac0f6 0 +SkillTargetNewerInPlayOtherSelfFilter.cs SkillTargetNewerInPlayOtherSelfFilter.cs 50ca30cdf9d309a7e1f00d5181b037cffae4b42cf3287906ef4aee2fdd666d54 0 +SkillTargetNotDamagedCardFilter.cs SkillTargetNotDamagedCardFilter.cs 665adccbb7ae390e33fcbf02bd402c4a87ca9a2009a7ea4d1525368519ffecb3 0 +SkillTargetNotUniqueBaseCardIdFilter.cs SkillTargetNotUniqueBaseCardIdFilter.cs ceb29653a81b2240592754655f7e1459f9190482bf17bf670f9a89830dea8700 0 +SkillTargetNullFilter.cs SkillTargetNullFilter.cs 5240046e6a1e9abf7ff50721c3ba8f4c7411d92efc44983cfb8a110340fd4f4f 0 +SkillTargetOtherThanBeAttackedFilter.cs SkillTargetOtherThanBeAttackedFilter.cs fcbbfc18823b39c97523318cba45c1cb79f75c7f5050015426672d3c392de7a3 0 +SkillTargetOverCostFromLastTargetFilter.cs SkillTargetOverCostFromLastTargetFilter.cs 7add88836beb613998a7d61227f3b77d58959e6b436efcd619bd47c616c43b9e 0 +SkillTargetPastSummonCardsFilter.cs SkillTargetPastSummonCardsFilter.cs c8aa3c1cb5fc81e1b671201350dcbfd360a3d893933d544e721b9cc32142583f 0 +SkillTargetPlayedCardFilter.cs SkillTargetPlayedCardFilter.cs d6c62b248a1ca5ed19456306788b7171a634fb0f00bcbcc0bb1721bc3f852cc8 0 +SkillTargetReanimatedCardFilter.cs SkillTargetReanimatedCardFilter.cs b3ce0fcc743bc8230c0d4dc9fdbb00ae87be8cf4bde71560b8ee1878148bcd4e 0 +SkillTargetReanimatedThisTurnCardListFilter.cs SkillTargetReanimatedThisTurnCardListFilter.cs 580b5b53d99993043b8b84f5e68d359d0e86eae574e1f4673fd03093cf3df100 0 +SkillTargetReceivedDamageCardFilter.cs SkillTargetReceivedDamageCardFilter.cs 83cafce544d9b1cd871bddddd46e060109437a4efac1bad96874eaadc95bd9b7 0 +SkillTargetReturnCardFilter.cs SkillTargetReturnCardFilter.cs d1698be7fae1bd7652c9aea56dbe12e0c46e966e9bb9699d8002bd1fc09ce393 0 +SkillTargetReturnSkillFilter.cs SkillTargetReturnSkillFilter.cs f10bed3f3dcd3f2aea29e38b6dfc2634f96de6c17d731ab9204f19cbf04c4f16 0 +SkillTargetReturnThisTurnCardListFilter.cs SkillTargetReturnThisTurnCardListFilter.cs 3a516e663e47822caa28c17ff22e4e4c689de7efe1043374bfbad8273da8c1b2 0 +SkillTargetSelectedCardsFilter.cs SkillTargetSelectedCardsFilter.cs 91f0d34d1faf554a266366345e1e92716d2678b97ba4d9194156e91f6d9c6f9c 0 +SkillTargetSelfFilter.cs SkillTargetSelfFilter.cs 72a70cf93ee52c8fa44f93012b584c68f9326f5a5684e010cd45bdee8659f8f3 0 +SkillTargetShortageDeckWinCards.cs SkillTargetShortageDeckWinCards.cs 4058c3d884c8da73ed3dd73ff8d3907d2ec9227cb582ce622814f58244f4df36 0 +SkillTargetSkillDrawCardListFilter.cs SkillTargetSkillDrawCardListFilter.cs b2203df83391e250f846dce5661dcf9bd952bbdcfc18d92a46bca21e2e714e30 0 +SkillTargetSkillDrewCardFilter.cs SkillTargetSkillDrewCardFilter.cs befc1e597f7c3a6e6ad9c53daf2ce40d55fab0cc5f887a8ef5a08be46a197619 0 +SkillTargetSkillSummonedCardFilter.cs SkillTargetSkillSummonedCardFilter.cs 940f7664a6718aae9fbaf74e974862b7a0fb931f874a3a69da338b9008978df6 0 +SkillTargetSkillSummonedCardIdFilter.cs SkillTargetSkillSummonedCardIdFilter.cs e31ffed95d00dd2e8e8405b4f9743bcbe634b4aae5e83091b2ef86a71cdfffbe 0 +SkillTargetSkillUpdateDeckCardFilter.cs SkillTargetSkillUpdateDeckCardFilter.cs 8a3fa33947ebeda1dd1ea69e26baf3e4e0702d4fbc8f52353f2e546e1817d48e 0 +SkillTargetSummonedCardFilter.cs SkillTargetSummonedCardFilter.cs b164f56552bc13e42c449583aeffca2cecb01602e297b27ba2351672f3e26de1 0 +SkillTargetThroughFusionIngredientedCardFilter.cs SkillTargetThroughFusionIngredientedCardFilter.cs 7d483b7eda8e557b881e2b278dec4a1d3ecd71c579c1d612c277c12668ee6a5b 0 +SkillTargetTokenDrawCardFilter.cs SkillTargetTokenDrawCardFilter.cs 8d8c396b51f240c62784e5c7848bede2c70d73940e2f9a510cc40ca1285e800c 0 +SkillTargetTurnDrawCardsFilter.cs SkillTargetTurnDrawCardsFilter.cs a76e33a06c8b514792fa415bf22d4ff98d53f4cdd61de3c007d0bd20a433054d 0 +SkillTargetTurnPlayCardsFilter.cs SkillTargetTurnPlayCardsFilter.cs 42e610e79abb7f251bc1a2e6354b4caae3bb7f6e48d0d5dc2c4684398a355add 0 +SkillTargetTurnPlayCardsOtherSelfFilter.cs SkillTargetTurnPlayCardsOtherSelfFilter.cs 6334245856f1c3c8cbfd0412d3c0568160cc84dd37e9a4ef821d3192fb1dff48 0 +SkillTargetTurnSummonCardsFilter.cs SkillTargetTurnSummonCardsFilter.cs 406cc592000267038c52f209c95180e6cceb08841be45cc187dc0d5517719d43 0 +SkillTargetTurnTokenDrawSkillIdFilter.cs SkillTargetTurnTokenDrawSkillIdFilter.cs 2973875b246f9164c90e07be0715576e60c1284eab805e0f0e0be7de06432e48 0 +SkillTargetUniqueBaseCardIDCardFilter.cs SkillTargetUniqueBaseCardIDCardFilter.cs a877dfd8e3091f98cf96c3ca809eb2477e9dbebe944a14a48060e84674dad9e6 0 +SkillTextVariableComareFilter.cs SkillTextVariableComareFilter.cs 56d63e1011bccfec3eba16f914c4ca4e8655a0e524c007c55a937ed04869ee9b 0 SkillTimingInfo.cs SkillTimingInfo.cs f3cb1e1f05af1a40dff198233cddaa9f60d90913e71a3f58909ab971f04fdb20 0 +SkillTribeFilter.cs SkillTribeFilter.cs f7549cef1e0e29be61462d060b0f66131daf8443af15712ce3b67505ce4725c6 0 +SkillTurnDestroyedFilter.cs SkillTurnDestroyedFilter.cs 4512ed0b8fd09f9735887e7b20773fa03249dce0eafff8cc0c0ba45a2c504bd2 0 +SkillUniqueBaseCardIDCardFilter.cs SkillUniqueBaseCardIDCardFilter.cs 58fff33fa42eb8db1f1bee8b9a1af50376ca3c17c5ee329e6d26b9839a235591 0 +SkillUniqueBaseCostCountFilter.cs SkillUniqueBaseCostCountFilter.cs 52171894422ff00d0d3f6e7d0ab82d7c6390bf870ba7d7b6d74e99303d94b362 0 +SkillUniqueTribeCountFilter.cs SkillUniqueTribeCountFilter.cs 79a0a134ec6e407c341a9b89f2394d55479679ef773889d94e1d06cca0c46252 0 +SkillUnitAndAllFieldFilter.cs SkillUnitAndAllFieldFilter.cs cd299b29deac95df89ff537c0485ec32bf8c34b6e0fa180460eee520e74e6e8f 0 +SkillUnitAndChantFieldFilter.cs SkillUnitAndChantFieldFilter.cs 178b57e393f6ebe0bd4e837a16e88480ea9e354e538e69be56fd03926f4c3eb9 0 +SkillUnitAndClassFilter.cs SkillUnitAndClassFilter.cs daa5c42cb5db3defa855ffe312c271be5a0855f4f6fd525dd182b274c8157cd6 0 +SkillUnitAndNotChantField.cs SkillUnitAndNotChantField.cs 60d21b529a21dbcb97631d7c2a0d2858720f7e5f0927f34907238192e989d031 0 +SkillUnitFilter.cs SkillUnitFilter.cs f00fd90b37154cb02bca44f1aabdc81ff50fd873222f3a787c4803f805f0dc06 0 +SkillUpdateDeckMomentTribeFilter.cs SkillUpdateDeckMomentTribeFilter.cs 1358f2811d051bd3bdd05b6d52ef3e03c8068c51dec47e6be31633b424263b15 0 +SkillUserSelectFilter.cs SkillUserSelectFilter.cs 32428dc620833291d1c29697a412fa3644d85306454e648d72bde42a1e524bb8 0 SkillVariableComareFilter.cs SkillVariableComareFilter.cs 6a30683c7d15d3124bb12fae13f7a9b786f22fc18e7edbf3306cdcdc13b6bbda 0 Skill_attach_skill.cs Skill_attach_skill.cs d7795060c18e8f2a66571446b56f1a0b4243d96b6bf4dc96db9f9f828c93f237 0 +Skill_attack_by_life.cs Skill_attack_by_life.cs 22e7064201123e6975a8802bac8c315ac0fc8373f183f5215159a91b32817d51 0 Skill_attack_count.cs Skill_attack_count.cs 85897dfd651df0b538f2a9a46d92f210d59718533168417b6a0b36626986617c 0 +Skill_attract_skill_target.cs Skill_attract_skill_target.cs 019ff2551a24f52ba1e4eb4cb42b1c62c671550c8acea63cdd9101b63e750660 0 +Skill_banish.cs Skill_banish.cs e600b5d7d60b7df8b0fd06683f592c3ffa700eebf8d533f39fa42d3a8286c79a 0 +Skill_bp_modifier.cs Skill_bp_modifier.cs 5a47d18331fb11ed614c0b0ab3307f94fb4010149eb6603a7e79d3481f0c7a0e 0 +Skill_can_play_self.cs Skill_can_play_self.cs 8b384ac3eaeb030f026b2a41e9b8b93242cb86a077642466bef1138c2edc039f 0 +Skill_cant_activate_fanfare.cs Skill_cant_activate_fanfare.cs 00ceb728318e0bf3c648aded073885912cb86653e0bf76683ca0a0c3dc59e14b 0 +Skill_cant_activate_shortage_deck_win.cs Skill_cant_activate_shortage_deck_win.cs 2aa706faec683a9dc56c6a553e81a5402aebd59112910c0e6190d5202bae7dc6 0 +Skill_cant_attack.cs Skill_cant_attack.cs b3c84e5c6d49d91f25c48d47a3899dd8c0dbb217d31096bfa448d27ebbb0ff7d 0 +Skill_cant_evolution.cs Skill_cant_evolution.cs 4efbaf477bcb8faafa217155f87774563678d70b98cf4958990181c2fc5bdea0 0 +Skill_cant_play.cs Skill_cant_play.cs 81e411b089b1887fe71b15e11d4a5dcda827b551445465fdc5fca6268bb17133 0 Skill_cant_summon.cs Skill_cant_summon.cs d5dc8b71ef1fe16c01e4fab59925db48d505eec343c341cc66258acf24132779 0 +Skill_change_affiliation.cs Skill_change_affiliation.cs 4122d41eb764df0f7a75e3c5010c201b9569213062b2a8256b025c7f3d2f14f4 0 +Skill_change_cemetery.cs Skill_change_cemetery.cs ede79d661afc4d2d69139a5aa1e61b154077a2c0a9615cce1c83195a79cc1bd7 0 +Skill_change_rally_count.cs Skill_change_rally_count.cs 9571019aabe673225320abe908745e679564ca2fba5c66df4f755f1c799607b6 0 +Skill_change_skybound_art_count.cs Skill_change_skybound_art_count.cs a2a3a897a6eeb0b0a8410a3d17e3ba754a03623cb4c6da4ba801db5617b96239 0 +Skill_change_super_skybound_art_count.cs Skill_change_super_skybound_art_count.cs 2949491a171496740ce975908614f27dff0934ae497f1f5e1f1da9ed21201148 0 +Skill_change_union_burst_count.cs Skill_change_union_burst_count.cs cf5711d42e95eada822fcca48b69a23a13036088061d2e2d6ace669d3386c6be 0 +Skill_change_white_ritual_stack.cs Skill_change_white_ritual_stack.cs a8886e4b31799752eba65ff81f9fb2648b9609ce316aeaf980cb0cc2f2bbea67 0 +Skill_chant_count_change.cs Skill_chant_count_change.cs cfdea2fd2e60ec0e07c307f0030003d98441d28f639d4c2cd7babf6bab03368a 0 +Skill_choice.cs Skill_choice.cs 178a4efaae3d70bc6291d3c4075c094846d5f6d10c4267195c796d036bcd7fd7 0 +Skill_clear_destroyed_and_discarded_card_list.cs Skill_clear_destroyed_and_discarded_card_list.cs f292ff39099fb4a9f34a33d363b02e6fab441c893170c201689f806765e4600b 0 +Skill_clear_summoned_card_list.cs Skill_clear_summoned_card_list.cs e75a35d2a1849756dca5cb4f1e8adc45ae4a74cab69a3d6a2d661e3cd59e2d58 0 +Skill_consume_ep_modifier.cs Skill_consume_ep_modifier.cs 11152ea58f9cf5add91878d13e0dedc8dfca225485b99f24177ddaa99f32eed5 0 +Skill_copy_skill.cs Skill_copy_skill.cs 8e76c8246ef4f7058e89467e097d36a1382661e9d96833817be2b72998e200c5 0 +Skill_cost_change.cs Skill_cost_change.cs 354976d096676bf05465345408665b36ecb9ff4fdaca5a79d9e56ffb133f0cca 0 +Skill_damage.cs Skill_damage.cs 34da81779391e0a7a6be87e039f69734c83efc988be95bce82731fb6fd495816 0 +Skill_damage_cut.cs Skill_damage_cut.cs 007060fa8052541af69c229a39af75ab1d76cea0b788a579193962995cd3f62a 0 +Skill_damage_modifier.cs Skill_damage_modifier.cs 6185e2d226a9d2d75c10e60126d0525cb73e8bfa116eb433df870033aed517db 0 +Skill_destroy.cs Skill_destroy.cs 8ba1f886a116c33e127a9d47cc9211f5b247787d82580036b023801738eb166f 0 +Skill_discard.cs Skill_discard.cs bd455702de8b14d860beec0ef688eba2d62b9ef7802aa6d5895b83db12df40f9 0 +Skill_drain.cs Skill_drain.cs fe765090b5e330f95e1c9c4bbe3eb95269d115d59129e56cfed34cc1bd72bbdc 0 +Skill_draw.cs Skill_draw.cs 762c0e0c629f142cdb35da87a939a6708f3e30f81ed1caec9a1368acaef22489 0 +Skill_evolve.cs Skill_evolve.cs 8856738acb3cc32ac9f025689d21476adbcd1c193c3ffe4d1d5e0f295b12d37d 0 +Skill_evolve_to_other.cs Skill_evolve_to_other.cs 17b9dcb76199cf05eaf9422a844b58c4ca663703c576cd645f9cde6ebea6e177 0 +Skill_extra_turn.cs Skill_extra_turn.cs 8ddea44e731276115cf81310a56361778e6c7082c272414346266cbe3c70cad3 0 +Skill_force_avarice.cs Skill_force_avarice.cs 124bb3009a035a34abc0dcbad5f5e349af0ffcdf40fa876a826da1825ffee2d7 0 +Skill_force_berserk.cs Skill_force_berserk.cs 0196691a90eb57653249558151315fd48bda9c5e0503384a97138ece7c3484ed 0 +Skill_force_skill_target.cs Skill_force_skill_target.cs f278984cd6fa25ab62dcf0a66d96c9cb9a27017a021010fd38d80d3a25646157 0 +Skill_force_wrath.cs Skill_force_wrath.cs 0591c2644aab18eca46eaa4f933f017a9155c6c2c4c2a959d8f4acd69db83c35 0 +Skill_fusion.cs Skill_fusion.cs 43dde99e3a1c0252ad8aba7a2b758eac0e34cff5fd384a9cd731d78226eda4b4 0 Skill_fusion_metamorphose.cs Skill_fusion_metamorphose.cs 9ac83f3d5fd462e1c60516b01833032b29f92aea8397623b7402f92ecd176d05 0 +Skill_generic_value_modifier.cs Skill_generic_value_modifier.cs 7e6f74380bd12a39f13aca16ed149989a5c02603a1ba0e7fa9940e7f3614b165 0 +Skill_getoff.cs Skill_getoff.cs ea9d0237b0ee1aedf40dd2428fc1376a1058efb78c98b8d4b20dbd6a9c308fe1 0 +Skill_geton.cs Skill_geton.cs c50b4a647f34707c83335dbc0b9f4949e04c66139c4729f8babdd9833957bf17 0 +Skill_guard.cs Skill_guard.cs 2bb07d9bb449a1546fe75505a5cc123099c4a7705b34947fafdba8fa37b734fa 0 +Skill_heal.cs Skill_heal.cs fffb636f56a7b5679d98d0e5c3e769078f3f1bbd8132196bd63e59167bf8b3da 0 +Skill_heal_modifier.cs Skill_heal_modifier.cs 8534bd343cd47ccf2151c0c4cbf2dfcfd188b7395a770d744f0e13af84f6bd3e 0 +Skill_ignore_guard.cs Skill_ignore_guard.cs 09a32d67f56eb45f378a8cf54a3f653d2193dd4fa40e0c4cccf87d77f839d8ae 0 +Skill_independent.cs Skill_independent.cs 4b59f3e92d8ffa4003c242549766e4c5af66227d91ca5aea6396a9b47b6e0639 0 +Skill_indestructible.cs Skill_indestructible.cs c78ea619a32b9fa94ad6be7215bfd7adae1332373fc99e4087dd04e605a0456a 0 +Skill_invoke_emote.cs Skill_invoke_emote.cs 53f83a2ea5ba3a07b79d657996ad67cc7cc2e677396881d998a3e9187b2e9ad4 0 +Skill_invoke_skill.cs Skill_invoke_skill.cs 3d567aa767d470fd4a28a146e961af75eb08a5eaff9abfa0796a64f85bfa3233 0 +Skill_invoke_voice.cs Skill_invoke_voice.cs d4963aa6b70b00b511a73fdb22f463d631ee2c739524fbbe5f4a1338d348d9e2 0 +Skill_killer.cs Skill_killer.cs 98a3b7bddc3ec8eca742f3f416f61c0092bd08b4e8702347bdb5371ca473b6bd 0 +Skill_life_zero_activate_leon_skill.cs Skill_life_zero_activate_leon_skill.cs 682e6522750ecd4019b6ea3c730a7c3601ecfea1f25ede6788e86bab2323c9fb 0 +Skill_loop_skill.cs Skill_loop_skill.cs c0cc1e190e61a10e03b3bc650af91795db44b83b6cd9731e8d2199fe967f57b9 0 +Skill_lose.cs Skill_lose.cs dfde9886cc42f86156450c91903fb6583c4a0bb4004f7c112b7fada8291b6005 0 Skill_metamorphose.cs Skill_metamorphose.cs 024a630261359a534f60ede3ea2a345409689558dbe9d9b4923fbf9502c241c0 0 +Skill_no_duplication_random_array.cs Skill_no_duplication_random_array.cs 1e16a18c7eae03f035e3fede6702dab6304f8304158af994ec318c48469941bb 0 +Skill_none.cs Skill_none.cs a931848c799738070c16a2213b332603ed24caeabc7220bf016f9299a73464fa 0 +Skill_not_attached_resident_chant_count_change.cs Skill_not_attached_resident_chant_count_change.cs 013c6da2aa9679a7877068ce8fade97d9956436b14f2b4f39228d4e600e65e81 0 +Skill_not_be_attacked.cs Skill_not_be_attacked.cs b0a5901f75340dacce3c3bafd62475211ce00b83da298267e6d1b4c1ff3f19d4 0 +Skill_not_be_debuffed.cs Skill_not_be_debuffed.cs 6b7ec9d9275cc3bb1984790c1830582ce2ec804e895c23c419605f6d788129f9 0 +Skill_not_decrease_pp.cs Skill_not_decrease_pp.cs 4e9a69cd64c9ac720423a127192e21e8622d53ec5670efaa036570017031138f 0 +Skill_play_count_change.cs Skill_play_count_change.cs a5528a57d4956b1fcb2df112d52e8a8475048bc19adce1eea5991b25d59957d2 0 +Skill_possess_ep_modifier.cs Skill_possess_ep_modifier.cs 29cb1cb37d38706ee747b6cff33a750bdbbd78e66367f09cccddcf33f2ffd1fe 0 +Skill_power_down.cs Skill_power_down.cs af9ba6852e6a4330bd5d1129009decb22561cfa92c42cd46e978c6a9a0387039 0 +Skill_power_modifier.cs Skill_power_modifier.cs de72ced4a69468ae068665d4cf8ec7025b3ae0fc0e70c1b198649580bcdf6eab 0 Skill_powerup.cs Skill_powerup.cs d5d0d9afbc2832159c07bacff5151e876294fc700f22114e0560de4aed085b6c 0 Skill_pp_fixeduse.cs Skill_pp_fixeduse.cs f44836e39a2ca74374a5a6a8b5a3a77c149fc9342dda3317f012431241406b4a 0 +Skill_pp_modifier.cs Skill_pp_modifier.cs be0ce3fa1554a3abef6fba552bef17569f6b38290590da7acb2203e6bd005814 0 +Skill_quick.cs Skill_quick.cs 1a42f980553e17ed82fcfb7dfecc22362a5350434787d318e0b9316be2a9d833 0 +Skill_random_array.cs Skill_random_array.cs 760a5a49917d73d5a5aea194d63401aa28a425da9846255fd91cf62cf7aa0765 0 +Skill_random_attack.cs Skill_random_attack.cs 440d8605d212566d991ef7896889e6178e62a152c2153191d29543321ee20367 0 +Skill_reflection.cs Skill_reflection.cs 3c35e0e26beea702a3e907f64210fcb79fc8ccde17efa53367178350e6559018 0 +Skill_remove_by_banish.cs Skill_remove_by_banish.cs 097f91456749e36cb3157c593c7e14eae682f71ca804ec3c681e405a949fdc64 0 +Skill_remove_by_destroy.cs Skill_remove_by_destroy.cs 09de63be641639ed86043d9dd74485346ae0bdf1a9e03c51c12087f56f04a04d 0 +Skill_repeat_skill.cs Skill_repeat_skill.cs 9b32e1a891421a5be36aadedbe08ca6923bceaebd360d39cd74ca747e806d78d 0 +Skill_return_card.cs Skill_return_card.cs df8cd7786d327e7c032deef89fd5afc269c6e8661177e231fb5a47ab3a7115dc 0 +Skill_rob_skill.cs Skill_rob_skill.cs 4e9f4dcaaaaabde4b3e6afaf6e050ad5f841587b15cbd5574a4d148911517f31 0 +Skill_rush.cs Skill_rush.cs 3850632c934f8c79c1d965f4c35ada1431798c9072c3d9c75c9c31f86976753d 0 +Skill_select.cs Skill_select.cs a4fb9db7465cc9169630fce5942b3543b22d09d2fd0034ee8c3216470978d789 0 +Skill_shield.cs Skill_shield.cs 3c1c8def0f8aeae0e66f1a9dbb5b208d571d21b7296c7a197c10b492f791d9bf 0 +Skill_shortage_deck_win.cs Skill_shortage_deck_win.cs 6dff9e2d1123dea0270457df18725db4fce9ca6f8fd0602a506da7d597630f62 0 +Skill_sneak.cs Skill_sneak.cs d3fc4c86ec500be86188af5b12c17dd15dc2b9d3b553a7e219a241d9bd6a919b 0 +Skill_special_lose.cs Skill_special_lose.cs 51d9738a8c0d1d0ad264217a1005265a15b6854b440d8c2ad0f0235dba9b97f4 0 +Skill_special_token_draw.cs Skill_special_token_draw.cs 176cd0f649b29bdac3bb359c766fb953b8b520bdd132cbce623a80a5d901240e 0 +Skill_special_win.cs Skill_special_win.cs a95961cbddb770c2d37d9e8f6fc96eb059e928c1e086fff97946b15f5022a1a8 0 +Skill_spell_charge.cs Skill_spell_charge.cs 197c127ba7d0f956da0bfb27acce3e7a2cbf65499efe4de556f80c5f2ffe1614 0 +Skill_stack_white_ritual.cs Skill_stack_white_ritual.cs 84dc8ab790674a51d38f30bc8e1e81b5f2edfc6ae185c11d3707a1c559b28e79 0 +Skill_summon_card.cs Skill_summon_card.cs 4f4fb4f1b8a8f1012a84e7f85052464b706fb4adf7a70c6f89641966537a5e98 0 +Skill_summon_token.cs Skill_summon_token.cs ec3d37e9e9f58d562fb59349dcd12809dcc43e74f59474fc4528f99614538497 0 +Skill_token_draw.cs Skill_token_draw.cs 7a13b65f22d91558fce594c462ff7f4198fbe0d6a05952a30b5ca924754d2f72 0 +Skill_token_draw_modifier.cs Skill_token_draw_modifier.cs f75b030c6f8d6366561363df8017580ca8064b1505cfeae30781aac04be93b68 0 Skill_transform.cs Skill_transform.cs 3e2a56875f4ed9a892845d33a356c61ab1ea1a34a3c32ef10eb74ff12a8f87c6 0 +Skill_trigger.cs Skill_trigger.cs 6ef35ec9a145a566eb49c0ebbd89cdb1b252c326b654af922e6f55993b67476a 0 +Skill_turn_start_fixed_pp.cs Skill_turn_start_fixed_pp.cs 621e9379ba46b389078b78922d3bcd82330a4e5acb80cb2c4255d40641cb0f0c 0 +Skill_unite.cs Skill_unite.cs 75a3a207b777f170df27c903db81472a31c40df743479673c871d573038050e6 0 +Skill_untouchable.cs Skill_untouchable.cs 6aaac19ddeb14a6340dfb4b7fa0e72ec681e5b6f70d1edc1b3825f6c77085ef2 0 +Skill_update_deck.cs Skill_update_deck.cs 671b0dd680989b6082d7b84cb57b3e53bca8ac4988e7cc67ab9a6fe738da8945 0 +SkyboundArtCountAddModifier.cs SkyboundArtCountAddModifier.cs 253e896f5d73dc24930981144d0a147fd4073eb2704ff906b1679d237714d41d 0 SlideObjectReceiveControl.cs SlideObjectReceiveControl.cs 25066b5bbcee488a0ae0d634e595354d194715895dd8f197c57740dc9a65d654 0 SoundMgr.cs SoundMgr.cs 6446b13929ddfef0f1e421498e7e007e5f047fb0b9af01ad4cb155f10abb98c3 0 +SpecialArenaField.cs SpecialArenaField.cs 412c324799fcf5ba3b44f569fc38eb55ee839d19eac69d239f0aa36b613b9ffa 0 +SpecialCrystalInfo.cs SpecialCrystalInfo.cs 5f8544bfa60c28abe33c1241f998b843b3556abd78ad806e86f1d0f54207144a 0 +SpellBattleCard.cs SpellBattleCard.cs beeb2ee38181c49eb23a3a4a34d88712ab9e775a1d6325359c497c75a1d64916 0 +SpellSelectableCardFilter.cs SpellSelectableCardFilter.cs fe43393a84e3e8fd571b5ece0389e248f16a630c4d887b691b7005a090305cd6 0 SpringPanel.cs SpringPanel.cs a017e4bda72cd7cf6f5afd49033ac1d7bc1e1723f7c9a2c47ed03275ab680470 0 +SpringPosition.cs SpringPosition.cs 95b7fe8038f93aefba651ab2ffc437bf067eda828d383ff8669768bc03fb6f7e 0 +Sqlite3Plugin\DBProxy.cs Sqlite3Plugin\DBProxy.cs 5ab0876de5301af3407c3340fcf569cf9465991accb81edbec51f68b056cd761 0 +Sqlite3Plugin\PreparedQuery.cs Sqlite3Plugin\PreparedQuery.cs 9cd4ecc6dc386f9cedece748372992ac3eb56d4a6b372ab22e28ae7b24504577 0 +Sqlite3Plugin\Query.cs Sqlite3Plugin\Query.cs 1ca5b79273292fc248f5097567142422dbdea8cc372ebe7c9b07a90de3aefef2 0 +StageField.cs StageField.cs 00b4ce73ee0ecf03cd735eeaf3c92d88ff84d961545ce9a128fe276ca8a6bc20 0 +StartPickMultiCardVfx.cs StartPickMultiCardVfx.cs 5319d35407eb703a1ce1e62c8010ca48bbbdab28664801e44229742709856dc2 0 +StockEmitMgr.cs StockEmitMgr.cs 652918ba621b02fc0141d1cce1e68847dbfb9d6be19cf9d2b87ee737c1fac742 0 StockReceiveMgr.cs StockReceiveMgr.cs ca15f8d8c7a532558071dd010fcecff5e05ef69891f8f364db4537ddf8f08fdc 0 StockSequenceMgr.cs StockSequenceMgr.cs ff64a78a351e6ed010b0bf9ef00e84d6540109fe578cdbf2772e17d6d66ada38 0 +StoryCardPanel.cs StoryCardPanel.cs cfd94847d286ae783c623d1dbe035ecd9d425afc30f9e8dc857f28c67cfa3270 0 +StoryChapterData.cs StoryChapterData.cs 01ade4dd98257c4360af148d3b27e1169012d0cc77da556fa3f3f2e07824b3bf 0 +StoryFinish.cs StoryFinish.cs 5fbebb41edd77454e7f84a7a554b5481f4a6b3927a779ed6f2cc885de2258052 0 +StoryFinishDetail.cs StoryFinishDetail.cs 69d4f7ea3fd2ae850c2c9f0761b206ed8cfa1131ec234f3847171f1ae92076e4 0 +StoryInfo.cs StoryInfo.cs 32b5563dca24e17e03ad86a4f4c32e5237249a29b1ca98cadf175f9f0929737d 0 +StoryLeaderSelect.cs StoryLeaderSelect.cs 1510dc9f50cdf22dcc7d666638f53a7043042c8b969184b7e65496c15077db20 0 +StoryLeaderSelectData.cs StoryLeaderSelectData.cs 1ac1eb3b8a1100393f5933fe298a926031f54ea06defb92fb9352b2c8852cd1e 0 +StoryNextSceneSelector.cs StoryNextSceneSelector.cs abb3d7f8bfdc4404463461f947b513b3221b121dd983bca4c86a6785ce15165e 0 +StoryReportEndAgent.cs StoryReportEndAgent.cs d2ea0cac09dc90b1fc0e163fa2e6117a45f7c61093edc22de698ae1873d8913f 0 +StoryResultAnimationAgent.cs StoryResultAnimationAgent.cs 67b5f484cd593a1c03f6116ae6c8eb2debf45f38671606478af7f0d12df06b59 0 +StoryResultAnimationHandler.cs StoryResultAnimationHandler.cs d5d0f28beddf0487e54c0652b3ec0af101543df4df63d8cc4847c9de0618b91a 0 +StoryResultReporter.cs StoryResultReporter.cs 21c77ea3cad8a8dd32ade349e68769bf3b09af224b919f29d09b958a1ac699c8 0 +StorySectionData.cs StorySectionData.cs 2a9977f30e6a8c4d3dcb54696ffa9b84f30baad9435745b36bc071465c6fe5d7 0 +SuperSkyboundArtCountAddModifier.cs SuperSkyboundArtCountAddModifier.cs 6672f92e8d9fad08c10c7a441d1756d2baf9fc0d47f137cf8adc0498ddbd47b1 0 +TaskManager.cs TaskManager.cs d16af8956ca562f74241bd570a68e7f2dbd0d061039a22e4eb71207843b2735b 0 +TempleField.cs TempleField.cs 3e3cab0f9c8630e3b275c78a226712ab34eeb17f807c484652331aa0b2b17fe7 0 +TempleNightField.cs TempleNightField.cs 3d27607868382d47a14f17880cfd5e7a340112e9e23e376a91ced7269cc2912c 0 Timer.cs Timer.cs 0ac4b1fc273798a587d38987cc7a353d8c071a81c4b7ba293fdc59a9c2e1c804 0 TimerMgr.cs TimerMgr.cs cfe8eb9a3405153f46ae962772d23934c39daaa34336cf6b309484c511509d1e 0 TokenDrawModifier.cs TokenDrawModifier.cs ee94b1a849c7779f1c0fcaf0951c06cadcdfd0fe7c61182de4e1cc468af494cb 0 @@ -237,19 +1218,24 @@ TouchControl.cs TouchControl.cs 999089722cce89697ebef6b2da6cb20a4d33e10826160e64 TurnAndIntValue.cs TurnAndIntValue.cs 1b08f6c6e7950738ea1be3b7910e62aa800eb945a1c5f17e910de63e040cabe9 0 TurnEndButtonUI.cs TurnEndButtonUI.cs fd5682499e7764933d3d3d24c8b75e1bf6a863fc29fd7b75bdaf0f4df4efa8e3 0 TurnEndTimeController.cs TurnEndTimeController.cs 3b516431616bcaac105e1c19c199fde08a74a4414ac2eb7264ecbf7aee4dc062 0 +TurnPanelControl.cs TurnPanelControl.cs d8b78ab4ec6b6b5e6ebfa8129679ef6dac38ac1e8285867c349c3e0c00881db7 0 TurnPlayerInfo.cs TurnPlayerInfo.cs 57656b4a000e98f9d9a75bcfcf13b1703c33a1c64f8f36f78afb0771f3caf43b 0 TweenAlpha.cs TweenAlpha.cs d1f530a59b492a34140f88c0fecb88406289cc37817e822d3a36cd141ec03e7e 0 +TweenColor.cs TweenColor.cs 27070a2f526015c8a9b68005be21e9235d46c72a35eb646b09e3d38fdaea8cb1 0 TweenPosition.cs TweenPosition.cs 1426cfaf028ac956d7e1e286ad67189723116ca2dc4926a101ca1784c90ec22a 0 +TweenRotation.cs TweenRotation.cs 840297b6cb3b51034b457fc3c4ae794ec3e76f9d75b2aeb9135ea2518e3a572e 0 TweenScale.cs TweenScale.cs dd50401e8ffca06da1d2ccaa9d21cccfef2007d8f786f0690b79880d13b5007d 0 UI2DSprite.cs UI2DSprite.cs c0c50a2c03e76ab7ee5fc7b0bb6ede7462ca98cb338a3ac93d3310d6016e660c 0 UIAnchor.cs UIAnchor.cs ed46145415d1c7a0fef11d38de99b4b851e92044455ab3297d3e487c09e5f9b2 0 UIAtlas.cs UIAtlas.cs 7b4a3539816d0568b2175af231466e58b30e60596b5f0ff095e6781c37b6b6e6 0 UIBase.cs UIBase.cs dbb46aa38d676f4c4a63adc182a0002a1a5fd74d5d72002a4e1771bfa7b30830 0 UIBase_CardManager.cs UIBase_CardManager.cs 5ef52362dda6c063389cc681f0ee48212ab113973807c4f062eae207c3658153 0 +UIBase_Textuer.cs UIBase_Textuer.cs 2a99abc5455d56dbd35db98494761d6ea07b7efcf0a35b4096af57d664dd49d6 0 UIBasicSprite.cs UIBasicSprite.cs 82e6d31f92cdccf975a2113546968dd72737df67c94cb55015e8e808749b3446 0 UIButton.cs UIButton.cs 6daadb36b071d0759d354c0368383bbc8fc7c7a419be5236a0a576e666b47ca8 0 UIButtonColor.cs UIButtonColor.cs 527c1e1d9db0da61cdc0348e893b3df2bef7fadd046b9079abeb5641483da7b0 0 UICamera.cs UICamera.cs 500eb9bb8f8bf4e7ed1f0073de80c5ccefe85273db00fc887295153d533c6525 0 +UICardList.cs UICardList.cs 0c983d56f955b25b0e0d52b4b1ce7c4a51b175093770c24c66db0ca575abc288 0 UICenterOnChild.cs UICenterOnChild.cs 474da8b0e6bab01a59538a47351a71f3a3564f9242c37a9adb29419dcaf91ee1 0 UIDragScrollView.cs UIDragScrollView.cs e5acfb873e2c58489438689c35fb49f9bc6a626e42b8210d99131027c5c614b4 0 UIDrawCall.cs UIDrawCall.cs 9450bbb24af68f5949415fdaf4d172e87f3666f50d04cc349a63317ba3ce16c0 0 @@ -260,8 +1246,11 @@ UIGrid.cs UIGrid.cs be8a6c35e77ba46793e07ff442fc18296acae8ec35dd265269b55a594abd UIInput.cs UIInput.cs 416afc67f7ccb2ce5013e0aa16a6f88e56835addc4f44119d20d6902e9a2f63d 0 UIInputOnGUI.cs UIInputOnGUI.cs b2580c5f417880c2439ecc10cf2be990ce36cb5c5cdd31106206160432bb07e3 0 UIInputWizard.cs UIInputWizard.cs 2cb970f67fca7f6b87ab2549c2afbc49641a15d2ae105d621a60a7c43246f3e9 0 +UIKeyNavigation.cs UIKeyNavigation.cs 07f92623077c4fe71abe087b62e8f66ff3d2542997dabd0f11c8e50b57714d15 0 UILabel.cs UILabel.cs caf2353d46a4a538b696f1cc11ca0d987d99905db8789a507df4fc726a29cb47 0 +UIOrthoCamera.cs UIOrthoCamera.cs 7af22756b74e80e8d79ec65a1b8dcb4a780548152af5fe354fc8d7ba437ea8a8 0 UIPanel.cs UIPanel.cs da0a82c5db60138e81e2fabbf0ed39adbe43f0d98a52ce5e7204e90c6378b8e6 0 +UIPopupList.cs UIPopupList.cs a92be6b849fd09c1208562e37b483dda6e17a2ef7d7dbd4f9ee4db417b719306 0 UIProgressBar.cs UIProgressBar.cs c528c65a6c4c5f0b99f16ee5d956ea45b0b2b50d5f99c82590ca11b39b1681dd 0 UIRect.cs UIRect.cs 26b0ed3873a80eccb7b3e110fa54f7ad732cfaae698aa5cbd7aec4c0f7b01d7a 0 UIRoot.cs UIRoot.cs 457040148de9a4cd8e2e4c8dec76da7db4f19fc424100b5bb93897a5ede815a0 0 @@ -274,34 +1263,84 @@ UISpriteData.cs UISpriteData.cs 5ef69b73779d7935627e4ce8e9875ef6ba8695dc872453f5 UITable.cs UITable.cs 7996e4ad3d48b3a05295671af25c135fdcb650cf7461e49a0d9e45ac2218771c 0 UITexture.cs UITexture.cs 4a620309b4b36a2d217bd365427011fa40fbd3572105312c5e67cfd9cf52f811 0 UIToggle.cs UIToggle.cs 4877e1f3dd9151b5dde182f2109999899d5ceaa3f390a8e0211424b77d8109dd 0 +UITweenAlpha.cs UITweenAlpha.cs d0b2af23184022caa70b8f027340330171f41c11a1f79a74370c452379b6c26f 0 UITweener.cs UITweener.cs 639742c82b7b38d98215bb9852df84c92819b28dbb9dcf43d834ed615897cbb5 0 UIWidget.cs UIWidget.cs bcc292adf33c73b6e1091e74df776dee7808b10f1e8a5b6296f3efe5eee1ac03 0 UIWidgetContainer.cs UIWidgetContainer.cs 86cb92fd2fe067189987d823f21f7492355d99490a37d03d0ca4b98ef6b2d014 0 UIWrapContent.cs UIWrapContent.cs 59a7ac9b3b6a8774ff69869ccf8d0a013efc3999ac636ec43ed5d2a90cf5c301 0 +UnionBurstCountAddModifier.cs UnionBurstCountAddModifier.cs 8beff11a43074eb1a3803dcfd0e5f9b094f5fd9967146439d6caf8c3fd468bb6 0 +UnitBattleCard.cs UnitBattleCard.cs 27dc1f653b825080ccfcc072236165148c25fbecf170d2b9fb9629cd330ba878 0 UnityEventAgent.cs UnityEventAgent.cs 0712c1fa51f3a6ac91d26d42972c3b4c0bef81431ac7e4424ca222c18746f46c 0 +User.cs User.cs d0108788bc786b1852b9d9c9bce9011d14a7fa681c8dc5b18814912029c4bb1d 0 UserAchievement.cs UserAchievement.cs 06f9a530d683c21c4c3697b0ae6b8c79e33197e504de7479d0ddfeb5b9c54014 0 +UserCard.cs UserCard.cs 54f5658a3d042ef394bfb3e36d5892a577ee24feec01ee5e26b10defb9a1b2c1 0 +UserConfig.cs UserConfig.cs 9ee05ccbfdb5531ac5fe35cbcb960470011664078f2cc33475cbeee82bc046e5 0 +UserCrystalCount.cs UserCrystalCount.cs 7170421dfb1e7bc4edb2a86ea486bb2b14fe4946ef9a03480c29293a23fa2e75 0 +UserDegree.cs UserDegree.cs d105820b88e629a652b77240674d3a35a479cb34118dfd67f317a58611c18abb 0 +UserEmblem.cs UserEmblem.cs 1171ddb12cdc4a2a64519e7d999c4e5f4826cc4412665fab513934ae4a3fda66 0 +UserFriend.cs UserFriend.cs ee231e46041027ad3f2f4f1b8859e655f2b6562562ed886933a2ec42d3435e39 0 +UserInfo.cs UserInfo.cs 5c073d43f4378f8629c524cc57e79097f67872fa898df84fa2e8b9e54630a4db 0 UserMission.cs UserMission.cs 2516293322a85ea704c66c79789c5b026a41024802aa464f943c019822424c06 0 +UserPromotionMatch.cs UserPromotionMatch.cs 9456ac47ac4ae1050bf35e2c32556774053f2442c6d35f4029d635faceade38a 0 +UserRank.cs UserRank.cs 482eb25d49fe10180258f86c98e5d016d0b2ae97dd9a703550ab6b203d12f1c0 0 +UserTutorial.cs UserTutorial.cs a9158fa4ed1954b5b0779acd6621f18d1046d1fcd196d0291ecf804c2f1733fb 0 +UtilityDrumrollScroll.cs UtilityDrumrollScroll.cs 33e4e607231f08df2286af7f8240407eab36a5c20139699f24a469e96a2f870a 0 ValueWithOperator.cs ValueWithOperator.cs 8f7f0a6779b0acef60616d8b11397e9287a2fda5aabb5633931fe054d0488a95 0 VariableSkillFilterCollection.cs VariableSkillFilterCollection.cs 81a4181b82be933b517204d193716c7b76af98f9c499635a1cded597b62dad30 0 +VellsarDesertField.cs VellsarDesertField.cs aa6332744db7946bc81a58cc9366b5aa12645510de417e387d952fa83fdb6723 0 +VideoHostingUtil.cs VideoHostingUtil.cs 70b20ef9a7e8187d33356d37bf74f0da02005bf26e2e7b33b0b60ca8feca5fb6 0 +VirtualBattleEnemy.cs VirtualBattleEnemy.cs 67a44fd924c8488a7a309162835d01f4a865481f1e6544d75cbf3ee28f151e34 0 +VirtualBattlePlayer.cs VirtualBattlePlayer.cs eb107ba07f87bf04337ca7958f545da20b211e0cf5c5aaa8ca5b5487ec4eef64 0 Voice.cs Voice.cs bb5adff9c75fb04af122f784aabce3238626eca7ecf63b34e3f1de41eb54f4f2 0 VoiceAndWaitTime.cs VoiceAndWaitTime.cs e2ae6dec5f198e44489e2f13a4149d0f6081da625f72d0e0f0d50a9740b0a156 0 +VoiceDictionaries.cs VoiceDictionaries.cs 845e20628eb0ef372bbfb8c7b55ae14ce6c57e11df24fcaa43668d9876ef6ed1 0 VoiceDictionary.cs VoiceDictionary.cs 314e23ce11985b7f0b5e6a5753b4ba48813c4414972441cccc4c8efe15e81d21 0 +VolcanoField.cs VolcanoField.cs 3dfb1318b89b7b82f8a4ea2065f471417bb6004efc2319f32a86ac9c6476528b 0 +VoteData.cs VoteData.cs f91a040c073e36b7058a2fe866005c33b22f247fd61419c21c6af46669485d9e 0 +WatchOperateReceive.cs WatchOperateReceive.cs e77378fd91ec257eba34448e0305e9608ae2bc29f8581c65167ac4c4cd829096 0 +WatchOperationCollection.cs WatchOperationCollection.cs a20deb14316a4f38ead77c4a4bf6d7d7b092dd1037bac54b3f4ebf26b01bccf9 0 +WatchTouchControl.cs WatchTouchControl.cs 7a8426ee3f178f05650eb4ccd5952eb5dcc1718ea8ec05be81715dcfbdfda529 0 +WatchTurnEndTimeController.cs WatchTurnEndTimeController.cs 50cd44122fe694f1003214c31a552ec9e899388166b4a495e5a03d5601fbfb1d 0 WatcherDisconnectChecker.cs WatcherDisconnectChecker.cs b2ec9803c3ed9e473233cfd4e2f805195df1f607936f7dde9ae1b7a7028dd847 0 WatcherLeaveChecker.cs WatcherLeaveChecker.cs 7b969aacc9670f319bd45d344528524a3001b0152cc96e99631e89fa69354466 0 +Wizard.AutoTest\AutoTestBattleMgr.cs Wizard.AutoTest\AutoTestBattleMgr.cs 42841daf11cb9b42e8d97f44f7ae24aebee089b7d9c7c6d8d39f21b32b49860d 0 Wizard.Battle.Card.InnerOptions\CardInnerOptionsBase.cs Wizard.Battle.Card.InnerOptions\CardInnerOptionsBase.cs e0c9e0e503c55e536924b17f7b2948423a79b85bafaf0ffa0d02b053667d69f2 0 +Wizard.Battle.Card\IVirtualBattleCard.cs Wizard.Battle.Card\IVirtualBattleCard.cs 9446d58a4ab2ddd2097d3132b133c36780d7e9d36b83309a4dc12d7c8d441f40 0 Wizard.Battle.Mulligan\IMulliganMgr.cs Wizard.Battle.Mulligan\IMulliganMgr.cs d49640f1076af798e9114ff9058b7fdfe5d5a194ed2420a6ef95122fa10d8c0f 0 Wizard.Battle.Mulligan\MulliganCtrl.cs Wizard.Battle.Mulligan\MulliganCtrl.cs dbb991240686c69313e36a6e7773acbf2e877eefb1153a7ee985379755ca36c7 0 Wizard.Battle.Mulligan\MulliganInfoControl.cs Wizard.Battle.Mulligan\MulliganInfoControl.cs 96b05ee5e79977b06a9f8d3e2f027b350baf06cbb49dc5d569b0cd4ca8030fda 0 +Wizard.Battle.Mulligan\MulliganMgrBase.cs Wizard.Battle.Mulligan\MulliganMgrBase.cs 4541b41e812e14598f82f44852348503760c9889306ec4958749c775042daedd 0 +Wizard.Battle.Mulligan\MulliganOperateControl.cs Wizard.Battle.Mulligan\MulliganOperateControl.cs 4cfb95ea034953cd75b801f65f634a5bb92650bc4322ee9ea2621035fc618e2a 0 Wizard.Battle.Mulligan\MulliganViewBase.cs Wizard.Battle.Mulligan\MulliganViewBase.cs 641fd480d2682454e5eee8bf149498ad23811752900dcc43de5b994c77b76b58 0 +Wizard.Battle.Mulligan\NetworkMulliganMgr.cs Wizard.Battle.Mulligan\NetworkMulliganMgr.cs e9d24af08954400b4e484871273ffecfe5ae76abb16cb0350b7ce16ac89b3c7d 0 Wizard.Battle.Mulligan\OpponentMulliganCtrl.cs Wizard.Battle.Mulligan\OpponentMulliganCtrl.cs 68ad23dde55aaecf68521d861b4d61a5569caeb8b524058f2fafead7a79f727e 0 +Wizard.Battle.Mulligan\OpponentMulliganView.cs Wizard.Battle.Mulligan\OpponentMulliganView.cs 225bcec52a9768a233bf336efb8285b40f57ccc1ebbc7d63a47823c3bd3876bc 0 +Wizard.Battle.Mulligan\PlayerMulliganCardSortOutVfx.cs Wizard.Battle.Mulligan\PlayerMulliganCardSortOutVfx.cs 2592025f334540f261207c02c5a69032c4109eec8e3ad47c8037e224a29424b3 0 Wizard.Battle.Mulligan\PlayerMulliganCtrl.cs Wizard.Battle.Mulligan\PlayerMulliganCtrl.cs 19da0c8f4d906a0151537e458feba897f497e0e58e98cc073af8ca17a46e992b 0 Wizard.Battle.Mulligan\PlayerMulliganView.cs Wizard.Battle.Mulligan\PlayerMulliganView.cs 9ec7621e20fb7b26e60f532612dc2598bb6b19b8d5f6d10f9616a42ad203832a 0 +Wizard.Battle.Mulligan\SingleMulliganMgr.cs Wizard.Battle.Mulligan\SingleMulliganMgr.cs f885a0a4039b2cea9889f904d0af81129ec2b700672550e0f7988c061c8883a9 0 Wizard.Battle.Operation\IOperationCommand.cs Wizard.Battle.Operation\IOperationCommand.cs 71d184f986afd2d5160a6f7121ef8f80e50c018b48c21d5e3b6c14086df8c494 0 +Wizard.Battle.Operation\OperationSimulator.cs Wizard.Battle.Operation\OperationSimulator.cs c97c6fdf16353d9d3aa5839528bc5832d00a85e27da8d786ad8274e1bf45708c 0 +Wizard.Battle.Operation\SimulateRandomSelectFilter.cs Wizard.Battle.Operation\SimulateRandomSelectFilter.cs 2d15e18af41ec05545d8b1d6db64f5d25240828ce3284d81fd23f775fa8c00f2 0 Wizard.Battle.Operation\SimulationSelection.cs Wizard.Battle.Operation\SimulationSelection.cs efe3abe803236d55e3594f15b65dafd9fff41a526e291a217ce63d1b89ecb475 0 +Wizard.Battle.Operation\TurnEndOperationCommand.cs Wizard.Battle.Operation\TurnEndOperationCommand.cs 2d89809870675e678f07161469602becac62efd9dcef35f5e185ccdbf9b43fa6 0 Wizard.Battle.Phase\IPhase.cs Wizard.Battle.Phase\IPhase.cs dacb64f72e43ea5c900c2fba5abcae616e9243f2c80bd2129af54263636f5ad7 0 Wizard.Battle.Phase\IPhaseCreator.cs Wizard.Battle.Phase\IPhaseCreator.cs 14fceafb7bfc643cc5022d38744b03926cda07bb67d1178b36a7ea614432259e 0 Wizard.Battle.Phase\IResultPhase.cs Wizard.Battle.Phase\IResultPhase.cs ba6732b9a31dad0a47b298cc85e5ee8b067875189f0225b8abed93e3f059c442 0 +Wizard.Battle.Phase\LoadingPhase.cs Wizard.Battle.Phase\LoadingPhase.cs 60b11afc14b20ed0960ea55fd5c8e3d006ad1d12cbc907679cbbfcb8127eaee5 0 +Wizard.Battle.Phase\MainPhase.cs Wizard.Battle.Phase\MainPhase.cs 7463c025866b5196219eeeb0132d69d91b45f4b6a80fb964471e23c96863937b 0 +Wizard.Battle.Phase\MulliganPhaseBase.cs Wizard.Battle.Phase\MulliganPhaseBase.cs 2676daa3204e99605dc74d3bde3999e6f3a44af65d9081bef3fedf824904068f 0 +Wizard.Battle.Phase\NetworkMulliganPhase.cs Wizard.Battle.Phase\NetworkMulliganPhase.cs b5eb259294c4851654647b3e6d482667686bf7f28c6d97dcfa86032a6c9660eb 0 +Wizard.Battle.Phase\OpeningPhase.cs Wizard.Battle.Phase\OpeningPhase.cs c47c033633cf5b813eb8384323c313a8b8ba2edfd91c1368fb1f5df9e4e73391 0 +Wizard.Battle.Phase\PhaseCreatorBase.cs Wizard.Battle.Phase\PhaseCreatorBase.cs a5641cd3ac277cb47bd0d2e2ee904bc17155ecb18f2e4c2b60a3d643be9ed06d 0 +Wizard.Battle.Phase\RecoveryAfterMulliganPhase.cs Wizard.Battle.Phase\RecoveryAfterMulliganPhase.cs 8b75c76e7a0122bff7e06a1bfe0817f1ce84585dea460e0d99225fb20d5fe4f5 0 +Wizard.Battle.Phase\RecoveryNetworkBeforeSubmitMulliganPhase.cs Wizard.Battle.Phase\RecoveryNetworkBeforeSubmitMulliganPhase.cs 6f16e1181f83f47de29f27017d1ecfd8aa6963f55524ee3457cc1a428778fb1e 0 +Wizard.Battle.Player.ClassCharacter\Class3dCharacterBase.cs Wizard.Battle.Player.ClassCharacter\Class3dCharacterBase.cs e30cc0fc68c1164411d0420f753d2597c166db94670eb8959bbfca401d7088ca 0 +Wizard.Battle.Player.ClassCharacter\ClassCharacterBase.cs Wizard.Battle.Player.ClassCharacter\ClassCharacterBase.cs 76c74e23c52d36176339dfb50f6885660ef587601b80cc2a882682bf0332429c 0 +Wizard.Battle.Player.ClassCharacter\HighRankSpineClassCharacter.cs Wizard.Battle.Player.ClassCharacter\HighRankSpineClassCharacter.cs 17f31270da67508f21987a11ad6978745cade12c9dec53249b6a508a58a2e773 0 Wizard.Battle.Player.ClassCharacter\IClassCharacter.cs Wizard.Battle.Player.ClassCharacter\IClassCharacter.cs c1a985539e3b304260d87f4af6ec249d939dc0385e7cd902634296c4127d991f 0 +Wizard.Battle.Player.ClassCharacter\SpineObject.cs Wizard.Battle.Player.ClassCharacter\SpineObject.cs bd325662311d523dc9948557b3ddf899ed5a72fe18430f69e307360f7fa6758f 0 +Wizard.Battle.Player.Emotion\Debug722006NullVfx.cs Wizard.Battle.Player.Emotion\Debug722006NullVfx.cs 65801eb05b7c9ee4c6514faa6d67f2d632ee95a47a74836a2f34072fe19a30db 0 Wizard.Battle.Player.Emotion\EmotionBase.cs Wizard.Battle.Player.Emotion\EmotionBase.cs 8a8edb24dbf845b07acf74e70658335d8fe23f67105e1e70e814153b836d4fad 0 Wizard.Battle.Player.Emotion\IEmotion.cs Wizard.Battle.Player.Emotion\IEmotion.cs 289e34823e07e0fa97f0259e3eeeeb1e0475f5c78aff8f6515f4208c7ad2f2e5 0 Wizard.Battle.Player.Emotion\IPlayerEmotion.cs Wizard.Battle.Player.Emotion\IPlayerEmotion.cs fe56394e17ad9a097aa1ef3da9df965c05e62c9850c21601b49b6eb87841d1d8 0 @@ -316,90 +1355,462 @@ Wizard.Battle.Recovery\HandCardInfo.cs Wizard.Battle.Recovery\HandCardInfo.cs b0 Wizard.Battle.Recovery\IRecoveryManager.cs Wizard.Battle.Recovery\IRecoveryManager.cs 183fafee041522a2c67f6e3c0b50751e4591e507f8f2950658fbc29ad3cbc78d 0 Wizard.Battle.Recovery\IRecoveryRecordManager.cs Wizard.Battle.Recovery\IRecoveryRecordManager.cs f8f95b3c268918fd18b849616a576e763819bf3d376dbbdb4a60393370a2d4e7 0 Wizard.Battle.Recovery\InPlayCardInfo.cs Wizard.Battle.Recovery\InPlayCardInfo.cs 63491906ad4c2e18fd2e7eadec2ee92d15eda18b8f726ec38f969da79e30155c 0 +Wizard.Battle.Recovery\OperationRecorderBase.cs Wizard.Battle.Recovery\OperationRecorderBase.cs 1291b862fc0bccd5cc9c96af41498e36e2521a1c0f0655a81f78b4d4eef02877 0 Wizard.Battle.Recovery\RecoveryController.cs Wizard.Battle.Recovery\RecoveryController.cs b433838072979be22767455344a4529b74ec0cc4261c4606ec2100897b7e8889 0 Wizard.Battle.Recovery\RecoveryDataHandler.cs Wizard.Battle.Recovery\RecoveryDataHandler.cs 972832014b77ce9a1f5fff1df87a2222b8c62aedc2057bb931646e85bee24c08 0 +Wizard.Battle.Recovery\RecoveryManagerBase.cs Wizard.Battle.Recovery\RecoveryManagerBase.cs 84aabcfd0acf652a15099057957432676384f0db3227953917208403c3cb8a2e 0 Wizard.Battle.Recovery\RecoveryOperationInfo.cs Wizard.Battle.Recovery\RecoveryOperationInfo.cs 37787cc77b98e18d1d4b9727d6bb640c04f47adf15ac463aab7b609e80a756ac 0 +Wizard.Battle.Recovery\RecoveryRecordManagerBase.cs Wizard.Battle.Recovery\RecoveryRecordManagerBase.cs 272f5bf53d47ca90c2ad69377eab055c2e6f47fac6421a4864c0f414383ff973 0 Wizard.Battle.Recovery\ResultConditionInfo.cs Wizard.Battle.Recovery\ResultConditionInfo.cs 52d21760da08ba7b0e6e067cb7dc7a3890638ed6949305d3ad42a1fdf04e4743 0 Wizard.Battle.Recovery\SetupConditionInfo.cs Wizard.Battle.Recovery\SetupConditionInfo.cs a5b78784312eb08496ef6db3b2c61a53957cf288c93c53714674972f5f4d2b9e 0 Wizard.Battle.Resource\IBattleResourceMgr.cs Wizard.Battle.Resource\IBattleResourceMgr.cs 59e39c39afa8186f237fa879f5cdb043aa2dc99e5117eb0e1204df77b563d607 0 +Wizard.Battle.Sound\LeaderSoundManager.cs Wizard.Battle.Sound\LeaderSoundManager.cs 50eb5262cd65deb22c5eb5ea3b47735844e8282d3e9b2ac064f520a9e12d397f 0 +Wizard.Battle.Touch/ITouchProcessor.cs Wizard.Battle.Touch/ITouchProcessor.cs 6343a8aa50461bcb5e99f9cc9a689d81bd62516266456f7821da962ab93bd369 0 +Wizard.Battle.UI/IClassInfomationUI.cs Wizard.Battle.UI/IClassInfomationUI.cs 05831a370255fda7e5f0091a278fb0c35ce7dd81c504395127589505e9cce4ee 0 +Wizard.Battle.UI/LogType.cs Wizard.Battle.UI/LogType.cs a8de41a8d5d8f2289f75b9b9fc25d277e74c42723e78d09762fc72ae5f5e9e34 0 +Wizard.Battle.UI/SkillGainType.cs Wizard.Battle.UI/SkillGainType.cs 7b12e7d3982bbf23dfeebbd90ea5fb045d801ff47d7713a3fb835db9642d05a5 0 +Wizard.Battle.View/HandCardFrameEffectType.cs Wizard.Battle.View/HandCardFrameEffectType.cs 0457f58fe09057aa9f32c8b131186d1a252aaf30930e4269ef204d6429188ff5 0 +Wizard.Battle.View/HandParameter.cs Wizard.Battle.View/HandParameter.cs e55287d3bdf32b98849f626ef833c347311a3483ffca92a73c70c9598955ec40 0 +Wizard.Battle.View/IBattleCardView.cs Wizard.Battle.View/IBattleCardView.cs 79657bc2b1a864d548e9929640d5f2322561041114119ff3f6ce987c1a073f68 0 +Wizard.Battle.View/IBattlePlayerView.cs Wizard.Battle.View/IBattlePlayerView.cs 8b131ef553141fb3ee9d17732d373e7b7422f870a10cba68e2bde6ef3311096e 0 +Wizard.Battle.View/IClassBattleCardView.cs Wizard.Battle.View/IClassBattleCardView.cs 15fa11b56a919f4f04a2429ed7b31d92839ae228356ae4fa805b23d867a6e750 0 +Wizard.Battle.View/IPlayerView.cs Wizard.Battle.View/IPlayerView.cs d0f937abd9dfa4130e0d0ea2892c539aef0023df1eeb0d0dbe13a4f80ee26f50 0 Wizard.Battle/ActionProcessor.cs Wizard.Battle/ActionProcessor.cs 7c8b40454a4948dd48a58c0efc240703eab9a77aea0add64e542f6b06c7323af 0 Wizard.BattleMgr\IBattleMgrContentsCreator.cs Wizard.BattleMgr\IBattleMgrContentsCreator.cs 7f1410027b146fe028bfadf5940599f1e576063dfa764e0be2754dfd7d19e30f 0 Wizard.Battle\IBattleCardUniqueID.cs Wizard.Battle\IBattleCardUniqueID.cs 0b1559e61bfd02f584b4830ad53aa6ce521665c00ff44ee89dda2953c9c3d781 0 Wizard.Battle\IInnerOptionsBuilder.cs Wizard.Battle\IInnerOptionsBuilder.cs 38160d48e9b01d686c0fd51a5743ee97afb742c97c1fda347460047a7d17b928 0 Wizard.Battle\IReadOnlyBattleCardInfo.cs Wizard.Battle\IReadOnlyBattleCardInfo.cs 1b3456595cf0664d7b1e3324268f84cf913c3e2778ecbacc63b0c0ba72ab2e8c 0 +Wizard.Battle\NetworkOpponentInnerOptionsBuilder.cs Wizard.Battle\NetworkOpponentInnerOptionsBuilder.cs 146590588d04b2c86dca19207a14ed0f9510db6385d808310700a396ffb97928 0 +Wizard.Battle\NullInnerOptionsBuilder.cs Wizard.Battle\NullInnerOptionsBuilder.cs 549ee05b3ef2b986949be196806ba58c411d82f84d2fcd5537c2824caeb4bf49 0 +Wizard.Battle\PlayerInnerOptionsBuilder.cs Wizard.Battle\PlayerInnerOptionsBuilder.cs 0ed76b5df3e18db737576bc6a4c8f06dbdaf227a67d8ca07d39cbbc10947e970 0 +Wizard.Bingo\BingoDrawTask.cs Wizard.Bingo\BingoDrawTask.cs 9c235721777d20d8d0bf0eba785c92b794881142c4904ead3fbb73bd9c28d995 0 +Wizard.Bingo\BingoInfoTask.cs Wizard.Bingo\BingoInfoTask.cs 3c651be0075b3dfdf781286166ddcffa16771a6a73eff7ae7d76a8a9e7a8d315 0 Wizard.DeckCardEdit\CachingCardBundle.cs Wizard.DeckCardEdit\CachingCardBundle.cs 3efcb163e9be8d023e12394684c83745081c500cf13a84b91674aab0eeace113 0 Wizard.DeckCardEdit\CardBundle.cs Wizard.DeckCardEdit\CardBundle.cs ae56efeea60e2288b595d57f6b48bc83661ff8f22b0607746a39b080714e439e 0 Wizard.DeckCardEdit\CardBundleController.cs Wizard.DeckCardEdit\CardBundleController.cs fa0cf42cf3d42e56dbcf0702ba21f15ccf4f4f38a7318472cbf8f473f7d97a61 0 Wizard.DeckCardEdit\CardBundleControllerBase.cs Wizard.DeckCardEdit\CardBundleControllerBase.cs 2b782fafb3043b1c67799228bf41ce3997bfa7c0a23492e090512c3677c62820 0 Wizard.DeckCardEdit\CardCreator.cs Wizard.DeckCardEdit\CardCreator.cs e0c36db83ca43934ae4220f914a5da027cf8cf8d7a81e593bc6782ae5fa7dde1 0 Wizard.DeckCardEdit\CardObject.cs Wizard.DeckCardEdit\CardObject.cs 602634f96d9c4c897465a2d3cebca885c7696135cfd4ebe9881bdd70fb97bf88 0 +Wizard.DeckCardEdit\CardSelectListUIBase.cs Wizard.DeckCardEdit\CardSelectListUIBase.cs cceeab0e7c06de1d414c846c9b75132ee35a7487a17b0ef89b0f6b1056683f13 0 +Wizard.DeckCardEdit\CardSelectListUI_State_CardDrag.cs Wizard.DeckCardEdit\CardSelectListUI_State_CardDrag.cs a4272875e7031b3d6c6b28c2133c4cbfe95532bc78984621ee569612c7559b91 0 +Wizard.DeckCardEdit\CardSelectListUI_State_Edit.cs Wizard.DeckCardEdit\CardSelectListUI_State_Edit.cs 2ceb554e8695117380ffbb8d8d653eec9d117a25325f4a11a828a1daf0e7e4df 0 +Wizard.DeckCardEdit\DeckCardEditUI.cs Wizard.DeckCardEdit\DeckCardEditUI.cs ac6172c070e028adf71839ba2a607383dcd58168077e68243ae53e4dc618abac 0 +Wizard.DeckCardEdit\DeckSave.cs Wizard.DeckCardEdit\DeckSave.cs 1fd5f1ef0fcb288eb9e28a0dce4796cce3afd61d7d2692e931f83111516825e1 0 Wizard.DeckCardEdit\FilteringCardBundle.cs Wizard.DeckCardEdit\FilteringCardBundle.cs 920e6cb5399277f6f2e2825e6cd5610b5d4dffb50d4c87b540a1d4b53b5d97ca 0 +Wizard.DeckSelect.FirstDisplayPageIndexGetter\FirstDisplayPageIndexGetterBase.cs Wizard.DeckSelect.FirstDisplayPageIndexGetter\FirstDisplayPageIndexGetterBase.cs 40d49191845c1ef7511756a754e18726428eb4a14a4c3e2216cf8f04f4b0b95b 0 +Wizard.DeckSelect.FirstDisplayPageIndexGetter\IFirstDisplayPageIndexGetter.cs Wizard.DeckSelect.FirstDisplayPageIndexGetter\IFirstDisplayPageIndexGetter.cs c0964e222f42a338369b5b77bfa65080dc7cf3b89cf384ae3f6068d982cd2b6c 0 +Wizard.DeckSelect.FirstDisplayPageIndexGetter\QuestFirstDisplayPageIndexGetter.cs Wizard.DeckSelect.FirstDisplayPageIndexGetter\QuestFirstDisplayPageIndexGetter.cs 5e9ccf095c3d5aaa4e48b1de47ca7fc2f933e622ef4463d0861a90b5e1a7be99 0 +Wizard.Dialog.Setting\ItemButton.cs Wizard.Dialog.Setting\ItemButton.cs 534a6040f8beee1a07181aecefb984c7968f12e262332c650f079e3d900443a8 0 +Wizard.Dialog.Setting\ItemGrid.cs Wizard.Dialog.Setting\ItemGrid.cs dcf11b1527c573daea9cbf7cfbb8c10a589ef6c68bed7af13dd21175299f8fed 0 +Wizard.Dialog.Setting\ItemLabel.cs Wizard.Dialog.Setting\ItemLabel.cs 6d738f7192ed4d48e3f6d976282e8c6b61d7de89df0d274109eb52b0d5b55cd9 0 +Wizard.Dialog.Setting\ItemSelect.cs Wizard.Dialog.Setting\ItemSelect.cs 8476cc133b1245660f95957542919f8141711a7f8643fb9bf9847bbce2acf4d0 0 +Wizard.Dialog.Setting\ItemSlider.cs Wizard.Dialog.Setting\ItemSlider.cs cba121f524678e029764be0dc6e5f1d4a4e5962d3db547dcc8d9756f44a6290f 0 +Wizard.Dialog.Setting\ItemToggle.cs Wizard.Dialog.Setting\ItemToggle.cs f4e3ab638edcd310a56da40c48c578fb2d1419836f631fc51927687e9df7c4fb 0 +Wizard.Dialog.Setting\SettingBase.cs Wizard.Dialog.Setting\SettingBase.cs 57bb82b20bdeca249e6991783268f707de706f2e456bfb063714be3af75c3cf6 0 +Wizard.ErrorDialog\Dialog.cs Wizard.ErrorDialog\Dialog.cs 19ca6f8150bbec122121a53c1166ad4fb5634e58c7e233b5be79d3865a2c23b7 0 Wizard.Lottery\LotteryApplyData.cs Wizard.Lottery\LotteryApplyData.cs a1f736b119c42db936962ef4b57821e5f0aaf4ab1458b6c2f92f25c727e4efcc 0 +Wizard.Lottery\LotteryApplyDialog.cs Wizard.Lottery\LotteryApplyDialog.cs 8787f2ff7ae2f2b65a3b8c67419ccaa7bde8cef3345f5b439c5947dec470904d 0 +Wizard.Lottery\LotteryLoadTaskData.cs Wizard.Lottery\LotteryLoadTaskData.cs 4c935c7750aed7c86abc7984c465c869b5f3b6535e0c62925b74e0f9dac5d5c0 0 +Wizard.Lottery\LotteryMissionData.cs Wizard.Lottery\LotteryMissionData.cs 2844dfd64d868c6ee758e9a32c986cdc2ffe9c3d7cefba74f151b3248569a9a0 0 Wizard.QuestSpecialResult\QuestAssetManager.cs Wizard.QuestSpecialResult\QuestAssetManager.cs 13ae6dae3eb9d98368e13a0435e061fa70f0b8a5965c591e3bd41ff16d452947 0 +Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\CandidateCard.cs Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\CandidateCard.cs b89c513435bb4d68607d6d0e5ee95a76144fd0fccb5abdb58b1a73ffed9a7309 0 +Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\CandidateChaos.cs Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\CandidateChaos.cs cfb1306d5d36d0221864b7302fa4f4949faa16c8cd0c4a6421b681e6326b0d96 0 +Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\CandidateClass.cs Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\CandidateClass.cs 1f202e563482a99757b7d6755f8358f7a5efb618eb4efc000b679fc17c7558a1 0 +Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\Deck.cs Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\Deck.cs ba318f314b1dfaf7a4f91cba398751d50aec815246f09500fe8ac6a89f792f8b 0 +Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\EntryInfo.cs Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\EntryInfo.cs 240f12c8b4c21db4e85fcb52da2f13ab106feb581ee0486c350085c9a8bb5336 0 +Wizard.Scripts.Network.Data.TableData.Ranking\MyMasterRanking.cs Wizard.Scripts.Network.Data.TableData.Ranking\MyMasterRanking.cs 242bbba9319329461178b7566f78bc8539daa2f0635afdd81b96d218c33044e7 0 +Wizard.Scripts.Network.Data.TableData.Ranking\RankingPeriod.cs Wizard.Scripts.Network.Data.TableData.Ranking\RankingPeriod.cs c4c4336df8f558569a32bb3286b6c2db262cf1e91a41bf9e7d388981b74db82b 0 +Wizard.Scripts.Network.Data.TableData.Ranking\RankingPeriodList.cs Wizard.Scripts.Network.Data.TableData.Ranking\RankingPeriodList.cs c5b2cb5a25a9f47b2e4b1276b0aa84f60b9136ce60e3ecb40bb0792c46ca2294 0 +Wizard.Scripts.Network.Data.TableData.Ranking\RankingUser.cs Wizard.Scripts.Network.Data.TableData.Ranking\RankingUser.cs bf8b182dc325ae02dd3b9faa88376a2b3d9ebd71720e0c72e6c5300cfac06581 0 +Wizard.Scripts.Network.Data.TableData\ItemAcquireHistory.cs Wizard.Scripts.Network.Data.TableData\ItemAcquireHistory.cs d6af52c75aa667b6e66fc74a8d871c6e611088c3023dbcde5b8a2af70607a5c2 0 +Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick\BattleResult.cs Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick\BattleResult.cs f14525b028d6a24a05d061b11d7a7c5e516340d3c185b0d66fbe559d0fbf0913 0 +Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick\CandidateCardInfo.cs Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick\CandidateCardInfo.cs 4fe633f3232f5a039d12dc15f4344e2f7c010f2f5e10fd846e13464d5679bc17 0 +Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick\Entry.cs Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick\Entry.cs 4b9078e65a0f36aa12ab8285a0d15ea4edeb531c745aacd6a29f0051baa988f8 0 +Wizard.Scripts.Network.Data.TaskData.Arena\Finish.cs Wizard.Scripts.Network.Data.TaskData.Arena\Finish.cs b7cbcb0e8a7113cfb7b7b2fc2921c7049543b5ef8ea14e775afddc44f1b593bb 0 +Wizard.Scripts.Network.Data.TaskData.Arena\FinishDetail.cs Wizard.Scripts.Network.Data.TaskData.Arena\FinishDetail.cs ebe125e8b5c023d06bc825225e77f9688d455bb681efdd156fb808f7223504b2 0 +Wizard.Scripts.Network.Data.TaskData.Arena\TwoPickInfo.cs Wizard.Scripts.Network.Data.TaskData.Arena\TwoPickInfo.cs 8e76e6eca0a1bfae75aace89bb9e3bcd9edba9d5536e2ddc19e88e9b088e3ac1 0 +Wizard.Scripts.Network.Data.TaskData.Battle\DoMatchingResponse.cs Wizard.Scripts.Network.Data.TaskData.Battle\DoMatchingResponse.cs 0333da0ebce1e8f6fec5d43ae0995ed62490be9536dde8868d4e70e0015b7879 0 +Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase\BuildDeckBuyTask.cs Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase\BuildDeckBuyTask.cs bf259e4e745e2e7ca90860e31d9cdafdf3f1b0b81bea289a66c781588007998c 0 +Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase\BuildDeckProductInfo.cs Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase\BuildDeckProductInfo.cs 2db317cebfbedee935a6035145c5c580ce1f4f9ea1b054485c16b8697f4fea6b 0 +Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase\BuildDeckPurchaseInfo.cs Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase\BuildDeckPurchaseInfo.cs 045817a97fbc695eaa151ed8bba8878f1296ff764f3c7967c7f7aa762cb386c6 0 +Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase\BuildDeckSeriesPurchaseInfo.cs Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase\BuildDeckSeriesPurchaseInfo.cs d8aba20b16e641ba45718dafa95bb5bcd20c65417572dcad4a4e6f97fc96d7b4 0 +Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseBuyTask.cs Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseBuyTask.cs 5efb8b505dfdce8f140a7272da996a88f88f6689bce8fa1cc1a7e849ceeedca2 0 +Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseData.cs Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseData.cs 0804c342fc51f32cc6960cf06b9fb48de29b7c63cfe6f97b52b6c0144c872f02 0 +Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseInfo.cs Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseInfo.cs 6a7f437d68999ac72e72ee3b2770792118bc3831d0186e1848885ad863fde0f6 0 +Wizard.Scripts.Network.Data.TaskData.Ranking\MonthlyRanking.cs Wizard.Scripts.Network.Data.TaskData.Ranking\MonthlyRanking.cs ee7df866956e2aedc6236294098a235b1298543040bdb39edfb90d850fb15363 0 +Wizard.Scripts.Network.Data.TaskData.Ranking\MyMasterPointHistories.cs Wizard.Scripts.Network.Data.TaskData.Ranking\MyMasterPointHistories.cs cbe5266fc37e82bdb0c3c094e4cd82681f187e83a6ad8adebdc88a29680deb6c 0 +Wizard.Scripts.Network.Data.TaskData.Ranking\Ranking.cs Wizard.Scripts.Network.Data.TaskData.Ranking\Ranking.cs ec842ab5aac1dad72bba1e0e4722d17648d7ac568cb5795f9cd6703726853f15 0 +Wizard.Scripts.Network.Data.TaskData.SkinPurchase\SkinBuyMultiRewardTask.cs Wizard.Scripts.Network.Data.TaskData.SkinPurchase\SkinBuyMultiRewardTask.cs 46be5d0d3110f7fc0e5f5dc018a89e5780941a759bb6bb4de465756fb124ce03 0 +Wizard.Scripts.Network.Data.TaskData.SkinPurchase\SkinBuyMultiTask.cs Wizard.Scripts.Network.Data.TaskData.SkinPurchase\SkinBuyMultiTask.cs 4af078ea2d4cb897257d781a4a2338f678a95d5a813c705d27bb33540e4f8909 0 +Wizard.Scripts.Network.Data.TaskData.SkinPurchase\SkinBuySingleTask.cs Wizard.Scripts.Network.Data.TaskData.SkinPurchase\SkinBuySingleTask.cs 2cabd30e7d9548558bb3f987a6f99510112896a78e695dc32b89800e0ad1d515 0 +Wizard.Scripts.Network.Data.TaskData.SkinPurchase\SkinProductInfo.cs Wizard.Scripts.Network.Data.TaskData.SkinPurchase\SkinProductInfo.cs c555ffcdaba0fd3a23cce2489064cba939a1757bb56889688ae85c804570e035 0 +Wizard.Scripts.Network.Data.TaskData.SkinPurchase\SkinPurchaseInfo.cs Wizard.Scripts.Network.Data.TaskData.SkinPurchase\SkinPurchaseInfo.cs cd255fc4b2072fbcdfdf57e2c42572fb14fd130cb868cd8125afa457ef9575c0 0 +Wizard.Scripts.Network.Data.TaskData.SkinPurchase\SkinSeriesPurchaseInfo.cs Wizard.Scripts.Network.Data.TaskData.SkinPurchase\SkinSeriesPurchaseInfo.cs 577ccb55ec4ee7509c800664f8ac7cb3896be2d80ca2cd6e3da547da57f7d4ef 0 +Wizard.Scripts.Network.Data.TaskData.SleevePurchase\SleeveProductInfo.cs Wizard.Scripts.Network.Data.TaskData.SleevePurchase\SleeveProductInfo.cs c6dfa9ab00a60bba685246b865a7990c81ab1ad1142cc12763faf28241bdc210 0 +Wizard.Scripts.Network.Data.TaskData.SleevePurchase\SleevePurchaseInfo.cs Wizard.Scripts.Network.Data.TaskData.SleevePurchase\SleevePurchaseInfo.cs dbe4f16b4d7d70531028579c04041a95afbff55c3a21256140b94f014eea04b0 0 +Wizard.Scripts.Network.Data.TaskData.SleevePurchase\SleeveSeriesPurchaseInfo.cs Wizard.Scripts.Network.Data.TaskData.SleevePurchase\SleeveSeriesPurchaseInfo.cs 249c364f08a6f3e574f4b44030aa7c8886abe5538468d75152ae4943e395ef66 0 +Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\GachaPointExchangeInfoTask.cs Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\GachaPointExchangeInfoTask.cs f118ce761c23f0a672ec16dc46d42da486c0950c39edb3e9b21cc02b54262e14 0 +Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\GachaPointExchangeTask.cs Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\GachaPointExchangeTask.cs cd723ac9658b8f5f15bc609f500fd08791734593815ee7f542b949c36eaadad2 0 +Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\SpotCardExchangeInfoTask.cs Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\SpotCardExchangeInfoTask.cs bec97c8be6a014ee2d01e4855dc090022b70119e51856978c8bbe15608336d7c 0 +Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\SpotCardExchangeTask.cs Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\SpotCardExchangeTask.cs 53581da430a338cb178b66c999b918e94ad9910b1f3a817fef051cdd779aecd2 0 +Wizard.Scripts.Network.Data.TaskData\ItemAcquireHistoryInfo.cs Wizard.Scripts.Network.Data.TaskData\ItemAcquireHistoryInfo.cs 4c472401abcddb81bf2cdaaddc6ed0ade73d7da1dfb9f67c3452ee5a4c969723 0 +Wizard/Tuple.cs Wizard/Tuple.cs 2626ed192e620d909de28610153912dcb36f602c54a5a4eda943a2b12bf7fe88 0 +Wizard\AIAccelerate.cs Wizard\AIAccelerate.cs b968700bf63fb47d263662e812270a805011fa53b4b026a5ad15f056d24c1d5d 0 Wizard\AIAccelerateInformation.cs Wizard\AIAccelerateInformation.cs 0b2558c3d4b87221a849f6e5a6622b517c9fad31e500f2f1f04ac1b20545fadc 0 Wizard\AIActivateCountTagArgument.cs Wizard\AIActivateCountTagArgument.cs e834197ddb81a1369cbd4f7ed3e3e5cd265809d0afe7a7e8f5e6313d9c7824d2 0 Wizard\AIActivateCounter.cs Wizard\AIActivateCounter.cs 8cb3ed5c7d1d9ca266ce52425be67168a742605f949c7e60f68b4e728b1fa43c 0 +Wizard\AIAfterAttackBanish.cs Wizard\AIAfterAttackBanish.cs c3104d8bb412cfd2c029eb3899bf6b057d5006b35c466f807e812912437d4031 0 +Wizard\AIAfterAttackDraw.cs Wizard\AIAfterAttackDraw.cs fc68e0b8633582d561d5bec40a74258f4e884dd668c70ff7fe8cd7029eb9f856 0 +Wizard\AIAfterAttackEvo.cs Wizard\AIAfterAttackEvo.cs 249444a75c7dfa090885a1d12f4ff71bf3ac79ea57c64f3c64ffcd89250d0aeb 0 +Wizard\AIAfterAttackHeal.cs Wizard\AIAfterAttackHeal.cs d57e252e03c131f8f53b142287788b69c5d7021dafe5d638866de682fc47e454 0 +Wizard\AIAfterClashDamage.cs Wizard\AIAfterClashDamage.cs 8ef198d626129f3d99f42f05069d26b977fdbe995ce2b378838e710ecf86c35e 0 +Wizard\AIAfterClashHeal.cs Wizard\AIAfterClashHeal.cs c427d5743be7b87f443ba8aabee6d1fbdbc5b25cf6ca43b2c1b06801d85fcf57 0 Wizard\AIAfterDamageStopCollection.cs Wizard\AIAfterDamageStopCollection.cs b98d31ef1308d6261f4c783fabf0a9a5b01e22b034986559c155c0fb81a2b247 0 Wizard\AIAfterDamageStopInformation.cs Wizard\AIAfterDamageStopInformation.cs fb0e9d053208527fcda7d2b11e8e1488a3ce970519c2b132d0579011c57a7fe1 0 +Wizard\AIAllyDiscardBonus.cs Wizard\AIAllyDiscardBonus.cs 196fa75baa918cac67dc23a28af4feb70a13409b09922c0840a2b53844aa2d62 0 +Wizard\AIAttachEventToBattleModuleUtility.cs Wizard\AIAttachEventToBattleModuleUtility.cs d48a79e6e2e81299804af7c8267ec0add85194aebc85fbf024345c407012139e 0 Wizard\AIAttachOperateMgrBattleEventCache.cs Wizard\AIAttachOperateMgrBattleEventCache.cs 53f76574938d64f03f0adc0964cb8de4a133a37276c2643f81bec99ca932d27c 0 Wizard\AIAttachPlayerBattleEventCache.cs Wizard\AIAttachPlayerBattleEventCache.cs 787f446c803ef676c8c4a7532228a57f65077d515c7e90eb787de3d3db728662 0 Wizard\AIAttachedTagCollection.cs Wizard\AIAttachedTagCollection.cs 6a93e39cf4f6135437938199c00a4c5a6824b7a874d4a1b4f520a74978890dde 0 Wizard\AIAttachedTagInformation.cs Wizard\AIAttachedTagInformation.cs 28169a7a9572155b3cf4da0238c4f9cdc00f07f0bbced0d310b7c1fdb6429846 0 +Wizard\AIAttachedTagLeaveStopInformation.cs Wizard\AIAttachedTagLeaveStopInformation.cs aee4d87a07619a81e3dfe382758779fa63fbb5fedac1cf1248b42aed407cc303 0 +Wizard\AIAttachedTagStopPreprocessOption.cs Wizard\AIAttachedTagStopPreprocessOption.cs 49861cec432487f26c2f0b964e2f988a9d79182dab8e619933a67d1a99efb03c 0 +Wizard\AIAttachedTagTurnEndStopInformation.cs Wizard\AIAttachedTagTurnEndStopInformation.cs c746fb138d1c8ea3c8a6f7775c2d1c6518256f661fcf6a3c0be61b99b3ba75b4 0 +Wizard\AIAttachedTagTurnStartStopInformation.cs Wizard\AIAttachedTagTurnStartStopInformation.cs f26f68ea5ec78036693ea4eabfb518424ba97501eb6a6e271b6d0ce6b920363b 0 +Wizard\AIAttackAddDeck.cs Wizard\AIAttackAddDeck.cs 679db2aa9bcb29bff4de837ee2a93d5449b7e82c6a31e61665f6c6c3a8d8fc0a 0 +Wizard\AIAttackAttachTag.cs Wizard\AIAttackAttachTag.cs 01d7aedc13f739be7ace10d2ef4ba0a0871a355b79db8819d3c4b2162540345f 0 +Wizard\AIAttackAttackableCount.cs Wizard\AIAttackAttackableCount.cs d37946f15d3a5b2e4f0080a875ac3ffe3cafb5b5ade2346d23ba1f4ae18143b3 0 +Wizard\AIAttackBreakAttackTwice.cs Wizard\AIAttackBreakAttackTwice.cs a1b71ec5a31b4c91d9d3928764deb30346db4fcd0b1cdddd9ef203723786c0e0 0 +Wizard\AIAttackBreakDamage.cs Wizard\AIAttackBreakDamage.cs 606606e0660a1823e271e8e385ccbde29139a99ccb82f91c6470fc82373d490f 0 +Wizard\AIAttackBreakEvo.cs Wizard\AIAttackBreakEvo.cs 52954b1c903cf6ea0d15eebe066a9f925d20acfa30427a77a857e81300afff56 0 +Wizard\AIAttackBreakRecoverPp.cs Wizard\AIAttackBreakRecoverPp.cs b12aec447bd811b506ba9bc5adaaa854f06fdb2894bcf72f6839186b324b2d01 0 +Wizard\AIAttackBuff.cs Wizard\AIAttackBuff.cs 699c251c55b77448ebed0f7b4b20b1a97d3ddb95d7a03288ddc714f0113620ed 0 +Wizard\AIAttackDamage.cs Wizard\AIAttackDamage.cs a5e1210bb8f80e703e44635a0599cf7efa940ded1647cf6ac2ef69d0a3fc8ad7 0 +Wizard\AIAttackDestroy.cs Wizard\AIAttackDestroy.cs 992c6ddcdd3e247918eb7b378d8eae3f505567f3950a2006b836fbcf05a8d442 0 +Wizard\AIAttackDiscard.cs Wizard\AIAttackDiscard.cs 50bbc5a3a87e3e6d41c445fa4d59dc265397509da9a0fccd9e2316110cf5895d 0 +Wizard\AIAttackEvo.cs Wizard\AIAttackEvo.cs b31c69e6dba35a05f730eb7ba7f4a5792e9958b1f5ef5a13fcda70ecf5a91b60 0 +Wizard\AIAttackHandBuff.cs Wizard\AIAttackHandBuff.cs 33e198f48ddf9b92985547738d624da6dadf19783735145e7c7bf2dbc475c109 0 +Wizard\AIAttackMove.cs Wizard\AIAttackMove.cs d939cfd365789f2d7ccab802c9ded5eced396c18f12ce8f7348912c22fdc0425 0 +Wizard\AIAttackOrClashBanish.cs Wizard\AIAttackOrClashBanish.cs fe208924c5ce2b022afa6b35e7b1b1eda8e7eed4c14b6300ff5efaad2c560816 0 +Wizard\AIAttackOrClashBarrierBase.cs Wizard\AIAttackOrClashBarrierBase.cs 7e42c36c5926e4d5c2e982516f24671f01c56b27b3e16a474c31c6af5e4ad5e1 0 +Wizard\AIAttackOrClashDamageClip.cs Wizard\AIAttackOrClashDamageClip.cs 49f8bbf454c97407c9613a50ea1587a575e3dd56fa37c0b00027192e7f9b9098 0 +Wizard\AIAttackOrClashHeal.cs Wizard\AIAttackOrClashHeal.cs 0b1b87694d3e118a14ce386f279aea253f98e749f7a813931a00c8879408d508 0 +Wizard\AIAttackOrClashKeywordSkill.cs Wizard\AIAttackOrClashKeywordSkill.cs 55126b33491466e606671856e500e3879d709dd176c21970b11c361275755772 0 +Wizard\AIAttackOrClashRemoveSkill.cs Wizard\AIAttackOrClashRemoveSkill.cs 0bdb4581b042a81cead22998f61202b08195a2511da5c6a563e2b6b08b92f296 0 +Wizard\AIAttackOrClashRemoveTag.cs Wizard\AIAttackOrClashRemoveTag.cs 3d2fafe1c8e8fa901ef413ac03cc39929c8d812178e2dbb0c3b24d963be6b76f 0 +Wizard\AIAttackOrClashShield.cs Wizard\AIAttackOrClashShield.cs 73f30bfdf0a4e020c8ace60f99b1b570f492f7be0222c842d428757ecf376ee4 0 +Wizard\AIAttackOrClashSpellboost.cs Wizard\AIAttackOrClashSpellboost.cs 5fafa0a2b32bf947fa20fbd0218d35d8f0b2d1f42bff6819c1cea591afcf20b9 0 +Wizard\AIAttackOrClashToken.cs Wizard\AIAttackOrClashToken.cs 6443ab61b95ae82a7ce168935f1e988b6985e93f06a3268971990ed805539496 0 Wizard\AIAttackPreCheckInformation.cs Wizard\AIAttackPreCheckInformation.cs 763002d0cbfa6c60fdaabe638adebd991b731619cb317f038301519c55881b12 0 +Wizard\AIAttackSetStatus.cs Wizard\AIAttackSetStatus.cs 736682150d64d0d8e6ecc900ec8448cac0d41e71a835eed8e7d68c557309443b 0 +Wizard\AIAttackSimulationUtility.cs Wizard\AIAttackSimulationUtility.cs 0aa8c77eed1de633fb98c069e5db89724ee6b3cefa808b350a33f5b05a1ac509 0 +Wizard\AIAttackSubtractCountdown.cs Wizard\AIAttackSubtractCountdown.cs 035772aca15d7f5adc5846a3fd9fd186b9a9588681c2234bd20cb60ae4182cad 0 +Wizard\AIAttackTagSimulator.cs Wizard\AIAttackTagSimulator.cs 3b086bc42857efdea4eb3568feb288219d0015646db736970bbcba4b86a623d2 0 +Wizard\AIAutoEvolutionSimulationUtility.cs Wizard\AIAutoEvolutionSimulationUtility.cs c34536971c0496eb7381353f92da164f6c4cec3c15ab41c74c9e5ea0d2bbc9cb 0 +Wizard\AIBanishAttachTag.cs Wizard\AIBanishAttachTag.cs 57811f7c612b1c2b5db229d590a4f588b5d7220bc481d39c08f1e941f4c7ce19 0 +Wizard\AIBarrierAfterDamageStopInformation.cs Wizard\AIBarrierAfterDamageStopInformation.cs e6289342559d0e92ca5dc09d610a4e0483b61fd41808ee3bccc5519664cd5ac7 0 Wizard\AIBarrierInfoBase.cs Wizard\AIBarrierInfoBase.cs ba0998c9b29c1e158df7e649c52c4611fa820905840a89afc79e6a966f7290c9 0 Wizard\AIBarrierInfoCollection.cs Wizard\AIBarrierInfoCollection.cs 373046001ab854a988dd8e6e18b0d7727650bf5fa334ae83de77322265ef7e5c 0 +Wizard\AIBarrierLeaveStopInformation.cs Wizard\AIBarrierLeaveStopInformation.cs 0e1fefc666e2c62875378838c117a70c448b2ac350be5ecff4be3cab5cd79d52 0 Wizard\AIBarrierPseudoSimulationInfo.cs Wizard\AIBarrierPseudoSimulationInfo.cs cb2f36694001eda21a03ca2292914d8c75c43ed2cf50b950c46d9409599c3866 0 +Wizard\AIBarrierSimulationUtility.cs Wizard\AIBarrierSimulationUtility.cs 25f4adb422e76b939cc2e2bff8c15274a48f866df0357d30e0c7052c78c3f4e5 0 +Wizard\AIBarrierStopPreprocessOption.cs Wizard\AIBarrierStopPreprocessOption.cs 9c3dc62c46672911ebecfc76fe5632d171636131795bbb06f882b91cee205c5f 0 Wizard\AIBarrierStopTiming.cs Wizard\AIBarrierStopTiming.cs e0f3f5691214baa3bfa42b7d2333d05cbeaa43b962f6e58ba94e347173fec931 0 +Wizard\AIBarrierTurnEndStopInformation.cs Wizard\AIBarrierTurnEndStopInformation.cs 4b6dc18461b2143dd40f16cb9623e2142d5dacd5ecd5ba7e355fc408524f1440 0 +Wizard\AIBarrierTurnStartStopInformation.cs Wizard\AIBarrierTurnStartStopInformation.cs 3426c5d64e8df071247ed8443ae80e372c93d4ca52612209e999c232747c3536 0 Wizard\AIBarrierType.cs Wizard\AIBarrierType.cs 7e0ddaa801358ddeea09c87eb884102628547554b021d3e8bf307de506e0211b 0 Wizard\AIBattleInfoReceivedData.cs Wizard\AIBattleInfoReceivedData.cs 48ba9398d89504579620ab39ac385ccda44e78d0b2b224a0ba76302cc5630b0c 0 +Wizard\AIBattleInfoReceiver.cs Wizard\AIBattleInfoReceiver.cs 4a52d7928b4a3fe7c7458d246f5533c2ddc6e7d47d0cf4dae88226d425e847fd 0 +Wizard\AIBattleSimulationLauncher.cs Wizard\AIBattleSimulationLauncher.cs 1bd420df5a8a23adcfc63b28b0ba2551aec18d549ca9eea2d8cf38ec015fa23a 0 +Wizard\AIBattleStartData.cs Wizard\AIBattleStartData.cs 321bee5cb5a1307e6f2da4e1487505aecdfbe9287c27d219dea4e8badcc733c0 0 +Wizard\AIBattleStartDetail.cs Wizard\AIBattleStartDetail.cs 060079ca989403316030a71186260e941acd28483f1f53e2e9c6b69b2b56ab05 0 +Wizard\AIBattleStartTask.cs Wizard\AIBattleStartTask.cs 3edb64aa5b558f98d14dcc2c955c30040b582ce1b55df0c5eec4d7536e105304 0 +Wizard\AIBestFusionPatternCalculator.cs Wizard\AIBestFusionPatternCalculator.cs 7f7abb65ee082eb6088e9c9af62125c67b4a8ae1fc328d78d13d95fe1e9d83d4 0 +Wizard\AIBonusArgumentWithIgnoreInBattle.cs Wizard\AIBonusArgumentWithIgnoreInBattle.cs 30f2046fa75d14d9c5b6d79c635f6a843e14927f84cac331166cd9311668a643 0 +Wizard\AIBounceDamage.cs Wizard\AIBounceDamage.cs 7518199405f37f3c45a1ea7ce843011a6724ace751e01d416916028eb234e414 0 +Wizard\AIBreakAddStack.cs Wizard\AIBreakAddStack.cs ea721e2f1253f7cb3c3119a90ee844738c6e3caed814e2b17e70daaf01e3a146 0 +Wizard\AIBreakAttachTag.cs Wizard\AIBreakAttachTag.cs 5307ac9768a0a1b12229a8125d38b1f4fd2376ba754dd8d9703c74d344f86edb 0 +Wizard\AIBreakBuff.cs Wizard\AIBreakBuff.cs 6d47b098d9782f7ee639473a201ec2e31f95ce6efcb9d8b1d955e04d8d2081dc 0 +Wizard\AIBreakDamage.cs Wizard\AIBreakDamage.cs 9e54b9d2b1d411c551db7d9f9071c56bab00b8ec838a83e8d6b83fa3dc53065a 0 +Wizard\AIBreakDestroy.cs Wizard\AIBreakDestroy.cs 3d0e27eb5aba855dcc76aa8cff219cc9bcdf19955c0e429edd28251b6b0aa441 0 +Wizard\AIBreakHeal.cs Wizard\AIBreakHeal.cs 770375c56c5f9fd3a42b13d25732e5c5853f10186a0addeca4ffd91f3b4135dd 0 +Wizard\AIBreakRecoverAttackableCount.cs Wizard\AIBreakRecoverAttackableCount.cs f86af23cb2477c8ddeba56c88588d2bad7a1beb7296b10c3aaab80bfed1b84ec 0 +Wizard\AIBreakRecoverPp.cs Wizard\AIBreakRecoverPp.cs 3333bb5e65c041b666ad6088fc0b08d429d9a68b7ba01e1a01481fbadcae46e5 0 +Wizard\AIBreakSetLeaderMaxLife.cs Wizard\AIBreakSetLeaderMaxLife.cs 4e6630d1068282ed735ae241962ef51f7749b9e19943b09d65c2b115697c09a2 0 +Wizard\AIBuffBuff.cs Wizard\AIBuffBuff.cs 0f2ccca224ce09de170fcf2bc0e5fde4f069ccbc7fd44725623e29723751e22e 0 +Wizard\AIBuffDamage.cs Wizard\AIBuffDamage.cs 7ee38cc3732653719265bf1593daacb0b0d2fb5dd4ab376c60e3eb71c9fd2b28 0 +Wizard\AIBuffDestroy.cs Wizard\AIBuffDestroy.cs bf850f2d3f00c07409fb4b970ec207901805efb79b2ed323aefdff89496a3a6a 0 +Wizard\AIBuffDraw.cs Wizard\AIBuffDraw.cs 8b5334986c650674a2c49270fa872513699067d2eb4103e29cb53f996170408e 0 +Wizard\AIBuffEvo.cs Wizard\AIBuffEvo.cs 82caa790a4743982529a599270b980c1689b0b57e4c6f817dd0d3bb5787f6b98 0 Wizard\AIBuffExecutingInfo_old.cs Wizard\AIBuffExecutingInfo_old.cs 402c325b09513f06789bd7ef919604d6e8274bbaf5b79693ab2c00962faff18e 0 +Wizard\AIBuffHeal.cs Wizard\AIBuffHeal.cs d211245ba4d4dd4924fc7667d442f92542e64e3eb8a7dacc111b9b178c35efc2 0 Wizard\AIBuffRecorderCollection.cs Wizard\AIBuffRecorderCollection.cs 6c61fc8962bef66dc3002e46fe7eeccabdb0e05a5cc3866ed548380da1e1f784 0 +Wizard\AIBuffRecoverPp.cs Wizard\AIBuffRecoverPp.cs 20caf8d39bbe4320fb1233a59162a45751352ce41f3d80b64d8713b3f189efa4 0 +Wizard\AIBuffRush.cs Wizard\AIBuffRush.cs 6c82e72d90630b7f70197ee3a1cf1d4a7f5e3dcf4b62d70280c949536ae3b4be 0 +Wizard\AIBuffShield.cs Wizard\AIBuffShield.cs fdd68d9ecb56f81c1722e7218b7c77785192d9f339c3c92e7d9de3e9ab647a60 0 +Wizard\AIBuffSimulationUtility.cs Wizard\AIBuffSimulationUtility.cs b7195680120dd60a8625718db7bbef995e323cdad970f3697ea9cd69af4290c4 0 +Wizard\AIBuffStopPreprocessOption.cs Wizard\AIBuffStopPreprocessOption.cs 98cee29a3c83d30cdee435b6fd424074ef33c5b35d08a47217c82a448448fbb8 0 +Wizard\AIBuffToken.cs Wizard\AIBuffToken.cs 694c9ca4c8d9047b0f97d72d0ad56ed8b74fe15c334767057532c59ac8f41b9c 0 +Wizard\AIBuffTurnEndStopInformation.cs Wizard\AIBuffTurnEndStopInformation.cs e7493368d46683b05f3940c95865f153b0c92babd84ad8575905dc53434865d4 0 Wizard\AIBuffWithTargetsInformation.cs Wizard\AIBuffWithTargetsInformation.cs 8badcf2dafc38e5b49cec01b5dfd253c04477e313844a624ddff26168a195bc9 0 +Wizard\AIBurialRite.cs Wizard\AIBurialRite.cs 4b7dc32e0ed2f804e4ba881945af9c0ba79601ed17025fc242c61c4bc30bcd00 0 +Wizard\AIBurialRiteSimulationUtility.cs Wizard\AIBurialRiteSimulationUtility.cs fd8af5f6948161b46876858d62160db6f541bdd7f622b4e7d3d860784e6c0e7f 0 Wizard\AICannotAttackInformation.cs Wizard\AICannotAttackInformation.cs 338fdbc7e7a727c3c0ebfda141698d0bc19c3958d303f21bf92d188925c4b1ba 0 Wizard\AICannotPlayInformation.cs Wizard\AICannotPlayInformation.cs 640571c76dd20a995018041244934a9f71d33e766bb4f6067f49a327028b4f9a 0 Wizard\AICardData.cs Wizard\AICardData.cs 7ef51bfa266263adb76e3b8e75ca6de4f607cb669ea29c778a2482cac8cc1e93 0 Wizard\AICardDataAsset.cs Wizard\AICardDataAsset.cs 39d4e3ac7e97b8b32b337eb696c8fca45a04a9cfcfbd0239a86d0a3dbd41b1c9 0 Wizard\AICardDataAssetSet.cs Wizard\AICardDataAssetSet.cs 49bccb382d26f636277f90f5e0d638ff4c3a0a784c327885f5d5c9930098bbfc 0 Wizard\AICategory.cs Wizard\AICategory.cs b4da86a28aac7ddb1151eb23521329e068b48274a6c4ca657975be7eb3e1be97 0 +Wizard\AIChangeInplayAttachTag.cs Wizard\AIChangeInplayAttachTag.cs 03284c1fb64f8b8dafa4e2f4aa0ab89d7318ac9f35aa6bf3f7d76715cc1f3d9d 0 +Wizard\AIChangeInplayCannotAttack.cs Wizard\AIChangeInplayCannotAttack.cs 9263120fece290ef5721e409b44b0f7565e76990b6384db04b41a94f95c7e025 0 +Wizard\AIChangeInplayCannotPlay.cs Wizard\AIChangeInplayCannotPlay.cs ea0f6b06dc4d3e1848de34c48ca2661ece00dee8bc8377a9b1e45808f08290ac 0 +Wizard\AIChangeInplayFixRemoveType.cs Wizard\AIChangeInplayFixRemoveType.cs a89d34ab78211c5982b01a8b1a9184758d6e42967eac06de8476e23e6f85d7ff 0 +Wizard\AIChangeInplayImmediateBarrierBase.cs Wizard\AIChangeInplayImmediateBarrierBase.cs f9996fad09197c6ebaa7d9652ff06597d9e260f25d23b9411bc1fe0b27b2468e 0 +Wizard\AIChangeInplayImmediateDamageClip.cs Wizard\AIChangeInplayImmediateDamageClip.cs 2eb533231ccaaa1faa13af9610a33a1f5a63eb00247f52efd48237c5247d68bf 0 +Wizard\AIChangeInplayImmediateDamageCut.cs Wizard\AIChangeInplayImmediateDamageCut.cs 3859762c77e590198831f3d5791c18d5fed1b0b0493b10e11a0ef566c493d7f4 0 +Wizard\AIChangeInplayImmediateDamageModifier.cs Wizard\AIChangeInplayImmediateDamageModifier.cs b9c0a56043bede3e20186b94ae2caa14c7bb89fb9b6774c13a4fe575cf2da6a6 0 +Wizard\AIChangeInplayImmediateIndestructible.cs Wizard\AIChangeInplayImmediateIndestructible.cs 5d4a5b7ad333253b21310144fa46b5f5a630f610768e60850f79453f87c8f0eb 0 +Wizard\AIChangeInplayImmediateKeywordSkill.cs Wizard\AIChangeInplayImmediateKeywordSkill.cs 4998575f2863f6e054a2398646c10fdd475a3bd02fab7fe1c21967a27c97dfb6 0 +Wizard\AIChangeInplayImmediateLifeLowerLimit.cs Wizard\AIChangeInplayImmediateLifeLowerLimit.cs d7a7077b3d381743d12b2c72c24a34acc3a8b837b74a6515cd86d0ff7fc59987 0 +Wizard\AIChangeInplayImmediateShield.cs Wizard\AIChangeInplayImmediateShield.cs 614b4506e5069f85bf74fb26b65807cd1529a5932fe82e6add22c8504c06635f 0 +Wizard\AIChangePpTotalBuff.cs Wizard\AIChangePpTotalBuff.cs 61afdbebd05f5d474510448737a6ee0f5aae8705402669e631f909c36cc5a72a 0 +Wizard\AIChoiceBrave.cs Wizard\AIChoiceBrave.cs 5fb029119fae61e8cbe203ef39fdede10123781a5b90401293aaf8312d35f2d9 0 +Wizard\AIChoiceTagArgument.cs Wizard\AIChoiceTagArgument.cs 58ea361f0584153c52a6c467e478d788047f82569359328d8d6171afc06c5018 0 +Wizard\AIChoiceTransform.cs Wizard\AIChoiceTransform.cs 9e65d0b7ab4ba4e1fa0b7d3cc707f05c28d0c9dfc7e89a2fb629b1f9a4a1aaad 0 Wizard\AIChoiceTransformCostInformation.cs Wizard\AIChoiceTransformCostInformation.cs 1e2066a8f30d209f4bb9c3902346130fc52125acca52ace2f56f5cad02bca05c 0 +Wizard\AIChoiceTransformUtility.cs Wizard\AIChoiceTransformUtility.cs e605fe9fd76f360bd021aba4ac25b6b7f72aea0bc3794da40c2caa09e3520034 0 +Wizard\AIClashBuff.cs Wizard\AIClashBuff.cs 3f7683b4dc1248eabbe9302dfafff5ea3a9eaca4d1c9bb635846a903cc47c1e0 0 +Wizard\AIClashDamage.cs Wizard\AIClashDamage.cs f1fdf591443cfaa0aabf59c62366998ee7cf00e831db6ac80cf6995833d408fc 0 +Wizard\AIClashDestroy.cs Wizard\AIClashDestroy.cs f0a94ed3646cd3970aef93d73a59fbd74b4656699e5dde837e418d93690a8e5a 0 Wizard\AIConditionExpressions.cs Wizard\AIConditionExpressions.cs da8d0450cbe4022236a9d2ca429812bed7f595d357d70564c53a69b0dec9b600 0 +Wizard\AIConsoleUtility.cs Wizard\AIConsoleUtility.cs a859968ba37940f6e856df57c437f23be3184d520c5ac1a73d556dfe7e7b6adb 0 +Wizard\AICrystalize.cs Wizard\AICrystalize.cs c8e0ae57029f6ab4dcaf4975bab5d2b951a90e43c0f5fcbb050e489d91a0ab76 0 Wizard\AICrystalizeInformation.cs Wizard\AICrystalizeInformation.cs 6375ba72325ef0be913a9f10efa7f67ede4ec67d01f1df5d44e2f4f05a12d959 0 Wizard\AICsvLoadingInfo.cs Wizard\AICsvLoadingInfo.cs 0800e6d793b8c2c9d157d67a31aef7e4df2e954e46c07afbbe2f5e481c521f20 0 Wizard\AIDamageModifierCollection.cs Wizard\AIDamageModifierCollection.cs 37e1407dd6350d13fc1ace8f1c7a447603d5d2c1ead2241a945ff91cebfd7622 0 Wizard\AIDamageModifierInfo.cs Wizard\AIDamageModifierInfo.cs db83f7ebc48e6b921c7124f5a01b8ac3b94fef4576f4ca05a1c8c9bf4fb0908a 0 Wizard\AIDamageType.cs Wizard\AIDamageType.cs 53e9b9bb6ff6f24b08e3a417f891d03e03c4d410a00593aea5cdc61e43d65508 0 +Wizard\AIDamagedBonus.cs Wizard\AIDamagedBonus.cs 9134ab8fb84118f55682a75f39015503c44132560ed39798e9fbfccb435f12f3 0 +Wizard\AIDamagedBuff.cs Wizard\AIDamagedBuff.cs 057d87109592a4b24e309b7403f09e5424c50b62c1e1852ede206a76a29619d4 0 +Wizard\AIDamagedCantUnderAttack.cs Wizard\AIDamagedCantUnderAttack.cs 162a0adeeb76af3979528401f6c89e1efca26d328ffddc33f4caa69dd3b4fa45 0 +Wizard\AIDamagedDamage.cs Wizard\AIDamagedDamage.cs ad68679f571568115384b4464674f3ba784166caf0a6c97a26794f89ad6fde59 0 +Wizard\AIDamagedHeal.cs Wizard\AIDamagedHeal.cs 1544b066c01ea05ff20b74e1e1b25e14cdf166bb50507fd25c63c763429bf4dd 0 +Wizard\AIDamagedToken.cs Wizard\AIDamagedToken.cs 214c603b590c92add11225962f08311a83343d98b52be7c94415fd1c21494d4d 0 Wizard\AIDataLibrary.cs Wizard\AIDataLibrary.cs 6d7575b5f6fb9598ad0756fa07fab30804d846a8efc0a6290f7156f2b0f2aac7 0 Wizard\AIDeckAcccessor.cs Wizard\AIDeckAcccessor.cs cb0ec83c0cea9f3fe95f8f6cdd3cd5bb5e52338dd3e095dc89685782c7b34ef1 0 Wizard\AIDeckData.cs Wizard\AIDeckData.cs 6b07e0390a656f1e9d4cdf8127f5ab1a68fa1b99633b60ec8c6ea416b84a597a 0 Wizard\AIDeckFileNameList.cs Wizard\AIDeckFileNameList.cs e04bd8c0739e473ed6cc8d6ed7d5058ced48647f143b46fe7b8fbcd98335485d 0 +Wizard\AIDelayTurnEndTime.cs Wizard\AIDelayTurnEndTime.cs e15eafcc0ec1c99d21f3a03538f5cc237c14967a5d3178b40fece0168bd292a2 0 +Wizard\AIDelayTurnEndTimePolicyCollection.cs Wizard\AIDelayTurnEndTimePolicyCollection.cs fbd30d31b3b4972abbdef8bf7b8e156ba7b73b7ed0e024d5e0a8708c956ec612 0 +Wizard\AIDiscardDamage.cs Wizard\AIDiscardDamage.cs e6b852686c5ce2915390e4e44abfa43363020b369a1eb13e1d78143fd179871b 0 +Wizard\AIDiscardHeal.cs Wizard\AIDiscardHeal.cs af7b72472155d064cedead3ad6b7872fcd3a420ae80328ca78f6e3dfed81bb20 0 Wizard\AIDiscardInfo.cs Wizard\AIDiscardInfo.cs 8d26fd1c9bb13f6684bf7be6e44ca974728a6c8b072fbc731c5068727a533c83 0 +Wizard\AIDiscardUtility.cs Wizard\AIDiscardUtility.cs 02fb62c479a4154fe15ab2c07e1aca3c042881895de255cdc5a01b866d75b430 0 +Wizard\AIDiscardedToken.cs Wizard\AIDiscardedToken.cs d3e7e33406d9d502816145eb7cfe1be75d498a5e78f4a432224d2e38df32c705 0 Wizard\AIDummyDeckContainer.cs Wizard\AIDummyDeckContainer.cs 4dce0c7e7933f388a5c3c60d2a03c6df318f0c60c9fa5a49007decd5dde63e0e 0 +Wizard\AIEarthRite.cs Wizard\AIEarthRite.cs 248c094baae5a18c6605cef2209a90cd10e5323ee9ec64ef599c5612057a4667 0 Wizard\AIEmoteCmd.cs Wizard\AIEmoteCmd.cs d71aa0e4310ad191cad59c02944644559e215e9bf5294fe58664484e6b9301cb 0 Wizard\AIEmoteCmdType.cs Wizard\AIEmoteCmdType.cs b756e835578b5964ae2bc82abdb0271223d91864199ba2bce00d3bf5d35ac7db 0 Wizard\AIEmoteCtrl.cs Wizard\AIEmoteCtrl.cs a98c88d9fc68bea88b332865348091d6b1b9afa489316dca836f091952d93d24 0 Wizard\AIEmoteDataAsset.cs Wizard\AIEmoteDataAsset.cs 2019e29004374a2cfc31de144e218b219e2b4463fcbf212c83fc3f1c23ed4359 0 Wizard\AIEmoteFileNameList.cs Wizard\AIEmoteFileNameList.cs de751646c462492238ec484d68e12e9fdf3445ca5d7891c6c13e5f5ccbfef6c2 0 Wizard\AIEmoteMng.cs Wizard\AIEmoteMng.cs 9903c0649369f0ce0868056982734601c85d807c1b967b2450f964c5de8d3c76 0 +Wizard\AIEmoteOnTurnTransition.cs Wizard\AIEmoteOnTurnTransition.cs 4dacdc512161efb4603f2323eedbb0e8a0f98d8f72ced7ca9fe78388831f249b 0 Wizard\AIEmoteQuery.cs Wizard\AIEmoteQuery.cs 07980237bee820ce3f47d46ae92ccecee4c9dc322e6633be878f5f611e41a720 0 Wizard\AIEmoteSet.cs Wizard\AIEmoteSet.cs 45a051f97c432fa36e6f9fc545c59a086e9e5537fb040c62da8418870eeeb967 0 +Wizard\AIEmoteUtility.cs Wizard\AIEmoteUtility.cs 4c00dc9aac6f900f239d54a228c6c7e47c6ac38f0d3566667773e14b0c8aab5b 0 +Wizard\AIEnhance.cs Wizard\AIEnhance.cs 4a63aceb5e794cfe4027ca6ddd7c2115757f8251ca9d6ebcfa271b900776d8b9 0 +Wizard\AIEvaluateBonusFromOhterUtility.cs Wizard\AIEvaluateBonusFromOhterUtility.cs 04f2c2238706195efba507979301c5425bb4bf859d27e8bf285cdc3fa48243dd 0 +Wizard\AIEvoAddDeck.cs Wizard\AIEvoAddDeck.cs 73d24f4e7ff1c018e12577d3a2edef042bd93d91bf23697999e20a969cbd896e 0 +Wizard\AIEvoAddStack.cs Wizard\AIEvoAddStack.cs 509352d63728ccef9a6a8391a6771891f4af39eeed7a0c3c4522b4f2138e004b 0 +Wizard\AIEvoAttachTag.cs Wizard\AIEvoAttachTag.cs 018c10dd399948d61a737df4463d0de9f342ca58b74d0e3b5d834351e1b62485 0 +Wizard\AIEvoAttackableCount.cs Wizard\AIEvoAttackableCount.cs fdd273597041407819f00209d1e3df83eea058cd8e457d703950f18942353c9d 0 +Wizard\AIEvoBanish.cs Wizard\AIEvoBanish.cs 0dc65005579efb7b6aa02d11c1585e1d8fae02d55d90379e7d348861fa1e77f1 0 +Wizard\AIEvoBounce.cs Wizard\AIEvoBounce.cs 6c01f18886125b5034709226e59866b88bb75dc50311e57ad233fa384ab2bd6f 0 +Wizard\AIEvoBuff.cs Wizard\AIEvoBuff.cs f0da5bc41b20bdd3de5f9d0e58a1b0947d4ef942486981105fb3a9b263ff76d7 0 +Wizard\AIEvoChangeCost.cs Wizard\AIEvoChangeCost.cs 957e4264c768226b447635647a9ed5e3c74ad162c42e4e81be0db99a54e6a271 0 +Wizard\AIEvoDamage.cs Wizard\AIEvoDamage.cs 8b4f4d07d970af3bb01d41d72ae16d4a50380497386416e94f371226d1592214 0 +Wizard\AIEvoDamageCut.cs Wizard\AIEvoDamageCut.cs de790fb47894b2ab65f7eb45657cb3f60a7047eb024508ec54d648cfcdf2fcc3 0 +Wizard\AIEvoDestroy.cs Wizard\AIEvoDestroy.cs 68ec438bdcb1b88cc3b79dadb58cc7e8b2104b49c01a50554580e52a1bace0ba 0 +Wizard\AIEvoDiscard.cs Wizard\AIEvoDiscard.cs 9cfe58f38a1e564094ec1131ae81681b1a4d57c3ee3f97244f794b383aafb897 0 +Wizard\AIEvoEvo.cs Wizard\AIEvoEvo.cs dd13ef6c44b9db3d6d435d23db22967f022853a777a592c595c6e96df622bdc0 0 +Wizard\AIEvoGiveBasicSkill.cs Wizard\AIEvoGiveBasicSkill.cs 9f102f719876db5d7a8727332273131c83732752f9759da5aeeed60888d53fa8 0 +Wizard\AIEvoHandBuff.cs Wizard\AIEvoHandBuff.cs afbcad7611a8d7c46cc98434bd0edf6c50e918c2ce4352996ef721455c277a8c 0 +Wizard\AIEvoHandMetamorphose.cs Wizard\AIEvoHandMetamorphose.cs d93c42ae05f222c81e992f58a88a6ad93235731d39fdaf435752a648f252d282 0 +Wizard\AIEvoHandSelect.cs Wizard\AIEvoHandSelect.cs be98337fdf9ab1b22f2ebff9d767e66d0c7dc986b186d00ca042ed6665e94594 0 +Wizard\AIEvoHeal.cs Wizard\AIEvoHeal.cs 6e14ae588efeef734f7273eb89c02fe6ac45ffa7ed16c8a983708935c46a9efd 0 +Wizard\AIEvoMetamorphose.cs Wizard\AIEvoMetamorphose.cs cddd2944e901b3d8634d25752c4caf4b438a91aba337d5f33a06bb6434be87db 0 +Wizard\AIEvoReanimate.cs Wizard\AIEvoReanimate.cs 59b4e87cfdd425d6962f25ba08c40d903bcaa738f227c6d21d04863b3d3e5dfe 0 +Wizard\AIEvoRecoverPp.cs Wizard\AIEvoRecoverPp.cs bf07a99fca941c3a2e7789311a98a78523312ac49906a3889493f94ef3829f02 0 +Wizard\AIEvoSetLeaderMaxLife.cs Wizard\AIEvoSetLeaderMaxLife.cs 80cc8a03b6a7d3376d098f935492bd24ce935d10a076241d70e08423969b58d9 0 +Wizard\AIEvoSetStatus.cs Wizard\AIEvoSetStatus.cs 952b8eeab9de1f238926d785b3b6876fdc552c221e7a9522e8c931b17e7d1a4c 0 +Wizard\AIEvoShield.cs Wizard\AIEvoShield.cs 0f7dd50f0c1ea4895b24f7125f0466626cda6490c1f5436a493ae0e4f7597fed 0 +Wizard\AIEvoSubtractCountdown.cs Wizard\AIEvoSubtractCountdown.cs eb6571b7b7fddbcb800e718dd7be015109091960b1d0f70c33f6a521919ef84e 0 +Wizard\AIEvoTagArgument.cs Wizard\AIEvoTagArgument.cs d86b36c2bf128c0ce2d7d73c50786015a6049904be01bff9aeefb0cbfda842e8 0 +Wizard\AIEvoToken.cs Wizard\AIEvoToken.cs a62481aa2e7a6214558ea0f49fca52be76c5381c97976ae1d632eac4dc9a8dc2 0 +Wizard\AIEvoTokenDraw.cs Wizard\AIEvoTokenDraw.cs dbbbe3125a7db1d2c9fa33d7a7471d2851eeb72ca0ebf164b477ce1dff765510 0 +Wizard\AIEvolMove.cs Wizard\AIEvolMove.cs 7055ccae3d2c422ed12be1d7cce499c9c87aa07131e8bbc6aa349cf503f0bedf 0 +Wizard\AIEvolveToOtherTagArgument.cs Wizard\AIEvolveToOtherTagArgument.cs acd00ec4b144c9c10c1403f76cbff1e523589533106fc4564c940c67af1d3d14 0 +Wizard\AIEvolvedAttackable.cs Wizard\AIEvolvedAttackable.cs 70aa6e92cc26cb3a4546606f8acef5b091186796cae63ff9f74676a72f20a221 0 +Wizard\AIEvolvedAttackableCount.cs Wizard\AIEvolvedAttackableCount.cs 5e436ad0b7733b999018f31d3fe320ff682414cedeb03e65d4d3dc06a149420a 0 +Wizard\AIEvolvedSkill.cs Wizard\AIEvolvedSkill.cs 4c867d8e8846b811be0dd5babd16bb59f3c3498681c706b47f5e2c6915985099 0 +Wizard\AIFilteringActivateCountArgument.cs Wizard\AIFilteringActivateCountArgument.cs 724cb7f85b1908d69996cc2e63d089caf78c19b33da073a61daaede4aba40eaf 0 +Wizard\AIFilteringUtility.cs Wizard\AIFilteringUtility.cs 94bb1baeeeccd3ad349964816bbf3edf3fca8a887d81779170bdd910604614db 0 +Wizard\AIFiltersAndSelectTypeArgument.cs Wizard\AIFiltersAndSelectTypeArgument.cs 875dc63fceb15e8b0474dba69fce6d8516e1f38eac36e8497d71565b471c5c2b 0 +Wizard\AIFiltersArgument.cs Wizard\AIFiltersArgument.cs 5dc3274c200fd18c7d2e4d96a4b133bb28195c386fe52f95d88ae8604f644776 0 +Wizard\AIFirstMoveBonus.cs Wizard\AIFirstMoveBonus.cs 638d3f68351d455e0c1dbcc50d579251eb1fd7bd21e5307387623f16011649d8 0 Wizard\AIFunctionResultContainer.cs Wizard\AIFunctionResultContainer.cs 32c12c6a5326f256b7e50d83c7d1f2709b4e208b9a932255476f71e297dfa5a4 0 +Wizard\AIFunctionResultHashCalculator.cs Wizard\AIFunctionResultHashCalculator.cs 4f6fbb7465cc2fb2ea6cf808f3b466c69d0e500c42b019428999ca1b5b69d128 0 +Wizard\AIFusion.cs Wizard\AIFusion.cs 197b1fd5b6e982b5dde95c870c4928f06b03c54b6500b9e4ef6dc34955ea1d88 0 +Wizard\AIFusionDraw.cs Wizard\AIFusionDraw.cs 02e8d6e49db6734743322d3fee2e405d10e56e3cddecc18345f15326a1b93d68 0 +Wizard\AIFusionMetamorphose.cs Wizard\AIFusionMetamorphose.cs 4a1d8f4e359e5f60fd4ac325319d0d2883e2b32d8591dfab18a7c3d5b3c7a403 0 +Wizard\AIFusionMove.cs Wizard\AIFusionMove.cs 4f707ff2053c36cef6e43aed9f3d2ea72fcec3a6874691541db074d7c6022044 0 Wizard\AIFusionSituationInfo.cs Wizard\AIFusionSituationInfo.cs abf01be029bd5fe69ec109d3541d452c92c21ebe849eea4ce5127165bc790360 0 +Wizard\AIGameStartAttachTag.cs Wizard\AIGameStartAttachTag.cs e71655bf3ffa71272da6459a9f6ee40dd5aa63115d11fd62987cc283f2f8453d 0 +Wizard\AIGenerateTag.cs Wizard\AIGenerateTag.cs e618715d718de81f3b92ed8b26a7784130aa251a1289ec4145328bbede425515 0 Wizard\AIGenerateTagOwnerTable.cs Wizard\AIGenerateTagOwnerTable.cs 5ef0628f2c7f6ba87e5ad684a92e79f2e29c8a9415bcc581890fca4efced4343 0 +Wizard\AIGetOffEvo.cs Wizard\AIGetOffEvo.cs 02d356b7aaa96be63bf73dbbecfbacc61ae5069d88690d49087cea8aa99b09f3 0 +Wizard\AIGetOffMetamorphose.cs Wizard\AIGetOffMetamorphose.cs 532d1213ace8d0d29b9e3d94866a58e7ad3e78093e6c65802b2f7a6580ef49d5 0 +Wizard\AIGetOn.cs Wizard\AIGetOn.cs 2c9542aca8f705e47064fc500710eb22360b2d95ae74ee64999ba2a07367f4c0 0 +Wizard\AIGetOnBanish.cs Wizard\AIGetOnBanish.cs ae7c11664492c6f48b30f4bacb82b946b672607e7764ff8d9f4c3aace616aa8c 0 +Wizard\AIGetOnDamage.cs Wizard\AIGetOnDamage.cs 9f9196aa4d1e86e27a16534efbaf08daaa218cee56045faae6812a094f98f421 0 +Wizard\AIGetOnEvo.cs Wizard\AIGetOnEvo.cs e45ece01952622ee1f633f6078b1b26963c694a67580e9ae6f31c4288aa7333b 0 +Wizard\AIGetOnSimulationUtility.cs Wizard\AIGetOnSimulationUtility.cs 81a4006a1c566e826c0a383994b37de5668d0b14ac65d701c802d20a1f068ad2 0 +Wizard\AIGiveSkill.cs Wizard\AIGiveSkill.cs 1c0490349175ea3f16871a8d82cd6048fd9ce83f6078eea151eccb3716bf52e2 0 +Wizard\AIGlobalEmptyList.cs Wizard\AIGlobalEmptyList.cs 610cb34c9780228eafdf18d2b20485601e1b4c5281a6da5dbdb8e964241319bc 0 Wizard\AIHandPlayEstimator.cs Wizard\AIHandPlayEstimator.cs a784c18d6db69769630084960b90572613ec6f35b20fa322bb5e77375f915639 0 +Wizard\AIHandPtnCalculator.cs Wizard\AIHandPtnCalculator.cs 48b51c3a5f6beb3d53410e1dd9b00e8270aa18942c94f441e497c65789a97bb7 0 +Wizard\AIHealAttachTag.cs Wizard\AIHealAttachTag.cs 28ebf08b93a1472934c9af9a44d77a0a93bacb6e50ed5ddd9241029853e0bf7d 0 +Wizard\AIHealBuff.cs Wizard\AIHealBuff.cs f40ab56afbdb5f4607a9ab0cf62dbf075299942e2330ab8ae4984b8fd00ffe78 0 +Wizard\AIHealDamage.cs Wizard\AIHealDamage.cs 6b7996cd60609c99c805ff019cef44506e07491702cf44884689b58ab0e42343 0 +Wizard\AIHealEvo.cs Wizard\AIHealEvo.cs 08c80712cd5cbffa74a0e89ee6239cefe367da34283871964ea46eb8d99e5319 0 +Wizard\AIHealHeal.cs Wizard\AIHealHeal.cs 7ffb34e7794547b231b612f35a3ae727e337e8e73a287e3cfd3023225e1d423d 0 Wizard\AIHealRecorderCollection.cs Wizard\AIHealRecorderCollection.cs 87ceb977aa25f08c175da7c59d74f7f5fb9911402f10bdf4cafc783e7184f9a9 0 +Wizard\AIHealToken.cs Wizard\AIHealToken.cs 144c7f5ed450b0fa4a8e4cd7b331be157f46215c126f719e1cd1a624d2711c23 0 +Wizard\AIInstantAttackUtility.cs Wizard\AIInstantAttackUtility.cs a640ddff12fcb974826993d224e52d7241cfaf282ce464319f3a8807d1462aab 0 +Wizard\AILastwordAddCemetery.cs Wizard\AILastwordAddCemetery.cs 6a474d4246b7cc781e9b89d24f16cf0c655dc1fb76229a39bb2f50c4b2b1d335 0 +Wizard\AILastwordAddDeck.cs Wizard\AILastwordAddDeck.cs 96e052c096eba27661887408fbaef45342d61771fa2a520306502dfc59ba8fc2 0 +Wizard\AILastwordAttachTag.cs Wizard\AILastwordAttachTag.cs 54ba68ec7b1bec1bd937982844d4ee1f904b167687eea66ff19dcfed92de0c3a 0 +Wizard\AILastwordBanish.cs Wizard\AILastwordBanish.cs 68e20e16e92c1bf00b45bcd8510122e62fcd1b101e7dc7491128e9f18ffc947a 0 +Wizard\AILastwordBuff.cs Wizard\AILastwordBuff.cs c0976e6fb3d00b9e74aa932b7cb77cfc8c25572a63b79c9de5a05c20fbec8126 0 +Wizard\AILastwordDamage.cs Wizard\AILastwordDamage.cs 516bef0734693e90d6db38421cbc76b15469be6e98833533536b13066f2b1ccb 0 +Wizard\AILastwordDamageClip.cs Wizard\AILastwordDamageClip.cs 6ad6ba5366b7293697034179255d91d88d6a76fb35989291ab5366d446427cf0 0 +Wizard\AILastwordDestroy.cs Wizard\AILastwordDestroy.cs 31abeb4504d5f9564eeb9e451ec90649e1931c240e6fc46f673ac9d8fd88471a 0 +Wizard\AILastwordDraw.cs Wizard\AILastwordDraw.cs 3899e93c77229cd5e4823d42abda677a4a32ccd1526bdc6b947e5c1826ef8842 0 +Wizard\AILastwordEvo.cs Wizard\AILastwordEvo.cs 367ccab00c7a52db3da531896be7dce4419e2769e445fe55e8fca7c4e947d2d4 0 +Wizard\AILastwordHeal.cs Wizard\AILastwordHeal.cs dc32777feea211937da707d26368588be065840f1dc82da29dcb1f174e7501c7 0 +Wizard\AILastwordMetamorphose.cs Wizard\AILastwordMetamorphose.cs f6d341bdced6586ca06d7dcaf7227dc77d2fc8467bc03b02d56df4801b290e4c 0 +Wizard\AILastwordReanimate.cs Wizard\AILastwordReanimate.cs c606f3a8c33aa201de5d050d87fd53f97d5fc62e5ed02c435058b09871e5aba6 0 +Wizard\AILastwordRemoveSkill.cs Wizard\AILastwordRemoveSkill.cs 8dfb7e9dce235aac07aa3fa58845fb3b01f968c3dd5593972a9a8f26bc27c18b 0 +Wizard\AILastwordSetStatus.cs Wizard\AILastwordSetStatus.cs eeb384b10d5eae90928b718812963f76fd36fc5b8497a397b365d6d9c94e2e21 0 +Wizard\AILastwordShield.cs Wizard\AILastwordShield.cs c98166370f5630a2ab867d5a2cc7c43f2f2f8449b6492af2a39ebcd96045cd67 0 +Wizard\AILastwordSubtractCountdown.cs Wizard\AILastwordSubtractCountdown.cs 2ed1756e367df202ef8091e1dbe49c913ec904dc31b88b533c898c956146156a 0 +Wizard\AILastwordToken.cs Wizard\AILastwordToken.cs b85f90e75ef28cdd628cd121c789173044d45030c239851f146a489cbbba2623 0 +Wizard\AILeaderLifeEvaluationUtility.cs Wizard\AILeaderLifeEvaluationUtility.cs 25219c347ee322d8e60361fe46dc3d07fcbc66c727102f905bc924551ca5d70a 0 +Wizard\AILeaveAttachTag.cs Wizard\AILeaveAttachTag.cs 15bd065089329ad0ba829ac238a7cef81475d8aef02a35d9d7db703d12b98fcd 0 +Wizard\AILeaveBanish.cs Wizard\AILeaveBanish.cs 9602a13893fbab3ebb998046888e201647f0cdd5efafee187680f586cc7abfc0 0 +Wizard\AILeaveDamage.cs Wizard\AILeaveDamage.cs a2181b925c404c39ef3b566b39a8aed598628b4ca5233591f3ef3646e83d9cf4 0 +Wizard\AILeaveHeal.cs Wizard\AILeaveHeal.cs 5d46844a5f350e2d230d1ba5780042bda5773f4ae5f9e5d05e9f4c75923257a2 0 Wizard\AILeaveStopCollection.cs Wizard\AILeaveStopCollection.cs aa64e33458c0ba01c24f82fb26f8fe830456dd17e1c62ca194526331bd2f45ec 0 Wizard\AILeaveStopInformation.cs Wizard\AILeaveStopInformation.cs 4cfdbf2de116f487cfdb8c7922db6ffd753e424004de18d7393ede500b945f80 0 +Wizard\AILeaveToken.cs Wizard\AILeaveToken.cs 644162f03289345c5f93e56f8332c06786e4de1af6db79c501169ab19935d352 0 Wizard\AILethalPlan.cs Wizard\AILethalPlan.cs 248a596eb9e5af3c8df3d3c71676fd69409b231771b72bf004ccf4def7d11ca1 0 +Wizard\AILethalSimulator.cs Wizard\AILethalSimulator.cs 1f122e02c65dfd76d6b02b5564c0008f94f17f0bf4ba1ca8d3c9609eab08138e 0 +Wizard\AIMathematicsLibrary.cs Wizard\AIMathematicsLibrary.cs 5654cca15a3e038551a484e2f2b7d0c200c9f8c5c0bbfb263f5293514a693aac 0 +Wizard\AIModifyValue.cs Wizard\AIModifyValue.cs 749762c075b3eb17651d0b1c370d24dc3e3fe38540006c0215bca6d0469e9209 0 +Wizard\AIMove.cs Wizard\AIMove.cs b970c8c0dac58f304f89b8922a5e4708bd285df3f67cd653d0fb496a7b0c94c5 0 +Wizard\AINecromance.cs Wizard\AINecromance.cs 458a04f500301f022a758465e399dfd2fcc00fda25c858021978a7a540811704 0 +Wizard\AINecromanceAddCemetery.cs Wizard\AINecromanceAddCemetery.cs 292f7cb165f821e217601040dbbc668aded4c8207f2931c211e7773c5138e089 0 +Wizard\AINecromanceAttachTag.cs Wizard\AINecromanceAttachTag.cs 8b1d0c93e3cf6d0fae2d19c555b5b5fbb1bc7a7404157a961442668cdd90c1b9 0 +Wizard\AINecromanceDamage.cs Wizard\AINecromanceDamage.cs 680578cfcaf71c45a6047dc12ec588de368458c4439697aaadd75acda807e3c6 0 +Wizard\AINecromanceHeal.cs Wizard\AINecromanceHeal.cs 90c16ec4b4ddc5e8b48ee505e19ea8f2b08e145a0d742bfd499bd4051b1f0427 0 Wizard\AIOperationProcessor.cs Wizard\AIOperationProcessor.cs 987a69fce793dded4c54d03f52dfe9be47eddc6695b7d99ed6447ec632a13eb3 0 Wizard\AIOperationSimulatorAccessor.cs Wizard\AIOperationSimulatorAccessor.cs 7b129b65a6fead48a9ab950b3bfe7cc0dc80559a6022b2f2a51a6ed9bfefa501 0 Wizard\AIOperationType.cs Wizard\AIOperationType.cs 2e26a9ca0d4c3a57710ec8d19f6f1481ae54c0e3f7a5510080e6bb2bdcfcea81 0 +Wizard\AIOtherAttackAttachTag.cs Wizard\AIOtherAttackAttachTag.cs 958ba21c297ae33b6b5fee792ec65a27deabfd0eca4272210de714465df66a43 0 +Wizard\AIOtherAttackBuff.cs Wizard\AIOtherAttackBuff.cs 9081aa220267040f20ddbaf4f318b41a401eb76e229e670cf6756e672b291279 0 +Wizard\AIOtherAttackDamage.cs Wizard\AIOtherAttackDamage.cs 28c64b2e9219aab33a38845028d04d492dbea0aed8d8761c8546eeacc90ddee9 0 +Wizard\AIOtherAttackHeal.cs Wizard\AIOtherAttackHeal.cs e54f04540730ed28e409822f1488a3c39864e22d823eec2bf3f7e32499da44d0 0 +Wizard\AIOtherAttackRemoveTag.cs Wizard\AIOtherAttackRemoveTag.cs 74d0f91068999ebbed7943debc3d3d06019f29133f7bdfd20218e5ca953a24ea 0 +Wizard\AIOtherAttackToken.cs Wizard\AIOtherAttackToken.cs 829f76bbabf0ff1602930e43c5450fdc2b6bfec0043e7bdd19ef786328b49002 0 +Wizard\AIOtherBanishAddCemetery.cs Wizard\AIOtherBanishAddCemetery.cs db7822fa75c7a693e230d9bab85f333383ce1c8aa5fa6e9b18c7005d605d1326 0 +Wizard\AIOtherBanishToken.cs Wizard\AIOtherBanishToken.cs 80551b6a2749b538b4ad88bd0c091a95dad8eaf34d948e664c64169e52fd35df 0 +Wizard\AIOtherBattleBonusRate.cs Wizard\AIOtherBattleBonusRate.cs 3263dba41428dee3bf70bdcfb8f59572bf5368ef6cd1d12e1ee290e948c198f0 0 +Wizard\AIOtherBreakBonus.cs Wizard\AIOtherBreakBonus.cs 9664b9abad16dcda3bf8e4a25f93ad6808f6107dff59332d55cda9ffa3aaf1a3 0 +Wizard\AIOtherDamagedBanish.cs Wizard\AIOtherDamagedBanish.cs 6ab6256147947eecac13482c5e1a825ca3b17b58007d0f30e3bb133895f41d18 0 +Wizard\AIOtherDamagedDamage.cs Wizard\AIOtherDamagedDamage.cs daf6f02c8e3765a3619b233e09cea0e79f2e3d6da9d66e4a759b613d918baaa5 0 +Wizard\AIOtherDamagedHeal.cs Wizard\AIOtherDamagedHeal.cs 340055088317cbea6188a57d37473d45ec62d518ac3d22989b981bb228278b94 0 +Wizard\AIOtherDamagedSetLeaderMaxLife.cs Wizard\AIOtherDamagedSetLeaderMaxLife.cs 6e89ea5b405b52a9b769d60e29d42305333720f46b661c67af1d845c7e8ebeeb 0 +Wizard\AIOtherDamagedSubtractCountdown.cs Wizard\AIOtherDamagedSubtractCountdown.cs 04dd253bbadccc7b2016163aa7c3a15a0400a4020d962fef6b3ca2ede33dd624 0 +Wizard\AIOtherEvoAddCemetery.cs Wizard\AIOtherEvoAddCemetery.cs 23517419722ac45d31068a40ed312c6d5a26b9473c73ed5ed9a7523bace2009c 0 +Wizard\AIOtherEvoAttachTag.cs Wizard\AIOtherEvoAttachTag.cs 7cdf589230424e3ee8c826b81fdc13b3a14b4ddff394668183567f6ad80aced2 0 +Wizard\AIOtherEvoBanish.cs Wizard\AIOtherEvoBanish.cs 9e14e0c35e7909d5dd1b6d1687ab284d98be9f76282346d0dd9b798c6977669f 0 +Wizard\AIOtherEvoBonus.cs Wizard\AIOtherEvoBonus.cs b9d70a19bbba1bf042d823263f4d2f0b7b21133fa324eca6513e6abaa5baddad 0 +Wizard\AIOtherEvoBounce.cs Wizard\AIOtherEvoBounce.cs bb14b8063da91823284b53b3e40937562aca19797f8dd243c2f4a2bf20c2eb1b 0 +Wizard\AIOtherEvoBuff.cs Wizard\AIOtherEvoBuff.cs 42c1fa9d3072d66f9357f37d6d7e5fb96630fcb0e0008928b02e4b0b23ab0303 0 +Wizard\AIOtherEvoDamage.cs Wizard\AIOtherEvoDamage.cs 152ead59f42873ac7db29b7f81f866a21e7d4beee6496411d208394ca5de4ddf 0 +Wizard\AIOtherEvoDestroy.cs Wizard\AIOtherEvoDestroy.cs 1865bb507e88318408bf2bcd70d6ba3327f51a30bf225bd3b8a975650c9816b7 0 +Wizard\AIOtherEvoDraw.cs Wizard\AIOtherEvoDraw.cs 456472394be0ea567f90cf83ecf9945e9cf1c7f1d6f3012ee43a002402652ca7 0 +Wizard\AIOtherEvoEvo.cs Wizard\AIOtherEvoEvo.cs 18b789ccc877d88584f7ef888937ed0b3b948838ec664989b29242202ed4bc39 0 +Wizard\AIOtherEvoHeal.cs Wizard\AIOtherEvoHeal.cs 044727f897b81d5152288139fe43913b5c2a69c6c94a536f075930eac8fa77ad 0 +Wizard\AIOtherEvoShield.cs Wizard\AIOtherEvoShield.cs 3addf274a9c80f6bb479f30f1cc1127ca64dbaf7c22e73b3ec381a394ebe9d5e 0 +Wizard\AIOtherEvoSubtractCountdown.cs Wizard\AIOtherEvoSubtractCountdown.cs 4c602a21eb3ffd117a35dfa58733987a4ff0539e0487f20a8316b23543bc5726 0 +Wizard\AIOtherEvoTagArgument.cs Wizard\AIOtherEvoTagArgument.cs d4bfb329dd35250ea0864b5547c9e231ef6ad3643776d66012b772044fc7b879 0 +Wizard\AIOtherEvoToken.cs Wizard\AIOtherEvoToken.cs 82745a9cf6a39e3528982c3ac50ae044ad16da437ebeb2f313e05847d64f79fc 0 +Wizard\AIOtherEvoTokenDraw.cs Wizard\AIOtherEvoTokenDraw.cs adbd214c47c253e13c82d86fb4641f019e27849a042dac91a2fccda4ad864f92 0 +Wizard\AIOtherLeaveDamage.cs Wizard\AIOtherLeaveDamage.cs 85e62821cab97454473fd60dbc3e33b280788e2161c2bc60c955ab7cb887590c 0 +Wizard\AIOtherLeaveToken.cs Wizard\AIOtherLeaveToken.cs 4deb4a39ce7071056fc4dd63e8052eadd9304dd3a004a2a30baf528729de3207 0 +Wizard\AIOtherPlayBonus.cs Wizard\AIOtherPlayBonus.cs 83b43f391d6c212d7c594e153fa698422d8797446a603443ceae6ce3dd96e393 0 +Wizard\AIOtherPlayBonusRate.cs Wizard\AIOtherPlayBonusRate.cs 8ddf0beac3557499c1b00726fcf55f8da09f8f9a471954831080d67677853991 0 +Wizard\AIOtherPlayoutDamageBonus.cs Wizard\AIOtherPlayoutDamageBonus.cs cf6898f830fcb2cf48c78fe3bb68e7cc869994bbe3ee0d862e099cccac2dee0c 0 +Wizard\AIOtherSummonAddCemetery.cs Wizard\AIOtherSummonAddCemetery.cs ed36cb27d7774cc9e9a210e3c51eafe307c686f141459885a29fc46077bb9c3a 0 +Wizard\AIOtherSummonAttachTag.cs Wizard\AIOtherSummonAttachTag.cs 98648a07559ffed361576ad252eaf016feb36e537323d9924c887c5111ad6b03 0 +Wizard\AIOtherSummonBanish.cs Wizard\AIOtherSummonBanish.cs ab2531ee1251b0ac05cd08781fe5508b911db6bd9f38192840a6cf84fe0dd0b6 0 +Wizard\AIOtherSummonBarrierBase.cs Wizard\AIOtherSummonBarrierBase.cs cce9e686a03d787eb35fc1ee9e9d1ed01f3dc9fb7c393b15e862f9380dbc4d56 0 +Wizard\AIOtherSummonBuff.cs Wizard\AIOtherSummonBuff.cs 3eeb747763d3737812591b50295479d641db4e0e1bcfe072ff8cfe9f4a548ee0 0 +Wizard\AIOtherSummonDamage.cs Wizard\AIOtherSummonDamage.cs 3bca86eb93154e3c4ec5c0d305403954c1bd7375db2a0caf4b88c58c85c26cd3 0 +Wizard\AIOtherSummonDamageClip.cs Wizard\AIOtherSummonDamageClip.cs 37361a7cce750b679b854667c46ff178e67a4b0f0c09b25a75e3eeee7e69a265 0 +Wizard\AIOtherSummonDamageCut.cs Wizard\AIOtherSummonDamageCut.cs 5a8aefaff9dac3c1e33308d43805af02e55c31edd76cb1ac122c2faec840822e 0 +Wizard\AIOtherSummonDestroy.cs Wizard\AIOtherSummonDestroy.cs 7d333417fafe264eab03b45051768913cc671e2727ce0639c7b0ce3e844de78b 0 +Wizard\AIOtherSummonDraw.cs Wizard\AIOtherSummonDraw.cs 66d34326e0b6c76b90a3390efba60402144fd321da7921b906ba9f8d32d04e1f 0 +Wizard\AIOtherSummonEvo.cs Wizard\AIOtherSummonEvo.cs a09799162402e049e24992e709b890f8b4a20056418b821ed59278fbbed2fd64 0 +Wizard\AIOtherSummonHeal.cs Wizard\AIOtherSummonHeal.cs 8bc933aa0e58a08ec4eeabd9e875792e159f0e85d85b947dfb7b1389865341da 0 +Wizard\AIOtherSummonKeywordSkill.cs Wizard\AIOtherSummonKeywordSkill.cs 4893c832e8fe0fe68091b7f6cbf6b18cc97a7c7c377af4fb8de903e9970fdfb9 0 +Wizard\AIOtherSummonSubtractCountdown.cs Wizard\AIOtherSummonSubtractCountdown.cs d87870be3d36f0bc7b1a8d7d84d636d0a6703b31f731cbf4e745a6f435acb596 0 +Wizard\AIOtherWhenPlayAttachTag.cs Wizard\AIOtherWhenPlayAttachTag.cs 3491c805bb13168ed919dfa68b41567eb5ec968ea277521b0b57d8e624516237 0 +Wizard\AIOtherWhenPlayBounce.cs Wizard\AIOtherWhenPlayBounce.cs c8dbbaca6600de582fb359eec2c26282d1993ae4d1685a2318e4c8de287d5eff 0 +Wizard\AIOtherWhenPlayBuff.cs Wizard\AIOtherWhenPlayBuff.cs 4ecd96aea02925d366848724a406d6ef2c71ca119a2aebaee1651d4074767e88 0 +Wizard\AIOtherWhenPlayDamage.cs Wizard\AIOtherWhenPlayDamage.cs 456734809fe86b6c425debd782356153180ea194a4df62329d38c08012d8ea12 0 +Wizard\AIOtherWhenPlayDestroy.cs Wizard\AIOtherWhenPlayDestroy.cs 80f5991b664574cca371d72c1ab84fce0094650f5d8a562d5648fe3d83b9e849 0 +Wizard\AIOtherWhenPlayEvo.cs Wizard\AIOtherWhenPlayEvo.cs 79d676adf61ae5b80a71f353e7c62046a3b67d492c61b214336bea6b0f26dcff 0 +Wizard\AIOtherWhenPlayKeywordSkill.cs Wizard\AIOtherWhenPlayKeywordSkill.cs aa79da6e4f588c307e1bf029d6acdd788459ea8ea7dc435eadf96c0efa26c131 0 +Wizard\AIOtherWhenPlayRecoverPp.cs Wizard\AIOtherWhenPlayRecoverPp.cs 4d87c0cbf8edd6ac4fbb6db39d9a932171df74b81e3f6bdd6b26a4016ec8f846 0 +Wizard\AIOtherWhenPlayRemoveTag.cs Wizard\AIOtherWhenPlayRemoveTag.cs dce8eec81cb815211ab8b8145263e0fbfe45191e899374f0ed480426dce3bbc5 0 +Wizard\AIOtherWhenPlayTagArgument.cs Wizard\AIOtherWhenPlayTagArgument.cs 01c0912988326bbce76f77f35fc951e1c5cdb0d210e4f052e341a4a825594d2b 0 +Wizard\AIOtherWhenPlayToken.cs Wizard\AIOtherWhenPlayToken.cs b3fc883273b62a1de6b8f2116232cc146ed9ffaf5e77c05818836b71f95e6ef5 0 Wizard\AIOwnSkillProcessRecord.cs Wizard\AIOwnSkillProcessRecord.cs 6dfc068e5c01160fec9067d925c28fca631593303a37eb01a73f572826127110 0 Wizard\AIParamQuery.cs Wizard\AIParamQuery.cs f72f4e7957b25eaf73fd016678ff0a359cf290570c43307d4d557e4c0848cbf2 0 +Wizard\AIPlayBreak.cs Wizard\AIPlayBreak.cs 88a9d014fee6d9395f3274686acf1f9e3f60e95fb645239f895f6f7c584ea708 0 +Wizard\AIPlayCardSimulationUtility.cs Wizard\AIPlayCardSimulationUtility.cs 778ca26874bfcb362f60b72c05cf4e628aec0cec8a759089d0768db62be0f8d1 0 +Wizard\AIPlayMove.cs Wizard\AIPlayMove.cs 1c90c48a15d7e41e8a6787641c94e6b96fa1c8f7cfd844ffcbfd50535ffb07f5 0 +Wizard\AIPlayOnSkillUtility.cs Wizard\AIPlayOnSkillUtility.cs 02e594b025412f266ac5f04e73507c095d1b91db354f3c75a268d8c1f3f0ccc1 0 Wizard\AIPlayOutAction.cs Wizard\AIPlayOutAction.cs d92398f58ff03224c5a3b4d3c11bb8a3e271c29f940801ca0fa2635897d52c57 0 +Wizard\AIPlayOutChecker.cs Wizard\AIPlayOutChecker.cs a4dbc1c7299ec7f51314b027f9e9e5324b2f5f513502a353d18e8bbcaf4e5301 0 +Wizard\AIPlayPtnUtility.cs Wizard\AIPlayPtnUtility.cs 48d21fc52d48585e96dded2c597cd75620a4583896c14655a83a68887b0b672b 0 +Wizard\AIPlaySkipIfEvo.cs Wizard\AIPlaySkipIfEvo.cs 0ff928e897d4a73cac9fb5c03eba60b0214abffb043cdc867c3f86794e431ac5 0 +Wizard\AIPlaySkipTagArgument.cs Wizard\AIPlaySkipTagArgument.cs b701b082bfec67fd011768f28689cb21c5a98a83e65fbee6008c867b595b32bd 0 +Wizard\AIPlaySkipWithAction.cs Wizard\AIPlaySkipWithAction.cs e6dbc8b262501a8bd41bc68fc2c4aeaa17f3eba2dfe3909351e62224f37be43f 0 +Wizard\AIPlaySkipWithActionIfEvo.cs Wizard\AIPlaySkipWithActionIfEvo.cs a6582fea3ddbaf291e487b58c3081ba14994ef2785b1d0e4eef6ef6f0fdcbee8 0 +Wizard\AIPlaySkipWithEvo.cs Wizard\AIPlaySkipWithEvo.cs 523727974b3eb31e8e84a8d226a6e2aa23c06f5e556ca42d2faadc5efc490285 0 +Wizard\AIPlaySkipWithFilteredTargets.cs Wizard\AIPlaySkipWithFilteredTargets.cs b15bd62490e587b2e306d2dc0addbd76c3d41f76b213902ce1f2646fa43946c0 0 Wizard\AIPlayTag.cs Wizard\AIPlayTag.cs 2dba08af840cde17384636259c1a8736220d48ca61a94716db6d0ee5e6ed5e25 0 Wizard\AIPlayTagAsset.cs Wizard\AIPlayTagAsset.cs 1b87a0193f4cf8653bafd6daaddddf662c91a7c956e2d98955b9d2c252aa2a93 0 +Wizard\AIPlayTagInitializingUtility.cs Wizard\AIPlayTagInitializingUtility.cs 715459516cbaba707ff4dc255fe4062e0432c040018fcb106a45cc796d47ce47 0 Wizard\AIPlayTagType.cs Wizard\AIPlayTagType.cs 98a5f5b22a3f7efe66cd9bfc9314bb71cd25d28d06a660a0dba542cbd62dd62d 0 +Wizard\AIPlayTokenSimulationUtility.cs Wizard\AIPlayTokenSimulationUtility.cs e5e5f0d7ed2807b7a023b5321ba51d4c9036ef351fa25e9b800d2125142c34ff 0 Wizard\AIPlayedCardContainer.cs Wizard\AIPlayedCardContainer.cs bfa459b95817c77dfdc3b14d445ed256c17b3f4fcdf902ed19ce08b408c8673c 0 +Wizard\AIPlayptnBaseStatsRate.cs Wizard\AIPlayptnBaseStatsRate.cs e1dbf76c8d88f210be967c11f5dfe2770b7ba40a259ee3f571b7a0a3e9c85c9f 0 +Wizard\AIPlayptnBaseStatsRateUtility.cs Wizard\AIPlayptnBaseStatsRateUtility.cs 06bf1e0cda623fed621fb7a65fa2d5580c5a91dff8348f13658a38c68c091d9c 0 Wizard\AIPlayptnRecorder.cs Wizard\AIPlayptnRecorder.cs 12efcd9a633f4d916a07b032e457c371a34e62e624d6d65a44ec11b24b6a652c 0 Wizard\AIPolicyCollection.cs Wizard\AIPolicyCollection.cs b5971a463a61c052b287a24e544367117555d0572989de2dbeaf5f27bd845384 0 Wizard\AIPolicyCollectionContainer.cs Wizard\AIPolicyCollectionContainer.cs cb2fb55f80cfef1254b5d7fa9587b9b80f3f46d7106146b62039bb5dfa19607d 0 @@ -407,33 +1818,69 @@ Wizard\AIPolicyData.cs Wizard\AIPolicyData.cs d121c5671ed8921f300da67ff87ce40067 Wizard\AIPolicyDataAsset.cs Wizard\AIPolicyDataAsset.cs 9eb4a2b26aaa831c0c24845ab2484f7647172bb1cd7d9619e67b235a5cdf03d9 0 Wizard\AIPolicyType.cs Wizard\AIPolicyType.cs 139ba46866994d03e271e10351bae6960a724f4e14e2efe7ca7567bf0ff96567 0 Wizard\AIPolishConvertedExpression.cs Wizard\AIPolishConvertedExpression.cs 2c37d1665811937b1103d742d6154a88d9d6549e926c842bc4461456ea63efb4 0 +Wizard\AIPreprocessSimulationUtility.cs Wizard\AIPreprocessSimulationUtility.cs e8dab36f853e23a6f47dd593eb2893e2b96d5f014e9acacdbd1f846712d9e15a 0 Wizard\AIRealActionInformation.cs Wizard\AIRealActionInformation.cs bace0d857b7345017e6d76cd2485d5d12bde4c7357046e04b483d19f4a37e502 0 +Wizard\AIRealBattleCardSearcher.cs Wizard\AIRealBattleCardSearcher.cs 5bb09911e97d22f5558048ca0fa8dceb1eb265bce3eda5a9ade88010f050c611 0 +Wizard\AIReincarnationUtility.cs Wizard\AIReincarnationUtility.cs 8c6f8d7019844fa4af5acb89c9f9bd3509f44bfadde0de6af4ed783b54d04546 0 Wizard\AIRemovalType.cs Wizard\AIRemovalType.cs a21dcef29cd2a5b50cac7ddc4e6dc046049a94cf0b607985fd211216c0f46ec4 0 +Wizard\AIRemoveByDestroy.cs Wizard\AIRemoveByDestroy.cs eaaa88f8fd1ce4992857ffccdb59bf5c78fc4c99ee6399198d3ed3508cd8d889 0 +Wizard\AIRemoveSkill.cs Wizard\AIRemoveSkill.cs 37ad93e8d0f2d36d7b8a7c2b3f52dacb7d8a2bd37cfed44b0d61a3abe158adb5 0 +Wizard\AIRemoveTagUtility.cs Wizard\AIRemoveTagUtility.cs 9611b9a087ab55879ab1ef610a26bae4f4f7e6507e9b7cfeca2ba4f5497e8ae9 0 Wizard\AIRemovedTagCollection.cs Wizard\AIRemovedTagCollection.cs 9131b82dd4626aacbc8b85fe09e1c93049e2fe4f1dc0d748e6dc99965731de66 0 Wizard\AIRemovedTagInformation.cs Wizard\AIRemovedTagInformation.cs 02359747ab3ef0417f6d9a57b675e1cc76f0d7739acf37c81c1fa0d4f4d9675d 0 +Wizard\AIResonanceDamage.cs Wizard\AIResonanceDamage.cs 31d3b5a74b4e369f3ffc15ed5745ebf8fd6b590f2efc737a1b7e6ed94317d8e1 0 +Wizard\AIResonanceGiveBasicSkill.cs Wizard\AIResonanceGiveBasicSkill.cs 00b4960af8ef45d3a59393988907b05856977fffa11dc91e276f6f0507e9488e 0 +Wizard\AIResonanceHeal.cs Wizard\AIResonanceHeal.cs b32a5ad217fd1bdac07b84b28cc25f84519c3dafb1d85e08120a46f8c1119cc6 0 +Wizard\AIRuleBaseBattleSimulator.cs Wizard\AIRuleBaseBattleSimulator.cs 2ec1cf8dd989a2779f214673107991995e2509d8b074fae2c06691ec9222d50e 0 Wizard\AIScriptArgumentExpressions.cs Wizard\AIScriptArgumentExpressions.cs f84b6e5cd8c7ace4cca42f83ef307ce9ec20b98b7518aecec372f4eb36d2cd0d 0 +Wizard\AIScriptArgumentToken.cs Wizard\AIScriptArgumentToken.cs 81ee7fc8bdd4868a26c01e47282c6395b31b4e0213816bef4d2c1b11ae434163 0 Wizard\AIScriptCalculationToken.cs Wizard\AIScriptCalculationToken.cs 6ab1018faf72d60041c56cc77c4d0bf5aa656a014f82223df64280660e6d963d 0 +Wizard\AIScriptExpressionCalculator.cs Wizard\AIScriptExpressionCalculator.cs de7922c107d2e436339a4c28939dd5322579e31a970e82ebd7c74e47e7160339 0 +Wizard\AIScriptFunctionToken.cs Wizard\AIScriptFunctionToken.cs 592b2829fef7646952eb3c20ec580cfb24a3e4ed4cf835416fd78a4ed10442c9 0 +Wizard\AIScriptIDToken.cs Wizard\AIScriptIDToken.cs e17a3f97d5cd633705db26e15f22f441941248ec85bdc73c5e4c046b4b95fb61 0 +Wizard\AIScriptNumericToken.cs Wizard\AIScriptNumericToken.cs 125ed19bd0fe13b3f256ca1dcd3af06b437d7fcc24f60c53301cd45991601748 0 +Wizard\AIScriptOperatorSymbolToken.cs Wizard\AIScriptOperatorSymbolToken.cs 29a0ea9d88ab4d2a57c602da929ea571854d7cd69f6cb0ad040fda0fe278590a 0 +Wizard\AIScriptParser.cs Wizard\AIScriptParser.cs 5caba7e096041245559d1706eaae50accfe7038f21f1339ed938424751b641fc 0 +Wizard\AIScriptTextToken.cs Wizard\AIScriptTextToken.cs 07f68a085af3e59e49e7baf997352b91133108e5db308c2a7e7c5a76816c203a 0 Wizard\AIScriptTokenArgType.cs Wizard\AIScriptTokenArgType.cs dac60cafacf16e8be5d4152f77e601c78380fc45ee18ea50a5249141fcd7a26d 0 Wizard\AIScriptTokenBase.cs Wizard\AIScriptTokenBase.cs 1e170b08af4926101bb84e7a907b25b95315d30c391e3f90578ad6d649f015ce 0 Wizard\AIScriptTokenFuncType.cs Wizard\AIScriptTokenFuncType.cs 2a67c3c917fc92479a1d0d65407bbe9cde91517d70d149bf97133095af3c5dc6 0 Wizard\AIScriptTokenType.cs Wizard\AIScriptTokenType.cs 25fa54f16c1a614e75888da9b01bf82c48484f221e34135f54ed45f2f594c128 0 Wizard\AIScriptTokenVariableType.cs Wizard\AIScriptTokenVariableType.cs 31a17a1a1892b28d1836475adb5f5fb6d8371579c4e117b8e934d1520394734f 0 +Wizard\AIScriptVariableToken.cs Wizard\AIScriptVariableToken.cs 95fc72412573367cae024e27f97ab824d303b3720a402950ebcc034018a5ce47 0 +Wizard\AISelectLogicArgumentBase.cs Wizard\AISelectLogicArgumentBase.cs 3cf1c8712e77f2e89bcda1e4e4f7e7578a561adbc484313420f0b37fbe6c608d 0 +Wizard\AISelectTargetPattern.cs Wizard\AISelectTargetPattern.cs e6ec9297ce867d018de96e073513995853987134f565599e52ca8f0b73a69aee 0 Wizard\AISelectedTargetInfo.cs Wizard\AISelectedTargetInfo.cs e5bd0b74bb61210fb74c7e32ea756c210b11606ff3ee8fd50db2eb3410b594b6 0 Wizard\AISelectedTargetInfoSet.cs Wizard\AISelectedTargetInfoSet.cs 7ce8704230b0e3845ab6fca518d57fed7014bc865be3d0068e6e1b6e0dfbf3cd 0 +Wizard\AISetTribe.cs Wizard\AISetTribe.cs f60347f263449db078058bbac9ad6b57b2069bfd16d602be61d2878c82fd5088 0 Wizard\AISetUpData.cs Wizard\AISetUpData.cs 40fd759ff03db75b0ce7037a189ea5f5a9b41ebde0e7a534f7af001765922f2a 0 Wizard\AISimulationBuffInfo.cs Wizard\AISimulationBuffInfo.cs a1220a11d4f07b0136353ee043781445021ecc4a2c20280010c063202eade9d8 0 Wizard\AISimulationBuffInfoCollection.cs Wizard\AISimulationBuffInfoCollection.cs 5566d56d5ddfec6b112435eb625be7182bb2c8c7c5cd749f482034df6aff84c9 0 Wizard\AISimulationPreprocessRecorder.cs Wizard\AISimulationPreprocessRecorder.cs 488c557427ce2e33b752cdf7dd4df6fedbc6b84f18009deddccd653f95211cdf 0 +Wizard\AISimulationUtility.cs Wizard\AISimulationUtility.cs 861880dc81dcbf5d637a438a9a6e5f0d6320aead2622ac5a285d7367aa2fe5d9 0 Wizard\AISinglePlayptnRecord.cs Wizard\AISinglePlayptnRecord.cs c627b1e1f8f0bff9d872b97ceecb111bc827346fae29517ca4a52fc96c3a78b5 0 Wizard\AISinglePreprocessRecord.cs Wizard\AISinglePreprocessRecord.cs 665cdff4396f8628d7a4c237bf68060376bb95f3b8497efc0dadcfce5e4ccd1e 0 Wizard\AISituationInfo.cs Wizard\AISituationInfo.cs a2c623dcb04b510aa1040a03c881a2653f1c8daf03965e605f72936eb1326e00 0 Wizard\AISituationTriggerInformation.cs Wizard\AISituationTriggerInformation.cs d555644f8f6aeaadf504f8cb75790d39e5cc767a17d0b570d78428e13cc6487a 0 Wizard\AISkillProcessInfoCollection.cs Wizard\AISkillProcessInfoCollection.cs e879231368bfccdddd19c35581434aa64bb098c54568f26badde1e7eb63af762 0 Wizard\AISkillProcessInformation.cs Wizard\AISkillProcessInformation.cs 363a1cde610924a277d4fd8fe2f3bec987092303f925ddd15b9aefc0da3fcc23 0 +Wizard\AISkillSimulationUtility.cs Wizard\AISkillSimulationUtility.cs 4559e4425b9d303aa8eb75f359b238a14973139f41c3402b940335320b71e620 0 +Wizard\AIStack.cs Wizard\AIStack.cs 683c5d650c1bb5fe8bf9d1e759968da523a14d2629ca8cbe3aec36723f0e5cdb 0 +Wizard\AIStackCountUtility.cs Wizard\AIStackCountUtility.cs ccbc006affb19a24630fedd07036764ce74c16a27bfec82cca8d6f122072ea8e 0 Wizard\AIStyleData.cs Wizard\AIStyleData.cs b75cc3deb327eae14e96b093b08f66eab487dec8b59a30c64cee250bf7529f28 0 Wizard\AIStyleFileNameList.cs Wizard\AIStyleFileNameList.cs 1a15d2ba07c655c979cbf8834db7bafda84903e6acc1b26f5bedcce4237f8154 0 Wizard\AIStyleKey.cs Wizard\AIStyleKey.cs 6de01f9b6e4e7facd907e2d36e12a8a2313645438595bf25f36dc7fc67276470 0 Wizard\AIStyleQuery.cs Wizard\AIStyleQuery.cs 6169604f23901d24f1bf2781c25d17284e52b21a1cf85795e3ea89b5fe017031 0 +Wizard\AISummonAttachTag.cs Wizard\AISummonAttachTag.cs 9dfbd28ccf548a3944d9bc43a55a49e47d241749e94e8d3ceee84cc53821ca0b 0 +Wizard\AISummonBanAttack.cs Wizard\AISummonBanAttack.cs c415ca03a172b490733e41354b7a2fc81fbeb460abfabc33c5e6b733a0024e42 0 +Wizard\AISummonBanish.cs Wizard\AISummonBanish.cs 2aef8da72e9fdd4cb509b1c35602e8144fc4a315163538f21bd8aa97420d3f15 0 +Wizard\AISummonBuff.cs Wizard\AISummonBuff.cs 234c45562a061bcde89da1b8cab5ae4fe31930b2cbf3171a8c3e7e42b535a60d 0 +Wizard\AISummonDamage.cs Wizard\AISummonDamage.cs 24481dd1bca2c80dff6986f5745499fc3c4c9fd2b9398a842f7799c70dd2cc61 0 +Wizard\AISummonDestroy.cs Wizard\AISummonDestroy.cs 72d6aa7fb6f698d5e7793d4fd87ced13b7f1f4e8c0e672be8e4dcba91f685ea3 0 +Wizard\AISummonEvo.cs Wizard\AISummonEvo.cs 7b13de04204ee846b7ab6c38c177e86e679a27f71b87d849360882833a7623d2 0 +Wizard\AISummonHeal.cs Wizard\AISummonHeal.cs 22b2a87ce6550981b93a6ba052ada51250037da8ded7abe2c1c3c1537b4c481c 0 +Wizard\AISummonKeywordSkill.cs Wizard\AISummonKeywordSkill.cs f5cb13b541d9e396f960174bf9cf89cbe6f9d0f2029f4ec7c619676852b9a6de 0 +Wizard\AISummonTokenUtility.cs Wizard\AISummonTokenUtility.cs 845a9eacdf2b4ed8f95226faffdc27f9ed455df1d198d1a0d8d71e5feb57f2a8 0 Wizard\AISummonedCardContainer.cs Wizard\AISummonedCardContainer.cs d0bfb2ed4b33f3945b9e04fdf8c55695164c4c16612c1e488794afce79f7601c 0 Wizard\AITagCollectionContainer.cs Wizard\AITagCollectionContainer.cs 27d58c22dca581c88747a8638279d60ab08d3171ba99e2e090e9633299c0196d 0 Wizard\AITagPreprocessCollectionBase.cs Wizard\AITagPreprocessCollectionBase.cs e34637b6e62216a23657c91a3f1ee73e97e59da9d9bd081efd4ca6d4e34f1e1d 0 @@ -441,64 +1888,180 @@ Wizard\AITagPreprocessCollectionContainer.cs Wizard\AITagPreprocessCollectionCon Wizard\AITagPreprocessCreationOptionBase.cs Wizard\AITagPreprocessCreationOptionBase.cs eb9315ebfb1987f84580adca2a88e8dc15133aa04db4d561621246deb65ac87e 0 Wizard\AITagPreprocessInfoType.cs Wizard\AITagPreprocessInfoType.cs 665eae10681ddf1d887f7a74238f34547fc03e16525b423b420a29e994059611 0 Wizard\AITagPreprocessInformationBase.cs Wizard\AITagPreprocessInformationBase.cs e18a087047b3036f679ae974be8b2a50a5ddf88203ff29d6b626c9ae25db0002 0 +Wizard\AITargetSelectFilteringUtility.cs Wizard\AITargetSelectFilteringUtility.cs 8757e4a3b3f598d0b6cd9f22fa9f07c435a9736f8765ff221d8168256fa8f726 0 +Wizard\AITargetSelectTagArgument.cs Wizard\AITargetSelectTagArgument.cs 0c0e6c7aef949e8a0faf2e1f801dbf5b845acf861c4853d8147745aaa6952a85 0 +Wizard\AITargetSelectUtility.cs Wizard\AITargetSelectUtility.cs 5f549dcc4d55e0f4cf3cd985da3509c16ede9da96697be910719befb5083024f 0 +Wizard\AITestGlobal.cs Wizard\AITestGlobal.cs de9e6c279378b0b572d4711021c57806343879ddb63b58f690062092fc7b6f87 0 +Wizard\AITimeOverAttackSimulator.cs Wizard\AITimeOverAttackSimulator.cs 4109f7c9c14ada1d326e788923a8aad30d056201465fcddf3fd7b1465894a7a5 0 +Wizard\AITokenDrawUtility.cs Wizard\AITokenDrawUtility.cs 2d321e831d5d8dfb62acc3c0753300d7e7bf931e580aa3342079abc0b06c37c9 0 Wizard\AITokenIdCollection.cs Wizard\AITokenIdCollection.cs dbf0f2fd026e6d20846c02ffec5fa32f1c659fb4f00b3a1c6e1f30638499b74e 0 +Wizard\AITokenIdHolderCandidateRangeInformation.cs Wizard\AITokenIdHolderCandidateRangeInformation.cs adcba8870fda5fcf81f5f746fe12e8f07fe8ff2df4062a975e327d0bfa5e6281 0 Wizard\AITokenInformation.cs Wizard\AITokenInformation.cs 911f946fad7fb683cd339c1d3582cc13e81e96c17eb241f260aebf584c8a8914 0 Wizard\AITokenManager.cs Wizard\AITokenManager.cs f0ce94639584c1b363526168b4fd389f53a55736dd6638eeafa03d2d5d7aa670 0 Wizard\AITokenPool.cs Wizard\AITokenPool.cs 7168cc127e6d2d3f8fb71f084ec127d1df61ed7c146aa7180702b7056c747320 0 Wizard\AITokenType.cs Wizard\AITokenType.cs ce54ae877e3ca2b888bcf80ff8b8494165fec70e7a4f13feea2e8fe03dfd09ee 0 +Wizard\AITribeSimulationUtility.cs Wizard\AITribeSimulationUtility.cs 82b68a7cd3ed189e04ea6bc6a3a52ac4b4d9d7b4a3cb081943bd01a28bfdc2a3 0 +Wizard\AITriggerAndTargetFiltersTagBase.cs Wizard\AITriggerAndTargetFiltersTagBase.cs 026d4aecc5dc6a81ac119525845a229522da50839ae8d51d8e3305513026a422 0 +Wizard\AITurnEndAddDeck.cs Wizard\AITurnEndAddDeck.cs 191157108dbb150e5d75b09edb4ea510e0bc093160d532aede308c5bc60e39dc 0 +Wizard\AITurnEndAttachTag.cs Wizard\AITurnEndAttachTag.cs b76c2d27b2a23727a54e8dc80b27ccef86522476be18646b189b1655567201fd 0 +Wizard\AITurnEndBanAttack.cs Wizard\AITurnEndBanAttack.cs 48abdb55cce7a0a547fddc873b124ee91d7551ef4b26fd3340b81b6991285ee3 0 +Wizard\AITurnEndBanish.cs Wizard\AITurnEndBanish.cs 60106ef86508303a9ec75c5614dfad17f5ff1f1d0251b08fb868d1ecad8fe820 0 +Wizard\AITurnEndBarrierBase.cs Wizard\AITurnEndBarrierBase.cs 6f7fe86b8b850855440aee5dda1786aca64d6a9f81c6a4b4f34d0461a12b186a 0 +Wizard\AITurnEndBounce.cs Wizard\AITurnEndBounce.cs 50f2f12f5eb85bc1afd9468972334a2aec72dccd091a18fbf3b9fdf4ecb92226 0 +Wizard\AITurnEndBuff.cs Wizard\AITurnEndBuff.cs 846a0077c69cf5b5765da39aafd7eeb9f4c2c3d8154469452bcb108cb3262516 0 +Wizard\AITurnEndDamage.cs Wizard\AITurnEndDamage.cs 812d7c3005a15fd8d52a779f5d988cd2ed0ffd5eda450bb367ca1b095e2a4f94 0 +Wizard\AITurnEndDamageClip.cs Wizard\AITurnEndDamageClip.cs 46125e93869975cddb05dc0c99685bdf0422172faf09224c54a558e616315c2b 0 +Wizard\AITurnEndDamageCut.cs Wizard\AITurnEndDamageCut.cs 91d04463d782f459a15ab205bf49ba0d76a16d21acb27c7aff4577612942fc04 0 +Wizard\AITurnEndDestroy.cs Wizard\AITurnEndDestroy.cs 7eead5a86b52b8135b8ecc5e94ffd8ca9f17eea405fb012898219e2c6f1292b0 0 +Wizard\AITurnEndDiscard.cs Wizard\AITurnEndDiscard.cs 129b493420b50ac98bd8449263673ee9028d801fa262a55e459c9b75d3a24497 0 +Wizard\AITurnEndDraw.cs Wizard\AITurnEndDraw.cs 9c131a8da161b835c68601b098a8648f7f5bb06873d09acffc8434ec67cf0923 0 +Wizard\AITurnEndEvo.cs Wizard\AITurnEndEvo.cs c38a9d1b494465ff3bf86dd81a34615f4b146041be0864b177738da470988f9f 0 +Wizard\AITurnEndHeal.cs Wizard\AITurnEndHeal.cs eab24857803482237853af06e983743cac0e4edb530a829856b550a02ae761aa 0 +Wizard\AITurnEndKeywordSkill.cs Wizard\AITurnEndKeywordSkill.cs ab17c78a6cdc42f2163c67c77a3fde10a1d8a11c7ff125870832304d091428f2 0 +Wizard\AITurnEndMetamorphose.cs Wizard\AITurnEndMetamorphose.cs 230be7340722365c169680caa70758c3c8511935a855971d5dbf2f58f3e296f2 0 +Wizard\AITurnEndRemoveTag.cs Wizard\AITurnEndRemoveTag.cs 396f2c699e39f62a3a39ad65e8fa279edca065699c5fff732723e582c2185f9b 0 +Wizard\AITurnEndSetLeaderMaxLife.cs Wizard\AITurnEndSetLeaderMaxLife.cs a590c41645dea9666d9f2c60494d43633d2ff1faac5a684e1bec475d732b550e 0 +Wizard\AITurnEndShield.cs Wizard\AITurnEndShield.cs 97cfd288f54a72bf0d2a2704f57b516a5ba800399afa76e94b6e88b8154d0b07 0 Wizard\AITurnEndStopCollection.cs Wizard\AITurnEndStopCollection.cs 136f36ed4e72e510181ac0402fcf399bb5f535fd7d31561be7f518b50e8f51f0 0 Wizard\AITurnEndStopInformation.cs Wizard\AITurnEndStopInformation.cs 281335cf192a4366bd3199b0da5efaec06580652e644dd6b7c2c268cc51aa37c 0 +Wizard\AITurnEndSubtractCountdown.cs Wizard\AITurnEndSubtractCountdown.cs 8854aa8b0b6c79a9a6faee76ff7e5b0687565fa61973fbdcc29993acc5d13fa0 0 +Wizard\AITurnEndToken.cs Wizard\AITurnEndToken.cs d80b08f879c5b3273e6ab172832b6b45e16db06f7532df680f301760416cd5d6 0 +Wizard\AITurnStartAttachTag.cs Wizard\AITurnStartAttachTag.cs 7039759b95b59ff90e3882408fd20d817df0e536f0ffe1727786e2433be06eb6 0 +Wizard\AITurnStartBarrierBase.cs Wizard\AITurnStartBarrierBase.cs cb6597e9d362b06f0c399005ade74b18b26273338840cc6daa119daf62ecf849 0 +Wizard\AITurnStartDamage.cs Wizard\AITurnStartDamage.cs e12c31596eafd8967bb7e97ce5f232e26121c9ad9294cc64cb44927cdfdb8f68 0 +Wizard\AITurnStartDamageCut.cs Wizard\AITurnStartDamageCut.cs a58405f144711352088d24e2904195392c78f71b398e69f49a3ebd85ec08531a 0 +Wizard\AITurnStartShield.cs Wizard\AITurnStartShield.cs 9f373c0ef89a514b81cfcdf5addf7be380190387847da179138314467ccd2c65 0 Wizard\AITurnStartStopCollection.cs Wizard\AITurnStartStopCollection.cs 7dd089da37cc3d173715402a51a39f48f0292d8e203c027901f87f23fe4311ba 0 Wizard\AITurnStartStopInformation.cs Wizard\AITurnStartStopInformation.cs 76e8db6a6a26c267e5b8e07d9160ad9dad0576f0e79450829a709ae388dd231c 0 +Wizard\AITurnStartSubtractCountdown.cs Wizard\AITurnStartSubtractCountdown.cs f4f126b4c4b7f4c9237f1b95de696d5789c874a3cca283c5fc43562d5ad5f3bd 0 +Wizard\AITurnStartTagArgument.cs Wizard\AITurnStartTagArgument.cs 7e7955f3db5977e2bc50bafc1b11973aa0a2adaf1138ff9e7ab84a79b25c25d2 0 +Wizard\AIUnknownAction.cs Wizard\AIUnknownAction.cs 16cdfe9b32664cd9fbf2cb14fe3eecbfcd4af21e6a809f8b55f80e833fb16b1f 0 +Wizard\AIUntouchableLeaveStopInformation.cs Wizard\AIUntouchableLeaveStopInformation.cs 203beb5200503259ff212f32210f658f680d3fcbfac20b872470af20f671788c 0 +Wizard\AIUseMinArgument.cs Wizard\AIUseMinArgument.cs 3fd829133058234c4655f21e177aba7df5bc1ebf3b3f6fa63bf3024e6a6cf54c 0 Wizard\AIUseMinTagCollection.cs Wizard\AIUseMinTagCollection.cs 49be88a6eed6e2dfbf241579edcc26289cc55b2c44b69c20741a4331a1378318 0 Wizard\AIVariableResultContainer.cs Wizard\AIVariableResultContainer.cs 56033f00c8e3140cbd10eb664754c95023508f39bea9feea9d23304207494ff6 0 Wizard\AIVirtualActionInfo.cs Wizard\AIVirtualActionInfo.cs 801c6b5e247be407dcdeec45bc9a2f5f2410f3a29e011a17cb8d07ebf9ed62ba 0 Wizard\AIVirtualAttackInfo.cs Wizard\AIVirtualAttackInfo.cs 16138524d2911ef07eae4739930e82dc39ea7a9602b9e52799ff1e8ea1fc3b94 0 +Wizard\AIVirtualAttackSimulator.cs Wizard\AIVirtualAttackSimulator.cs c3236d0263b9e8ce21e820cf434e475fcda4f16235372b15567a2a005493c326 0 Wizard\AIVirtualCard.cs Wizard\AIVirtualCard.cs f37b7687359543b67e6934292a0d187326ed1ac3dd097e3e124f938832fa675e 0 Wizard\AIVirtualCardBuildParameterCollectionBase.cs Wizard\AIVirtualCardBuildParameterCollectionBase.cs 14896f9714593475b4d33269f56967d442796011b453f667db13d97178ca33c9 0 Wizard\AIVirtualCardParameter.cs Wizard\AIVirtualCardParameter.cs 0efb3001f156f1c6361b6794f06dd87bea04cc38c7b745d8df5f0b9d36c59ec6 0 Wizard\AIVirtualCardRealTargetInformation.cs Wizard\AIVirtualCardRealTargetInformation.cs 4a234fd97705c34f3dda6849640115395632aaff4d354696cd8c35afa07be181 0 +Wizard\AIVirtualCardStatusInfo.cs Wizard\AIVirtualCardStatusInfo.cs 9cb8040efc2704b8ce4afe7e087032d8f68ab26c68eaecdb4b370922b045d588 0 Wizard\AIVirtualCemetery.cs Wizard\AIVirtualCemetery.cs c2707eeca2eb4d065b4b056abf85843509bd3dbb82b91d4747437f2887e89df2 0 +Wizard\AIVirtualEvolutionSimulator.cs Wizard\AIVirtualEvolutionSimulator.cs 20e2f60a30715c207fa2364d6e511b4fa4f4fe2473f25bf21b29d4eaac50b3d9 0 Wizard\AIVirtualField.cs Wizard\AIVirtualField.cs 0219d29471a281bbbfa4f60c07749a9e7d34077cff8221880fb96ec5b4977fae 0 Wizard\AIVirtualFieldBuildParameterCollction.cs Wizard\AIVirtualFieldBuildParameterCollction.cs b3254b56ce4ee183df65a293880648998f8d909ca753d1f9db9acaba57c9256c 0 Wizard\AIVirtualFieldRollBackBasicProcessor.cs Wizard\AIVirtualFieldRollBackBasicProcessor.cs 81541ea41b43625a1a7a52eebed6ebb76a8557fcdba4e3ca77849a5139ae4057 0 Wizard\AIVirtualFieldRollBackRecord.cs Wizard\AIVirtualFieldRollBackRecord.cs e4be2b685c75a93716faae94ab5a6ad2577436bcd9296490fc1ccc396ae57d60 0 Wizard\AIVirtualFieldRollBackStackProcessor.cs Wizard\AIVirtualFieldRollBackStackProcessor.cs 91c7aa2ad8aa81b00a9546775e5c877c7fd952050363b4d04ff236c401b8d6db 0 Wizard\AIVirtualFusionIngredientsInfo.cs Wizard\AIVirtualFusionIngredientsInfo.cs 2139b7abc3dda0c64b9ef32312249e699f7420d46192a1213552c04bdf015497 0 +Wizard\AIVirtualPlaySimulator.cs Wizard\AIVirtualPlaySimulator.cs e260579db3a1f8f2d239f8fbbbd5cf77db7059fce61e3c8d60875b81891cf0a5 0 Wizard\AIVirtualTargetSelectAction.cs Wizard\AIVirtualTargetSelectAction.cs 23df015a493f920e8f0eaf3e88aafb0f8397fac75d7b17d131ac30f2b5404733 0 Wizard\AIVirtualTargetSelectInfo.cs Wizard\AIVirtualTargetSelectInfo.cs c579901ee72ff4da84d5cdbc379897060ef0a7d2dbf6d03cafbf75585d47adb6 0 +Wizard\AIVirtualTargetSelectSimulationInfo.cs Wizard\AIVirtualTargetSelectSimulationInfo.cs 97d7e9e0a4902bf83a54ae4c08ee941309ac15ba17364c6671d8d8511948c28b 0 +Wizard\AIVirtualTargetSelectSimulator.cs Wizard\AIVirtualTargetSelectSimulator.cs 6d3b89da8e3b578c562c3abd4a89a62d194b14e39bef07dd2cbc369c5a3a56db 0 Wizard\AIVirtualTurnEndInfo.cs Wizard\AIVirtualTurnEndInfo.cs 57004c97cdbcd0a560ef3e3053a28391e92e99ace0ccd2ff631f27a1180950dc 0 +Wizard\AIVirtualTurnEndSimulator.cs Wizard\AIVirtualTurnEndSimulator.cs 3d978a9862daf02faff309fae4e6fac80591e2ba19eeda700b551060a2749697 0 Wizard\AIVirtualTurnStartInfo.cs Wizard\AIVirtualTurnStartInfo.cs c5bab0e979a9a11eedcdd3178b608f22f0db55ab9dd0d3b46532a64028945eef 0 +Wizard\AIWhenAttackOrWhenFightTagArgument.cs Wizard\AIWhenAttackOrWhenFightTagArgument.cs f96ca8d94b92660d5c0f8df132af620ec09f5fce1b38d9b7ea0be734fd596856 0 +Wizard\AIWhenAttackSelfAndOtherTagArgument.cs Wizard\AIWhenAttackSelfAndOtherTagArgument.cs 6665add8baa1adba40c929d367e3c21dce5e0b08c42b635356d6dcde17a47d4a 0 +Wizard\AIWhenChangeInplayTagArgument.cs Wizard\AIWhenChangeInplayTagArgument.cs 4b7c4ee4252f7be9171c6ad9bc6aedfbd2cfc1348e3a4db6a13e4ef1c3c5bbc0 0 +Wizard\AIWhenPlayAddCemetery.cs Wizard\AIWhenPlayAddCemetery.cs 4d183e6f493fca5d8372463eb735f9cb41b71784ceb86d620a2d97e21a62d048 0 +Wizard\AIWhenPlayAddDeck.cs Wizard\AIWhenPlayAddDeck.cs 3bdb2db078e1d875d872141a8e5e550f1dccfc8f8ef6a01c30a65a9d22b2d549 0 +Wizard\AIWhenPlayAttachStyle.cs Wizard\AIWhenPlayAttachStyle.cs cbf54b40c1e05f101e46a658690a9ee65ccef411a09be96f71d5fa1ac0628a8b 0 +Wizard\AIWhenPlayAttachTag.cs Wizard\AIWhenPlayAttachTag.cs 9a61c380dc61d8be31c277d800e39af6ead5a2fbe37277109d74dd4bb61cd795 0 +Wizard\AIWhenPlayAttackableCount.cs Wizard\AIWhenPlayAttackableCount.cs 8800d55f1091765d1414c03ebf417084cce3733cd9546e7defab34d4e879513d 0 +Wizard\AIWhenPlayBanAttack.cs Wizard\AIWhenPlayBanAttack.cs a4f243694e6b6465ffd417ed2bf8f6bb4d0ed904ccc6cc5ed0b2cf68fcca5255 0 +Wizard\AIWhenPlayBanish.cs Wizard\AIWhenPlayBanish.cs d05927ddaa8b01ffac57cda2bc104aee4dad718bf3588e42fd41697d65906c6f 0 +Wizard\AIWhenPlayBarrierBase.cs Wizard\AIWhenPlayBarrierBase.cs 014e9890549ec2dbb16a607863e113c7a5ae4d8417d286a9f12230e18693b40a 0 +Wizard\AIWhenPlayBonusInSimulation.cs Wizard\AIWhenPlayBonusInSimulation.cs e8a3c9a510afe7178f5be4a85450afe40b9cd6e8bae1ee10583c2fa0d914d695 0 +Wizard\AIWhenPlayBounce.cs Wizard\AIWhenPlayBounce.cs a8f6f0283c9e62f397c746e03d0386a9fc37269558f13280eb3f718600484225 0 +Wizard\AIWhenPlayBuff.cs Wizard\AIWhenPlayBuff.cs 1fd8071a98420fce42d085455b17e78bfab56d0c1a80100b39fd8c24bc525d37 0 +Wizard\AIWhenPlayChangeClass.cs Wizard\AIWhenPlayChangeClass.cs 727ae3a54e42232bc98d8e934a4e9bbd3a425a6c4f714d65a3d317019eb1cc0d 0 +Wizard\AIWhenPlayChangeCost.cs Wizard\AIWhenPlayChangeCost.cs 6dd2d34e65e460ce463ecfb86da4c7af511a17143da750511112914aeb054421 0 +Wizard\AIWhenPlayChangeTribe.cs Wizard\AIWhenPlayChangeTribe.cs 3df43f60c01b651610601db8c4eb964a79499333d86176ecb1eb204907c0f584 0 +Wizard\AIWhenPlayCopyTag.cs Wizard\AIWhenPlayCopyTag.cs 628e25bce3d3e0218541c3ade72e6edad3672a55bf6bc47a80f5eada08dfeecb 0 +Wizard\AIWhenPlayDamage.cs Wizard\AIWhenPlayDamage.cs 218cbafdbaed6c83d5bdd1aec3392ec999324b22b38f03297ea8ce569a6be0c5 0 +Wizard\AIWhenPlayDamageClip.cs Wizard\AIWhenPlayDamageClip.cs 5c3fe6dc28063e8dc0c05c654ab0c4c53005c9d86bbc3f1147177c413e63e9b3 0 +Wizard\AIWhenPlayDamageCut.cs Wizard\AIWhenPlayDamageCut.cs 40fd6d089320ad75a886bc1b5bda6634369b01296c3cec7653c2ae65c4504feb 0 +Wizard\AIWhenPlayDestroy.cs Wizard\AIWhenPlayDestroy.cs 15bc0f758a2a46c0e2aeed06e170beff862bead1626dbe95ba7d4c9385832f6b 0 +Wizard\AIWhenPlayDiscard.cs Wizard\AIWhenPlayDiscard.cs 0e6041da94760be246e56c43cc0570291228a7638fe4c61c69ab97ccead22870 0 +Wizard\AIWhenPlayEvo.cs Wizard\AIWhenPlayEvo.cs ea42ef3997360335ff5c2aacbffffd2fb4b77eb50c6abe51bb14c1f93d62f9e6 0 +Wizard\AIWhenPlayHandBuff.cs Wizard\AIWhenPlayHandBuff.cs b8b7604c0d7be1177deff7a2ef5238cc92f3fd233e92fce2ecc3f069c6949138 0 +Wizard\AIWhenPlayHandMetamorphose.cs Wizard\AIWhenPlayHandMetamorphose.cs 5a04d681fae694932cd871f29b69e49ac3599aeb058899559a404b9695aa642f 0 +Wizard\AIWhenPlayHandSelect.cs Wizard\AIWhenPlayHandSelect.cs 6df478f1146f5626102517e7f3a8d5e5a426550d83d10e64058e4844fc81e86d 0 +Wizard\AIWhenPlayHeal.cs Wizard\AIWhenPlayHeal.cs 075b468870319ffba66b721b5750cba7e5166e5d1bb4fb463b122b28d77198dd 0 +Wizard\AIWhenPlayKeywordSkill.cs Wizard\AIWhenPlayKeywordSkill.cs aad155504b365354097c6a970af797c962f1fb6fd79c5fb32ac7218e0ce5bf59 0 +Wizard\AIWhenPlayMetamorphose.cs Wizard\AIWhenPlayMetamorphose.cs 7577ca26bacb1cc0ca9133c33b0647fbac066d7984faf19be132ef8c0e2d7761 0 +Wizard\AIWhenPlayModifyConsumeEp.cs Wizard\AIWhenPlayModifyConsumeEp.cs f4a7ea66959ad9b77c9e9883259644bc4392f8b75d228a11f4178bbac85d7f91 0 +Wizard\AIWhenPlayNotBeAttacked.cs Wizard\AIWhenPlayNotBeAttacked.cs 6bfd68b2b0f4b04526e6eec54f4e6850a33fca54cbc8c36decdd6af5a685a340 0 +Wizard\AIWhenPlayReanimate.cs Wizard\AIWhenPlayReanimate.cs 69eb133662a917d8428a47786609b99bafaa44514fee1e9d5378ad43110074eb 0 +Wizard\AIWhenPlayRecoverAttackableCount.cs Wizard\AIWhenPlayRecoverAttackableCount.cs a5b7a7683cebe94eacac0d3bdcecff493891014f42c0c1f8cfd972fd628a438c 0 +Wizard\AIWhenPlayRecoverPp.cs Wizard\AIWhenPlayRecoverPp.cs 561852d83c11174c30ee87e36ae179195cbe7d49cdc0ed1def086e48510bb3e5 0 +Wizard\AIWhenPlayRemoveKeywordSkill.cs Wizard\AIWhenPlayRemoveKeywordSkill.cs 00c464dd2472ec7641334398ecb65cc91b91d4c670ef57abce11e1ad619d84c5 0 +Wizard\AIWhenPlayRemoveSkill.cs Wizard\AIWhenPlayRemoveSkill.cs ad9d9536aa5ca983696d219ad02db0198821b430e0996709abe5d3cfe4cef7a2 0 +Wizard\AIWhenPlaySelect.cs Wizard\AIWhenPlaySelect.cs 2897ae363869267e7ff5669cab90a51dfa63fd21cbf595e5be6a55de78814eb6 0 +Wizard\AIWhenPlaySetLeaderMaxLife.cs Wizard\AIWhenPlaySetLeaderMaxLife.cs b64101aa379550d8b91176d84973a50386ff8e234e6d64fe1d02cee790d4364b 0 +Wizard\AIWhenPlaySetMaxStatus.cs Wizard\AIWhenPlaySetMaxStatus.cs 6b4e7dbaf469c282adc80c555988ef266bfd08e993e26e4c56d6718137d4d30b 0 +Wizard\AIWhenPlayShield.cs Wizard\AIWhenPlayShield.cs 05a9eb8babd7477e0f18cb29733849c101950f0ef46e7c6d2486dd7ee0ba1d65 0 +Wizard\AIWhenPlaySpellboost.cs Wizard\AIWhenPlaySpellboost.cs 4d61b8e8c9f8eb35629b5790a0b500758e9a385aff302c636a2bf831925e238e 0 +Wizard\AIWhenPlaySubtractCountdown.cs Wizard\AIWhenPlaySubtractCountdown.cs 4715e2c03539860820044dbc17624eba9372fac94241cdb4f753f13c9056801f 0 +Wizard\AIWhenPlaySummonHandCard.cs Wizard\AIWhenPlaySummonHandCard.cs 2d67e7fad7cbb2d8279c2043d7fa94bc70451efdb76ba83098fbefc9f850fd79 0 +Wizard\AIWhenPlaySummonToken.cs Wizard\AIWhenPlaySummonToken.cs d87039563bae9d4abe524dc3f76df63063925ed420fef72507b0d66550fddfca 0 +Wizard\AIWhenPlayTagArgument.cs Wizard\AIWhenPlayTagArgument.cs 374f17523d8266b87644faef9bfe8c6e2f7cd5004f851f0448c3d8a10fc1b429 0 +Wizard\AIWhenPlayTokenArgumentBase.cs Wizard\AIWhenPlayTokenArgumentBase.cs 0b94d1ff02bb4cc8a87ba200cc16dcdcf20146293d448f86dbf4d43dae61a22f 0 +Wizard\AIWhenPlayTokenDraw.cs Wizard\AIWhenPlayTokenDraw.cs e61b4aaba2515f7e5968930f248e16dbf1e4126cf01433d12d82bc68a13708ea 0 Wizard\AI_LOGIC_LV.cs Wizard\AI_LOGIC_LV.cs e6a97a7f33f421973293eff0f046a0a8422ddc4103f3fb7b77a114c0f6b7b9d6 0 +Wizard\AchievementImpl.cs Wizard\AchievementImpl.cs f7e7690b1c5f5ed7e6d08e2ebb6624ac1c175a874b83806b16fd0fd89d857030 0 Wizard\ActivateCountTagCollection.cs Wizard\ActivateCountTagCollection.cs fb0b8de915750511da274995871c184582f447c1b1d5a6569960db243bf1f482 0 Wizard\AddCardToPlayoutPlayPtnTagCollection.cs Wizard\AddCardToPlayoutPlayPtnTagCollection.cs be590b8fc0998c928f0130913b0aa923eaff662f21368401ab13ea2d763f349b 0 Wizard\AfterAttackTagCollection.cs Wizard\AfterAttackTagCollection.cs 399655aabb4fb431693df63b42794178c30765b5e3e708214bc55a7a1a6b9236 0 Wizard\AfterClashTagCollection.cs Wizard\AfterClashTagCollection.cs 7e4c59ef671559d3a1be6e9b7745fd67ff19afcdf2b37c8eb3eaa042596ef1ea 0 Wizard\AfterDiscardTagCollection.cs Wizard\AfterDiscardTagCollection.cs 076f64ad48ce2473fe5aacbe16790488872c5c1992577ba9cfb7d1472ade0d27 0 +Wizard\AllLabelColorChanger.cs Wizard\AllLabelColorChanger.cs 9b542c07fbe67066b958313e2220d5943550a9ff443b9700e7f2aec8c7e0c601 0 +Wizard\AllyPlayBonusPolicyCollection.cs Wizard\AllyPlayBonusPolicyCollection.cs d7e0242716e16cf65624181e1f3c2c7b21cd2d450863368009c4cf9475f4db35 0 +Wizard\AllyPlayBonusRatePolicyCollection.cs Wizard\AllyPlayBonusRatePolicyCollection.cs d33ddef3ce145c7b8acd943c451ba8657c25f0c98f243ee7a4f21d9f1857f32a 0 Wizard\AllyPlayBonusTagCollection.cs Wizard\AllyPlayBonusTagCollection.cs 04260820f1240296416afe9d579b64e16c953293375bd26d7b956a0f37341d16 0 +Wizard\AreaSelectClearReward.cs Wizard\AreaSelectClearReward.cs 6e11173e7b2d4d16b18e4f8ce7e7c5f588e754cd013ac4e0cc58176537736f83 0 +Wizard\ArenaConfigDialog.cs Wizard\ArenaConfigDialog.cs 95172ffd65a3e90cb63f7d9368dd662721f74fa5526f6397a82eb56a182081c0 0 Wizard\AttachedSkillInfoReceiveData.cs Wizard\AttachedSkillInfoReceiveData.cs 40db29bd9eeb41d3a0e15aab0a91ddee7a24709d5742d05584b8a76100522aaa 0 Wizard\AttachedSkillInfoReceiveDataCollection.cs Wizard\AttachedSkillInfoReceiveDataCollection.cs 9fccf7143e59065644b7cb96f1bb56f52ef4a5353eae76c1a161846544222c6a 0 Wizard\AttackBonusTagCollection.cs Wizard\AttackBonusTagCollection.cs ead7de323b51ab6321e12b5ce37616db9d75cb4ba1c8b5887fd929383cd16586 0 Wizard\AttackByLifeTagCollection.cs Wizard\AttackByLifeTagCollection.cs a67f23b492a670013588dee1fd854d9bcb9ae3c3a62a9b8020a57e40e2578a5c 0 Wizard\AttackTagCollection.cs Wizard\AttackTagCollection.cs dfd6643aae0b0677bdd31fd52845c995bf14d4a78b4818d272f20f39e7c6340e 0 Wizard\AttackableClassTagCollection.cs Wizard\AttackableClassTagCollection.cs 87f2a7fc4a2cca3d35ad802fbf745b621c94eb9b19e4f4414b763902064303cc 0 +Wizard\AvatarBattleAllInfo.cs Wizard\AvatarBattleAllInfo.cs aa81432dab0e99a84a4aadceec6db2c859c5ef15d5112d0c2e8872ffcaed7745 0 Wizard\AvatarBattleInfo.cs Wizard\AvatarBattleInfo.cs d3417046e0acea3e6806fee941f30ee543f122d34956412ba61f5822e42c6a95 0 Wizard\BanishBonusTagCollection.cs Wizard\BanishBonusTagCollection.cs 02d6a7110fe4433971e2499430f5bb929d665c70805a9c148f4b4108324bcb9c 0 Wizard\BanishTagCollection.cs Wizard\BanishTagCollection.cs 9e9bfded276a6d2cdd2f21775da1d55d1b744b5a950d52ad369a0fac152f68b4 0 Wizard\BannerDialog.cs Wizard\BannerDialog.cs 4c2e9f967bb9166bb2891bc9f01e16be05bad5a4734da3dcac094ec9419dcc9b 0 +Wizard\BarrierBonusPolicyCollection.cs Wizard\BarrierBonusPolicyCollection.cs b0c4650dd4c3aecdd39b732f72a999762c493b0e89ed5187e223093f3f6923b7 0 Wizard\BaseParam.cs Wizard\BaseParam.cs aafba52c5b868cb4b3c9736c6706113d8d521c754bdc9b955c8b9deda221c722 0 +Wizard\BaseProductDetail.cs Wizard\BaseProductDetail.cs 5d15337781bcac5656c95a9e42ea8dd5c77032851255a423251308a505fb801e 0 Wizard\BaseSeriesData.cs Wizard\BaseSeriesData.cs b5f6431a7d175f16784a36d07707c81d6f4ad0942135a0ee636de3de5caac758 0 +Wizard\BaseShopPurchasePage.cs Wizard\BaseShopPurchasePage.cs f158ce39f34b47b46ea2fe27605e7fa4a4ebc14db87b9240e47189066cbda891 0 Wizard\BaseTask.cs Wizard\BaseTask.cs f6e3ff4403c4ec32bf1d37807c1f8b51e419caa7feb6fd81887ae09c6d7e1348 0 Wizard\BattleBonusRateTagCollection.cs Wizard\BattleBonusRateTagCollection.cs cb619934e00027224da854ecdaae8e8c28757db722bfa2047f4cae761eb251db 0 Wizard\BattleBonusTagCollection.cs Wizard\BattleBonusTagCollection.cs eef79191a777a20d78afb363f8e18cc4f3a82767b7aff749ef1322e9041a4842 0 Wizard\BattleButtonControl.cs Wizard\BattleButtonControl.cs c01b03426b6150426c112d89cd9f21153dcf4bd7b587b6e6ff2dcbd954e9ddfc 0 Wizard\BattleCardRealTargetInformation.cs Wizard\BattleCardRealTargetInformation.cs c42a18e1aa2e252cca98136dca1350cf4a6a3c0314e7362691ceceb4a2375c23 0 Wizard\BattleInformation.cs Wizard\BattleInformation.cs 85808cdf3afae2207317b68833c14d5e65c10de6b630e7f5ed436ce4bfbe55cb 0 +Wizard\BattleMenuUserPanel.cs Wizard\BattleMenuUserPanel.cs 15180328be642d73316aa50844f52541cb4596249c7982344fb419811dc05101 0 Wizard\BattleParameter.cs Wizard\BattleParameter.cs a034f5db7cd37a8d8fc3e4b14a0e575694e236dbd6ca307d9ab1f827b99258c7 0 +Wizard\BattlePassGaugeInfo.cs Wizard\BattlePassGaugeInfo.cs b4940b7f064149a0137e7b0a61a9df21eb20b5e8cc885769979f91ee45059cc9 0 +Wizard\BattlePassGuage.cs Wizard\BattlePassGuage.cs fe0d550cbe5afc8acd6364b1a8966bdc08f1bcedf9467c32cc06e3d3b8c099b5 0 +Wizard\BattlePassLevelInfo.cs Wizard\BattlePassLevelInfo.cs 8c2484b47fb952aeb2e32134999644dc78babcb03e2f1a482c3f340135918c8f 0 +Wizard\BattlePassMonthlyMission.cs Wizard\BattlePassMonthlyMission.cs 2fe16dceba2cbaa3391d1e91821149c5eb45c64841478212dcbe59034724d8ae 0 +Wizard\BattlePassResultPanel.cs Wizard\BattlePassResultPanel.cs 332992ec3f44533c9f99f06d577f6a6834e815859c09a54d4264807d8b946eb4 0 Wizard\BattlePlayerPair.cs Wizard\BattlePlayerPair.cs ff8d3eb14f7bb8386d29f2891a1c5665ea857171bdae23493033729180b21bec 0 Wizard\BattlePlayerReadOnlyInfoPair.cs Wizard\BattlePlayerReadOnlyInfoPair.cs da9aacfc922101e0b5d741b0233dc3f8597fd07d339a5366d037745b8c2a0a09 0 Wizard\BattleRecoveryInfo.cs Wizard\BattleRecoveryInfo.cs 0a148f60eb5689ef33f58d98f43ea7f437702750dce77d9fbd7dc261118d44f4 0 +Wizard\BattleSequencer.cs Wizard\BattleSequencer.cs 91b1272eb25921ee6bae09cd08140d4d96496ada5b050aadab81f3a81623b070 0 +Wizard\BattleStartUserPanel.cs Wizard\BattleStartUserPanel.cs 9af3ec3df078b3f7996f0deabbe7bfce3275c8dfb81fba0e69e8d0e3e3d8ac18 0 Wizard\BeforeTransformVirtualCard.cs Wizard\BeforeTransformVirtualCard.cs 96c43888d9a72d8bc8b4dcb86439e635fd5919f9b9499e4ba92035ca0bebd4bd 0 +Wizard\BestInPlayMoveAI.cs Wizard\BestInPlayMoveAI.cs 7ca9982d80f65a598aaf66565055787d968ddb041fbe64e2a832f6079145b202 0 +Wizard\BestOpenSpaceAttackAI.cs Wizard\BestOpenSpaceAttackAI.cs 6be9bd37837ee5e84d7df230ca5c7d001f8f46bcf2f852ab4015a7ed2aa7595e 0 Wizard\BossRushBattleData.cs Wizard\BossRushBattleData.cs 5b9afe850670e86c4721cb59e61d3bba4cf78d99e66c328ef778d183c4c06084 0 Wizard\BossRushInfo.cs Wizard\BossRushInfo.cs 5e0c725f4d19e75b060bc8545f857c0f91dab77e994dcf1fbdbc67b2554a627f 0 Wizard\BossRushLobbyAbilityCandidateData.cs Wizard\BossRushLobbyAbilityCandidateData.cs eeae65a4867ad4514df39f64edb586c9c3b5fe31ea9b58ac1f86e7b9baf66e7a 0 @@ -513,57 +2076,114 @@ Wizard\BreakBonusTagCollection.cs Wizard\BreakBonusTagCollection.cs 45a5349698ea Wizard\BreakFirstTagCollection.cs Wizard\BreakFirstTagCollection.cs 96ba8fc479d7660a14317152215ec7c0580751851cc31fdf0eac439ee7f6dab8 0 Wizard\BreakLastTagCollection.cs Wizard\BreakLastTagCollection.cs d60299bc656680461cbb2281b6c67f06bc988c6383ffcad6d91ff3e4c504d39f 0 Wizard\BreakTagCollection.cs Wizard\BreakTagCollection.cs 5e6cdeacf56abe9077830a5baa5e0771c9df0286699365589fb097df4fa8e65a 0 +Wizard\BrowserURL.cs Wizard\BrowserURL.cs 1d4323f80f3d9a2cf492bbe5ad06a3f07edbfcabeef53990fe7b7ec46e0e9ced 0 Wizard\BuffBonusTagCollection.cs Wizard\BuffBonusTagCollection.cs 1ba4e258a1b6c2aa9c823d8ff70bdc0712fc407d9e831272a81f9244271eae16 0 Wizard\BuffTriggerTagCollection.cs Wizard\BuffTriggerTagCollection.cs 99d3a0179a6b33a85efaca75a7e2632fa0c0fc0073be168c83d7116e1b37602a 0 Wizard\BuildDeckCard.cs Wizard\BuildDeckCard.cs 2f49148b8472e0a45edf5d4360902605658057db7c34abe6d3e8e46f7f299367 0 Wizard\BuildDeckSeries.cs Wizard\BuildDeckSeries.cs 8f6144e6cb43e2a4924b3a5ebc06795d67461ea029bbc76126e97300532ba159 0 +Wizard\CampaignBattleWin.cs Wizard\CampaignBattleWin.cs 1608aa1db4226d5928be000b720dd0cc691dcea190d34c4f2f0fdece90e8609d 0 +Wizard\CampaignRewardInfo.cs Wizard\CampaignRewardInfo.cs 038717992648b3a4475456630a00f1a296113d304675e936a2a80b7a60de6fec 0 Wizard\CantBeAttackedTagCollection.cs Wizard\CantBeAttackedTagCollection.cs f7460a54faa7c37f3ba07645ac6d65995eee549127907ca1e77d5aecef4ea6b0 0 Wizard\CardCSVData.cs Wizard\CardCSVData.cs 228543612535910f39c39c273c6b55ab65214e2545bd77f97b38a6926ebc1ae4 0 Wizard\CardCraftPanel.cs Wizard\CardCraftPanel.cs ae136c5d1bfae1ea48d57669c114d0aa03f248a0bf7cef70c35e6371f9a44123 0 +Wizard\CardCreateTask.cs Wizard\CardCreateTask.cs a6293652488c0d0fe8149f883fb36e7effd670d619f53316650c46c010e297f1 0 +Wizard\CardDestructTask.cs Wizard\CardDestructTask.cs a896598ca607d49cd68cc02ed797e0d4a041ab41574b7d9eb8994844a8bb12b7 0 Wizard\CardImageHelpder.cs Wizard\CardImageHelpder.cs d7145108a61a669a9377af5eb021afeb0eb6a8e76a8311c6e7140abec0fe9725 0 Wizard\CardKeyWordCommonCache.cs Wizard\CardKeyWordCommonCache.cs a729b53da036c709d41b0dfc6a3c242ca336cda412ec538bb8296305c5123a9f 0 Wizard\CardListTemplate.cs Wizard\CardListTemplate.cs b41f32001b001470ac9aff768b4be92c3579999fe24f5de7646af80f31185fd1 0 Wizard\CardListsForReference.cs Wizard\CardListsForReference.cs 71df5335307ff56a2db97fe44bddd70d1e33425314de3ea15e35a74a8a48cfd7 0 Wizard\CardMaster.cs Wizard\CardMaster.cs 12b77985327a1e117d6af30c02a617c8de06203e73c77d1e16b86bdc2b312011 0 +Wizard\CardMasterLocalFileUtility.cs Wizard\CardMasterLocalFileUtility.cs 81527d4d49360eb86d71246678d34ab40373b705a6aa651c85d25611699de5ec 0 Wizard\CardParameter.cs Wizard\CardParameter.cs a7ea3ce6d2efad06697ea5e9ea2ce0b38280139b2e55a55f0c48aca2c99109fc 0 Wizard\CardPrm.cs Wizard\CardPrm.cs 41697c1ed692386772dfed98690e9a3471cbc295460b8fef2c7b5cbdfd223247 0 +Wizard\CardProtectTask.cs Wizard\CardProtectTask.cs 1b700bc1a2b75cecd4b8460cd90eddcb6e5de64c8cacc5ffe009786fe345f7a9 0 +Wizard\CardSelectListConfirmPagerView.cs Wizard\CardSelectListConfirmPagerView.cs 93ed1b34d2ed8b3f868bded81f89fd6ec1a2f63b607a6b553dac15ac8ccb86a0 0 Wizard\CardSetName.cs Wizard\CardSetName.cs 943b0083d367048c7cdebcfdc2780aee27f6d9f1adfafec7cb720830bb614f6f 0 Wizard\CardSetNameMgr.cs Wizard\CardSetNameMgr.cs 146a4a804055f9c3341301c3823bda3cf3f560e8032b5df46e1b7fca87009649 0 +Wizard\CardSkillHashUtility.cs Wizard\CardSkillHashUtility.cs ad5fba74351ce510165f83273391762c3cb57e96ff605e13cf3d5e544a2e6edd 0 Wizard\CenteringUIWidget.cs Wizard\CenteringUIWidget.cs 1ddc0ddbbfcd6638010dc6889706b3a5944ac5b122103cf24f9c0d7adde66efc 0 Wizard\ChangeInplayTagCollection.cs Wizard\ChangeInplayTagCollection.cs 0e52c7c354104e962110f89f72971455b6d1835ee41c01e07886fee28491dcd0 0 +Wizard\ChaosUtil.cs Wizard\ChaosUtil.cs 152adff597f552c9e74f44fe8c2bf41708055dc1c80e85410eea6aa04f0ad82c 0 +Wizard\ChapterObjectCenteringSupporter.cs Wizard\ChapterObjectCenteringSupporter.cs 43ae389f01e2a45d87767adfab44caaccb10d590e0509e4dcd54ee4d6787e7d9 0 +Wizard\CheckSpecialTitleTask.cs Wizard\CheckSpecialTitleTask.cs 191c82c69c744c93682a3516d15a7eefe0153962e47df48b88be507ed0d26095 0 +Wizard\CheckTimeSlipRotationPeriodTask.cs Wizard\CheckTimeSlipRotationPeriodTask.cs dc3007b64143e02fad056a87ef9f0c3e93f443499a851c802fb85a05a1525c65 0 Wizard\ChoiceTagCollection.cs Wizard\ChoiceTagCollection.cs ee83f8d599d0592e679c11c5c208841c1d044088b38e12604016e5f673f77cf9 0 +Wizard\ChoiceVirtualCard.cs Wizard\ChoiceVirtualCard.cs 8c1d30ba976b4c2f78da58bd6d53b38bbe255e39de2320ea2ff629d24d2800d6 0 Wizard\ClashBonusTagCollection.cs Wizard\ClashBonusTagCollection.cs 2290a26a5cf6378f6dbaaa730edc33893fe4b3a19257f6f0a69e297ff3f07a71 0 Wizard\ClassCharacterMasterData.cs Wizard\ClassCharacterMasterData.cs ccf929714e0900b6f422d46da6de8cb3c0702258ceb314509b6d7beac112fa93 0 Wizard\ClassInfoParts.cs Wizard\ClassInfoParts.cs 75b6923688f22d49ddc97db55ecb6daae2c8c4d444ccfaae66625d85ce35e208 0 +Wizard\ClassInfomationOrder.cs Wizard\ClassInfomationOrder.cs 885f4c62c3d6f3e026f95c4f83830f634bbbcfe4c74352d763bfb992ce21e4e8 0 +Wizard\ClassSelectionButton.cs Wizard\ClassSelectionButton.cs e54b6667dcf47f83bdb242337ba8d6744ddef3d8a7111201da5e83fa62475450 0 Wizard\ClassSet.cs Wizard\ClassSet.cs 37d444f7109e8637da98bc721c35286d6f0c45c49dbcf552603e26e453908e32 0 +Wizard\ClassSkinDetailWindow.cs Wizard\ClassSkinDetailWindow.cs 05f8f178d4cbec20554dcfbae3f9f62c22f55cadda61528334284c38185a0aae 0 Wizard\ClassType.cs Wizard\ClassType.cs c0be0ce00bb64ad28a85f1f1edfafa0216b67a47fa8d744a1b69c19b78c786ce 0 +Wizard\ClassUtil.cs Wizard\ClassUtil.cs fbfe755aff08092de955f89e8cc0494b289d74cf09eab426a239dcb2aca78a27 0 Wizard\CloneActualFlags.cs Wizard\CloneActualFlags.cs feadf48e251d85e8d9b76ce2a973f56102a2c753d788ad21055e577d1788f8dd 0 +Wizard\ColorCode.cs Wizard\ColorCode.cs c009240287a148d30c3fb249cf85ead5a885b76455dd42f79aaedc43d0b3b393 0 +Wizard\CompetitionBattleFinish.cs Wizard\CompetitionBattleFinish.cs 9c57fa74b82bb7cbb69253ebc959b03e4629cf6f600e17de6c2408ffc87664a3 0 +Wizard\CompetitionBattleFinishDetail.cs Wizard\CompetitionBattleFinishDetail.cs 8fe99f2a423fd36c67a12e32f1efa60ea8c6229adaa6a19964a9b1bf6728ef3e 0 +Wizard\CompetitionResultAnimationAgent.cs Wizard\CompetitionResultAnimationAgent.cs 75b8a263a2ef3999b4abbcc79aeb8027457521e7cc84ee5de27b09d34810acf5 0 +Wizard\CompetitionResultAnimationHandler.cs Wizard\CompetitionResultAnimationHandler.cs b881b9efd770b87585bf3d059976ffd97e5ea23e4cfcf9501d9ac45fe96f8994 0 +Wizard\CompetitionResultReporter.cs Wizard\CompetitionResultReporter.cs c6e601412cc55d33f4136c71e11d1f92aede9f2bf4cc12e3154a8d526bbd62ed 0 +Wizard\CompleteDeckDecideDialog.cs Wizard\CompleteDeckDecideDialog.cs 13989e70a3de839fc5932bf3e87eb15edc889c6a22bad05294c232e75e192255 0 Wizard\CondChoiceTagCollection.cs Wizard\CondChoiceTagCollection.cs e2cbd37890595adbf142aebaca58885a87788ad81dc9a78c7f9d6628d2147169 0 Wizard\ConventionDeckList.cs Wizard\ConventionDeckList.cs 8653b2d3cfd9d69413b0483bf384e05e18e0ca3b52f6239a212c5e5f01f2aceb 0 +Wizard\ConventionInfoTask.cs Wizard\ConventionInfoTask.cs 81ccf3c9eef5ee417b4e3f7e3c981f994f99933a4174219a6a884842395c5a45 0 +Wizard\ConvertTime.cs Wizard\ConvertTime.cs e4b66d476871adf4e6d5a62c07335a98c8ae8edbe2acad9c50c4a348520dafaf 0 Wizard\CostBonusTagCollection.cs Wizard\CostBonusTagCollection.cs 8c6d5e7a4b886334eecb7e70ef787bc39de32eb5c5f0c2715f4eefd209ea71a9 0 Wizard\Country.cs Wizard\Country.cs 833d76a4fa24fe50248cad54e6aa5eb6f4f20cf42afd17326638827e0380f133 0 +Wizard\CrossOverClassInfomationOrder.cs Wizard\CrossOverClassInfomationOrder.cs 09161540d7eba3406e5c30ebe4c9e1debf9d40ec4d1cd3484d6d71ad357955e0 0 +Wizard\Crossover.cs Wizard\Crossover.cs 20a74b69be74e89d8eef25a2b8fe5971b653566b418675a2a2b056a9500dfb7c 0 +Wizard\CrossoverPortalParam.cs Wizard\CrossoverPortalParam.cs d0d751f5c901ed6c7b18cf4189c6e0ae2d3de4184cb05d8c770770d16f58f6bd 0 +Wizard\CrossoverRestrictedCard.cs Wizard\CrossoverRestrictedCard.cs 663c0ac1cabef1716b979c3ec4bdafa47ced26420eaaa08bd6b97e90acf1d815 0 +Wizard\CrossoverRewardInfo.cs Wizard\CrossoverRewardInfo.cs bb3763306d0e7d3feefb748b1bf461a114a363d36703edb8a8a5d2b5734128ee 0 +Wizard\CsvColumns.cs Wizard\CsvColumns.cs d113f92e1f0145adb323c093deca81aab1889e8de34ed78c852b8e5a764c1c4c 0 Wizard\DamagedTagCollection.cs Wizard\DamagedTagCollection.cs 8e6ecf677b4da8e16a68d3336959cd6d08af4830a0214297d65e96243f777c3f 0 +Wizard\Data.cs Wizard\Data.cs 26bd39c591da328c1a30eccf773064be022145dad1f11a29584832b8a81d36e1 0 Wizard\DeckAttributeType.cs Wizard\DeckAttributeType.cs 006bb4c04d8a60c9caf04873dde6c962366348db03ec40a8bbc0071392f656dd 0 +Wizard\DeckAutoCreateTask.cs Wizard\DeckAutoCreateTask.cs e8c21d513114d2c42ad85a28da4adb48642bd36dc012f6029fbc8a8d72b78d6c 0 +Wizard\DeckBuildShortageCardView.cs Wizard\DeckBuildShortageCardView.cs 34428e4efb614c4fd59136d1bb87485ce117a97b2c6668f0481fff4b510a31d3 0 +Wizard\DeckCopyDialog.cs Wizard\DeckCopyDialog.cs 32d95553dc268017f7d0345914c1f83243c928376e418f78d48615b568551957 0 Wizard\DeckGroup.cs Wizard\DeckGroup.cs c5334b68f875f193b100950fba847271ae5fe12e94c79aabd4a8220551066964 0 Wizard\DeckGroupListData.cs Wizard\DeckGroupListData.cs d107ef3fc0cae879fe755256b94e8cc7ddcaa64d3cffa1143246dfe68a185150 0 +Wizard\DeckInfoTask.cs Wizard\DeckInfoTask.cs 4256d53231dfd8f243c47c9e94810d749c9542fb4c540f0ad486918dec5f3b3a 0 +Wizard\DeckListUtility.cs Wizard\DeckListUtility.cs 353c79754fd9a0967d88439c3793c7759e75f6dccc99aaa506c63c263bc40ca7 0 +Wizard\DeckSelectUI.cs Wizard\DeckSelectUI.cs 2988481745cf6011c71470173e750d0d53e049eae0fd0222fdd58426552e4ea5 0 +Wizard\DeckSelectUIDialog.cs Wizard\DeckSelectUIDialog.cs 57d268defebb1b9e21d26eb5d83eb0e6a017dfbef062ee03279a17c81707ce57 0 +Wizard\DeckSelectUIDialogTitle.cs Wizard\DeckSelectUIDialogTitle.cs a392d397f6f7b885440ceedee71ee93e8acefe1e7cfb1508bc44a311a43567a0 0 Wizard\DeckUI.cs Wizard\DeckUI.cs f99d5d852a206e73ee5c25406ae03380225bfea8c68ce24b69de8347e220af59 0 Wizard\DeckVirtualCard.cs Wizard\DeckVirtualCard.cs 00c7e8d2ebae0dac6af30eb018cd1390a3ceba87b1348c93fe0c7c99eebf275d 0 Wizard\Degree.cs Wizard\Degree.cs 0f3cf092884c7d4c5a4479ce9f887c3b93e77c2c1fd205379c785b4ec095dd22 0 Wizard\DegreeCategory.cs Wizard\DegreeCategory.cs f68c21dc08c6bf0b20af52a33792e14d680c5dab5abb1f2d78eba08e418f7806 0 +Wizard\DegreeHelper.cs Wizard\DegreeHelper.cs 374834564120f9fada359f4d1c8ecb2fec73d9d9e8e0dff4d049c10459f94bcb 0 Wizard\DegreeMgr.cs Wizard\DegreeMgr.cs 556894217a0903686b0c2c1b4895d0585a3b85863617e5f97dfe49edb02b2c73 0 +Wizard\DialogCreator.cs Wizard\DialogCreator.cs a48d5ef01c479732f8e1638ce589904cddae1ecfea80526321e5ab2c0ff29b32 0 +Wizard\DialogItemPurchase.cs Wizard\DialogItemPurchase.cs 3b35164adbc25cb9075a6fdf4e605ba9b08e7272ba9ebbafae381c0e6206ba2d 0 +Wizard\DialogSubText.cs Wizard\DialogSubText.cs 0f2c313c63527cab0897631df179960ffe766102c250fdb392cb9baccb819dc4 0 +Wizard\DisableLethalCheckPolicyCollection.cs Wizard\DisableLethalCheckPolicyCollection.cs e1d291cfda348b5487ef0a1ae0978724891ee40e2fcb9a84b26b652e3a913322 0 Wizard\DiscardedBonusTagCollection.cs Wizard\DiscardedBonusTagCollection.cs ca8a302ba3e3d8a55b1608812514a733458db7b819237308953fd33856178c72 0 Wizard\DiscardedTagCollection.cs Wizard\DiscardedTagCollection.cs a69512ecef80fb292401593bb6d84436806d82d1e291283bfa239fc986fe070d 0 +Wizard\DiscardedVirtualCard.cs Wizard\DiscardedVirtualCard.cs ce499add4b5b3c54e9a4ae151f2d2d741734ba69c4b16feab87534b7e167f3c1 0 +Wizard\DrumrollDialog.cs Wizard\DrumrollDialog.cs 544e1507787ce68a55161efa6d297fd631c24ecdb7d3c0cd57001c2cb159bf9d 0 Wizard\DrumrollScrollManager.cs Wizard\DrumrollScrollManager.cs e6737ba53a22d1ad16fb5b37d9dca3c550b4be58c442d5f0b1a628bed6c6fbbb 0 Wizard\EarthRiteRecordContainer.cs Wizard\EarthRiteRecordContainer.cs 24174a54eaff51ffe79ac07b9093c7f4c60a17d5553cb35ad079e2f0b6544c38 0 Wizard\Effect2dCreateParam.cs Wizard\Effect2dCreateParam.cs 99b02a3cf6255dcb255104d2a59a65d806fff8676e372dbc430066850cd77fc8 0 +Wizard\EffectUtility.cs Wizard\EffectUtility.cs a5385e357d288c22fdff05e8a7a37f6b4e58b3d5351b2b98d9587e149e7b509a 0 Wizard\Emblem.cs Wizard\Emblem.cs 40fa3d4362ff82c882153f1974a24109c15843b7b293e3568c71dfe11c6647b6 0 Wizard\EmblemCategory.cs Wizard\EmblemCategory.cs 983147bf89405c54d6270ed65d619138b8d86dbfc85080a2488d62497768ccdb 0 Wizard\EmblemMgr.cs Wizard\EmblemMgr.cs 87285534a13166dca261b1bfb4bed260a7aedad0bb0bc544e10a157db47d3473 0 +Wizard\EmoOnLeaderDamagedPolicyCollection.cs Wizard\EmoOnLeaderDamagedPolicyCollection.cs f4f26880b3b29578eba687247efeaef485660a78129be0d9d139b9cc6685842a 0 +Wizard\EmoOnTurnEndPolicyCollection.cs Wizard\EmoOnTurnEndPolicyCollection.cs a945bc0e9691eeeb635ad4ddf4eb3ffc7241c42254b5de5d76d9c33ade17cc9e 0 +Wizard\EmoOnTurnStartPolicyCollection.cs Wizard\EmoOnTurnStartPolicyCollection.cs 87ba871d30c87c8d1eb4dfec188e3292b0162d5d66a6e7e0744ff9405ace2e52 0 Wizard\EmoteTagCollection.cs Wizard\EmoteTagCollection.cs ea18ac5bcf19f541d6feda09f7eb299a00c48c3b70081fbacc67ed8da7226ac6 0 Wizard\EmoteUI.cs Wizard\EmoteUI.cs c312c9110380793bd972cd6641177b21ac99b356ce3e06862f278f13f10d1586 0 Wizard\Emotion.cs Wizard\Emotion.cs 0cffcacfe1eb54bd02b66fb4ad54a3a146722e89b824ebb4c126904c87dfca8d 0 +Wizard\EmptyDeckInfo.cs Wizard\EmptyDeckInfo.cs aa954d6e0b6b699500ff9a7db06408c35ae2c48314dafbf058c4d3edd5566bcd 0 +Wizard\EncryptData.cs Wizard\EncryptData.cs e7afc82bfc5e7b796ecf5b0ec1fa0afd4be0e3c4ee9dee1d37e1c99cdddf3fad 0 Wizard\EnemyAI.cs Wizard\EnemyAI.cs d264983ee917e4b6268e30f01e49b5cfc278cd5c5d91e085f8bbeb148cbdd3af 0 Wizard\EnemyAIFusion.cs Wizard\EnemyAIFusion.cs d3dd6db16807beb214c1c42481567a3bff6f729c3b793c8017771d23c6628f98 0 +Wizard\EnemyAINull.cs Wizard\EnemyAINull.cs acc40c89939d36b843119e12bc973369acd3e1e9e8f800f99a0c34369381ee56 0 +Wizard\EnemyAIUtil.cs Wizard\EnemyAIUtil.cs b7e20a730e2c69134bd1da46f1fa61edf8666b72da35c12b6bb2f505b8f0d2ab 0 Wizard\EnemyAI_Attack.cs Wizard\EnemyAI_Attack.cs 95b484d3ae841051e1ebbb83273c566ba52016c44158ee1b41c43b22acf7fdb2 0 Wizard\EnemyAI_Play.cs Wizard\EnemyAI_Play.cs 26a62d83a770858b8b5dfb9f1bdf33917ecea9b456cbc2b43d59daa64ad5fd13 0 Wizard\EnemyAI_Skill.cs Wizard\EnemyAI_Skill.cs d3eb3694c301a0b3ababf1561a9da1279fb1c97c01f9113a51095dc4c647a555 0 @@ -571,25 +2191,55 @@ Wizard\EnemyAI_WeakLogic.cs Wizard\EnemyAI_WeakLogic.cs ffcb5020b4387b6ef560e0f7 Wizard\EnemyBattleBonusRateTagCollection.cs Wizard\EnemyBattleBonusRateTagCollection.cs ea09eb8f465a35b65cc89809aba3093ecbc1c51abaa1129eba5f1a68d2cf810c 0 Wizard\EnemyBattleBonusTagCollection.cs Wizard\EnemyBattleBonusTagCollection.cs 071b163d0f713514ca6ce70a88a89fa36d7b53178d38ab1b31c3ef20150d1f2e 0 Wizard\EnemyEvoBonusTagCollection.cs Wizard\EnemyEvoBonusTagCollection.cs 9e7770cc32c64ac0e598b675d30cb68783e204ee4961bdd2e791f0b78327b155 0 +Wizard\EnemyHandVirtualCard.cs Wizard\EnemyHandVirtualCard.cs 92a00eb3a4efea0fde1bcf48026d1d79ce20d08aa94035d589723fb1586fdc0a 0 Wizard\EnemyPlayBonusTagCollection.cs Wizard\EnemyPlayBonusTagCollection.cs e14aba377958be3a1481118f94da0486a522f3c5ab0db196a9b2b6c2ec8faca9 0 +Wizard\EpValuePolicyCollection.cs Wizard\EpValuePolicyCollection.cs c24e10a8972fa18e111fc8673e3f7c33537c41a8297dffcb90501f80f36fcdd8 0 Wizard\EvalInstantAttackInformation.cs Wizard\EvalInstantAttackInformation.cs 9d2898f1e88381cd29e39cafa4de5e4d6a7ee85b806158f368871726ae742bb7 0 +Wizard\EvaluationType.cs Wizard\EvaluationType.cs 8dc122fa6bb282b18c448b31b0ec7ab3d4195f9dcac564a060648b14474f771e 0 Wizard\EventStoryQuestInfo.cs Wizard\EventStoryQuestInfo.cs 1b664258a746d028f14816b3cd186d6fd1d4041ebf6e78b8e80ab1c0c72a3dfa 0 Wizard\EvoBonusTagCollection.cs Wizard\EvoBonusTagCollection.cs f77e10af5d6d59cbc8d36b38916ea507278ab139ca869a22a3274d8e91cdb134 0 Wizard\EvoHandPlusTagCollection.cs Wizard\EvoHandPlusTagCollection.cs 8d91fd61550cfd87d92885fe34ca5b1399400f8c0eb3f7f446494804e5179a6b 0 Wizard\EvoTagCollection.cs Wizard\EvoTagCollection.cs f5d4674174526797f1ca154ea7d6b2975514e11de24d919593f7397b2810fd41 0 Wizard\EvolveToOtherTagCollection.cs Wizard\EvolveToOtherTagCollection.cs 51a978c4aca7c80e6d03f5e1602516c48e4c5361fc38a95d598128c058f17a8c 0 Wizard\EvolvedResidentTagCollection.cs Wizard\EvolvedResidentTagCollection.cs 357f1718ee170049c6e86488bc0ec4ca9fb659a3e68195e8b70c2ea538c96584 0 +Wizard\ExchangeConfirmDialog.cs Wizard\ExchangeConfirmDialog.cs 44ca8362ea686a7619595a73302bd43d167ce44e92a3bb3e427964d0c28af73b 0 Wizard\FanfareBonusTagCollection.cs Wizard\FanfareBonusTagCollection.cs d21e2af67aeca95420438f140aaec1445a9dc0be829231c4d50771f4ae807c64 0 Wizard\FanfareTagCollection.cs Wizard\FanfareTagCollection.cs c5c99a0437a507b360bf6247fa823bb9f56a2f39746b3a251f918e0f85e5a945 0 Wizard\FavoriteTask.cs Wizard\FavoriteTask.cs e7e846e293142749f1d30a88b83506ab04a17df3c3d182dd59af49fedefde445 0 +Wizard\Field1005.cs Wizard\Field1005.cs 43af1fc9739e97b1a274b15f5387a56a5638b31c548bcc504e9f8522b9a21a2e 0 +Wizard\Field1006.cs Wizard\Field1006.cs 8379ef92d723cd16b1cf7a92cfc5c2c88c12745a892a9f84452e85a8d62d9d64 0 +Wizard\Field1007.cs Wizard\Field1007.cs c21e595714ae3d9f2c8c22e5b119214b91794da95cb7e2a57fbda6a7f8c8fd46 0 +Wizard\Field1008.cs Wizard\Field1008.cs f92a31ae90eeccc19923d97081304e528fc0bbd064a34b08b6c74c5a28fd5279 0 +Wizard\Field1009.cs Wizard\Field1009.cs b5f310fbf3de27c27866872a7dd4e1a0b1be5fbf0525b53a1acb74e4531c6191 0 +Wizard\Field1010.cs Wizard\Field1010.cs c980d4f972d26350bcab98727fad035b273031f4a6546fc71802dff3ff49d08a 0 +Wizard\Field1011.cs Wizard\Field1011.cs 3fef105d434f7ba4b6c41815f2f137db224caef19336c183e36907aa71a059f2 0 +Wizard\Field1012.cs Wizard\Field1012.cs a6d76d7dc419f11c6a25f2c2abc0c3019c28b622641e1d63dc78810fe8c2c1d9 0 +Wizard\Field51.cs Wizard\Field51.cs 8eb1151086d84558abd67cc035f06ec4d080852c90366e34a097b45540699e59 0 +Wizard\Field52.cs Wizard\Field52.cs fbee2b1615db4b1ab0b5ffc50fadc3e565d8c5dde726487310f7f9fafe5131c0 0 +Wizard\Field61.cs Wizard\Field61.cs bad451ac040f173803577d41a7ff8748dc6997979c4b6695c9812529a579655b 0 +Wizard\Field62.cs Wizard\Field62.cs 332fb0be684fa18e03ba258cb83163c56ab8b53dad2332c2fca8fb5a93728ad5 0 +Wizard\Field71.cs Wizard\Field71.cs c867d1493541720f5d50efde08b4eeb43c6fcee67ac32482852cb3422f4cb725 0 +Wizard\Field72.cs Wizard\Field72.cs 5057a0b5546cf13ffffaf2618021c8aa77edf009a5daafb8534acbcf34369162 0 +Wizard\Field73.cs Wizard\Field73.cs 2d64a4f34182f5e8b5e9d8c9e08ac14f8ef55c58badb0c7377cd38c8b1b10e52 0 +Wizard\Field74.cs Wizard\Field74.cs c0a12ea2ae33f3b1be6570f5701a98794325477b4934501d8b12db92d0dc8b3b 0 +Wizard\Field75.cs Wizard\Field75.cs c901d7508bed898ca19a15f2a19058e2b7cf41c371326d539b1c9be7b0ced982 0 +Wizard\Field76.cs Wizard\Field76.cs e4adeec81bcb45ba4a3b4ac0b74d29d7fa4a7e99bd596227b2d5a41d94ff9ed4 0 Wizard\FilteringImageSelection.cs Wizard\FilteringImageSelection.cs 6b8cab1cf1cac1d724a28e5b5fdedd08c9ae1131565cf709c49c0d65e072a3f8 0 Wizard\FilteringImageSelectionItem.cs Wizard\FilteringImageSelectionItem.cs 42da761519d7ea0b58f684ffc3382a7c912a08db2dbaa04b89f10103ef43b62a 0 +Wizard\FilteringSleeveSelection.cs Wizard\FilteringSleeveSelection.cs 01bc7473c395d533706ec261c887c7eb46e3f40d3f0c19c7ecdb481ab2a943a1 0 Wizard\FirstEvoTagCollection.cs Wizard\FirstEvoTagCollection.cs 86154576e6fa624f9d379ca20bf760683b2b274d908e3ebbe99ea70666c68482 0 +Wizard\FirstTips.cs Wizard\FirstTips.cs e3b1f858c2a065411ec281eb31d5144cda59dc83af455972d4efcfcd6a01f66c 0 Wizard\FixedCostTagCollection.cs Wizard\FixedCostTagCollection.cs ac1393292c3c1abc3af3d2668b13c51f9cf01e0315117f1e5dcd341fd45c7856 0 +Wizard\FixedRemoveType.cs Wizard\FixedRemoveType.cs 18521692ab83dd624c64921bcad7e851fadab86fb89b29469e0890011b0a1da7 0 Wizard\Font.cs Wizard\Font.cs c84085ad2ce2a33ed50ad8183c9a635970a3067a109feae6227ad76c85c7de84 0 +Wizard\Footer.cs Wizard\Footer.cs 4e9fcb3268393c346e6b61687320f57b3316c96bbbd50e1b10cb7d661530f708 0 Wizard\ForceBerserkTagCollection.cs Wizard\ForceBerserkTagCollection.cs 386d3f9150076989b6a3ad3b8ed6ecd2ca4ba475be4c4dffae9cacdb8cb89b43 0 Wizard\ForceImmediateAttackTagCollection.cs Wizard\ForceImmediateAttackTagCollection.cs 6d8c4aae8881f2395ac57450bcd0364b8bd0c1ed28700c3d65c0a44f6bbf5555 0 Wizard\Format.cs Wizard\Format.cs da3bc270aeb1fce63610b6bd1857ef6e07019c7840ba3a549f607170a957b3ce 0 +Wizard\FormatBehaviorManager.cs Wizard\FormatBehaviorManager.cs 6605b28d99c969cc08551568ae47b3c494dfae376ffc04a60c814ce993958bf2 0 +Wizard\FormatChangeUI.cs Wizard\FormatChangeUI.cs 4488f75727d57aff2b56bd18dfa5b67566189114c7120041fb4edc081f72e667 0 +Wizard\FreeCardPackCampaignFinishTask.cs Wizard\FreeCardPackCampaignFinishTask.cs 1dd31ef77f9940b479c211692c1d8301712bc5df8cf21de3224e0dda8eed203f 0 +Wizard\FullSimulationAI.cs Wizard\FullSimulationAI.cs 39e5b70761aeaab89f7d8d5423e73debab490171e72a2bb8a75a013c2dc9c8f0 0 Wizard\FusionBonusTagCollection.cs Wizard\FusionBonusTagCollection.cs 4903288da869da61c7a10520fd0815a168c5a1b1f00dc1fb011e509e88f69464 0 Wizard\FusionDrawTagCollection.cs Wizard\FusionDrawTagCollection.cs fc333ea01f0840ce80d000384f65285513185a37eafe3c5b3999fb5fcb37c3ae 0 Wizard\FusionMetamorphoseTagCollection.cs Wizard\FusionMetamorphoseTagCollection.cs adb96cf8a406a435815e619005cc27635dae060ebff295455ddb9a7a61223b39 0 @@ -602,21 +2252,31 @@ Wizard\GachaPointData.cs Wizard\GachaPointData.cs 26bae09ef1c6707cd1135a6ccdcb9a Wizard\GachaPointExchange.cs Wizard\GachaPointExchange.cs a6f8e1822b4c2d76ebc3ce173365b6e930ec2b41f820eaa46230f8d83a1521ef 0 Wizard\GachaPointExchangeDialog.cs Wizard\GachaPointExchangeDialog.cs aa0b1cbd3e4e677be1af91558c774ea0366219bc067db8c56e83d7dc45b40fab 0 Wizard\GachaPointExchangeInfo.cs Wizard\GachaPointExchangeInfo.cs 604786e3888b9898415f0aa27b9fec2f0e22bb0e925829ae9749fea03aa26f65 0 +Wizard\GachaPointExchangePlate.cs Wizard\GachaPointExchangePlate.cs 5fd7f08d6424e4ed3a385fb683a849ea7ed66b70cad9fde5b55a543241934d9d 0 Wizard\GachaResultBuyCardPack.cs Wizard\GachaResultBuyCardPack.cs c38ca1737830907080640a6144de5e67e5bfce8880c51b73a7fb829775c47c0e 0 Wizard\GachaResultBuyCardPackDialog.cs Wizard\GachaResultBuyCardPackDialog.cs e0b7d915f4c8c7e1b20cf88c44dd01a6325d58afc1e7df9be45cb0fb19c75d55 0 Wizard\GachaSelectBuyNumPopup.cs Wizard\GachaSelectBuyNumPopup.cs 2aa4ee4381bd6ffda29d4c4c8ee8ce7899722d361089037ebeb8c626c4091c13 0 +Wizard\GachaUIParam.cs Wizard\GachaUIParam.cs 0b3d1a8dea33c121c44ad2d11b4d3329811913ddaeff65abd0e388ebdd566a2a 0 +Wizard\GameStartAttachTagPolicyCollection.cs Wizard\GameStartAttachTagPolicyCollection.cs c4e1108a4e06f5cc00b27cfed24cd5556490e08cd912acdb504db349ec47d6c6 0 +Wizard\GatheringMyPageInfo.cs Wizard\GatheringMyPageInfo.cs c28baddfaafc8ef7685abfdf6ac6318f822524a30006247625391fd7b6568fd2 0 +Wizard\GatheringRule.cs Wizard\GatheringRule.cs ee446b445c77d6d0a1e6e0f64b54cbe2a8b15974376ebc7fefa65331bd42ce51 0 Wizard\GenerateDeckCodeTask.cs Wizard\GenerateDeckCodeTask.cs 9f32c9513ec63d8b19e36d402c1adfec123b7f5774b86369391ce5fcb3996e1b 0 Wizard\GenerateTagCollection.cs Wizard\GenerateTagCollection.cs c8a76fe65207f3e3ce6c06bfeb0317ea98796bf8f093dfa710b05547e8b8cfad 0 +Wizard\GetCardMasterTask.cs Wizard\GetCardMasterTask.cs 76242fa1bce00c5820fb35ba1e7abd984841a2b12971987d7300384c23a9eb01 0 Wizard\GetOnTagCollection.cs Wizard\GetOnTagCollection.cs 53dd75747aca1d11c8dde8703971ca327b36076ac25d7a4980cf21255835148f 0 Wizard\GetOnTriggerTagCollection.cs Wizard\GetOnTriggerTagCollection.cs 2b7b7621f4483bd52ca49e2c3294a56ff25e29ff7bf32baa1ff76d86111f2fb3 0 +Wizard\GetSelectSkinOwnedStatusTask.cs Wizard\GetSelectSkinOwnedStatusTask.cs 2e704c9343f59ac2d42d26eda7db77045ef144b45b16b581a6316d9cae5d177a 0 Wizard\GiftTransition.cs Wizard\GiftTransition.cs 6fa6e6166dbfff9e8eb6abc43f26f011e8f681a0f3a443fd82aa78d2832b9d96 0 Wizard\GiveSkillTagCollection.cs Wizard\GiveSkillTagCollection.cs fc0b094247ed98cee05d1e781c3e0f2d0f56db4f4b89affd2b805859dc040ed4 0 +Wizard\GuildNotification.cs Wizard\GuildNotification.cs 167b667c4475f5ea1aab301f70a0dc52b5ae273d6c4a00209ec515cf90978323 0 Wizard\HandBonusTagCollection.cs Wizard\HandBonusTagCollection.cs 254828268b50bd500739de4715e07548f94d8e315e298cf83d123b9704575721 0 Wizard\HandPlusTagCollection.cs Wizard\HandPlusTagCollection.cs 6e7c69ade97cea12534f1308a8a1b47170ac1078b3efe5e0613c38a742d9eca9 0 Wizard\HealTagCollection.cs Wizard\HealTagCollection.cs 913557e82f49d9beb64a02bbae3555ace4b4ab633580411e14dd6ded61f46ef5 0 Wizard\HighRankEffectInfo.cs Wizard\HighRankEffectInfo.cs d902f77261b58377e093cc7305827c087b4af6fda9d39c0470afe75ae1e7e1f7 0 Wizard\IAIEmoteCtrl.cs Wizard\IAIEmoteCtrl.cs 7a10392831ba1389e0d690d49fd563b9de356e8199e9cb2c252edb5d7b2442a3 0 +Wizard\IAIRemoveTagArgument.cs Wizard\IAIRemoveTagArgument.cs b1b55e01c9542773c5fda04e23e2692c9c1f2abe8d7f5e49832eecd32e1c4770 0 Wizard\IAITargetSelectTagCollection.cs Wizard\IAITargetSelectTagCollection.cs 9f5213399c3590ccf5519da98308384c07a960c6c8e79721169a854218ad3416 0 +Wizard\IAITurnEndArgument.cs Wizard\IAITurnEndArgument.cs fecc0c0f390376939e0aa5993b4ef7efe2c68457b3b7a76b8c7203b53b4853af 0 Wizard\IBattleSimulationAI.cs Wizard\IBattleSimulationAI.cs 4ae9b2993be434a5b76d822de8d56977d7c15d0108e7446a19dcabc785976470 0 Wizard\IEnemyAI.cs Wizard\IEnemyAI.cs e4fc8be7e4dfb93145e0dda9a6c8935813b54ca7f46b156a784e1c24e0b07c41 0 Wizard\IEnemyAIBattleInfoRecieveDataAccessor.cs Wizard\IEnemyAIBattleInfoRecieveDataAccessor.cs 0f24830f9f5c99068d1eaded636815b8010c1056883b3ce7fc2fac1867e66574 0 @@ -624,29 +2284,59 @@ Wizard\IFormatBehavior.cs Wizard\IFormatBehavior.cs b11e696685f19dcd75be555aaab5 Wizard\IgnoreBreakTagCollection.cs Wizard\IgnoreBreakTagCollection.cs 95fa4a8aea7a980dd225d37f80c8ebeed3d2984507ce6a83c8411a70398fe816 0 Wizard\IgnoreFanfareBonusTagCollection.cs Wizard\IgnoreFanfareBonusTagCollection.cs cf22a06695c7b33920b0ee6caa9ab62a8f541306167074860bc105fb3f713126 0 Wizard\IgnoreTargetTagCollection.cs Wizard\IgnoreTargetTagCollection.cs 792b1c640a8978a7f69d9d295480780e18c250ea874a655ab55dc1c99d535542 0 +Wizard\InCompleteDeckDecideDialog.cs Wizard\InCompleteDeckDecideDialog.cs 81c448ba1d0e0d9614c0c7b6941a396e03ed0bc460b4419c79d2e88155835eb5 0 +Wizard\InplayMovePatternFilter.cs Wizard\InplayMovePatternFilter.cs 99b4635adc0978eacd30a4eab54eedf0185b23b29f2824b7a66071566ff34737 0 Wizard\Item.cs Wizard\Item.cs 1f08b86cf607be02d6083243247d28fb89bfae5ba9595f1cf74562680caa9025 0 +Wizard\ItemPurchase.cs Wizard\ItemPurchase.cs 6f7d4c77170059b5418fb2aeb0749abc735bd141a116e5e612b028455964159a 0 +Wizard\ItemPurchasePlate.cs Wizard\ItemPurchasePlate.cs 7ad6b0abd541371ba4184602105b3de849ac547452f5ab594de2f75dcea69e13 0 +Wizard\LabelDefine.cs Wizard\LabelDefine.cs 073931ece990c5defc6b745f739221ae742552579055257c5c1fc179b1b07807 0 Wizard\LastwordTagCollection.cs Wizard\LastwordTagCollection.cs 35a8bf05a748f8cc1811bf419a5e19cbe8058bc76e3f54d9f2160c584436a59f 0 Wizard\LeaderSkinSeries.cs Wizard\LeaderSkinSeries.cs 8273cd6831408f1e74e7e2f7b3db3074d41b102e557941ee3c1f0afecaed71e5 0 Wizard\LeaveBonusTagCollection.cs Wizard\LeaveBonusTagCollection.cs 30e0c56bbe6b1418a166762a88660ce41b13facd173f1b00e500066e84e699fd 0 Wizard\LeaveTagCollection.cs Wizard\LeaveTagCollection.cs 11d8c7a49a83ae6032f77183b7e2e32d38ac4a9def2413cf64558a00fe53750e 0 Wizard\LifeRecord.cs Wizard\LifeRecord.cs dbb7e7c6532bf24174d3d958147309b1eb87faac12c57754e7282cf8ac5d8b50 0 +Wizard\LocalLog.cs Wizard\LocalLog.cs 991b50f5e128fd3b2368770fe7a7b7691ce4090bdaca5ae744d1f464572caab0 0 +Wizard\LocalizeJson.cs Wizard\LocalizeJson.cs 4adf1a47af054dc08971d7e8d1574e8b8d7692c027182ff6c3d167164240f4ea 0 +Wizard\LootBoxDialogUtility.cs Wizard\LootBoxDialogUtility.cs 8277f2e7dfbe98bc4e8790630c338d50a0e635f7566e9d1ee1cd22cd6b199237 0 Wizard\Master.cs Wizard\Master.cs dc58e2aacb78cd813aa7c7e8db2ba18268b3ca62188e0ef36d9f8445a58486ce 0 +Wizard\Mastershop.cs Wizard\Mastershop.cs ed5828427f2fe31272830b4ab3dfe0c70d1caae570cf7145f96e9cb402eb90f5 0 +Wizard\Matching_Competition.cs Wizard\Matching_Competition.cs 5a28b9f3ed26f46c28b9b41ea26557cb56a13a424f8279a3e6e7ecccf47cd1e5 0 +Wizard\Matching_Sealed.cs Wizard\Matching_Sealed.cs fe051fbc6117cc48b6ba9d48226d5735bde55b220e558cdbbf7d13dbe3f888e6 0 +Wizard\MaterialDefine.cs Wizard\MaterialDefine.cs c0e77fd2b296289d26960a188e1dde9d24c5aa0538b2a237b8e5d3d177c2b0e0 0 Wizard\MemberBattleBonusRateTagCollection.cs Wizard\MemberBattleBonusRateTagCollection.cs af0f9eb215dfdba042be2663c3485e0330a2da5cf1c64b001fbeb958f9c40f77 0 Wizard\MemberBattleBonusTagCollection.cs Wizard\MemberBattleBonusTagCollection.cs 7d5c866fa706411b0eef538feb6b10551066b0e552d757a081c9a2b1bf5a5107 0 Wizard\MemberEvoBonusTagCollection.cs Wizard\MemberEvoBonusTagCollection.cs 94fa4f95290b222605bc4c01b68d38d8f3bd64568887f0764034bd1a1ab429e5 0 +Wizard\MissionInfoTask.cs Wizard\MissionInfoTask.cs 68c13aa4f0b37a1e1f29c30ba2b2b3e9809be3a69b40fa7990c577521ebe082a 0 +Wizard\ModUnitRatePolicyCollection.cs Wizard\ModUnitRatePolicyCollection.cs 51ee8a8ca31e3fb5eef773271b95e463c8fe376f9b16e9f537aaf8ab1b03e4c7 0 Wizard\ModifyHealTagCollection.cs Wizard\ModifyHealTagCollection.cs b8451ec819776ddfec09c4027fad85ee2d2e9d7c77970aef414949841b8a034d 0 +Wizard\MoveFirstBonusPolicyCollection.cs Wizard\MoveFirstBonusPolicyCollection.cs fc3fa7944f42245732f94eb03228bf5b88fa886fb290f58edf4b2c6f6e7735aa 0 +Wizard\MovieSubtitles.cs Wizard\MovieSubtitles.cs 6704fb258932c439dd0c56b3fe2e4fd4bde4331bc214b94d9e4511e2e523deaf 0 +Wizard\MyPage.cs Wizard\MyPage.cs 75afa5c09e9866a0f5a59ffd85f4cb7977975700b88d318238b675440cb7c1e2 0 +Wizard\MyPageBGInfo.cs Wizard\MyPageBGInfo.cs 2a4a4b373afc76709bc4fe338c9cda07e9a9928403e14544aa866ba1b20cfd33 0 +Wizard\MyPageCustomBGControl.cs Wizard\MyPageCustomBGControl.cs 6dcda3459b2867c5cecfed12306c6546d704104d72050625c5445fe3dcc4f996 0 Wizard\MyPageCustomBGMasterData.cs Wizard\MyPageCustomBGMasterData.cs f804b67196ba049ab2bca36abbcb98246d603c7e9035901c75b40a3eda954326 0 +Wizard\MyPageDetail.cs Wizard\MyPageDetail.cs a34a11602c1741e48c51da86e5376c92e2c51e711ff32818cc328f4c046bed41 0 Wizard\MyPageHomeDialogData.cs Wizard\MyPageHomeDialogData.cs 8a340ba114a70c5546bba0d727cb9a9257efea3ae656417566882f3101a3578f 0 +Wizard\MyPageMaintenanceNotification.cs Wizard\MyPageMaintenanceNotification.cs 64149488be27c560203a11731d10539772adaab7c7e342991027b71af1af47f6 0 +Wizard\MyPageMyPageNotificationDetail.cs Wizard\MyPageMyPageNotificationDetail.cs 4e8495da3fda6ebd51be3d0f16582659a5c1084113c8ccc53d36a951053238b5 0 +Wizard\MyPageNotifications.cs Wizard\MyPageNotifications.cs 25336aac677f52bf5e9d5be2963cba52b1889ebe288fdce4c7ddd21b41b6b84b 0 +Wizard\MyRotationAbilityGroup.cs Wizard\MyRotationAbilityGroup.cs 221427bd0628660a209d850d6e01274d00ceadba7c5a951a3dd98e87d1c30653 0 +Wizard\MyRotationAllInfo.cs Wizard\MyRotationAllInfo.cs 88ae58ae0352d620d94bfc461b28f50a3c6f9cc1cb015954748a32c8db3efde7 0 Wizard\MyRotationInfo.cs Wizard\MyRotationInfo.cs 4d9090e0e4b81cbd5c0e2ad5542da9577a5dade1a6a5211ebeb9dfd1ce91961b 0 Wizard\MyRotationParts.cs Wizard\MyRotationParts.cs 2469f8b192fe03cec39e4519002031872790662048e61305a63802a48f1cd6df 0 Wizard\MyRotationRePrintInfo.cs Wizard\MyRotationRePrintInfo.cs 2bb1fdfcc60af40afcf6fdd11b36edeca0ced9c4765b226c6f62cca1ed5f0da1 0 +Wizard\MypageReceiveSpecialTreasureTask.cs Wizard\MypageReceiveSpecialTreasureTask.cs 5d5f018ada4f5139b2521adfef9930dabef7937602d7854d5599341792eb814e 0 +Wizard\MypageTreasureBoxCpOpenTask.cs Wizard\MypageTreasureBoxCpOpenTask.cs 25b6a4ae001a6f38a505a1e1d291fcdbad8172e0ea0680b2fb78a9d9565a5e92 0 Wizard\NetworkDefine.cs Wizard\NetworkDefine.cs 44050f0b6eb56b29d05ddf9834a10b05553de9659dc4eb3619cd1a50660f7ef3 0 +Wizard\NetworkSkill_spell_charge.cs Wizard\NetworkSkill_spell_charge.cs 1cb5d6df2b3003362996e93b9ae95237a4ac5bda8af850b6b5a8122849e9b36e 0 +Wizard\NetworkUI.cs Wizard\NetworkUI.cs 28d19cff575b3fed81703487770dbcde958b7a2267e921d480c2f24c6b5720f7 0 Wizard\NoInstantAttackTagCollection.cs Wizard\NoInstantAttackTagCollection.cs db3d8479c9e03b4fd7d6d58d9ff763564a7ff4b9e2ce1c8b7b2f5219f245bcd4 0 Wizard\NoNormalEvoTagCollection.cs Wizard\NoNormalEvoTagCollection.cs 92c16f64f48fc8d643dcc29addd4c77adbc8a92bd9ccee830560190344e789ef 0 Wizard\NoSkipAttackTagCollection.cs Wizard\NoSkipAttackTagCollection.cs 107152d8cb5b57a6c8e2682d6ba73cb90662fbbd7ac749def7e841101b5462e8 0 Wizard\NonReferableVirtualCardBuildParameterCollection.cs Wizard\NonReferableVirtualCardBuildParameterCollection.cs 23251af778a55d3bd995d72adf74616b1d9679a6178c35e19e0466f748fb3210 0 Wizard\NotificatonAnimation.cs Wizard\NotificatonAnimation.cs 86079fa67434ccd594837728872c521648a01111dc6917ecc9b100b892556c99 0 Wizard\OneMoreLastwordTagCollection.cs Wizard\OneMoreLastwordTagCollection.cs 43ded6b3ecf0cea6d0880bb9e6a0294fecf17eacca1f27bdfdbf4073a9f36661 0 +Wizard\OptionSettingWindow.cs Wizard\OptionSettingWindow.cs ddca8fc3a8fa399d2a19e143de82647c9a7dc3e849ae4538b9f42c5e4987f79a 0 Wizard\OtherAttackTagCollection.cs Wizard\OtherAttackTagCollection.cs 01abdfb334ad2c7a75244ce40aa76963123120b1311b55d9f72b30eb602dcf45 0 Wizard\OtherBanishBonusTagCollection.cs Wizard\OtherBanishBonusTagCollection.cs 9cc66ef3cb7e38fb9c393c8a827942003083062f1a704374c9adc600317c445d 0 Wizard\OtherBanishTagCollection.cs Wizard\OtherBanishTagCollection.cs b0b834a06e5e3c202233667ea591c26fb8ddfcc1d3f04a05cf5530cbb6629aab 0 @@ -662,55 +2352,92 @@ Wizard\PackBannerData.cs Wizard\PackBannerData.cs 19a49488cc25566d51d172cdaaf5ea Wizard\PackCategory.cs Wizard\PackCategory.cs 9335bf51da46cc25f51040bd04c543bad6686858802d3ded1c9ab857bef69995 0 Wizard\PackChildGachaInfo.cs Wizard\PackChildGachaInfo.cs 40d10fdd911009cd6dfb780e2111a16cb7914cb7f1e8680130f9ab255a5a0801 0 Wizard\PackConfig.cs Wizard\PackConfig.cs 01a5fcd6c5d39e3c08d6b820f8a062f16d65105e6f1a3fbe085f752b389cc45b 0 +Wizard\PackInfo.cs Wizard\PackInfo.cs 2bc15a5a218249074b306483866f20441ecb88d3ade2e2d363c19fb5633da0b7 0 Wizard\PackInfoTask.cs Wizard\PackInfoTask.cs 361bde0ab56dfe307c887d472f2187971583a7bc9f706e70c9557fd8cd1b8039 0 +Wizard\PackOpenTask.cs Wizard\PackOpenTask.cs f640c02451e49da979f8d11388ae35549961a1076fb7faf277f267fcc4d4b9f8 0 Wizard\ParameterOverwriterBase.cs Wizard\ParameterOverwriterBase.cs 0966e18f7e514ddaff7567c3d845b6cc98d10d7ee49f6130156ed46eace56cf0 0 Wizard\PlagueCityTagCollection.cs Wizard\PlagueCityTagCollection.cs 3213ddc7ae26058dc28be578bd19b4342914324bdf761ebbc5f74e640e5155d6 0 Wizard\PlayBonusRateTagCollection.cs Wizard\PlayBonusRateTagCollection.cs 32b5ae7c6fe5998aa1dfac3fac64bc08c36cc127408b983667e85d98bcca76af 0 Wizard\PlayBonusTagCollection.cs Wizard\PlayBonusTagCollection.cs aae0f75c19388e975da4abf671c5082fd5e8d9bb0efc81cba0723a37d164dbf4 0 +Wizard\PlayBreakPolicyCollection.cs Wizard\PlayBreakPolicyCollection.cs a57c0e1a895b01fd4724657bb9b0f87cbf3515cb4bd2a73512b1c7f0f42d3283 0 Wizard\PlayDrawTagCollection.cs Wizard\PlayDrawTagCollection.cs 26c9c14e820f24b7c42e7aa0945863875eb8340962537d041188f36c45082aa0 0 Wizard\PlayLimitTagCollection.cs Wizard\PlayLimitTagCollection.cs 54dcdce8c2df53f4ed802b106411bafab77fdd3880676c3e36dfe3920fa67698 0 Wizard\PlayPlusTagCollection.cs Wizard\PlayPlusTagCollection.cs b83296a9abf6a081036c9230b335e6c3380ee9018386faa72dc9cb65cde47933 0 Wizard\PlayPtnBonusTagCollection.cs Wizard\PlayPtnBonusTagCollection.cs e77524431abd386597302bac81a6e6996a36b685ceef89804d66de9c313ea8be 0 Wizard\PlayPtnWithToken.cs Wizard\PlayPtnWithToken.cs 080747dd4f88ceaceb395817efa0db08360b9d59924525452e967d3d1edefecf 0 +Wizard\PlaySimulationInfo.cs Wizard\PlaySimulationInfo.cs 63ede0dc409161412d03de1d31bf6d8687a3486ec7c5ad28f5a71a781e1b60e8 0 Wizard\PlaySimulationType.cs Wizard\PlaySimulationType.cs 004b802fea1bc338f85fb2cde43544d13257f25238454bb4906e872c14b7c233 0 +Wizard\PlaySkipIfEvoInformation.cs Wizard\PlaySkipIfEvoInformation.cs c9661e2f6bb246f2e8aa6d587fff3c3cd056345485f01488a5e5636caf46c6e6 0 Wizard\PlaySkipInformation.cs Wizard\PlaySkipInformation.cs 991da0ec87aeb9d1d4283ccb7f315db875d14aa63c494a05ea97df452c14ae9d 0 Wizard\PlaySkipTagCollection.cs Wizard\PlaySkipTagCollection.cs b5a8ef396806b07493e98d47000f4519868355ff37432aa94d59ecec87306cb8 0 +Wizard\PlaySkipWithActionIfEvoInformation.cs Wizard\PlaySkipWithActionIfEvoInformation.cs 161af11f1248d88fb5b0eac67b043c8e6df9668a1008632660b4fed0c506720d 0 +Wizard\PlaySkipWithActionInformation.cs Wizard\PlaySkipWithActionInformation.cs 444852c31fc756f4e09231c2993261bc2feb600deb6f1eca2f687bfd25c45939 0 Wizard\PlayTagCollection.cs Wizard\PlayTagCollection.cs 68c84ed4598bdef107d093b7662ddd4a51cfcdeecc73c72cb40db08fd6d01fa3 0 Wizard\PlayedCardInfo.cs Wizard\PlayedCardInfo.cs 4f5236fb71867c8607bc4f3aacee3e5355080a4d5a4a79bc6521f564b7994e6e 0 +Wizard\PlayedTogetherHistory.cs Wizard\PlayedTogetherHistory.cs 4539c3f65d8eeec93a128d35d03162aa0920584fd6c0572819926d650f1bf1d4 0 +Wizard\PlayedTogetherInfo.cs Wizard\PlayedTogetherInfo.cs 2ad8297287d54111f23f6e230f428b1ef8c4cab8901049dd5dd86ddf6d870ecd 0 +Wizard\PlayerEmoOnLeaderDamagedPolicyCollection.cs Wizard\PlayerEmoOnLeaderDamagedPolicyCollection.cs c184b3bcdee48da727b852c93144b682dd012190bb9a6a2cdf15a71d78c305c2 0 +Wizard\PlayerEmoOnTurnEndPolicyCollection.cs Wizard\PlayerEmoOnTurnEndPolicyCollection.cs 8bcdde120838b245bdae2c8b2f0f980ea5e6ae9f6cb82f408ee2818f6889d874 0 +Wizard\PlayerEmoOnTurnStartPolicyCollection.cs Wizard\PlayerEmoOnTurnStartPolicyCollection.cs 1820ab12d06d0480f691e6e27c845fe7d714dc89520bd49c07d298d5217964bc 0 +Wizard\PlayerPrefsWrapper.cs Wizard\PlayerPrefsWrapper.cs 55326eeae1bd6269244e81c561851a486cedf959b981caea8f4de3bb80f01b67 0 +Wizard\PlayerStaticData.cs Wizard\PlayerStaticData.cs 7928b47254bacd87b53525bc22a5401e4471860e6d62d12b3c1fcfb420625a54 0 Wizard\PlayoutBonusTagCollection.cs Wizard\PlayoutBonusTagCollection.cs e09f770ddfeb7644d0d836a9d9747944a76a1ca464e4301b7469c52433d69051 0 Wizard\PlayoutNextTurnTagCollection.cs Wizard\PlayoutNextTurnTagCollection.cs 6f5c85cc3a8d3b12c68a8b70769025783e6058bf518eb6467053d986ad2b0200 0 Wizard\PlayptnBaseStatsRateInfo.cs Wizard\PlayptnBaseStatsRateInfo.cs 43d28ea1977f721d3b106f12bcfb601fd69816fe8fcfd0717a8fa8691ec95fa2 0 Wizard\PlayptnBaseStatsRateTagCollection.cs Wizard\PlayptnBaseStatsRateTagCollection.cs 4ed539fff8051a4474c1114bcd0c6892cf1b255d1ce5c60129657081c2cc0d60 0 +Wizard\PlayptnBonusPolicyCollection.cs Wizard\PlayptnBonusPolicyCollection.cs 0cf86b51c43acbe5842171a923af9b9099e1e8745d6122fbf7ea1d8465ae41d6 0 +Wizard\PolicyCollectionWithSingleType.cs Wizard\PolicyCollectionWithSingleType.cs 028f14bf344c0b269887d79b497b5ec43c232b6dfc88facf5190c5d29f8f2ed9 0 Wizard\PolicyCollectionWithTypeBase.cs Wizard\PolicyCollectionWithTypeBase.cs d6e70cd2c96ad62d6dfadff5a3c6fc8318c31e8661f0a1abce61165156136aa4 0 +Wizard\PolicyCollectionWithTypeCreator.cs Wizard\PolicyCollectionWithTypeCreator.cs 8836a3b0826ed5b0120e3353aa755a146f037e989b76d70e534aea595817bdba 0 Wizard\PracticeAISettingData.cs Wizard\PracticeAISettingData.cs 59f4b1180f859de742f31f4af61dd7997d9f5d0e09d0f15c605586a9d6d732f0 0 Wizard\PracticeAISettingDataSet.cs Wizard\PracticeAISettingDataSet.cs d718d5d948ff6fb0a57614b84d7f11a04c99bfcf099c6f3916e56522017f22fc 0 +Wizard\PracticeData.cs Wizard\PracticeData.cs 46f8546a0b0ad4fa7e383db8ebae71f94f8e7489336e2cc49150984086ea02a1 0 +Wizard\PracticeDataMgr.cs Wizard\PracticeDataMgr.cs 8807b1c5f3579893c86becdab6748170b0f0d421645b3786291a70eccf7651ba 0 +Wizard\PracticeFinishTask.cs Wizard\PracticeFinishTask.cs d10192570f5b7a64781d5e092dc30b83c6959fea2af08b630521977ae9c6b197 0 +Wizard\PracticePuzzleMissionData.cs Wizard\PracticePuzzleMissionData.cs 47003f300e5cf92034b000af42ec55b6d8797551ff78779f988cf4fb444b3969 0 Wizard\PremiumCardConversionDialogParts.cs Wizard\PremiumCardConversionDialogParts.cs ef813540d655bcf33bcdf994acfdae8185dc8dcf85976520da2f394c6125733a 0 +Wizard\PremiumCardConversionTask.cs Wizard\PremiumCardConversionTask.cs bd38fcf046c19a6950f9dd0857065a55e01e6defd496a53413bc0aa2aa8d2142 0 Wizard\PreprocessTagCollection.cs Wizard\PreprocessTagCollection.cs 2f22016f344bf7a05815f0d60d7721a9ecaa1094dced3c3007c77b4372cb2368 0 +Wizard\Prerelease.cs Wizard\Prerelease.cs f23633dee2b1e4a45df176a8c31f1beb888e1ed536b7b3cd8dfb050c51612595 0 Wizard\PrereleasePurchaseInfo.cs Wizard\PrereleasePurchaseInfo.cs 8876aa1902f358c9eda8c46c5911a45e8d9a836a900d9a4b0d437149112dcf37 0 Wizard\PriorityTagCollection.cs Wizard\PriorityTagCollection.cs 1c9656863a2740157fd0737e77528180d66e246cd672a820d6a94c2d38429693 0 +Wizard\ProductDetailPlate.cs Wizard\ProductDetailPlate.cs 5195aeeae2fdb5f0cb9675643a7b4cfc6766fcaf62ea295d289db63c213bf35e 0 Wizard\PuppetAttackParam.cs Wizard\PuppetAttackParam.cs dbfa38756de17fa26e09165c070c91640812540465c66dac3592aa0582594127 0 Wizard\PuppetAttackTagCollection.cs Wizard\PuppetAttackTagCollection.cs e284ebdeb61706237dbf83d8b7fb0145f703aa375cd170e5f39b7af2d43db446 0 Wizard\PurchaseConfirm.cs Wizard\PurchaseConfirm.cs 91ab7d0a239b6ddf305b5395e8cb058c5714a0b6a5d4e1534990e912ec2af0d2 0 +Wizard\PurchaseRewardDialog.cs Wizard\PurchaseRewardDialog.cs 66c1260e844322ac7c786ebc6ef10dcd3390fea3724c38abd2898aa4961917cb 0 Wizard\PurchaseRewardInfo.cs Wizard\PurchaseRewardInfo.cs 68266e03484b149bbe1ec5d0d26ca99f5377e33cf6194af6c332ae021d96c925 0 +Wizard\PuzzleAnimation.cs Wizard\PuzzleAnimation.cs d39d28b1116f056e57c19e9e18249f9989c6907b6e6413451d343e2127fe1746 0 Wizard\PuzzleBattleMasterData.cs Wizard\PuzzleBattleMasterData.cs d1724a7755e6ffd48ced04db5853dbfec787b6190c235471eb96b8ababf766c0 0 Wizard\PuzzleQuestData.cs Wizard\PuzzleQuestData.cs da6724883671e227cfd3b5b8eb64af071bed3ffec7ecb95e84710b18db96b901 0 Wizard\PuzzleQuestInfo.cs Wizard\PuzzleQuestInfo.cs 17e215c00ac4d2ec648d5a3c7a70393fea406889685c88434b6d526571811f7b 0 Wizard\PuzzleQuestSelectDialog.cs Wizard\PuzzleQuestSelectDialog.cs 2f297d0ea4730615c2657a05777994e224732fe8003c9e231b307d5eb8b500ba 0 +Wizard\PuzzleQuestSelectGroup.cs Wizard\PuzzleQuestSelectGroup.cs 825f716ed1886765d08cdc9d43e623e98fc1db4a092f0b27c418e2af744fba6f 0 Wizard\PuzzleQuestStatus.cs Wizard\PuzzleQuestStatus.cs 080f93e95b6fb21f06ca4e7874ef9050bd4bcb62338f5c0e12b05de722cecca9 0 +Wizard\PuzzleUtil.cs Wizard\PuzzleUtil.cs bafb6cdbfa6a9e1878ac22eecbe6c6fab77c4998dba4f4a7893813cfbb39e5a7 0 Wizard\QuestAllConfirmDialog.cs Wizard\QuestAllConfirmDialog.cs 797160bab5654b592f9bd5e9390e42008336c0ba9e0aeea1aabdab7a0e435bed 0 Wizard\QuestBattleData.cs Wizard\QuestBattleData.cs 2c7b710d636f9f2112f6216b78f6516f17e573803db9277c03e2d04200b2e23a 0 Wizard\QuestBossData.cs Wizard\QuestBossData.cs 54bea11a04848ecbba06458cc3fb23ee38eb80ffe096871a490c3c3e10730f7a 0 +Wizard\QuestCampaignDialog.cs Wizard\QuestCampaignDialog.cs ac77934edc832b5b3d82459ea80b834bcbb2448c26882d1c8bcf2510c4a881aa 0 +Wizard\QuestDeckListTask.cs Wizard\QuestDeckListTask.cs 7c35ec8edc89aaefdab8f908cdf6ec9067a7635d9d89fd135783e8226d348f1c 0 Wizard\QuestGaugeItem.cs Wizard\QuestGaugeItem.cs dd1dc88a5b96dcf53a47bfead6786c42c20b7b422547f9946b5213d534309b7f 0 Wizard\QuestInfoTask.cs Wizard\QuestInfoTask.cs b6da4bc6326ab5b8a11367cd77cc00a563847486bd62528ec1badcd71451e271 0 Wizard\QuestItem.cs Wizard\QuestItem.cs 6f873d6290ba0122b8c6789fb23e5ba9ec1a602bbe11e8fe50dad5eff8b712cd 0 Wizard\QuestItemBase.cs Wizard\QuestItemBase.cs 8f6330477afc45f7c23044fb7fb0aa5309a26cac11e74c3c70c76cdffcc7c664 0 Wizard\QuestItemTitle.cs Wizard\QuestItemTitle.cs d0f78fd42450feff168cc3777d1fbb4009d4ca135884099df42b4ebacb86d9b0 0 +Wizard\QuestLastUsedDeckSaveDataManager.cs Wizard\QuestLastUsedDeckSaveDataManager.cs 2e6bd310224e1f19565a6d151065abfe15b42e7de0501843728061bc5de63c07 0 Wizard\QuestMissionData.cs Wizard\QuestMissionData.cs 66851df2ee770b75efee5a16e28a3e0dc23fda420f4c5888746af055c258a2e9 0 Wizard\QuestMissionDetail.cs Wizard\QuestMissionDetail.cs cb9bca006c7b2cf01d8b52f79bb8309cf2df03b52b0fd9ba989e811343cf3938 0 +Wizard\QuestMissionInfo.cs Wizard\QuestMissionInfo.cs b053f2da261b643f34f07b3407ae56fe46d52303c179badc9fc93a4d0a153170 0 +Wizard\QuestMissionInfoTask.cs Wizard\QuestMissionInfoTask.cs 16dddc339f90798b09b3293c9251b541f4c826f2c27b52536d3cf46d624fa744 0 +Wizard\QuestOpenInfo.cs Wizard\QuestOpenInfo.cs c64408d97e06f18f99917bdccf9065eb80124544e412b2bb35c16e33e419f6ce 0 Wizard\QuestOpenPuzzleDialogTask.cs Wizard\QuestOpenPuzzleDialogTask.cs 3aed83f56b6aeebb345d6836cdc86fac3ae19cae47223f3ae8c7bd9e91d9c740 0 Wizard\QuestOpponentData.cs Wizard\QuestOpponentData.cs 85b29720e35ba0937b5bbd8bfc28dee787a7945bb0aa1cc829c668069f633daf 0 Wizard\QuestPointConfirmDialog.cs Wizard\QuestPointConfirmDialog.cs c5c4b1e31fe40f7de6fa17f9d16ef66074d1fdcd6ddfc4128a57dc6e8d274f38 0 +Wizard\QuestPointInfoTask.cs Wizard\QuestPointInfoTask.cs d536b67d78c30f75ac3727c4b07d9aa06ab53121ffebe9c45c1f00e6f75eee5b 0 +Wizard\QuestPuzzleSelectionButton.cs Wizard\QuestPuzzleSelectionButton.cs 856cba9ac3c534d254d3d3f444cc0c6c489e6146984a12b7fb870a6d98a881e7 0 Wizard\QuestRewardInfo.cs Wizard\QuestRewardInfo.cs c0d8c01dd78824d62c5f145bea4141a576db63d39ca2230e35eb41fe48342e97 0 +Wizard\QuestRewardReceiveAllTask.cs Wizard\QuestRewardReceiveAllTask.cs 8a176374c8b8e0de2c80c6baf26cb7a13435dc036c82ad4f3afd528126478d75 0 Wizard\QuestSelectionButtonBase.cs Wizard\QuestSelectionButtonBase.cs a6376f737ad9c5e89199eb572562d3e85f8537bf4b0e349df1d95462cb8f2230 0 Wizard\QuestSelectionButtonData.cs Wizard\QuestSelectionButtonData.cs 63f83ab58371f7a90664d831e88932b1c6ef39b5e93b99308aecd0d87fe381ab 0 Wizard\QuestSelectionPage.cs Wizard\QuestSelectionPage.cs 4a4a0e23ca749a3e634e45fd0edab5c1a4902651f56b982a057136a705940685 0 @@ -718,46 +2445,98 @@ Wizard\RallyCountPlusTagCollection.cs Wizard\RallyCountPlusTagCollection.cs 4925 Wizard\Rank.cs Wizard\Rank.cs 1bbdd3efaf38a8a9e587ae8094b0db792cb81d1df7cf63252f739347b1803cba 0 Wizard\RankMatchAISettingData.cs Wizard\RankMatchAISettingData.cs 210b88babcc6daff656bdc2fe24edcd0a9556351f2b147d5f04a37f52a770f42 0 Wizard\RankMatchAISettingDataSet.cs Wizard\RankMatchAISettingDataSet.cs a0dd289c49ede4aac584291fdeeb060cc0c9b70c4e1a123cad6cab216ea2de55 0 +Wizard\RankWinnerReward.cs Wizard\RankWinnerReward.cs eaca300be07defdbf22c9792d9697997fbbf9b0f162a3fabc535498f7c28e0da 0 Wizard\ReanimateBonusTagCollection.cs Wizard\ReanimateBonusTagCollection.cs 6ac7d8043c9a315e74aa1533f36f00468f432fb4043367c6c7f6881ca06b9e34 0 Wizard\ReanimateEvoTagCollection.cs Wizard\ReanimateEvoTagCollection.cs a266712e3ded29167a94fd881ee344b35eaf3eaad8f1359736d2c76ee0e02881 0 Wizard\ReceiveTurnEndToJudgeResult.cs Wizard\ReceiveTurnEndToJudgeResult.cs ef2f76201ccef6b81ce3b2ff37016bc839e7126f5772524f74d114d3d826e6b9 0 +Wizard\RedEtherCampaignResultData.cs Wizard\RedEtherCampaignResultData.cs 83dcda42b623e04deaad677b7a127eb8fc5a3b762d8969ed3d32e2bd4ec92a90 0 +Wizard\RedEtherCampaignRewardData.cs Wizard\RedEtherCampaignRewardData.cs ee29767b469b128fd64232d415baf1a34b315478dd268f4fa59a9774b5789d3b 0 Wizard\ReferableVirtualCardBuildParameterCollection.cs Wizard\ReferableVirtualCardBuildParameterCollection.cs b04760995eddf63a9f8f7dcc1ca3064092bc880a67eb1ba7f808e77dfd7cf829 0 Wizard\ReincarnationSimulationTagCollection.cs Wizard\ReincarnationSimulationTagCollection.cs 863e9c6fd3b131c9564048419b2af5967689b9389fb803c8bc4b079185a578b0 0 Wizard\RemainTime.cs Wizard\RemainTime.cs cad4a6d7241987deccf91cab20b07146a393262888f556743b959d015c58c7cb 0 Wizard\RemoveByDestroyTagCollection.cs Wizard\RemoveByDestroyTagCollection.cs 6bb0f29c81a74b7bab7c062244773c4a7c366ea76836db7ca5abe860d097c38b 0 Wizard\RemoveSkillTagCollection.cs Wizard\RemoveSkillTagCollection.cs 4b31000c33a964929a361f964499aeddd2e884862600c4488c86d49e8a21120f 0 +Wizard\ReplayInfo.cs Wizard\ReplayInfo.cs c1a4ac59b3c2867dee7d40b8756492ddb6418bb5895a96e663eb0ec73b36bea4 0 +Wizard\ReplayInfoItem.cs Wizard\ReplayInfoItem.cs f33d8625be78c3ff5edad57e4a9350f2721677352b1e637dde6f604c37db2471 0 Wizard\ReplaySkipAnimation.cs Wizard\ReplaySkipAnimation.cs 028d4fbc5d2ac366f5a90c86245482b36f37990c22eedd1f9b1109b5e673d346 0 Wizard\ResonanceTagCollection.cs Wizard\ResonanceTagCollection.cs 18e5ba29b08bf24bdf9b6f2078c6180099c9d468b1ab5c1fa05a0452199169ad 0 Wizard\RewardBase.cs Wizard\RewardBase.cs ea35849169b3987c450abbaece54578234821d644bf3289fc0307fd8ca14fe23 0 +Wizard\RewardConfirmDialog.cs Wizard\RewardConfirmDialog.cs 021ab951cdc0d5415fa633e3ae3baa4d455d7f58effe7cc50ab607cd366cc111 0 +Wizard\RewardConfirmView.cs Wizard\RewardConfirmView.cs 10b0861af3584726436dbc8f2d1881984455c98878e9fe32731e5d73e2966e8b 0 +Wizard\RewardConfirmViewItem.cs Wizard\RewardConfirmViewItem.cs a610a6e1717c0e451e02d3aa855904d94cf7402180f65380e09ff8ef9119b623 0 +Wizard\RoomNonPossessionCardCampaign.cs Wizard\RoomNonPossessionCardCampaign.cs c2a0ac27c8f58890764c6733cac8d4c73ecb67b27ebf4a4d18db2022980b0de4 0 +Wizard\RoomRuleInfo.cs Wizard\RoomRuleInfo.cs 6ba79e521eaeba627b6ef48ac714180b870049479ed8690533f780c27c07cfcf 0 +Wizard\RoomTwoPickMultiDeckInfo.cs Wizard\RoomTwoPickMultiDeckInfo.cs 162e9f436a85bbde551fe7b19f140aa0e2535c62a92a1736ba4aa5b7e6d502a5 0 +Wizard\RubyText.cs Wizard\RubyText.cs 603c0127a9a30f36afd18e894bd0f14eb47c07dcbf2dc70795aee7febc873466 0 Wizard\SceneTransition.cs Wizard\SceneTransition.cs 3858aa170b79fe0d46824439ee34bd85865732bc0c96dfa9bc8b37f5a28a0670 0 +Wizard\SealedCardInfo.cs Wizard\SealedCardInfo.cs cce1286ee19cba2f723c2ccc551dd0d86ce57e4cfe48dc17364166cb94f84cd7 0 +Wizard\SealedClassInfo.cs Wizard\SealedClassInfo.cs b767bc9d34b118b82729ce158dc1f52ab666abde3c80336bad1c6d4268ab1f22 0 +Wizard\SealedData.cs Wizard\SealedData.cs 64eef0afbb678d29b18696e41cf2ea13b2950eb9392154f9123ac1d6a554ec70 0 +Wizard\SealedMyPageResponseData.cs Wizard\SealedMyPageResponseData.cs e4532941557173ee81bd1262fd7883720e7170ec80d739943d719c11c9ec0ff5 0 Wizard\SecretBossInfo.cs Wizard\SecretBossInfo.cs 5ee84152be88797d9d5147965973aad8011e7ad23e07bf2c2a4df512012f99b9 0 Wizard\SelectBuyNumPopupBase.cs Wizard\SelectBuyNumPopupBase.cs ecea78a81f059d7e3d7bf18e05ef61bfa39a85e0b72b0f53991e8edbf498c90e 0 +Wizard\SelectCardPurchaseConfirmDialog.cs Wizard\SelectCardPurchaseConfirmDialog.cs d903d5c304091a75730d89c2762f51c1c1f9bc8d4b6de53405e6a037a08c7e40 0 +Wizard\SelectSkinCardDialog.cs Wizard\SelectSkinCardDialog.cs b4843278a392d9b14c898f0918ebdd7d5ad3e76eec457071d2c91739d611cdfb 0 Wizard\SelectSkinCardInfo.cs Wizard\SelectSkinCardInfo.cs 6011046eb19f8a1d354683c144f769a09f56ff42f43a4d4245aeb1beaac72fa2 0 +Wizard\SelectSkinCardPlate.cs Wizard\SelectSkinCardPlate.cs b2f7078b56691bb3b8f2829af9d48e52c4ecd077fef2f705a63d27412749a125 0 Wizard\SelfAndOtherEvoTagCollection.cs Wizard\SelfAndOtherEvoTagCollection.cs dcd522c9567e370f36d467501d30d5f7e8f0e570f6ba60272c95b014705198de 0 Wizard\SetAITribeTagCollection.cs Wizard\SetAITribeTagCollection.cs 69b942da626b35c3f41096f752dc2456adf3315ed15777644baea2fe80f87f7a 0 +Wizard\SetReferenceIdPolicyCollection.cs Wizard\SetReferenceIdPolicyCollection.cs 8cf3171c99f0bfea8fb69de902e587a5ea113a49c935b269be49f001c7f4c288 0 +Wizard\SetReferenceTribePolicyCollection.cs Wizard\SetReferenceTribePolicyCollection.cs 38b4892c251736b3b2aa706a8d6d96d6584b25f83a5764345ff57f4399a1cff3 0 +Wizard\SetUp.cs Wizard\SetUp.cs 200f871c2f6ca9c5f4cfa4b32615ce99505c38edd26ec36d6250e2a7869b6bce 0 Wizard\ShopCommonRewardInfo.cs Wizard\ShopCommonRewardInfo.cs 1362db5cce7666eec06fa52b47a631df8de00dfaf4c89a8b329f4c5d081f3b75 0 +Wizard\ShopCommonSaleInfo.cs Wizard\ShopCommonSaleInfo.cs 11a36e1059fc7b22670cdd2358bbe89a80ff5d12cef5363535af0f1817b694cc 0 +Wizard\ShopCommonUtility.cs Wizard\ShopCommonUtility.cs 922f6d01f9b3c5dcaa093dc1e58d68e3a009998de49b130989e85611bf6f4546 0 +Wizard\ShopDrumrollScrollItem.cs Wizard\ShopDrumrollScrollItem.cs c929abe0ab0633c4a1d3c9db2502b7d599ef47cd50146a17b566d598ab939b93 0 Wizard\ShopDrumrollScrollManager.cs Wizard\ShopDrumrollScrollManager.cs 74fb76307264f57d77e4d68ae067a6c94e544c1a36f799649be1871f61ec51de 0 Wizard\ShopExpirtyInfo.cs Wizard\ShopExpirtyInfo.cs 93d265032ad665bb5b1752f8891e40cf0b2b7380def77a83298c9d7ef344ffd9 0 +Wizard\ShopNotification.cs Wizard\ShopNotification.cs 966f8941c585502d2468cc62839e4d230f4d27d7ca4cf157f47a3582afd4208e 0 +Wizard\ShopPanelAppealItem.cs Wizard\ShopPanelAppealItem.cs 91938915d1596a81669ad732ccf0ab85ca7588fe3b884193475e778c4f7a19f4 0 Wizard\SimpleScrollViewUI.cs Wizard\SimpleScrollViewUI.cs c09d0cd5935fa0157c07d98226df86270f51d94cccc6e66d0fca4a901f868899 0 Wizard\SimulationAdditionalActionInfoSet.cs Wizard\SimulationAdditionalActionInfoSet.cs c20debde6f1f635e218fc5027f7b2939a6160e86a13c2166efac15732e1bee81 0 Wizard\SimulationResult.cs Wizard\SimulationResult.cs e7664bfdf29cce647808d1fa5989de992affa051e552a2fbe4c627ccc37c55f4 0 +Wizard\SimulationSetting.cs Wizard\SimulationSetting.cs 77cdc42ebe248d32c80459d163910035dd3b2a20383025b8fbd4099697926f45 0 +Wizard\SkinProductDetail.cs Wizard\SkinProductDetail.cs 62ba878fd680385058defd2b206b2a194f21f2eeebbebf21bef478afb0d9aef5 0 Wizard\Sleeve.cs Wizard\Sleeve.cs 7f871310a61810e786bb5daeb65e994c5deb2f1c2f6269065892a4d325553e80 0 +Wizard\SleeveBuyTask.cs Wizard\SleeveBuyTask.cs 0d00a58104bd404cfb18e3a8354186f94adc71158f214b52c388b08e808d4470 0 Wizard\SleeveCategory.cs Wizard\SleeveCategory.cs d636241391f0421028aec23fa83b44af32beb01a3af5bc14469fe076b8016a38 0 Wizard\SleeveMgr.cs Wizard\SleeveMgr.cs 65624ba278a3238a02189445cf03fdf423d1e8985338d938a389c002e5bbf497 0 Wizard\SleeveSeries.cs Wizard\SleeveSeries.cs 9a3658f9b77625a36c9ce51c8797c3fec4f8a9d48b541e828a372b71490b45ba 0 +Wizard\SoftwareReset.cs Wizard\SoftwareReset.cs 34b932e97699b44f002a33ef3d500a42d2c91473bc726c7a5e1baed65a44d2af 0 +Wizard\SpecialTreasureInfo.cs Wizard\SpecialTreasureInfo.cs 7a11bde523e27e58b1ed032703c755e76da0a85e0b1919f7cdff673f440731d1 0 +Wizard\SpeedChallengeInfo.cs Wizard\SpeedChallengeInfo.cs 9fd6697d1c55746b451fa07809d610d6ba1251ad6b723ece688a3b04fc996876 0 +Wizard\SpineDisplay.cs Wizard\SpineDisplay.cs ea318e1a3fc12d23581101ef989a9d32d7dadcbb33a1104526b2cd7c9b8008b6 0 Wizard\SpotCardData.cs Wizard\SpotCardData.cs ac20fd44447242b9ecc761f3b4acf3bb407f3ea542f48fb56926d2385cd3e814 0 +Wizard\SpotCardExchange.cs Wizard\SpotCardExchange.cs 40ab6e8cfa601cac24d61ee262c4715f40fdecb81f3b705b9458db57540c9592 0 +Wizard\SpotCardExchangeDialog.cs Wizard\SpotCardExchangeDialog.cs bb9eb3bed731bb46701d97f1951f7a10bfe8af3ce51cf88a87b1728b285bcc51 0 +Wizard\SpotCardExchangeInfo.cs Wizard\SpotCardExchangeInfo.cs f8441842f1c264887158a5e5fa5305830a11308af593bd4049893b9a9f54d17a 0 +Wizard\StarterClassSelectDialog.cs Wizard\StarterClassSelectDialog.cs 3522461bbc4d0f73d1beb639b37213f68a9691ea3a344df56e34ff7ba75b2e4b 0 Wizard\StoryAISettingData.cs Wizard\StoryAISettingData.cs 14402dc36fa4ae13f154c8110141087145efb387c94292f7a5102dd3b671151d 0 Wizard\StoryAISettingDataSet.cs Wizard\StoryAISettingDataSet.cs 76693a53b4022593dd67cd8d08b41c2ab7647d8b3663176b13909ca0e6c11900 0 +Wizard\StoryFinishTask.cs Wizard\StoryFinishTask.cs dbf0508b3638ac87b55872f060f672960b38de3c2cabcf6d8bdd3499047d4643 0 +Wizard\StoryNotification.cs Wizard\StoryNotification.cs 2031e97ce2caa711e695a8ca6b372e9c43c4957e890d274a857887d387eb2808 0 +Wizard\StorySectionBtn.cs Wizard\StorySectionBtn.cs 4c5017f7a46c2aadf025f170455524a7fbcdaf230357f103411171a21d2e67b9 0 +Wizard\StorySelectPage.cs Wizard\StorySelectPage.cs 9f24b2f8f98fd01b416272fbd6653d2a4394e94276813dbe4392144e459c831e 0 +Wizard\SubClassSelectDialog.cs Wizard\SubClassSelectDialog.cs ce9eed6444e38ddd10eb305755b400808395d861621442d60553e91e46b6351f 0 Wizard\SummonTagCollection.cs Wizard\SummonTagCollection.cs 584ee636f3d8826973893728e77f5a72cc4c4b608357b6bccb993f17abf46976 0 +Wizard\SummonedVirtualCard.cs Wizard\SummonedVirtualCard.cs 26483c1445ad0f95167e6cfd6cc8d719e87fb20d231d2215ee13d6adc1e3c145 0 +Wizard\SupplyLabelPlate.cs Wizard\SupplyLabelPlate.cs f4dc3274f670ef78b6c9bf7518e074df7c9477792af420caf6e0d16518df73df 0 +Wizard\SupplyLabelPlateListUI.cs Wizard\SupplyLabelPlateListUI.cs 9c49cffa2ff008f6b20d08109dd3eaee2a75d5f062fb3b538a331a26e1d8747c 0 Wizard\SystemText.cs Wizard\SystemText.cs 1450cdaf4d2f61346fb8743ca0be089647c64f328b825d2e1f9d9ce667655dc3 0 Wizard\TagCollection.cs Wizard\TagCollection.cs 16016406df9b7e9287ba64d32b57297059ee1a1fe2f3b57845ec7ad4588630ea 0 Wizard\TagCollectionType.cs Wizard\TagCollectionType.cs 6723cd1be89e3669a02e640d2b4528d8908b0322f25fef413e8b147e3aea3101 0 +Wizard\TagCollectionWithSingleType.cs Wizard\TagCollectionWithSingleType.cs 13828b771705d65b2626fda575be6d2de1057d1b91b26917d20c96e9b3179371 0 Wizard\TagCollectionWithTypeBase.cs Wizard\TagCollectionWithTypeBase.cs 9ba0688d57518d19a3ed80819ae1501bd59c911e7749388aff097dfae8f46aee 0 +Wizard\TagCollectionWithTypeCreator.cs Wizard\TagCollectionWithTypeCreator.cs ba793e436b0c9b4f4ec2e4d0b8cdb6d0572c1285556baf0068fb6d330d0d7cbc 0 Wizard\TargetSelectType.cs Wizard\TargetSelectType.cs 91ab18f9c069784e1140a187eabd8248761618a577811296f36db07f9b87265b 0 Wizard\TargetTagCollection.cs Wizard\TargetTagCollection.cs 1bd2fb66e58c9fae3d23fbce351972577da664c2b959ee92e0547e2396c82eb9 0 Wizard\TextLineCreater.cs Wizard\TextLineCreater.cs fdb7f0a918c2f5b92268954b3980724f29cb16a8098ea67c2d99633ae5bd1e92 0 Wizard\TokenPlayPattern.cs Wizard\TokenPlayPattern.cs c14d846afb81b876291013c077cbd503bebd27b651b5b78708e93d68758e2e7b 0 +Wizard\ToolboxGame.cs Wizard\ToolboxGame.cs f0a39a9ec7a06d08cc2594cc93f010c602946492ed93c002775c41000f30ef75 0 +Wizard\TransformBackup.cs Wizard\TransformBackup.cs 590cfc9e5b00c6896b9bff2e1086827dd53d821b99cc83a76bc76f94ea053135 0 +Wizard\TreasureBoxCp.cs Wizard\TreasureBoxCp.cs e78c9c95de87adcce86167b4f99afc69960072254fbff0226dbb27aa2253c10f 0 Wizard\TreasureBoxCpResultInfo.cs Wizard\TreasureBoxCpResultInfo.cs 77141091f1b85fdfa04005a5551b5d9ae29322c1446c70411e410daec2fe4bc5 0 +Wizard\TreasureCpBoxTextPanel.cs Wizard\TreasureCpBoxTextPanel.cs 22be14af133def36515b86ba125a329778b6d3f19997ecc70e7e68bd05167a51 0 Wizard\TurnEndTagCollection.cs Wizard\TurnEndTagCollection.cs 176accc9ed7bbafa5b36a25cbd85caa6bad54acabdbe1f786160ba11737cbdf2 0 Wizard\TurnStartTagCollection.cs Wizard\TurnStartTagCollection.cs a6190321dd648393cb52de200be2bdd7dadeca06f602fd13c9803fd3d84e2849 0 Wizard\TutorialAreaSelect.cs Wizard\TutorialAreaSelect.cs fd8c11bbe4a98a5407fc1bdae75f3fae5fab2a996cde2a54a7fcbd5a73115352 0 @@ -765,14 +2544,21 @@ Wizard\TutorialData.cs Wizard\TutorialData.cs 2fc9577f9c08b7803e3673d18eee530d3a Wizard\TwoPickFormat.cs Wizard\TwoPickFormat.cs 7f09731756f955d49fd610f3383ad697786e37c4d09d78bf577b03767bd40177 0 Wizard\TypeFilterDialog.cs Wizard\TypeFilterDialog.cs 4c764fe4b79a18bc267d0775575b85f7bedb28a645935f2474dfebc292ba3cf8 0 Wizard\TypeFilterSingle.cs Wizard\TypeFilterSingle.cs d59034d2a145657e5d06d6db841d13f3ea71a00ddb586f5e8994d8e14ad9de2b 0 +Wizard\UIAtlasManager.cs Wizard\UIAtlasManager.cs 5c75b17b39bb1e5e6c14eed56ebbf00a21bc88427227a971897b7d41eae9a173 0 Wizard\UIGauge.cs Wizard\UIGauge.cs 0118ff5fbb35e3386abbda434cac738fc420ecbac5dcba1e532483f4ac9b0d40 0 Wizard\UILabelEffectOverwriter.cs Wizard\UILabelEffectOverwriter.cs d91ad280e420b0b04a1e1fda0b58c993d0523b2dce9f58e40bf2fd98aaf9943b 0 Wizard\UILabelGradientOverwriter.cs Wizard\UILabelGradientOverwriter.cs 61d81c1710dbdcfdd5f2ecc07bfaf1aea701f80c45b46c4556705782c43a4eec 0 +Wizard\UIPageIndicator.cs Wizard\UIPageIndicator.cs d4e6665f6992a99dac634794580ed7810242639f10b9a4f4875fc4df0b87db11 0 Wizard\UIParticleEffectGroup.cs Wizard\UIParticleEffectGroup.cs dcc425e476a98214ce77ae6c41500e8a082e3c4ecdea1b06455ffc80da4f85ff 0 +Wizard\UIParticleEffectManager.cs Wizard\UIParticleEffectManager.cs 6de2774b868bed1f996dfccce58de26dca47b89b42e03a7929eb95ea97dafcbd 0 Wizard\UIShaderSprite.cs Wizard\UIShaderSprite.cs 26f4dc6be5c3fa99f59e54582797b045ad343fb40fb1338a187f723ee0c75251 0 Wizard\UISpriteAtlasOverwriter.cs Wizard\UISpriteAtlasOverwriter.cs 0f3455b58b740cab260d97bf28d1b8e73ba0ba6938f62d4b81021b3329e07bd7 0 +Wizard\UIUtil.cs Wizard\UIUtil.cs 6a019191da0f9c4a0605f3ccec9e85f028115bcf1c292b8f0512a20b54654be7 0 +Wizard\UnitBonusPolicyCollection.cs Wizard\UnitBonusPolicyCollection.cs b8e5522040191498c5871a91b7330774d4710b2f65ee2af451706ff9cb228baf 0 Wizard\UnlimitedRestrictedCard.cs Wizard\UnlimitedRestrictedCard.cs 295618ea53573f498923f63bfabd0b3543552761811830b83e2a18980edfc311 0 Wizard\UserGoods.cs Wizard\UserGoods.cs c21dd8bc5521e705da0994f68771149a54d461f49d00fbd54f9d8673bb047eb3 0 +Wizard\WebViewHelper.cs Wizard\WebViewHelper.cs 6de04c4f2ed591d28abd463e1ecf8392e75ac345520c2632365aef575d87bc53 0 +Wizard\WebViewScreen.cs Wizard\WebViewScreen.cs db0acaf319d8dc5ee28c441a4c32d88b59f49632efcb5707de85ed1ae47ecf7e 0 Wizard\WhenGetOffTagCollection.cs Wizard\WhenGetOffTagCollection.cs 56009d6b9acb7df9d376670526228b9b51d19fadd14325cc60166a0a0d82d7d1 0 Wizard\WhenNecromanceTagCollection.cs Wizard\WhenNecromanceTagCollection.cs 2576488749e9fa264bac47d56edcca8f30e7b0eaa08459f85ea0286f39453925 0 Wizard\WhenPlayTagCollection.cs Wizard\WhenPlayTagCollection.cs 4b4ee7e60d9fc7d6ac23ce8b3cec928d542ea6bb55d3637ad66093f0cba30141 0 @@ -780,4 +2566,6 @@ Wizard\WizardUIButton.cs Wizard\WizardUIButton.cs e078cf8215ad02ac1c0fd4a7fe66ab Wizard\_3dCardFrameManager.cs Wizard\_3dCardFrameManager.cs d23f7bd3cc2ddbb86f9a40d1dea6941796cf7562f9dd0f804b6acccd9a345396 0 Wizard\eColorCodeId.cs Wizard\eColorCodeId.cs 4c853d61f36776bc6a652c11a6eabdb4dbde7ff8ff5fbc410fb4b878a17edcb1 0 WrapContentsScrollBarSize.cs WrapContentsScrollBarSize.cs 90b8b14191d5016037bc1b907ef9408f9aecc63e8a2562cd58db8991345a538e 0 +YuwanField.cs YuwanField.cs 1368d0b2755edbae36ce4dcabd69d8d2f6ce854765ea46621199ef20d407d13a 0 iTween.cs iTween.cs 8da77cd885d8fb1e8727e91681ab5ac00a889d0fcc9b973a4162f15a0b642a54 0 +llField.cs llField.cs a0e0eaed3f22a8c4ce47f82fa80346e3b99e3ac0a6765e1ad4ade3a87c1b0189 0 diff --git a/SVSim.BattleEngine/Engine/AchievementInfo.cs b/SVSim.BattleEngine/Engine/AchievementInfo.cs new file mode 100644 index 0000000..5e69326 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AchievementInfo.cs @@ -0,0 +1,4 @@ +public class AchievementInfo : HeaderData +{ + public AchievementInfoDetail data; +} diff --git a/SVSim.BattleEngine/Engine/AchievementInfoDetail.cs b/SVSim.BattleEngine/Engine/AchievementInfoDetail.cs new file mode 100644 index 0000000..599f6e0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AchievementInfoDetail.cs @@ -0,0 +1,6 @@ +using System.Collections.Generic; + +public class AchievementInfoDetail +{ + public List user_achievement_list; +} diff --git a/SVSim.BattleEngine/Engine/AchievementWindowBase.cs b/SVSim.BattleEngine/Engine/AchievementWindowBase.cs new file mode 100644 index 0000000..d301dcf --- /dev/null +++ b/SVSim.BattleEngine/Engine/AchievementWindowBase.cs @@ -0,0 +1,777 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Bingo; +using Wizard.Lottery; +using Wizard.Scripts.Network.Data.TableData; + +public class AchievementWindowBase : MonoBehaviour +{ + public enum AchievementType + { + None, + Reward, + Nonattainment, + AlreadyReceived, + PointRunning, + PointClear, + PointReceived + } + + public GameObject goButtonReward; + + public UITexture achievementIconTexture; + + public UILabel labelAchievementTitle; + + public UILabel labelAchievementData; + + public UILabel labelAchievementCount; + + public UILabel _missionWaitLabel; + + public UILabel _labelMissionPeriod; + + public UILabel _labelMissionNotice; + + public UISprite _titleLine; + + public UILabel alreadyReceived; + + [NonSerialized] + public int type; + + [NonSerialized] + public int iType = -1; + + [NonSerialized] + public int level; + + [NonSerialized] + public string strAchievementData = "3็จฎ้กžใฎใ‚นใƒชใƒผใƒ–ใ‚’ไฝฟใ†ใ€‚"; + + [SerializeField] + private UILabel LabelDetailBtn; + + [SerializeField] + private UITable StarTable; + + [SerializeField] + private UISprite StarOriginal; + + [SerializeField] + private GameObject MailReceive; + + [SerializeField] + private UIGauge GaugeUI; + + [SerializeField] + private UILabel GaugeLabel; + + [SerializeField] + private UISprite _Separator; + + [SerializeField] + private UIWidget _StarsWidget; + + [SerializeField] + private UILabel _labelTopRight; + + [SerializeField] + private UILabel _missionStartTime; + + [SerializeField] + private UILabel _missionTimeOver; + + [SerializeField] + private UILabel _applyFinish; + + private const int ACHIEVEMENT_STARS_MAX = 5; + + private ResourceHandler _resourceHandler; + + private const string SPRITE_PREFIX_BUTTON_BLUE = "btn_common_02_s_"; + + private int _viewMailId; + + private QuestRewardInfo _questRewardInfo; + + private Action _onReceivceAchievementSuccess; + + private CrossoverRewardInfo _crossoverRewardInfo; + + private const int BINGO_MISSION_SPRITE_WIDTH = 752; + + private void Awake() + { + LabelDetailBtn.text = Data.SystemText.Get("Common_0022"); + } + + public void SetType(AchievementType typeBase) + { + labelAchievementCount.gameObject.SetActive(typeBase != AchievementType.AlreadyReceived); + alreadyReceived.gameObject.SetActive(typeBase == AchievementType.AlreadyReceived || typeBase == AchievementType.PointReceived); + goButtonReward.SetActive(typeBase != AchievementType.AlreadyReceived && typeBase != AchievementType.PointReceived); + UIManager.SetObjectToGrey(goButtonReward, typeBase == AchievementType.Nonattainment || typeBase == AchievementType.PointRunning); + } + + public void SetActiveGaugeUI(bool isActive) + { + GaugeUI.gameObject.SetActive(isActive); + } + + public void OnRewardClick() + { + AchievementReceiveRewardTask achievementReceiveRewardTask = new AchievementReceiveRewardTask(); + achievementReceiveRewardTask.SetParameter(type, level); + StartCoroutine(Toolbox.NetworkManager.Connect(achievementReceiveRewardTask, OnRequestRewardAchievement, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + public void OnDetail() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Mission_0007")); + dialogBase.SetText(strAchievementData); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + } + + private void OnRequestRewardAchievement(NetworkTask.ResultCode error) + { + OnRequestReward(error, Data.MissionInfo.data.total_reward_list); + _onReceivceAchievementSuccess.Call(); + } + + private void OnRequestReward(NetworkTask.ResultCode error, List rewards) + { + base.transform.parent.gameObject.AddMissingComponent().ShowReadDialog(rewards, MailReceive, base.gameObject, _resourceHandler); + MyPageMenu.Instance.UpdateMissionCount(); + } + + private void SetAchievementCommon(UserAchievement achi) + { + bool num = achi.reward_type == 4; + strAchievementData = achi.achievement_name; + SystemText systemText = Data.SystemText; + labelAchievementTitle.text = systemText.Get("Mission_0023") + strAchievementData; + labelAchievementTitle.rightAnchor.target = _StarsWidget.transform; + labelAchievementTitle.rightAnchor.relative = 0f; + if (num) + { + ReceiveReward.SetTicket(achi.RewardUserGoodsId, achi.reward_number, achievementIconTexture, labelAchievementData, _resourceHandler); + } + else + { + ReceiveReward.SetTexture((UserGoods.Type)achi.reward_type, achievementIconTexture, _resourceHandler); + labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)achi.reward_type, achi.RewardUserGoodsId, achi.reward_number); + } + GaugeUI.gameObject.SetActive(value: true); + int num2 = ((achi.total_count > achi.require_number) ? achi.require_number : achi.total_count); + int require_number = achi.require_number; + labelAchievementCount.gameObject.SetActive(value: false); + GaugeLabel.text = num2 + "/" + require_number; + if (num2 != 0 && require_number != 0) + { + float value = (float)num2 / (float)require_number; + GaugeUI.Value = value; + } + else + { + GaugeUI.Value = 0f; + } + goButtonReward.GetComponent().GetComponentInChildren().text = systemText.Get("Mail_0023"); + } + + private void SetRunning(UserAchievement achi) + { + SetType(AchievementType.Nonattainment); + SetAchievementCommon(achi); + SetAchievementStars(achi, cleared: false); + } + + private void SetAchievementStars(UserAchievement achi, bool cleared) + { + int num = achi._maxLevel; + int num2 = achi.level; + if (achi._maxLevel > 5) + { + num = 5; + num2 = ((achi.level == achi._maxLevel) ? 5 : ((achi.level <= 0 || achi.level % 5 != 0) ? (achi.level % 5) : 5)); + } + for (int i = 0; i < num; i++) + { + UISprite uISprite = UnityEngine.Object.Instantiate(StarOriginal, StarOriginal.transform.localPosition, StarOriginal.transform.localRotation); + uISprite.transform.parent = StarTable.transform; + uISprite.transform.localPosition = Vector3.zero; + uISprite.transform.localScale = Vector3.one; + if ((num2 == i + 1 && cleared) || num2 > i + 1) + { + uISprite.spriteName = "achievement_star_02"; + } + else + { + uISprite.spriteName = "achievement_star_01"; + } + uISprite.gameObject.SetActive(value: true); + } + StarTable.repositionNow = true; + } + + private void SetCanReceive(UserAchievement achi) + { + SetType(AchievementType.Reward); + SetAchievementCommon(achi); + SetAchievementStars(achi, cleared: false); + UIButton component = goButtonReward.GetComponent(); + component.onClick.Clear(); + component.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + OnRewardClick(); + })); + } + + private void SetAlreadyReceived(UserAchievement achi) + { + SetType(AchievementType.AlreadyReceived); + SetAchievementCommon(achi); + SetAchievementStars(achi, cleared: true); + } + + public void SetAchievement(UserAchievement achi, ResourceHandler resourceHandler, Action onReceivceAchievementSuccess) + { + _resourceHandler = resourceHandler; + _onReceivceAchievementSuccess = onReceivceAchievementSuccess; + switch (achi.achievement_status) + { + case 0: + SetRunning(achi); + break; + case 1: + SetCanReceive(achi); + break; + case 2: + SetAlreadyReceived(achi); + break; + default: + UnityEngine.Debug.LogError("unkown achievement status"); + break; + } + } + + public void SetCrossoverReward(CrossoverRewardInfo reward, AchievementType type, ResourceHandler resourceHandler, Action onReceiveReward) + { + _crossoverRewardInfo = reward; + _resourceHandler = resourceHandler; + SetType(type); + string texName = UserGoods.GetUserGoodsImageName((UserGoods.Type)reward.RewardType, reward.RewardDetailId); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Item); + _resourceHandler.Add(assetTypePath, delegate + { + if (reward.RewardDetailId == _crossoverRewardInfo.RewardDetailId) + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + } + }); + RankInfo rankInfo = Data.Load.data.GetRankInfo(Format.Crossover, reward.Rank); + labelAchievementTitle.text = Data.SystemText.Get("Profile_0042", Data.SystemText.Get(rankInfo.rank_name)); + labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)reward.RewardType, reward.RewardDetailId, reward.RewardCount); + GaugeUI.gameObject.SetActive(value: false); + UIButton component = goButtonReward.GetComponent(); + component.GetComponentInChildren().text = Data.SystemText.Get("Mail_0023"); + goButtonReward.gameObject.SetActive(type != AchievementType.PointReceived); + UIManager.SetObjectToGrey(goButtonReward, type != AchievementType.PointClear); + component.onClick.Clear(); + component.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + ReceiveCrossoverReward(reward.RewardId, onReceiveReward); + })); + CopyAnchor(_labelTopRight.rightAnchor, labelAchievementTitle.rightAnchor); + } + + private void ReceiveCrossoverReward(int rewardId, Action onReceiveReward) + { + CrossoverReceiveRankRewardTask task = new CrossoverReceiveRankRewardTask(); + task.SetParameter(rewardId); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + onReceiveReward.Call(); + DialogCreator.CreateRewardReceiveDialog(task.ReceivedRewardList); + })); + } + + public void SetQuestPoint(QuestRewardInfo reward, AchievementType type, ResourceHandler resourceHandler, Action onRequestRewardPointCallBack) + { + _questRewardInfo = reward; + strAchievementData = reward.Point.ToString(); + labelAchievementTitle.text = Data.SystemText.Get("Quest_0019", strAchievementData); + _resourceHandler = resourceHandler; + SetType(type); + string texName = UserGoods.GetUserGoodsImageName((UserGoods.Type)reward.RewardType, reward.RewardDetailId); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Item); + _resourceHandler.Add(assetTypePath, delegate + { + if (reward.RewardDetailId == _questRewardInfo.RewardDetailId) + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + } + }); + labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)reward.RewardType, reward.RewardDetailId, reward.RewardCount); + GaugeUI.gameObject.SetActive(value: false); + UIButton component = goButtonReward.GetComponent(); + component.GetComponentInChildren().text = Data.SystemText.Get("Mail_0023"); + goButtonReward.gameObject.SetActive(type != AchievementType.PointReceived); + UIManager.SetObjectToGrey(goButtonReward, type != AchievementType.PointClear); + component.onClick.Clear(); + component.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + OnQuestPointReceive(reward.Id, onRequestRewardPointCallBack); + })); + GetComponent().spriteName = string.Empty; + CopyAnchor(_labelTopRight.rightAnchor, labelAchievementTitle.rightAnchor); + } + + public void SetMission(UserMission mission, ResourceHandler resourceHandler, bool canChangeMissions, bool enableSeparator, bool displayChange, Action onChangeMissionSuccess = null) + { + _resourceHandler = resourceHandler; + _Separator.gameObject.SetActive(enableSeparator); + if (mission.mission_status == 0 && SetMissionWait(mission)) + { + return; + } + SystemText systemText = Data.SystemText; + if (mission.reward_type == 4) + { + ReceiveReward.SetTicket(mission.RewardUserGoodsId, mission.reward_number, achievementIconTexture, labelAchievementData, _resourceHandler); + } + else + { + ReceiveReward.SetTexture((UserGoods.Type)mission.reward_type, mission.RewardUserGoodsId, achievementIconTexture, _resourceHandler); + labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)mission.reward_type, mission.RewardUserGoodsId, mission.reward_number); + } + labelAchievementTitle.text = mission.mission_name; + int require_number = mission.require_number; + bool flag = require_number > 0; + GaugeUI.gameObject.SetActive(flag); + if (flag) + { + int num = ((mission.total_count > mission.require_number) ? mission.require_number : mission.total_count); + GaugeLabel.text = num + "/" + require_number; + if (num != 0) + { + float value = (float)num / (float)require_number; + GaugeUI.Value = value; + } + else + { + GaugeUI.Value = 0f; + } + } + UIButton component = goButtonReward.GetComponent(); + component.normalSprite = "btn_common_02_s_off"; + component.pressedSprite = "btn_common_02_s_on"; + component.GetComponentInChildren().text = systemText.Get("Mission_0029"); + component.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + ChangeMission(mission.id, mission.mission_name, onChangeMissionSuccess); + })); + goButtonReward.SetActive(displayChange && !mission.default_flag); + UIManager.SetObjectToGrey(goButtonReward, !canChangeMissions); + labelAchievementCount.gameObject.SetActive(value: false); + SetMissionPeriodLabel(mission); + CopyAnchor(_labelTopRight.rightAnchor, labelAchievementTitle.rightAnchor); + } + + public void SetBttlePassMonthlyMission(BattlePassMonthlyMission.MissionDetail mission, ResourceHandler resourceHandler) + { + _Separator.gameObject.SetActive(value: false); + _labelMissionPeriod.gameObject.SetActive(value: false); + labelAchievementCount.gameObject.SetActive(value: false); + goButtonReward.gameObject.SetActive(value: false); + _resourceHandler = resourceHandler; + labelAchievementTitle.text = mission.Name; + alreadyReceived.gameObject.SetActive(mission.IsCleared); + BattlePassMonthlyMission.MissionDetail.RewardInfo reward = mission.Reward; + if (reward == null) + { + _resourceHandler.Add(Toolbox.ResourcesManager.GetAssetTypePath("thumbnail_battle_pass_point", ResourcesManager.AssetLoadPathType.BattlePass), delegate + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("thumbnail_battle_pass_point", ResourcesManager.AssetLoadPathType.BattlePass, isfetch: true); + achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath); + }); + labelAchievementData.text = string.Empty; + } + else if (reward.UserGoods.GoodsType == UserGoods.Type.Item) + { + ReceiveReward.SetTicket(reward.UserGoods.Id, reward.Number, achievementIconTexture, labelAchievementData, _resourceHandler); + } + else + { + ReceiveReward.SetTexture(reward.UserGoods.GoodsType, achievementIconTexture, _resourceHandler); + labelAchievementData.text = ReceiveReward.getTitle(reward.UserGoods.GoodsType, reward.UserGoods.Id, reward.Number); + } + SetViewBattlePassPointText(mission.BattlePassPoint); + int requireNumber = mission.RequireNumber; + bool flag = requireNumber > 0; + GaugeUI.gameObject.SetActive(flag); + if (flag) + { + int num = ((mission.DoneNumber > mission.RequireNumber) ? mission.RequireNumber : mission.DoneNumber); + GaugeLabel.text = num + "/" + requireNumber; + if (num != 0) + { + float value = (float)num / (float)requireNumber; + GaugeUI.Value = value; + } + else + { + GaugeUI.Value = 0f; + } + } + } + + private void SetViewBattlePassPointText(int point) + { + string text = " "; + if (labelAchievementData.text == string.Empty) + { + labelAchievementData.text = Data.SystemText.Get("BattlePass_0010", point.ToString()); + } + else + { + UILabel uILabel = labelAchievementData; + uILabel.text = uILabel.text + text + Data.SystemText.Get("BattlePass_0010", point.ToString()); + } + } + + private bool SetMissionWait(UserMission mission) + { + MissionInfoTask missionInfoTask = GameMgr.GetIns().GetMissionInfoTask(); + long num = (long)Time.realtimeSinceStartup - missionInfoTask.RequestTime; + long num2 = missionInfoTask.ServerTime + num; + TimeSpan timeSpan = TimeSpan.FromSeconds(mission.start_time - num2).Add(new TimeSpan(0, 1, 0)); + int num3 = timeSpan.Hours; + int num4 = timeSpan.Minutes; + if (timeSpan.TotalHours >= 24.0) + { + num3 = 24; + num4 = 0; + } + else if (num3 <= 0 && num4 <= 0) + { + return false; + } + if (mission.IsGemMission()) + { + _missionWaitLabel.text = Data.SystemText.Get("Mission_0073", num3.ToString("00"), num4.ToString("00")); + _labelMissionNotice.gameObject.SetActive(value: true); + _labelMissionNotice.text = Data.SystemText.Get("Mission_0074"); + } + else + { + _missionWaitLabel.text = Data.SystemText.Get("Mission_0041", num3.ToString("00"), num4.ToString("00")); + } + labelAchievementTitle.gameObject.SetActive(value: false); + labelAchievementCount.gameObject.SetActive(value: false); + labelAchievementData.gameObject.SetActive(value: false); + labelAchievementData.gameObject.SetActive(value: false); + goButtonReward.gameObject.SetActive(value: false); + GaugeUI.gameObject.SetActive(value: false); + _titleLine.gameObject.SetActive(value: false); + _missionWaitLabel.gameObject.SetActive(value: true); + return true; + } + + private void SetMissionPeriodLabel(UserMission mission) + { + if (mission.end_time <= 0 || mission.IsGemMission()) + { + _labelMissionPeriod.gameObject.SetActive(value: false); + return; + } + long nowUnixTime = GameMgr.GetIns().GetMissionInfoTask().NowUnixTime(); + string remainingTime = ConvertTime.GetRemainingTime(TimeSpan.FromSeconds(mission.GetMissionPeriodSec(nowUnixTime))); + goButtonReward.gameObject.SetActive(value: false); + _labelMissionPeriod.gameObject.SetActive(value: true); + _labelMissionPeriod.text = remainingTime; + } + + private void ChangeMission(int id, string content, Action onChangeMissionSuccess) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Mission_0033")); + dialogBase.SetText(systemText.Get("Mission_0030", content)); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn); + dialogBase.onPushButton1 = delegate + { + MissionRetireTask missionRetireTask = new MissionRetireTask(); + missionRetireTask.SetParameter(id); + StartCoroutine(Toolbox.NetworkManager.Connect(missionRetireTask, delegate + { + onChangeMissionSuccess.Call(); + }, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + }; + } + + private void OnQuestPointReceive(int rewardId, Action onRequestRewardPointCallBack) + { + QuestRewardReceiveTask task = new QuestRewardReceiveTask(); + task.SetParameter(rewardId); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + onRequestRewardPointCallBack.Call(); + DialogCreator.CreateRewardReceiveDialog(task.ReceiveRewardList); + }, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + public void SetHistoryItem(ItemAcquireHistory item, bool enableSeparator, ResourceHandler resourceHandler) + { + _resourceHandler = resourceHandler; + SystemText systemText = Data.SystemText; + if (item.RewardType == 4) + { + ReceiveReward.SetTicket(item.RewardUserGoodsId, item.RewardCount, achievementIconTexture, labelAchievementTitle, _resourceHandler); + } + else + { + ReceiveReward.SetTexture((UserGoods.Type)item.RewardType, achievementIconTexture, _resourceHandler); + labelAchievementTitle.text = ReceiveReward.getTitle((UserGoods.Type)item.RewardType, item.RewardUserGoodsId, item.RewardCount); + } + labelAchievementData.text = item.Message; + labelAchievementCount.text = systemText.Get("Mail_0043", ConvertTime.ToLocal(item.AcquireTime)); + GaugeUI.gameObject.SetActive(value: false); + goButtonReward.SetActive(value: false); + _Separator.gameObject.SetActive(enableSeparator); + } + + public void SetMail(MailData mail, Action OnReadMail, ResourceHandler handler) + { + _resourceHandler = handler; + _viewMailId = mail.mail_id; + SetCommonMail(mail); + TimeLeftUpdate timeLeftUpdate = base.gameObject.AddMissingComponent(); + timeLeftUpdate.mailData = mail; + _labelTopRight.gameObject.SetActive(value: true); + timeLeftUpdate.timeLeft = _labelTopRight; + timeLeftUpdate.UpdateTime(); + SystemText systemText = Data.SystemText; + labelAchievementCount.text = systemText.Get("Mail_0043", mail.create_time); + goButtonReward.SetActive(value: true); + goButtonReward.transform.Find("RewardLabel").GetComponent().text = systemText.Get("Mail_0023"); + UIButton component = goButtonReward.GetComponent(); + component.normalSprite = "btn_common_02_s_off"; + component.hoverSprite = "btn_common_02_s_off"; + component.pressedSprite = "btn_common_02_s_on"; + UIEventListener.Get(goButtonReward).onClick = delegate + { + OnReadMail(mail.mail_id, mail.mail_id); + }; + } + + public void SetHistoryMail(MailData mail, ResourceHandler handler) + { + _resourceHandler = handler; + _viewMailId = mail.mail_id; + SetCommonMail(mail); + TimeLeftUpdate component = base.gameObject.GetComponent(); + if ((bool)component) + { + component.mailData = null; + } + _labelTopRight.gameObject.SetActive(value: false); + labelAchievementCount.text = Data.SystemText.Get("Mail_0044", mail.create_time); + goButtonReward.SetActive(value: false); + } + + private void SetCommonMail(MailData mailData) + { + GaugeUI.gameObject.SetActive(value: false); + labelAchievementData.text = mailData.message; + labelAchievementTitle.text = ReceiveReward.getTitle(mailData); + string textureName = ReceiveReward.GetThumbnailName((UserGoods.Type)mailData.reward_type, mailData.RewardUserGoodsId); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item); + _resourceHandler.Add(assetTypePath, delegate + { + if (mailData.mail_id == _viewMailId) + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + } + }); + } + + private void CopyAnchor(UIRect.AnchorPoint original, UIRect.AnchorPoint destination) + { + destination.target = original.target; + destination.relative = original.relative; + destination.absolute = original.absolute; + } + + public void SetGetButtonToGreyOut() + { + UIManager.SetObjectToGrey(goButtonReward, b: true); + } + + public void SetLottery(LotteryMissionData lotteryData, bool needCeparator) + { + string userGoodsImageName = UserGoods.GetUserGoodsImageName(lotteryData.UserGoodsType, lotteryData.ItemId); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(userGoodsImageName, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + base.gameObject.GetComponent().width = 800; + achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath); + _Separator.gameObject.SetActive(needCeparator); + labelAchievementTitle.text = lotteryData.MissionTitle; + if (lotteryData.UserGoodsType == UserGoods.Type.Item) + { + labelAchievementData.text = ReceiveReward.SetTicketTitle(lotteryData.ItemId, lotteryData.ItemCount); + } + else + { + labelAchievementData.text = ReceiveReward.getTitle(lotteryData.UserGoodsType, lotteryData.ItemId, lotteryData.ItemCount); + } + goButtonReward.SetActive(value: false); + if (lotteryData.StartTime.Second > 0) + { + _missionStartTime.text = Data.SystemText.Get("Mission_0077", lotteryData.StartTime.LocalTime); + _missionStartTime.gameObject.SetActive(value: true); + } + else + { + _labelMissionPeriod.text = lotteryData.EndTime.GetShowText("Mission_0062", "Mission_0060", "Mission_0061"); + _labelMissionPeriod.gameObject.SetActive(value: true); + } + CopyAnchor(_labelTopRight.rightAnchor, labelAchievementTitle.rightAnchor); + _applyFinish.gameObject.SetActive(lotteryData.IsCleared); + _labelMissionPeriod.gameObject.SetActive(!lotteryData.IsCleared && !lotteryData.IsTimeOver); + _missionTimeOver.gameObject.SetActive(lotteryData.IsTimeOver); + GaugeLabel.text = lotteryData.MissionCurrent + "/" + lotteryData.MissionMax; + GaugeUI.Value = lotteryData.MissionRatio; + bool active = true; + if (lotteryData.IsCleared || lotteryData.MissionMax == 0) + { + active = false; + } + GaugeUI.gameObject.SetActive(active); + } + + public void SetBingoMission(BingoInfoTask.BingoMissionData missionData, bool needCeparator, ResourceHandler handler) + { + _resourceHandler = handler; + base.gameObject.GetComponent().width = 752; + base.gameObject.GetComponent().enabled = false; + alreadyReceived.gameObject.SetActive(missionData.IsCleared); + labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)missionData.Reward.reward_type, missionData.Reward.rewardUserGoodsId, missionData.Reward.reward_count); + string textureName = UserGoods.GetUserGoodsImageName((UserGoods.Type)missionData.Reward.reward_type, missionData.Reward.rewardUserGoodsId); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item); + _resourceHandler.Add(assetTypePath, delegate + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + }); + CopyAnchor(_labelTopRight.rightAnchor, labelAchievementTitle.rightAnchor); + _titleLine.SetAnchor((GameObject)null); + _titleLine.spriteName = "quest_line_05"; + _titleLine.SetDimensions(610, 2); + _Separator.spriteName = "quest_line_02"; + _Separator.gameObject.SetActive(needCeparator); + goButtonReward.SetActive(value: false); + GaugeLabel.text = missionData.MissionCurrent + "/" + missionData.MissionMax; + GaugeUI.Value = missionData.MissionRatio; + labelAchievementTitle.text = missionData.MissionTitle; + } + + public void SetBingoRewardDetails(ReceivedReward reward, bool needCeparator, ResourceHandler handler) + { + _resourceHandler = handler; + base.gameObject.GetComponent().width = 752; + base.gameObject.GetComponent().enabled = false; + goButtonReward.SetActive(value: false); + _titleLine.SetAnchor((GameObject)null); + _titleLine.spriteName = "quest_line_05"; + _titleLine.SetDimensions(610, 2); + _Separator.spriteName = "quest_line_02"; + _Separator.gameObject.SetActive(needCeparator); + labelAchievementTitle.text = string.Format(Data.SystemText.Get("Bingo_0004", reward.lineNum.ToString())); + labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)reward.reward_type, reward.rewardUserGoodsId, reward.reward_count); + GaugeUI.gameObject.SetActive(value: false); + string textureName = UserGoods.GetUserGoodsImageName((UserGoods.Type)reward.reward_type, reward.rewardUserGoodsId); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item); + _resourceHandler.Add(assetTypePath, delegate + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + }); + } + + public void SetBingoSideBarRewards(string lineNum, ReceivedReward reward, bool isCleared, bool needCeparator, ResourceHandler handler) + { + _resourceHandler = handler; + _Separator.gameObject.SetActive(needCeparator); + goButtonReward.SetActive(value: false); + labelAchievementTitle.text = string.Format(Data.SystemText.Get("Bingo_0004", lineNum)); + labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)reward.reward_type, reward.rewardUserGoodsId, reward.reward_count); + alreadyReceived.gameObject.SetActive(isCleared); + string textureName = UserGoods.GetUserGoodsImageName((UserGoods.Type)reward.reward_type, reward.rewardUserGoodsId); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item); + _resourceHandler.Add(assetTypePath, delegate + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + }); + } + + public void SetPracticePuzzleMission(PracticePuzzleMissionData mission, ResourceHandler resourceHandler, bool canChangeMissions, bool enableSeparator, bool displayChange, Action onChangeMissionSuccess = null) + { + _resourceHandler = resourceHandler; + _Separator.gameObject.SetActive(enableSeparator); + goButtonReward.SetActive(value: false); + _ = Data.SystemText; + if (mission.UserGoodsType == UserGoods.Type.Item) + { + ReceiveReward.SetTicket(mission.ItemId, mission.ItemCount, achievementIconTexture, labelAchievementData, _resourceHandler); + } + else + { + ReceiveReward.SetTexture(mission.UserGoodsType, mission.ItemId, achievementIconTexture, _resourceHandler); + labelAchievementData.text = ReceiveReward.getTitle(mission.UserGoodsType, mission.ItemId, mission.ItemCount); + } + labelAchievementTitle.text = mission.Name; + int totalMissionCount = mission.TotalMissionCount; + bool flag = totalMissionCount > 0; + GaugeUI.gameObject.SetActive(flag); + if (flag) + { + int num = ((mission.TotalMissionCount > mission.CurrentClearCount) ? mission.CurrentClearCount : mission.TotalMissionCount); + GaugeLabel.text = num + "/" + totalMissionCount; + if (num != 0) + { + float value = (float)num / (float)totalMissionCount; + GaugeUI.Value = value; + } + else + { + GaugeUI.Value = 0f; + } + } + alreadyReceived.gameObject.SetActive(mission.IsCleared); + labelAchievementCount.gameObject.SetActive(value: false); + CopyAnchor(_labelTopRight.rightAnchor, labelAchievementTitle.rightAnchor); + } + + public void SetRedEtherMission(RedEtherCampaignRewardData rewardData, ResourceHandler resourceHandler) + { + _resourceHandler = resourceHandler; + goButtonReward.SetActive(value: false); + ReceiveReward.SetTexture(rewardData.UserGoodsType, 0L, achievementIconTexture, _resourceHandler); + labelAchievementData.text = ReceiveReward.getTitle(rewardData.UserGoodsType, 0L, rewardData.ItemCount); + labelAchievementTitle.text = rewardData.MissionText; + alreadyReceived.gameObject.SetActive(rewardData.IsCleared); + GaugeUI.gameObject.SetActive(value: false); + } +} diff --git a/SVSim.BattleEngine/Engine/ActiveAnimation.cs b/SVSim.BattleEngine/Engine/ActiveAnimation.cs new file mode 100644 index 0000000..59f470d --- /dev/null +++ b/SVSim.BattleEngine/Engine/ActiveAnimation.cs @@ -0,0 +1,356 @@ +using System.Collections.Generic; +using AnimationOrTween; +using UnityEngine; + +[AddComponentMenu("NGUI/Internal/Active Animation")] +public class ActiveAnimation : MonoBehaviour +{ + public static ActiveAnimation current; + + public List onFinished = new List(); + + [HideInInspector] + public GameObject eventReceiver; + + [HideInInspector] + public string callWhenFinished; + + private Animation mAnim; + + private Direction mLastDirection; + + private Direction mDisableDirection; + + private bool mNotify; + + private Animator mAnimator; + + private string mClip = ""; + + private float playbackTime => Mathf.Clamp01(mAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime); + + public bool isPlaying + { + get + { + if (mAnim == null) + { + if (mAnimator != null) + { + if (mLastDirection == Direction.Reverse) + { + if (playbackTime == 0f) + { + return false; + } + } + else if (playbackTime == 1f) + { + return false; + } + return true; + } + return false; + } + foreach (AnimationState item in mAnim) + { + if (!mAnim.IsPlaying(item.name)) + { + continue; + } + if (mLastDirection == Direction.Forward) + { + if (item.time < item.length) + { + return true; + } + continue; + } + if (mLastDirection == Direction.Reverse) + { + if (item.time > 0f) + { + return true; + } + continue; + } + return true; + } + return false; + } + } + + public void Finish() + { + if (mAnim != null) + { + foreach (AnimationState item in mAnim) + { + if (mLastDirection == Direction.Forward) + { + item.time = item.length; + } + else if (mLastDirection == Direction.Reverse) + { + item.time = 0f; + } + } + mAnim.Sample(); + } + else if (mAnimator != null) + { + mAnimator.Play(mClip, 0, (mLastDirection == Direction.Forward) ? 1f : 0f); + } + } + + public void Reset() + { + if (mAnim != null) + { + foreach (AnimationState item in mAnim) + { + if (mLastDirection == Direction.Reverse) + { + item.time = item.length; + } + else if (mLastDirection == Direction.Forward) + { + item.time = 0f; + } + } + return; + } + if (mAnimator != null) + { + mAnimator.Play(mClip, 0, (mLastDirection == Direction.Reverse) ? 1f : 0f); + } + } + + private void Start() + { + if (eventReceiver != null && EventDelegate.IsValid(onFinished)) + { + eventReceiver = null; + callWhenFinished = null; + } + } + + private void Update() + { + float deltaTime = RealTime.deltaTime; + if (deltaTime == 0f) + { + return; + } + if (mAnimator != null) + { + mAnimator.Update((mLastDirection == Direction.Reverse) ? (0f - deltaTime) : deltaTime); + if (isPlaying) + { + return; + } + mAnimator.enabled = false; + base.enabled = false; + } + else + { + if (!(mAnim != null)) + { + base.enabled = false; + return; + } + bool flag = false; + foreach (AnimationState item in mAnim) + { + if (!mAnim.IsPlaying(item.name)) + { + continue; + } + float num = item.speed * deltaTime; + item.time += num; + if (num < 0f) + { + if (item.time > 0f) + { + flag = true; + } + else + { + item.time = 0f; + } + } + else if (item.time < item.length) + { + flag = true; + } + else + { + item.time = item.length; + } + } + mAnim.Sample(); + if (flag) + { + return; + } + base.enabled = false; + } + if (!mNotify) + { + return; + } + mNotify = false; + if (current == null) + { + current = this; + EventDelegate.Execute(onFinished); + if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished)) + { + eventReceiver.SendMessage(callWhenFinished, SendMessageOptions.DontRequireReceiver); + } + current = null; + } + if (mDisableDirection != Direction.Toggle && mLastDirection == mDisableDirection) + { + NGUITools.SetActive(base.gameObject, state: false); + } + } + + private void Play(string clipName, Direction playDirection) + { + if (playDirection == Direction.Toggle) + { + playDirection = ((mLastDirection != Direction.Forward) ? Direction.Forward : Direction.Reverse); + } + if (mAnim != null) + { + base.enabled = true; + mAnim.enabled = false; + if (string.IsNullOrEmpty(clipName)) + { + if (!mAnim.isPlaying) + { + mAnim.Play(); + } + } + else if (!mAnim.IsPlaying(clipName)) + { + mAnim.Play(clipName); + } + foreach (AnimationState item in mAnim) + { + if (string.IsNullOrEmpty(clipName) || item.name == clipName) + { + float num = Mathf.Abs(item.speed); + item.speed = num * (float)playDirection; + if (playDirection == Direction.Reverse && item.time == 0f) + { + item.time = item.length; + } + else if (playDirection == Direction.Forward && item.time == item.length) + { + item.time = 0f; + } + } + } + mLastDirection = playDirection; + mNotify = true; + mAnim.Sample(); + } + else if (mAnimator != null) + { + if (base.enabled && isPlaying && mClip == clipName) + { + mLastDirection = playDirection; + return; + } + base.enabled = true; + mNotify = true; + mLastDirection = playDirection; + mClip = clipName; + mAnimator.Play(mClip, 0, (playDirection == Direction.Forward) ? 0f : 1f); + } + } + + public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition) + { + if (!NGUITools.GetActive(anim.gameObject)) + { + if (enableBeforePlay != EnableCondition.EnableThenPlay) + { + return null; + } + NGUITools.SetActive(anim.gameObject, state: true); + UIPanel[] componentsInChildren = anim.gameObject.GetComponentsInChildren(); + int i = 0; + for (int num = componentsInChildren.Length; i < num; i++) + { + componentsInChildren[i].Refresh(); + } + } + ActiveAnimation activeAnimation = anim.GetComponent(); + if (activeAnimation == null) + { + activeAnimation = anim.gameObject.AddComponent(); + } + activeAnimation.mAnim = anim; + activeAnimation.mDisableDirection = (Direction)disableCondition; + activeAnimation.onFinished.Clear(); + activeAnimation.Play(clipName, playDirection); + if (activeAnimation.mAnim != null) + { + activeAnimation.mAnim.Sample(); + } + else if (activeAnimation.mAnimator != null) + { + activeAnimation.mAnimator.Update(0f); + } + return activeAnimation; + } + + public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection) + { + return Play(anim, clipName, playDirection, EnableCondition.DoNothing, DisableCondition.DoNotDisable); + } + + public static ActiveAnimation Play(Animation anim, Direction playDirection) + { + return Play(anim, null, playDirection, EnableCondition.DoNothing, DisableCondition.DoNotDisable); + } + + public static ActiveAnimation Play(Animator anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition) + { + if (enableBeforePlay != EnableCondition.IgnoreDisabledState && !NGUITools.GetActive(anim.gameObject)) + { + if (enableBeforePlay != EnableCondition.EnableThenPlay) + { + return null; + } + NGUITools.SetActive(anim.gameObject, state: true); + UIPanel[] componentsInChildren = anim.gameObject.GetComponentsInChildren(); + int i = 0; + for (int num = componentsInChildren.Length; i < num; i++) + { + componentsInChildren[i].Refresh(); + } + } + ActiveAnimation activeAnimation = anim.GetComponent(); + if (activeAnimation == null) + { + activeAnimation = anim.gameObject.AddComponent(); + } + activeAnimation.mAnimator = anim; + activeAnimation.mDisableDirection = (Direction)disableCondition; + activeAnimation.onFinished.Clear(); + activeAnimation.Play(clipName, playDirection); + if (activeAnimation.mAnim != null) + { + activeAnimation.mAnim.Sample(); + } + else if (activeAnimation.mAnimator != null) + { + activeAnimation.mAnimator.Update(0f); + } + return activeAnimation; + } +} diff --git a/SVSim.BattleEngine/Engine/AddDamageInfo.cs b/SVSim.BattleEngine/Engine/AddDamageInfo.cs new file mode 100644 index 0000000..435d7fb --- /dev/null +++ b/SVSim.BattleEngine/Engine/AddDamageInfo.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; + +public class AddDamageInfo : DamageModifier +{ + public int AddDamage { get; protected set; } + + public AddDamageInfo(int addDamage, string damageType, CardBasePrm.ClanType damageClan, bool isUseClass, int order) + { + AddDamage = addDamage; + base.DamageType = new List(); + base.DamageType.AddRange(damageType.Split(new string[1] { "_and_" }, StringSplitOptions.None)); + base.DamageClan = new List { damageClan }; + base.IsUseClass = isUseClass; + base.OrderCount = order; + } + + public override int Calc(int damage) + { + return damage + AddDamage; + } +} diff --git a/SVSim.BattleEngine/Engine/AlleyField.cs b/SVSim.BattleEngine/Engine/AlleyField.cs new file mode 100644 index 0000000..ac66645 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AlleyField.cs @@ -0,0 +1,77 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class AlleyField : BackGroundBase +{ + public override int FieldId => 22; + + public override int FieldEffectId => 22; + + public AlleyField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_aley_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles22").gameObject; + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_22, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_22_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _battleCamera.Camera.transform.localPosition = new Vector3(2750f, -510f, -10f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-10f, -53f, 84f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(300f, -30f, -150f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-11f, -100f, 92f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1") + { + _ = _gimicCntDictionary[obj.tag]; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/AnimationOrTween/Direction.cs b/SVSim.BattleEngine/Engine/AnimationOrTween/Direction.cs new file mode 100644 index 0000000..3fcbe42 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AnimationOrTween/Direction.cs @@ -0,0 +1,8 @@ +namespace AnimationOrTween; + +public enum Direction +{ + Reverse = -1, + Toggle, + Forward +} diff --git a/SVSim.BattleEngine/Engine/AreaSelInfo.cs b/SVSim.BattleEngine/Engine/AreaSelInfo.cs new file mode 100644 index 0000000..0f282ed --- /dev/null +++ b/SVSim.BattleEngine/Engine/AreaSelInfo.cs @@ -0,0 +1,530 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; + +public class AreaSelInfo : MonoBehaviour +{ + private enum eTableCategory + { + CARD, + SLEEVE, + OTHER, + MAX + } + + private const float LEFTSTAGEINFO_X_IN = 0f; + + private const float LEFTSTAGEINFO_X_OUT = -1120f; + + private const int CLEARPRESENT_MAX = 3; + + private static readonly Vector3 CLEARPRESENT_CARD_COLLISIONSIZE = new Vector3(175f, 230f, 1f); + + private const int CLEARPRESENT_CARD_DEPTHOFFSET = 50; + + private const int CLEARPRESENT_RESOURCELIST_CAPACITY = 2; + + private static readonly string[] CLEARPRESENT_NAME = new string[10] { "", "Common_0205", "", "Common_0201", "", "", "", "", "", "Common_0115" }; + + private static readonly string[] CLEARPRESENT_THUMBNAIL_SPRITENAME = new string[10] { "", "thumbnail_liquid", "", "thumbnail_crystal", "", "", "thumbnail_card", "thumbnail_emblem", "thumbnail_title", "thumbnail_rupy" }; + + private readonly Vector3 REWARD_TABLE_DEFAULT_POSITION = new Vector3(45f, -85.3f, 0f); + + private readonly Vector3 REWARD_TABLE_CARD_POSITION = new Vector3(28.5f, -85.3f, 0f); + + private const float TABLE_CONTAINS_CARD_REWARD_OFFSET_X = -16f; + + private const int REWARD_BG_BASIC_WIDTH = 250; + + private const int REWARD_BG_OFFSET_WIDTH_PER_GOODS = 90; + + private readonly Dictionary REWARD_BG_OFFSET_MAGNIFICATION = new Dictionary + { + { + UserGoods.Type.Degree, + 2f + }, + { + UserGoods.Type.Card, + 1.2f + }, + { + UserGoods.Type.Sleeve, + 1.2f + }, + { + UserGoods.Type.Skin, + 1.2f + }, + { + UserGoods.Type.RedEther, + 1f + }, + { + UserGoods.Type.Rupy, + 1f + }, + { + UserGoods.Type.Item, + 1f + }, + { + UserGoods.Type.Emblem, + 1f + } + }; + + private const float LABEL_ONLY_DEGREE_OFFSET_Y = -10f; + + [SerializeField] + private GameObject _clearRewardPrefab; + + private List _clearRewardList = new List(); + + [SerializeField] + private UITable _tableRoot; + + [SerializeField] + private UITable[] _tableRewardsCategory = new UITable[3]; + + [SerializeField] + private GameObject _cardObjEvacuationRoot; + + [SerializeField] + private UISprite _spriteRewardBackground; + + [SerializeField] + private UILabel _labelAcquired; + + private List _cardObjList = new List(); + + [SerializeField] + private GameObject CardDetailRoot; + + [SerializeField] + private CardDetailUI CardDetailPrefab; + + private CardDetailUI _cardDetail; + + private List _loadFileList = new List(); + + private bool _isLoadEnd = true; + + public void SetClearPresent(StoryChapterData chapterData) + { + if (chapterData == null || chapterData.Rewards == null) + { + return; + } + if (chapterData.Rewards.Length != 0) + { + base.gameObject.SetActive(value: true); + bool isCleared = chapterData.IsCleared; + for (int i = 0; i < _clearRewardList.Count; i++) + { + _clearRewardList[i].gameObject.SetActive(value: false); + } + List list = new List(); + for (int j = 0; j < chapterData.Rewards.Length; j++) + { + StoryChapterData.StoryReward storyReward = chapterData.Rewards[j]; + if (storyReward == null) + { + continue; + } + if (j >= _clearRewardList.Count) + { + break; + } + if (storyReward.RewardType == 5) + { + if (list.Contains(storyReward.RewardUserGoodsId)) + { + continue; + } + list.Add(storyReward.RewardUserGoodsId); + } + _clearRewardList[j].gameObject.SetActive(value: true); + _clearRewardList[j].ShowReward((UserGoods.Type)storyReward.RewardType, storyReward.RewardUserGoodsId, storyReward.RewardNumber, isCleared); + } + RepositionRewards(); + SetRewardBackgroundWidth(); + SetAcquiredLabel(isCleared); + } + else + { + base.gameObject.SetActive(value: false); + } + } + + private void RepositionRewards() + { + for (int i = 0; i < _tableRewardsCategory.Length; i++) + { + _tableRewardsCategory[i].gameObject.SetActive(value: false); + } + for (int j = 0; j < _clearRewardList.Count; j++) + { + if (_clearRewardList[j].gameObject.activeSelf) + { + int num = _clearRewardList[j].RewardGoodsType switch + { + UserGoods.Type.Card => 0, + UserGoods.Type.Sleeve => 1, + _ => 2, + }; + Transform obj = _clearRewardList[j].gameObject.transform; + obj.SetParent(_tableRewardsCategory[num].transform); + obj.SetAsLastSibling(); + _tableRewardsCategory[num].gameObject.SetActive(value: true); + } + } + for (int k = 0; k < _tableRewardsCategory.Length; k++) + { + if (_tableRewardsCategory[k].gameObject.activeInHierarchy) + { + _tableRewardsCategory[k].Reposition(); + } + } + _tableRoot.Reposition(); + if (_tableRewardsCategory[0].gameObject.activeInHierarchy) + { + _tableRoot.transform.localPosition = REWARD_TABLE_CARD_POSITION; + for (int l = 0; l < _tableRewardsCategory.Length; l++) + { + if (l != 0) + { + Vector3 localPosition = _tableRewardsCategory[l].transform.localPosition; + localPosition.x += -16f; + _tableRewardsCategory[l].transform.localPosition = localPosition; + } + } + } + else + { + _tableRoot.transform.localPosition = REWARD_TABLE_DEFAULT_POSITION; + } + } + + private void SetRewardBackgroundWidth() + { + float num = 0f; + for (int i = 0; i < _clearRewardList.Count; i++) + { + if (_clearRewardList[i].gameObject.activeInHierarchy) + { + UserGoods.Type rewardGoodsType = _clearRewardList[i].RewardGoodsType; + num += REWARD_BG_OFFSET_MAGNIFICATION[rewardGoodsType]; + } + } + int width = 250 + (int)(90f * num); + _spriteRewardBackground.width = width; + } + + private void SetAcquiredLabel(bool isAcquired) + { + _labelAcquired.gameObject.SetActive(isAcquired); + if (!isAcquired) + { + return; + } + float a = float.MaxValue; + float num = float.MinValue; + bool flag = true; + for (int i = 0; i < _clearRewardList.Count; i++) + { + if (_clearRewardList[i].gameObject.activeInHierarchy) + { + Transform rewardTransform = _clearRewardList[i].GetRewardTransform(); + a = Mathf.Min(a, rewardTransform.position.x); + num = Mathf.Max(num, rewardTransform.position.x); + if (_clearRewardList[i].RewardGoodsType != UserGoods.Type.Degree) + { + flag = false; + } + } + } + Vector3 position = _labelAcquired.transform.position; + position.x = Mathf.Lerp(a, num, 0.5f); + _labelAcquired.transform.position = position; + Vector3 localPosition = _labelAcquired.transform.localPosition; + localPosition.y = _tableRoot.transform.localPosition.y + (flag ? (-10f) : 0f); + _labelAcquired.transform.localPosition = localPosition; + } + + public void LoadClearPresent(IReadOnlyList stageDataList) + { + if (!_isLoadEnd) + { + return; + } + _isLoadEnd = false; + ReleaseClearPresent(); + if (CardDetailPrefab != null) + { + _cardDetail = Object.Instantiate(CardDetailPrefab); + _cardDetail.transform.parent = CardDetailRoot.transform; + _cardDetail.transform.localPosition = Vector3.zero; + _cardDetail.transform.localScale = Vector3.one; + _cardDetail.OnClose = OnCardDetailClose; + _cardDetail.gameObject.SetActive(value: false); + _cardDetail.Initialize(_cardDetail.gameObject.layer, CardMaster.CardMasterId.Default); + _cardDetail.IsShowFlavorTextButton = true; + _cardDetail.IsShowVoiceButton = true; + _cardDetail.IsShowEvolutionButton = true; + } + _clearRewardList.Clear(); + for (int i = 0; i < 3; i++) + { + AreaSelectClearReward component = NGUITools.AddChild(_tableRoot.gameObject, _clearRewardPrefab).GetComponent(); + _clearRewardList.Add(component); + } + List list = new List(2); + List loadPath = new List(); + StoryChapterData.StoryReward storyReward = null; + for (int j = 0; j < stageDataList.Count; j++) + { + for (int k = 0; k < stageDataList[j].Rewards.Length; k++) + { + string text = string.Empty; + storyReward = stageDataList[j].Rewards[k]; + if (storyReward == null) + { + continue; + } + if (storyReward.RewardType == 5) + { + if (!list.Contains((int)storyReward.RewardUserGoodsId)) + { + list.Add((int)storyReward.RewardUserGoodsId); + } + } + else if (storyReward.RewardType == 4) + { + string userGoodsImageName = UserGoods.GetUserGoodsImageName(UserGoods.Type.Item, storyReward.RewardUserGoodsId); + text = Toolbox.ResourcesManager.GetAssetTypePath(userGoodsImageName, ResourcesManager.AssetLoadPathType.Item); + } + else if (storyReward.RewardType == 6) + { + long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(storyReward.RewardUserGoodsId); + text = Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture); + Sleeve sleeve = Data.Master.SleeveMgr.Get(existingSleeveId); + if (sleeve.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref loadPath, sleeve); + } + } + else if (storyReward.RewardType == 8) + { + foreach (string degreeResource in DegreeHelper.GetDegreeResourceList(storyReward.RewardUserGoodsId, DegreeHelper.DegreeType.SMALL, isFetch: false)) + { + if (!loadPath.Contains(degreeResource)) + { + loadPath.Add(degreeResource); + } + } + } + else if (storyReward.RewardType == 7) + { + text = Toolbox.ResourcesManager.GetAssetTypePath(storyReward.RewardUserGoodsId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M); + } + else if (storyReward.RewardType == 10) + { + text = Toolbox.ResourcesManager.GetAssetTypePath(storyReward.RewardUserGoodsId.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail); + } + if (text != string.Empty && !loadPath.Contains(text)) + { + loadPath.Add(text); + } + } + } + if (list.Count == 0 && loadPath.Count == 0) + { + _isLoadEnd = true; + } + else + { + StartCoroutine(LoadClearPresentInner(list, loadPath)); + } + } + + private IEnumerator LoadClearPresentInner(List cardidlist, List rewardPathList) + { + UIManager uiMgr = UIManager.GetInstance(); + UIBase_CardManager uiCardMgr = uiMgr.getUIBase_CardManager(); + bool isLoadRewardEnd = false; + _loadFileList.Clear(); + bool isLoadCard = cardidlist.Count > 0; + if (isLoadCard) + { + int layer = LayerMask.NameToLayer("FrontUI"); + uiMgr.CardLoadSelect(base.gameObject, cardidlist, layer, is2D: true); + } + StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(rewardPathList, delegate + { + _loadFileList.AddRange(rewardPathList); + isLoadRewardEnd = true; + })); + while ((isLoadCard && (!uiCardMgr.getCreateEndFlag() || !uiCardMgr.isAssetAllReady)) || !isLoadRewardEnd) + { + yield return null; + } + _cardObjList = uiMgr.getCardList2DObjs(); + if (_cardObjList != null) + { + for (int num = 0; num < _cardObjList.Count; num++) + { + GameObject cardObj = _cardObjList[num].CardObj; + if (!(cardObj == null)) + { + cardObj.SetActive(value: false); + UITexture[] componentsInChildren = cardObj.GetComponentsInChildren(includeInactive: true); + for (int num2 = 0; num2 < componentsInChildren.Length; num2++) + { + componentsInChildren[num2].depth += 50; + } + UILabel[] componentsInChildren2 = cardObj.GetComponentsInChildren(includeInactive: true); + for (int num3 = 0; num3 < componentsInChildren2.Length; num3++) + { + componentsInChildren2[num3].depth += 50; + } + UISprite[] componentsInChildren3 = cardObj.GetComponentsInChildren(includeInactive: true); + for (int num4 = 0; num4 < componentsInChildren3.Length; num4++) + { + componentsInChildren3[num4].depth += 50; + } + cardObj.GetComponent().HideNum(); + cardObj.AddComponent().size = CLEARPRESENT_CARD_COLLISIONSIZE; + cardObj.AddComponent().onClick = _cardDetail.OnPushCardDetailOn; + } + } + } + for (int num5 = 0; num5 < 3; num5++) + { + _clearRewardList[num5].Init(_cardObjList, _cardObjEvacuationRoot); + } + _isLoadEnd = true; + } + + public void ReleaseClearPresent() + { + if (_cardDetail != null) + { + Object.Destroy(_cardDetail.gameObject); + _cardDetail = null; + } + if (_cardObjList != null) + { + for (int i = 0; i < _cardObjList.Count; i++) + { + Object.Destroy(_cardObjList[i].CardObj.gameObject); + } + _cardObjList.Clear(); + } + Toolbox.ResourcesManager.RemoveAssetGroup(_loadFileList); + _loadFileList.Clear(); + } + + private void OnCardDetailClose() + { + } + + public bool GetLoadEnd() + { + return _isLoadEnd; + } + + public void ResetInfoPosition() + { + base.gameObject.transform.localPosition = new Vector3(0f, base.gameObject.transform.localPosition.y, base.gameObject.transform.localPosition.z); + } + + public void MoveToScreen(bool isIn, bool isImmediate) + { + MoveToScreenObj(base.gameObject, isIn ? 0f : (-1120f), isImmediate ? 0f : 0.5f); + } + + public void MoveToScreenObj(GameObject target, float localPosX, float time) + { + if (Mathf.Approximately(time, 0f)) + { + Vector3 localPosition = target.transform.localPosition; + localPosition.x = localPosX; + target.transform.localPosition = localPosition; + return; + } + iTween.MoveTo(target, iTween.Hash("islocal", true, "x", localPosX, "time", time)); + } + + public static string GetPresentItemName(int itemID, long userGoodsId) + { + switch ((UserGoods.Type)itemID) + { + case UserGoods.Type.RedEther: + case UserGoods.Type.Rupy: + return Data.SystemText.Get(CLEARPRESENT_NAME[itemID]); + case UserGoods.Type.Item: + { + Item item = Data.Master.ItemList.Find((Item data) => data.UserGoodsId == userGoodsId); + if (item == null) + { + return string.Empty; + } + return item.name; + } + case UserGoods.Type.Sleeve: + { + Sleeve sleeve = Data.Master.SleeveMgr.Get(userGoodsId); + if (sleeve == null) + { + return string.Empty; + } + return sleeve.sleeve_name; + } + case UserGoods.Type.Emblem: + { + Emblem emblem = Data.Master.EmblemMgr.Get(userGoodsId); + if (emblem == null) + { + return string.Empty; + } + return emblem._name; + } + case UserGoods.Type.Degree: + { + Degree degree = Data.Master.DegreeMgr.Get((int)userGoodsId); + if (degree == null) + { + return string.Empty; + } + return degree._name; + } + case UserGoods.Type.Skin: + { + ClassCharacterMasterData charaPrmByCharaId = GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId((int)userGoodsId); + if (charaPrmByCharaId == null) + { + return string.Empty; + } + return charaPrmByCharaId.chara_name; + } + case UserGoods.Type.SpotCardPoint: + return Data.SystemText.Get("Common_0161"); + case UserGoods.Type.MyPageBG: + return Data.Master.MyPageCustomBGMaster[userGoodsId.ToString()].Name; + default: + return string.Empty; + } + } + + public static string GetPresentItemSpriteName(int itemID) + { + if (itemID < 0 || itemID >= CLEARPRESENT_THUMBNAIL_SPRITENAME.Length) + { + return string.Empty; + } + return CLEARPRESENT_THUMBNAIL_SPRITENAME[itemID]; + } +} diff --git a/SVSim.BattleEngine/Engine/ArenaColosseum.cs b/SVSim.BattleEngine/Engine/ArenaColosseum.cs new file mode 100644 index 0000000..7baf369 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ArenaColosseum.cs @@ -0,0 +1,346 @@ +using System.Collections.Generic; +using UnityEngine; +using Wizard; +using Wizard.Scripts.Network.Data.TableData.Arena.TwoPick; +using Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick; + +public class ArenaColosseum : ArenaEntryDataBase +{ + public enum eRound + { + FinalNotAdvance = -1, + Round1 = 1, + Round2B = 2, + Round2A = 3, + FinalB = 4, + FinalA = 5, + FinalMin = 4, + RoundMax = 5, + Undecided = 6, + Lose = 7 + } + + public enum eStageNo + { + Stage1 = 1, + Stage2, + FinalStage, + Max + } + + public enum eEntryStatus + { + TwoPickClassSelect = 1, + TwoPickCardSelect, + SetUpComplete + } + + public enum eRule + { + NONE = 0, + RotationBo1 = 1, + UnlimitedBo1 = 2, + TwoPick = 3, + TwoPickChaos = 4, + Crossover = 5, + MyRotation = 6, + HOF = 31, + WindFall = 33, + Avatar = 39 + } + + public enum eDeckIndex + { + Main = 0, + First = 0, + Second = 1, + Third = 2 + } + + public struct Detail + { + public string RoundTimeText { get; set; } + + public string RoundTimeStartText { get; set; } + + public string RoundTimeEndText { get; set; } + + public string GroupName { get; set; } + + public int MaxBattleNum { get; set; } + + public int BreakThroughNum { get; set; } + + public int MaxEntryNum { get; set; } + } + + public class TwoPick + { + public CandidateClass CandidateClass { get; set; } + + public CandidateCardInfo CandidateCard { get; set; } + + public Deck DeckData { get; set; } + + public CandidateChaos CandidateChaos { get; set; } + } + + public enum eResultEffect + { + None, + GroupA, + Final, + Clear + } + + private bool _isRankMatching; + + public bool CanUseNonPossessionCard; + + public int DeckEntryId { get; set; } + + public bool IsColosseumPeriod { get; set; } + + public bool IsRoundPeriod { get; set; } + + public eEntryStatus EntryStatus { get; set; } + + public Format DeckFormat { get; set; } + + public eRule Rule { get; set; } + + public bool IsNormalTwoPick { get; set; } + + public int ChaosNum { get; set; } + + public bool IsTwoPickRule + { + get + { + if (Rule != eRule.TwoPick) + { + return Rule == eRule.TwoPickChaos; + } + return true; + } + } + + public bool NeedsFirstTips { get; set; } + + public int ColosseumId { get; set; } + + public int ChaoseTipsId { get; set; } + + public bool IsSpecialDeckSelectRule + { + get + { + if (Rule != eRule.HOF) + { + return Rule == eRule.WindFall; + } + return true; + } + } + + public bool IsDeckMaxNumberChange => Rule == eRule.WindFall; + + public int DeckMaxNumber + { + get + { + if (Rule == eRule.WindFall) + { + return 35; + } + return 40; + } + } + + public bool IsRankMatching + { + get + { + return _isRankMatching; + } + set + { + if (_isRankMatching != value) + { + _isRankMatching = value; + if (RealTimeNetworkAgent.FinishTaskBase != null) + { + RealTimeNetworkAgent.FinishTaskBase = new ColosseumBattleFinishTask(); + } + } + } + } + + public List DeckList { get; set; } + + public eRound Round { get; set; } + + public int ServerRoundId { get; set; } + + public eStageNo StageNo { get; set; } + + public string Name { get; set; } + + public List RewardList { get; set; } + + public eResultEffect ResultEffect { get; set; } + + public string ColorCodeId { get; set; } + + public string CardPool { get; set; } + + public int RetryRemainingNum { get; set; } + + public int BattleMax { get; set; } + + public int ClearWinNum { get; set; } + + public bool IsDeckEntry { get; set; } + + public bool IsFreeEntry + { + get + { + return Data.MyPageNotifications.data.IsColosseumFreeEntry; + } + set + { + Data.MyPageNotifications.data.IsColosseumFreeEntry = value; + } + } + + public bool IsRetry { get; set; } + + public bool IsLastDay { get; set; } + + public bool IsClear { get; set; } + + public bool IsRetire { get; set; } + + public bool IsFinish { get; set; } + + public bool IsDeckDeleted { get; set; } + + public bool IsFinalRoundTry { get; set; } + + public eRound NextRound { get; set; } + + public double RemainingUnixTime { get; set; } + + public float RemainingSinceTime { get; set; } + + public double RemainingServerUnixTime { get; set; } + + public string NextRoundStartTimeText { get; set; } + + public string NowRoundTimeText { get; set; } + + public string ColosseumTimeText { get; set; } + + public string AnnounceNo { get; set; } + + public Detail[] DetailData { get; set; } + + public eStageNo FocusStageNo { get; set; } + + public int WinBattleNum { get; set; } + + public List BattleResultList { get; set; } + + public List BoxGradeList { get; set; } + + public int FinalRoundEliminateCount { get; set; } + + public TwoPick TwoPickData { get; set; } + + public ArenaColosseum() + { + base.LootBoxType = PlayerStaticData.LootBoxType.COLOSSEUM; + DeckList = new List(); + RewardList = new List(); + BattleResultList = new List(); + BoxGradeList = new List(); + DetailData = new Detail[5]; + Rule = eRule.TwoPick; + TwoPickData = new TwoPick(); + TwoPickData.CandidateClass = new CandidateClass(); + TwoPickData.CandidateCard = new CandidateCardInfo(); + TwoPickData.CandidateChaos = new CandidateChaos(); + } + + public int GetRoundNumber(eRound inRound) + { + switch (inRound) + { + case eRound.Round1: + return 1; + case eRound.Round2B: + case eRound.Round2A: + return 2; + default: + return 0; + } + } + + public string GetGroupText(eRound inRound) + { + switch (inRound) + { + case eRound.Round2A: + case eRound.FinalA: + return Data.SystemText.Get("Colosseum_0020"); + case eRound.Round2B: + case eRound.FinalB: + return Data.SystemText.Get("Colosseum_0021"); + default: + return ""; + } + } + + public eStageNo GetStageNoFromRoundId(eRound inRoundId) + { + switch (inRoundId) + { + case eRound.Round1: + return eStageNo.Stage1; + case eRound.Round2B: + case eRound.Round2A: + return eStageNo.Stage2; + case eRound.FinalB: + case eRound.FinalA: + return eStageNo.FinalStage; + default: + return eStageNo.Stage1; + } + } + + public bool IsFinalRound() + { + if (Round == eRound.FinalA || Round == eRound.FinalB) + { + return true; + } + return false; + } + + public DialogBase CreateDetailDialog(GameObject defaultDetailPrefab) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + GameObject gameObject = Object.Instantiate(defaultDetailPrefab); + dialogBase.SetObj(gameObject); + gameObject.GetComponent().Init(dialogBase); + return dialogBase; + } + + public void ApiRuleParseAndSet(int apiRule) + { + ArenaColosseum colosseumData = Data.ArenaData.ColosseumData; + colosseumData.Rule = (eRule)apiRule; + colosseumData.DeckFormat = ArenaData.ApiDeckFormatParse(colosseumData.Rule); + } +} diff --git a/SVSim.BattleEngine/Engine/ArenaCompetition.cs b/SVSim.BattleEngine/Engine/ArenaCompetition.cs new file mode 100644 index 0000000..72a17e7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ArenaCompetition.cs @@ -0,0 +1,206 @@ +using System; +using System.Collections.Generic; +using LitJson; +using UnityEngine; +using Wizard; +using Wizard.Scripts.Network.Data.TaskData.Arena; + +public class ArenaCompetition : ArenaEntryDataBase +{ + public enum EntryStatusType + { + NotEntry, + NotChallenge, + NotRegistDeck, + InBattle + } + + public enum FreebieStatusType + { + InFreeBattle, + CanPermanentEntry, + PermanentEntryDone + } + + public enum EntryCostType + { + EntryWithFree, + EntryWithCost + } + + private bool _isRankMatching; + + public bool IsCompetitionPeriod { get; private set; } + + public bool IsEntry { get; set; } + + public bool IsInFreeBattleRegistDeck { get; set; } + + public bool NeedsFirstTips { get; private set; } + + public int CompetitionId { get; private set; } + + public FreebieStatusType FreebieStatus { get; set; } + + public Format DeckFormat { get; private set; } + + public ArenaColosseum.eRule Rule { get; private set; } + + public bool IsSpecialMode { get; private set; } + + public string NowRoundTimeText { get; private set; } + + public string EntryEndTimeText { get; private set; } + + public string EndTimeText { get; private set; } + + public double EntryRemainingUnixTime { get; set; } + + public double RemainingUnixTime { get; set; } + + public float RemainingSinceTime { get; set; } + + public double RemainingServerUnixTime { get; set; } + + public string EntryTimeText { get; private set; } + + public List DeckList { get; set; } + + public List EntryRewardList { get; set; } + + public bool IsRewardReceived { get; private set; } + + public string AnnounceId { get; private set; } + + public string CompetitionName { get; private set; } + + public int MaxEntryCount { get; private set; } + + public int MaxChallengeCount { get; private set; } + + public int MaxWinCount { get; private set; } + + public int BestWinCount { get; private set; } + + public int MaxLoseCount { get; private set; } + + public int RestChallangeCount { get; private set; } + + public int RestEntryCount { get; private set; } + + public int CurrentWinCount { get; private set; } + + public int FreebieChallengeCount { get; private set; } + + public bool IsChampion { get; private set; } + + public bool IsEntryTimeEnd { get; private set; } + + public int MaxBattleCount { get; private set; } + + public int IsCompletedTwoPickDeck { get; private set; } + + public int MaxFreebieChallengeCount { get; private set; } + + public EntryStatusType EntryStatus { get; private set; } + + public EntryCostType CostType { get; private set; } + + public bool IsRankMatching + { + get + { + return _isRankMatching; + } + set + { + if (_isRankMatching != value) + { + _isRankMatching = value; + if (RealTimeNetworkAgent.FinishTaskBase != null) + { + RealTimeNetworkAgent.FinishTaskBase = new CompetitionBattleFinishTask(); + } + } + } + } + + public ArenaCompetition() + { + } + + public ArenaCompetition(JsonData responseData) + { + JsonData jsonData = responseData["data"]["competition_info"]; + IsCompetitionPeriod = jsonData["is_competition_period"].ToBoolean(); + if (IsCompetitionPeriod) + { + Rule = (ArenaColosseum.eRule)jsonData["deck_format"].ToInt(); + DeckFormat = ArenaData.ApiDeckFormatParse(Rule); + IsEntry = jsonData["is_entry"].ToBoolean(); + IsInFreeBattleRegistDeck = jsonData["is_in_battle"].ToBoolean(); + IsSpecialMode = jsonData["is_special_mode"].ToInt() == 1; + string text = ConvertTime.ToLocal(DateTime.Parse(jsonData["entry_start_time"].ToString())); + EntryRemainingUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(jsonData["entry_end_time"].ToString())); + string text2 = ConvertTime.ToLocal(DateTime.Parse(jsonData["entry_end_time"].ToString())); + EntryTimeText = Data.SystemText.Get("Colosseum_0033", text, text2); + EntryEndTimeText = text2; + string text3 = ConvertTime.ToLocal(DateTime.Parse(jsonData["start_time"].ToString())); + RemainingUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(jsonData["end_time"].ToString())); + string text4 = ConvertTime.ToLocal(DateTime.Parse(jsonData["end_time"].ToString())); + NowRoundTimeText = Data.SystemText.Get("Colosseum_0033", text3, text4); + EndTimeText = text4; + RemainingSinceTime = Time.realtimeSinceStartup; + RemainingServerUnixTime = responseData["data_headers"]["servertime"].ToDouble(); + NeedsFirstTips = jsonData.GetValueOrDefault("is_display_tips", 0) == 1; + CompetitionId = jsonData.GetValueOrDefault("competition_id", 0); + FreebieStatus = (FreebieStatusType)jsonData["freebie_status"].ToInt(); + DeckList = new List(); + EntryRewardList = new List(); + JsonData jsonData2 = jsonData["featured_entry_reward_list"]; + for (int i = 0; i < jsonData2.Count; i++) + { + Wizard.Scripts.Network.Data.TaskData.Arena.Reward item = new Wizard.Scripts.Network.Data.TaskData.Arena.Reward(jsonData2[i]); + EntryRewardList.Add(item); + } + IsRewardReceived = jsonData["is_received_featured_entry_reward"].ToBoolean(); + if (jsonData["announce_id"] != null) + { + AnnounceId = jsonData["announce_id"].ToString(); + } + MaxEntryCount = jsonData.GetValueOrDefault("max_entry_count", 0); + MaxChallengeCount = jsonData.GetValueOrDefault("max_challenge_count", 0); + MaxWinCount = jsonData.GetValueOrDefault("max_win_count", 0); + MaxLoseCount = jsonData.GetValueOrDefault("max_lose_count", 0); + MaxBattleCount = jsonData.GetValueOrDefault("max_battle_count", 0); + MaxFreebieChallengeCount = jsonData["max_freebie_challenge_count"].ToInt(); + crystalCost = jsonData.GetValueOrDefault("crystal_cost", 0); + rupyCost = jsonData.GetValueOrDefault("rupy_cost", 0); + BestWinCount = jsonData["max_win_count_in_entry"].ToInt(); + RestChallangeCount = jsonData["rest_challenge_num"].ToInt(); + RestEntryCount = jsonData["rest_entry_num"].ToInt(); + CurrentWinCount = jsonData["current_win_count"].ToInt(); + FreebieChallengeCount = jsonData["freebie_challenge_count"].ToInt(); + EntryStatus = (EntryStatusType)jsonData["entry_status"].ToInt(); + CostType = (EntryCostType)jsonData["entry_type"].ToInt(); + IsChampion = jsonData.GetValueOrDefault("is_champion", 0) == 1; + CompetitionName = jsonData.GetValueOrDefault("competition_name", string.Empty).Replace("\\n", "\n"); + double num = RemainingServerUnixTime + (double)Time.realtimeSinceStartup - (double)RemainingSinceTime; + IsEntryTimeEnd = EntryRemainingUnixTime - num < 0.0; + bool flag = CompetitionId <= PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.COMPETITION_JOIN_BUTTON_LATEST_ID); + Data.MyPageNotifications.data.IsCompetitionBadge = !IsRewardReceived && EntryStatus == EntryStatusType.NotEntry && !IsEntryTimeEnd && !flag; + base.ExpirtyInfo = new ShopExpirtyInfo(jsonData["sales_period_info"]); + if (DeckFormat == Format.TwoPick) + { + IsCompletedTwoPickDeck = jsonData["is_completed_two_pick_deck"].ToInt(); + } + } + base.LootBoxType = PlayerStaticData.LootBoxType.COMPETITION; + } + + public void SetRestChallangeCountByEntry(JsonData responseData) + { + RestChallangeCount = responseData["rest_challenge_count"].ToInt(); + IsEntry = true; + } +} diff --git a/SVSim.BattleEngine/Engine/ArenaData.cs b/SVSim.BattleEngine/Engine/ArenaData.cs new file mode 100644 index 0000000..c0ca7b6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ArenaData.cs @@ -0,0 +1,80 @@ +using LitJson; +using Wizard; + +public class ArenaData : HeaderData +{ + public enum eARENA_PAY + { + None = 0, + Crystal = 1, + Ticket = 3, + Rupy = 4, + Free = 5 + } + + public ArenaTwoPickData TwoPickData { get; set; } + + public SealedData SealedData { get; private set; } + + public SealedMyPageResponseData SealedMyPageResponseData { get; private set; } + + public ArenaColosseum ColosseumData { get; set; } + + public ArenaCompetition CompetitionData { get; set; } + + public ArenaData() + { + SealedData = new SealedData(); + ColosseumData = new ArenaColosseum(); + CompetitionData = new ArenaCompetition(); + } + + public ArenaData(JsonData data) + : this() + { + if (data != null) + { + JsonData data2 = data[0]; + TwoPickData = new ArenaTwoPickData(data2); + } + } + + public void ClearSealedData() + { + SealedData = new SealedData(); + } + + public void SetSealedMyPageResponseData(JsonData rootData) + { + if (rootData.Keys.Contains("sealed_info")) + { + SealedMyPageResponseData = new SealedMyPageResponseData(rootData["sealed_info"]); + } + } + + public static Format ApiDeckFormatParse(ArenaColosseum.eRule rule) + { + Format format = Format.Rotation; + switch (rule) + { + case ArenaColosseum.eRule.RotationBo1: + return Format.Rotation; + case ArenaColosseum.eRule.UnlimitedBo1: + return Format.Unlimited; + case ArenaColosseum.eRule.TwoPick: + case ArenaColosseum.eRule.TwoPickChaos: + return Format.TwoPick; + case ArenaColosseum.eRule.HOF: + case ArenaColosseum.eRule.WindFall: + return Format.Max; + case ArenaColosseum.eRule.Crossover: + return Format.Crossover; + case ArenaColosseum.eRule.MyRotation: + return Format.MyRotation; + case ArenaColosseum.eRule.Avatar: + return Format.Avatar; + default: + return Format.Max; + } + } +} diff --git a/SVSim.BattleEngine/Engine/ArenaEntryDataBase.cs b/SVSim.BattleEngine/Engine/ArenaEntryDataBase.cs new file mode 100644 index 0000000..7b01ef2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ArenaEntryDataBase.cs @@ -0,0 +1,16 @@ +using Wizard; + +public abstract class ArenaEntryDataBase +{ + public bool isJoin; + + public int crystalCost; + + public int rupyCost; + + public int ticketCost; + + public ShopExpirtyInfo ExpirtyInfo { get; set; } + + public PlayerStaticData.LootBoxType LootBoxType { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/ArenaField.cs b/SVSim.BattleEngine/Engine/ArenaField.cs new file mode 100644 index 0000000..5f6adf8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ArenaField.cs @@ -0,0 +1,80 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ArenaField : BackGroundBase +{ + public override int FieldId => 9; + + public ArenaField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_arna_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles09").gameObject; + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_9, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_9_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(2700f, -880f, 300f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-19f, -90f, 90f)); + Vector3[] bezierCubic = MotionUtils.GetBezierCubic(new Vector3(2700f, -880f, 300f), new Vector3(1700f, -550f, -220f), new Vector3(700f, -200f, 20f), new Vector3(-240f, -190f, -70f), 10); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierCubic, "movetopath", false, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-37f, -117f, 107f), "time", 1f, "delay", 1f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1") + { + _ = _gimicCntDictionary[obj.tag]; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/ArenaNextSceneSelector.cs b/SVSim.BattleEngine/Engine/ArenaNextSceneSelector.cs new file mode 100644 index 0000000..a25edc0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ArenaNextSceneSelector.cs @@ -0,0 +1,101 @@ +using Cute; +using UnityEngine; +using Wizard; + +public class ArenaNextSceneSelector : INextSceneSelector +{ + private BattleResultUIController m_battleResultNewControl; + + private bool _movingToMyPage; + + public ArenaNextSceneSelector(BattleResultUIController battleResultControl) + { + m_battleResultNewControl = battleResultControl; + _movingToMyPage = false; + } + + public void Setup(bool isWin, GameObject gameObject) + { + if (m_battleResultNewControl.ResultMsgReportBtnFlag) + { + m_battleResultNewControl.ReportBtnObj.labels[0].text = Data.SystemText.Get("Con_Management_001_Button"); + m_battleResultNewControl.ReportBtnObj.gameObject.SetActive(value: true); + m_battleResultNewControl.ReportBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.ReportBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + ConsistencyReportButtonAction.CreateReportConfirmWindow(); + })); + } + m_battleResultNewControl.MissionBtnObj.labels[0].text = Data.SystemText.Get("Battle_0200"); + m_battleResultNewControl.MissionBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.MissionBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + UIManager.GetInstance().createInSceneCenterLoading(); + MissionInfoTask missionInfoTask = GameMgr.GetIns().GetMissionInfoTask(); + missionInfoTask.SetParameter(); + m_battleResultNewControl.StartCoroutine(Toolbox.NetworkManager.Connect(missionInfoTask, delegate + { + m_battleResultNewControl.CreateMissionList(); + }, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + })); + m_battleResultNewControl.HomeBtnObj.labels[0].text = Data.SystemText.Get("Battle_0202"); + m_battleResultNewControl.HomeBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.HomeBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + MoveToMyPage(); + })); + if (GameMgr.GetIns().GetDataMgr().IsColosseumBattleType()) + { + m_battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Battle_0489"); + } + else if (GameMgr.GetIns().GetDataMgr().IsCompetitionBattleType()) + { + m_battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Competition_0021"); + } + else if (GameMgr.GetIns().GetDataMgr().m_BattleType == DataMgr.BattleType.Sealed) + { + m_battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Sealed_BattleResult_0001"); + } + else + { + m_battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Battle_0203"); + } + m_battleResultNewControl.RetryBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.RetryBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + if (GameMgr.GetIns().GetDataMgr().m_BattleType == DataMgr.BattleType.TwoPick) + { + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.TwoPick); + } + else if (GameMgr.GetIns().GetDataMgr().m_BattleType == DataMgr.BattleType.Sealed) + { + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.Sealed); + } + else if (GameMgr.GetIns().GetDataMgr().IsCompetitionBattleType()) + { + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.CompetitionLobby); + } + else + { + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.Colosseum); + } + })); + } + + public void Show() + { + iTween.MoveTo(m_battleResultNewControl.ButtonGrid.gameObject, iTween.Hash("position", m_battleResultNewControl.DefaultPosDict["ButtonGrid"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + private void MoveToMyPage() + { + if (!_movingToMyPage) + { + _movingToMyPage = true; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL_TRANS); + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.MyPage); + } + } +} diff --git a/SVSim.BattleEngine/Engine/ArenaResultAnimationAgent.cs b/SVSim.BattleEngine/Engine/ArenaResultAnimationAgent.cs new file mode 100644 index 0000000..6e46e97 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ArenaResultAnimationAgent.cs @@ -0,0 +1,204 @@ +using System.Collections; +using UnityEngine; +using Wizard; + +public class ArenaResultAnimationAgent : ResultAnimationAgent +{ + public override IEnumerator RunUI(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin) + { + m_BattleCamera.m_CutInCamera.gameObject.SetActive(value: false); + if (battleResultControl.IsDraw) + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleDraw.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 48, 16, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + else if (isWin) + { + battleResultControl.TitleWin.gameObject.SetActive(value: true); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleWin.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.alpha = 0f; + battleResultControl.Bg.color = new Color32(32, 24, 0, 0); + battleResultControl.ResultTitle.spriteName = "result_top_win"; + } + else + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleLose.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleLose.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 24, 48, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + battleResultControl.MainPanel.alpha = 1f; + yield return new WaitForSeconds(0.1f); + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + else if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOUWIN); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_WIN); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + TweenAlpha.Begin(battleResultControl.Bg.gameObject, 0.5f, 0.75f); + yield return new WaitForSeconds(0.2f); + TweenAlpha.Begin(battleResultControl.ArcaneIn.gameObject, 0.5f, 1f); + TweenAlpha.Begin(battleResultControl.ArcaneOut.gameObject, 0.5f, 1f); + iTween.ScaleTo(battleResultControl.ArcaneIn.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(battleResultControl.ArcaneOut.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + if (battleResultControl.IsDraw) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_3, Vector3.zero); + battleResultControl.TitleDraw.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else if (isWin) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_1, Vector3.zero); + battleResultControl.TitleWin.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_2, Vector3.zero); + battleResultControl.TitleLose.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + HideEmotionMessage(); + if (battleResultControl.ResultMsgWindowFlag) + { + StartCoroutine(battleResultControl.ShowSpecialResultInfo()); + } + yield return new WaitForSeconds(2f); + RankWinnerReward winnerReward = GameMgr.GetIns()._rankWinnerReward; + if (winnerReward == null) + { + int value = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_GRADE); + string value2 = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_STRING); + if (value != 0 && value2 != "") + { + winnerReward = UIManager.GetInstance().createRankWinnerReward(); + GameMgr.GetIns()._rankWinnerReward = winnerReward; + winnerReward.SetInfomation(value, value2); + winnerReward.gameObject.SetActive(value: false); + } + } + if (winnerReward != null && isWin) + { + float seconds = 3f; + StartCoroutine(winnerReward.ResultWinnerReward()); + yield return new WaitForSeconds(seconds); + StartCoroutine(winnerReward.HideRewardObject()); + } + if (!battleResultControl.IsDraw && ShowRewardDialog(battleResultControl)) + { + while (battleResultControl.IsRewardWait) + { + yield return null; + } + } + if (Data.ArenaBattleFinish.data != null) + { + TreasureBoxCpResultInfo treasureBoxCpResultInfo = Data.ArenaBattleFinish.data.TreasureBoxCpResultInfo; + if (treasureBoxCpResultInfo.IsPlayGradeUpAnimation()) + { + yield return TreasureBoxCpOpenBoxAnimation(battleResultControl, treasureBoxCpResultInfo.AfterGrade); + } + if (treasureBoxCpResultInfo.IsBoxOpened()) + { + yield return CreateTreasureBoxCpRewardDialog(treasureBoxCpResultInfo); + } + } + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_3, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 0f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 3f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_1, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_2, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + yield return new WaitForSeconds(0.2f); + if (isWin) + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_WIN_LOOP); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_LOSE_LOOP); + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_WINDOW_APPER); + iTween.MoveTo(battleResultControl.ClassCharObj.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassCharObj"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ResultTitle.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ResultTitle"], "time", 0.5f, "delay", 0f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ClassInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassInfo"], "time", 0.5f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(1f); + if (isWin) + { + PlayWinVoice(); + } + if (battleResultControl.AddClassExp > 0) + { + battleResultControl.SettingAddClassExpTextAnimation(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP); + yield return new WaitForSeconds(0.05f); + } + yield return new WaitForSeconds(0.5f); + } + bool _isFinishBattlePass = false; + battleResultControl.SetBattlePassGauge(delegate + { + _isFinishBattlePass = true; + }); + while (!_isFinishBattlePass) + { + yield return null; + } + if (Data.RedEtherCampaignResultData != null) + { + bool isFinishRedEther = false; + RedEtherCampaignPanel.Create(battleResultControl.gameObject, Data.RedEtherCampaignResultData, battleResultControl, delegate + { + isFinishRedEther = true; + }); + while (!isFinishRedEther) + { + yield return null; + } + yield return ShowRewardDialog(Data.RedEtherCampaignResultData.RewardList); + } + battleResultControl.GreySpriteBGVisible = false; + nextSceneSelector.Show(); + battleResultControl.PrepareAchievementLog(); + battleResultControl.FinishResult(); + } +} diff --git a/SVSim.BattleEngine/Engine/ArenaResultAnimationHandler.cs b/SVSim.BattleEngine/Engine/ArenaResultAnimationHandler.cs new file mode 100644 index 0000000..e8c8f9c --- /dev/null +++ b/SVSim.BattleEngine/Engine/ArenaResultAnimationHandler.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +public class ArenaResultAnimationHandler : IResultAnimationHandler +{ + private readonly GameObject m_resultAnimationAgentObj; + + private readonly ArenaResultAnimationAgent m_resultAnimationAgentIns; + + public ResultAnimationAgent m_resultAnimationAgent => m_resultAnimationAgentIns; + + public ArenaResultAnimationHandler(BattleCamera battleCamera) + { + m_resultAnimationAgentObj = new GameObject(); + m_resultAnimationAgentIns = m_resultAnimationAgentObj.AddComponent(); + m_resultAnimationAgentIns.GetComponent().SetBattleCamera(battleCamera); + } + + public void Destroy() + { + Object.Destroy(m_resultAnimationAgentObj); + } +} diff --git a/SVSim.BattleEngine/Engine/ArenaResultReporter.cs b/SVSim.BattleEngine/Engine/ArenaResultReporter.cs new file mode 100644 index 0000000..ec621be --- /dev/null +++ b/SVSim.BattleEngine/Engine/ArenaResultReporter.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using LitJson; +using Wizard; +using Wizard.Lottery; + +public class ArenaResultReporter : IBattleResultReporter +{ + public bool IsEnd => Data.ArenaBattleFinish.data != null; + + public int ClassExp => GetClassExp(); + + public List UserAchievement => GetUserAchievementList(); + + public List UserMission => GetUserMissionList(); + + public List MissionRewards => Data.ArenaBattleFinish.data._missionRewards; + + public List VictoryRewards => Data.ArenaBattleFinish.data._victoryRewards; + + public LotteryApplyData LotteryData => LotteryApplyData.EmptyData(); + + public bool IsDataExist + { + get + { + if (Data.ArenaBattleFinish.data != null) + { + return Data.ArenaBattleFinish.data.IsProcessed; + } + return false; + } + } + + public MyPageHomeDialogData HomeDialogData => null; + + public void Report(bool isWin) + { + } + + public void Destroy() + { + } + + public JsonData GetFinishResponseData() + { + return Data.ArenaBattleFinish.data._responseData; + } + + public List GetUserAchievementList() + { + return Data.ArenaBattleFinish.data.achieved_achievement_list; + } + + public List GetUserMissionList() + { + return Data.ArenaBattleFinish.data.achieved_mission_list; + } + + public int GetClassExp() + { + return Data.ArenaBattleFinish.data.get_class_chara_experience; + } +} diff --git a/SVSim.BattleEngine/Engine/ArenaTwoPickData.cs b/SVSim.BattleEngine/Engine/ArenaTwoPickData.cs new file mode 100644 index 0000000..07f8831 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ArenaTwoPickData.cs @@ -0,0 +1,24 @@ +using LitJson; +using Wizard; + +public class ArenaTwoPickData : ArenaEntryDataBase +{ + public ChallengeData ChallengeData { get; private set; } + + public ArenaTwoPickData(JsonData data) + { + isJoin = data["is_join"].ToBoolean(); + crystalCost = data["cost"].ToInt(); + rupyCost = data["rupy_cost"].ToInt(); + ticketCost = data["ticket_cost"].ToInt(); + base.LootBoxType = PlayerStaticData.LootBoxType.TWOPICK; + if (data.Keys.Contains("sales_period_info")) + { + base.ExpirtyInfo = new ShopExpirtyInfo(data["sales_period_info"]); + } + if (data.Keys.Contains("format_info")) + { + ChallengeData = new ChallengeData(data["format_info"]); + } + } +} diff --git a/SVSim.BattleEngine/Engine/AspectCamera.cs b/SVSim.BattleEngine/Engine/AspectCamera.cs new file mode 100644 index 0000000..f5b99a8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AspectCamera.cs @@ -0,0 +1,76 @@ +using UnityEngine; + +[ExecuteInEditMode] +public class AspectCamera : MonoBehaviour +{ + public Vector2 aspect = new Vector2(4f, 3f); + + public Color32 backgroundColor = Color.black; + + private float aspectRate; + + private Camera _camera; + + private static Camera _backgroundCamera; + + private int sizeVal = 1; + + public const float LOWER_LIMIT_ASPECT_RATIO = 0.5625f; + + public const float UPPER_LIMIT_ASPECT_RATIO = 0.4618f; + + public const float LOWER_LIMIT_ASPECT_RATIO_RECIPROCAL = 1.7777778f; + + private const float SAFE_AREA_RATE = 0.892f; + + private const float SAFE_AREA_NONE_RATE = 1f; + + public static float SafeAreaRate; + + private void Start() + { + aspectRate = aspect.x / aspect.y; + _camera = GetComponent(); + SafeAreaRate = 1f; + float num = (float)Screen.height / (float)Screen.width; + if (num < 0.5625f) + { + num = Mathf.Max(num, 0.4618f); + float t = (0.5625f - num) / 0.10069999f; + SafeAreaRate = Mathf.Lerp(1f, 0.892f, t); + } + } + + private void UpdateScreenRate() + { + float num = aspect.y / aspect.x; + float num2 = (float)Screen.height / (float)Screen.width; + if (num2 < 0.5625f) + { + num2 = 0.5625f; + } + if (num > num2) + { + float num3 = num2 / num; + _camera.rect = new Rect(0f, 0f, 1f, 1f); + _camera.orthographicSize = (float)sizeVal * num3; + } + else + { + float num4 = num / num2; + _camera.rect = new Rect(0f, 0f, 1f, 1f); + _camera.orthographicSize = (float)sizeVal / num4; + } + } + + private bool IsChangeAspect() + { + return _camera.aspect == aspectRate; + } + + private void Update() + { + UpdateScreenRate(); + _camera.ResetAspect(); + } +} diff --git a/SVSim.BattleEngine/Engine/AttackSelectControl.cs b/SVSim.BattleEngine/Engine/AttackSelectControl.cs new file mode 100644 index 0000000..257cde0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AttackSelectControl.cs @@ -0,0 +1,528 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard; +using Wizard.Battle.Touch; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class AttackSelectControl +{ + public class AttackPair + { + public class AttackPairCard + { + public IBattleCardView _battleCardView; + + public bool _isReady; + + public bool _hasStartedMoving; + + public AttackPairCard(IBattleCardView battleCardBase) + { + _battleCardView = battleCardBase; + } + + public AttackPairCard(AttackPairCard attackPairCard) + { + _battleCardView = attackPairCard._battleCardView; + _isReady = attackPairCard._isReady; + _hasStartedMoving = attackPairCard._hasStartedMoving; + } + + public void Clear() + { + _battleCardView = null; + _isReady = false; + _hasStartedMoving = false; + } + } + + public AttackPairCard _attackInitiator; + + public AttackPairCard _attackTarget; + + public bool IsAttackPairReady + { + get + { + if (_attackInitiator._isReady) + { + return _attackTarget._isReady; + } + return false; + } + } + + public AttackPair(IBattleCardView attackInitiator, IBattleCardView attackTarget) + { + _attackInitiator = new AttackPairCard(attackInitiator); + _attackTarget = new AttackPairCard(attackTarget); + } + + public AttackPair(AttackPair attackPair) + { + _attackInitiator = new AttackPairCard(attackPair._attackInitiator); + _attackTarget = new AttackPairCard(attackPair._attackTarget); + } + + public bool Compare(IBattleCardView attackInitiatorView, IBattleCardView attackTargetView) + { + if (_attackInitiator._battleCardView == attackInitiatorView) + { + return _attackTarget._battleCardView == attackTargetView; + } + return false; + } + + public void Clear() + { + _attackInitiator.Clear(); + _attackTarget.Clear(); + } + } + + public class WaitUntilAttackPairIsReadyVfx : VfxBase + { + private AttackPair _attackPair; + + public WaitUntilAttackPairIsReadyVfx(AttackPair attackPair) + { + _attackPair = attackPair; + } + + public override void Play() + { + BattleCoroutine.GetInstance().StartCoroutine(Wait()); + } + + private IEnumerator Wait() + { + while (!_attackPair.IsAttackPairReady) + { + yield return null; + } + IsEnd = true; + } + } + + private BattleCardBase currentAttackInitiatorBattleCard; + + private bool areAttackPairsBeingUpdated; + + private readonly AttackPair currentAttackPair = new AttackPair(null, null); + + private readonly List successfulAttackPairs = new List(); + + public const float Z_FLOAT_AMOUNT = -100f; + + private const float EPSILON = 0.1f; + + private const float SMOOTHING_AMOUNT = 0.01f; + + private const float DECAY_MULTIPLIER = 10f; + + private const float IDLING_POSITION = 0.025390625f; + + private IBattleCardView currentAttackInitiator + { + get + { + return currentAttackPair._attackInitiator._battleCardView; + } + set + { + currentAttackPair._attackInitiator._battleCardView = value; + } + } + + private IBattleCardView currentAttackTarget + { + get + { + return currentAttackPair._attackTarget._battleCardView; + } + set + { + currentAttackPair._attackTarget._battleCardView = value; + } + } + + public void Update() + { + float t = MotionUtils.CalculateFrameRateIndependantDampingConstant(0.01f, 10f); + if (currentAttackInitiator != null && !currentAttackInitiator._attackTargetSelectInfo.IsCardInvolvedInAttack) + { + MoveCardUpwards(currentAttackPair._attackInitiator, t); + } + if (currentAttackTarget != null && !currentAttackTarget._attackTargetSelectInfo.IsCardInvolvedInAttack) + { + MoveCardUpwards(currentAttackPair._attackTarget, t); + } + } + + public void RegisterAttackInitiator(BattleCardBase attackInitiatorCard, BattlePlayerBase opponentBattlePlayer) + { + currentAttackInitiatorBattleCard = attackInitiatorCard; + currentAttackInitiator = attackInitiatorCard.BattleCardView; + ToggleAttackableCardFrameEffects(isEnabled: true, opponentBattlePlayer); + attackInitiatorCard.BattleCardView._attackTargetSelectInfo._isBeingSelectedInAttack = true; + if (!attackInitiatorCard.BattleCardView._attackTargetSelectInfo.IsCardInvolvedInAttack) + { + ResetCardOrientationAndStopMovement(attackInitiatorCard.BattleCardView); + } + } + + public void RegisterAttackTarget(IBattleCardView attackTargetCard) + { + if (currentAttackTarget == attackTargetCard) + { + return; + } + if (attackTargetCard != null) + { + attackTargetCard._attackTargetSelectInfo._isBeingSelectedInAttack = true; + if (!attackTargetCard._attackTargetSelectInfo.IsCardInvolvedInAttack) + { + ResetCardOrientationAndStopMovement(attackTargetCard); + } + } + currentAttackPair._attackTarget._isReady = !IsCardTranslatable(attackTargetCard); + currentAttackPair._attackTarget._hasStartedMoving = !IsCardTranslatable(attackTargetCard); + ResetCardPosition(currentAttackTarget); + if (currentAttackTarget != null) + { + currentAttackTarget._attackTargetSelectInfo._isBeingSelectedInAttack = false; + } + currentAttackTarget = attackTargetCard; + } + + public virtual void RegisterAttackPair(AttackPair attackPair) + { + IBattleCardView battleCardView = attackPair._attackInitiator._battleCardView; + IBattleCardView battleCardView2 = attackPair._attackTarget._battleCardView; + if (attackPair == null || battleCardView == null || battleCardView._attackTargetSelectInfo._attackPairsCardIsInvolvedIn == null) + { + ResetCardPosition(currentAttackInitiator); + ResetCardPosition(currentAttackTarget); + return; + } + successfulAttackPairs.Add(attackPair); + battleCardView._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Enqueue(attackPair); + battleCardView2._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Enqueue(attackPair); + if (!areAttackPairsBeingUpdated) + { + BattleCoroutine.GetInstance().StartCoroutine(UpdateAttackPairs()); + } + } + + public void CancelAttackSelect(bool wasAttackSuccessful, BattlePlayerBase opponentBattlePlayer) + { + if (wasAttackSuccessful) + { + AttackPair attackPair = new AttackPair(currentAttackPair); + RegisterAttackPair(attackPair); + } + else + { + ResetCardPosition(currentAttackInitiator); + ResetCardPosition(currentAttackTarget); + } + if (currentAttackInitiatorBattleCard != null) + { + ToggleAttackableCardFrameEffects(isEnabled: false, opponentBattlePlayer); + } + if (currentAttackInitiator != null) + { + currentAttackInitiator._attackTargetSelectInfo._isBeingSelectedInAttack = false; + } + if (currentAttackTarget != null) + { + currentAttackTarget._attackTargetSelectInfo._isBeingSelectedInAttack = false; + } + currentAttackInitiatorBattleCard = null; + currentAttackPair.Clear(); + } + + public void ResetCardOrientationAndStopMovement(IBattleCardView targetCard) + { + if (!targetCard._attackTargetSelectInfo.IsUneffectedByAttackTargetting) + { + iTween.Stop(targetCard.CardWrapObject); + targetCard.CardWrapObject.transform.rotation = Quaternion.identity; + } + } + + public virtual VfxBase ResetCardAfterAttackOnReplay() + { + return InstantVfx.Create(delegate + { + for (int i = 0; i < successfulAttackPairs.Count(); i++) + { + IBattleCardView battleCardView = successfulAttackPairs[i]._attackInitiator._battleCardView; + if (battleCardView._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Count > 0) + { + battleCardView._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Dequeue(); + } + ResetCardPosition(battleCardView); + IBattleCardView battleCardView2 = successfulAttackPairs[i]._attackTarget._battleCardView; + if (battleCardView2._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Count > 0) + { + battleCardView2._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Dequeue(); + } + ResetCardPosition(battleCardView2); + } + }); + } + + public virtual VfxBase ResetCardAfterAttack(IBattleCardView cardToReset) + { + return InstantVfx.Create(delegate + { + if (cardToReset._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Count > 0) + { + cardToReset._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Dequeue(); + } + if (cardToReset._attackTargetSelectInfo.IsCardInvolvedInAttack) + { + cardToReset._attackTargetSelectInfo.CurrentAttackPairCardIsInvolvedIn._attackTarget._isReady = true; + } + ResetCardPosition(cardToReset); + }); + } + + private void ResetCardPosition(IBattleCardView targetCard) + { + if (!BattleManagerBase.GetIns().IsRecovery && IsCardTranslatable(targetCard) && !targetCard._attackTargetSelectInfo.IsCardInvolvedInAttack && !targetCard._attackTargetSelectInfo.IsUneffectedByAttackTargetting) + { + ImmediateVfxMgr.GetInstance().Register(SequentialVfxPlayer.Create(InstantVfx.Create(delegate + { + iTween.Stop(targetCard.CardWrapObject); + }), new DelaySetupVfx(() => (targetCard._attackTargetSelectInfo._isBeingSelectedInAttack || targetCard._attackTargetSelectInfo.IsCardInvolvedInAttack) ? ((VfxBase)NullVfx.GetInstance()) : ((VfxBase)new FallToGroundVfx(targetCard.CardWrapObject))))); + } + } + + public virtual void StartCardIdling(IBattleCardView battleCardView) + { + iTween.Stop(battleCardView.CardWrapObject); + iTween.MoveAdd(battleCardView.CardWrapObject, iTween.Hash("z", 0.025390625f, "time", Random.Range(0.5f, 0.6f), "looptype", iTween.LoopType.pingPong, "easetype", iTween.EaseType.easeInOutQuad)); + } + + public virtual VfxBase RemoveAttackPairVfx(IBattleCardView attackInitiator, IBattleCardView attackTarget) + { + AttackPair attackPairToRemove = null; + for (int i = 0; i < successfulAttackPairs.Count; i++) + { + if (successfulAttackPairs[i].Compare(attackInitiator, attackTarget)) + { + attackPairToRemove = successfulAttackPairs[i]; + break; + } + } + if (attackPairToRemove != null) + { + VfxBase vfxBase = CreateWaitUntilAttackPairIsReadyVfx(attackPairToRemove); + VfxBase vfxBase2 = InstantVfx.Create(delegate + { + successfulAttackPairs.Remove(attackPairToRemove); + }); + return SequentialVfxPlayer.Create(vfxBase, vfxBase2); + } + return NullVfx.GetInstance(); + } + + private void ToggleAttackableCardFrameEffects(bool isEnabled, BattlePlayerBase opponentBattlePlayer) + { + List classAndInPlayCardList = opponentBattlePlayer.ClassAndInPlayCardList; + for (int i = 0; i < classAndInPlayCardList.Count; i++) + { + if (CanCardAttackTarget(currentAttackInitiatorBattleCard, classAndInPlayCardList[i], opponentBattlePlayer.InPlayCards) && classAndInPlayCardList[i].AreCanBeAttackedConditionsFulfilled) + { + classAndInPlayCardList[i].BattleCardView._inPlayFrameEffect.ToggleTargetSelectEffect(isEnabled); + } + } + currentAttackInitiator._inPlayFrameEffect.ToggleTargetSelectEffect(isEnabled, isAttackTargetSelectInitiator: true); + } + + private VfxBase CreateWaitUntilAttackPairIsReadyVfx(AttackPair attackPair) + { + return new WaitUntilAttackPairIsReadyVfx(attackPair); + } + + private IEnumerator UpdateAttackPairs() + { + areAttackPairsBeingUpdated = true; + while (successfulAttackPairs.Count > 0) + { + float t = MotionUtils.CalculateFrameRateIndependantDampingConstant(0.01f, 10f); + for (int i = 0; i < successfulAttackPairs.Count; i++) + { + AttackPair attackPair = successfulAttackPairs[i]; + if (!attackPair.IsAttackPairReady) + { + AttackPair.AttackPairCard attackInitiator = attackPair._attackInitiator; + AttackPair.AttackPairCard attackTarget = attackPair._attackTarget; + if (attackInitiator._battleCardView._attackTargetSelectInfo.CurrentAttackPairCardIsInvolvedIn == attackPair) + { + MoveCardUpwards(attackInitiator, t); + } + if (attackTarget._battleCardView._attackTargetSelectInfo.CurrentAttackPairCardIsInvolvedIn == attackPair) + { + MoveCardUpwards(attackTarget, t); + } + } + } + yield return null; + } + areAttackPairsBeingUpdated = false; + } + + private void MoveCardUpwards(AttackPair.AttackPairCard attackPairCard, float t) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + attackPairCard._isReady = true; + } + else + { + if (attackPairCard == null || attackPairCard._battleCardView == null) + { + return; + } + IBattleCardView battleCardView = attackPairCard._battleCardView; + if (IsCardTranslatable(battleCardView) && !battleCardView._attackTargetSelectInfo.IsUneffectedByAttackTargetting && !attackPairCard._isReady) + { + if (!attackPairCard._hasStartedMoving) + { + attackPairCard._hasStartedMoving = true; + ResetCardOrientationAndStopMovement(battleCardView); + } + Transform transform = battleCardView.CardWrapObject.transform; + if (!IsCardFullyTranslated(battleCardView)) + { + Vector3 b = CalculateFinalFloatingPosition(battleCardView); + transform.localPosition = Vector3.Lerp(transform.transform.localPosition, b, t); + } + else + { + transform.localPosition = CalculateFinalFloatingPosition(battleCardView); + attackPairCard._isReady = true; + StartCardIdling(battleCardView); + } + } + } + } + + private Vector3 CalculateFinalFloatingPosition(IBattleCardView battleCardView) + { + Vector3 localPosition = battleCardView.CardWrapObject.transform.transform.localPosition; + localPosition.z = -100f; + return localPosition; + } + + public bool IsCardTranslatable(IBattleCardView cardToTranslate) + { + if (cardToTranslate != null) + { + return !cardToTranslate.CardInfo.IsClass; + } + return false; + } + + private bool IsCardFullyTranslated(IBattleCardView cardBeingTranslated) + { + return Mathf.Abs(cardBeingTranslated.CardWrapObject.transform.localPosition.z - -100f) < 0.1f; + } + + public static bool CanCardAttackTarget(BattleCardBase Attacker, BattleCardBase Target, IEnumerable TargetInPlayCards) + { + bool flag = false; + bool isClass = Target.IsClass; + if (TargetInPlayCards.Any((BattleCardBase c) => c.SkillApplyInformation.IsGuard && !c.CantBeFocusedAttack(Attacker))) + { + flag = true; + } + if (Attacker.SkillApplyInformation.IsIgnoreGuard) + { + flag = false; + } + if (Attacker.AttackableCount <= 0) + { + return false; + } + if ((!Attacker.SkillApplyInformation.IsQuick || !Attacker.SkillApplyInformation.IsRush) && !Attacker.Attackable) + { + return false; + } + if (isClass) + { + if (!Attacker.SkillApplyInformation.IsQuick) + { + if (Attacker.IsFirstTurn) + { + return false; + } + if (!Attacker.Attackable) + { + return false; + } + } + if (Attacker.IsCantAttackClass) + { + return false; + } + if (Attacker.SkillApplyInformation.IsForceAttackUnit && Attacker.OpponentBattlePlayer.InPlayCards.Any((BattleCardBase c) => !c.CantBeFocusedAttack(Attacker) && c.IsUnit && !AttackTargetSelectTouchProcessor.CheckAttackToUnitNotHasGuardError(Attacker, c))) + { + return false; + } + } + if (!Target.IsInplay) + { + return false; + } + if (Target.IsField || Target.CantBeFocusedAttack(Attacker)) + { + return false; + } + if (flag && (isClass || !Target.SkillApplyInformation.IsGuard)) + { + return false; + } + if (isClass && Attacker.IsCantAttackClass) + { + return false; + } + if (Target.IsUnit && Attacker.SkillApplyInformation.IsSkillCantAtkUnit) + { + return false; + } + if (Target.IsUnit && Attacker.SkillApplyInformation.IsSkillCantAtkUnitBaseCardId && Attacker.SkillApplyInformation.CantAtkUnitBaseCardIdList.Contains(Target.BaseParameter.BaseCardId)) + { + return false; + } + if (!isClass && Attacker.SkillApplyInformation.IsSkillCantAtkUnitNotHasGuard && !Target.SkillApplyInformation.IsGuard) + { + return false; + } + return true; + } + + public static bool IsAttackPossible(BattleCardBase attacker, BattleCardBase target, IEnumerable opponentInPlayCards) + { + if (attacker.Attackable) + { + return CanCardAttackTarget(attacker, target, opponentInPlayCards); + } + return false; + } + + public static bool IsAttackPossible(AIVirtualCard attacker, AIVirtualCard target, BattlePlayerBase opponent) + { + if (attacker.BaseCard.Attackable) + { + return CanCardAttackTarget(attacker.BaseCard, target.BaseCard, opponent.InPlayCards); + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/BattleCardIconAnimations.cs b/SVSim.BattleEngine/Engine/BattleCardIconAnimations.cs new file mode 100644 index 0000000..2eac6ae --- /dev/null +++ b/SVSim.BattleEngine/Engine/BattleCardIconAnimations.cs @@ -0,0 +1,487 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +public class BattleCardIconAnimations : MonoBehaviour +{ + public class SkillIcon + { + public string _key; + + public string _iconSpriteName; + + public int LabelNumber; + + public SkillIcon(string key, string iconSpriteName, int labelNumber) + { + _key = key; + _iconSpriteName = iconSpriteName; + LabelNumber = labelNumber; + } + } + + private List skillIconList = new List(); + + private List skillIconListWithoutDuplicates = new List(); + + private CardTemplate cardTemplate; + + private BattleCardBase _card; + + private SkillCollectionBase collection; + + private bool skillIconAlphaFlg; + + private int skillCount; + + private int _inductionLabelNumber = -1; + + private const float ALPHA_BLEND_RATE = 0.6f; + + private const string INDUCTION_ICON_SPRITE_NAME = "battle_notice_status_04"; + + private const string WHITE_RITUAL_STACK_SPRITE_NAME = "battle_notice_status_11"; + + public VfxBase Initialize(BattleCardBase card, SkillCollectionBase collection, bool isStackWhiteRitual = false) + { + _card = card; + this.collection = collection; + ISkillApplyInformation skillApplyInformation = card.SkillApplyInformation; + bool isEarthRiteField = (IsEarthRiteField() ? true : false); + bool hasInductionSkill = HasInductionSkill(); + bool hasInductionNumberSkill = HasInductionNumberSkill(); + bool hasKiller = (skillApplyInformation.IsKiller ? true : false); + bool hasDrain = (skillApplyInformation.IsDrain ? true : false); + bool hasWhenDestroySkill = (HasWhenDestroySkill() ? true : false); + bool hasGetonSkill = HasGetonSkill(); + bool isGetOnAfter = _card.GetOnCards.Any(); + bool hasWhiteRirualStackSkill = HasStackWhiteRitualSkill(); + int whiteRitualCount = _card.SkillApplyInformation.WhiteRitualCount; + return InstantVfx.Create(delegate + { + InitializeIcon(isEarthRiteField && !hasWhiteRirualStackSkill, isEarthRiteField && hasWhiteRirualStackSkill, whiteRitualCount, hasInductionSkill, hasInductionNumberSkill, hasKiller, hasDrain, hasWhenDestroySkill, hasGetonSkill, isGetOnAfter, isReplay: false, isStackWhiteRitual); + }); + } + + public VfxBase InitializeOnlyStack(BattleCardBase card, SkillCollectionBase collection) + { + _card = card; + this.collection = collection; + bool isEarthRiteField = IsEarthRiteField(); + bool hasWhiteRirualStackSkill = HasStackWhiteRitualSkill(); + int whiteRitualCount = _card.SkillApplyInformation.WhiteRitualCount; + return InstantVfx.Create(delegate + { + InitializeIcon(isEarthRiteField && !hasWhiteRirualStackSkill, isEarthRiteField && hasWhiteRirualStackSkill, whiteRitualCount, hasInductionSkill: false, hasInductionNumberSkill: false, hasKiller: false, hasDrain: false, hasWhenDestroySkill: false, hasGetonSkill: false); + }); + } + + private void InitializeIcon(bool hasWhiteRirualSkill, bool hasWhiteRirualStackSkill, int whiteRitualCount, bool hasInductionSkill, bool hasInductionNumberSkill, bool hasKiller, bool hasDrain, bool hasWhenDestroySkill, bool hasGetonSkill, bool isGetOnAfter = false, bool isReplay = false, bool isStackWhiteRitual = false) + { + if (!(_card.BattleCardView.GameObject == null)) + { + ClearAllSkillIcons(); + cardTemplate = _card.BattleCardView.GameObject.GetComponent(); + cardTemplate.SkillIconTemp.gameObject.transform.localPosition = new Vector3(0f, -30f, -0.1f); + cardTemplate.SkillIconTemp.gameObject.transform.localScale = new Vector3(0.2f, 0.2f, 1f); + cardTemplate.SkillIconTemp.atlas = UIManager.GetInstance().GetAtlasList().FirstOrDefault((UIAtlas s) => s.name == "Battle"); + AddToIconList("white_ritual", "battle_notice_status_08", hasWhiteRirualSkill); + AddToIconList("stack_white_ritual", "battle_notice_status_11", hasWhiteRirualStackSkill, whiteRitualCount); + AddToIconList("induction", "battle_notice_status_04", hasInductionSkill); + AddToIconList("induction_number", "battle_notice_status_04", hasInductionNumberSkill, GetInductionLabelNumber()); + AddToIconList("killer", "battle_notice_status_01", hasKiller); + AddToIconList("drain", "battle_notice_status_07", hasDrain); + AddToIconList("destroy", "battle_notice_status_06", hasWhenDestroySkill); + if (isReplay) + { + AddToIconList("geton", "battle_notice_status_09", hasGetonSkill); + AddToIconList("geton_after", "battle_notice_status_10", isGetOnAfter); + } + else if (isGetOnAfter) + { + AddToIconList("geton_after", "battle_notice_status_10", hasGetonSkill); + } + else + { + AddToIconList("geton", "battle_notice_status_09", hasGetonSkill); + } + PopulateSkillIconListWithoutDuplicates(); + string spriteName = (skillIconListWithoutDuplicates.Any() ? skillIconListWithoutDuplicates[0]._iconSpriteName : string.Empty); + cardTemplate.SkillIconTemp.spriteName = spriteName; + ChangeSkillIconLabel(cardTemplate.SkillIconLabelTemp, skillIconListWithoutDuplicates.Any() ? skillIconListWithoutDuplicates[0].LabelNumber : (-1)); + UpdateSkillIconLabelColor(); + skillCount = 0; + cardTemplate.SkillIconTemp.gameObject.SetActive(value: true); + if (isStackWhiteRitual) + { + cardTemplate.SkillIconTemp.alpha = 1.5f; + skillIconAlphaFlg = false; + } + } + } + + public VfxBase UpdateLabelNumber() + { + return InstantVfx.Create(delegate + { + SkillIcon skillIcon = skillIconListWithoutDuplicates.FirstOrDefault((SkillIcon i) => i._key == "induction_number"); + if (skillIcon != null) + { + skillIcon.LabelNumber = GetInductionLabelNumber(); + if (cardTemplate.SkillIconTemp.spriteName == "battle_notice_status_04") + { + ChangeSkillIconLabel(cardTemplate.SkillIconLabelTemp, skillIcon.LabelNumber); + } + } + }); + } + + public VfxBase UpdateWhiteRitualCountLabel() + { + if (!HasStackWhiteRitualSkill() || !IsEarthRiteField()) + { + return NullVfx.GetInstance(); + } + int whiteRitualCount = _card.SkillApplyInformation.WhiteRitualCount; + return InstantVfx.Create(delegate + { + SkillIcon skillIcon = skillIconListWithoutDuplicates.FirstOrDefault((SkillIcon i) => i._key == "stack_white_ritual"); + if (skillIcon != null) + { + skillIcon.LabelNumber = whiteRitualCount; + if (cardTemplate.SkillIconTemp.spriteName == "battle_notice_status_11") + { + ChangeSkillIconLabel(cardTemplate.SkillIconLabelTemp, skillIcon.LabelNumber); + } + } + }); + } + + private void AddToIconList(string key, string spriteName, bool addCondition, int labelNumber = -1) + { + if (addCondition) + { + AddSkillIcon(key, spriteName, labelNumber); + } + } + + private void PopulateSkillIconListWithoutDuplicates() + { + AddToIconListWithoutDuplicates("white_ritual"); + AddToIconListWithoutDuplicates("stack_white_ritual"); + AddToIconListWithoutDuplicates("induction"); + AddToIconListWithoutDuplicates("induction_number"); + AddToIconListWithoutDuplicates("destroy"); + AddToIconListWithoutDuplicates("killer"); + AddToIconListWithoutDuplicates("drain"); + AddToIconListWithoutDuplicates("geton"); + } + + private void AddToIconListWithoutDuplicates(string key) + { + if (skillIconList.Any((SkillIcon c) => c._key == key) && !skillIconListWithoutDuplicates.Any((SkillIcon c) => c._key == key)) + { + SkillIcon skillIcon = skillIconList.SingleOrDefault((SkillIcon c) => c._key == key && c._iconSpriteName != null); + skillIconListWithoutDuplicates.Add(new SkillIcon(key, skillIcon._iconSpriteName, skillIcon.LabelNumber)); + } + } + + public VfxBase ShowIcon() + { + return InstantVfx.Create(delegate + { + cardTemplate.SkillIconTemp.gameObject.SetActive(value: true); + }); + } + + public VfxBase HideIcon() + { + return InstantVfx.Create(delegate + { + cardTemplate.SkillIconTemp.gameObject.SetActive(value: false); + }); + } + + private void Update() + { + if (cardTemplate != null) + { + if (cardTemplate.SkillIconTemp.gameObject.activeSelf) + { + SkillIconAlphaBlend(); + } + else + { + cardTemplate.SkillIconTemp.alpha = 0f; + } + } + } + + public void AddSkillIcon(string key, string fileName, int labelNumber = -1) + { + string iconSpriteName = ((!skillIconList.Any((SkillIcon v) => v._key == key)) ? fileName : null); + skillIconList.Add(new SkillIcon(key, iconSpriteName, labelNumber)); + skillIconListWithoutDuplicates = skillIconList.Where((SkillIcon v) => v._iconSpriteName != null).ToList(); + } + + public void DeleteSkillIcon(string key) + { + if (skillIconList.Any((SkillIcon v) => v._key == key)) + { + skillIconList.Remove(skillIconList.Where((SkillIcon v) => v._key == key).Last()); + } + skillIconListWithoutDuplicates = skillIconList.Where((SkillIcon v) => v._iconSpriteName != null).ToList(); + if (skillIconListWithoutDuplicates.Count == 0) + { + cardTemplate.SkillIconTemp.spriteName = string.Empty; + cardTemplate.SkillIconLabelTemp.text = string.Empty; + } + ChangeTexture(); + } + + public void DeleteUnneededSkillIcons() + { + RemoveSkillIconFromList("white_ritual", () => !IsEarthRiteField()); + RemoveSkillIconFromList("induction", () => !HasInductionSkill()); + RemoveSkillIconFromList("induction_number", () => !HasInductionNumberSkill()); + RemoveSkillIconFromList("destroy", () => !HasWhenDestroySkill()); + } + + private void RemoveSkillIconFromList(string key, Func deleteCondition) + { + if (deleteCondition()) + { + DeleteSkillIcon(key); + } + } + + private void ChangeTexture() + { + if (skillIconListWithoutDuplicates.Count() - 1 > skillCount) + { + skillCount++; + cardTemplate.SkillIconTemp.spriteName = skillIconListWithoutDuplicates[skillCount]._iconSpriteName; + ChangeSkillIconLabel(cardTemplate.SkillIconLabelTemp, skillIconListWithoutDuplicates[skillCount].LabelNumber); + } + else if (skillIconListWithoutDuplicates.Count() != 0) + { + skillCount = 0; + cardTemplate.SkillIconTemp.spriteName = skillIconListWithoutDuplicates[skillCount]._iconSpriteName; + ChangeSkillIconLabel(cardTemplate.SkillIconLabelTemp, skillIconListWithoutDuplicates[skillCount].LabelNumber); + } + UpdateSkillIconLabelColor(); + } + + private void UpdateSkillIconLabelColor() + { + if (cardTemplate.SkillIconTemp.spriteName == "battle_notice_status_11") + { + cardTemplate.SkillIconLabelTemp.color = Color.white; + cardTemplate.SkillIconLabelTemp.effectColor = Color.black; + } + else if (cardTemplate.SkillIconTemp.spriteName == "battle_notice_status_04") + { + cardTemplate.SkillIconLabelTemp.color = Color.black; + cardTemplate.SkillIconLabelTemp.effectColor = Color.white; + } + } + + private void ChangeSkillIconLabel(UILabel label, int labelNumber) + { + if (labelNumber == -1) + { + label.text = string.Empty; + } + else + { + label.text = labelNumber.ToString(); + } + } + + public void ClearAllSkillIcons() + { + skillIconList.Clear(); + skillIconListWithoutDuplicates.Clear(); + } + + private void SkillIconAlphaBlend() + { + bool flag = cardTemplate.SkillIconLabelTemp.text.IsNotNullOrEmpty(); + if (skillIconListWithoutDuplicates.Count > 1) + { + if (skillIconAlphaFlg) + { + cardTemplate.SkillIconTemp.alpha += (flag ? (0.6f * Time.deltaTime * 2f) : (0.6f * Time.deltaTime)); + } + else + { + cardTemplate.SkillIconTemp.alpha -= (flag ? (0.6f * Time.deltaTime * 2f) : (0.6f * Time.deltaTime)); + } + } + else if (cardTemplate.SkillIconTemp.spriteName == string.Empty) + { + cardTemplate.SkillIconTemp.alpha = 1f; + if (skillIconListWithoutDuplicates.Count > 0) + { + if (cardTemplate.SkillIconTemp.spriteName != skillIconListWithoutDuplicates[0]._iconSpriteName) + { + cardTemplate.SkillIconTemp.spriteName = skillIconListWithoutDuplicates[0]._iconSpriteName; + } + ChangeSkillIconLabel(cardTemplate.SkillIconLabelTemp, skillIconListWithoutDuplicates[0].LabelNumber); + UpdateSkillIconLabelColor(); + } + } + else + { + cardTemplate.SkillIconTemp.alpha = 1f; + } + if (skillIconAlphaFlg && cardTemplate.SkillIconTemp.alpha >= (flag ? 2f : 1f)) + { + skillIconAlphaFlg = false; + } + else if (!skillIconAlphaFlg && cardTemplate.SkillIconTemp.alpha <= 0f) + { + ChangeTexture(); + skillIconAlphaFlg = true; + } + } + + private bool HasWhenDestroySkill() + { + return collection._skillTimingInfo.IsWhenDestroy; + } + + public bool HasInductionSkill() + { + for (int i = 0; i < collection.Count(); i++) + { + SkillBase skillBase = collection.ElementAt(i); + if (skillBase.IsInductionSkill && skillBase.SkillPrm.buildInfo._icon == "induction") + { + return true; + } + } + return false; + } + + public bool HasStackWhiteRitualSkill() + { + return collection.Any((SkillBase x) => x is Skill_stack_white_ritual); + } + + public bool HasGetonSkill() + { + return collection.Any((SkillBase x) => x is Skill_geton); + } + + public bool HasInductionNumberSkill() + { + for (int i = 0; i < collection.Count(); i++) + { + SkillBase skillBase = collection.ElementAt(i); + if (skillBase.IsInductionSkill && skillBase.SkillPrm.buildInfo._icon != "induction" && skillBase.SkillPrm.buildInfo._icon.Contains("induction")) + { + return true; + } + } + return false; + } + + public int GetInductionLabelNumber() + { + if (_inductionLabelNumber != -1) + { + return _inductionLabelNumber; + } + SkillBase skillBase = collection.FirstOrDefault((SkillBase s) => s.IsInductionSkill && s.SkillPrm.buildInfo._icon != "induction" && s.SkillPrm.buildInfo._icon.Contains("induction")); + if (skillBase == null) + { + return -1; + } + SkillOptionValue skillOptionValue = new SkillOptionValue(skillBase.SkillPrm.buildInfo._icon); + skillOptionValue.SetupFilterVariable(BattleManagerBase.GetIns().GetBattlePlayerInfoPair(_card.IsPlayer), _card, isPrePlay: false, null); + return skillOptionValue.GetInt(SkillFilterCreator.ContentKeyword.induction); + } + + private bool IsEarthRiteField() + { + if (_card.IsField || _card.IsChantField) + { + return _card.IsTribe(CardBasePrm.TribeType.WHITE_RITUAL); + } + return false; + } + + public VfxBase UpdateSkillIconInReplay(List inplaySkillEffectList, int inductionNumber, bool isInitialize, bool isStackWhiteRitual = false) + { + if (!isInitialize && _card.HasStackWhiteRitualAndOtherIconSkill() && skillIconListWithoutDuplicates.Count < 2) + { + return NullVfx.GetInstance(); + } + _inductionLabelNumber = inductionNumber; + bool hasWhiteRitualSkill = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.WhiteRitual); + bool hasWhiteRirualStackSkill = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.StackWhiteRitual); + bool hasInductionSkill = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.Induction); + bool hasInductionNumberSkill = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.InductionNumber); + bool hasKiller = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.Killer); + bool hasDrain = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.Drain); + bool hasWhenDestroySkill = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.Destroy); + bool hasGeton = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.Geton); + bool hasGetonAfter = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.GetonAfter); + int whiteRitualCount = _card.SkillApplyInformation.WhiteRitualCount; + return InstantVfx.Create(delegate + { + if (skillIconList.Count == 0 || isInitialize) + { + InitializeIcon(hasWhiteRitualSkill, hasWhiteRirualStackSkill, whiteRitualCount, hasInductionSkill, hasInductionNumberSkill, hasKiller, hasDrain, hasWhenDestroySkill, hasGeton, hasGetonAfter, isReplay: true, isStackWhiteRitual); + } + else + { + UpdateSkillIcon("white_ritual", "battle_notice_status_08", hasWhiteRitualSkill); + UpdateSkillIcon("stack_white_ritual", "battle_notice_status_11", hasWhiteRirualStackSkill, whiteRitualCount); + UpdateSkillIcon("induction", "battle_notice_status_04", hasInductionSkill); + UpdateSkillIcon("induction_number", "battle_notice_status_04", hasInductionNumberSkill, GetInductionLabelNumber()); + UpdateSkillIcon("killer", "battle_notice_status_01", hasKiller); + UpdateSkillIcon("drain", "battle_notice_status_07", hasDrain); + UpdateSkillIcon("destroy", "battle_notice_status_06", hasWhenDestroySkill); + UpdateSkillIcon("geton", "battle_notice_status_09", hasGeton); + UpdateSkillIcon("geton_after", "battle_notice_status_10", hasGetonAfter); + } + }); + } + + private void UpdateSkillIcon(string key, string spriteName, bool hasIcon, int labelNumber = -1) + { + if (hasIcon && !skillIconList.Any((SkillIcon v) => v._key == key)) + { + AddToIconList(key, spriteName, hasIcon, labelNumber); + } + else if (!hasIcon && skillIconList.Any((SkillIcon v) => v._key == key)) + { + DeleteSkillIcon(key); + } + } + + public void DeleteSkillIcons() + { + if (!(cardTemplate == null)) + { + DeleteSkillIcon("white_ritual"); + DeleteSkillIcon("stack_white_ritual"); + DeleteSkillIcon("induction"); + DeleteSkillIcon("induction_number"); + DeleteSkillIcon("destroy"); + DeleteSkillIcon("killer"); + DeleteSkillIcon("drain"); + DeleteSkillIcon("geton"); + } + } + + public int GetIconListCount() + { + return skillIconListWithoutDuplicates.Count; + } +} diff --git a/SVSim.BattleEngine/Engine/BattleCoroutine.cs b/SVSim.BattleEngine/Engine/BattleCoroutine.cs new file mode 100644 index 0000000..21a6e5c --- /dev/null +++ b/SVSim.BattleEngine/Engine/BattleCoroutine.cs @@ -0,0 +1,52 @@ +using System.Collections; +using UnityEngine; + +public class BattleCoroutine +{ + private static BattleCoroutine m_instance; + + private static MonoBehaviour _coroutineObject; + + public static BattleCoroutine GetInstance() + { + if (m_instance == null) + { + m_instance = new BattleCoroutine(); + } + if (_coroutineObject == null) + { + GameObject gameObject = Object.Instantiate(Resources.Load("Prefab/Game/_BattleCoroutine")) as GameObject; + if (null != gameObject) + { + _coroutineObject = gameObject.GetComponent(); + } + } + return m_instance; + } + + public Coroutine StartCoroutine(IEnumerator enumerator) + { + return _coroutineObject.StartCoroutine(enumerator); + } + + public void StopAllCoroutines() + { + _coroutineObject.StopAllCoroutines(); + } + + public void StopCoroutine(IEnumerator enumerator) + { + if (enumerator != null) + { + _coroutineObject.StopCoroutine(enumerator); + } + } + + public void StopCoroutine(Coroutine enumerator) + { + if (enumerator != null) + { + _coroutineObject.StopCoroutine(enumerator); + } + } +} diff --git a/SVSim.BattleEngine/Engine/BattleFinishSendBase.cs b/SVSim.BattleEngine/Engine/BattleFinishSendBase.cs new file mode 100644 index 0000000..6de0fa6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/BattleFinishSendBase.cs @@ -0,0 +1,49 @@ +using System; +using Cute; +using Wizard; + +public class BattleFinishSendBase +{ + private FinishTaskBase _finishTaskBase; + + private Action _onSuccess; + + private NetworkManager _networkManager; + + private BattleManagerBase _battleMgr; + + public BattleFinishSendBase(BattleManagerBase mgr) + { + _networkManager = Toolbox.NetworkManager; + _battleMgr = mgr; + } + + public void SendMatchingFinish(FinishTaskBase finishTaskBase, Action callbackOnSuccess) + { + _finishTaskBase = finishTaskBase; + SettingFinishBattleParameter(finishTaskBase); + _onSuccess = callbackOnSuccess; + StartMatchingFinish(); + } + + private void StartMatchingFinish() + { + LocalLog.AccumulateLastTraceLog("StartMatchingFinish"); + BattleCoroutine.GetInstance().StartCoroutine(_networkManager.Connect(_finishTaskBase, _onSuccess, CallbackOnFailure, null, encrypt: true, useJson: false, showLoadingIcon: false)); + } + + public void CallbackOnFailure(NetworkTask.ResultCode result) + { + LocalLog.AccumulateTraceLog("CallbackOnFailure" + result); + } + + private void SettingFinishBattleParameter(FinishTaskBase data) + { + int cumulativeEvolutionCount = _battleMgr.BattlePlayer._cumulativeEvolutionCount; + int cumulativeEvolutionCount2 = _battleMgr.BattleEnemy._cumulativeEvolutionCount; + int battle_result = ((!_battleMgr.BattlePlayer.Class.IsDead) ? 1 : 0); + int is_retire = (_battleMgr.IsPlayerRetire ? 1 : 0); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + data.SettingFinishBattleParameter(dataMgr.GetPlayerClassId(), _battleMgr.BattlePlayer.Turn, cumulativeEvolutionCount, cumulativeEvolutionCount2, battle_result, is_retire); + } +} diff --git a/SVSim.BattleEngine/Engine/BattleFinishToOpponentDisConnectChecker.cs b/SVSim.BattleEngine/Engine/BattleFinishToOpponentDisConnectChecker.cs new file mode 100644 index 0000000..5ec3d6b --- /dev/null +++ b/SVSim.BattleEngine/Engine/BattleFinishToOpponentDisConnectChecker.cs @@ -0,0 +1,149 @@ +using System; +using Cute; +using Wizard; + +public class BattleFinishToOpponentDisConnectChecker : NetworkBattleIntervalCheckerBase +{ + private NetworkBattleManagerBase networkBattleManager; + + private DialogBase BattleFinishWaitDialog; + + private SystemText _systemText; + + private int _dispScene; + + private const int WINDOW_DISP_WAIT = 0; + + private const int WINDOW_UPDATE = 1; + + private const int FINISH_SEND_WAIT = 2; + + private const int FINISH_OPPONENT_DISCONNECT_INTERVAL = 8; + + private const int FINISH_OPPONENT_DISP_COUNTER_INTERVAL = 98; + + private const int FINISH_BATTLE_SEND_INTERVAL = 128; + + private bool _isDisconnect; + + public bool IsStart { get; private set; } + + public event Action OnDisConnectWin; + + public BattleFinishToOpponentDisConnectChecker(NetworkBattleManagerBase manager) + { + networkBattleManager = manager; + _systemText = Data.SystemText; + } + + public override void StartChecker(string log = "") + { + if (BattleFinishWaitDialog == null) + { + LocalLog.AccumulateTraceLog("#6911825CreateBattleFinishWaitDialog" + log); + } + base.StartChecker(); + IsStart = true; + CreateBattleFinishWaitDialog(); + BattleFinishWaitDialog.SetActive(inActive: false); + UIManager.GetInstance().closeInSceneNotNetwork(); + } + + public override void StopChecker() + { + base.StopChecker(); + if (BattleFinishWaitDialog != null) + { + BattleFinishWaitDialog.Close(); + LocalLog.AccumulateTraceLog("#691182DialogCloseStopChecker"); + } + UIManager.GetInstance().closeInSceneNotNetwork(); + } + + protected override void IntervalCheck() + { + base.IntervalCheck(); + switch (_dispScene) + { + case 0: + if (!networkBattleManager.VfxMgr.IsEnd) + { + InitTimer(); + } + else if (NetworkUtility.GetTimeSpanSecond(base.startTick) >= 8) + { + if (networkBattleManager.disconnectToLoseChecker.IsDisconnect()) + { + ShowDisconnectAlert(); + } + _dispScene++; + } + break; + case 1: + if (networkBattleManager.disconnectToLoseChecker.IsDisconnect()) + { + ShowDisconnectAlert(); + break; + } + ShowBattleFinishWaitDialog(); + if (NetworkUtility.GetTimeSpanSecond(base.startTick) <= 98) + { + int num = 98 - NetworkUtility.GetTimeSpanSecond(base.startTick); + BattleFinishWaitDialog.SetText(_systemText.Get("Battle_0425", num.ToString() ?? "")); + } + else + { + BattleFinishWaitDialog.SetText(_systemText.Get("Battle_0426")); + _dispScene++; + } + break; + case 2: + if (NetworkUtility.GetTimeSpanSecond(base.startTick) >= 128) + { + BattleFinishWaitDialog.Close(); + LocalLog.AccumulateTraceLog("#691182DialogClose"); + this.OnDisConnectWin.Call(); + StopChecker(); + } + break; + } + } + + private void ShowDisconnectAlert() + { + BattleFinishWaitDialog.SetActive(inActive: false); + if (!_isDisconnect) + { + _isDisconnect = true; + UIManager.GetInstance().closeInSceneNotNetwork(); + BattleManagerBase.GetIns().BattlePlayer.PlayerBattleView.ShowAlert(PanelMgr.BattleAlertType.DisconnectInfomation, isClass: false); + } + } + + private void ShowBattleFinishWaitDialog() + { + if (!BattleFinishWaitDialog.gameObject.activeSelf) + { + LocalLog.AccumulateTraceLog("#691182ShowBattleFinishWaitDialog"); + } + BattleFinishWaitDialog.SetActive(inActive: true); + if (_isDisconnect) + { + _isDisconnect = false; + UIManager.GetInstance().createInSceneNotNetwork(); + BattleManagerBase.GetIns().BattlePlayer.PlayerBattleView.OffNotHideAndNotCreate(); + BattleManagerBase.GetIns().BattlePlayer.PlayerBattleView.HideAlertDialogue(); + } + } + + private void CreateBattleFinishWaitDialog() + { + UIManager.GetInstance().closeInSceneNotNetwork(); + UIManager.GetInstance().createInSceneNotNetwork(); + BattleFinishWaitDialog = UIManager.GetInstance().CreateDialogClose(); + BattleFinishWaitDialog.SetTitleLabel(Data.SystemText.Get("Battle_0423")); + BattleFinishWaitDialog.SetButtonLayout(DialogBase.ButtonLayout.NONE); + BattleFinishWaitDialog.SetFadeButtonEnabled(flag: false); + BattleFinishWaitDialog.SetPanelDepth(5000); + } +} diff --git a/SVSim.BattleEngine/Engine/BattleKeywordInfoListMgr.cs b/SVSim.BattleEngine/Engine/BattleKeywordInfoListMgr.cs new file mode 100644 index 0000000..c0cb71a --- /dev/null +++ b/SVSim.BattleEngine/Engine/BattleKeywordInfoListMgr.cs @@ -0,0 +1,423 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using UnityEngine; +using Wizard; +using Wizard.Battle.View; + +public class BattleKeywordInfoListMgr : MonoBehaviour +{ + private const string KEYWORD = "KEYWORD"; + + private static readonly string[] KEYWORD_PATTERNS = new string[2] { "\\[u\\]\\[(ffcd45|524522)\\](?.*?)\\[-\\]\\[/u\\]", "\\[b\\](?.*?)\\[/b\\]" }; + + private static readonly string KEYWORD_TITLE_REMOVE_PATTERN = "<<\\{me.hand_self.count\\}\\+\\d\\?\\?>>"; + + private const int LABEL_KEYWORD = 0; + + private const int LABEL_DESC = 1; + + private const int LINE_SPRITE = 0; + + private const int PADDING_OBJECT = 1; + + private const int LINE_SPRITE_OFFSET = -12; + + private const int CLASS_EFFECT_TABLE_PADDING_Y = 30; + + private const int CLASS_EFFECT_FONT_SIZE = 21; + + [SerializeField] + public UIScrollView ScrollView; + + [SerializeField] + private NguiObjs SkillInfo; + + [SerializeField] + public UITable _table; + + [SerializeField] + private UIPanel _panel; + + private IList SkillInfoList = new List(); + + private Action ResetTableFinishAction; + + public static IList GetKeywords(CardParameter cardParameter) + { + return GetKeywords(cardParameter.SkillDescription + cardParameter.EvoSkillDescription); + } + + public static IList GetKeywords(string skillDescription) + { + List list = new List(); + for (int i = 0; i < KEYWORD_PATTERNS.Length; i++) + { + foreach (Match item in Regex.Matches(skillDescription, KEYWORD_PATTERNS[i])) + { + string value = item.Groups["KEYWORD"].Value; + if (!list.Contains(value)) + { + list.Add(value); + } + } + } + return list; + } + + public void SetKeywordInfos(IList currentWords, CardMaster.CardMasterId cardMasterId) + { + List list = new List(); + for (int i = 0; i < currentWords.Count; i++) + { + string keywordTitle = string.Empty; + string skillinfo = string.Empty; + string text = currentWords[i]; + string valueOrDefault = Data.Master.BattleKeywordReplaceDic.GetValueOrDefault(text, text); + if (GetKeywordData(valueOrDefault, cardMasterId, out keywordTitle, out skillinfo) && !list.Contains(keywordTitle)) + { + AddKeywordInfo(keywordTitle, skillinfo, LabelDefine.TEXT_COLOR_KEYWORD, cardMasterId); + list.Add(keywordTitle); + } + } + StartCoroutine(RepositionTable()); + } + + public void SetBuffInfos(List baseCardID, List buff) + { + string empty = string.Empty; + for (int i = 0; i < baseCardID.Count; i++) + { + empty = ((CardMaster.GetInstanceForBattle().GetCardParameterFromId(baseCardID[i]).CardName != null && !(CardMaster.GetInstanceForBattle().GetCardParameterFromId(baseCardID[i]).CardName == string.Empty)) ? CardMaster.GetInstanceForBattle().GetCardParameterFromId(baseCardID[i]).CardName : Data.SystemText.Get("BattleLog_0097")); + AddKeywordInfo(empty, buff[i], LabelDefine.TEXT_COLOR_NORMAL, CardMaster.BatttleCardMasterId); + } + StartCoroutine(RepositionTable()); + } + + public IEnumerator RepositionTable() + { + yield return null; + _table.Reposition(); + ScrollView.verticalScrollBar.value = 0f; + ScrollView.ResetPosition(); + if (ResetTableFinishAction != null) + { + ResetTableFinishAction(); + } + } + + public void AddKeywordInfo(string keyword, string desc, Color32 keywordColor, CardMaster.CardMasterId cardMasterId, bool isClassEffect = false, Action onClickCardName = null, bool isKeyWordDisp = true) + { + NguiObjs nguiObjs = UnityEngine.Object.Instantiate(SkillInfo); + keyword = Regex.Replace(keyword, KEYWORD_TITLE_REMOVE_PATTERN, ""); + if (isClassEffect) + { + nguiObjs.labels[0].fontSize = 21; + nguiObjs.labels[1].fontSize = 21; + } + nguiObjs.transform.parent = _table.transform; + nguiObjs.labels[0].text = keyword; + nguiObjs.labels[0].color = keywordColor; + nguiObjs.labels[1].SetWrapText(desc); + nguiObjs.transform.localScale = new Vector3(1f, 1f, 1f); + nguiObjs.gameObject.name = SkillInfoList.Count.ToString(); + nguiObjs.gameObject.SetActive(value: true); + if (isClassEffect) + { + GameObject gameObject = new GameObject("paddingObject"); + gameObject.transform.SetParent(nguiObjs.labels[0].gameObject.transform); + gameObject.transform.localPosition = Vector3.zero; + gameObject.transform.localScale = Vector3.one; + UISprite uISprite = gameObject.AddComponent(); + uISprite.alpha = 0f; + uISprite.height = 30; + gameObject.transform.localPosition = new Vector3(nguiObjs.labels[0].width / 2, gameObject.transform.localPosition.y); + nguiObjs.objs.Add(gameObject); + if (SkillInfoList.Count == 0) + { + gameObject.SetActive(value: false); + } + BoxCollider boxCollider = nguiObjs.labels[1].gameObject.AddComponent(); + boxCollider.size = new Vector3(nguiObjs.labels[1].width, nguiObjs.labels[1].height); + boxCollider.center = new Vector3(nguiObjs.labels[1].width / 2, -nguiObjs.labels[1].height / 2); + List keyWordList = BattlePlayerView.GetKeyWordList(nguiObjs.labels[1].text); + UIEventListener uIEventListener = UIEventListener.Get(nguiObjs.labels[1].gameObject); + uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate + { + if (keyWordList.Count == 0) + { + onClickCardName(); + } + else + { + BattlePlayerView.CreateClassEffectPanel(keyWordList, cardMasterId); + } + }); + BattlePlayerView.SetKeyWordColor(nguiObjs.labels[1].gameObject, nguiObjs.labels[1]); + BoxCollider boxCollider2 = nguiObjs.labels[0].gameObject.AddComponent(); + boxCollider2.size = new Vector3(nguiObjs.labels[0].width, nguiObjs.labels[0].height); + boxCollider2.center = new Vector3(nguiObjs.labels[0].width / 2, -nguiObjs.labels[0].height / 2); + BattlePlayerView.SetLabelColorEvent(nguiObjs.labels[0]); + UIEventListener uIEventListener2 = UIEventListener.Get(nguiObjs.labels[0].gameObject); + uIEventListener2.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener2.onClick, (UIEventListener.VoidDelegate)delegate + { + onClickCardName(); + }); + if (!isKeyWordDisp) + { + nguiObjs.labels[0].gameObject.SetActive(value: false); + nguiObjs.labels[1].transform.localPosition = new Vector3(nguiObjs.labels[1].transform.localPosition.x, nguiObjs.labels[0].transform.localPosition.y); + SkillInfoList[SkillInfoList.Count - 1].objs[0].SetActive(value: false); + } + boxCollider.gameObject.AddComponent().scrollView = ScrollView; + boxCollider2.gameObject.AddComponent().scrollView = ScrollView; + UILabel uILabel = nguiObjs.labels[1]; + uILabel.topAnchor.target = null; + uILabel.bottomAnchor.target = null; + uILabel.leftAnchor.target = null; + uILabel.rightAnchor.target = null; + UISprite component = nguiObjs.objs[0].GetComponent(); + component.topAnchor.target = null; + component.bottomAnchor.target = null; + component.leftAnchor.target = null; + component.rightAnchor.target = null; + component.transform.localPosition = new Vector3(component.transform.localPosition.x, uILabel.transform.localPosition.y - (float)uILabel.height + -12f); + } + SkillInfoList.Add(nguiObjs); + } + + public void RemoveKeyWord(int index) + { + bool activeSelf = SkillInfoList[index].labels[0].gameObject.activeSelf; + UnityEngine.Object.Destroy(SkillInfoList[index].gameObject); + if (SkillInfoList.Count > index + 1) + { + if (!SkillInfoList[index + 1].labels[0].gameObject.activeSelf) + { + Vector3 localPosition = SkillInfoList[index + 1].labels[1].transform.localPosition; + if (activeSelf) + { + SkillInfoList[index + 1].labels[0].gameObject.SetActive(value: true); + } + SkillInfoList[index + 1].labels[1].transform.localPosition = new Vector3(localPosition.x, SkillInfoList[index + 1].labels[0].transform.localPosition.y - (float)SkillInfoList[index + 1].labels[0].height); + SkillInfoList[index + 1].objs[0].transform.localPosition = new Vector3(SkillInfoList[index + 1].objs[0].transform.localPosition.x, -72 - SkillInfoList[index + 1].labels[1].height + -12); + } + } + else if (index - 1 > 0) + { + bool flag = false; + bool flag2 = false; + if (SkillInfoList[index - 1].labels[0].gameObject.activeSelf) + { + flag = true; + if (index + 1 < SkillInfoList.Count && !SkillInfoList[index + 1].labels[0].gameObject.activeSelf) + { + flag2 = true; + } + } + if (flag && !flag2) + { + SkillInfoList[index - 1].objs[0].SetActive(value: true); + } + } + SkillInfoList.RemoveAt(index); + if (SkillInfoList.Count != 0) + { + SkillInfoList[0].objs[1].SetActive(value: false); + } + if (base.gameObject.activeInHierarchy) + { + StartCoroutine(RepositionTable()); + } + } + + public void AddKeywordInfo(BattleCardBase card, string keyword, string desc, Color32 keywordColor) + { + NguiObjs nguiObjs = UnityEngine.Object.Instantiate(SkillInfo); + nguiObjs.transform.parent = _table.transform; + nguiObjs.labels[0].text = keyword; + nguiObjs.labels[0].color = keywordColor; + nguiObjs.labels[1].SetWrapText(desc); + nguiObjs.transform.localScale = new Vector3(1f, 1f, 1f); + nguiObjs.gameObject.name = SkillInfoList.Count.ToString(); + nguiObjs.gameObject.SetActive(value: true); + UIRect[] componentsInChildren = nguiObjs.gameObject.GetComponentsInChildren(); + for (int i = 0; i < componentsInChildren.Length; i++) + { + componentsInChildren[i].ResetAndUpdateAnchors(); + } + SkillInfoList.Add(nguiObjs); + } + + public void SetScrollView(DialogBase dia) + { + UIPanel component = ScrollView.GetComponent(); + GameObject gameObject = dia.WindowSprite.gameObject; + GameObject gameObject2 = dia.titleLine.gameObject; + component.topAnchor.target = gameObject2.transform; + component.topAnchor.relative = 0f; + component.topAnchor.absolute = -10; + component.bottomAnchor.target = gameObject.transform; + component.bottomAnchor.relative = 0f; + component.bottomAnchor.absolute = 25; + component.leftAnchor.target = gameObject.transform; + component.leftAnchor.relative = 0f; + component.leftAnchor.absolute = 25; + component.rightAnchor.target = gameObject.transform; + component.rightAnchor.relative = 1f; + component.rightAnchor.absolute = -25; + gameObject.GetComponent().scrollView = ScrollView; + component.UpdateAnchors(); + } + + private bool GetKeywordData(string skill, CardMaster.CardMasterId cardMasterId, out string keywordTitle, out string skillinfo) + { + keywordTitle = string.Empty; + skillinfo = string.Empty; + if (Data.Master.BattleKeyWordDic.ContainsKey(skill)) + { + string skillToLower = skill.ToLower(); + KeyValuePair keyValuePair = Data.Master.BattleKeyWordDic.First((KeyValuePair data) => data.Key.ToLower() == skillToLower); + keywordTitle = keyValuePair.Key; + skillinfo = keyValuePair.Value; + List cardIdsInDesc = GetCardIdsInDesc(skillinfo); + if (cardIdsInDesc.Count > 0) + { + skillinfo = string.Empty; + for (int num = 0; num < cardIdsInDesc.Count; num++) + { + CardParameter cardParameterFromId = CardMaster.GetInstance(cardMasterId).GetCardParameterFromId(cardIdsInDesc[num]); + if (num > 0) + { + skillinfo += "\n"; + skillinfo += Data.SystemText.Get("Card_0198_BattleKeyWord_01", cardParameterFromId.CardName); + skillinfo += "\n"; + } + skillinfo += GetCardDescText(cardParameterFromId); + } + } + skillinfo = skillinfo.Trim(); + return true; + } + return false; + } + + public static string GetCardDescText(CardParameter param) + { + string empty = string.Empty; + string clanNameByKey = GameMgr.GetIns().GetDataMgr().GetClanNameByKey((int)param.Clan); + string cardTypeName = CardBasePrm.GetCardTypeName(param.CharType); + empty = ((!(param.TribeName == "ALL")) ? (Data.SystemText.Get("Card_0200_BattleKeyWord_03", param.Cost.ToString(), clanNameByKey, param.TribeName, cardTypeName) + "\n") : (Data.SystemText.Get("Card_0199_BattleKeyWord_02", param.Cost.ToString(), clanNameByKey, cardTypeName) + "\n")); + if (param.CharType == CardBasePrm.CharaType.NORMAL || param.CharType == CardBasePrm.CharaType.EVOLUTION) + { + if (!param.IsEvolveChoiceCard) + { + empty = empty + Data.SystemText.Get("Card_0201_BattleKeyWord_04", param.Atk.ToString(), param.Life.ToString()) + "\n"; + if (param.ConvertedSkillDescription != string.Empty) + { + empty = empty + ConvertKeywordsInText(param.ConvertedSkillDescription) + "\n"; + } + } + empty = empty + Data.SystemText.Get("Card_0202_BattleKeyWord_05") + "\n"; + empty = empty + Data.SystemText.Get("Card_0201_BattleKeyWord_04", param.EvoAtk.ToString(), param.EvoLife.ToString()) + "\n"; + if (param.ConvertedEvoSkillDescription != string.Empty) + { + empty = empty + ConvertKeywordsInText(param.ConvertedEvoSkillDescription) + "\n"; + } + } + else + { + empty = empty + ConvertKeywordsInText(param.ConvertedSkillDescription) + "\n"; + } + return empty; + } + + private static string ConvertKeywordsInText(string skilldisc) + { + List list = new List(); + List list2 = new List(); + for (int i = 0; i < KEYWORD_PATTERNS.Length; i++) + { + foreach (Match item2 in Regex.Matches(skilldisc, KEYWORD_PATTERNS[i])) + { + string item = Regex.Escape(item2.Value); + if (list.Contains(item)) + { + continue; + } + string value = item2.Groups["KEYWORD"].Value; + if (Data.Master.BattleKeyWordDic.ContainsKey(value)) + { + List cardIdsInDesc = GetCardIdsInDesc(Data.Master.BattleKeyWordDic[value]); + list.Add(item); + if (cardIdsInDesc.Count > 0) + { + list2.Add(Data.SystemText.Get("Card_0203_BattleKeyWord_06", value)); + } + else + { + list2.Add(value); + } + } + } + } + for (int j = 0; j < list.Count; j++) + { + skilldisc = Regex.Replace(skilldisc, list[j], list2[j]); + } + return Global.ConvertToWithoutBBCode(skilldisc); + } + + public static List GetCardIdsInDesc(string desc) + { + string text = "KEYWORD"; + string pattern = "\\[card\\](?<" + text + ">.*?)\\[/card\\]"; + List list = new List(); + foreach (Match item2 in Regex.Matches(desc, pattern)) + { + int item = int.Parse(item2.Groups[text].Value); + if (!list.Contains(item)) + { + list.Add(item); + } + } + return list; + } + + public List GetKeyWordNameList() + { + List list = new List(SkillInfoList.Count); + for (int i = 0; i < SkillInfoList.Count; i++) + { + list.Add(SkillInfoList[i].labels[0].text); + } + return list; + } + + public IList GetSkillInfoList() + { + return SkillInfoList; + } + + public float GetScrollViewSizeY() + { + return ScrollView.GetComponent().GetViewSize().y; + } + + public void SetResetTableFinishAction(Action inAction) + { + ResetTableFinishAction = inAction; + } + + public void SetKeyWordFocus(float inScrollBarValue) + { + ScrollView.verticalScrollBar.value = inScrollBarValue; + } + + public void SetPanelDepth(int depth) + { + _panel.depth = depth; + } +} diff --git a/SVSim.BattleEngine/Engine/BattlePlayerVfxCreatorBase.cs b/SVSim.BattleEngine/Engine/BattlePlayerVfxCreatorBase.cs new file mode 100644 index 0000000..f1dfb94 --- /dev/null +++ b/SVSim.BattleEngine/Engine/BattlePlayerVfxCreatorBase.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class BattlePlayerVfxCreatorBase : IBattlePlayerVfxCreator +{ + private readonly IBattlePlayerView m_battleView; + + public BattlePlayerVfxCreatorBase(IBattlePlayerView battleView) + { + m_battleView = battleView; + } + + public VfxBase CreateUsePp(int pp, int maxPp, Vector3 labelPosition, bool newReplayMoveTurn) + { + if (newReplayMoveTurn) + { + return ParallelVfxPlayer.Create(InstantVfx.Create(delegate + { + m_battleView.StatusParentPanel.GetComponent().SetPp(pp, maxPp, newReplayMoveTurn); + })); + } + return ParallelVfxPlayer.Create(new LoadAndPlayEffectVfx("cmn_ui_cost_1", null, labelPosition, 0f), InstantVfx.Create(delegate + { + m_battleView.StatusParentPanel.GetComponent().SetPp(pp, maxPp, newReplayMoveTurn); + })); + } + + public VfxBase CreateUseBp(int bp, int deltaBp, Func getPosition, bool isVariableCost, bool isSelf) + { + if (BattleManagerBase.GetIns().IsRecovery || isVariableCost) + { + return ParallelVfxPlayer.Create(m_battleView.SetBp(bp)); + } + string fileName = ((deltaBp < 0) ? "cmn_ui_hbp_2" : "cmn_ui_hbp_1"); + if (deltaBp < 0 && isSelf) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_HBP_UP); + } + return ParallelVfxPlayer.Create(new LoadAndPlayEffectVfx(fileName, null, getPosition, 0f, BattleManagerBase.GetIns().Battle3DContainer.layer), m_battleView.SetBp(bp)); + } + + public VfxBase CreateUpdateEp(int evolCount, int evolveWaitTurnCount) + { + return new UpdateEpVfx(m_battleView, evolCount, evolveWaitTurnCount); + } + + public VfxBase CreateCardDraw(IEnumerable cards, bool isOpenDrawSkill) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + foreach (BattleCardBase card in cards) + { + if (card.BaseCost != card.Cost) + { + List costList = card.BattleCardView.GetUseCostList(card.Cost); + bool isInHand = card.IsInHand; + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + card.BattleCardView.UpdateCost(costList, isGenerateInHand: true, playEffect: true, isInHand); + })); + } + } + sequentialVfxPlayer.Register(new PlayerDrawCardVfx(cards, isOpenDrawSkill)); + sequentialVfxPlayer.Register(new PlayerEndDrawVfx(cards)); + return sequentialVfxPlayer; + } +} diff --git a/SVSim.BattleEngine/Engine/BattleSettingBaseData.cs b/SVSim.BattleEngine/Engine/BattleSettingBaseData.cs new file mode 100644 index 0000000..fdd5c18 --- /dev/null +++ b/SVSim.BattleEngine/Engine/BattleSettingBaseData.cs @@ -0,0 +1,36 @@ +using LitJson; + +public class BattleSettingBaseData +{ + public int PlayerCharaId { get; } + + public int EnemyCharaId { get; } + + public int EnemyClassId { get; } + + public int EnemyAiId { get; } + + public int FieldId { get; } + + public string BgmId { get; } + + public BattleSettingBaseData(JsonData jsonData) + { + PlayerCharaId = jsonData["chara_id"].ToInt(); + EnemyCharaId = jsonData["enemy_chara_id"].ToInt(); + EnemyClassId = jsonData["enemy_class"].ToInt(); + EnemyAiId = jsonData["enemy_ai_id"].ToInt(); + FieldId = jsonData["battle3dfield_id"].ToInt(); + BgmId = GetBgmId(jsonData); + } + + private static string GetBgmId(JsonData jsonData) + { + string text = jsonData["bgm_id"].ToString(); + if (!(text == "0")) + { + return text; + } + return "NONE"; + } +} diff --git a/SVSim.BattleEngine/Engine/BattleSettingData.cs b/SVSim.BattleEngine/Engine/BattleSettingData.cs new file mode 100644 index 0000000..0e6e4c8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/BattleSettingData.cs @@ -0,0 +1,157 @@ +using LitJson; + +public class BattleSettingData +{ + public int DeckClassId { get; } + + public int DeckSkinId { get; } + + public int PlayerCharaId { get; } + + public string PlayerEmotionId { get; } + + public int EnemyCharaId { get; } + + public string EnemyEmotionId { get; } + + public int EnemyClassId { get; } + + public int EnemyAiId { get; } + + public int FieldId { get; } + + public string BgmId { get; } + + public BattleSettingData(JsonData jsonData, BattleSettingBaseData baseData) + { + DeckClassId = jsonData["deck_class_id"].ToInt(); + DeckSkinId = GetDeckSkinId(jsonData, DeckClassId); + PlayerCharaId = GetPlayerCharaId(jsonData, baseData.PlayerCharaId, DeckClassId); + PlayerEmotionId = GetPlayerEmotionId(jsonData, PlayerCharaId); + EnemyCharaId = baseData.EnemyCharaId; + EnemyEmotionId = GetEnemyEmotionId(jsonData, EnemyCharaId); + EnemyClassId = baseData.EnemyClassId; + EnemyAiId = baseData.EnemyAiId; + FieldId = GetFieldId(jsonData, baseData.FieldId); + BgmId = GetBgmId(jsonData, baseData.BgmId); + } + + private static int GetDeckSkinId(JsonData jsonData, int deckClassId) + { + int num = jsonData["deck_skin_id_override"].ToInt(); + if (num == 0) + { + return GameMgr.GetIns().GetDataMgr().GetCharaPrmByClassId(deckClassId, isCurrentChara: false) + .skin_id; + } + return num; + } + + private static int GetPlayerCharaId(JsonData jsonData, int baseCharaId, int classId) + { + int? overridePlayerCharaId = GetOverridePlayerCharaId(jsonData); + if (overridePlayerCharaId.HasValue) + { + return overridePlayerCharaId.Value; + } + if (baseCharaId == 0) + { + return GameMgr.GetIns().GetDataMgr().GetCharaPrmByClassId(classId, isCurrentChara: false) + .chara_id; + } + return baseCharaId; + } + + private static int? GetOverridePlayerCharaId(JsonData jsonData) + { + int num = jsonData["skin_id_override"].ToInt(); + if (num == 0) + { + return null; + } + return num; + } + + private static string GetPlayerEmotionId(JsonData jsonData, int charaId) + { + int? overridePlayerEmotionId = GetOverridePlayerEmotionId(jsonData); + return GetEmotionId(charaId, overridePlayerEmotionId); + } + + private static int? GetOverridePlayerEmotionId(JsonData jsonData) + { + int num = jsonData["player_emotion_override"].ToInt(); + if (num == 0) + { + return null; + } + return num; + } + + private static string GetEnemyEmotionId(JsonData jsonData, int charaId) + { + int? overrideEnemyEmotionId = GetOverrideEnemyEmotionId(jsonData); + return GetEmotionId(charaId, overrideEnemyEmotionId); + } + + private static int? GetOverrideEnemyEmotionId(JsonData jsonData) + { + int num = jsonData["enemy_emotion_override"].ToInt(); + if (num == 0) + { + return null; + } + return num; + } + + private static string GetEmotionId(int charaId, int? variationId) + { + int skin_id = GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId(charaId) + .skin_id; + if (!variationId.HasValue) + { + return $"{skin_id}"; + } + return $"{skin_id}_{variationId.Value}"; + } + + private static int GetFieldId(JsonData jsonData, int baseFieldId) + { + int? overrideFieldId = GetOverrideFieldId(jsonData); + if (!overrideFieldId.HasValue) + { + return baseFieldId; + } + return overrideFieldId.Value; + } + + private static int? GetOverrideFieldId(JsonData jsonData) + { + int num = jsonData["battle3dfield_id_override"].ToInt(); + if (num == 0) + { + return null; + } + return num; + } + + private static string GetBgmId(JsonData jsonData, string baseBgmId) + { + string overrideBgmId = GetOverrideBgmId(jsonData); + if (overrideBgmId == null) + { + return baseBgmId; + } + return overrideBgmId; + } + + private static string GetOverrideBgmId(JsonData jsonData) + { + string text = jsonData["bgm_id_override"].ToString(); + if (!(text != "0")) + { + return null; + } + return text; + } +} diff --git a/SVSim.BattleEngine/Engine/BattleStageChoiceObject.cs b/SVSim.BattleEngine/Engine/BattleStageChoiceObject.cs new file mode 100644 index 0000000..0a7a6f1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/BattleStageChoiceObject.cs @@ -0,0 +1,36 @@ +using System; +using UnityEngine; + +public class BattleStageChoiceObject : MonoBehaviour +{ + [SerializeField] + private UIButton _button; + + [SerializeField] + private UITexture _texture; + + [SerializeField] + private GameObject _offObject; + + public Action _onButton; + + public void Init() + { + UIEventListener.Get(_button.gameObject).onClick = null; + UIEventListener uIEventListener = UIEventListener.Get(_button.gameObject); + uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate + { + _onButton(); + }); + } + + public void SettingOffSelect(bool isOff) + { + _offObject.gameObject.SetActive(isOff); + } + + public void SettingTexture(Texture texture) + { + _texture.mainTexture = texture; + } +} diff --git a/SVSim.BattleEngine/Engine/BattleStageChoiceWindow.cs b/SVSim.BattleEngine/Engine/BattleStageChoiceWindow.cs new file mode 100644 index 0000000..70b4c79 --- /dev/null +++ b/SVSim.BattleEngine/Engine/BattleStageChoiceWindow.cs @@ -0,0 +1,468 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; + +public class BattleStageChoiceWindow : MonoBehaviour +{ + public class PageData + { + public readonly GameObject Obj; + + public BattleStageChoiceObject[] StageList; + + public PageData(BattleStageChoiceObject[] stageList, GameObject obj) + { + StageList = stageList; + Obj = obj; + } + } + + public class StageData + { + public GameObject StageDataObject; + + public string TextureName; + + public StageData(GameObject obj, string textureName) + { + StageDataObject = obj; + TextureName = textureName; + } + } + + private bool _initializeEnd; + + [SerializeField] + private UIButton _leftButton; + + [SerializeField] + private UIButton _rightButton; + + [SerializeField] + private UIButton _allOffButton; + + [SerializeField] + private BoxCollider _flickCollider; + + [SerializeField] + private UIGrid _radioIconsGrid; + + [SerializeField] + private UIGrid _deckTableOriginal; + + [SerializeField] + private GameObject _deckTableRoot; + + private List _stagePageList = new List(); + + [SerializeField] + private BattleStageChoiceObject _battleTageSelectOriginal; + + [SerializeField] + private UISprite _radioIconOriginal; + + [SerializeField] + private GameObject _allOnLabel; + + [SerializeField] + private GameObject _allOffLabel; + + private int _currentPage; + + private bool _isChangePage; + + private float _timeChangePage; + + private List _radioIconClones; + + private List _pageList = new List(); + + private int _maxSelectStageNum; + + private bool _isScroll = true; + + private int _loadDoneStageTextureNum; + + private const int MAXNUM_STAGE_PER_TABLE = 9; + + private List _loadedResourceList = new List(); + + public bool[] SettingOffStageIndexs { get; private set; } + + public Action OnAllOff { get; set; } + + private void Update() + { + if (_isChangePage) + { + _timeChangePage += Time.deltaTime; + if (_timeChangePage >= 0.2f) + { + _isChangePage = false; + _timeChangePage = 0f; + } + } + } + + public IEnumerator LoadResource(Action onLoadEnd) + { + UIManager.GetInstance().createInSceneCenterLoading(); + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + for (int i = 0; i < Data.Load.data.OpenBattleFieldIdList.Count; i++) + { + string path = "BattleStage_" + int.Parse(Data.Load.data.OpenBattleFieldIdList[i]).ToString("00"); + _loadedResourceList.Add(resourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.BattlePass)); + } + yield return StartCoroutine(resourcesManager.LoadAssetGroupAsync(_loadedResourceList, null)); + UIManager.GetInstance().closeInSceneCenterLoading(); + onLoadEnd.Call(); + } + + public void Initialize() + { + if (_initializeEnd) + { + return; + } + _initializeEnd = true; + PlayerPrefsWrapper.TurnOnFirsStageIfStageIdListAllOff(); + _maxSelectStageNum = Data.Load.data.OpenBattleFieldIdList.Count; + if (_maxSelectStageNum <= 9) + { + _isScroll = false; + } + else + { + _isScroll = true; + } + if (_isScroll) + { + UIEventListener uIEventListener = UIEventListener.Get(_flickCollider.gameObject); + uIEventListener.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener.onDrag, new UIEventListener.VectorDelegate(OnDragPanel)); + UIEventListener uIEventListener2 = UIEventListener.Get(_rightButton.gameObject); + uIEventListener2.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener2.onClick, (UIEventListener.VoidDelegate)delegate + { + NextPage(); + }); + UIEventListener uIEventListener3 = UIEventListener.Get(_leftButton.gameObject); + uIEventListener3.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener3.onClick, (UIEventListener.VoidDelegate)delegate + { + PrevPage(); + }); + } + UIEventListener uIEventListener4 = UIEventListener.Get(_allOffButton.gameObject); + uIEventListener4.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener4.onClick, (UIEventListener.VoidDelegate)delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + if (IsAllOff()) + { + for (int i = 0; i < SettingOffStageIndexs.Length; i++) + { + SettingOffStageIndexs[i] = false; + } + _allOnLabel.gameObject.SetActive(value: false); + _allOffLabel.gameObject.SetActive(value: true); + OnAllOff(obj: false); + } + else + { + for (int j = 0; j < SettingOffStageIndexs.Length; j++) + { + SettingOffStageIndexs[j] = true; + } + _allOnLabel.gameObject.SetActive(value: true); + _allOffLabel.gameObject.SetActive(value: false); + OnAllOff(obj: true); + } + UpdateStageOffView(); + }); + _radioIconClones = new List(); + SettingOffStageIndexs = new bool[_maxSelectStageNum]; + int num = _maxSelectStageNum; + _loadDoneStageTextureNum = 0; + int num2 = 1 + num / 9; + for (int num3 = 0; num3 < num2; num3++) + { + int num4 = num; + if (num4 >= 9) + { + num4 = 9; + } + AddStageTable(num3, num4); + num -= 9; + if (num <= 0) + { + break; + } + } + if (!_isScroll) + { + _leftButton.gameObject.SetActive(value: false); + _rightButton.gameObject.SetActive(value: false); + } + for (int num5 = 0; num5 < _stagePageList.Count; num5++) + { + _stagePageList[num5].Reposition(); + } + foreach (PageData page in _pageList) + { + page.Obj.SetActive(value: false); + } + _pageList[_currentPage].Obj.SetActive(value: true); + SettingOffStageIndexs = ConvertSaveDataToStageIndexList(); + UpdateStageOffView(); + UpdateAllOnOffLabel(); + UpdateRadioButtonView(); + } + + private bool[] ConvertSaveDataToStageIndexList() + { + string[] array = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.OFF_STAGE_ID).Split(','); + bool[] array2 = new bool[_maxSelectStageNum]; + for (int i = 0; i < array.Length; i++) + { + for (int j = 0; j < _maxSelectStageNum; j++) + { + if (array[i] == Data.Load.data.OpenBattleFieldIdList[j].ToString()) + { + array2[j] = true; + break; + } + } + } + return array2; + } + + public void SaveSetting() + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.OFF_STAGE_ID, PlayerPrefsWrapper.ConvertStageIdListToSaveData(SettingOffStageIndexs)); + } + + private void UpdateStageOffView() + { + int num = 0; + foreach (PageData page in _pageList) + { + BattleStageChoiceObject[] stageList = page.StageList; + foreach (BattleStageChoiceObject battleStageChoiceObject in stageList) + { + if (SettingOffStageIndexs[num]) + { + battleStageChoiceObject.SettingOffSelect(isOff: true); + } + else + { + battleStageChoiceObject.SettingOffSelect(isOff: false); + } + num++; + } + } + } + + private void UpdateAllOnOffLabel() + { + if (IsAllOff()) + { + _allOnLabel.gameObject.SetActive(value: true); + _allOffLabel.gameObject.SetActive(value: false); + OnAllOff(obj: true); + } + else + { + _allOnLabel.gameObject.SetActive(value: false); + _allOffLabel.gameObject.SetActive(value: true); + OnAllOff(obj: false); + } + } + + private bool IsAllOff() + { + bool result = true; + for (int i = 0; i < _maxSelectStageNum; i++) + { + if (!SettingOffStageIndexs[i]) + { + result = false; + break; + } + } + return result; + } + + private void AddStageTable(int tableIndex, int createNum) + { + BattleStageChoiceObject[] array = new BattleStageChoiceObject[createNum]; + UIGrid uIGrid = UnityEngine.Object.Instantiate(_deckTableOriginal); + uIGrid.transform.parent = _deckTableRoot.transform; + uIGrid.transform.localScale = Vector3.one; + uIGrid.transform.localPosition = Vector3.zero; + int num = 0; + uIGrid.sorting = UIGrid.Sorting.Custom; + _stagePageList.Add(uIGrid); + for (int i = 0; i < createNum; i++) + { + string textureId = Data.Load.data.OpenBattleFieldIdList[_loadDoneStageTextureNum]; + BattleStageChoiceObject battleStageChoiceObject = CreateStageFrame(tableIndex * 9 + i, textureId); + _loadDoneStageTextureNum++; + uIGrid.AddChild(battleStageChoiceObject.transform); + battleStageChoiceObject.transform.localScale = Vector3.one; + battleStageChoiceObject.gameObject.name = (num + i).ToString(); + array[i] = battleStageChoiceObject; + } + if (_isScroll) + { + UISprite uISprite = UnityEngine.Object.Instantiate(_radioIconOriginal); + _radioIconClones.Add(uISprite); + _radioIconsGrid.AddChild(uISprite.transform); + uISprite.transform.localScale = Vector3.one; + } + PageData item = new PageData(array, uIGrid.gameObject); + _pageList.Add(item); + } + + private BattleStageChoiceObject CreateStageFrame(int index, string textureId) + { + BattleStageChoiceObject battleStageChoiceObject = UnityEngine.Object.Instantiate(_battleTageSelectOriginal); + battleStageChoiceObject.Init(); + UIEventListener uIEventListener = UIEventListener.Get(battleStageChoiceObject.gameObject); + uIEventListener.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener.onPress, (UIEventListener.BoolDelegate)delegate(GameObject g, bool b) + { + StartCoroutine(PushedAnimation(g)); + }); + battleStageChoiceObject._onButton = (Action)Delegate.Combine(battleStageChoiceObject._onButton, (Action)delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + SettingOffStageIndexs[index] = !SettingOffStageIndexs[index]; + UpdateStageOffView(); + UpdateAllOnOffLabel(); + }); + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + string path = "BattleStage_" + int.Parse(textureId).ToString("00"); + Texture texture = resourcesManager.LoadObject(resourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.BattleStage, isfetch: true)); + battleStageChoiceObject.SettingTexture(texture); + UIEventListener uIEventListener2 = UIEventListener.Get(battleStageChoiceObject.gameObject); + uIEventListener2.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener2.onDrag, new UIEventListener.VectorDelegate(OnDragPanel)); + return battleStageChoiceObject; + } + + private void OnDragPanel(GameObject obj, Vector2 dir) + { + if (_isScroll) + { + if (dir.x >= 70f) + { + PrevPage(); + } + else if (dir.x <= -70f) + { + NextPage(); + } + } + } + + private void NextPage() + { + if (ChangePage(_currentPage + 1)) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + } + } + + private void PrevPage() + { + if (ChangePage(_currentPage - 1)) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + } + } + + private bool ChangePage(int newPage, bool isImmediate = false) + { + int currentPage = _currentPage; + if (_isChangePage) + { + return false; + } + int count = _radioIconClones.Count; + bool flag = false; + if (newPage < 0) + { + newPage = count - 1; + flag = true; + } + if (newPage >= count) + { + newPage = 0; + flag = true; + } + if (currentPage == newPage) + { + isImmediate = true; + } + _currentPage = newPage; + foreach (PageData page in _pageList) + { + page.Obj.SetActive(value: false); + } + _pageList[_currentPage].Obj.SetActive(value: true); + _pageList[currentPage].Obj.SetActive(value: true); + float num = ((_currentPage < currentPage) ? 1400f : (-1400f)); + if (flag) + { + num = 0f - num; + } + Vector3 pos = new Vector3(num, 0f, 0f); + Vector3 localPosition = new Vector3(0f - num, 0f, 0f); + Vector3 zero = Vector3.zero; + _pageList[_currentPage].Obj.transform.localPosition = localPosition; + TweenPosition.Begin(_pageList[currentPage].Obj, isImmediate ? 0f : 0.2f, pos); + TweenPosition.Begin(_pageList[_currentPage].Obj, isImmediate ? 0f : 0.2f, zero); + if (!isImmediate) + { + _isChangePage = true; + } + UpdateRadioButtonView(); + bool flag2; + bool active = (flag2 = _pageList.Count >= 2) || flag2; + _radioIconsGrid.gameObject.SetActive(active); + return true; + } + + private void UpdateRadioButtonView() + { + for (int i = 0; i < _radioIconClones.Count; i++) + { + if (i == _currentPage) + { + _radioIconClones[i].spriteName = _radioIconClones[i].spriteName.Replace("_off", "_on"); + } + else + { + _radioIconClones[i].spriteName = _radioIconClones[i].spriteName.Replace("_on", "_off"); + } + } + } + + private IEnumerator PushedAnimation(GameObject obj) + { + TweenScale scl = obj.GetComponent(); + if ((bool)scl) + { + scl.PlayForward(); + while (Input.GetMouseButton(0)) + { + yield return null; + } + scl.PlayReverse(); + } + } + + private void OnDestroy() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList); + _loadedResourceList = null; + } +} diff --git a/SVSim.BattleEngine/Engine/BattleStopChecker.cs b/SVSim.BattleEngine/Engine/BattleStopChecker.cs new file mode 100644 index 0000000..1c176e0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/BattleStopChecker.cs @@ -0,0 +1,24 @@ +using System; +using Cute; + +public class BattleStopChecker : NetworkBattleIntervalCheckerBase +{ + private const int JUDGE_RESULT_RETRY_TIMER = 95; + + public event Action OnBattleStop; + + public override void StopChecker() + { + base.StopChecker(); + } + + protected override void IntervalCheck() + { + base.IntervalCheck(); + if (NetworkUtility.GetTimeSpanSecond(base.startTick) >= 95) + { + this.OnBattleStop.Call(); + StartChecker(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/BattleUtility.cs b/SVSim.BattleEngine/Engine/BattleUtility.cs new file mode 100644 index 0000000..6839c82 --- /dev/null +++ b/SVSim.BattleEngine/Engine/BattleUtility.cs @@ -0,0 +1,67 @@ +using System.Collections.Generic; +using System.Linq; + +public static class BattleUtility +{ + public class RepeatSkillsAndTiming + { + public List _skills; + + public List _timings; + + public RepeatSkillsAndTiming(List skills, List timings) + { + _timings = timings; + _skills = skills; + } + } + + public static RepeatSkillsAndTiming GetRepeatSkillsWithTiming(List skills) + { + if (skills == null || skills.Count == 0) + { + return null; + } + BattleCardBase ownerCard = skills.First().SkillPrm.ownerCard; + return GetRepeatSkillsWithTiming(ownerCard.SelfBattlePlayer, ownerCard, skills); + } + + public static List GetRepeatSkillsForPrediction(BattlePlayerBase sourcePlayer, BattleCardBase virtualCard) + { + if (virtualCard.Skills == null || virtualCard.Skills.Count() == 0) + { + return null; + } + return GetRepeatSkillsWithTiming(sourcePlayer, virtualCard, virtualCard.Skills.ToList())?._skills; + } + + public static List GetRepeatableWhenPlaySkill(BattleCardBase ownerCard, List activeSkills, bool isInvokeCheck) + { + if (ownerCard.Skills.Any((SkillBase s) => s.IsUserSelectType && !(s is Skill_fusion))) + { + return null; + } + if (isInvokeCheck && !ownerCard.HasSkillWhenPlay(isOnlyNoSelect: true)) + { + return null; + } + if (activeSkills.Count == 1 && activeSkills.Any((SkillBase s) => s is Skill_pp_fixeduse)) + { + return null; + } + return activeSkills.Where((SkillBase c) => c.OnWhenPlayStart != 0).ToList(); + } + + private static RepeatSkillsAndTiming GetRepeatSkillsWithTiming(BattlePlayerBase player, BattleCardBase ownerCard, List activeSkills) + { + List list = new List(); + List list2 = new List(); + IEnumerable enumerable = activeSkills.Where((SkillBase s) => s.IsWhenDestroySkill); + if (player.Class.SkillApplyInformation.RepeatSkillTimingList.Any((RepeatSkillInfo s) => s.Timing == "when_destroy" && Skill_repeat_skill.CheckCardType(s.Target, ownerCard)) && enumerable.Count() > 0) + { + list.AddRange(enumerable); + list2.Add("when_destroy"); + } + return new RepeatSkillsAndTiming(list, list2); + } +} diff --git a/SVSim.BattleEngine/Engine/BetterList.cs b/SVSim.BattleEngine/Engine/BetterList.cs new file mode 100644 index 0000000..3953ba8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/BetterList.cs @@ -0,0 +1,229 @@ +using System.Collections.Generic; +using System.Diagnostics; +using UnityEngine; + +public class BetterList +{ + public delegate int CompareFunc(T left, T right); + + public T[] buffer; + + public int size; + + [DebuggerHidden] + public T this[int i] + { + get + { + return buffer[i]; + } + set + { + buffer[i] = value; + } + } + + [DebuggerHidden] + [DebuggerStepThrough] + public IEnumerator GetEnumerator() + { + if (buffer != null) + { + int i = 0; + while (i < size) + { + yield return buffer[i]; + int num = i + 1; + i = num; + } + } + } + + private void AllocateMore() + { + T[] array = ((buffer != null) ? new T[Mathf.Max(buffer.Length << 1, 32)] : new T[32]); + if (buffer != null && size > 0) + { + buffer.CopyTo(array, 0); + } + buffer = array; + } + + private void Trim() + { + if (size > 0) + { + if (size < buffer.Length) + { + T[] array = new T[size]; + for (int i = 0; i < size; i++) + { + array[i] = buffer[i]; + } + buffer = array; + } + } + else + { + buffer = null; + } + } + + public void Clear() + { + size = 0; + } + + public void Release() + { + size = 0; + buffer = null; + } + + public void Add(T item) + { + if (buffer == null || size == buffer.Length) + { + AllocateMore(); + } + buffer[size++] = item; + } + + public void Insert(int index, T item) + { + if (buffer == null || size == buffer.Length) + { + AllocateMore(); + } + if (index > -1 && index < size) + { + for (int num = size; num > index; num--) + { + buffer[num] = buffer[num - 1]; + } + buffer[index] = item; + size++; + } + else + { + Add(item); + } + } + + public bool Contains(T item) + { + if (buffer == null) + { + return false; + } + for (int i = 0; i < size; i++) + { + ref readonly T reference = ref buffer[i]; + object obj = item; + if (reference.Equals(obj)) + { + return true; + } + } + return false; + } + + public int IndexOf(T item) + { + if (buffer == null) + { + return -1; + } + for (int i = 0; i < size; i++) + { + ref readonly T reference = ref buffer[i]; + object obj = item; + if (reference.Equals(obj)) + { + return i; + } + } + return -1; + } + + public bool Remove(T item) + { + if (buffer != null) + { + EqualityComparer equalityComparer = EqualityComparer.Default; + for (int i = 0; i < size; i++) + { + if (equalityComparer.Equals(buffer[i], item)) + { + size--; + buffer[i] = default(T); + for (int j = i; j < size; j++) + { + buffer[j] = buffer[j + 1]; + } + buffer[size] = default(T); + return true; + } + } + } + return false; + } + + public void RemoveAt(int index) + { + if (buffer != null && index > -1 && index < size) + { + size--; + buffer[index] = default(T); + for (int i = index; i < size; i++) + { + buffer[i] = buffer[i + 1]; + } + buffer[size] = default(T); + } + } + + public T Pop() + { + if (buffer != null && size != 0) + { + T result = buffer[--size]; + buffer[size] = default(T); + return result; + } + return default(T); + } + + public T[] ToArray() + { + Trim(); + return buffer; + } + + [DebuggerHidden] + [DebuggerStepThrough] + public void Sort(CompareFunc comparer) + { + int num = 0; + int num2 = size - 1; + bool flag = true; + while (flag) + { + flag = false; + for (int i = num; i < num2; i++) + { + if (comparer(buffer[i], buffer[i + 1]) > 0) + { + T val = buffer[i]; + buffer[i] = buffer[i + 1]; + buffer[i + 1] = val; + flag = true; + } + else if (!flag) + { + num = ((i != 0) ? (i - 1) : 0); + } + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/BothBattlePlayerFilter.cs b/SVSim.BattleEngine/Engine/BothBattlePlayerFilter.cs new file mode 100644 index 0000000..996a745 --- /dev/null +++ b/SVSim.BattleEngine/Engine/BothBattlePlayerFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using Wizard; + +public class BothBattlePlayerFilter : ISkillBattlePlayerFilter +{ + public IEnumerable Filtering(BattlePlayerReadOnlyInfoPair playerInfoPair) + { + yield return playerInfoPair.ReadOnlySelf; + yield return playerInfoPair.ReadOnlyOpponent; + } +} diff --git a/SVSim.BattleEngine/Engine/CardCreatorBase.cs b/SVSim.BattleEngine/Engine/CardCreatorBase.cs new file mode 100644 index 0000000..467c2c8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CardCreatorBase.cs @@ -0,0 +1,404 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Battle; +using Wizard.Battle.Card; +using Wizard.Battle.Resource; + +public class CardCreatorBase +{ + private class CardTypeBuildInfo + { + public bool isActive; + + public Vector3 localPosition; + + public Vector3 localScale; + + public Quaternion localRotation; + + public Transform parent; + } + + private readonly GameObject _cardRootObject; + + protected static Dictionary _classIconCache = new Dictionary(); + + private static BattleCardBase _dummyCardInstance; + + public static Material GetSharedClassIconMaterial(CardBasePrm.ClanType clanType) + { + Material material; + if (_classIconCache.ContainsKey(clanType)) + { + material = _classIconCache[clanType]; + if (material == null || material.mainTexture == null) + { + if (material != null) + { + Object.Destroy(material); + } + _classIconCache.Remove(clanType); + } + material = null; + } + if (_classIconCache.ContainsKey(clanType)) + { + material = _classIconCache[clanType]; + } + else + { + material = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("CardFrameClassIcon", ResourcesManager.AssetLoadPathType.CardFrameMaterialPlus, isfetch: true)) as Material); + material.mainTexture = ClassCharaPrm.GetClassIconTexture((int)clanType); + _classIconCache[clanType] = material; + } + return material; + } + + public CardCreatorBase(GameObject cardRootObject) + { + _cardRootObject = cardRootObject; + } + + public GameObject LoadRootObject() + { + return _cardRootObject; + } + + public static BattleCardBase CreateCard(int cardId, bool isPlayer, int index, SBattleLoad sBattleLoad, BattleManagerBase battleMgr, IBattleResourceMgr resourceMgr, IInnerOptionsBuilder innerOptionsBuilder, bool isChoiceBrave = false) + { + bool flag = !isPlayer; + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId); + CardBasePrm.CharaType charType = cardParameterFromId.CharType; + CardCreatorBase cardCreatorBase = null; + switch (charType) + { + case CardBasePrm.CharaType.NORMAL: + cardCreatorBase = new UnitCardCreator(sBattleLoad.UnitCardTemplate.gameObject); + break; + case CardBasePrm.CharaType.FIELD: + case CardBasePrm.CharaType.CHANT_FIELD: + cardCreatorBase = new FieldCardCreator(sBattleLoad.FieldCardTemplate.gameObject); + break; + case CardBasePrm.CharaType.SPELL: + cardCreatorBase = new SpellCardCreator(sBattleLoad.SpellCardTemplate.gameObject); + break; + default: + return null; + } + GameObject gobj = cardCreatorBase.LoadRootObject(); + GameObject gameObject = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(gobj, BattleManagerBase.GetIns().Battle3DContainer); + CardTemplate component = gameObject.GetComponent(); + if (flag && !GameMgr.GetIns().IsWatchBattle && !sBattleLoad.isDbgEnableEnemyHandView && !GameMgr.GetIns().IsAdmin) + { + gameObject.GetComponent().CardNormalLodGroup.enabled = false; + } + GameObject gameObject2 = component.CardNormalTemp.gameObject; + if (charType == CardBasePrm.CharaType.NORMAL) + { + gameObject2.SetActive(value: false); + } + component.NormalCardBaseMeshTemp.sharedMaterial = resourceMgr.GetSleeveMaterial(isPlayer); + if (charType == CardBasePrm.CharaType.NORMAL) + { + component.EvolCardBaseMeshTemp.sharedMaterial = resourceMgr.GetSleeveMaterial(isPlayer); + } + Transform transform = gameObject.transform.Find("CardObj"); + Transform transform2 = gameObject.transform.Find("Collider"); + string tag = (transform.tag = (gameObject2.tag = (flag ? "Enemy" : "Player"))); + transform2.tag = tag; + GameObject gameObject3 = null; + if (component.LifeLabelTemp != null) + { + gameObject3 = component.LifeLabelTemp.transform.parent.gameObject; + } + UILabel lifeLabelTemp = component.LifeLabelTemp; + if (lifeLabelTemp != null) + { + lifeLabelTemp.text = cardParameterFromId.Life.ToString(); + } + if (gameObject3 != null) + { + gameObject3.SetActive(value: false); + } + if (isChoiceBrave) + { + component.SetEffectColor(Global.CARD_HBP_LABEL_COST_COLOR); + } + if (cardParameterFromId.IsVariableCost) + { + component.NormalSignLabelTemp.text = "-"; + component.NormalSignedCostLabelTemp.text = "X"; + component.ShowSignedCostLabel(); + component.NormalChoiceBraveNameLabelTemp.text = cardParameterFromId.CardName; + component.ShowChoiceBraveNameLabel(); + } + else if (isChoiceBrave) + { + if (cardParameterFromId.Cost != 0) + { + component.NormalSignLabelTemp.text = ((cardParameterFromId.Cost > 0) ? "-" : "+"); + component.NormalSignedCostLabelTemp.text = Mathf.Abs(cardParameterFromId.Cost).ToString(); + component.ShowSignedCostLabel(); + } + else + { + component.NormalZeroCostLabelTemp.text = "0"; + component.ShowZeroCostLabel(); + } + component.NormalChoiceBraveNameLabelTemp.text = cardParameterFromId.CardName; + component.ShowChoiceBraveNameLabel(); + } + else + { + component.NormalCostLabelTemp.text = cardParameterFromId.Cost.ToString(); + component.NormalNameLabelTemp.text = cardParameterFromId.CardName; + } + component.SetNumberLabelStyle(cardParameterFromId.IsFoil); + component.SetNameLabelStyle(cardParameterFromId.IsFoil, isChoiceBrave); + component.SetRepositionNameLabel(cardParameterFromId.CardName, isChoiceBrave); + if (charType == CardBasePrm.CharaType.NORMAL) + { + component.NormalLifeLabelTemp.text = lifeLabelTemp.text; + GameObject gameObject4 = component.AtkLabelTemp.transform.parent.gameObject; + UILabel atkLabelTemp = component.AtkLabelTemp; + atkLabelTemp.text = cardParameterFromId.Atk.ToString(); + gameObject4.SetActive(value: false); + component.NormalAtkLabelTemp.text = atkLabelTemp.text; + } + UILabel component2 = gameObject2.transform.Find("Cost(Clone)").Find("CostLabel").GetComponent(); + if (charType == CardBasePrm.CharaType.NORMAL) + { + UILabel component3 = gameObject2.transform.Find("Life(Clone)").Find("LifeLabel").GetComponent(); + UILabel component4 = gameObject2.transform.Find("Atk(Clone)").Find("AtkLabel").GetComponent(); + GameObject gameObject5 = component2.gameObject; + GameObject gameObject6 = component3.gameObject; + int num = (component4.gameObject.layer = 12); + int layer = (gameObject6.layer = num); + gameObject5.layer = layer; + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(component.NormalAtkLabelTemp, cardParameterFromId.IsFoil); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(component.NormalLifeLabelTemp, cardParameterFromId.IsFoil); + } + return CreateCard(cardId, gameObject, index, isPlayer, battleMgr, component, transform, innerOptionsBuilder, isChoiceBrave); + } + + public static BattleCardBase CreateSpecialSkillCard(int cardId, bool isPlayer, int index, SBattleLoad sBattleLoad, BattleManagerBase battleMgr, IBattleResourceMgr resourceMgr, IInnerOptionsBuilder innerOptionsBuilder, BossRushSpecialSkill skill) + { + bool flag = !isPlayer; + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId); + _ = cardParameterFromId.CharType; + GameObject gobj = new SpecialSkillCardCreator(sBattleLoad.SpellCardTemplate.gameObject).LoadRootObject(); + GameObject gameObject = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(gobj, BattleManagerBase.GetIns().Battle3DContainer); + CardTemplate component = gameObject.GetComponent(); + if (flag && !GameMgr.GetIns().IsWatchBattle && !sBattleLoad.isDbgEnableEnemyHandView && !GameMgr.GetIns().IsAdmin) + { + gameObject.GetComponent().CardNormalLodGroup.enabled = false; + } + GameObject gameObject2 = component.CardNormalTemp.gameObject; + component.NormalCardBaseMeshTemp.sharedMaterial = resourceMgr.GetSleeveMaterial(isPlayer); + Transform transform = gameObject.transform.Find("CardObj"); + Transform transform2 = gameObject.transform.Find("Collider"); + string tag = (transform.tag = (gameObject2.tag = (flag ? "Enemy" : "Player"))); + transform2.tag = tag; + GameObject gameObject3 = null; + if (component.LifeLabelTemp != null) + { + gameObject3 = component.LifeLabelTemp.transform.parent.gameObject; + } + UILabel lifeLabelTemp = component.LifeLabelTemp; + if (lifeLabelTemp != null) + { + lifeLabelTemp.text = cardParameterFromId.Life.ToString(); + } + if (gameObject3 != null) + { + gameObject3.SetActive(value: false); + } + component.NormalCostLabelTemp.text = cardParameterFromId.Cost.ToString(); + component.NormalNameLabelTemp.text = skill.Name; + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(component.NormalCostLabelTemp, cardParameterFromId.IsFoil); + UIManager.GetInstance().getUIBase_CardManager().SetNameLabelStyle(component.NormalNameLabelTemp, cardParameterFromId.IsFoil); + Global.SetRepositionNameLabel(component.NormalNameLabelTemp, skill.Name, is2D: false); + string tag2; + if (isPlayer) + { + tag2 = "Player"; + gameObject.name = "P0"; + } + else + { + tag2 = "Enemy"; + gameObject.name = "E0"; + } + CardTypeBuildInfo cardTypeBuildInfo = CreateCardTypeBuildInfo(cardParameterFromId.CharType, isPlayer); + gameObject.SetActive(cardTypeBuildInfo.isActive); + gameObject.transform.localPosition = cardTypeBuildInfo.localPosition; + gameObject.transform.localScale = cardTypeBuildInfo.localScale; + gameObject.transform.localRotation = cardTypeBuildInfo.localRotation; + gameObject.transform.parent = cardTypeBuildInfo.parent; + gameObject.tag = tag2; + transform.tag = tag2; + transform.transform.Find("NormalField").tag = tag2; + transform.transform.Find("EvolField").tag = tag2; + SkillCreator.CardSkillsBuildInfo cardSkillsBuildInfo = SkillCreator.CreateBuildInfo(cardParameterFromId); + BattleCardBase.BuildInfo buildInfo = new BattleCardBase.BuildInfo(gameObject, cardId, battleMgr.GetBattlePlayer(isPlayer), battleMgr.GetBattlePlayer(!isPlayer), battleMgr.GetBattlePlayer(isPlayer), cardSkillsBuildInfo.normalSkillBuildInfos, cardSkillsBuildInfo.evolveSkillBuildInfos, isPlayer, 0, innerOptionsBuilder.CreateCardOptions(), battleMgr, battleMgr.BattleResourceMgr); + SpecialSkillBattleCard specialSkillBattleCard = new SpecialSkillBattleCard(skill, buildInfo); + specialSkillBattleCard.Setup(createNullView: true); + return specialSkillBattleCard; + } + + public static BattleCardBase CreateCard(int cardId, GameObject gameObject, int battleCardIndex, bool isPlayer, BattleManagerBase battleMgr, CardTemplate CardTemplateIns, Transform parentObject, IInnerOptionsBuilder innerOptionsBuilder, bool isChoiceBrave) + { + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId); + string tag; + if (isPlayer) + { + tag = "Player"; + gameObject.name = "P" + battleCardIndex; + } + else + { + tag = "Enemy"; + gameObject.name = "E" + battleCardIndex; + } + CardTypeBuildInfo cardTypeBuildInfo = CreateCardTypeBuildInfo(cardParameterFromId.CharType, isPlayer); + gameObject.SetActive(cardTypeBuildInfo.isActive); + gameObject.transform.localPosition = cardTypeBuildInfo.localPosition; + gameObject.transform.localScale = cardTypeBuildInfo.localScale; + gameObject.transform.localRotation = cardTypeBuildInfo.localRotation; + gameObject.transform.parent = cardTypeBuildInfo.parent; + gameObject.tag = tag; + parentObject.tag = tag; + if (cardParameterFromId.CharType == CardBasePrm.CharaType.NORMAL) + { + CardTemplateIns.CardNormalTemp.tag = tag; + CardTemplateIns.CardNormalTemp.gameObject.SetActive(value: true); + } + parentObject.transform.Find("NormalField").tag = tag; + parentObject.transform.Find("EvolField").tag = tag; + SkillCreator.CardSkillsBuildInfo cardSkillsBuildInfo = SkillCreator.CreateBuildInfo(cardParameterFromId); + return CreateBase(new BattleCardBase.BuildInfo(gameObject, cardId, battleMgr.GetBattlePlayer(isPlayer), battleMgr.GetBattlePlayer(!isPlayer), battleMgr.GetBattlePlayer(isPlayer), cardSkillsBuildInfo.normalSkillBuildInfos, cardSkillsBuildInfo.evolveSkillBuildInfos, isPlayer, battleCardIndex, innerOptionsBuilder.CreateCardOptions(), battleMgr, battleMgr.BattleResourceMgr), createNullView: false, isChoiceBrave); + } + + private static BattleCardBase CreateCardWithoutResources(int cardId, int battleCardIndex, bool isPlayer, BattleManagerBase battleMgr, IInnerOptionsBuilder innerOptionsBuilder) + { + SkillCreator.CardSkillsBuildInfo cardSkillsBuildInfo = SkillCreator.CreateBuildInfo(CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId)); + return CreateBase(new BattleCardBase.BuildInfo(null, cardId, battleMgr.GetBattlePlayer(isPlayer), battleMgr.GetBattlePlayer(!isPlayer), battleMgr.GetBattlePlayer(isPlayer), cardSkillsBuildInfo.normalSkillBuildInfos, cardSkillsBuildInfo.evolveSkillBuildInfos, isPlayer, battleCardIndex, innerOptionsBuilder.CreateCardOptions(), battleMgr, battleMgr.BattleResourceMgr), createNullView: true); + } + + public static BattleCardBase CreateVirtualClass(bool isPlayer, BattleManagerBase battleMgr, IInnerOptionsBuilder innerOptionsBuilder) + { + return new VirtualClassBattleCard(new ClassBattleCardBase.ClassBuildInfo(isPlayer, 20, battleMgr.GetBattlePlayer(isPlayer), battleMgr.GetBattlePlayer(!isPlayer), battleMgr, NullBattleResourceMgr.GetInstance())); + } + + public static BattleCardBase CreateVirtualCard(int cardId, int index, bool isPlayer, BattleManagerBase battleMgr, BattlePlayerBase selfBattlePlayer, BattlePlayerBase opponentBattlePlayer, IInnerOptionsBuilder innerOptionsBuilder) + { + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId); + SkillCreator.CardSkillsBuildInfo cardSkillsBuildInfo = SkillCreator.CreateBuildInfo(cardParameterFromId); + BattleCardBase.BuildInfo buildInfo = new BattleCardBase.BuildInfo(null, cardId, selfBattlePlayer, opponentBattlePlayer, selfBattlePlayer, cardSkillsBuildInfo.normalSkillBuildInfos, cardSkillsBuildInfo.evolveSkillBuildInfos, isPlayer, index, innerOptionsBuilder.CreateCardOptions(), battleMgr, NullBattleResourceMgr.GetInstance()); + BattleCardBase battleCardBase; + switch (cardParameterFromId.CharType) + { + case CardBasePrm.CharaType.NORMAL: + case CardBasePrm.CharaType.EVOLUTION: + battleCardBase = new VirtualUnitBattleCard(buildInfo); + break; + case CardBasePrm.CharaType.FIELD: + battleCardBase = new VirtualFieldBattleCard(buildInfo); + break; + case CardBasePrm.CharaType.CHANT_FIELD: + battleCardBase = new VirtualChantFieldBattleCard(buildInfo); + break; + case CardBasePrm.CharaType.SPELL: + battleCardBase = new VirtualSpellBattleCard(buildInfo, isChoiceBrave: false); + break; + default: + battleCardBase = NullBattleCard.Create(); + break; + } + battleCardBase.Setup(); + return battleCardBase; + } + + public static BattleCardBase CreateToken(BattleCardBase.BuildInfo buildInfo, bool createNullView = false) + { + return CreateBase(buildInfo, createNullView); + } + + private static BattleCardBase CreateBase(BattleCardBase.BuildInfo buildInfo, bool createNullView = false, bool isChoiceBrave = false) + { + BattleCardBase battleCardBase; + switch (CardMaster.GetInstanceForBattle().GetCardParameterFromId(buildInfo.CardId).CharType) + { + case CardBasePrm.CharaType.NORMAL: + case CardBasePrm.CharaType.EVOLUTION: + battleCardBase = new UnitBattleCard(buildInfo); + break; + case CardBasePrm.CharaType.FIELD: + battleCardBase = new FieldBattleCard(buildInfo); + break; + case CardBasePrm.CharaType.CHANT_FIELD: + battleCardBase = new ChantFieldBattleCard(buildInfo); + break; + case CardBasePrm.CharaType.SPELL: + battleCardBase = new SpellBattleCard(buildInfo, isChoiceBrave); + battleCardBase.IsChoiceBraveSkillCard = isChoiceBrave; + break; + default: + battleCardBase = NullBattleCard.Create(); + break; + } + battleCardBase.Setup(createNullView); + return battleCardBase; + } + + public static BattleCardBase CreateDummyInstance() + { + return NullBattleCard.Create(); + } + + public static BattleCardBase GetDummyInstance() + { + if (_dummyCardInstance == null) + { + _dummyCardInstance = NullBattleCard.Create(); + } + return _dummyCardInstance; + } + + private static CardTypeBuildInfo CreateCardTypeBuildInfo(CardBasePrm.CharaType type, bool isPlayer) + { + BattleManagerBase ins = BattleManagerBase.GetIns(); + CardTypeBuildInfo cardTypeBuildInfo = new CardTypeBuildInfo(); + if (type == CardBasePrm.CharaType.CLASS) + { + cardTypeBuildInfo.isActive = true; + cardTypeBuildInfo.localPosition = (isPlayer ? new Vector3(0f, -400f, 30f) : new Vector3(0f, 420f, 30f)); + cardTypeBuildInfo.localScale = Global.CLASS_BATTLE_SCALE; + cardTypeBuildInfo.localRotation = Quaternion.identity; + cardTypeBuildInfo.parent = ins.Battle3DContainer.transform; + } + else + { + cardTypeBuildInfo.isActive = false; + cardTypeBuildInfo.localPosition = (isPlayer ? ins.CardHolder.transform.localPosition : ins.ECardHolder.transform.localPosition); + cardTypeBuildInfo.localScale = Global.CARD_BATTLE_SCALE; + cardTypeBuildInfo.localRotation = Quaternion.Euler(0f, -90f, 90f); + cardTypeBuildInfo.parent = ins.PCardPlace.transform; + } + return cardTypeBuildInfo; + } + + public static void SetupClassMaterialToCenterCharacterMesh(MeshRenderer insideMesh, MeshRenderer outsideMesh, Material cardArtMaterial, Material cardFrameMaterial) + { + Material[] materials = insideMesh.materials; + Material[] materials2 = outsideMesh.materials; + cardFrameMaterial.shader = Shader.Find(cardFrameMaterial.shader.name); + cardArtMaterial.shader = Shader.Find(cardArtMaterial.shader.name); + materials2[0] = cardFrameMaterial; + materials[0] = cardArtMaterial; + insideMesh.materials = materials; + outsideMesh.materials = materials2; + } +} diff --git a/SVSim.BattleEngine/Engine/CardMake.cs b/SVSim.BattleEngine/Engine/CardMake.cs new file mode 100644 index 0000000..bf708eb --- /dev/null +++ b/SVSim.BattleEngine/Engine/CardMake.cs @@ -0,0 +1,175 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; + +public class CardMake : MonoBehaviour +{ + public const int CAN_CREATE_MAX = 3; + + public const string FORMAT_CARD_CRAFT_PARAM = "{0},{1}"; + + private IDictionary DestructDict; + + private IDictionary _craftDict; + + public Action OnCardSell; + + public Action OnCardSellId; + + public Action OnCardBuy; + + public Action OnClose; + + private Action _onFinishCardDestruct; + + public void StartCardDestruct(int cardId) + { + if (DestructDict == null) + { + DestructDict = new Dictionary(); + } + else + { + DestructDict.Clear(); + } + int possessionCardNum = GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard: false); + DestructDict = new Dictionary(); + DestructDict.Add(cardId.ToString(), "1," + possessionCardNum); + DestructCard(); + } + + private void DestructCard() + { + CardDestructTask cardDestructTask = GameMgr.GetIns().GetCardDestructTask(); + cardDestructTask.SetParameter(DestructDict); + StartCoroutine(Toolbox.NetworkManager.Connect(cardDestructTask, OnRequestFinishDestruct, OnError, OnError)); + } + + private void OnRequestFinishDestruct(NetworkTask.ResultCode error) + { + TriggerUpdateUserDeck(); + if (_onFinishCardDestruct != null) + { + _onFinishCardDestruct(); + } + } + + private void TriggerUpdateUserDeck() + { + List list = new List(DestructDict.Keys); + for (int i = 0; i < list.Count; i++) + { + int obj = int.Parse(list[i]); + if (OnCardSellId != null) + { + OnCardSellId(obj); + } + } + if (OnCardSell != null) + { + OnCardSell(); + } + if (OnClose != null) + { + OnClose(); + } + list = null; + } + + public void StartCardCraft(int cardId) + { + if (_craftDict == null) + { + _craftDict = new Dictionary(); + } + else + { + _craftDict.Clear(); + } + int possessionCardNum = GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard: false); + _craftDict.Add(cardId.ToString(), $"{1},{possessionCardNum}"); + CraftCard(); + } + + private void CraftCard() + { + CardCreateTask cardCreateTask = GameMgr.GetIns().GetCardCreateTask(); + cardCreateTask.SetParameter(_craftDict); + StartCoroutine(Toolbox.NetworkManager.Connect(cardCreateTask, OnRequestFinishCraft, OnError, OnError)); + } + + private void OnRequestFinishCraft(NetworkTask.ResultCode error) + { + if (OnCardBuy != null) + { + OnCardBuy(); + } + if (OnClose != null) + { + OnClose(); + } + } + + public void StartDestructAll(IDictionary destructDict, Action onFinishCallBack = null) + { + _onFinishCardDestruct = onFinishCallBack; + DestructDict = destructDict; + if (DestructDict.Count > 0) + { + DestructCard(); + } + } + + public void StartDestructAll(IDictionary destructDict, Action callback = null) + { + Dictionary dictionary = new Dictionary(); + foreach (KeyValuePair item in destructDict) + { + string value = CreateRequestParam(item.Key, item.Value); + dictionary.Add(item.Key.ToString(), value); + } + StartDestructAll(dictionary, callback); + } + + public void StartCraftAll(IDictionary craftDict) + { + if (_craftDict == null) + { + _craftDict = new Dictionary(); + } + else + { + _craftDict.Clear(); + } + foreach (KeyValuePair item in craftDict) + { + if (item.Value > 0) + { + string value = CreateRequestParam(item.Key, item.Value); + _craftDict.Add(item.Key.ToString(), value); + } + } + if (_craftDict.Count > 0) + { + CraftCard(); + } + } + + private string CreateRequestParam(int cardId, int num) + { + int possessionCardNum = GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard: false); + return $"{num},{possessionCardNum}"; + } + + private void OnError(NetworkTask.ResultCode code) + { + OnClose.Call(); + } + + private void OnError(int code) + { + OnClose.Call(); + } +} diff --git a/SVSim.BattleEngine/Engine/CardPanelMaintenancePlate.cs b/SVSim.BattleEngine/Engine/CardPanelMaintenancePlate.cs new file mode 100644 index 0000000..52d7152 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CardPanelMaintenancePlate.cs @@ -0,0 +1,21 @@ +using UnityEngine; + +public class CardPanelMaintenancePlate : MonoBehaviour +{ + [SerializeField] + private UISprite _sprite; + + [SerializeField] + private UILabel _label; + + public void SetDepth(int depth) + { + _sprite.depth = depth; + _label.depth = depth + 1; + } + + public void SetText(string text) + { + _label.text = text; + } +} diff --git a/SVSim.BattleEngine/Engine/CardSelectListUI_Positioning.cs b/SVSim.BattleEngine/Engine/CardSelectListUI_Positioning.cs new file mode 100644 index 0000000..6b12e54 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CardSelectListUI_Positioning.cs @@ -0,0 +1,210 @@ +using System.Collections.Generic; +using UnityEngine; + +public class CardSelectListUI_Positioning : MonoBehaviour +{ + [SerializeField] + private List m_objList = new List(); + + [SerializeField] + private Vector3 m_offset = Vector3.zero; + + [SerializeField] + private Vector3 m_lineDirection = Vector3.down; + + [SerializeField] + private float m_lineWidth = 170f; + + [SerializeField] + private Vector3 m_breakDirection = Vector3.right; + + [SerializeField] + private float m_breakHeight = 130f; + + [SerializeField] + private float m_breakNum = 2f; + + [SerializeField] + private float m_speed = 0.2f; + + private float m_prog; + + public Vector3 Offset + { + get + { + return m_offset; + } + set + { + m_offset = value; + StartAnim(); + } + } + + public Vector3 LineDirection + { + get + { + return m_lineDirection; + } + set + { + m_lineDirection = value; + StartAnim(); + } + } + + public float LineWidth + { + get + { + return m_lineWidth; + } + set + { + m_lineWidth = value; + StartAnim(); + } + } + + public Vector3 BreakDirection + { + get + { + return m_breakDirection; + } + set + { + m_breakDirection = value; + StartAnim(); + } + } + + public float BreakWidth + { + get + { + return m_breakHeight; + } + set + { + m_breakHeight = value; + StartAnim(); + } + } + + public int BreakNum + { + get + { + return (int)m_breakNum; + } + set + { + m_breakNum = value; + StartAnim(); + } + } + + public float Speed + { + get + { + return m_speed; + } + set + { + m_speed = value; + StartAnim(); + } + } + + public bool IsMoving => m_prog < 0.95f; + + public void Clear() + { + m_objList.Clear(); + } + + public void Add(GameObject[] addList) + { + int num = m_objList.Count; + if (num == 0) + { + m_objList.AddRange(addList); + } + else + { + int num2 = addList.Length; + int i = 0; + int num3 = 0; + while (num3 < num && i < num2) + { + int num4 = 0; + while (i < num2 && m_objList[num3] != addList[i]) + { + m_objList.Insert(num3, addList[i]); + } + i++; + num3 += num4; + num += num4; + num3++; + } + for (; i < num2; i++) + { + m_objList.Add(addList[i]); + } + } + StartAnim(); + } + + public void Change(GameObject[] addList) + { + m_objList.Clear(); + m_objList.AddRange(addList); + StartAnim(); + } + + public void Immediate() + { + float speed = m_speed; + m_speed = 1f; + Update_Anim(); + m_speed = speed; + } + + public Vector3 GetPositionAtIndex(int idx) + { + int num = idx % (int)m_breakNum; + int num2 = idx / (int)m_breakNum; + float num3 = m_lineWidth * (float)num; + float num4 = m_breakHeight * (float)num2; + return m_offset + m_lineDirection * num3 + m_breakDirection * num4; + } + + private void LateUpdate() + { + Update_Anim(); + } + + private void Update_Anim() + { + m_prog += (1f - m_prog) * m_speed; + int count = m_objList.Count; + for (int i = 0; i < count; i++) + { + if (!(m_objList[i] == null)) + { + Vector3 localPosition = m_objList[i].transform.localPosition; + Vector3 vector = (GetPositionAtIndex(i) - localPosition) * m_speed; + m_objList[i].transform.localPosition = localPosition + vector; + } + } + } + + private void StartAnim() + { + m_prog = 0f; + } +} diff --git a/SVSim.BattleEngine/Engine/CardShaderDefine.cs b/SVSim.BattleEngine/Engine/CardShaderDefine.cs new file mode 100644 index 0000000..c30e2c6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CardShaderDefine.cs @@ -0,0 +1,39 @@ +using UnityEngine; +using Wizard; + +public static class CardShaderDefine +{ + public const string CARD_SHADER_DEFAULT = "Wizard/Card/Basic_Front0_Back0_Normal"; + + public const string CARD_SHADER_FOIL = "Wizard/VariantCardShader"; + + public static void ReplaceShader(Material mat) + { + if (!(mat == null)) + { + if (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_FOIL_CARD_ANIMATION)) + { + mat.shader = Shader.Find(mat.shader.name); + } + else + { + mat.shader = Shader.Find("Wizard/Card/Basic_Front0_Back0_Normal"); + } + } + } + + public static void ReplaceBaseShader(Material mat, bool isFoil) + { + if (!(mat == null)) + { + if (isFoil && mat.shader.name != "Wizard/VariantCardShader") + { + mat.shader = Shader.Find("Wizard/VariantCardShader"); + } + else + { + mat.shader = Shader.Find(mat.shader.name); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/CastleField.cs b/SVSim.BattleEngine/Engine/CastleField.cs new file mode 100644 index 0000000..a6b0902 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CastleField.cs @@ -0,0 +1,182 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CastleField : BackGroundBase +{ + public override int FieldId => 2; + + public CastleField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_ocsl_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles02").gameObject; + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + _fieldObjDictionary.Add("coffin", _fieldModel.transform.Find("md_bf_ocsl_01_coffin").gameObject); + _fieldObjDictionary.Add("sword", _fieldModel.transform.Find("md_bf_ocsl_01_sword").gameObject); + _fieldObjDictionary.Add("tapestry_a", _fieldModel.transform.Find("md_bf_ocsl_01_tapestry_a").gameObject); + _fieldObjDictionary.Add("tapestry_b", _fieldModel.transform.Find("md_bf_ocsl_01_tapestry_b").gameObject); + _fieldObjDictionary.Add("chain_a", _fieldModel.transform.Find("md_bf_ocsl_01_chain_a").gameObject); + _fieldObjDictionary.Add("chain_b", _fieldModel.transform.Find("md_bf_ocsl_01_chain_b").gameObject); + _fieldObjDictionary.Add("chain_c", _fieldModel.transform.Find("md_bf_ocsl_01_chain_c").gameObject); + _fieldObjDictionary.Add("chain_d", _fieldModel.transform.Find("md_bf_ocsl_01_chain_d").gameObject); + _fieldObjDictionary.Add("chain_e", _fieldModel.transform.Find("md_bf_ocsl_01_chain_e").gameObject); + _fieldObjDictionary.Add("grate", _fieldModel.transform.Find("md_bf_ocsl_01_grate").gameObject); + m_FieldAnimatorDictionary.Add("coffin", _fieldObjDictionary["coffin"].GetComponent()); + m_FieldAnimatorDictionary.Add("sword", _fieldObjDictionary["sword"].GetComponent()); + m_FieldAnimatorDictionary.Add("tapestry_a", _fieldObjDictionary["tapestry_a"].GetComponent()); + m_FieldAnimatorDictionary.Add("tapestry_b", _fieldObjDictionary["tapestry_b"].GetComponent()); + m_FieldAnimatorDictionary.Add("chain_a", _fieldObjDictionary["chain_a"].GetComponent()); + m_FieldAnimatorDictionary.Add("chain_b", _fieldObjDictionary["chain_b"].GetComponent()); + m_FieldAnimatorDictionary.Add("chain_c", _fieldObjDictionary["chain_c"].GetComponent()); + m_FieldAnimatorDictionary.Add("chain_d", _fieldObjDictionary["chain_d"].GetComponent()); + m_FieldAnimatorDictionary.Add("chain_e", _fieldObjDictionary["chain_e"].GetComponent()); + m_FieldAnimatorDictionary.Add("grate", _fieldObjDictionary["grate"].GetComponent()); + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("coffin_open", _fieldParticles.transform.Find("coffin_open").GetComponent()); + _fieldParticleSystemDictionary.Add("coffin_close", _fieldParticles.transform.Find("coffin_close").GetComponent()); + _fieldParticleSystemDictionary.Add("coffin_gimic_1", _fieldParticles.transform.Find("coffin_gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("coffin_gimic_2", _fieldParticles.transform.Find("coffin_gimic_2").GetComponent()); + _fieldParticleSystemDictionary.Add("fog", _fieldParticles.transform.Find("fog").GetComponent()); + _fieldParticleSystemDictionary.Add("candle", _fieldParticles.transform.Find("candle").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_2, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_2_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["tapestry_a"].speed = 0.4f + Random.value * 0.2f; + m_FieldAnimatorDictionary["tapestry_b"].speed = 0.4f + Random.value * 0.2f; + _fieldParticleSystemDictionary["opening"].Play(); + _fieldParticleSystemDictionary["fog"].gameObject.SetActive(value: false); + _fieldParticleSystemDictionary["candle"].gameObject.SetActive(value: false); + m_RandomActionTime = 20f; + _battleCamera.Camera.transform.localPosition = new Vector3(2550f, -830f, -200f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-19f, -90f, 90f)); + Vector3[] bezierQuad = MotionUtils.GetBezierQuad(new Vector3(2550f, -830f, -200f), new Vector3(840f, -250f, -200f), new Vector3(-240f, -190f, -70f), 10); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierQuad, "movetopath", false, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-37f, -117f, 107f), "time", 1f, "delay", 1f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(0.6f); + m_FieldAnimatorDictionary["grate"].SetTrigger("Open"); + _fieldParticleSystemDictionary["candle"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(1.4f); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT); + m_FieldAnimatorDictionary["grate"].SetTrigger("Close"); + _fieldParticleSystemDictionary["fog"].gameObject.SetActive(value: true); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + int num = Random.Range(1, 3); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_{num}", "se_field_" + _str3DFieldNo, 0f, 0L); + switch (num) + { + case 1: + GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[0], "se_field_" + _str3DFieldNo, 0f, 0L); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[1], "se_field_" + _str3DFieldNo, 0f, 0L); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[2], "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["coffin"].SetTrigger("Open"); + m_FieldAnimatorDictionary["sword"].SetTrigger("Open"); + _fieldParticleSystemDictionary["coffin_open"].Play(); + yield return new WaitForSeconds(1.5f); + _fieldParticleSystemDictionary["coffin_gimic_1"].Play(); + yield return new WaitForSeconds(2.5f); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[4], "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["coffin"].SetTrigger("Close"); + yield return new WaitForSeconds(1f); + m_FieldAnimatorDictionary["sword"].SetTrigger("Close"); + yield return new WaitForSeconds(1f); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[6], "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["coffin_close"].Play(); + yield return new WaitForSeconds(1f); + break; + case 2: + m_FieldAnimatorDictionary["coffin"].SetTrigger("Act"); + m_FieldAnimatorDictionary["sword"].SetTrigger("Act"); + yield return new WaitForSeconds(0.5f); + break; + } + GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[5], "se_field_" + _str3DFieldNo, 0f, 0L); + _gimicCntDictionary[obj.tag] = 0; + } + } + + protected override IEnumerator RunFieldShake() + { + m_FieldAnimatorDictionary["chain_a"].speed = 0.8f + Random.value * 0.4f; + m_FieldAnimatorDictionary["chain_b"].speed = 0.8f + Random.value * 0.4f; + m_FieldAnimatorDictionary["chain_c"].speed = 0.8f + Random.value * 0.4f; + m_FieldAnimatorDictionary["chain_d"].speed = 0.8f + Random.value * 0.4f; + m_FieldAnimatorDictionary["chain_e"].speed = 0.8f + Random.value * 0.4f; + m_FieldAnimatorDictionary["chain_a"].SetTrigger("Shake"); + m_FieldAnimatorDictionary["chain_b"].SetTrigger("Shake"); + m_FieldAnimatorDictionary["chain_c"].SetTrigger("Shake"); + m_FieldAnimatorDictionary["chain_d"].SetTrigger("Shake"); + m_FieldAnimatorDictionary["chain_e"].SetTrigger("Shake"); + m_FieldAnimatorDictionary["tapestry_a"].speed = 0.8f + Random.value * 0.4f; + m_FieldAnimatorDictionary["tapestry_b"].speed = 0.8f + Random.value * 0.4f; + m_FieldAnimatorDictionary["tapestry_a"].SetTrigger("Shake"); + m_FieldAnimatorDictionary["tapestry_b"].SetTrigger("Shake"); + if (_gimicCntDictionary["FieldGimic1"] == 0) + { + m_FieldAnimatorDictionary["coffin"].SetTrigger("Shake"); + m_FieldAnimatorDictionary["sword"].SetTrigger("Shake"); + } + yield return new WaitForSeconds(3f); + m_FieldAnimatorDictionary["tapestry_a"].speed = 0.4f + Random.value * 0.2f; + m_FieldAnimatorDictionary["tapestry_b"].speed = 0.4f + Random.value * 0.2f; + yield return new WaitForSeconds(0f); + } + + public override void UpdateFieldRandom() + { + if (IsFieldRandom) + { + m_RandomActionTime -= Time.deltaTime; + if (m_RandomActionTime <= 0f) + { + m_FieldAnimatorDictionary["tapestry_a"].SetTrigger("LoopRandom"); + m_FieldAnimatorDictionary["tapestry_b"].SetTrigger("LoopRandom"); + m_RandomActionTime = Random.value * 20f + 20f; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/ChallengeConfig.cs b/SVSim.BattleEngine/Engine/ChallengeConfig.cs new file mode 100644 index 0000000..a9a4246 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ChallengeConfig.cs @@ -0,0 +1,6 @@ +public class ChallengeConfig +{ + public bool UseTwoPickPremiumCard { get; set; } + + public long TwoPickSleeveId { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/ChallengeData.cs b/SVSim.BattleEngine/Engine/ChallengeData.cs new file mode 100644 index 0000000..b37fc48 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ChallengeData.cs @@ -0,0 +1,43 @@ +using System; +using LitJson; +using Wizard; + +public class ChallengeData +{ + public TwoPickFormat TwoPickFormat { get; private set; } + + public string CardPoolName { get; private set; } + + public string CardPoolUrl { get; private set; } = string.Empty; + + public string AnnounceId { get; private set; } + + public string StartTime { get; private set; } + + public string EndTime { get; private set; } + + public int LatestCardPackId { get; private set; } + + public int ChaosNum { get; private set; } + + public ChallengeData(JsonData forMatIndoJson) + { + TwoPickFormat = (TwoPickFormat)forMatIndoJson["two_pick_type"].ToInt(); + CardPoolName = forMatIndoJson["card_pool_name"].ToString(); + if (forMatIndoJson.TryGetValue("card_pool_url", out var value)) + { + CardPoolUrl = value.ToString(); + } + AnnounceId = forMatIndoJson["announce_id"].ToString(); + StartTime = ConvertTime.ToLocal(DateTime.Parse(forMatIndoJson["start_time"].ToString())); + EndTime = ConvertTime.ToLocal(DateTime.Parse(forMatIndoJson["end_time"].ToString())); + if (forMatIndoJson.TryGetValue("last_card_pack_set_id", out var value2)) + { + LatestCardPackId = value2.ToInt(); + } + if (forMatIndoJson.TryGetValue("strategy_pick_num", out var value3)) + { + ChaosNum = value3.ToInt(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/ChangeAffiliationVfx.cs b/SVSim.BattleEngine/Engine/ChangeAffiliationVfx.cs new file mode 100644 index 0000000..9fe7440 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ChangeAffiliationVfx.cs @@ -0,0 +1,52 @@ +using UnityEngine; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class ChangeAffiliationVfx : SequentialVfxPlayer +{ + private readonly IBattleCardView _view; + + public ChangeAffiliationVfx(BattleCardBase card, CardBasePrm.ClanType clan) + { + ChangeAffiliationVfx changeAffiliationVfx = this; + GameObject effectGameObject = null; + _view = card.BattleCardView; + if ((card.IsPlayer || GameMgr.GetIns().IsAdminWatch || !card.IsInHand) && clan != CardBasePrm.ClanType.NONE) + { + Register(new WaitLoadEffectAndSetSeVfx("cmn_card_classchange_1", "se_cmn_card_classchange_1", delegate(GameObject e) + { + effectGameObject = e; + })); + Register(new PlayEffectAndSeVfx(delegate + { + effectGameObject.GetComponent().ChangeParticleColor(changeAffiliationVfx.GetClanColor(clan)); + return effectGameObject; + }, _view.Transform)); + Register(WaitVfx.Create(0.3f)); + } + } + + private VfxBase ChangeEffectColor(Effect effect, Color color) + { + return InstantVfx.Create(delegate + { + effect.ChangeParticleColor(color); + }); + } + + private Color GetClanColor(CardBasePrm.ClanType clan) + { + return clan switch + { + CardBasePrm.ClanType.ALL => Color.white, + CardBasePrm.ClanType.MIN => new Color(0.2f, 1f, 0.8f), + CardBasePrm.ClanType.ROYAL => new Color(1f, 0.9f, 0.5f), + CardBasePrm.ClanType.WITCH => new Color(0.7f, 0.5f, 1f), + CardBasePrm.ClanType.DRAGON => new Color(1f, 0.5f, 0f), + CardBasePrm.ClanType.NECRO => new Color(0.5f, 0.4f, 1f), + CardBasePrm.ClanType.VAMPIRE => new Color(1f, 0.2f, 0.2f), + CardBasePrm.ClanType.BISHOP => new Color(0.5f, 0.7f, 1f), + _ => Color.white, + }; + } +} diff --git a/SVSim.BattleEngine/Engine/ChantCountAddModifier.cs b/SVSim.BattleEngine/Engine/ChantCountAddModifier.cs new file mode 100644 index 0000000..dfa1564 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ChantCountAddModifier.cs @@ -0,0 +1,21 @@ +public class ChantCountAddModifier : ICardChantCountModifier +{ + public int ChantCount { get; private set; } + + public bool IsClearBeforeModifier => false; + + public ChantCountAddModifier(int chantCount) + { + ChantCount = chantCount; + } + + public int CalcChantCount(int chantCount) + { + return chantCount + ChantCount; + } + + public ICardChantCountModifier Clone() + { + return new ChantCountAddModifier(ChantCount); + } +} diff --git a/SVSim.BattleEngine/Engine/ChantCountSetModifier.cs b/SVSim.BattleEngine/Engine/ChantCountSetModifier.cs new file mode 100644 index 0000000..f1c59a4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ChantCountSetModifier.cs @@ -0,0 +1,21 @@ +public class ChantCountSetModifier : ICardChantCountModifier +{ + public readonly int ChantCount; + + public bool IsClearBeforeModifier => true; + + public ChantCountSetModifier(int chantCount) + { + ChantCount = chantCount; + } + + public int CalcChantCount(int chantCount) + { + return ChantCount; + } + + public ICardChantCountModifier Clone() + { + return new ChantCountSetModifier(ChantCount); + } +} diff --git a/SVSim.BattleEngine/Engine/ChantFieldBattleCard.cs b/SVSim.BattleEngine/Engine/ChantFieldBattleCard.cs new file mode 100644 index 0000000..f7a6496 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ChantFieldBattleCard.cs @@ -0,0 +1,120 @@ +using Wizard; +using Wizard.Battle.Card; +using Wizard.Battle.View.Vfx; + +public class ChantFieldBattleCard : FieldBattleCard +{ + protected readonly int _baseChantCount; + + public override bool IsChantField => true; + + public ChantFieldBattleCard(BuildInfo buildInfo) + : base(buildInfo) + { + _baseChantCount = base.BaseParameter.ChantCount; + AddChantSkill(buildInfo); + } + + public void AddChantSkill(BuildInfo buildInfo) + { + if (!_normalSkillCollection.HaveNotAttachedResidentChantCountChangeSkill()) + { + SkillBase skillBase = CreateSkillCreator(buildInfo.SelfBattlePlayer, buildInfo.OpponentBattlePlayer, buildInfo.ResourceMgr).Create(ChantSkillInfoCreate()); + SetChantSkill(skillBase); + _normalSkillCollection.Add(skillBase); + } + } + + public override void FlagCardAsDestroyedBySkill() + { + base.IsDestroyedBySkill = true; + base.DeathTypeInfo.ChantDestroy = true; + } + + public override VfxBase SetUpInplay() + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + parallelVfxPlayer.Register(base.SetUpInplay()); + parallelVfxPlayer.Register(new ShowChantCountVfx(this, base.ChantCount, base.SelfBattlePlayer.BattleMgr.BattleResourceMgr)); + return parallelVfxPlayer; + } + + protected override void InitSkillApplyInformationOnWhenReturn() + { + base.SkillApplyInformation.InitializeInformation(isReturnCard: true); + base.SkillApplyInformation.ClearParameterModifier(); + ClearCostModifier(); + base.TransformInfo = default(TransformInformation); + base.SkillApplyInformation.AttachedSkillsInfo.Clear(); + _normalSkillCollection.Clear(); + _evolveSkillCollection.Clear(); + SkillCreator.CardSkillsBuildInfo cardSkillsBuildInfo = SkillCreator.CreateBuildInfo(CardMaster.GetInstanceForBattle().GetCardParameterFromId(base.CardId)); + foreach (SkillBase item in CreateSkillCondition(cardSkillsBuildInfo.normalSkillBuildInfos, base.SelfBattlePlayer, base.OpponentBattlePlayer, _buildInfo.ResourceMgr)) + { + _normalSkillCollection.Add(item); + item.SetInductionVoiceIndex(); + } + foreach (SkillBase item2 in CreateSkillCondition(cardSkillsBuildInfo.evolveSkillBuildInfos, base.SelfBattlePlayer, base.OpponentBattlePlayer, _buildInfo.ResourceMgr)) + { + _evolveSkillCollection.Add(item2); + item2.SetInductionVoiceIndex(); + } + AddChantSkill(_buildInfo); + base.Skills = _normalSkillCollection; + base.Skills.Complete(); + } + + public override VfxBase ReturnCard(SkillProcessor skillProcessor) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(base.SkillApplyInformation.AllSkillEffectStop()); + InitializeParameterOnWhenReturn(); + VfxBase vfx = base.ReturnCard(skillProcessor); + sequentialVfxPlayer.Register(vfx); + return sequentialVfxPlayer; + } + + public override VfxBase RecoveryInPlay(int inPlayIndex, bool newReplayMoveTurn = false) + { + return ParallelVfxPlayer.Create(base.RecoveryInPlay(inPlayIndex, newReplayMoveTurn), new ShowChantCountVfx(this, base.ChantCount, _buildInfo.ResourceMgr)); + } + + public override BattleCardBase VirtualClone(BattlePlayerBase virtualSelfBattlePlayer, BattlePlayerBase virtualOpponentBattlePlayer) + { + VirtualChantFieldBattleCard virtualChantFieldBattleCard = new VirtualChantFieldBattleCard(_buildInfo.VirtualClone(virtualSelfBattlePlayer, virtualOpponentBattlePlayer)); + CopyToVirtualCardBase(virtualChantFieldBattleCard); + return virtualChantFieldBattleCard; + } + + public override VfxBase CombineVirtualCardSkill(BattleCardBase target) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + base.IsSkillLost = false; + foreach (SkillBase item in CreateSkillCondition(target.GetBuildInfo.NormalSkillBuildInfos, base.SelfBattlePlayer, base.OpponentBattlePlayer, _buildInfo.ResourceMgr)) + { + _normalSkillCollection.Add(item); + } + AddChantSkill(_buildInfo); + base.Skills = _normalSkillCollection; + base.SkillApplyInformation.Combine(target.SkillApplyInformation); + int count = target.BuffInfoList.Count; + for (int i = 0; i < count; i++) + { + BuffInfo buffInfo = target.BuffInfoList[i]; + if (!(buffInfo.SkillFrom is Skill_powerup) && !(buffInfo.SkillFrom is Skill_power_down) && !base.BuffInfoList.Contains(buffInfo)) + { + AddBuffInfo(buffInfo); + } + } + base.Skills.Complete(); + CostModifierList.AddRange(target.CostModifierList); + if (!base.SelfBattlePlayer.BattleMgr.IsVirtualBattle && !base.SelfBattlePlayer.BattleMgr.IsRecovery) + { + parallelVfxPlayer.Register(SequentialVfxPlayer.Create(base.SkillApplyInformation.AllSkillEffectRestart(), InstantVfx.Create(delegate + { + base.BattleCardView._inPlayFrameEffect.UpdateCanAttackEffect(); + }), base.BattleCardView.BattleCardIconAnimations.Initialize(this, base.Skills))); + } + return parallelVfxPlayer; + } +} diff --git a/SVSim.BattleEngine/Engine/CharIdx.cs b/SVSim.BattleEngine/Engine/CharIdx.cs new file mode 100644 index 0000000..b9193b3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CharIdx.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +public class CharIdx : MonoBehaviour +{ + public int m_Idx { get; protected set; } + + public int m_CardId { get; protected set; } + + public void SetIdx(int idx) + { + m_Idx = idx; + } + + public int GetIdx() + { + return m_Idx; + } + + public void SetCardId(int cardid) + { + m_CardId = cardid; + } + + public int GetCardId() + { + return m_CardId; + } +} diff --git a/SVSim.BattleEngine/Engine/Charactor3dInformation.cs b/SVSim.BattleEngine/Engine/Charactor3dInformation.cs new file mode 100644 index 0000000..92476f9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Charactor3dInformation.cs @@ -0,0 +1,430 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Wizard.Battle.Player.ClassCharacter; + +public class Charactor3dInformation : MonoBehaviour +{ + public GameObject[] Meshes; + + public Material[] Materials; + + public Animator[] Animators; + + public Transform[] LeftEyeInfoObject; + + public Transform[] RightEyeInfoObject; + + public Effect3dInformation EffectInfo; + + public Transform BodyNeck; + + public Transform FaceNeck; + + public Transform BodyHead; + + public Transform FaceHead; + + public Transform BodyHip; + + public Transform TailHip; + + public Transform BodyProp; + + public Transform PropProp; + + public GameObject Prop; + + public Transform HeadAttach; + + public Transform HeadCenterOffset; + + public Transform HeadTubeCenterOffset; + + public Transform HeadAttachR; + + public Transform HeadAttachL; + + private Material EyeMaterial; + + private Material FaceSkinMaterial; + + private Material HairMaterial; + + private Material BodyMaterial; + + public GameObject Quad; + + private string _oldMotion = ""; + + private Class3dCharacterBase _characterBase; + + private string _characterId = ""; + + private bool _isInitialized; + + private bool _isLoadMesh; + + private bool _isLoadedMesh; + + public bool IsTestScene; + + private List _meshList = new List(); + + private Class3dPostImageEffect _postEffect; + + private void Start() + { + string text = base.name; + text = text.Replace("chr", ""); + _characterId = text.Replace("(Clone)", ""); + if (Prop != null) + { + Prop.SetActive(value: true); + } + if (!IsTestScene) + { + _isLoadMesh = true; + } + } + + private void Update() + { + if ((_isLoadedMesh && !_isInitialized) || (IsTestScene && !_isInitialized)) + { + Initialize(); + _isInitialized = true; + } + if (_isLoadMesh && !_isLoadedMesh) + { + InitializeMesh(_characterBase, _postEffect); + _isLoadedMesh = true; + } + if (EyeMaterial != null) + { + Vector4[] values = new Vector4[3] + { + new Vector4(LeftEyeInfoObject[0].localPosition.x, LeftEyeInfoObject[0].localPosition.y, LeftEyeInfoObject[0].localPosition.z, LeftEyeInfoObject[0].localScale.x), + new Vector4(LeftEyeInfoObject[1].localPosition.x, LeftEyeInfoObject[1].localPosition.y, LeftEyeInfoObject[1].localPosition.z, LeftEyeInfoObject[1].localScale.x), + new Vector4(LeftEyeInfoObject[2].localPosition.x, LeftEyeInfoObject[2].localPosition.y, LeftEyeInfoObject[2].localPosition.z, LeftEyeInfoObject[2].localScale.x) + }; + EyeMaterial.SetVectorArray("_HighParam1", values); + Vector4[] values2 = new Vector4[2] + { + new Vector4(RightEyeInfoObject[0].localPosition.x, RightEyeInfoObject[0].localPosition.y, RightEyeInfoObject[0].localPosition.z, RightEyeInfoObject[0].localScale.x), + new Vector4(RightEyeInfoObject[1].localPosition.x, RightEyeInfoObject[1].localPosition.y, RightEyeInfoObject[1].localPosition.z, RightEyeInfoObject[1].localScale.x) + }; + EyeMaterial.SetVectorArray("_HighParam2", values2); + } + } + + private void Initialize() + { + SkinnedMeshRenderer[] componentsInChildren = GetComponentsInChildren(); + MeshRenderer meshRenderer = null; + if (Prop != null) + { + MeshRenderer[] componentsInChildren2 = Prop.GetComponentsInChildren(); + if (componentsInChildren2.Length != 0) + { + meshRenderer = componentsInChildren2[0]; + } + } + int num = 0; + SkinnedMeshRenderer[] array = componentsInChildren; + for (int i = 0; i < array.Length; i++) + { + Material[] materials = array[i].materials; + num += materials.Length; + } + num += ((meshRenderer != null) ? 1 : 0); + Materials = new Material[num]; + int num2 = 0; + array = componentsInChildren; + foreach (SkinnedMeshRenderer skinnedMeshRenderer in array) + { + Material[] materials2 = skinnedMeshRenderer.materials; + for (int j = 0; j < materials2.Length; j++) + { + skinnedMeshRenderer.sharedMaterials[j].shader = Shader.Find(materials2[j].shader.name); + Materials[num2] = skinnedMeshRenderer.sharedMaterials[j]; + if (skinnedMeshRenderer.sharedMaterials[j].name.Contains("face")) + { + FaceSkinMaterial = skinnedMeshRenderer.sharedMaterials[j]; + } + if (skinnedMeshRenderer.sharedMaterials[j].name.Contains("hair")) + { + HairMaterial = skinnedMeshRenderer.sharedMaterials[j]; + } + if (skinnedMeshRenderer.sharedMaterials[j].name.Contains("eye")) + { + EyeMaterial = skinnedMeshRenderer.sharedMaterials[j]; + } + if (skinnedMeshRenderer.sharedMaterials[j].name.Contains("bdy")) + { + BodyMaterial = skinnedMeshRenderer.sharedMaterials[j]; + } + num2++; + } + } + if (meshRenderer != null) + { + meshRenderer.sharedMaterial.shader = Shader.Find(meshRenderer.sharedMaterial.shader.name); + Materials[num2] = meshRenderer.sharedMaterial; + } + InitializeMaterials(); + EffectInfo = GetComponent(); + if (Prop != null) + { + Prop.SetActive(value: false); + } + } + + public void OnApplicationFocus(bool focus) + { + if (focus) + { + InitializeMaterials(); + } + } + + public void InitializeMaterials() + { + Material[] materials = Materials; + foreach (Material material in materials) + { + if (!(material == null)) + { + material.SetColor("_GlobalToonColor", Color.white); + material.SetColor("_GlobalRimColor", Color.white); + material.SetFloat("_GlobalOutlineWidth", 1f); + material.SetFloat("_GlobalOutlineOffset", 1f); + material.SetColor("_Global_FogColor", new Color(0.76f, 1f, 1f, 1f)); + material.SetVector("_Global_FogMinDistance", Vector4.zero); + material.SetVector("_Global_FogLength", new Vector4(1000f, 1000f, 1000f, 1000f)); + material.SetInt("_Global_MaxDensity", 1); + material.SetFloat("_Global_MaxHeight", 100f); + material.SetVector("_Global_FogWorld_Origin", Vector4.zero); + material.SetColor("_LightColorWizard", Color.white); + material.SetFloat("_RimStep", 0.5f); + material.SetFloat("_RimStep2", 0.1f); + material.SetFloat("_RimSpecRate", 0.5f); + } + } + } + + private void LateUpdate() + { + AnimatorClipInfo[] currentAnimatorClipInfo = Animators[0].GetCurrentAnimatorClipInfo(0); + if (currentAnimatorClipInfo != null && currentAnimatorClipInfo.Length != 0) + { + string text = currentAnimatorClipInfo[0].clip.name; + foreach (ClassCharaPrm.MotionType value5 in Enum.GetValues(typeof(ClassCharaPrm.MotionType))) + { + if (text.Contains(value5.ToString())) + { + if (EffectInfo != null) + { + EffectInfo.UpdateInfo(value5); + } + break; + } + } + Vector3 localScale = HeadAttach.localScale; + Color value = new Color(localScale.x, localScale.y, localScale.z); + Vector3 vector = HeadAttach.localRotation * Vector3.up; + Material[] materials = Materials; + foreach (Material material in materials) + { + if (!(material == null)) + { + material.SetColor("_CharaColor", value); + material.SetVector("_WorldSpaceLightPosWizard", vector); + } + } + string value2 = ClassCharaPrm.MotionType.extra.ToString(); + if (_characterBase != null && _characterBase.IsPlayer) + { + if (text.Equals(value2) && !_oldMotion.Equals(value2)) + { + _characterBase.EnableEvolve(enable: true); + } + else if (!text.Equals(value2) && _oldMotion.Equals(value2)) + { + _characterBase.EnableEvolve(enable: false); + } + } + if (_postEffect != null && text.Equals(value2)) + { + AnimatorStateInfo currentAnimatorStateInfo = Animators[0].GetCurrentAnimatorStateInfo(0); + float num = (float)currentAnimatorClipInfo.Length * currentAnimatorStateInfo.normalizedTime; + int num2 = (int)(85f * num) + 1; + if (_postEffect._param.FadeOutEndFrame <= num2) + { + _postEffect._param.DiffusionThreshold = _postEffect._param.EndDiffusionThreshold; + } + else if (_postEffect._param.FadeOutStartFrame <= num2) + { + float num3 = _postEffect._param.FadeOutEndFrame - _postEffect._param.FadeOutStartFrame; + float t = 0f; + if (num3 > 0f) + { + t = 1f / num3; + } + _postEffect._param.DiffusionThreshold = Mathf.Lerp(_postEffect._param.DiffusionThreshold, _postEffect._param.EndDiffusionThreshold, t); + } + else + { + _postEffect._param.DiffusionThreshold = _postEffect._param.DefaultDiffusionThreshold; + } + } + if (text != _oldMotion && BodyMaterial != null) + { + if (text.Contains(ClassCharaPrm.MotionType.idle.ToString())) + { + BodyMaterial.renderQueue = 1999; + } + if ((_characterId == "3606" && text.Contains("extra_2")) || (_characterId == "3603" && (text.Contains("extra_2") || text.Contains("shock") || text == "positive")) || (_characterId == "3617" && text.Contains("nagative_2_a"))) + { + BodyMaterial.renderQueue = 2001; + } + } + if (Prop != null) + { + if (text.Equals(value2) && !_oldMotion.Equals(value2)) + { + Prop.SetActive(value: true); + } + else if (!text.Equals(value2) && _oldMotion.Equals(value2)) + { + Prop.SetActive(value: false); + } + } + _oldMotion = text; + } + if (HeadCenterOffset != null && FaceSkinMaterial != null) + { + Vector3 forward = BodyHead.forward; + Vector3 up = BodyHead.up; + Vector3 vector2 = BodyHead.position + up * HeadCenterOffset.localPosition.y + forward * HeadCenterOffset.localPosition.z; + Vector3 vector3 = BodyHead.position + forward * HeadTubeCenterOffset.localPosition.z; + FaceSkinMaterial.SetVector("_FaceCenterPos", vector3); + HairMaterial.SetVector("_FaceCenterPos", vector2); + EyeMaterial.SetVector("_FaceCenterPos", vector3); + FaceSkinMaterial.SetVector("_FaceUp", up); + HairMaterial.SetVector("_FaceUp", up); + EyeMaterial.SetVector("_FaceUp", up); + FaceSkinMaterial.SetVector("_FaceForward", forward); + HairMaterial.SetVector("_FaceForward", forward); + EyeMaterial.SetVector("_FaceForward", forward); + if (HeadAttachR != null) + { + Material[] materials = Materials; + foreach (Material material2 in materials) + { + if (!(material2 == null)) + { + Vector3 localPosition = HeadAttachR.localPosition; + material2.SetFloat("_RimStep", localPosition.x); + material2.SetFloat("_RimFeather", localPosition.y); + material2.SetFloat("_RimSpecRate", localPosition.z); + if (material2.HasProperty("_RimColor")) + { + Color color = material2.GetColor("_RimColor"); + Vector3 localScale2 = HeadAttachR.localScale; + Color value3 = new Color(localScale2.x, localScale2.y, localScale2.z, color.a); + material2.SetColor("_RimColor", value3); + } + Vector3 localScale3 = HeadAttachL.localScale; + Color value4 = new Color(localScale3.x, localScale3.y, localScale3.z, 0f); + material2.SetColor("_ToonDarkColor", value4); + } + } + } + } + UpdateTransform(FaceNeck, BodyNeck); + FaceHead.localPosition = BodyHead.localPosition; + FaceHead.localRotation = BodyHead.localRotation; + UpdateTransform(TailHip, BodyHip); + if (Prop != null && Prop.activeSelf && BodyProp != null && PropProp != null) + { + UpdateTransform(PropProp, BodyProp); + } + } + + private void UpdateTransform(Transform face, Transform body) + { + face.position = body.position; + face.localRotation = body.rotation; + } + + public void InitializeMesh(Class3dCharacterBase characterBase = null, Class3dPostImageEffect postEffect = null) + { + _characterBase = characterBase; + _postEffect = postEffect; + Mesh mesh = new Mesh(); + mesh.vertices = new Vector3[4] + { + new Vector3(-0.5f, -0.5f, 0f), + new Vector3(-0.5f, 0.5f, 0f), + new Vector3(0.5f, 0.5f, 0f), + new Vector3(0.5f, -0.5f, 0f) + }; + mesh.triangles = new int[6] { 0, 1, 3, 1, 2, 3 }; + mesh.uv = new Vector2[4] + { + new Vector2(0.65f, 0.39f), + new Vector2(0.65f, 0.69f), + new Vector2(0.35f, 0.69f), + new Vector2(0.35f, 0.39f) + }; + mesh.RecalculateBounds(); + mesh.RecalculateNormals(); + mesh.RecalculateTangents(); + Quad.GetComponent().mesh = mesh; + } + + public void Destroy() + { + if (Materials != null) + { + for (int i = 0; i < Materials.Length; i++) + { + Material material = Materials[i]; + if (!(material == null)) + { + UnityEngine.Object.Destroy(material); + Materials[i] = null; + } + } + Materials = null; + } + if (Quad != null) + { + if (Quad.GetComponent().mesh != null) + { + UnityEngine.Object.Destroy(Quad.GetComponent().mesh); + Quad.GetComponent().mesh = null; + } + MeshRenderer component = Quad.GetComponent(); + if (component != null && component.sharedMaterial != null) + { + RenderTexture renderTexture = component.sharedMaterial.mainTexture as RenderTexture; + component.sharedMaterial.mainTexture = null; + if (renderTexture != null) + { + renderTexture.Release(); + } + UnityEngine.Object.Destroy(component.sharedMaterial); + component.sharedMaterial = null; + } + UnityEngine.Object.Destroy(Quad); + Quad = null; + } + if (_postEffect != null) + { + _postEffect.Destroy(); + _postEffect = null; + } + } +} diff --git a/SVSim.BattleEngine/Engine/ChateauField.cs b/SVSim.BattleEngine/Engine/ChateauField.cs new file mode 100644 index 0000000..9a1119b --- /dev/null +++ b/SVSim.BattleEngine/Engine/ChateauField.cs @@ -0,0 +1,110 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ChateauField : BackGroundBase +{ + public override int FieldId => 6; + + public ChateauField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_hous_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles06").gameObject; + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + _fieldObjDictionary.Add("door", _fieldModel.transform.Find("md_bf_hous_01_door").gameObject); + _fieldObjDictionary.Add("shelf_door", _fieldModel.transform.Find("md_bf_hous_01_shelf_door").gameObject); + m_FieldAnimatorDictionary.Add("door", _fieldObjDictionary["door"].GetComponent()); + m_FieldAnimatorDictionary.Add("shelf_door", _fieldObjDictionary["shelf_door"].GetComponent()); + _fieldParticleSystemDictionary.Add("clock_gimic_1", _fieldParticles.transform.Find("clock_gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("clock_gimic_2", _fieldParticles.transform.Find("clock_gimic_2").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_6, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_6_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_6_2, pos); + break; + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["door"].SetTrigger("Open"); + _battleCamera.Camera.transform.localPosition = new Vector3(-870f, -690f, -40f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-37f, 90f, -90f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(10f, -10f, -100f), "time", 1.7f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-35f, 105f, -100f), "time", 1.7f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(0f, -20f, -200f), "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeInExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-35f, 10f, -15f), "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeInExpo)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 1f, "delay", 1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 1f, "delay", 1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + int num = Random.Range(1, 3); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_{num}", "se_field_" + _str3DFieldNo, 0f, 0L); + switch (num) + { + case 1: + _fieldParticleSystemDictionary["clock_gimic_1"].Play(); + yield return new WaitForSeconds(5f); + break; + case 2: + m_FieldAnimatorDictionary["shelf_door"].SetTrigger("Open"); + yield return new WaitForSeconds(0.5f); + _fieldParticleSystemDictionary["clock_gimic_2"].Play(); + yield return new WaitForSeconds(5f); + break; + } + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Class3dPostImageEffect.cs b/SVSim.BattleEngine/Engine/Class3dPostImageEffect.cs new file mode 100644 index 0000000..01faea5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Class3dPostImageEffect.cs @@ -0,0 +1,339 @@ +using UnityEngine; + +[ExecuteInEditMode] +public class Class3dPostImageEffect : MonoBehaviour +{ + public int BLOOM_DIVIDER = 4; + + public float BLOOM_WIDTHMOD = 0.5f; + + private const int PASS_FASTBLOOM_DOWNSAMPLE = 1; + + private const int PASS_FASTBLOOM_VERTICALBLUR = 2; + + private const int PASS_FASTBLOOM_HORIZONTALBLUR = 3; + + private const int PASS_POSTDIFFUSIONBLOOM_VERTICALGAUSS = 0; + + private const int PASS_POSTDIFFUSIONBLOOM_HORIZONGAUSS = 1; + + private const int PASS_POSTDIFFUSIONBLOOM_BLOOM = 2; + + private const int PASS_POSTDIFFUSIONBLOOM_OVERLAY1 = 3; + + private const int PASS_POSTDIFFUSIONBLOOM_OVERLAY2 = 5; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_APPLYBG = 0; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_APPLYBGDEBUG = 1; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_COC2ALPHA = 2; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_DOWNSAMPLE = 3; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_FOGBLOOM = 4; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_BLOOMCOLOR = 5; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_VERTICALGAUSS = 6; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_HORIZONGAUSS = 7; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_BLOOM = 8; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_COCBG_RICH = 9; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_COCBGFG = 10; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_OVERLAY1 = 11; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_OVERLAY1_INVERSE = 12; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_OVERLAY2 = 13; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_OVERLAY2_INVERSE = 14; + + private const int PASS_POSTDIFFUSIONDOFBLOOM_COCFG = 15; + + private const float DOF_HEIGHT_BASE_SIZE_HORIZONTAL = 0.0034722222f; + + private const float DOF_HEIGHT_BASE_SIZE_VERTICAL = 0.0010986328f; + + private const float DIVIDE_SCREEN = 1f; + + private const float DOFONEOVERBASESIZE = 0.001953125f; + + private const float DOFBASESIZE = 512f; + + private float _dofWidthOverHeight = 1.25f; + + private float _dofHeightBaseSize = 0.0024414062f; + + private int _rezworkWidth; + + private int _rezworkHeight; + + [SerializeField] + public DofDiffusionBloomOverlayParam _param = new DofDiffusionBloomOverlayParam(); + + [SerializeField] + private Material _postDiffusionBloomMaterial; + + [SerializeField] + private Material _postDiffusionDofBloomMaterial; + + [SerializeField] + private Material _fastBloomMaterial; + + [Header("Antialiasing")] + public bool EnableAntialiasing = true; + + public float edgeThresholdMin = 0.05f; + + public float edgeThreshold = 0.2f; + + public float edgeshilhouette = 4f; + + private Material antialiasingMaterial; + + public void Initialize() + { + _postDiffusionDofBloomMaterial = (_postDiffusionBloomMaterial = new Material(Shader.Find("Class3D/ImageEffects/Rich/PostDiffusionDofBloom_Rich"))); + _fastBloomMaterial = new Material(Shader.Find("Class3D/ImageEffects/FastBloom")); + Shader shader = Shader.Find("Hidden/FXAA III (Console)"); + if (shader != null && shader.isSupported) + { + antialiasingMaterial = new Material(shader); + } + _param.TargetCamera = GetComponent(); + } + + public void Destroy() + { + if (_fastBloomMaterial != null) + { + Object.Destroy(_fastBloomMaterial); + _fastBloomMaterial = null; + } + if (_postDiffusionBloomMaterial != null) + { + Object.Destroy(_postDiffusionBloomMaterial); + _postDiffusionBloomMaterial = null; + } + if (_postDiffusionDofBloomMaterial != null) + { + Object.Destroy(_postDiffusionDofBloomMaterial); + _postDiffusionDofBloomMaterial = null; + } + if (antialiasingMaterial != null) + { + Object.Destroy(antialiasingMaterial); + antialiasingMaterial = null; + } + } + + private static float GetLowResolutionDividerBasedOnQuality(float baseDivider) + { + return baseDivider * 0.5f; + } + + private RenderTexture CreateBloomTexture(RenderTexture source, RenderTexture downSample) + { + RenderTexture renderTexture = null; + int width = source.width / BLOOM_DIVIDER; + int height = source.height / BLOOM_DIVIDER; + if (_param.BloomBlurSize > 0f) + { + Vector4 zero = Vector4.zero; + bool flag = false; + RenderTexture renderTexture2 = downSample; + if (renderTexture2 == null) + { + zero.z = 0f; + zero.w = 1f; + _fastBloomMaterial.SetVector("_Parameter", zero); + renderTexture2 = RenderTexture.GetTemporary(width, height, 0); + renderTexture2.filterMode = FilterMode.Bilinear; + Graphics.Blit(source, renderTexture2, _fastBloomMaterial, 1); + flag = true; + } + float num = 1f * (float)source.width / (1f * (float)source.height); + float bloomBlurSize = _param.BloomBlurSize; + float num2 = 0.001953125f; + zero.x = bloomBlurSize / num * num2; + zero.y = bloomBlurSize * num2; + zero.z = _param.BloomThreshold; + zero.w = _param.BloomIntensity; + _fastBloomMaterial.SetVector("_Parameter", zero); + RenderTexture temporary = RenderTexture.GetTemporary(width, height, 0); + temporary.filterMode = FilterMode.Bilinear; + Graphics.Blit(renderTexture2, temporary, _fastBloomMaterial, 2); + renderTexture = temporary; + temporary = RenderTexture.GetTemporary(width, height, 0); + temporary.filterMode = FilterMode.Bilinear; + Graphics.Blit(renderTexture, temporary, _fastBloomMaterial, 3); + renderTexture.DiscardContents(); + RenderTexture.ReleaseTemporary(renderTexture); + if (flag) + { + renderTexture2.DiscardContents(); + RenderTexture.ReleaseTemporary(renderTexture2); + } + return temporary; + } + Vector4 zero2 = Vector4.zero; + zero2.z = _param.BloomThreshold; + zero2.w = _param.BloomIntensity; + _fastBloomMaterial.SetVector("_Parameter", zero2); + RenderTexture temporary2 = RenderTexture.GetTemporary(width, height, 0); + temporary2.filterMode = FilterMode.Bilinear; + Graphics.Blit(source, temporary2, _fastBloomMaterial, 1); + return temporary2; + } + + private RenderTexture OnRenderImageDiffusionDofBloom(RenderTexture source, RenderTexture destination) + { + PrepareDofParam(source, _postDiffusionDofBloomMaterial); + int num = 2; + RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height, 0); + RenderTexture temporary2 = RenderTexture.GetTemporary(_rezworkWidth, _rezworkHeight, 0); + RenderTexture temporary3 = RenderTexture.GetTemporary(_rezworkWidth, _rezworkHeight, 0); + RenderTexture temporary4 = RenderTexture.GetTemporary(_rezworkWidth, _rezworkHeight, 0); + num = 9; + if (_param.DofQualityType == DepthBlurAndBloom.DofQuality.BackgroundAndForeground) + { + _postDiffusionDofBloomMaterial.SetFloat("_dofForegroundSize", _param.DofForegroundSize); + num = 10; + } + Graphics.Blit(source, temporary, _postDiffusionDofBloomMaterial, num); + Graphics.Blit(temporary, temporary4, _postDiffusionDofBloomMaterial, 3); + BlurBlt(temporary4, temporary2, _param.DofMaxBlurSpread); + DiffusionFilterProcess(temporary2, temporary3); + _postDiffusionDofBloomMaterial.SetTexture("_TapLowBackground", temporary3); + RenderTexture renderTexture = null; + if (_param.IsEnableBloom) + { + renderTexture = CreateBloomTexture(temporary, temporary4); + _postDiffusionDofBloomMaterial.SetTexture("_Bloom", renderTexture); + _postDiffusionDofBloomMaterial.SetFloat("_BloomIsScreenBlend", (_param.BloomBlendMode == DofDiffusionBloomOverlayParam.BloomScreenBlendMode.Screen) ? 1f : 0f); + _param.ScreenOverlay.PostFilmBlit(temporary, destination, _postDiffusionDofBloomMaterial, 8, 11, 13); + } + else + { + _postDiffusionDofBloomMaterial.SetFloat("_BloomIsScreenBlend", 0f); + _param.ScreenOverlay.PostFilmBlit(temporary, destination, _postDiffusionDofBloomMaterial, -1, 11, 13); + } + if (renderTexture != null) + { + renderTexture.DiscardContents(); + RenderTexture.ReleaseTemporary(renderTexture); + renderTexture = null; + } + if (temporary != source) + { + temporary.DiscardContents(); + RenderTexture.ReleaseTemporary(temporary); + temporary = null; + } + if (temporary2 != null) + { + temporary2.DiscardContents(); + RenderTexture.ReleaseTemporary(temporary2); + temporary2 = null; + } + if (temporary3 != null) + { + temporary3.DiscardContents(); + RenderTexture.ReleaseTemporary(temporary3); + temporary3 = null; + } + if (temporary4 != null) + { + temporary4.DiscardContents(); + RenderTexture.ReleaseTemporary(temporary4); + temporary4 = null; + } + return destination; + } + + private void PrepareDofParam(RenderTexture source, Material mtrl) + { + source.filterMode = FilterMode.Bilinear; + source.wrapMode = TextureWrapMode.Clamp; + Camera targetCamera = _param.TargetCamera; + float num = targetCamera.farClipPlane - targetCamera.nearClipPlane; + float num2 = 0.1f; + Vector4 zero = Vector4.zero; + switch (_param.DofFocalType) + { + case DepthBlurAndBloom.DofFocalType.Transform: + num2 = ((!(_param.DofFocalTransfrom != null)) ? FocalDistance01(_param.DofFocalPoint) : (targetCamera.WorldToViewportPoint(_param.DofFocalTransfrom.position).z / num)); + break; + case DepthBlurAndBloom.DofFocalType.Position: + num2 = targetCamera.WorldToViewportPoint(_param.DofFocalPosition).z / num; + break; + case DepthBlurAndBloom.DofFocalType.Point: + num2 = FocalDistance01(_param.DofFocalPoint); + break; + } + if (num2 < 0f) + { + num2 = 0f; + } + if (_param.DofSmoothness < 0.1f) + { + _param.DofSmoothness = 0.1f; + } + zero.x = 1f / (float)source.width; + zero.y = 1f / (float)source.height; + mtrl.SetVector("_InvRenderTargetSize", zero); + float num3 = num2 * _param.DofSmoothness; + float num4 = num3; + _dofWidthOverHeight = (float)source.width / (float)source.height; + _dofHeightBaseSize = ((source.width > source.height) ? 0.0034722222f : 0.0010986328f); + float num5 = 1E-06f; + zero.x = ((num3 < num5) ? 0f : (1f / num3)); + zero.y = ((num4 < num5) ? 0f : (1f / num4)); + zero.z = _param.DofFocalSize / num * 0.5f + num2; + mtrl.SetVector("_CurveParams", zero); + mtrl.SetFloat("_bloomDofWeight", _param.BloomDofWeight); + float lowResolutionDividerBasedOnQuality = GetLowResolutionDividerBasedOnQuality(1f); + _rezworkWidth = (int)((float)source.width * lowResolutionDividerBasedOnQuality); + _rezworkHeight = (int)((float)source.height * lowResolutionDividerBasedOnQuality); + } + + private float FocalDistance01(float worldDist) + { + return _param.TargetCamera.WorldToViewportPoint((worldDist - _param.TargetCamera.nearClipPlane) * _param.TargetCamera.transform.forward + _param.TargetCamera.transform.position).z / (_param.TargetCamera.farClipPlane - _param.TargetCamera.nearClipPlane); + } + + private void DiffusionFilterProcess(RenderTexture source, RenderTexture destination) + { + float lowResolutionDividerBasedOnQuality = GetLowResolutionDividerBasedOnQuality(1f); + RenderTexture temporary = RenderTexture.GetTemporary(_rezworkWidth, _rezworkHeight, 0); + Vector4 zero = Vector4.zero; + zero.x = _param.DiffusionBlurSize * lowResolutionDividerBasedOnQuality / (float)_rezworkWidth; + zero.y = _param.DiffusionBlurSize * lowResolutionDividerBasedOnQuality / (float)_rezworkHeight; + _postDiffusionDofBloomMaterial.SetVector("_PixelSize", zero); + zero.x = _param.DiffusionBright; + zero.y = _param.DiffusionSaturation; + zero.z = _param.DiffusionContrast; + zero.w = _param.DiffusionThreshold; + _postDiffusionDofBloomMaterial.SetVector("_ColorParam", zero); + _postDiffusionDofBloomMaterial.mainTexture = source; + Graphics.Blit(null, temporary, _postDiffusionDofBloomMaterial, 6); + _postDiffusionDofBloomMaterial.mainTexture = temporary; + Graphics.Blit(null, destination, _postDiffusionDofBloomMaterial, 7); + _postDiffusionDofBloomMaterial.mainTexture = null; + if (temporary != null) + { + temporary.DiscardContents(); + RenderTexture.ReleaseTemporary(temporary); + temporary = null; + } + } + + private void BlurBlt(RenderTexture from, RenderTexture to, float spread) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Class3dScreenOverlay.cs b/SVSim.BattleEngine/Engine/Class3dScreenOverlay.cs new file mode 100644 index 0000000..c33cab2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Class3dScreenOverlay.cs @@ -0,0 +1,343 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +[Serializable] +public class Class3dScreenOverlay +{ + [Serializable] + public class Overlay + { + public enum PostFilmMode + { + None, + Lerp, + Add, + Mul, + VignetteLerp, + VignetteAdd, + VignetteMul, + Monochrome, + ScreenBlend, + VignetteScreenBlend + } + + public enum LayerMode + { + Color, + UVMovie, + UVMovieNoScale + } + + public enum ColorBlend + { + None, + Lerp, + Additive, + Multiply + } + + public static readonly string[] SHADER_KEYWORD_MODE = new string[10] { "MODE_NONE", "MODE_LERP", "MODE_ADD", "MODE_MUL", "MODE_VIGNETTE_LERP", "MODE_VIGNETTE_ADD", "MODE_VIGNETTE_MUL", "MODE_MONOCHROME", "MODE_SCREENBLEND", "MODE_VIGNETT_SCREENBLEND" }; + + public static readonly string[] SHADER_KEYWORD_BLEND = new string[5] { "COLOR_ONLY", "BLEND_NONE", "BLEND_LERP", "BLEND_ADD", "BLEND_MUL" }; + + public const float DEFAULT_DEPTH_CLIP = 2f; + + public PostFilmMode postFilmMode; + + public float postFilmPower; + + public float depthPower; + + public float DepthClip = 2f; + + public Vector2 postFilmOffsetParam = Vector2.zero; + + public Vector4 postFilmOptionParam = Vector4.zero; + + public Color postFilmColor0 = Color.black; + + public Color postFilmColor1 = Color.black; + + public Color postFilmColor2 = Color.black; + + public Color postFilmColor3 = Color.black; + + public bool inverseVignette; + + public LayerMode layerMode; + + public ColorBlend colorBlend; + + public int movieResId; + + private bool _isExistMovieMask; + + private Texture _movieTexture; + + private Texture _movieMaskTexture; + + private Vector2 _movieTextureScale = Vector2.one; + + private Vector2 _movieTextureOffset = Vector2.zero; + + public float colorBlendFactor; + + public Vector4 RollParameter; + + public Vector4 ScaleParameter = Vector4.one; + + private bool _isUVMovieNoScale; + + public bool IsEnableDepth = true; + + public void SetMovieInfo(Texture texMovie, Texture texMask, Vector2 scale, Vector2 offset) + { + _movieTexture = texMovie; + _movieMaskTexture = texMask; + _movieTextureScale = scale; + _movieTextureOffset = offset; + _isExistMovieMask = !(texMask == null); + } + + public void SetScale(Vector2 scale) + { + ScaleParameter.x = 1f / scale.x; + ScaleParameter.y = 1f / scale.y; + } + + public void SetRollAngle(float angle) + { + RollParameter.x = Mathf.Sin(angle * (float)Math.PI / 180f); + RollParameter.y = Mathf.Cos(angle * (float)Math.PI / 180f); + } + + public Overlay() + { + SetRollAngle(0f); + } + + private static void SetShaderKeyword(int id, string[] _arrKeywords, Material mtrl) + { + for (int i = 0; i < _arrKeywords.Length; i++) + { + if (id != i) + { + mtrl.DisableKeyword(_arrKeywords[i]); + } + } + if (0 < id && id < _arrKeywords.Length) + { + mtrl.EnableKeyword(_arrKeywords[id]); + } + } + + public void Update(Material mtrl, RenderTexture mainTexture) + { + if (mtrl == null) + { + return; + } + SetShaderKeyword((int)postFilmMode, SHADER_KEYWORD_MODE, mtrl); + switch (layerMode) + { + case LayerMode.Color: + SetShaderKeyword((int)layerMode, SHADER_KEYWORD_BLEND, mtrl); + break; + case LayerMode.UVMovie: + case LayerMode.UVMovieNoScale: + SetShaderKeyword((int)layerMode + (int)colorBlend, SHADER_KEYWORD_BLEND, mtrl); + if (_movieTexture != null) + { + mtrl.SetTexture("_texMovie", _movieTexture); + float num = 0f; + float num2 = (float)mainTexture.width / num; + float num3 = (float)mainTexture.height / num; + float num4 = 7f; + float num5 = 3f; + if (2.3333333f > num2 / num3) + { + num4 *= Mathf.Ceil(num2 / num4); + num5 *= Mathf.Ceil(num3 / num5); + } + ScaleParameter.z = num2 / num4; + ScaleParameter.w = num3 / num5; + } + break; + } + _isUVMovieNoScale = layerMode == LayerMode.UVMovieNoScale; + if (_isExistMovieMask && _movieMaskTexture != null) + { + mtrl.SetTexture("_texMovieMask", _movieMaskTexture); + } + mtrl.SetVector("_movieScale", _movieTextureScale); + mtrl.SetVector("_movieOffset", _movieTextureOffset); + mtrl.SetFloat("_colorBlendFactor", colorBlendFactor); + } + + public bool IsDepthValid() + { + if (!IsEnableDepth) + { + return false; + } + return IsValid(); + } + + public bool IsValid() + { + bool result = true; + switch (postFilmMode) + { + case PostFilmMode.Monochrome: + result = postFilmColor0.a > 0f; + break; + case PostFilmMode.None: + result = false; + break; + default: + result = postFilmPower > 0f; + break; + case PostFilmMode.Mul: + case PostFilmMode.VignetteLerp: + case PostFilmMode.VignetteMul: + break; + } + return result; + } + + public void Blit(RenderTexture source, RenderTexture destination, Material material, int pass) + { + if (inverseVignette) + { + pass++; + } + Update(material, source); + Vector4 value = new Vector4(postFilmOffsetParam.x, postFilmOffsetParam.y); + material.SetFloat("_PostFilmPower", postFilmPower); + material.SetFloat("_DepthPower", depthPower); + float value2 = ((!(DepthClip > 1.5f)) ? (1.5f - DepthClip) : 0f); + material.SetFloat("_DepthClip", value2); + material.SetVector("_PostFilmOffsetParam", value); + material.SetVector("_PostFilmOptionParam", postFilmOptionParam); + material.SetColor("_PostFilmColor0", postFilmColor0); + material.SetColor("_PostFilmColor1", postFilmColor1); + material.SetColor("_PostFilmColor2", postFilmColor2); + material.SetColor("_PostFilmColor3", postFilmColor3); + RollParameter.z = (float)source.width / (float)source.height; + material.SetVector("_PostFilmRollParameter", RollParameter); + material.SetVector("_PostFilmScaleParameter", ScaleParameter); + material.SetFloat("_PostFilmIsUVMovieNoScale", _isUVMovieNoScale ? 1f : 0f); + material.SetFloat("_PostFilmIsInverseVignette", inverseVignette ? 1f : 0f); + material.SetFloat("_PostFilmIsAlphaMasking", _isExistMovieMask ? 1f : 0f); + material.SetFloat("_PostFilmIsWithoutDepth", IsEnableDepth ? 0f : 1f); + Graphics.Blit(source, destination, material, pass); + } + } + + [SerializeField] + [Header("Screen Overlay - First layer")] + private Overlay _overlay1 = new Overlay(); + + [SerializeField] + [Header("Screen Overlay - Second layer")] + private Overlay _overlay2 = new Overlay(); + + [SerializeField] + [Header("Screen Overlay - Third layer")] + private Overlay _overlay3 = new Overlay(); + + public bool IsScreenOverlay = true; + + public Overlay Overlay1 => _overlay1; + + public Overlay Overlay2 => _overlay2; + + public Overlay Overlay3 => _overlay3; + + public bool IsEnable + { + get + { + if (!_overlay1.IsValid() && !_overlay2.IsValid()) + { + return _overlay3.IsValid(); + } + return true; + } + } + + public bool IsUseDepthTexture + { + get + { + if (!_overlay1.IsDepthValid() && !_overlay2.IsDepthValid()) + { + return _overlay3.IsDepthValid(); + } + return true; + } + } + + public void PostFilmBlit(RenderTexture source, RenderTexture destination, Material material, int defaultPass, int filmPass1st, int filmPass2nd) + { + if (material == null || !IsScreenOverlay) + { + Graphics.Blit(source, destination); + return; + } + bool num = Overlay1.IsValid(); + bool flag = Overlay2.IsValid(); + bool flag2 = Overlay3.IsValid(); + RenderTexture renderTexture = destination; + RenderTexture source2 = source; + if (flag || flag2) + { + renderTexture = RenderTexture.GetTemporary(source.width, source.height, source.depth); + } + if (num) + { + Overlay1.Blit(source2, renderTexture, material, filmPass1st); + } + else if (defaultPass >= 0) + { + Graphics.Blit(source2, renderTexture, material, defaultPass); + } + else + { + Graphics.Blit(source2, renderTexture); + } + source2 = renderTexture; + renderTexture = destination; + if (flag) + { + if (flag2) + { + renderTexture = RenderTexture.GetTemporary(source.width, source.height, source.depth); + } + Overlay2.Blit(source2, renderTexture, material, filmPass2nd); + if (source2 != source) + { + RenderTexture.ReleaseTemporary(source2); + source2 = renderTexture; + renderTexture = destination; + } + } + if (flag2) + { + Overlay3.Blit(source2, renderTexture, material, filmPass2nd); + if (source2 != source) + { + RenderTexture.ReleaseTemporary(source2); + source2 = renderTexture; + renderTexture = destination; + } + } + } + + public static void SetShaderVariantKeyword(List keywordList) + { + keywordList.AddRange(Overlay.SHADER_KEYWORD_MODE); + keywordList.AddRange(Overlay.SHADER_KEYWORD_BLEND); + } +} diff --git a/SVSim.BattleEngine/Engine/ClassBattleCardBase.cs b/SVSim.BattleEngine/Engine/ClassBattleCardBase.cs new file mode 100644 index 0000000..125a3ca --- /dev/null +++ b/SVSim.BattleEngine/Engine/ClassBattleCardBase.cs @@ -0,0 +1,387 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Battle.Card; +using Wizard.Battle.Card.InnerOptions; +using Wizard.Battle.Resource; +using Wizard.Battle.UI; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public abstract class ClassBattleCardBase : BattleCardBase +{ + public class ClassBuildInfo + { + public int charaId; + + public bool isPlayer; + + public int life; + + public BattlePlayerBase selfBattlePlayer; + + public BattlePlayerBase opponentBattlePlayer; + + public BattleManagerBase battleMgr; + + public IBattleResourceMgr resourceMgr; + + public ClassBuildInfo(bool _isPlayer, int _life, BattlePlayerBase _selfBattlePlayer, BattlePlayerBase _opponentBattlePlayer, BattleManagerBase _battleMgr, IBattleResourceMgr _resourceMgr) + { + isPlayer = _isPlayer; + life = _life; + selfBattlePlayer = _selfBattlePlayer; + opponentBattlePlayer = _opponentBattlePlayer; + battleMgr = _battleMgr; + resourceMgr = _resourceMgr; + } + + public ClassBuildInfo VirtualClone(BattlePlayerBase virtualSelfBattlePlayer, BattlePlayerBase virtualOpponentBattlePlayer) + { + return new ClassBuildInfo(isPlayer, life, virtualSelfBattlePlayer, virtualOpponentBattlePlayer, battleMgr, resourceMgr); + } + } + + protected readonly ClassBuildInfo _classBuildInfo; + + private readonly ClassBattleCardViewBase _classCardView; + + protected int _baseMaxLife; + + public int BossRushStartLife; + + private static SkillCreator.CardSkillsBuildInfo _sharedEmptySkillInfo; + + public override int BaseMaxLife => _baseMaxLife; + + public override bool IsDead + { + get + { + if (base.IsDead) + { + return true; + } + if (base.SelfBattlePlayer.IsShortageDeck && !base.SelfBattlePlayer.IsShortageDeckWin) + { + return true; + } + if (base.OpponentBattlePlayer.IsShortageDeck && base.OpponentBattlePlayer.IsShortageDeckWin) + { + return true; + } + return false; + } + } + + public override bool IsLifeZeroDead + { + get + { + if (base.Life <= 0) + { + return !base.SkillApplyInformation.IsLifeZeroActivateLeonSkill; + } + return false; + } + } + + public int CharaId + { + get + { + if (!_classBuildInfo.isPlayer) + { + return GameMgr.GetIns().GetDataMgr().GetEnemyCharaId(); + } + return GameMgr.GetIns().GetDataMgr().GetPlayerCharaId(); + } + } + + public override bool Attackable => false; + + public override bool IsClass => true; + + public override bool IsOnDraw => false; + + public override bool IsCantAttackClass => base.SkillApplyInformation.IsSkillCantAtkClass; + + public IClassBattleCardView ClassBattleCardView { get; private set; } + + public event Action OnDamageDestroy; + + public event Action OnForceBerserkChange; + + public event Func OnBerserkCheck; + + public event Action OnForceAvariceChange; + + public event Func OnAvariceCheck; + + public event Action OnForceWrathChange; + + public event Func OnWrathCheck; + + public event Func OnRetire; + + public VfxBase GetOnBerserkCheck(bool flg) + { + return this.OnBerserkCheck.GetAllFuncVfxResults(flg); + } + + public void CallOnForceBerserkChange(int num) + { + this.OnForceBerserkChange.Call(base.SelfBattlePlayer, num); + } + + public VfxBase GetOnAvariceCheck(bool flag) + { + return this.OnAvariceCheck.GetAllFuncVfxResults(flag); + } + + public void CallOnForceAvariceChange(int number) + { + this.OnForceAvariceChange.Call(base.SelfBattlePlayer, number); + } + + public VfxBase GetOnWrathCheck(bool flag) + { + return this.OnWrathCheck.GetAllFuncVfxResults(flag); + } + + public void CallOnForceWrathChange(int number) + { + this.OnForceWrathChange.Call(base.SelfBattlePlayer, number); + } + + protected ClassBattleCardBase(ClassBuildInfo classBuildInfo) + : base(CreateBaseBuildInfo(classBuildInfo)) + { + _classBuildInfo = classBuildInfo; + } + + public override void Setup(bool createNullView = false, bool isRecreate = false) + { + base.Setup(); + _CacheBattlePlayer(); + ClassBattleCardView = (IClassBattleCardView)base.BattleCardView; + } + + public void InitBaseMaxLife(int baseMaxLife) + { + _baseMaxLife = baseMaxLife; + } + + protected virtual void _CacheBattlePlayer() + { + base.SelfBattlePlayer = (base.IsPlayer ? ((BattlePlayerBase)_classBuildInfo.battleMgr.BattlePlayer) : ((BattlePlayerBase)_classBuildInfo.battleMgr.BattleEnemy)); + base.OpponentBattlePlayer = ((!base.IsPlayer) ? ((BattlePlayerBase)_classBuildInfo.battleMgr.BattlePlayer) : ((BattlePlayerBase)_classBuildInfo.battleMgr.BattleEnemy)); + } + + public override DamageResult ApplyDamage(SkillBase skill, DamageParam damageParam, bool doesAttackerPossessKiller, bool isReflectedDamage, SkillProcessor skillProcessor, BattleCardBase reflectCard) + { + int damage = damageParam.Damage; + bool isSkillDamage = skill != null; + bool isSpellDamage = skill?.SkillPrm.ownerCard.IsSpell ?? false; + BattleCardBase damageReflectionTarget = GetDamageReflectionTarget(isSkillDamage); + if (damageReflectionTarget != this) + { + return damageReflectionTarget.ApplyDamage(skill, damageParam, doesAttackerPossessKiller: false, isReflectedDamage: true, skillProcessor, this); + } + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + damageParam.Damage = CalculateFinalDamageAmount(damageParam.Damage, isSkillDamage, isSpellDamage, parallelVfxPlayer); + int damage2 = damageParam.Damage; + new SkillConditionCheckerOption + { + DefaultDamage = new DamageInfo(skill, damage), + FixedDamage = new DamageInfo(skill, damage2) + }; + BattleManagerBase ins = BattleManagerBase.GetIns(); + base.SkillApplyInformation.DamageLife(damageParam.Damage, ins.CurrentTurn, ins.BattlePlayer.IsSelfTurn); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(ParallelVfxPlayer.Create(CreateVfxWithCardPlayabilityRefresh(base.VfxCreator.CreateDamage(damageParam.Damage, base.Life, base.MaxLife, BaseMaxLife, isReflectedDamage, isSkillDamage)), parallelVfxPlayer)); + SequentialVfxPlayer sequentialVfxPlayer2 = SequentialVfxPlayer.Create(); + if (IsDead) + { + sequentialVfxPlayer2.Register(CreatePullHandInVfx()); + this.OnDamageDestroy.Call(); + } + base.SelfBattlePlayer.BattleMgr.VfxMgr.RegisterImmediateVfx(this.OnBerserkCheck.GetAllFuncVfxResults(arg1: false)); + skillProcessor?.Register(base.Skills.CreateWhenDamageInfo(skill, skillProcessor, new BattlePlayerReadOnlyInfoPair(base.SelfBattlePlayer, base.OpponentBattlePlayer), damage, damageParam.Damage)); + sequentialVfxPlayer.Register(base.ApplyDamage(skill, damageParam, doesAttackerPossessKiller, isReflectedDamage, skillProcessor, reflectCard).Vfx); + sequentialVfxPlayer.Register(base.SelfBattlePlayer.StartSkillWhenChangeClassLife(skillProcessor)); + return new DamageResult(sequentialVfxPlayer, damageParam.Damage, damage2, sequentialVfxPlayer2, null, isReflectedDamage); + } + + public override HealResult ApplyHealing(HealParam healParam, SkillProcessor skillProcessor) + { + BattleManagerBase ins = BattleManagerBase.GetIns(); + int num = HealLife(healParam.HealAmount, ins.CurrentTurn, ins.BattlePlayer.IsSelfTurn); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(CreateVfxWithCardPlayabilityRefresh(base.VfxCreator.CreateHealing(num, base.Life, base.MaxLife, BaseMaxLife))); + new SkillConditionCheckerOption().HealingCardAndValue = new List + { + new BattlePlayerBase.CardAndValue(this, num) + }; + base.SelfBattlePlayer.BattleMgr.VfxMgr.RegisterImmediateVfx(this.OnBerserkCheck.GetAllFuncVfxResults(arg1: false)); + if (skillProcessor != null) + { + sequentialVfxPlayer.Register(base.SelfBattlePlayer.StartSkillWhenChangeClassLife(skillProcessor)); + } + return new HealResult(num, sequentialVfxPlayer, CreatePullHandInVfx()); + } + + private VfxBase CreatePullHandInVfx() + { + return base.SelfBattlePlayer.BattleView.HandView.HandUnfocus(); + } + + private VfxBase CreatePullHandOutVfx() + { + if (base.IsSelfTurn) + { + return base.SelfBattlePlayer.BattleView.HandView.HandFocus(); + } + return NullVfx.GetInstance(); + } + + public VfxBase DestroyBySpecialWin() + { + return ((ClassCardVfxCreatorBase)base.VfxCreator).CreateDestroy(base.DeathTypeInfo, base.SelfBattlePlayer); + } + + public VfxBase Retire() + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(this.OnRetire.GetAllFuncVfxResults(this, new SkillProcessor())); + sequentialVfxPlayer.Register(((ClassCardVfxCreatorBase)base.VfxCreator).CreateRetire(base.SelfBattlePlayer)); + return sequentialVfxPlayer; + } + + public VfxBase LifeZeroActivateLeonSkill() + { + if (base.IsDestroyedBySkill || base.SelfBattlePlayer.IsShortageDeck || base.OpponentBattlePlayer.Class.IsDead || (base.OpponentBattlePlayer.IsShortageDeck && base.OpponentBattlePlayer.IsShortageDeckWin)) + { + base.SkillApplyInformation.DepriveLifeZeroActivateLeonSkill(); + return NullVfx.GetInstance(); + } + int num = 10; + int cardId = 104741020; + string fileName = "stt_quest_leon_1"; + string criSeName = "se_stt_quest_leon_1"; + float waitTime = 0.6f; + string fileName2 = "stt_quest_leon_2"; + string criSeName2 = "se_stt_quest_leon_2"; + float waitTime2 = 0.5f; + float num2 = 2f; + float num3 = 3.5f; + float waitTime3 = 0f; + float waitTime4 = 1.5f; + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + ParallelVfxPlayer parallelVfxPlayer2 = ParallelVfxPlayer.Create(); + List list = new List(); + list.AddRange(base.SelfBattlePlayer.InPlayCards); + list.AddRange(base.OpponentBattlePlayer.InPlayCards); + VfxBase vfxBase = null; + vfxBase = ((!base.OpponentBattlePlayer.IsSelfTurn) ? WaitVfx.Create(waitTime3) : WaitVfx.Create(waitTime4)); + parallelVfxPlayer.Register(SequentialVfxPlayer.Create(vfxBase, base.SelfBattlePlayer.Emotion.PlayEmotion(ClassCharaPrm.EmotionType.PROVOCATION, 0f))); + sequentialVfxPlayer.Register(WaitVfx.Create(base.OpponentBattlePlayer.IsSelfTurn ? num3 : num2)); + MaxLifeSetModifier lifeModifier = new MaxLifeSetModifier(num); + sequentialVfxPlayer.Register(base.SkillApplyInformation.GiveCombatValueModifier(null, lifeModifier, new SkillProcessor())); + int num4 = ((base.Life < 0) ? (base.Life * -1) : 0); + if (num4 != 0) + { + HealLife(num4, base.SelfBattlePlayer.Turn, base.SelfBattlePlayer.IsSelfTurn); + } + sequentialVfxPlayer.Register(new LoadAndPlayEffectVfx(fileName, criSeName, base.SelfBattlePlayer.BattleMgr.IsRecovery ? null : base.BattleCardView.Transform, waitTime)); + HealParam healParam = new HealParam(num, this, this, applyModifier: false); + HealResult healResult = ApplyHealing(healParam, new SkillProcessor()); + sequentialVfxPlayer.Register(healResult.PrehealVfxVfx); + sequentialVfxPlayer.Register(healResult.HealVfx); + sequentialVfxPlayer.Register(healResult.PosthealVfxVfx); + base.SkillApplyInformation.DepriveLifeZeroActivateLeonSkill(); + sequentialVfxPlayer.Register(new LoadAndPlayEffectVfx(fileName2, criSeName2, Vector3.zero, waitTime2)); + for (int i = 0; i < list.Count; i++) + { + if (list[i].SkillApplyInformation.IsIndependent) + { + sequentialVfxPlayer.Register(new OneShotHeavenlyAegisPlayVfx(list[i].BattleCardView)); + continue; + } + list[i].FlagCardAsDestroyedBySkill(); + parallelVfxPlayer2.Register(list[i].SelfBattlePlayer.CardManagement(list[i], new SkillProcessor(), BattlePlayerBase.CARD_MANAGEMENT.BANISH, isRandom: false)); + } + sequentialVfxPlayer.Register(parallelVfxPlayer2); + SkillBaseSummon.SummonedCardsList summonedCardsList = new SkillBaseSummon.SummonedCardsList(); + summonedCardsList.AddCardToSummonedCards(base.SelfBattlePlayer.CreateNextIndexCard(cardId)); + BattlePlayerBase.SummonInfo summonInfo = new BattlePlayerBase.SummonInfo(base.SelfBattlePlayer.IsPlayer, summonedCardsList, SkillBaseSummon.SUMMON_TYPE.TOKEN); + VfxWithLoadingSequential vfxWithLoadingToRegister = base.SelfBattlePlayer.CardManagement(null, new SkillProcessor(), BattlePlayerBase.CARD_MANAGEMENT.SUMMON, isRandom: false, null, null, null, summonInfo) as VfxWithLoadingSequential; + base.SelfBattlePlayer.UpdateHandCardsPlayability(); + StartPickMultiCardVfx vfxToRegister = new StartPickMultiCardVfx(summonedCardsList, BattleManagerBase.GetIns().BattleResourceMgr, base.SelfBattlePlayer.IsPlayer, isToken: true, isIgnoreVoice: false, isRandomVoice: false, isGetoff: false, isEvoVoice: false, 0f); + if (!base.SelfBattlePlayer.BattleMgr.IsVirtualBattle) + { + BattleLogManager.GetInstance().BeginLogBlockTurnChangeReactive(); + BattleLogManager.GetInstance().AddLogSkillBuffSetLife(this, Wizard.Battle.UI.LogType.WhenDestroy, new List { this }, num, isTargetInOpponentHand: false); + BattleLogManager.GetInstance().AddLogSkillHeal(new List { this }, new List { healResult }); + BattleLogManager.GetInstance().AddLogSkillDeath(list.Where((BattleCardBase c) => !c.SkillApplyInformation.IsIndependent).ToList()); + BattleLogManager.GetInstance().AddLogSkillSummon(summonedCardsList.summonedCards.ToList()); + BattleLogManager.GetInstance().EndLogBlockTurnChangeReactive(); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterToMainVfx(vfxToRegister); + vfxWithLoadingSequential.RegisterVfxWithLoading(vfxWithLoadingToRegister); + sequentialVfxPlayer.Register(vfxWithLoadingSequential); + parallelVfxPlayer.Register(sequentialVfxPlayer); + return parallelVfxPlayer; + } + + public override VfxBase LoadResource(bool isLogging = false) + { + return ClassBattleCardView.LoadResource(); + } + + public override VfxBase UnloadResource() + { + return ClassBattleCardView.UnloadResource(); + } + + public override VfxBase RecoveryInPlay(int inPlayIndex, bool newReplayMoveTurn = false) + { + return SequentialVfxPlayer.Create(base.BattleCardView.RecoveryInPlay(), new RefreshHealthVfx(base.SelfBattlePlayer)); + } + + public override BattleCardBase VirtualClone(BattlePlayerBase virtualSelfBattlePlayer, BattlePlayerBase virtualOpponentBattlePlayer) + { + VirtualClassBattleCard virtualClassBattleCard = new VirtualClassBattleCard(_classBuildInfo.VirtualClone(virtualSelfBattlePlayer, virtualOpponentBattlePlayer)); + virtualClassBattleCard.InitBaseMaxLife(BaseMaxLife); + CopyToVirtualCardBase(virtualClassBattleCard); + return virtualClassBattleCard; + } + + public void ClearSpineObject() + { + if (ClassBattleCardView != null) + { + ClassBattleCardView.ClearSpineObject(); + } + } + + private static BuildInfo CreateBaseBuildInfo(ClassBuildInfo classBuildInfo) + { + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(0); + if (_sharedEmptySkillInfo == null) + { + _sharedEmptySkillInfo = SkillCreator.CreateBuildInfo(cardParameterFromId); + } + return new BuildInfo(null, 0, classBuildInfo.selfBattlePlayer, classBuildInfo.opponentBattlePlayer, classBuildInfo.selfBattlePlayer, _isPlayer: classBuildInfo.isPlayer, _innerOptions: new CardInnerOptionsBase(), _normalSkillBuildInfos: _sharedEmptySkillInfo.normalSkillBuildInfos, _evolveSkillBuildInfos: _sharedEmptySkillInfo.evolveSkillBuildInfos, _battleCardIndex: 0, _battleMgr: classBuildInfo.battleMgr, _resourceMgr: classBuildInfo.resourceMgr); + } + + protected override ISkillApplyInformation CreateSkillApplyInformation(BattleCardBase card, ICardVfxCreator vfxCreator) + { + return new ClassSkillApplyInformation(card, vfxCreator); + } +} diff --git a/SVSim.BattleEngine/Engine/ClassCharaExp.cs b/SVSim.BattleEngine/Engine/ClassCharaExp.cs new file mode 100644 index 0000000..ae1cd10 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ClassCharaExp.cs @@ -0,0 +1,8 @@ +public class ClassCharaExp : HeaderData +{ + public int level; + + public int necessary_exp; + + public int accumulate_exp; +} diff --git a/SVSim.BattleEngine/Engine/ClassSkinPlate.cs b/SVSim.BattleEngine/Engine/ClassSkinPlate.cs new file mode 100644 index 0000000..036bfcd --- /dev/null +++ b/SVSim.BattleEngine/Engine/ClassSkinPlate.cs @@ -0,0 +1,208 @@ +using System; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Scripts.Network.Data.TaskData.SkinPurchase; + +public class ClassSkinPlate : MonoBehaviour +{ + private const int MAX_LENGTH_VIEW_SINGLE_PRODUCT_NAME = 15; + + private const int MAX_LENGTH_VIEW_SINGLE_PRODUCT_NAME_ALPHABET = 35; + + private const int MAX_LENGTH_VIEW_LARGE_SIZE_PRODUCT_NAME = 20; + + private const int MAX_LENGTH_VIEW_LARGE_SIZE_PRODUCT_NAME_ALPHABET = 39; + + private const int WIDTH_PRODUCT_BG_SPRITE_NORMAL = 357; + + private const int WIDTH_PRODUCT_BG_SPRITE_LARGE = 411; + + private readonly Vector3 POS_VIEW_SINGLE_PRODUCT_NAME = new Vector3(13f, -52f, 0f); + + private readonly Vector3 POS_VIEW_MULTI_PRODUCT_NAME = new Vector3(0f, -52f, 0f); + + [SerializeField] + private UIEventListener _eventListenerSkinImage; + + [SerializeField] + private UISprite _spritePlateBG; + + [SerializeField] + private UILabel _labelFree; + + [SerializeField] + private UILabel _labelCostCrystal; + + [SerializeField] + private UILabel _labelCostRupy; + + [SerializeField] + private UILabel _labelCostTicket; + + [SerializeField] + private UIButton m_BtnBuy; + + [SerializeField] + private UILabel m_LabelBuy; + + [SerializeField] + private UILabel m_LabelPurchased; + + [SerializeField] + private UILabel _LabelProductName; + + [SerializeField] + private UITexture _uiClassSkinTexture; + + [SerializeField] + private UITexture _uiClassSkinTextureLarge; + + [SerializeField] + private UISprite _spriteClassColorIcon; + + [SerializeField] + private UITexture _leaderSkinTicketIcon; + + public SkinProductInfo ProductInfo { get; private set; } + + public SkinSeriesPurchaseInfo SeriesInfo { get; private set; } + + public Texture ImageTexture { get; private set; } + + private void Start() + { + m_LabelPurchased.text = Data.SystemText.Get("Shop_0100"); + } + + public void SetMultiData(SkinSeriesPurchaseInfo seriesInfo, EventDelegate onPushBuyBtnCallback = null, Action onTapSkinImage = null) + { + SetBuyButtonToGrey(isGrey: false); + bool isLargeImage = Data.Master.LeaderSkinSeriesIdDic[seriesInfo.series_id].IsLargeImage; + ProductInfo = null; + SeriesInfo = seriesInfo; + Texture mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(seriesInfo.saleInfo.path, ResourcesManager.AssetLoadPathType.ShopClassSkin, isfetch: true)); + if (isLargeImage) + { + _uiClassSkinTexture.gameObject.SetActive(value: false); + _uiClassSkinTextureLarge.gameObject.SetActive(value: true); + _uiClassSkinTextureLarge.mainTexture = mainTexture; + _spritePlateBG.width = 411; + int maxLength = (Global.IsAlphabetLanguage() ? 39 : 20); + _LabelProductName.text = ShopCommonUtility.TrimProductName(seriesInfo.saleInfo.name, maxLength); + } + else + { + _uiClassSkinTexture.gameObject.SetActive(value: true); + _uiClassSkinTextureLarge.gameObject.SetActive(value: false); + _uiClassSkinTexture.mainTexture = mainTexture; + _spritePlateBG.width = 357; + _LabelProductName.text = ShopCommonUtility.TrimProductName(seriesInfo.saleInfo.name); + } + _LabelProductName.transform.localPosition = POS_VIEW_MULTI_PRODUCT_NAME; + _LabelProductName.effectStyle = UILabel.Effect.None; + _spriteClassColorIcon.gameObject.SetActive(value: false); + m_BtnBuy.onClick.Clear(); + m_BtnBuy.onClick.Add(onPushBuyBtnCallback); + _eventListenerSkinImage.onClick = null; + _eventListenerSkinImage.onClick = delegate + { + onTapSkinImage.Call(); + }; + if (seriesInfo.saleInfo.costTicketItemId.HasValue) + { + _leaderSkinTicketIcon.mainTexture = Toolbox.ResourcesManager.LoadObject(ShopCommonUtility.GetTicketIconPath(seriesInfo.saleInfo.costTicketItemId.Value.ToString(), isFetch: true)); + } + if (seriesInfo.is_completed && seriesInfo._rewardStatus != SkinSeriesPurchaseInfo.RewardStatus.not_got) + { + _labelCostCrystal.gameObject.SetActive(value: false); + _labelCostRupy.gameObject.SetActive(value: false); + _labelFree.gameObject.SetActive(value: false); + _labelCostTicket.gameObject.SetActive(value: false); + } + else + { + ShopCommonUtility.SetCostInfo(seriesInfo.saleInfo, _labelCostCrystal, _labelCostRupy, _labelFree, _labelCostTicket); + } + _SetMultiBuyButton(seriesInfo); + } + + public void SetBuyButtonToGrey(bool isGrey) + { + UIManager.SetObjectToGrey(m_BtnBuy.gameObject, isGrey); + } + + public void SetData(SkinProductInfo productInfo, EventDelegate onPushBuyBtnCallback = null, Action onTapSkinImage = null) + { + SeriesInfo = null; + ProductInfo = productInfo; + ClassCharacterMasterData charaPrmBySkinId = GameMgr.GetIns().GetDataMgr().GetCharaPrmBySkinId(productInfo.leader_skin_id); + _LabelProductName.transform.localPosition = POS_VIEW_SINGLE_PRODUCT_NAME; + int maxLength = (Global.IsAlphabetLanguage() ? 35 : 15); + _LabelProductName.text = ShopCommonUtility.TrimProductName(productInfo.saleInfo.name, maxLength); + ClassCharaPrm.SetClassLabelSetting(_LabelProductName, charaPrmBySkinId.ClassColorId); + _uiClassSkinTextureLarge.gameObject.SetActive(value: false); + _uiClassSkinTexture.gameObject.SetActive(value: true); + _uiClassSkinTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(productInfo.saleInfo.path, ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail, isfetch: true)); + _spritePlateBG.width = 357; + _spriteClassColorIcon.gameObject.SetActive(value: true); + _spriteClassColorIcon.spriteName = ClassCharaPrm.GetIconSpriteName(charaPrmBySkinId.clan); + m_BtnBuy.onClick.Clear(); + m_BtnBuy.onClick.Add(onPushBuyBtnCallback); + _eventListenerSkinImage.onClick = null; + _eventListenerSkinImage.onClick = delegate + { + onTapSkinImage.Call(); + }; + if (productInfo.IsEnableBuyTicket) + { + _leaderSkinTicketIcon.mainTexture = Toolbox.ResourcesManager.LoadObject(ShopCommonUtility.GetTicketIconPath(productInfo.saleInfo.costTicketItemId.Value.ToString(), isFetch: true)); + } + ShopCommonUtility.SetCostInfo(productInfo.saleInfo, _labelCostCrystal, _labelCostRupy, _labelFree, _labelCostTicket); + _SetBuyButton(productInfo); + } + + private void _SetBuyButton(SkinProductInfo productInfo) + { + if (!productInfo.is_purchased) + { + m_BtnBuy.gameObject.SetActive(value: true); + m_BtnBuy.isEnabled = true; + m_LabelPurchased.gameObject.SetActive(value: false); + if (productInfo.saleInfo.isFree) + { + m_LabelBuy.text = Data.SystemText.Get("Shop_0099"); + } + else + { + m_LabelBuy.text = Data.SystemText.Get("Shop_0095"); + } + } + else + { + m_BtnBuy.gameObject.SetActive(value: false); + m_LabelPurchased.gameObject.SetActive(value: true); + } + } + + private void _SetMultiBuyButton(SkinSeriesPurchaseInfo seriesInfo) + { + if (seriesInfo.is_completed && seriesInfo._rewardStatus != SkinSeriesPurchaseInfo.RewardStatus.not_got) + { + m_BtnBuy.gameObject.SetActive(value: false); + m_LabelPurchased.gameObject.SetActive(value: true); + return; + } + m_BtnBuy.gameObject.SetActive(value: true); + m_BtnBuy.isEnabled = true; + m_LabelPurchased.gameObject.SetActive(value: false); + if (seriesInfo.saleInfo.isFree) + { + m_LabelBuy.text = Data.SystemText.Get("Shop_0099"); + } + else + { + m_LabelBuy.text = Data.SystemText.Get("Shop_0095"); + } + } +} diff --git a/SVSim.BattleEngine/Engine/ClassSkinPurchasePage.cs b/SVSim.BattleEngine/Engine/ClassSkinPurchasePage.cs new file mode 100644 index 0000000..abc8599 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ClassSkinPurchasePage.cs @@ -0,0 +1,691 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Scripts.Network.Data.TaskData.SkinPurchase; + +public class ClassSkinPurchasePage : BaseShopPurchasePage +{ + private enum eBuyType + { + single, + multi, + rewardOnly + } + + private const int DEFAULT_INDEX = 0; + + [SerializeField] + private UITable _uiTableProducts; + + [SerializeField] + private GameObject _PrefabDialogSelectBuyMeans; + + [SerializeField] + private PurchaseConfirm _PrefabDialogPurchaseConfirm; + + [SerializeField] + private ClassSkinDetailWindow _PrefabDialogSkinDetail; + + [SerializeField] + private ShopDrumrollScrollManager _drumrollManager; + + private SkinSeriesPurchaseInfo _selectSeriesInfo; + + private string _purchaseProductName; + + private SkinProductInfo _purchaseProductInfo; + + private ClassSkinPlate _selectPlate; + + private GameObject _MultiPlateObj; + + private DialogBase _tempCloseDialog; + + private DialogBase _dialogPurchaseConfirm; + + private DialogBase _dialogSelectBuyMeans; + + private DialogBase _dialogProductDetail; + + private DialogBase _dialogCrystalShortage; + + private bool _isBuyConnect; + + private List _productPlateObjList = new List(); + + private readonly List _loadedVoiceList = new List(); + + public override void onFirstStart() + { + CreateTopBar(Data.SystemText.Get("Shop_0104"), delegate + { + MyPageMenu.Instance.GoToShopSupply(); + }); + base.onFirstStart(); + } + + protected override void SetupScrollView() + { + _productPlateOriginal.gameObject.SetActive(value: false); + } + + protected override void ResetProductListScroll(int productCount) + { + if (productCount > _productPlateObjList.Count) + { + int num = productCount - _productPlateObjList.Count; + for (int i = 0; i < num; i++) + { + GameObject item = NGUITools.AddChild(_uiTableProducts.gameObject, _productPlateOriginal); + _productPlateObjList.Add(item); + } + } + for (int j = 0; j < _productPlateObjList.Count; j++) + { + UpdateScrollItem(_productPlateObjList[j], j); + } + _uiTableProducts.Reposition(); + _scrollView.ResetPosition(); + } + + protected override void onOpen() + { + base.onOpen(); + _loadedResourceList = new List(); + StartGetClassSkinInfo(OnClassSkinInfoRequestFinished); + } + + protected override void onClose() + { + if (_loadedVoiceList.Count > 0) + { + GameMgr.GetIns().GetSoundMgr().StopVoiceAll(0f); + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedVoiceList); + _loadedVoiceList.Clear(); + } + base.onClose(); + } + + private void StartGetClassSkinInfo(Action callbackOnSuccess) + { + SkinPurchaseInfoTask skinPurchaseInfoTask = new SkinPurchaseInfoTask(); + skinPurchaseInfoTask.SetParameter(); + StartCoroutine(Toolbox.NetworkManager.Connect(skinPurchaseInfoTask, callbackOnSuccess)); + } + + private void StartBuySkin(eBuyType buyType, ShopCommonUtility.SalesType costType, int id, long? itemId) + { + if (!_isBuyConnect) + { + _isBuyConnect = true; + UIManager.GetInstance().createInSceneCenterLoading(); + switch (buyType) + { + case eBuyType.single: + { + SkinBuySingleTask skinBuySingleTask = new SkinBuySingleTask(); + skinBuySingleTask.SetParameter(id, costType, itemId); + StartCoroutine(Toolbox.NetworkManager.Connect(skinBuySingleTask, onSuccessPurchaseSingle, _OnFailurePurchase, _OnResultCodeError)); + break; + } + case eBuyType.multi: + { + SkinBuyMultiTask skinBuyMultiTask = new SkinBuyMultiTask(); + skinBuyMultiTask.SetParameter(id, costType, itemId); + StartCoroutine(Toolbox.NetworkManager.Connect(skinBuyMultiTask, onSuccessPurchaseMulti, _OnFailurePurchase, _OnResultCodeError)); + break; + } + case eBuyType.rewardOnly: + { + SkinBuyMultiRewardTask skinBuyMultiRewardTask = new SkinBuyMultiRewardTask(); + skinBuyMultiRewardTask.SetParameter(id); + StartCoroutine(Toolbox.NetworkManager.Connect(skinBuyMultiRewardTask, onSuccessPurchaseMulti, _OnFailurePurchase, _OnResultCodeError)); + break; + } + } + } + } + + public static void SetFirstDisplaySeries(int seriesId) + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.SCENE_TRANSITION_VIEW_SKIN_SERIES_ID, seriesId); + } + + private int GetViewSeriesId() + { + int series_id = Data.SkinPurchaseInfo.seriesList[0].series_id; + int value = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LATEST_SKIN_SERIES_ID); + if (series_id != value) + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LATEST_SKIN_SERIES_ID, series_id); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_PURCHASE_SKIN_SERIES_ID, series_id); + } + int value2 = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.SCENE_TRANSITION_VIEW_SKIN_SERIES_ID); + if (value2 > -1) + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.SCENE_TRANSITION_VIEW_SKIN_SERIES_ID, -1); + return value2; + } + return PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_PURCHASE_SKIN_SERIES_ID); + } + + private void OnClassSkinInfoRequestFinished(NetworkTask.ResultCode error) + { + List seriesIdList = GetSeriesIdList(); + Dictionary seriesDataDictionary = GetSeriesDataDictionary(); + StartCoroutine(loadSeriesImages(ResourcesManager.AssetLoadPathType.ShopClassSkin, seriesIdList, seriesDataDictionary, delegate + { + if (_drumrollSeriesImageList.Count <= 0) + { + UIManager.GetInstance().OnReadyViewScene(isFadein: true); + } + else + { + int viewSeriesId = GetViewSeriesId(); + int seriesIndex = Data.SkinPurchaseInfo.seriesList.FindIndex((SkinSeriesPurchaseInfo data) => data.series_id == viewSeriesId); + if (seriesIndex < 0) + { + seriesIndex = 0; + } + List seriesList = Data.SkinPurchaseInfo.seriesList; + List itemList = _drumrollSeriesImageList.Select((Texture tex, int index) => new ShopDrumrollScrollManager.DrumrollItem(tex, seriesList[index].IsNew)).ToList(); + StartCoroutine(_drumrollManager.CreateDrumrollScroll_Coroutine(itemList, seriesIndex, onSelectSeries, delegate + { + onSelectSeries(seriesIndex, delegate + { + UIManager.GetInstance().OnReadyViewScene(isFadein: true); + }); + })); + } + })); + } + + private List GetSeriesIdList() + { + return Data.SkinPurchaseInfo.seriesList.ConvertAll((SkinSeriesPurchaseInfo info) => info.series_id); + } + + private Dictionary GetSeriesDataDictionary() + { + Dictionary dictionary = new Dictionary(); + foreach (KeyValuePair item in Data.Master.LeaderSkinSeriesIdDic) + { + dictionary.Add(item.Key, item.Value); + } + return dictionary; + } + + private void onSelectSeries(int seriesIndex) + { + onSelectSeries(seriesIndex, null); + } + + private void onSelectSeries(int seriesIndex, Action onFinish) + { + SkinSeriesPurchaseInfo seriesInfo = Data.SkinPurchaseInfo.seriesList[seriesIndex]; + _selectSeriesInfo = seriesInfo; + _titleLogoTexture.mainTexture = _seriesTitleImageList[seriesIndex]; + _labelSeriesDescription.text = seriesInfo.description; + int num = _cacheSeriesIdList.IndexOf(seriesInfo.series_id); + if (num != -1) + { + _cacheRefCountList[num]++; + ResetProductListScroll(seriesInfo.GetProductCount()); + onFinish.Call(); + return; + } + if (_cacheSeriesIdList.Count >= 4) + { + int num2 = _cacheRefCountList[0]; + int cacheIndex = 0; + for (int i = 1; i < _cacheRefCountList.Count; i++) + { + if (num2 > _cacheRefCountList[i]) + { + num2 = _cacheRefCountList[i]; + cacheIndex = i; + } + } + DeleteCacheSeriesByCashIndex(cacheIndex); + } + StartCoroutine(loadClassSkins(delegate + { + if (_selectSeriesInfo == seriesInfo) + { + ResetProductListScroll(seriesInfo.GetProductCount()); + } + _cacheSeriesIdList.Add(seriesInfo.series_id); + _cacheRefCountList.Add(1); + onFinish.Call(); + })); + } + + private void DeleteCacheSeriesByCashIndex(int cacheIndex) + { + List listResource = new List(); + SkinSeriesPurchaseInfo skinSeriesPurchaseInfo = Data.SkinPurchaseInfo.seriesList.Find((SkinSeriesPurchaseInfo m) => m.series_id == _cacheSeriesIdList[cacheIndex]); + if (skinSeriesPurchaseInfo != null) + { + if (skinSeriesPurchaseInfo.SetSalesStatus != SkinSeriesPurchaseInfo.eSetSalesStatus.None) + { + listResource.Add(Toolbox.ResourcesManager.GetAssetTypePath(skinSeriesPurchaseInfo.saleInfo.path, ResourcesManager.AssetLoadPathType.ShopClassSkin)); + } + skinSeriesPurchaseInfo.productList.ForEach(delegate(SkinProductInfo s) + { + listResource.Add(Toolbox.ResourcesManager.GetAssetTypePath(s.saleInfo.path, ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail)); + }); + } + Toolbox.ResourcesManager.RemoveAssetGroup(listResource); + _cacheSeriesIdList.RemoveAt(cacheIndex); + _cacheRefCountList.RemoveAt(cacheIndex); + for (int num = 0; num < listResource.Count; num++) + { + _cacheResourceList.Remove(listResource[num]); + } + } + + private IEnumerator loadClassSkins(Action callBack = null) + { + UIManager.GetInstance().createInSceneCenterLoading(); + List listResource = new List(); + if (_selectSeriesInfo.SetSalesStatus != SkinSeriesPurchaseInfo.eSetSalesStatus.None) + { + listResource.Add(Toolbox.ResourcesManager.GetAssetTypePath(_selectSeriesInfo.saleInfo.path, ResourcesManager.AssetLoadPathType.ShopClassSkin)); + } + foreach (SkinProductInfo product in _selectSeriesInfo.productList) + { + if (product.IsEnableBuyTicket) + { + listResource.Add(ShopCommonUtility.GetTicketIconPath(product.saleInfo.costTicketItemId.Value.ToString(), isFetch: false)); + listResource.Add(ShopCommonUtility.GetTicketIconRightDownPath(product.saleInfo.costTicketItemId.Value.ToString(), isFetch: false)); + } + } + _selectSeriesInfo.productList.ForEach(delegate(SkinProductInfo s) + { + listResource.Add(Toolbox.ResourcesManager.GetAssetTypePath(s.saleInfo.path, ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail)); + }); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(listResource, null)); + UIManager.GetInstance().closeInSceneCenterLoading(); + for (int num = 0; num < listResource.Count; num++) + { + _cacheResourceList.Add(listResource[num]); + } + callBack.Call(); + } + + private void UpdateScrollItem(GameObject go, int index) + { + if (_selectSeriesInfo == null) + { + return; + } + if (index >= _selectSeriesInfo.GetProductCount() || index < 0) + { + go.SetActive(value: false); + return; + } + go.SetActive(value: true); + ClassSkinPlate plate = go.GetComponent(); + EventDelegate eventDelegate = new EventDelegate(this, "onPushBuyButton"); + eventDelegate.parameters[0].value = plate; + plate.SetBuyButtonToGrey(isGrey: false); + if (_selectSeriesInfo.SetSalesStatus != SkinSeriesPurchaseInfo.eSetSalesStatus.None) + { + if (index == 0) + { + _MultiPlateObj = go; + eventDelegate.parameters[1].value = true; + plate.SetMultiData(_selectSeriesInfo, eventDelegate, delegate + { + _onTapClassSkinImage(plate, isMulti: true); + }); + if (_selectSeriesInfo.SetSalesStatus == SkinSeriesPurchaseInfo.eSetSalesStatus.Disable) + { + plate.SetBuyButtonToGrey(isGrey: true); + } + } + else + { + if (_MultiPlateObj == go) + { + _MultiPlateObj = null; + } + eventDelegate.parameters[1].value = false; + plate.SetData(_selectSeriesInfo.productList[index - 1], eventDelegate, delegate + { + _onTapClassSkinImage(plate, isMulti: false); + }); + } + } + else + { + _MultiPlateObj = null; + eventDelegate.parameters[1].value = false; + plate.SetData(_selectSeriesInfo.productList[index], eventDelegate, delegate + { + _onTapClassSkinImage(plate, isMulti: false); + }); + } + } + + private void _onTapClassSkinImage(ClassSkinPlate plate, bool isMulti) + { + if (!(_dialogProductDetail != null)) + { + _dialogProductDetail = UIManager.GetInstance().CreateDialogClose(); + _dialogProductDetail.SetSize(DialogBase.Size.M); + _dialogProductDetail.SetTitleLabel(Data.SystemText.Get("Dia_BuySkin_003_Title")); + _dialogProductDetail.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + ClassSkinDetailWindow component = UnityEngine.Object.Instantiate(_PrefabDialogSkinDetail).GetComponent(); + _dialogProductDetail.SetObj(component.gameObject); + if (isMulti) + { + component.SetMultiData(plate.SeriesInfo); + } + else + { + component.SetSingleData(plate.ProductInfo, _loadedVoiceList); + } + } + } + + private void onPushBuyButton(ClassSkinPlate plate, bool isMulti) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + _selectPlate = plate; + if (isMulti) + { + createClassSkinSelectBuyMeansMultiDialog(plate.SeriesInfo); + } + else + { + createClassSkinSelectBuyMeansDialog(plate.ProductInfo); + } + } + + private void createClassSkinSelectBuyMeansMultiDialog(SkinSeriesPurchaseInfo sInfo) + { + if (_dialogSelectBuyMeans != null) + { + return; + } + if (sInfo.is_completed) + { + _ = sInfo._rewardStatus; + _ = 2; + } + _dialogSelectBuyMeans = _createBaseDialogForSelectBuyMeans(sInfo.saleInfo); + ClassSkinSelectBuyMeansDialog component = UnityEngine.Object.Instantiate(_PrefabDialogSelectBuyMeans).GetComponent(); + _dialogSelectBuyMeans.SetObj(component.gameObject); + Action onPushBuyCrystalBtnCallBack = null; + Action onPushBuyRupyBtnCallBack = null; + Action onPushBuyTicketButtonCallBack = null; + if (sInfo.saleInfo.isFree) + { + _dialogSelectBuyMeans.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + _dialogSelectBuyMeans.SetButtonText(Data.SystemText.Get("Shop_0082")); + _dialogSelectBuyMeans.onPushButton1 = delegate + { + _purchaseProductName = sInfo.saleInfo.name; + UIManager.GetInstance().createInSceneCenterLoading(); + if (sInfo.is_completed && sInfo._rewardStatus == SkinSeriesPurchaseInfo.RewardStatus.not_got) + { + StartBuySkin(eBuyType.rewardOnly, ShopCommonUtility.SalesType.free, sInfo.series_id, null); + } + else + { + StartBuySkin(eBuyType.multi, ShopCommonUtility.SalesType.free, sInfo.series_id, null); + } + }; + } + else + { + _dialogSelectBuyMeans.SetButtonLayout(DialogBase.ButtonLayout.NONE); + onPushBuyCrystalBtnCallBack = delegate + { + _createPurchaseConfirmDialog(sInfo.saleInfo, ShopCommonUtility.SalesType.crystal, delegate + { + StartBuySkin(eBuyType.multi, ShopCommonUtility.SalesType.crystal, sInfo.series_id, null); + }); + }; + onPushBuyRupyBtnCallBack = delegate + { + _createPurchaseConfirmDialog(sInfo.saleInfo, ShopCommonUtility.SalesType.rupy, delegate + { + StartBuySkin(eBuyType.multi, ShopCommonUtility.SalesType.rupy, sInfo.series_id, null); + }); + }; + onPushBuyTicketButtonCallBack = delegate + { + _createPurchaseConfirmDialog(sInfo.saleInfo, ShopCommonUtility.SalesType.ticket, delegate + { + StartBuySkin(eBuyType.multi, ShopCommonUtility.SalesType.ticket, sInfo.series_id, sInfo.saleInfo.costTicketItemId); + }); + }; + } + component.Init(sInfo, _dialogSelectBuyMeans, onPushBuyCrystalBtnCallBack, onPushBuyRupyBtnCallBack, onPushBuyTicketButtonCallBack); + } + + private void createClassSkinSelectBuyMeansDialog(SkinProductInfo pInfo) + { + if (_dialogSelectBuyMeans != null) + { + return; + } + _ = pInfo.is_purchased; + _dialogSelectBuyMeans = _createBaseDialogForSelectBuyMeans(pInfo.saleInfo); + ClassSkinSelectBuyMeansDialog component = UnityEngine.Object.Instantiate(_PrefabDialogSelectBuyMeans).GetComponent(); + _dialogSelectBuyMeans.SetObj(component.gameObject); + Action onPushBuyCrystalBtnCallBack = null; + Action onPushBuyRupyBtnCallBack = null; + Action onPushBuyTicketButtonCallBack = null; + if (pInfo.saleInfo.isFree) + { + _dialogSelectBuyMeans.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + _dialogSelectBuyMeans.SetButtonText(Data.SystemText.Get("Shop_0082")); + _dialogSelectBuyMeans.onPushButton1 = delegate + { + _purchaseProductName = pInfo.saleInfo.name; + _purchaseProductInfo = pInfo; + UIManager.GetInstance().createInSceneCenterLoading(); + StartBuySkin(eBuyType.single, ShopCommonUtility.SalesType.free, pInfo.product_id, null); + }; + } + else + { + _dialogSelectBuyMeans.SetButtonLayout(DialogBase.ButtonLayout.NONE); + onPushBuyCrystalBtnCallBack = delegate + { + _createPurchaseConfirmDialog(pInfo.saleInfo, ShopCommonUtility.SalesType.crystal, delegate + { + _purchaseProductInfo = pInfo; + StartBuySkin(eBuyType.single, ShopCommonUtility.SalesType.crystal, pInfo.product_id, null); + }); + }; + onPushBuyRupyBtnCallBack = delegate + { + _createPurchaseConfirmDialog(pInfo.saleInfo, ShopCommonUtility.SalesType.rupy, delegate + { + _purchaseProductInfo = pInfo; + StartBuySkin(eBuyType.single, ShopCommonUtility.SalesType.rupy, pInfo.product_id, null); + }); + }; + onPushBuyTicketButtonCallBack = delegate + { + _createPurchaseConfirmDialog(pInfo.saleInfo, ShopCommonUtility.SalesType.ticket, delegate + { + _purchaseProductInfo = pInfo; + StartBuySkin(eBuyType.single, ShopCommonUtility.SalesType.ticket, pInfo.product_id, pInfo.saleInfo.costTicketItemId); + }); + }; + } + component.Init(pInfo, _dialogSelectBuyMeans, onPushBuyCrystalBtnCallBack, onPushBuyRupyBtnCallBack, onPushBuyTicketButtonCallBack); + } + + private DialogBase _createBaseDialogForSelectBuyMeans(ShopCommonSaleInfo info) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_BuySkin_002_Title")); + dialogBase.SetReturnMsg(null, ""); + return dialogBase; + } + + private void _createPurchaseConfirmDialog(ShopCommonSaleInfo info, ShopCommonUtility.SalesType costType, Action buyApiFunc) + { + if (!(_dialogPurchaseConfirm != null) && ShopCommonUtility.IsHaveEnoughCost(info, costType, delegate + { + if (_dialogCrystalShortage == null) + { + _dialogCrystalShortage = ShopCommonUtility.CreateCrystalShortagePopup(); + } + })) + { + _dialogPurchaseConfirm = ShopCommonUtility.CreatePurchaseConfirmPopup(info, costType, _PrefabDialogPurchaseConfirm, delegate + { + _purchaseProductName = info.name; + buyApiFunc(); + }); + _dialogPurchaseConfirm.SetTitleLabel(Data.SystemText.Get("Dia_BuySkin_001_Title")); + } + } + + private void _OnFailurePurchase(NetworkTask.ResultCode code) + { + _isBuyConnect = false; + UIManager.GetInstance().closeInSceneCenterLoading(); + } + + private void _OnResultCodeError(int code) + { + if (code != 110) + { + _isBuyConnect = false; + UIManager.GetInstance().closeInSceneCenterLoading(); + _ReloadSkinInfo(); + } + } + + private void onSuccessPurchaseSingle(NetworkTask.ResultCode error) + { + _isBuyConnect = false; + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_PURCHASE_SKIN_SERIES_ID, _selectSeriesInfo.series_id); + if (_purchaseProductName != null) + { + DialogBase diaChange = UIManager.GetInstance().CreateDialogClose(); + int skinId = _purchaseProductInfo.leader_skin_id; + ClassCharacterMasterData charaData = GameMgr.GetIns().GetDataMgr().GetCharaPrmBySkinId(skinId); + string text = Data.SystemText.Get("Shop_0022", _purchaseProductName.Replace("\n", "")); + text = text + "\n\n" + Data.SystemText.Get("Shop_0108", GameMgr.GetIns().GetDataMgr().GetClanNameByKey(charaData.class_id), charaData.chara_name); + diaChange.SetText(text); + diaChange.SetTitleLabel(Data.SystemText.Get("Dia_BuySkin_004_Title")); + diaChange.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + diaChange.SetButtonText(Data.SystemText.Get("Dia_BuySkin_001_Button")); + diaChange.onPushButton1 = delegate + { + _tempCloseDialog = diaChange; + LeaderSkinUpdateTask leaderSkinUpdateTask = new LeaderSkinUpdateTask(); + leaderSkinUpdateTask.SetParameter(charaData.class_id, skinId); + StartCoroutine(Toolbox.NetworkManager.Connect(leaderSkinUpdateTask, onSuccessChangeSkin)); + }; + } + _ReloadSkinInfo(); + } + + private void onSuccessChangeSkin(NetworkTask.ResultCode error) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetText(Data.SystemText.Get("Shop_0109")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + _purchaseProductInfo = null; + if (_tempCloseDialog != null) + { + _tempCloseDialog.Close(); + } + } + + private void onSuccessPurchaseMulti(NetworkTask.ResultCode error) + { + _isBuyConnect = false; + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_PURCHASE_SKIN_SERIES_ID, _selectSeriesInfo.series_id); + if (_purchaseProductName != null) + { + ShopCommonUtility.CreatePurchaseSuccess(_purchaseProductName.Replace("\n", "")); + _purchaseProductName = null; + } + _ReloadSkinInfo(); + } + + private void _ReloadSkinInfo() + { + MyPageMenu.Instance.UpdateCrystalCount(); + MyPageMenu.Instance.UpdateRupyCount(); + List oldSeriesList = new List(Data.SkinPurchaseInfo.seriesList); + StartGetClassSkinInfo(delegate + { + bool flag = false; + List seriesList = Data.SkinPurchaseInfo.seriesList; + for (int i = 0; i < seriesList.Count; i++) + { + if (oldSeriesList[i].series_id != seriesList[i].series_id) + { + flag = true; + } + if (seriesList[i].series_id == _selectSeriesInfo.series_id) + { + if (_selectPlate.ProductInfo == null) + { + onSelectSeries(i); + } + else if (_selectPlate.ProductInfo.product_id == _purchaseProductInfo.product_id) + { + _selectSeriesInfo = seriesList[i]; + int num = ((_selectSeriesInfo.SetSalesStatus != SkinSeriesPurchaseInfo.eSetSalesStatus.None) ? 1 : 0); + for (int j = 0; j < _selectSeriesInfo.productList.Count; j++) + { + UpdateScrollItem(_productPlateObjList[j + num], j + num); + } + if (_MultiPlateObj != null) + { + UpdateScrollItem(_MultiPlateObj, 0); + } + } + else + { + onSelectSeries(i); + } + } + } + if (oldSeriesList.Count != seriesList.Count) + { + flag = true; + } + _purchaseProductName = null; + _purchaseProductInfo = null; + _selectPlate = null; + if (flag) + { + List seriesIdList = GetSeriesIdList(); + Dictionary seriesDataDictionary = GetSeriesDataDictionary(); + StartCoroutine(loadSeriesImages(ResourcesManager.AssetLoadPathType.ShopClassSkin, seriesIdList, seriesDataDictionary, delegate + { + List seriesList2 = Data.SkinPurchaseInfo.seriesList; + List itemList = _drumrollSeriesImageList.Select((Texture tex, int index) => new ShopDrumrollScrollManager.DrumrollItem(tex, seriesList2[index].IsNew)).ToList(); + StartCoroutine(_drumrollManager.CreateDrumrollScroll_Coroutine(itemList, 0, onSelectSeries, delegate + { + onSelectSeries(0); + UIManager.GetInstance().closeInSceneCenterLoading(); + })); + })); + } + else + { + UIManager.GetInstance().closeInSceneCenterLoading(); + } + }); + } +} diff --git a/SVSim.BattleEngine/Engine/ColosseumBattleFinish.cs b/SVSim.BattleEngine/Engine/ColosseumBattleFinish.cs new file mode 100644 index 0000000..f857a5e --- /dev/null +++ b/SVSim.BattleEngine/Engine/ColosseumBattleFinish.cs @@ -0,0 +1,4 @@ +public class ColosseumBattleFinish : HeaderData +{ + public ColosseumBattleFinishDetail data; +} diff --git a/SVSim.BattleEngine/Engine/ColosseumBattleFinishDetail.cs b/SVSim.BattleEngine/Engine/ColosseumBattleFinishDetail.cs new file mode 100644 index 0000000..b65d9e2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ColosseumBattleFinishDetail.cs @@ -0,0 +1,3 @@ +public class ColosseumBattleFinishDetail : MatchFinishBase +{ +} diff --git a/SVSim.BattleEngine/Engine/ColosseumResultAnimationAgent.cs b/SVSim.BattleEngine/Engine/ColosseumResultAnimationAgent.cs new file mode 100644 index 0000000..eeead7c --- /dev/null +++ b/SVSim.BattleEngine/Engine/ColosseumResultAnimationAgent.cs @@ -0,0 +1,220 @@ +using System.Collections; +using UnityEngine; +using Wizard; + +public class ColosseumResultAnimationAgent : ResultAnimationAgent +{ + private const float OBJECT_APPEAR_MOVE_SEC = 0.5f; + + private const float RESULT_TITLE_DELAY_SEC = 0f; + + private const float CLASS_CHAR_DELAY_SEC = 0.1f; + + private const float CLASS_INFO_DELAY_SEC = 0.3f; + + private const float GAUGE_WAIT_SEC = 0.5f; + + public override IEnumerator RunUI(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin) + { + m_BattleCamera.m_CutInCamera.gameObject.SetActive(value: false); + if (battleResultControl.ResultReporter.LotteryData.IsEnable) + { + yield return LoadLotteryImage(battleResultControl.ResultReporter.LotteryData); + } + if (battleResultControl.IsDraw) + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleDraw.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 48, 16, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + else if (isWin) + { + battleResultControl.TitleWin.gameObject.SetActive(value: true); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleWin.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.alpha = 0f; + battleResultControl.Bg.color = new Color32(32, 24, 0, 0); + battleResultControl.ResultTitle.spriteName = "result_top_win"; + } + else + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleLose.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleLose.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 24, 48, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + battleResultControl.MainPanel.alpha = 1f; + yield return new WaitForSeconds(0.1f); + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + else if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOUWIN); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_WIN); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + TweenAlpha.Begin(battleResultControl.Bg.gameObject, 0.5f, 0.75f); + yield return new WaitForSeconds(0.2f); + TweenAlpha.Begin(battleResultControl.ArcaneIn.gameObject, 0.5f, 1f); + TweenAlpha.Begin(battleResultControl.ArcaneOut.gameObject, 0.5f, 1f); + iTween.ScaleTo(battleResultControl.ArcaneIn.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(battleResultControl.ArcaneOut.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + if (battleResultControl.IsDraw) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_3, Vector3.zero); + battleResultControl.TitleDraw.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else if (isWin) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_1, Vector3.zero); + battleResultControl.TitleWin.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_2, Vector3.zero); + battleResultControl.TitleLose.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + HideEmotionMessage(); + if (battleResultControl.ResultMsgWindowFlag) + { + StartCoroutine(battleResultControl.ShowSpecialResultInfo()); + } + yield return new WaitForSeconds(2f); + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_3, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + if (ShowRewardDialog(battleResultControl)) + { + while (battleResultControl.IsRewardWait) + { + yield return null; + } + } + if (battleResultControl.ResultReporter.LotteryData.IsEnable) + { + yield return CreateLotteryDialog(battleResultControl.ResultReporter.LotteryData); + } + if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 0f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 3f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_1, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_2, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + } + yield return new WaitForSeconds(0.2f); + if (isWin) + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_WIN_LOOP); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_LOSE_LOOP); + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_WINDOW_APPER); + iTween.MoveTo(battleResultControl.ClassCharObj.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassCharObj"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ResultTitle.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ResultTitle"], "time", 0.5f, "delay", 0f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ClassInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassInfo"], "time", 0.5f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(1f); + if (isWin) + { + PlayWinVoice(); + } + if (battleResultControl.AddClassExp > 0) + { + battleResultControl.SettingAddClassExpTextAnimation(); + yield return new WaitForSeconds(0.5f); + yield return PlayGaugeUpSe(); + yield return new WaitForSeconds(0.5f); + } + ArenaColosseum colosseumData = Data.ArenaData.ColosseumData; + if (colosseumData.ResultEffect != ArenaColosseum.eResultEffect.None) + { + if (colosseumData.ResultEffect == ArenaColosseum.eResultEffect.GroupA) + { + battleResultControl.TitleMatch.spriteName = "colosseum_battle_title_01"; + } + else if (colosseumData.ResultEffect == ArenaColosseum.eResultEffect.Final) + { + battleResultControl.TitleMatch.spriteName = "colosseum_battle_title_02"; + } + else + { + battleResultControl.TitleMatch.spriteName = "colosseum_battle_title_03"; + } + StartCoroutine(battleResultControl.RunMatch()); + yield return new WaitForSeconds(3f); + } + bool isFinishBattlePass = false; + battleResultControl.SetBattlePassGauge(delegate + { + isFinishBattlePass = true; + }); + while (!isFinishBattlePass) + { + yield return null; + } + if (Data.RedEtherCampaignResultData != null) + { + bool isFinishRedEther = false; + RedEtherCampaignPanel.Create(battleResultControl.gameObject, Data.RedEtherCampaignResultData, battleResultControl, delegate + { + isFinishRedEther = true; + }); + while (!isFinishRedEther) + { + yield return null; + } + yield return ShowRewardDialog(Data.RedEtherCampaignResultData.RewardList); + } + nextSceneSelector.Show(); + battleResultControl.PrepareAchievementLog(); + battleResultControl.FinishResult(); + battleResultControl.GreySpriteBGVisible = false; + } + + private IEnumerator PlayGaugeUpSe() + { + SoundMgr soundMgr = GameMgr.GetIns().GetSoundMgr(); + int i = 0; + while (i < 10) + { + soundMgr.PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP); + yield return new WaitForSeconds(0.05f); + int num = i + 1; + i = num; + } + } +} diff --git a/SVSim.BattleEngine/Engine/ColosseumResultAnimationHandler.cs b/SVSim.BattleEngine/Engine/ColosseumResultAnimationHandler.cs new file mode 100644 index 0000000..b33fb21 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ColosseumResultAnimationHandler.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +public class ColosseumResultAnimationHandler : IResultAnimationHandler +{ + private readonly GameObject m_resultAnimationAgentObj; + + private readonly ColosseumResultAnimationAgent m_resultAnimationAgentIns; + + public ResultAnimationAgent m_resultAnimationAgent => m_resultAnimationAgentIns; + + public ColosseumResultAnimationHandler(BattleCamera battleCamera) + { + m_resultAnimationAgentObj = new GameObject(); + m_resultAnimationAgentIns = m_resultAnimationAgentObj.AddComponent(); + m_resultAnimationAgentIns.GetComponent().SetBattleCamera(battleCamera); + } + + public void Destroy() + { + Object.Destroy(m_resultAnimationAgentObj); + } +} diff --git a/SVSim.BattleEngine/Engine/ColosseumResultReporter.cs b/SVSim.BattleEngine/Engine/ColosseumResultReporter.cs new file mode 100644 index 0000000..17fa231 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ColosseumResultReporter.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using LitJson; +using Wizard; +using Wizard.Lottery; + +public class ColosseumResultReporter : IBattleResultReporter +{ + public bool IsEnd => Data.ColosseumBattleFinish.data != null; + + public int ClassExp => GetClassExp(); + + public List UserAchievement => GetUserAchievementList(); + + public List UserMission => GetUserMissionList(); + + public List MissionRewards => Data.ColosseumBattleFinish.data._missionRewards; + + public List VictoryRewards => null; + + public LotteryApplyData LotteryData => Data.ColosseumBattleFinish.data.AchievedInfo._lotteryData; + + public bool IsDataExist + { + get + { + if (Data.ColosseumBattleFinish.data != null) + { + return Data.ColosseumBattleFinish.data.IsProcessed; + } + return false; + } + } + + public MyPageHomeDialogData HomeDialogData => null; + + public void Report(bool isWin) + { + } + + public void Destroy() + { + } + + public JsonData GetFinishResponseData() + { + return Data.ColosseumBattleFinish.data._responseData; + } + + public List GetUserAchievementList() + { + return Data.ColosseumBattleFinish.data.achieved_achievement_list; + } + + public List GetUserMissionList() + { + return Data.ColosseumBattleFinish.data.achieved_mission_list; + } + + public int GetClassExp() + { + return Data.ColosseumBattleFinish.data.get_class_chara_experience; + } +} diff --git a/SVSim.BattleEngine/Engine/ConnectionReportTrigger.cs b/SVSim.BattleEngine/Engine/ConnectionReportTrigger.cs new file mode 100644 index 0000000..c05e016 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ConnectionReportTrigger.cs @@ -0,0 +1,12 @@ +using Wizard; + +public class ConnectionReportTrigger +{ + public static void ConnectionReport(NetworkBattleManagerBase networkBattleManager) + { + LocalLog.AddGungnirLog("ConnectionReport"); + networkBattleManager.disconnectToDispChecker.StartChecker(); + networkBattleManager.disconnectToDispChecker.EraseDisp(); + networkBattleManager.disconnectToLoseChecker.StartChecker(); + } +} diff --git a/SVSim.BattleEngine/Engine/ConnectionReporter.cs b/SVSim.BattleEngine/Engine/ConnectionReporter.cs new file mode 100644 index 0000000..fab6daa --- /dev/null +++ b/SVSim.BattleEngine/Engine/ConnectionReporter.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections; +using Cute; +using UnityEngine; + +public class ConnectionReporter +{ + private const float DEFAULT_INTERVAL = 10f; + + private Coroutine coroutine; + + private readonly MonoBehaviour runner; + + private readonly Action report; + + private readonly float interval; + + public ConnectionReporter(MonoBehaviour runner, Action report, float interval = 10f) + { + this.runner = runner; + this.report = report; + this.interval = interval; + } + + public void StopReporter() + { + if (coroutine != null) + { + runner.StopCoroutine(coroutine); + coroutine = null; + } + } + + public void StartReporter() + { + if (coroutine == null && runner != null) + { + coroutine = runner.StartCoroutine(LoopCoroutine()); + } + } + + private IEnumerator LoopCoroutine() + { + WaitForSeconds secondWait = new WaitForSeconds(interval); + while (true) + { + report.Call(); + yield return secondWait; + } + } +} diff --git a/SVSim.BattleEngine/Engine/ConventionList.cs b/SVSim.BattleEngine/Engine/ConventionList.cs new file mode 100644 index 0000000..f2e44cf --- /dev/null +++ b/SVSim.BattleEngine/Engine/ConventionList.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using LitJson; + +public class ConventionList +{ + public List List { get; private set; } + + public void Parse(JsonData data) + { + List = new List(); + for (int i = 0; i < data.Count; i++) + { + List.Add(new ConventionInfo(data[i])); + } + } +} diff --git a/SVSim.BattleEngine/Engine/ConventionListPlate.cs b/SVSim.BattleEngine/Engine/ConventionListPlate.cs new file mode 100644 index 0000000..17f81e7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ConventionListPlate.cs @@ -0,0 +1,59 @@ +using System; +using Cute; +using UnityEngine; +using Wizard; + +public class ConventionListPlate : MonoBehaviour +{ + private const string DECK_ENTRY_SPRITE = "btn_decklogin"; + + private const string GAME_START_SPRITE = "btn_competition"; + + [SerializeField] + private UIButton _button; + + [SerializeField] + private UILabel _conventionName; + + [SerializeField] + private UILabel _deckSetTimeLimit; + + private ConventionInfo _conventionInfo; + + public Action OnSelect { get; set; } + + private void Start() + { + _button.onClick.Add(new EventDelegate(delegate + { + OnClickConvention(); + })); + } + + public void Initialize(ConventionInfo convention) + { + _conventionInfo = convention; + _conventionName.text = convention.Name; + if (convention.Status == ConventionInfo.ConventionStatus.GameStart) + { + _deckSetTimeLimit.gameObject.SetActive(value: false); + _button.normalSprite = "btn_competition"; + return; + } + _deckSetTimeLimit.gameObject.SetActive(value: true); + _deckSetTimeLimit.text = Data.SystemText.Get("Arena_0126", convention.DeckEntryLimitText); + _button.normalSprite = "btn_decklogin"; + } + + public void FadeOutHide() + { + FadeUtility.FadeOutObjectAndNonActive(_button.gameObject); + _button.enabled = false; + } + + private void OnClickConvention() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OnSelect.Call(_conventionInfo); + } +} diff --git a/SVSim.BattleEngine/Engine/ConventionListUI.cs b/SVSim.BattleEngine/Engine/ConventionListUI.cs new file mode 100644 index 0000000..efd731c --- /dev/null +++ b/SVSim.BattleEngine/Engine/ConventionListUI.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +public class ConventionListUI : UIBase +{ + private const int SCROLL_CONVENTION_COUNT = 3; + + [SerializeField] + private ConventionListPlate _conventionItemOriginal; + + [SerializeField] + private UIScrollView _scrollView; + + [SerializeField] + private UIGrid _grid; + + [SerializeField] + private GameObject _conventionListPlateRoot; + + [SerializeField] + private GameObject _backGround; + + [SerializeField] + private GameObject _layout1; + + [SerializeField] + private GameObject[] _layout2; + + [SerializeField] + private GameObject _scrollBar; + + private List _plateList = new List(); + + public Action OnSelect { get; set; } + + private void Awake() + { + _conventionItemOriginal.gameObject.SetActive(value: false); + } + + public void Show(ConventionList conventionList) + { + List list = conventionList.List; + int num = 0; + foreach (ConventionInfo item in list) + { + GameObject parent = _conventionListPlateRoot; + switch (list.Count) + { + case 1: + parent = _layout1; + break; + case 2: + parent = _layout2[num]; + break; + } + num++; + GameObject obj = NGUITools.AddChild(parent, _conventionItemOriginal.gameObject); + obj.SetActive(value: true); + ConventionListPlate component = obj.GetComponent(); + component.Initialize(item); + component.OnSelect = OnSelectConvention; + _plateList.Add(component); + } + _backGround.SetActive(list.Count > 3); + _grid.Reposition(); + _scrollView.ResetPosition(); + } + + private void OnSelectConvention(ConventionInfo convention) + { + OnSelect.Call(convention); + foreach (ConventionListPlate plate in _plateList) + { + plate.FadeOutHide(); + } + } + + public void Hide() + { + _backGround.SetActive(value: false); + _scrollBar.SetActive(value: false); + } +} diff --git a/SVSim.BattleEngine/Engine/CostAddModifier.cs b/SVSim.BattleEngine/Engine/CostAddModifier.cs new file mode 100644 index 0000000..6fa8975 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CostAddModifier.cs @@ -0,0 +1,24 @@ +public class CostAddModifier : ICardCostModifier +{ + public int Cost { get; private set; } + + public bool IsClearBeforeModifier => false; + + public bool IsResidentModifier { get; } + + public CostAddModifier(int cost, bool isResidentModifier = false) + { + Cost = cost; + IsResidentModifier = isResidentModifier; + } + + public int CalcCost(int cost) + { + return cost + Cost; + } + + public ICardCostModifier Clone() + { + return new CostAddModifier(Cost, IsResidentModifier); + } +} diff --git a/SVSim.BattleEngine/Engine/CostCurveUI.cs b/SVSim.BattleEngine/Engine/CostCurveUI.cs new file mode 100644 index 0000000..d0db330 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CostCurveUI.cs @@ -0,0 +1,195 @@ +using System; +using UnityEngine; +using Wizard; + +public class CostCurveUI : MonoBehaviour +{ + [Serializable] + private class CostStruct + { + [SerializeField] + public GameObject Parent; + + [SerializeField] + public UILabel LabelCost; + + [SerializeField] + public UILabel LabelCount; + + [SerializeField] + public UIProgressBar Bar; + + public int Count; + } + + [SerializeField] + private int m_maxBarValue = 15; + + [SerializeField] + private CostStruct m_original; + + [SerializeField] + private UIProgressBar m_barAdditiveEffect; + + [SerializeField] + private int m_barNum = 8; + + [SerializeField] + private int m_minCost = 1; + + [SerializeField] + private float m_barWidth = 25f; + + private CostStruct[] m_costArray; + + private CardMaster.CardMasterId _cardMasterId; + + public void Initialize(CardMaster.CardMasterId cardMasterId) + { + _cardMasterId = cardMasterId; + } + + public void Refresh() + { + if (m_costArray != null) + { + for (int i = 0; i < m_costArray.Length; i++) + { + m_costArray[i].Count = 0; + m_costArray[i].LabelCount.text = "0"; + m_costArray[i].Bar.value = 0f; + } + } + } + + public void Refresh(int[] array) + { + Refresh(); + if (array != null) + { + for (int i = 0; i < array.Length; i++) + { + Add(array[i], withAnim: false); + } + } + } + + public void Refresh(UIBase_CardManager.CardObjData[] array) + { + Refresh(); + if (array == null) + { + return; + } + for (int i = 0; i < array.Length; i++) + { + int num = array[i].mainCardNum + array[i].subCardNum; + for (int j = 0; j < num; j++) + { + Add(array[i].ids, withAnim: false); + } + } + } + + public void Add(int cardId, bool withAnim) + { + ChangeValue(1, cardId, withAnim); + } + + public void Add(UIBase_CardManager.CardObjData card, bool withAnim) + { + Add(card.ids, withAnim); + } + + public void Sub(int cardId, bool withAnim) + { + ChangeValue(-1, cardId, withAnim); + } + + public void Sub(UIBase_CardManager.CardObjData card, bool withAnim) + { + Sub(card.ids, withAnim); + } + + private void ChangeValue(int addnum, int cardId, bool withAnim) + { + int num = Mathf.Min(Mathf.Max(CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(cardId).Cost, m_minCost), m_barNum) - m_minCost; + CostStruct cost_this = m_costArray[num]; + cost_this.Count += addnum; + if (withAnim && m_barAdditiveEffect != null) + { + m_barAdditiveEffect.gameObject.SetActive(value: true); + UIProgressBar barAdditiveEffect = m_barAdditiveEffect; + float value = (cost_this.Bar.value = (float)(cost_this.Count + addnum) / (float)m_maxBarValue); + barAdditiveEffect.value = value; + m_barAdditiveEffect.transform.position = cost_this.Bar.transform.position; + m_barAdditiveEffect.alpha = 0.8f; + TweenAlpha.Begin(m_barAdditiveEffect.gameObject, 0.4f, 0f); + TweenScale anim = TweenScale.Begin(cost_this.LabelCount.gameObject, 0.2f, Vector3.one * 1.2f); + TweenAlpha.Begin(cost_this.LabelCount.gameObject, 0.2f, 0f); + EventDelegate ev = null; + ev = new EventDelegate(delegate + { + anim.RemoveOnFinished(ev); + cost_this.Bar.value = (float)cost_this.Count / (float)m_maxBarValue; + cost_this.LabelCount.text = cost_this.Count.ToString() ?? ""; + cost_this.LabelCount.transform.localScale = Vector3.one * 0.8f; + TweenScale.Begin(cost_this.LabelCount.gameObject, 0.2f, Vector3.one); + TweenAlpha.Begin(cost_this.LabelCount.gameObject, 0.2f, 1f); + }); + anim.onFinished.Add(ev); + } + else + { + cost_this.LabelCount.text = cost_this.Count.ToString() ?? ""; + cost_this.Bar.value = (float)cost_this.Count / (float)m_maxBarValue; + } + } + + private void Awake() + { + m_costArray = new CostStruct[m_barNum]; + m_original.LabelCost.text = m_minCost.ToString() ?? ""; + m_original.LabelCount.text = 0.ToString() ?? ""; + m_original.Bar.value = 0f; + m_costArray[0] = m_original; + for (int i = 1; i < m_barNum; i++) + { + m_costArray[i] = new CostStruct(); + GameObject obj = (m_costArray[i].Parent = UnityEngine.Object.Instantiate(m_original.Parent)); + obj.transform.parent = m_original.Parent.transform.parent; + obj.transform.localScale = m_original.Parent.transform.localScale; + Vector3 localPosition = m_original.Parent.transform.localPosition; + localPosition.x += m_barWidth * (float)i; + obj.transform.localPosition = localPosition; + UIWidget[] componentsInChildren = obj.GetComponentsInChildren(); + for (int j = 0; j < componentsInChildren.Length; j++) + { + if (componentsInChildren[j].name == m_original.LabelCost.name) + { + m_costArray[i].LabelCost = componentsInChildren[j].GetComponent(); + m_costArray[i].LabelCost.text = (i + m_minCost).ToString() ?? ""; + if (i == m_barNum - 1) + { + m_costArray[i].LabelCost.text += "โบ"; + } + } + else if (componentsInChildren[j].name == m_original.LabelCount.name) + { + m_costArray[i].LabelCount = componentsInChildren[j].GetComponent(); + m_costArray[i].LabelCount.text = 0.ToString() ?? ""; + } + else if (componentsInChildren[j].name == m_original.Bar.name) + { + m_costArray[i].Bar = componentsInChildren[j].GetComponent(); + m_costArray[i].Bar.value = 0f; + } + m_costArray[i].Count = 0; + } + } + if (m_barAdditiveEffect != null) + { + m_barAdditiveEffect.gameObject.SetActive(value: false); + } + } +} diff --git a/SVSim.BattleEngine/Engine/CostHalfModifier.cs b/SVSim.BattleEngine/Engine/CostHalfModifier.cs new file mode 100644 index 0000000..2e0c855 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CostHalfModifier.cs @@ -0,0 +1,17 @@ +public abstract class CostHalfModifier : ICardCostModifier +{ + public int Cost { get; private set; } + + public bool IsClearBeforeModifier => false; + + public bool IsResidentModifier { get; } + + public CostHalfModifier(bool isResidentModifier) + { + IsResidentModifier = isResidentModifier; + } + + public abstract int CalcCost(int cost); + + public abstract ICardCostModifier Clone(); +} diff --git a/SVSim.BattleEngine/Engine/CostHalfRoundUpModifier.cs b/SVSim.BattleEngine/Engine/CostHalfRoundUpModifier.cs new file mode 100644 index 0000000..ccba9b6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CostHalfRoundUpModifier.cs @@ -0,0 +1,19 @@ +using System; + +public class CostHalfRoundUpModifier : CostHalfModifier +{ + public CostHalfRoundUpModifier(bool isResidentModifier) + : base(isResidentModifier) + { + } + + public override int CalcCost(int cost) + { + return (int)Math.Ceiling((float)cost / 2f); + } + + public override ICardCostModifier Clone() + { + return new CostHalfRoundUpModifier(base.IsResidentModifier); + } +} diff --git a/SVSim.BattleEngine/Engine/CostSetModifier.cs b/SVSim.BattleEngine/Engine/CostSetModifier.cs new file mode 100644 index 0000000..7e17007 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CostSetModifier.cs @@ -0,0 +1,24 @@ +public class CostSetModifier : ICardCostModifier +{ + public int Cost { get; private set; } + + public bool IsClearBeforeModifier => true; + + public bool IsResidentModifier { get; } + + public CostSetModifier(int cost, bool isResidentModifier = false) + { + Cost = cost; + IsResidentModifier = isResidentModifier; + } + + public int CalcCost(int cost) + { + return Cost; + } + + public ICardCostModifier Clone() + { + return new CostSetModifier(Cost, IsResidentModifier); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/AssetBundleObject.cs b/SVSim.BattleEngine/Engine/Cute/AssetBundleObject.cs new file mode 100644 index 0000000..80ef894 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/AssetBundleObject.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Cute; + +public class AssetBundleObject +{ + public AssetBundle assetBundle { get; set; } + + public List objectArray { get; set; } + + public AssetBundleObject() + { + assetBundle = null; + objectArray = new List(); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/AssetManager.cs b/SVSim.BattleEngine/Engine/Cute/AssetManager.cs new file mode 100644 index 0000000..ccda1fd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/AssetManager.cs @@ -0,0 +1,1554 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Security.Cryptography; +using System.Text; +using Sqlite3Plugin; +using UnityEngine; +using Wizard; + +namespace Cute; + +public class AssetManager : MonoBehaviour, IManager +{ + public enum _tag_datamode + { + DATAMODE_PREIN, + DATAMODE_ALLDL, + DATAMODE_HYBRID + } + + private Dictionary handleDictionary = new Dictionary(); + + private Dictionary objectDictionary = new Dictionary(); + + private const int BACKGROUND_DOWNLOAD_BETWEEN_JOBS_WAIT_FRAMES = 5; + + private string[] categoryNameList; + + private static bool _isCryptAssetFileName = false; + + private AsyncJob _asyncJobDownload; + + private AsyncJob _asyncJobLoad; + + private bool _isCompressionAssetBundle = true; + + public bool _isUsePersistSound_PreIncircumstance; + + public const string assetbundleManifestName = "_assetmanifest"; + + public const string manifestOfManifestName = "manifest_assetmanifest"; + + public const string soundManifestName = "soundmanifest"; + + public const string movieManifestName = "moviemanifest"; + + public const string fontManifestName = "fontmanifest"; + + public string currentMovieManifestName = ""; + + private static string _savePath = null; + + private static string _packageDataPath = null; + + public bool _isUseStreamingAsset; + + private const string DIRECTORY_ASSET_BUNDLE = "a"; + + public const string DIRECTORY_MOVIE = "m"; + + public const string DIRECTORY_FONT = "f"; + + public const string DIRECTORY_BGM = "b"; + + public const string DIRECTORY_SE = "s"; + + public const string DIRECTORY_VOICE = "v"; + + public const string DIRECTORY_TEMPORARY = "t"; + + public const string DIRECTORY_TEMPORARY_VOICE = "v/t"; + + private const string DIRECTORY_MANIFEST = "manifest"; + + private const string commonShaderAssetName = "card_shader_common.unity3d"; + + private string manifestSavePath = ""; + + private string bundleSavePath = ""; + + private string soundSavePath = ""; + + private string movieSavePath = ""; + + private string fontSavePath = ""; + + private string manifestPackagePath = ""; + + private string bundlePackagePath = ""; + + private string soundPackagePath = ""; + + private string moviePackagePath = ""; + + private string fontPackagePath = ""; + + private int downloadReqCount; + + private int downloadCompCount; + + private int loadingReqCount; + + private int loadingCompCount; + + private int loadingManifestCompCount; + + public HashSet predownloadCategories = new HashSet { "common", "tutorial" }; + + public HashSet tutorialdownloadCategories = new HashSet { "tutorial" }; + + public List NoUnloadAssetName = new List(); + + private static List assetList = new List(); + + private static List soundList = new List(); + + private static List movieList = new List(); + + private float _normalResourceDownloadSize; + + private float _smallResourceDownloadSize; + + private float _downloadCompletedSize; + + private float _prevFrameEndTime; + + private List _temporaryVoiceNameList = new List(); + + public string MovieManifesHeadtName = "moviemanifest"; + + public string SoundManifesHeadtName = "soundmanifest"; + + private bool _isLocalDatahashStoreRecoveryMode; + + private ManifestDatahashKVS _localDatahashStore; + + public static bool isCryptAssetFileName => _isCryptAssetFileName; + + public bool IsResourceDataBaseError { get; private set; } + + public bool IsBackgroundDownload { get; private set; } + + public bool isCompressionAssetBundle + { + get + { + return _isCompressionAssetBundle; + } + set + { + _isCompressionAssetBundle = value; + } + } + + public string manifestOfManifests { get; set; } + + public string manifestOfManifests_sub { get; set; } + + public bool IsDownloadJobIdle() + { + return _asyncJobDownload.IsIdle; + } + + public void CancelDownloadAsyncJob() + { + _asyncJobDownload.Cancel(); + } + + public void SetDownloadAsBg(bool isBackground) + { + IsBackgroundDownload = isBackground; + if (isBackground) + { + _asyncJobDownload.WantedWaitFramesBetweenJobs = 5; + } + else + { + _asyncJobDownload.WantedWaitFramesBetweenJobs = null; + } + } + + public void ClearManifestOfManifests() + { + manifestOfManifests = null; + manifestOfManifests_sub = null; + } + + private ManifestDatahashKVS GetLocalDatahashStore() + { + if (_localDatahashStore == null && !_isLocalDatahashStoreRecoveryMode) + { + string localDatahashStorePath = GetLocalDatahashStorePath(); + try + { + _localDatahashStore = new ManifestDatahashKVS(localDatahashStorePath); + } + catch (Exception ex) + { + HandleLocalDatahashException(ex); + } + } + return _localDatahashStore; + } + + public string GetLocalDatahashStorePath() + { + return GetAssetSaveRootPath() + "manifest.db"; + } + + private void HandleLocalDatahashException(Exception ex) + { + if (ex is DatabaseCorruptionException) + { + IsResourceDataBaseError = true; + _isLocalDatahashStoreRecoveryMode = true; + UnloadManifestHashDB(); + string localDatahashStorePath = GetLocalDatahashStorePath(); + if (File.Exists(localDatahashStorePath)) + { + File.Delete(localDatahashStorePath); + } + UIManager instance = UIManager.GetInstance(); + if ((bool)instance) + { + instance.CreateConfirmationDialog(Data.SystemText.Get("System_0058")).OnClose = delegate + { + SoftwareReset.setAction(); + SoftwareReset.exec(); + }; + } + else + { + SoftwareResetBase.SoftwareReset(null, null); + } + return; + } + throw ex; + } + + public void SaveLocalDatahash(string name, string hash) + { + ManifestDatahashKVS localDatahashStore = GetLocalDatahashStore(); + if (localDatahashStore != null) + { + try + { + localDatahashStore.Set(name, hash); + } + catch (Exception ex) + { + HandleLocalDatahashException(ex); + } + } + } + + public string GetLocalDatahash(string name) + { + ManifestDatahashKVS localDatahashStore = GetLocalDatahashStore(); + if (localDatahashStore != null) + { + try + { + return localDatahashStore.Get(name); + } + catch (Exception ex) + { + HandleLocalDatahashException(ex); + } + } + return ""; + } + + public void DeleteLocalDatahashByPrefix(string prefix) + { + ManifestDatahashKVS localDatahashStore = GetLocalDatahashStore(); + if (localDatahashStore != null) + { + try + { + localDatahashStore.DeleteByPrefix(prefix); + } + catch (Exception ex) + { + HandleLocalDatahashException(ex); + } + } + } + + public List FindLocalDatahashByPattern(string patternEscaped) + { + List result = null; + ManifestDatahashKVS localDatahashStore = GetLocalDatahashStore(); + if (localDatahashStore != null) + { + try + { + result = localDatahashStore.FindLike(patternEscaped); + } + catch (Exception ex) + { + HandleLocalDatahashException(ex); + } + } + return result; + } + + public string EscapeLocalDatahashPattern(string patternNoEscaped) + { + string result = null; + ManifestDatahashKVS localDatahashStore = GetLocalDatahashStore(); + if (localDatahashStore != null) + { + try + { + result = localDatahashStore.EscapeLikePattern(patternNoEscaped); + } + catch (Exception ex) + { + HandleLocalDatahashException(ex); + } + } + return result; + } + + public void UnloadManifestHashDB() + { + if (_localDatahashStore != null) + { + _localDatahashStore.Dispose(); + _localDatahashStore = null; + } + } + + public void DisableDatahashCache() + { + if (_localDatahashStore != null) + { + _localDatahashStore.DisableCache(); + } + } + + public static string GetCryptFileName(string name) + { + return Cryptographer.ComputeSHA1(name); + } + + public static string GetAssetSaveRootPath() + { + return _savePath; + } + + public static string BuildAssetLocalCachePath(string directory, string filename) + { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.Append(GetAssetSaveRootPath()); + stringBuilder.Append(directory); + stringBuilder.Append(isCryptAssetFileName ? GetCryptFileName(filename) : filename); + return stringBuilder.ToString(); + } + + public static string BuildAssetLocalCachePath(string assetName) + { + string fileName = Path.GetFileName(assetName); + return BuildAssetLocalCachePath(assetName.Substring(0, assetName.Length - fileName.Length), fileName); + } + + public static bool AssetFileExists(string assetName) + { + return File.Exists(BuildAssetLocalCachePath(assetName)); + } + + private IEnumerator Start() + { + _isUseStreamingAsset = false; + _savePath = Application.persistentDataPath + "/"; + _packageDataPath = Application.streamingAssetsPath + "/"; + while (Toolbox.ResourcesManager == null) + { + yield return 0; + } + int preferredParallelLoadNum = Toolbox.ResourcesManager.GetPreferredParallelLoadNum(); + int preferredParallelDownloadNum = Toolbox.ResourcesManager.GetPreferredParallelDownloadNum(); + preferredParallelLoadNum = ((preferredParallelLoadNum > preferredParallelDownloadNum) ? preferredParallelLoadNum : preferredParallelDownloadNum); + _asyncJobDownload = new AsyncJob(this, preferredParallelLoadNum); + _asyncJobDownload.Start(); + _asyncJobLoad = new AsyncJob(this, preferredParallelLoadNum); + _asyncJobLoad.Start(); + Toolbox.AssetManager = this; + yield return 0; + } + + private void OnDestroy() + { + UnloadManifestHashDB(); + } + + public int GetManifestCount() + { + int num = categoryNameList.Length; + int num2 = 1; + int num3 = 1; + int num4 = 1; + return num + num2 + num3 + num4; + } + + public bool CreateLocalFileCacheDirectories() + { + try + { + Directory.CreateDirectory(_savePath + "a"); + Directory.CreateDirectory(_savePath + "b"); + Directory.CreateDirectory(_savePath + "s"); + Directory.CreateDirectory(_savePath + "v"); + Directory.CreateDirectory(_savePath + "v/t"); + Directory.CreateDirectory(_savePath + "m"); + Directory.CreateDirectory(_savePath + "f"); + Directory.CreateDirectory(_savePath + "manifest"); + } + catch (Exception) + { + return false; + } + return true; + } + + private IEnumerator TryDownloadManifestOfManifest() + { + bool isError = false; + ClearManifestOfManifests(); + if (CustomPreference.GetResourceLanguage() != CustomPreference.GetSoundMovieLanguage()) + { + yield return StartCoroutine(DownloadManifestOfManifest("manifest_assetmanifest", delegate + { + isError = true; + }, isSubMani: true)); + } + if (isError) + { + yield break; + } + yield return StartCoroutine(DownloadManifestOfManifest("manifest_assetmanifest", delegate + { + isError = true; + }, isSubMani: false)); + if (!isError) + { + bool isDone = false; + CacheAsset("manifest_assetmanifest", delegate + { + isDone = true; + }); + while (!isDone) + { + yield return 0; + } + } + } + + private IEnumerator DownloadManifestOfManifest(string manifestOfManifestName, Action errorCallback, bool isSubMani) + { + bool isDone = false; + AssetErrorState errorState = new AssetErrorState(); + RequestDownload(manifestOfManifestName, isManifest: true, new AssetRequestContext(delegate + { + isDone = true; + }, null, errorState), isSubMani); + while (!isDone) + { + yield return 0; + } + if (errorState.HasError()) + { + errorCallback?.Invoke(); + } + } + + private bool CheckExtraDownload() + { + return true; + } + + private void DecideMovieManifestName() + { + currentMovieManifestName = string.Format("{0}_{1}", "moviemanifest", CustomPreference.GetSoundMovieLanguage().ToLower()); + } + + private void PrepareManifestList(out List downloadList, out List loadList, bool extraDownload) + { + List list = new List(); + loadList = new List(); + for (int i = 0; i < categoryNameList.Length; i++) + { + string item = categoryNameList[i] + "_assetmanifest"; + list.Add(item); + loadList.Add(item); + } + DecideMovieManifestName(); + if (extraDownload) + { + string[] array = new string[3] { "soundmanifest", currentMovieManifestName, "fontmanifest" }; + foreach (string item2 in array) + { + list.Add(item2); + loadList.Add(item2); + } + } + downloadList = new List(); + foreach (string item3 in list) + { + if (handleDictionary.TryGetValue(item3, out var value)) + { + if (value.isReDownloadAsset(CustomPreference.IsNormalResource)) + { + downloadList.Add(item3); + } + } + else + { + value = new AssetHandle(item3, null, null, null, null, null, isManifest: true); + handleDictionary.Add(item3, value); + downloadList.Add(item3); + } + } + } + + public IEnumerator InitializeManifest(Action completeCallback, bool isTutorialDL) + { + QualitySettings.vSyncCount = 0; + Application.targetFrameRate = 60; + if (!CreateLocalFileCacheDirectories()) + { + UIManager.GetInstance().isErrorProc = false; + string titleLabel = Data.SystemText.Get("System_0020"); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true); + if (dialogBase != null) + { + dialogBase.SetFadeButtonEnabled(flag: false); + dialogBase.SetTitleLabel(titleLabel); + dialogBase.SetText(Data.SystemText.Get("System_0021")); + dialogBase.SetReturnMsg(UIManager.GetInstance().gameObject, "CommonResetGame"); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.GrayBtn); + dialogBase.SetButtonText(Data.SystemText.Get("System_0006")); + dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_CANCEL_TRANS; + dialogBase.SetPanelDepth(6000); + } + UIManager.GetInstance().isNoAvailMemory = true; + UIManager.GetInstance().isRetryProc = false; + while (!UIManager.GetInstance().isErrorProc) + { + yield return 0; + } + UIManager.GetInstance().isNoAvailMemory = false; + if (!UIManager.GetInstance().isRetryProc) + { + SoftwareResetBase.SoftwareReset(null, null); + } + } + LoadPreinManifest(); + yield return StartCoroutine(TryDownloadManifestOfManifest()); + bool extraDownload = CheckExtraDownload(); + PrepareManifestList(out var downloadList, out var loadList, extraDownload); + if (downloadList.Count > 0) + { + yield return StartCoroutine(Toolbox.ResourcesManager.DownloadAssetGroup(downloadList, null, isProgress: false)); + } + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupSync(loadList, null, isProgress: false)); + bool isDone = false; + if (extraDownload) + { + isDone = false; + RequestDownload("card_shader_common.unity3d", isManifest: false, delegate + { + isDone = true; + }); + while (!isDone) + { + yield return 0; + } + } + CacheAsset("card_shader_common.unity3d", delegate + { + isDone = true; + }); + while (!isDone) + { + yield return 0; + } + loadList.Sort(); + ClearManifestOfManifests(); + Toolbox.SavedataManager.Save(); + QualitySettings.vSyncCount = 0; + Application.targetFrameRate = Toolbox.QualityManager.GetFrameRate(); + completeCallback?.Invoke(); + } + + public bool IsShouldLoadPreinResource(string fileName) + { + return false; + } + + public bool IsUseDownloadResource(string fileName) + { + return true; + } + + private void LoadPreinManifest() + { + } + + private string CalcWholeResourceHash(List loadedManfiestList) + { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.Append(Toolbox.SavedataManager.GetResourceVersion()); + stringBuilder.Append("|"); + int i = 0; + for (int count = loadedManfiestList.Count; i < count; i++) + { + string text = loadedManfiestList[i]; + if (handleDictionary.TryGetValue(text, out var value)) + { + if (string.IsNullOrEmpty(value.dataHash)) + { + Debug.LogError("manifest hash not found: " + text); + return ""; + } + stringBuilder.Append(text); + stringBuilder.Append(","); + stringBuilder.Append(value.dataHash); + stringBuilder.Append("|"); + } + } + SHA1CryptoServiceProvider sHA1CryptoServiceProvider = new SHA1CryptoServiceProvider(); + byte[] array = sHA1CryptoServiceProvider.ComputeHash(new UTF8Encoding().GetBytes(stringBuilder.ToString())); + StringBuilder stringBuilder2 = new StringBuilder(); + for (int j = 0; j < array.Length; j++) + { + stringBuilder2.Append(Convert.ToString(array[j], 16).PadLeft(2, '0')); + } + sHA1CryptoServiceProvider.Clear(); + return stringBuilder2.ToString(); + } + + public void SetCategoryList(string[] _categoryList) + { + categoryNameList = _categoryList; + } + + public string[] GetCategoryList() + { + return categoryNameList; + } + + public bool RegistHandle(string key, AssetHandle handle) + { + try + { + handleDictionary.Add(key, handle); + if (handle.directory.StartsWith("v/t", StringComparison.Ordinal)) + { + _temporaryVoiceNameList.Add(Path.GetFileNameWithoutExtension(handle.filename)); + } + } + catch (Exception ex) + { + AssetHandle assetHandle = GetAssetHandle(key); + if (assetHandle != null && assetHandle.isMultipleHandleIgnorAsset) + { + assetHandle.CopyWithCatchException(handle); + assetHandle.reference--; + return true; + } + Debug.LogError(ex.Message); + return false; + } + return true; + } + + public AssetBundleObject GetAssetBundleObject(string assetName) + { + AssetBundleObject value = null; + if (objectDictionary.TryGetValue(assetName, out value)) + { + return value; + } + return null; + } + + public void DownloadAsset(string assetName, AssetRequestContext requestContext, bool isManifest = false) + { + RequestDownload(assetName, isManifest, requestContext); + } + + public void SetAssetBundle(string filename, AssetBundle assetbundle, bool isMultipleHandleIgnorAsset = false) + { + if (objectDictionary.TryGetValue(filename, out var value)) + { + if (!isMultipleHandleIgnorAsset) + { + for (int i = 0; i < value.objectArray.Count; i++) + { + UnityEngine.Object.DestroyImmediate(value.objectArray[i].baseObject, allowDestroyingAssets: true); + } + } + value.objectArray.Clear(); + if (value.assetBundle != null) + { + value.assetBundle.Unload(unloadAllLoadedObjects: true); + } + value.assetBundle = assetbundle; + } + else + { + value = new AssetBundleObject(); + value.assetBundle = assetbundle; + objectDictionary.Add(filename, value); + } + } + + public void SetObjectList(string filename, List objectList) + { + if (objectDictionary.TryGetValue(filename, out var value)) + { + value.objectArray = objectList; + } + } + + public bool HasObjectList(string filename) + { + return objectDictionary.ContainsKey(filename); + } + + public void UnloadAssetBundle(string assetName) + { + if (objectDictionary.TryGetValue(assetName, out var value)) + { + for (int i = 0; i < value.objectArray.Count; i++) + { + UnityEngine.Object.DestroyImmediate(value.objectArray[i].baseObject, allowDestroyingAssets: true); + } + value.objectArray.Clear(); + if (value.assetBundle != null) + { + value.assetBundle.Unload(unloadAllLoadedObjects: true); + value.assetBundle = null; + } + objectDictionary.Remove(assetName); + } + } + + public void UnloadAssetAll() + { + foreach (KeyValuePair item in handleDictionary) + { + item.Value.Unload(); + } + } + + public void UnloadAsset(string assetName) + { + if (!string.IsNullOrEmpty(assetName) && handleDictionary.TryGetValue(assetName, out var value) && value.assetType != AssetHandle.AssetType.Movie) + { + value.Unload(); + } + } + + public void UnloadTemporaryAssetAll() + { + foreach (KeyValuePair item in handleDictionary) + { + if (item.Value.unloadTemporary) + { + item.Value.UnloadTemporary(); + } + } + } + + public void UnloadTemporaryAsset(string assetName) + { + if (handleDictionary.TryGetValue(assetName, out var value) && value.unloadTemporary) + { + value.UnloadTemporary(); + } + } + + public void UnloadCommonAssetAll() + { + foreach (KeyValuePair item in handleDictionary) + { + if (item.Value.unloadCommon) + { + item.Value.UnloadCommon(); + } + } + } + + public void UnloadCommonAsset(string assetName) + { + if (handleDictionary.TryGetValue(assetName, out var value) && value.unloadCommon) + { + value.UnloadCommon(); + } + } + + public void CacheAsset(string assetName, Action callback = null) + { + CacheAsset(assetName, new AssetRequestContext(delegate + { + if (callback != null) + { + callback(); + } + })); + } + + public void CacheAsset(string assetName, AssetRequestContext requestContext) + { + AssetHandle value = null; + if (handleDictionary.TryGetValue(assetName, out value) && !value.useStreamingAsset) + { + value.Load(requestContext); + } + else if (requestContext != null && requestContext.callback != null) + { + requestContext.callback(value); + } + } + + public void CachePersistantAssetBeforeManifestLoad(string assetName, Action callback = null) + { + CachePersistantAssetBeforeManifestLoad(assetName, new AssetRequestContext(delegate + { + if (callback != null) + { + callback(); + } + })); + } + + public void CachePersistantAssetBeforeManifestLoad(string assetName, AssetRequestContext requestContext) + { + AssetHandle value = null; + if (handleDictionary.TryGetValue(assetName, out value)) + { + requestContext.callback(value); + return; + } + value = new AssetHandle(assetName, "", null, null, null, null); + if (File.Exists(value.BuildLocalCachePath())) + { + Toolbox.AssetManager.RegistHandle(assetName, value); + value.Load(requestContext); + } + else if (requestContext != null && requestContext.callback != null) + { + requestContext.callback(value); + } + } + + public UnityEngine.Object LoadObject(string objectName, Type type, bool isIfFindLoad = false) + { + string value = objectName.ToLower() + "."; + foreach (AssetBundleObject value2 in objectDictionary.Values) + { + int count = value2.objectArray.Count; + for (int i = 0; i < count; i++) + { + AssetObject assetObject = value2.objectArray[i]; + if (assetObject.baseObject != null && (assetObject.baseObject.GetType() == type || assetObject.baseObject.GetType().IsSubclassOf(type)) && assetObject.basePath.IndexOf(value, StringComparison.Ordinal) != -1) + { + return assetObject.baseObject; + } + } + } + return null; + } + + public UnityEngine.Object LoadObject(string assetName, string objectName, Type type) + { + string text = objectName.ToLower() + "."; + if (objectDictionary.TryGetValue(assetName, out var value)) + { + int count = value.objectArray.Count; + for (int i = 0; i < count; i++) + { + if (value.objectArray[i].baseObject != null && text.Equals(value.objectArray[i].basePath) && (value.objectArray[i].baseObject.GetType() == type || value.objectArray[i].baseObject.GetType().IsSubclassOf(type))) + { + return value.objectArray[i].baseObject; + } + } + } + return null; + } + + public object LoadObjectByte(string objectName, Type type, bool isIfFindLoad = false) + { + if (string.IsNullOrEmpty(objectName)) + { + Debug.LogError("empty name for AssetManager.LoadObject"); + return null; + } + foreach (KeyValuePair item in objectDictionary) + { + AssetBundleObject value = item.Value; + for (int i = 0; i < value.objectArray.Count; i++) + { + if (value.objectArray[i] != null && value.objectArray[i].baseObject != null && (type == typeof(UnityEngine.Object) || value.objectArray[i].baseObject.GetType() == type)) + { + return value.objectArray[i].baseObject; + } + } + } + return null; + } + + public void RegistCommonAsset(string assetName) + { + AssetHandle assetHandle = GetAssetHandle(assetName); + if (assetHandle != null) + { + assetHandle.unloadCommon = true; + } + } + + public void RegistTemporaryAsset(string assetName) + { + AssetHandle assetHandle = GetAssetHandle(assetName); + if (assetHandle != null) + { + assetHandle.unloadTemporary = true; + } + } + + public void AddDownloadJob(IEnumerator enumerator, Action cancelAction) + { + _asyncJobDownload.Add(enumerator, cancelAction); + } + + public void AddLoadJob(IEnumerator enumerator, Action cancelAction) + { + _asyncJobLoad.Add(enumerator, cancelAction); + } + + private void RequestDownload(string name, bool isManifest, Action callback, bool isSubMani = false) + { + RequestDownload(name, isManifest, new AssetRequestContext(delegate + { + if (callback != null) + { + callback(); + } + }), isSubMani); + } + + private void RequestDownload(string name, bool isManifest, AssetRequestContext requestContext, bool isSubMani = false) + { + if (isManifest && !handleDictionary.TryGetValue(name, out var value)) + { + value = new AssetHandle(name, null, null, null, null, null, isManifest); + handleDictionary.Add(name, value); + } + value = GetAssetHandle(name); + if (value == null) + { + value = new AssetHandle(name, "", null, null, null, null); + handleDictionary.Add(name, value); + } + value.isSubManifest = isSubMani; + value.Download(requestContext); + } + + public bool IsEnableAssetName(string assetName) + { + return handleDictionary.ContainsKey(assetName); + } + + public AssetHandle GetAssetHandle(string assetName, bool isWarning = true) + { + AssetHandle value = null; + handleDictionary.TryGetValue(assetName, out value); + return value; + } + + public void ClearAssetCacheAssetBundle() + { + foreach (KeyValuePair item in objectDictionary) + { + AssetBundleObject value = item.Value; + List objectArray = item.Value.objectArray; + if (objectArray != null) + { + for (int i = 0; i < objectArray.Count; i++) + { + UnityEngine.Object.DestroyImmediate(objectArray[i].baseObject, allowDestroyingAssets: true); + } + } + if (value.assetBundle != null) + { + value.assetBundle.Unload(unloadAllLoadedObjects: true); + } + } + objectDictionary.Clear(); + handleDictionary.Clear(); + } + + public void ClearAllAssetFile() + { + ClearManifestAll(); + ClearAssetBundleAll(forceCleanCache: true); + ClearSoundFileAll(); + ClearMovieAll(); + ClearFontAll(); + ClearTemporaryFileAll(); + Caching.ClearCache(); + } + + public void ClearManifestAll() + { + ClearManifestOfManifests(); + ClearLocalCache("manifest"); + if (_localDatahashStore != null) + { + _localDatahashStore.DeleteAll(); + } + } + + public void ClearAssetBundleAll(bool forceCleanCache) + { + ClearLocalCache("a"); + if (forceCleanCache) + { + Caching.ClearCache(); + } + } + + public void ClearMovieAll() + { + ClearLocalCache("m"); + } + + public void ClearFontAll() + { + ClearLocalCache("f"); + } + + public void ClearSoundFileAll() + { + ClearSoundFileBgm(); + ClearSoundFileSe(); + ClearSoundFileVoice(); + } + + public void ClearSoundFileBgm() + { + ClearLocalCache("b"); + } + + public void ClearSoundFileSe() + { + ClearLocalCache("s"); + } + + public void ClearSoundFileVoice() + { + ClearLocalCache("v"); + } + + public void ClearTemporaryFileAll() + { + ClearTemporaryVoiceFile(); + } + + public void ClearTemporaryVoiceFile() + { + ClearLocalCache("v/t"); + } + + private void ClearLocalCache(string keyword) + { + string value = keyword + "/"; + try + { + List list = new List(); + foreach (KeyValuePair item in handleDictionary) + { + if (item.Key.StartsWith(value)) + { + list.Add(item.Key); + } + } + int count = list.Count; + for (int i = 0; i < count; i++) + { + handleDictionary.Remove(list[i]); + } + DeleteLocalDatahashByPrefix(keyword + "/"); + string path = _savePath + keyword; + if (Directory.Exists(path)) + { + Directory.Delete(path, recursive: true); + } + } + catch (Exception ex) + { + Debug.LogError(ex.Message); + } + } + + public IEnumerator DownloadAssetBundleAll(Action callback) + { + assetList.Clear(); + foreach (KeyValuePair item in handleDictionary) + { + if (item.Value.IsAssetBundle()) + { + assetList.Add(item.Key); + } + } + yield return StartCoroutine(Toolbox.ResourcesManager.DownloadAssetGroup(assetList, callback)); + } + + public IEnumerator DownloadSoundAll(Action callback) + { + soundList.Clear(); + foreach (KeyValuePair item in handleDictionary) + { + if (item.Value.IsSound()) + { + soundList.Add(item.Key); + } + } + yield return StartCoroutine(Toolbox.ResourcesManager.DownloadAssetGroup(soundList, callback)); + } + + public IEnumerator DownloadMovieAll(Action callback) + { + movieList.Clear(); + foreach (KeyValuePair item in handleDictionary) + { + if (item.Value.IsMovie()) + { + movieList.Add(item.Key); + } + } + yield return StartCoroutine(Toolbox.ResourcesManager.DownloadAssetGroup(movieList, callback)); + } + + public IEnumerator PreDownloadListCoroutine(Action, List> onFinish) + { + Action, List, float, float> finish = delegate(List normalResourceDownloadList, List smallResourceDownloadList, float size, float smallResourceDownloadSize) + { + _normalResourceDownloadSize = size; + _smallResourceDownloadSize = smallResourceDownloadSize; + onFinish(normalResourceDownloadList, smallResourceDownloadList); + }; + while (!Toolbox.ResourcesManager.CanStartDownload()) + { + yield return new WaitForSeconds(1f); + } + PreDownloadListCoroutine(finish, withTutorial: true); + } + + public void RefreshNeedDownloadFile() + { + Action, List, float, float> onFinish = delegate(List normalResourceDownloadList, List smallResourceDownloadList, float size, float smallResourceDownloadSize) + { + _normalResourceDownloadSize = size; + _smallResourceDownloadSize = smallResourceDownloadSize; + }; + PreDownloadListCoroutine(onFinish, withTutorial: true); + } + + public void PreDownloadListCoroutine(Action, List, float, float> onFinish, bool withTutorial) + { + List list = new List(); + List list2 = new List(); + float num = 0f; + float num2 = 0f; + foreach (KeyValuePair item in handleDictionary) + { + AssetHandle value = item.Value; + bool flag = withTutorial || !value.isTutorialDownload; + if (!value.IsManifests() && value.isPreDownload && flag) + { + if (value.isReDownloadAsset(isNormalSizeResource: true)) + { + list.Add(item.Key); + num += value.manifestDataSize; + } + if (value.isReDownloadAsset(isNormalSizeResource: false)) + { + list2.Add(item.Key); + num2 += value.ManifestSmallDataSize; + } + } + } + onFinish.Call(list, list2, num, num2); + } + + public float GetNeedDownloadSize(bool isNormalResource, bool isTutorial) + { + float num = 0f; + foreach (KeyValuePair item in handleDictionary) + { + AssetHandle value = item.Value; + if ((!isTutorial || value.isTutorialDownload) && value.isPreDownload && !value.IsManifests() && value.isReDownloadAsset(isNormalResource)) + { + num += (isNormalResource ? value.manifestDataSize : value.ManifestSmallDataSize); + } + } + return num; + } + + public float GetTotalStrageUseSize(bool isNormalResource) + { + float num = 0f; + foreach (KeyValuePair item in handleDictionary) + { + AssetHandle value = item.Value; + if (value.isPreDownload && !value.IsManifests()) + { + num += (isNormalResource ? value.manifestDataSize : value.ManifestSmallDataSize); + } + } + return num; + } + + public float GetDownloadSize(bool isNormalResource) + { + if (!isNormalResource) + { + return _smallResourceDownloadSize; + } + return _normalResourceDownloadSize; + } + + public static string GetSuffixByDigit(float num) + { + int num2 = Mathf.FloorToInt(Mathf.Log(num, 2f)) + 1; + if (num2 <= 0) + { + return (num * 1024f).ToString("0.0") + "KB"; + } + if (num2 >= 11) + { + return (num / 1024f).ToString("0.0") + "GB"; + } + return num.ToString("0.0") + "MB"; + } + + public List GetTutorialDownloadList(bool isNormalResource) + { + List list = new List(); + if (isNormalResource) + { + _normalResourceDownloadSize = 0f; + } + else + { + _smallResourceDownloadSize = 0f; + } + foreach (KeyValuePair item in handleDictionary) + { + AssetHandle value = item.Value; + if (value.IsManifests() || !value.isTutorialDownload) + { + continue; + } + if (isNormalResource) + { + if (value.isReDownloadAsset(isNormalSizeResource: true)) + { + list.Add(item.Key); + _normalResourceDownloadSize += value.manifestDataSize; + } + } + else if (value.isReDownloadAsset(isNormalSizeResource: false)) + { + list.Add(item.Key); + _smallResourceDownloadSize += value.manifestDataSize; + } + } + return list; + } + + public int assetbundleOpenCount() + { + int num = 0; + foreach (KeyValuePair item in objectDictionary) + { + if (item.Value.assetBundle != null) + { + num++; + } + } + return num; + } + + public int assetbundleListCount() + { + return objectDictionary.Count; + } + + public IEnumerator InitializeSoundManifest() + { + handleDictionary.Remove("soundmanifest"); + bool isDone = false; + RequestDownload("soundmanifest", isManifest: true, delegate + { + Directory.CreateDirectory(_savePath + "b"); + Directory.CreateDirectory(_savePath + "s"); + Directory.CreateDirectory(_savePath + "v"); + isDone = true; + }); + while (!isDone) + { + yield return 0; + } + } + + public IEnumerator InitializeMovieManifest() + { + handleDictionary.Remove("moviemanifest"); + bool isDone = false; + RequestDownload("moviemanifest", isManifest: true, delegate + { + Directory.CreateDirectory(_savePath + "m"); + isDone = true; + }); + while (!isDone) + { + yield return 0; + } + } + + public void ResetDownloadCount() + { + downloadReqCount = 0; + downloadCompCount = 0; + _downloadCompletedSize = 0f; + ResetLoadCount(); + } + + public void ResetLoadCount() + { + loadingReqCount = 0; + loadingCompCount = 0; + loadingManifestCompCount = 0; + } + + public void createSavePath() + { + manifestSavePath = _savePath + "manifest/"; + bundleSavePath = _savePath + "a/"; + soundSavePath = _savePath; + movieSavePath = _savePath; + fontSavePath = _savePath; + } + + public string getAssetSavePath(AssetHandle.AssetType _assetType) + { + switch (_assetType) + { + case AssetHandle.AssetType.Manifests: + return manifestSavePath; + case AssetHandle.AssetType.AssetBundle: + return bundleSavePath; + case AssetHandle.AssetType.Sound: + case AssetHandle.AssetType.TemporarySound: + return soundSavePath; + case AssetHandle.AssetType.Movie: + return movieSavePath; + case AssetHandle.AssetType.Font: + return fontSavePath; + default: + return bundleSavePath; + } + } + + public void createPackagePath() + { + manifestPackagePath = _packageDataPath + "manifest/"; + bundlePackagePath = _packageDataPath + "a/"; + soundPackagePath = _packageDataPath; + moviePackagePath = _packageDataPath + CustomPreference.GetLanguageFolderName(); + } + + public string getAssetPackagePath(AssetHandle.AssetType _assetType) + { + switch (_assetType) + { + case AssetHandle.AssetType.Manifests: + return manifestPackagePath; + case AssetHandle.AssetType.AssetBundle: + return bundlePackagePath; + case AssetHandle.AssetType.Sound: + case AssetHandle.AssetType.TemporarySound: + return soundPackagePath; + case AssetHandle.AssetType.Movie: + return moviePackagePath; + case AssetHandle.AssetType.Font: + return fontPackagePath; + default: + return bundlePackagePath; + } + } + + public int GetDownloadMaxCount() + { + return downloadReqCount; + } + + public int GetDownloadCurrentCount() + { + return downloadCompCount; + } + + public float GetDownloadCompletedSize() + { + return _downloadCompletedSize; + } + + public int GetLoadingMaxCount() + { + return loadingReqCount; + } + + public int GetLoadingCurrentCount() + { + return loadingCompCount; + } + + public int GetManifestMaxCount() + { + return categoryNameList.Length; + } + + public int GetManifestCompleteCount() + { + return loadingManifestCompCount; + } + + public void AddManifestCount() + { + loadingManifestCompCount++; + } + + public void AddDownloadMaxCount(int cnt = -1) + { + if (cnt == -1) + { + downloadReqCount++; + } + else + { + downloadReqCount += cnt; + } + } + + public void AddDownloadCurrentCount() + { + downloadCompCount++; + } + + public void AddDownloadCompletedSize(float size) + { + _downloadCompletedSize += size; + } + + public void AddLoadingMaxCount(int cnt = -1) + { + if (cnt == -1) + { + loadingReqCount++; + } + else + { + loadingReqCount += cnt; + } + } + + public void AddLoadingCurrentCount(string strFileName) + { + loadingCompCount++; + } + + public void AddNoUnloadAssetGroupName(string name) + { + if (name == "") + { + return; + } + for (int i = 0; i < NoUnloadAssetName.Count; i++) + { + if (NoUnloadAssetName[i].CompareTo(name) == 0) + { + return; + } + } + NoUnloadAssetName.Add(name); + } + + public void RemoveUnloadAssetGroupName(string name) + { + if (!(name == "")) + { + NoUnloadAssetName.Remove(name); + } + } + + public bool CheckSavedDataAccuracy(List DataNameList) + { + if (DataNameList == null) + { + return true; + } + SHA1CryptoServiceProvider sHA1CryptoServiceProvider = new SHA1CryptoServiceProvider(); + int i = 0; + for (int count = DataNameList.Count; i < count; i++) + { + string key = DataNameList[i]; + if (handleDictionary.TryGetValue(key, out var value)) + { + string value2 = Utility.CreateHash(File.ReadAllBytes(value.BuildLocalCachePath())).ToString(); + if (!value.dataHash.Equals(value2)) + { + sHA1CryptoServiceProvider.Clear(); + return false; + } + } + } + sHA1CryptoServiceProvider.Clear(); + return true; + } + + public bool DeleteUnity3dAssetHash(List deleteDataNameList) + { + int i = 0; + for (int count = deleteDataNameList.Count; i < count; i++) + { + string key = deleteDataNameList[i]; + if (handleDictionary.TryGetValue(key, out var value)) + { + Toolbox.SavedataManager.DeleteKey(value.directory + value.filename); + } + } + return true; + } + + public bool IsTemporaryVoice(string fileName) + { + return _temporaryVoiceNameList.Contains(fileName); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/AssetObject.cs b/SVSim.BattleEngine/Engine/Cute/AssetObject.cs new file mode 100644 index 0000000..7fdef4d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/AssetObject.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace Cute; + +public class AssetObject +{ + public string basePath { get; private set; } + + public Object baseObject { get; private set; } + + public AssetObject(string path, Object obj) + { + basePath = path; + baseObject = obj; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/AsyncJob.cs b/SVSim.BattleEngine/Engine/Cute/AsyncJob.cs new file mode 100644 index 0000000..511e02d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/AsyncJob.cs @@ -0,0 +1,182 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Cute; + +public class AsyncJob +{ + private class Unit + { + public object action; + + public Action cancelAction; + + public Unit(object action, Action cancelAction) + { + this.action = action; + this.cancelAction = cancelAction; + } + } + + private int num; + + private MonoBehaviour mono; + + private List jobList = new List(); + + private bool isCancel; + + private int? _waitFramesBetweenJobs; + + private int _waitFramesBetweenJobsMin; + + private FramerateProfiler _framerateProfiler = new FramerateProfiler(); + + public int WAIT_FRAMES_INCREMENT = 5; + + public int WAIT_FRAMES_DECREMENT = 1; + + public bool IsIdle + { + get + { + if (!isCancel) + { + return jobList.Count == 0; + } + return false; + } + } + + public int? WantedWaitFramesBetweenJobs + { + set + { + _waitFramesBetweenJobs = value; + _waitFramesBetweenJobsMin = value.GetValueOrDefault(); + } + } + + public AsyncJob(MonoBehaviour mono, int num) + { + this.mono = mono; + this.num = num; + } + + public void Add(IEnumerator enumerator) + { + jobList.Add(new Unit(enumerator, null)); + } + + public void Add(IEnumerator enumerator, Action calcelAction) + { + jobList.Add(new Unit(enumerator, calcelAction)); + } + + public void Add(Action action) + { + jobList.Add(new Unit(action, null)); + } + + public void Add(Action action, Action calcelAction) + { + jobList.Add(new Unit(action, calcelAction)); + } + + public void Cancel() + { + if (!isCancel && jobList.Count != 0) + { + isCancel = true; + Add(CancelTerminator, CancelTerminator); + } + } + + public void CancelTerminator() + { + isCancel = false; + } + + public void Start() + { + for (int i = 0; i < num; i++) + { + mono.StartCoroutine(MicroThread()); + } + _framerateProfiler = new FramerateProfiler(); + mono.StartCoroutine(RunFpsProfiler()); + } + + private IEnumerator RunFpsProfiler() + { + _framerateProfiler.Init(); + while (true) + { + _framerateProfiler.Update(); + yield return null; + } + } + + private IEnumerator MicroThread() + { + while (true) + { + if (jobList.Count <= 0) + { + yield return null; + continue; + } + Unit unit = jobList[0]; + jobList.RemoveAt(0); + if (isCancel) + { + if (unit.cancelAction != null) + { + unit.cancelAction(); + } + } + else if (unit.action is IEnumerator) + { + yield return mono.StartCoroutine((IEnumerator)unit.action); + if (!_waitFramesBetweenJobs.HasValue) + { + continue; + } + float? fps = _framerateProfiler.Fps; + if (fps.HasValue) + { + if (fps < 20f) + { + _waitFramesBetweenJobs += WAIT_FRAMES_INCREMENT; + _framerateProfiler.Init(); + } + else if (fps > 30f) + { + _waitFramesBetweenJobs -= WAIT_FRAMES_INCREMENT; + if (_waitFramesBetweenJobs.Value < _waitFramesBetweenJobsMin) + { + _waitFramesBetweenJobs = _waitFramesBetweenJobsMin; + } + _framerateProfiler.Init(); + } + } + yield return WaitFrames(_waitFramesBetweenJobs.Value); + } + else if (unit.action is Action) + { + ((Action)unit.action)(); + } + } + } + + private static IEnumerator WaitFrames(int frameCount) + { + while (frameCount > 0) + { + frameCount--; + yield return null; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/AudioManager.cs b/SVSim.BattleEngine/Engine/Cute/AudioManager.cs new file mode 100644 index 0000000..f1a5cb5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/AudioManager.cs @@ -0,0 +1,808 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using CriWare; +using UnityEngine; + +namespace Cute; + +public class AudioManager : MonoBehaviour, IManager +{ + [SerializeField] + private GameObject _bgmParent; + + [SerializeField] + private CriAtomSource[] _bgm; + + private int _bgmSourceCount; + + [SerializeField] + private GameObject _seParent; + + [SerializeField] + private CriAtomSource[] _se; + + private int _seSourceCount; + + private SoundData[] _playingSe; + + [SerializeField] + private GameObject _voiceParent; + + [SerializeField] + private CriAtomSource[] _voice; + + private int _voiceSourceCount; + + private bool _bgmPlaySuspend; + + private const int BGM_FADEOUT_TIME = 500; + + private const int SONG_PREVIEW_FADE_TIME = 500; + + private const int SONG_PREVIEW_FADE_SPACE_TIME = 1500; + + private const float SE_FADE_TIME = 0.5f; + + public const int DELAY_TIME_OFFSET = -4; + + private const float VOULMN_BOOST_FACTOR = 1.5f; + + public const string ACB_EXTENSION_WITHPARAM = "{0}.acb"; + + public const string ACB_EXTENSION = ".acb"; + + public const string AWB_EXTENSION_WITHPARAM = "{0}.awb"; + + public const string AWB_EXTENSION = ".awb"; + + private const string STR_SUBFOLDER_BGM = "b/"; + + public const string STR_SUBFOLDER_SE = "s/"; + + private const string STR_SUBFOLDER_SONG = "l/"; + + private const string STR_SUBFOLDER_VOICE = "v/"; + + private const string STR_SUBFOLDER_STORY = "c/"; + + private const string STR_SUBFOLDER_ROOM = "r/"; + + public bool isDownloadVoiceUse = true; + + protected bool _isRedy; + + private bool _noSeMode; + + private CriAtomExPlayback _playback; + + private CriAtomExPlayback _bgmPlayback; + + private float _sampleTime; + + private int _delayTime; + + private int _criDelayTime; + + private int _criInitializeCount; + + private const int CRI_RETRY_COUNT = 3; + + private Dictionary _acbDictionary = new Dictionary(); + + private string[] STR_PREINSTALL_FILENAME = new string[1] { "preinstall" }; + + public const float VOICE_MASTER_VOLUME = 0.8f; + + private Action _callbackVoiseEnd; + + private string _bgmName = ""; + + private int _cueId = -1; + + private string _bgmCue = ""; + + public bool isRedy => _isRedy; + + public int delayTime + { + get + { + return _delayTime; + } + set + { + _delayTime = value; + } + } + + public string bgmName + { + get + { + return _bgmName; + } + set + { + _bgmName = value; + } + } + + public int cueId + { + get + { + return _cueId; + } + set + { + _cueId = value; + } + } + + public string bgmCue + { + get + { + return _bgmCue; + } + set + { + _bgmCue = value; + } + } + + private void Awake() + { + } + + private IEnumerator Start() + { + _bgm = _bgmParent.GetComponentsInChildren(); + _bgmSourceCount = _bgm.Length; + for (int i = 0; i < _bgmSourceCount; i++) + { + CriAtomExPlayer player = _bgm[i].player; + player.AttachFader(); + player.ResetFaderParameters(); + player.SetFadeOutTime(500); + } + _se = _seParent.GetComponentsInChildren(); + _seSourceCount = _se.Length; + _playingSe = new SoundData[_seSourceCount]; + for (int j = 0; j < _seSourceCount; j++) + { + CriAtomExPlayer player2 = _se[j].player; + player2.AttachFader(); + player2.ResetFaderParameters(); + } + _voice = _voiceParent.GetComponentsInChildren(); + _voiceSourceCount = _voice.Length; + for (int k = 0; k < _voiceSourceCount; k++) + { + CriAtomExPlayer player3 = _voice[k].player; + player3.AttachFader(); + player3.ResetFaderParameters(); + } + Toolbox.AudioManager = this; + yield break; + } + + public void ResetSoundMode() + { + _noSeMode = false; + } + + private void Update() + { + } + + public void PauseAllBgm(bool pauseStatus) + { + if (pauseStatus) + { + _bgmPlaySuspend = false; + for (int i = 0; i < _bgmSourceCount; i++) + { + if (_bgm[i].status == CriAtomSource.Status.Prep || _bgm[i].status == CriAtomSource.Status.Playing) + { + _bgm[i].Pause(sw: true); + _bgmPlaySuspend = true; + } + } + } + else if (_bgmPlaySuspend) + { + for (int j = 0; j < _bgmSourceCount; j++) + { + _bgm[j].Pause(sw: false); + } + } + } + + public long GetMusicLength(string acbName) + { + CriAtomExAcb acb = CriAtom.GetAcb(acbName); + if (acb != null && acb.GetCueInfo(0, out var info)) + { + return info.length; + } + return -1L; + } + + public bool IsAvailableCueSheet(string cueName) + { + CriAtomCueSheet cueSheet = CriAtom.GetCueSheet(cueName); + if (cueSheet != null) + { + return cueSheet.acb != null; + } + return false; + } + + public bool AddCueSheet(string _name, string acbFile, string subFolderPath, string awbname = "") + { + _name = _name.Replace(".acb", ""); + if (CriAtom.GetCueSheet(_name) != null || CriAtom.GetCueSheet(acbFile) != null) + { + return true; + } + bool flag = false; + int num = STR_PREINSTALL_FILENAME.Length; + for (int i = 0; i < num; i++) + { + if (string.Compare(_name, STR_PREINSTALL_FILENAME[i]) == 0) + { + flag = true; + break; + } + } + if (flag) + { + acbFile = $"{subFolderPath}{acbFile}"; + awbname = $"{subFolderPath}{awbname}"; + } + else + { + acbFile = string.Format("{0}{1}{2}{3}", Application.persistentDataPath, "/", subFolderPath, acbFile); + awbname = string.Format("{0}{1}{2}{3}", Application.persistentDataPath, "/", subFolderPath, awbname); + } + CriAtomCueSheet criAtomCueSheet = CriAtom.AddCueSheet(_name, acbFile, awbname); + if (criAtomCueSheet == null) + { + return false; + } + if (criAtomCueSheet.acb == null) + { + RemoveCueSheet(_name); + return false; + } + return true; + } + + public bool AddCueSheetFromFileName(string _name, string acbFile, string awbname) + { + _name = _name.Replace(".acb", ""); + int num = STR_PREINSTALL_FILENAME.Length; + for (int i = 0; i < num && string.Compare(_name, STR_PREINSTALL_FILENAME[i]) != 0; i++) + { + } + if (CriAtom.GetCueSheet(_name) != null) + { + return true; + } + CriAtomCueSheet criAtomCueSheet = CriAtom.AddCueSheet(_name, acbFile, awbname); + if (criAtomCueSheet == null) + { + return false; + } + if (criAtomCueSheet.acb == null) + { + RemoveCueSheet(_name); + return false; + } + return true; + } + + public void RemoveCueSheet(string name) + { + name = name.Replace(".awb", ""); + name = name.Replace(".acb", ""); + name = name.Replace("s/", ""); + name = name.Replace("b/", ""); + CriAtom.RemoveCueSheet(name); + } + + public void RemoveCueSheet(List nameList) + { + for (int i = 0; i < nameList.Count; i++) + { + RemoveCueSheet(nameList[i]); + } + } + + public float GetSampleTime() + { + long numSamples = 0L; + int samplingRate = 0; + if (_playback.GetNumPlayedSamples(out numSamples, out samplingRate)) + { + _sampleTime = (float)numSamples / (float)samplingRate; + } + return _sampleTime; + } + + private void OnDestroy() + { + foreach (KeyValuePair item in _acbDictionary) + { + item.Value.Dispose(); + } + } + + public int GetDelayTimeFromCRI() + { + int result = 0; + if (_criInitializeCount >= 3) + { + return result; + } + return _criDelayTime / 10; + } + + public CriAtomSource GetBgmSource(int bgmId) + { + return _bgm[bgmId]; + } + + public int GetBgmMaxCount() + { + return _bgmSourceCount; + } + + public void VolumeUpdate_Bgm(int level, bool mute, int bgmId = -1) + { + if (bgmId < 0) + { + int num = _bgm.Length; + for (int i = 0; i < num; i++) + { + Volume_Bgm((float)level * 0.1f, mute, i); + } + } + else + { + Volume_Bgm((float)level * 0.1f, mute, bgmId); + } + } + + public void Volume_Bgm(float level, bool mute, int bgmId = -1) + { + if (mute) + { + level = 0f; + } + if (bgmId < 0) + { + int num = _bgm.Length; + for (int i = 0; i < num; i++) + { + _bgm[i].volume = level; + _bgm[i].player.Update(_bgmPlayback); + } + } + else + { + _bgm[bgmId].volume = level; + _bgm[bgmId].player.Update(_bgmPlayback); + } + } + + public bool IsPlayBgm(int bgmId = 0) + { + if (_bgm[bgmId].status == CriAtomSource.Status.Prep || _bgm[bgmId].status == CriAtomSource.Status.Playing) + { + return true; + } + return false; + } + + public int PlayBgmFromName(string cueSheet, string cueName, string acbName, string awbName = "", int bgmId = 0, bool loop = true, float FadeInfime = 0f, float OffsetTime = 0f, long startTime = 0L) + { + if (_bgmName == cueName) + { + return -1; + } + string acbFile = ""; + string awbname = ""; + if (acbName.CompareTo("") != 0) + { + acbFile = acbName + ".acb"; + } + if (awbName.CompareTo("") != 0) + { + awbname = awbName + ".awb"; + } + if (AddCueSheet(cueSheet, acbFile, "b/", awbname)) + { + StopBgm(bgmId); + _bgm[bgmId].cueSheet = cueSheet; + _bgm[bgmId].cueName = cueName; + _bgm[bgmId].player.ResetFaderParameters(); + _bgm[bgmId].player.SetStartTime(startTime); + _bgm[bgmId].player.SetFadeInTime((int)(FadeInfime * 1000f)); + _bgm[bgmId].player.SetFadeInStartOffset((int)(OffsetTime * 1000f)); + _bgm[bgmId].loop = loop; + _bgmPlayback = _bgm[bgmId].Play(); + _bgmName = cueName; + return 0; + } + return -1; + } + + public int PlayBgmFromId(string cueSheet, int cueId, int bgmId = 0, bool loop = true, float FadeInfime = 0f, float OffsetTime = 0f, long startTime = 0L) + { + if (_bgmCue == cueSheet && cueId == _cueId) + { + return -1; + } + if (CriAtom.GetCueSheet(cueSheet) != null) + { + StopBgm(bgmId); + _bgm[bgmId].cueSheet = cueSheet; + _bgm[bgmId].player.ResetFaderParameters(); + _bgm[bgmId].player.SetStartTime(startTime); + _bgm[bgmId].player.SetFadeInTime((int)(FadeInfime * 1000f)); + _bgm[bgmId].player.SetFadeInStartOffset((int)(OffsetTime * 1000f)); + _bgm[bgmId].loop = loop; + _bgmPlayback = _bgm[bgmId].Play(cueId); + _cueId = cueId; + _bgmCue = ""; + return 1; + } + return 0; + } + + public void StopBgm(int bgmId = 0) + { + _bgmName = ""; + _bgm[bgmId].Stop(); + } + + public void PauseBgm(bool isPause, int bgmId = 0) + { + _bgm[bgmId].Pause(isPause); + } + + public void StopFadeBgm(int bgmId = 0, float time = 0.5f) + { + _bgm[bgmId].player.SetFadeOutTime((int)(time * 1000f)); + StopBgm(bgmId); + } + + public void SetBgmVolume(float volume) + { + GameMgr.GetIns().GetSoundMgr().SetBgmVolume(volume); + } + + public void StartCoroutine_DelayMethod(float waitTime, Action process) + { + StartCoroutine(Timer.DelayMethod(waitTime, process)); + } + + public void VolumeUpdate_Se(int level, bool mute) + { + Volume_Se((float)level * 0.1f, mute); + } + + public void Volume_Se(float level, bool mute) + { + if (mute) + { + level = 0f; + } + for (int i = 0; i < _seSourceCount; i++) + { + _se[i].volume = level; + } + } + + public int PlaySeFromId(ref SoundData seData, bool loop = false) + { + int index = -1; + CriAtomSource criAtomSource = FindSe(ref seData, out index); + if (criAtomSource != null) + { + criAtomSource.cueSheet = seData._acbName; + criAtomSource.loop = loop; + CriAtomExPlayer player = criAtomSource.player; + player.ResetFaderParameters(); + player.SetFadeOutTime(0); + criAtomSource.Play(seData._cueName); + return index; + } + return index; + } + + public int PlaySeFromId(string cueName, int cueId, bool loop = false) + { + if (!IsAvailableCueSheet(cueName)) + { + return -1; + } + for (int i = 0; i < _seSourceCount; i++) + { + if (_se[i].status == CriAtomSource.Status.PlayEnd) + { + _se[i].Stop(); + } + if (_se[i].status == CriAtomSource.Status.Stop) + { + _se[i].cueSheet = cueName; + _se[i].loop = loop; + _se[i].Play(cueId); + return i; + } + } + return -1; + } + + private CriAtomSource FindSe(ref SoundData seData, out int index) + { + index = -1; + if (_noSeMode) + { + return null; + } + if (!IsAvailableCueSheet(seData._acbName)) + { + Debug.LogError($"No Include Acb!!!:{seData._acbName},{seData._cueName}"); + return null; + } + for (int i = 0; i < _seSourceCount; i++) + { + if (_se[i].status == CriAtomSource.Status.PlayEnd) + { + _se[i].Stop(); + } + if (_se[i].status == CriAtomSource.Status.Stop) + { + index = i; + return _se[i]; + } + } + return null; + } + + public int PlaySe(string cueName, int cueId, bool loop = false) + { + if (!IsAvailableCueSheet(cueName)) + { + return -1; + } + for (int i = 0; i < _seSourceCount; i++) + { + if (_se[i].status == CriAtomSource.Status.PlayEnd) + { + _se[i].Stop(); + } + if (_se[i].status == CriAtomSource.Status.Stop) + { + _se[i].cueSheet = cueName; + _se[i].loop = loop; + _se[i].Play(cueId); + return i; + } + } + return -1; + } + + public void StopSe(int index, float fadeout = 500f) + { + if (index >= 0 && index < _seSourceCount) + { + ResumeSe(index); + _se[index].player.SetFadeOutTime((int)(fadeout * 1000f)); + _se[index].Stop(); + } + } + + public void StopSe(string cuename, float fadeout = 500f) + { + for (int i = 0; i < _se.Length; i++) + { + if (_se[i].cueName.CompareTo(cuename) == 0) + { + ResumeSe(i); + _se[i].player.SetFadeOutTime((int)(fadeout * 1000f)); + _se[i].Stop(); + } + } + } + + public void StopSeAll(float fadeout = 500f) + { + for (int i = 0; i < _seSourceCount; i++) + { + StopSe(i, fadeout); + } + } + + public void PauseSe(int index) + { + if (index >= 0 && index < _seSourceCount && (_se[index].status == CriAtomSource.Status.Playing || _se[index].status == CriAtomSource.Status.Prep)) + { + _se[index].Pause(sw: true); + } + } + + public void ResumeSe(int index) + { + if (index >= 0 && index < _seSourceCount && _se[index].status == CriAtomSource.Status.Playing) + { + _se[index].Pause(sw: false); + } + } + + public bool IsPlaySe(string cueName, int cueId) + { + for (int i = 0; i < _seSourceCount; i++) + { + if (_playingSe[i]._cueName == cueName && _playingSe[i]._cueId == cueId && (_se[i].status == CriAtomSource.Status.Prep || _se[i].status == CriAtomSource.Status.Playing)) + { + return true; + } + } + return false; + } + + public bool IsPlaySe(string cueSheetName, string cueName, out int number) + { + number = 0; + for (int i = 0; i < _seSourceCount; i++) + { + if (_playingSe[i]._acbName == cueSheetName && _playingSe[i]._cueName == cueName && _se[i].status == CriAtomSource.Status.Playing) + { + number++; + } + } + if (number > 0) + { + return true; + } + return false; + } + + public bool IsPrepSe(string cueSheetName, string cueName, out int number) + { + number = 0; + for (int i = 0; i < _seSourceCount; i++) + { + if (_playingSe[i]._acbName == cueSheetName && _playingSe[i]._cueName == cueName && _se[i].status == CriAtomSource.Status.Prep) + { + number++; + } + } + if (number > 0) + { + return true; + } + return false; + } + + public void ResetSe() + { + for (int i = 0; i < _seSourceCount; i++) + { + _se[i].Stop(); + _se[i].Pause(sw: false); + } + } + + public bool IsPlaySe(int index) + { + if (_se[index].status == CriAtomSource.Status.Prep || _se[index].status == CriAtomSource.Status.Playing) + { + return true; + } + return false; + } + + public void SetAisac(string cuename, string param, float num) + { + for (int i = 0; i < _se.Length; i++) + { + if (_se[i].cueName.CompareTo(cuename) == 0) + { + _se[i].SetAisacControl(param, num); + } + } + } + + public int PlaySeFromName(string acbName, string seName, bool loop = false, float fadeInfime = 0f, long startTime = 0L) + { + if (!IsAvailableCueSheet(acbName)) + { + return -1; + } + for (int i = 0; i < _seSourceCount; i++) + { + if (_se[i].status == CriAtomSource.Status.PlayEnd) + { + _se[i].Stop(); + } + if (_se[i].status == CriAtomSource.Status.Stop) + { + _se[i].cueSheet = acbName; + _se[i].cueName = seName; + _se[i].loop = loop; + _se[i].player.ResetFaderParameters(); + _se[i].player.SetStartTime(startTime); + _se[i].player.SetFadeInTime((int)(fadeInfime * 1000f)); + _se[i].Play(seName); + return i; + } + } + return -1; + } + + public int GetVoiceSourceCount() + { + return _voiceSourceCount; + } + + public void VolumeUpdate_Voice(int level, bool mute, int voiceId = -1) + { + Volume_Voice((float)level * 0.1f, mute, voiceId); + } + + public void Volume_Voice(float level, bool mute, int voiceId = -1) + { + if (mute) + { + level = 0f; + } + if (voiceId < 0) + { + int num = _voice.Length; + for (int i = 0; i < num; i++) + { + _voice[i].volume = level; + } + } + else + { + _voice[voiceId].volume = level; + } + } + + public bool IsPlayVoice(int index) + { + if (_voice[index].status == CriAtomSource.Status.Prep || _voice[index].status == CriAtomSource.Status.Playing) + { + return true; + } + return false; + } + + public void PlayVoice(int voiceId, string acbFile, string cueSheet, string cueName) + { + AddCueSheet(cueSheet, acbFile, "v/"); + _voice[voiceId].Play(cueName); + } + + public void PlayVoice(int voiceId, string cueName) + { + _voice[voiceId].Play(cueName); + } + + public void StopVoice(int voiceId, float fadetout = 500f) + { + CriAtomSource criAtomSource = _voice[voiceId]; + if (criAtomSource != null && criAtomSource.player != null) + { + criAtomSource.player.SetFadeOutTime((int)(fadetout * 1000f)); + criAtomSource.Stop(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/BootNetwork.cs b/SVSim.BattleEngine/Engine/Cute/BootNetwork.cs new file mode 100644 index 0000000..e1275ec --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/BootNetwork.cs @@ -0,0 +1,93 @@ +using System.Collections; +using UnityEngine; +using Wizard; + +namespace Cute; + +public class BootNetwork : MonoBehaviour +{ + public bool _autoSetup; + + public static bool IsDoneLanguageSetting; + + public bool IsDoneGameStartCheck { get; set; } + + private void Awake() + { + Object.DontDestroyOnLoad(base.gameObject); + } + + private IEnumerator Start() + { + while (Toolbox.BootSystem == null) + { + yield return 0; + } + while (Toolbox.NetworkManager == null) + { + yield return 0; + } + Toolbox.BootNetwork = this; + if (_autoSetup) + { + SetupNetwork(); + } + SetupNetworkLanguage(); + while (!IsDoneLanguageSetting) + { + yield return 0; + } + } + + private void OnDestroy() + { + } + + public void SetupNetwork() + { + if (!IsDoneGameStartCheck) + { + StartCoroutine(SetupNetworkCoroutine()); + } + } + + public void SetupNetworkLanguage() + { + string text = Toolbox.SavedataManager.GetString("LANG_SETTING"); + if (text == "Jpn") + { + Toolbox.SavedataManager.DeleteKey("LANG_SETTING"); + Toolbox.SavedataManager.DeleteKey("LANG_SOUND_SETTING"); + text = ""; + Toolbox.AssetManager.ClearAllAssetFile(); + Toolbox.AssetManager.ClearAssetCacheAssetBundle(); + } + if (string.IsNullOrEmpty(text)) + { + CustomPreference.SetScemeMode(CustomPreference.eSchemeType.Https); + CustomPreference.SetApplicationServerURL("utoongaize.shadowverse.jp/shadowverse/"); + } + else + { + IsDoneLanguageSetting = true; + } + } + + private IEnumerator SetupNetworkCoroutine() + { + if (!IsDoneGameStartCheck) + { + yield return StartCoroutine(Toolbox.NetworkManager._certification.Login()); + } + } + + public IEnumerator SetupNetworkCertification() + { + SetupNetwork(); + while (!IsDoneGameStartCheck) + { + yield return 0; + } + yield return StartCoroutine(Toolbox.AssetManager.InitializeManifest(null, Data.Load.data._userTutorial.tutorial_step != 100)); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/BootSystem.cs b/SVSim.BattleEngine/Engine/Cute/BootSystem.cs new file mode 100644 index 0000000..9bb024c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/BootSystem.cs @@ -0,0 +1,145 @@ +#define STEAM +using System; +using System.Collections; +using System.Diagnostics; +using com.adjust.sdk; +using RedShellUnity; +using Steamworks; +using UnityEngine; +using Wizard; + +namespace Cute; + +public class BootSystem : MonoBehaviour +{ + [SerializeField] + [Tooltip("ใƒใ‚งใƒƒใ‚ฏใ™ใ‚‹ใจMaxFramerateใŒๆœ‰ๅŠน")] + private bool _dontVsync; + + [SerializeField] + [Range(0f, 60f)] + private int _maxFramerate; + + public static bool isRootBootCamera; + + private Coroutine _logCoroutine; + + private string _logMsg = ""; + + private void Awake() + { + _logMsg += "Awake"; + if (isRootBootCamera) + { + UnityEngine.Object.Destroy(GameObject.Find("BootCamera")); + isRootBootCamera = false; + } + VisibleBootCamera(enable: true); + UnityEngine.Object.DontDestroyOnLoad(base.gameObject); + } + + private IEnumerator Start() + { + _logCoroutine = StartCoroutine(WaitToAccumulateTraceLog()); + _logMsg += " Start"; + while (Toolbox.DeviceManager == null) + { + yield return 0; + } + _logMsg += " DeviceManager"; + while (Toolbox.SavedataManager == null) + { + yield return 0; + } + _logMsg += " SavedataManager"; + while (Toolbox.QualityManager == null) + { + yield return 0; + } + _logMsg += " QualityManager"; + while (Toolbox.SceneManager == null) + { + yield return 0; + } + _logMsg += " SceneManager"; + while (Toolbox.ResourcesManager == null) + { + yield return 0; + } + _logMsg += " ResourcesManager"; + while (Toolbox.AssetManager == null) + { + yield return 0; + } + _logMsg += " AssetManager"; + while (Toolbox.AudioManager == null) + { + yield return 0; + } + _logMsg += " AudioManager"; + while (Toolbox.MovieManager == null) + { + yield return 0; + } + _logMsg += " MovieManager"; + SocialServiceUtility.CreateInstance(); + bootAdjust(); + setupRedShell(); + if (_dontVsync) + { + QualitySettings.vSyncCount = 0; + Application.targetFrameRate = _maxFramerate; + } + StopCoroutine(_logCoroutine); + Toolbox.BootSystem = this; + } + + private IEnumerator WaitToAccumulateTraceLog() + { + yield return new WaitForSeconds(5f); + LocalLog.AccumulateTraceInquiryLog("BootSystem " + _logMsg); + } + + private void bootAdjust() + { + try + { + } + catch (Exception ex) + { + LocalLog.AccumulateTraceLog(ex.ToString()); + } + Adjust.addSessionCallbackParameter("viewer_id", Certification.ViewerId.ToString()); + } + + private void OnDestroy() + { + } + + public void VisibleBootCamera(bool enable) + { + GameObject gameObject = base.transform.Find("BootCamera").gameObject; + if (gameObject != null) + { + gameObject.SetActive(enable); + } + } + + [Conditional("STEAM")] + private void setupRedShell() + { + RedShell.SetVerboseLogs(verboseLogs: true); + RedShell.SetApiKey("04b8d4a58416140132fdcd680b17a0d8"); + try + { + RedShell.SetUserId(SteamUser.GetSteamID().m_SteamID.ToString()); + } + catch (Exception ex) + { + Debug.LogError("steam client ใŒ่ตทๅ‹•ใ—ใฆใ„ใชใ„ใ€‚steamใฎๆฉŸ่ƒฝใ‚’ไฝฟใˆใพใ›ใ‚“ใ€‚"); + Debug.LogError(ex.Message); + Debug.LogError(ex.StackTrace); + } + RedShell.MarkConversion(); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/CryptAES.cs b/SVSim.BattleEngine/Engine/Cute/CryptAES.cs new file mode 100644 index 0000000..7f2fafb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/CryptAES.cs @@ -0,0 +1,248 @@ +using System; +using System.IO; +using System.Security.Cryptography; +using System.Text; + +namespace Cute; + +public class CryptAES +{ + public static byte[] encrypt(byte[] byteSrc) + { + return EncryptRJ256Api(byteSrc); + } + + public static string encrypt(string byteSrc) + { + return Convert.ToBase64String(EncryptRJ256Api(Encoding.UTF8.GetBytes(byteSrc))); + } + + public static string encryptForNode(string src) + { + return EncryptRJ256ForNode(src); + } + + public static byte[] decrypt(string src) + { + return DecryptRJ256Api(Convert.FromBase64String(src)); + } + + public static string decryptForNode(string src) + { + return DecryptRJ256ForNode(src); + } + + private static byte[] EncryptRJ256Api(byte[] toEncryptData) + { + using RijndaelManaged rijndaelManaged = new RijndaelManaged(); + rijndaelManaged.Mode = CipherMode.CBC; + rijndaelManaged.KeySize = 256; + rijndaelManaged.BlockSize = 128; + byte[] array = new byte[0]; + byte[] array2 = new byte[0]; + string s = Cryptographer.generateKeyString(); + string s2 = Certification.Udid.Replace("-", "").Substring(0, 16); + array = Encoding.UTF8.GetBytes(s); + array2 = Encoding.UTF8.GetBytes(s2); + ICryptoTransform transform = rijndaelManaged.CreateEncryptor(array, array2); + using MemoryStream memoryStream = new MemoryStream(); + using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write); + cryptoStream.Write(toEncryptData, 0, toEncryptData.Length); + cryptoStream.FlushFinalBlock(); + byte[] array3 = memoryStream.ToArray(); + byte[] array4 = new byte[array3.Length + array.Length]; + Array.Copy(array3, 0, array4, 0, array3.Length); + Array.Copy(array, 0, array4, array3.Length, array.Length); + rijndaelManaged.Clear(); + memoryStream.Flush(); + memoryStream.Close(); + cryptoStream.Flush(); + cryptoStream.Close(); + return array4; + } + + public static string EncryptRJ256(string prm_text_to_encrypt) + { + using RijndaelManaged rijndaelManaged = new RijndaelManaged(); + rijndaelManaged.Padding = PaddingMode.Zeros; + rijndaelManaged.Mode = CipherMode.CBC; + rijndaelManaged.KeySize = 256; + rijndaelManaged.BlockSize = 256; + byte[] array = new byte[0]; + byte[] array2 = new byte[0]; + string s = Cryptographer.generateKeyString(); + string s2 = Certification.Udid.Replace("-", ""); + array = Encoding.UTF8.GetBytes(s); + array2 = Encoding.UTF8.GetBytes(s2); + ICryptoTransform transform = rijndaelManaged.CreateEncryptor(array, array2); + using MemoryStream memoryStream = new MemoryStream(); + using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write); + byte[] bytes = Encoding.UTF8.GetBytes(prm_text_to_encrypt); + cryptoStream.Write(bytes, 0, bytes.Length); + cryptoStream.FlushFinalBlock(); + byte[] array3 = memoryStream.ToArray(); + byte[] array4 = new byte[array3.Length + array.Length]; + Array.Copy(array3, 0, array4, 0, array3.Length); + Array.Copy(array, 0, array4, array3.Length, array.Length); + rijndaelManaged.Clear(); + memoryStream.Flush(); + memoryStream.Close(); + cryptoStream.Flush(); + cryptoStream.Close(); + return Convert.ToBase64String(array4); + } + + public static string EncryptRJ256ForNode(string prm_text_to_encrypt) + { + using AesManaged aesManaged = new AesManaged(); + string text = Cryptographer.generateKeyString(); + string s = text.Substring(0, 16); + aesManaged.BlockSize = 128; + aesManaged.KeySize = 256; + aesManaged.IV = Encoding.UTF8.GetBytes(s); + aesManaged.Key = Encoding.UTF8.GetBytes(text); + aesManaged.Mode = CipherMode.CBC; + aesManaged.Padding = PaddingMode.PKCS7; + byte[] bytes = Encoding.UTF8.GetBytes(prm_text_to_encrypt); + using ICryptoTransform cryptoTransform = aesManaged.CreateEncryptor(); + byte[] inArray = cryptoTransform.TransformFinalBlock(bytes, 0, bytes.Length); + aesManaged.Clear(); + return text + Convert.ToBase64String(inArray); + } + + private static byte[] DecryptRJ256Api(byte[] sEncryptedString) + { + using RijndaelManaged rijndaelManaged = new RijndaelManaged(); + rijndaelManaged.Mode = CipherMode.CBC; + rijndaelManaged.KeySize = 256; + rijndaelManaged.BlockSize = 128; + byte[] array = new byte[32]; + byte[] array2 = new byte[16]; + byte[] array3 = new byte[sEncryptedString.Length - array.Length]; + Array.Copy(sEncryptedString, 0, array3, 0, array3.Length); + Array.Copy(sEncryptedString, sEncryptedString.Length - array.Length, array, 0, array.Length); + array2 = Encoding.UTF8.GetBytes(Certification.Udid.Replace("-", "").Substring(0, 16)); + ICryptoTransform transform = rijndaelManaged.CreateDecryptor(array, array2); + byte[] array4 = new byte[array3.Length]; + using MemoryStream memoryStream = new MemoryStream(array3); + using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Read); + cryptoStream.Read(array4, 0, array4.Length); + rijndaelManaged.Clear(); + cryptoStream.Flush(); + cryptoStream.Close(); + memoryStream.Flush(); + memoryStream.Close(); + return array4; + } + + public static string DecryptRJ256(string prm_text_to_decrypt) + { + byte[] array = Convert.FromBase64String(prm_text_to_decrypt); + using RijndaelManaged rijndaelManaged = new RijndaelManaged(); + rijndaelManaged.Padding = PaddingMode.Zeros; + rijndaelManaged.Mode = CipherMode.CBC; + rijndaelManaged.KeySize = 256; + rijndaelManaged.BlockSize = 256; + byte[] array2 = new byte[32]; + byte[] array3 = new byte[32]; + byte[] array4 = new byte[array.Length - array2.Length]; + Array.Copy(array, 0, array4, 0, array4.Length); + Array.Copy(array, array.Length - array2.Length, array2, 0, array2.Length); + array3 = Encoding.UTF8.GetBytes(Certification.Udid.Replace("-", "")); + ICryptoTransform transform = rijndaelManaged.CreateDecryptor(array2, array3); + byte[] array5 = new byte[array4.Length]; + using MemoryStream memoryStream = new MemoryStream(array4); + using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Read); + cryptoStream.Read(array5, 0, array5.Length); + rijndaelManaged.Clear(); + cryptoStream.Flush(); + cryptoStream.Close(); + memoryStream.Flush(); + memoryStream.Close(); + return Encoding.UTF8.GetString(array5).TrimEnd(default(char)); + } + + public static string DecryptRJ256ForNode(string prm_text_to_decrypt) + { + using AesManaged aesManaged = new AesManaged(); + string text = prm_text_to_decrypt.Substring(0, 32); + string s = text.Substring(0, 16); + string s2 = prm_text_to_decrypt.Substring(32); + aesManaged.BlockSize = 128; + aesManaged.KeySize = 256; + aesManaged.Key = Encoding.UTF8.GetBytes(text); + aesManaged.IV = Encoding.UTF8.GetBytes(s); + aesManaged.Mode = CipherMode.CBC; + aesManaged.Padding = PaddingMode.PKCS7; + byte[] array = Convert.FromBase64String(s2); + using ICryptoTransform cryptoTransform = aesManaged.CreateDecryptor(); + byte[] bytes = cryptoTransform.TransformFinalBlock(array, 0, array.Length); + string result = Encoding.UTF8.GetString(bytes); + aesManaged.Clear(); + return result; + } + + public static byte[] EncryptRJ256(byte[] binData) + { + using RijndaelManaged rijndaelManaged = new RijndaelManaged(); + rijndaelManaged.Padding = PaddingMode.PKCS7; + rijndaelManaged.Mode = CipherMode.CBC; + rijndaelManaged.KeySize = 256; + rijndaelManaged.BlockSize = 256; + byte[] array = new byte[0]; + byte[] array2 = new byte[0]; + string s = Cryptographer.generateKeyString(); + string s2 = Certification.Udid.Replace("-", ""); + array = Encoding.UTF8.GetBytes(s); + array2 = Encoding.UTF8.GetBytes(s2); + ICryptoTransform transform = rijndaelManaged.CreateEncryptor(array, array2); + using MemoryStream memoryStream = new MemoryStream(); + using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write); + byte[] bytes = BitConverter.GetBytes(binData.Length); + byte[] array3 = new byte[4 + binData.Length]; + Array.Copy(bytes, 0, array3, 0, 4); + Array.Copy(binData, 0, array3, 4, binData.Length); + cryptoStream.Write(array3, 0, array3.Length); + cryptoStream.FlushFinalBlock(); + byte[] array4 = memoryStream.ToArray(); + byte[] array5 = new byte[array.Length + array4.Length]; + Array.Copy(array4, 0, array5, 0, array4.Length); + Array.Copy(array, 0, array5, array4.Length, array.Length); + rijndaelManaged.Clear(); + memoryStream.Flush(); + memoryStream.Close(); + cryptoStream.Flush(); + cryptoStream.Close(); + return array5; + } + + public static byte[] DecryptRJ256(byte[] binData) + { + using RijndaelManaged rijndaelManaged = new RijndaelManaged(); + rijndaelManaged.Padding = PaddingMode.PKCS7; + rijndaelManaged.Mode = CipherMode.CBC; + rijndaelManaged.KeySize = 256; + rijndaelManaged.BlockSize = 256; + byte[] array = new byte[32]; + byte[] array2 = new byte[32]; + byte[] array3 = new byte[binData.Length - array.Length]; + Array.Copy(binData, 0, array3, 0, array3.Length); + Array.Copy(binData, binData.Length - array.Length, array, 0, array.Length); + array2 = Encoding.UTF8.GetBytes(Certification.Udid.Replace("-", "")); + ICryptoTransform transform = rijndaelManaged.CreateDecryptor(array, array2); + byte[] array4 = new byte[array3.Length]; + using MemoryStream memoryStream = new MemoryStream(array3); + using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Read); + cryptoStream.Read(array4, 0, array4.Length); + byte[] array5 = new byte[4]; + Array.Copy(array4, 0, array5, 0, 4); + byte[] array6 = new byte[BitConverter.ToInt32(array5, 0)]; + Array.Copy(array4, 4, array6, 0, array6.Length); + rijndaelManaged.Clear(); + memoryStream.Flush(); + memoryStream.Close(); + cryptoStream.Flush(); + cryptoStream.Close(); + return array6; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/Cryptographer.cs b/SVSim.BattleEngine/Engine/Cute/Cryptographer.cs new file mode 100644 index 0000000..5df1daf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/Cryptographer.cs @@ -0,0 +1,144 @@ +using System; +using System.Globalization; +using System.Security.Cryptography; +using System.Text; + +namespace Cute; + +public class Cryptographer +{ + public const int FBENCRYPT_BLOCK_SIZE = 32; + + private static string encode_buf; + + private static Random cRandom = new Random(); + + private static SHA1CryptoServiceProvider sha1 = null; + + private static UTF8Encoding utf8 = null; + + private static int random() + { + return cRandom.Next(1, 9); + } + + public static string generateIvString() + { + string text = ""; + for (int i = 0; i < 32; i++) + { + text += $"{random()}"; + } + return text; + } + + public static string generateKeyString() + { + string text = ""; + for (int i = 0; i < 32; i++) + { + text += $"{cRandom.Next(0, 65535):x}"; + } + return Convert.ToBase64String(Encoding.ASCII.GetBytes(text.ToString())).Substring(0, 32); + } + + public static string encode(string dat) + { + int length = dat.Length; + encode_buf = $"{length:x4}"; + foreach (char value in dat) + { + encode_buf += $"{random(),1:x}"; + encode_buf += $"{random(),1:x}"; + encode_buf += (char)(Convert.ToInt32(value) + 10); + encode_buf += $"{random(),1:x}"; + } + encode_buf += generateIvString(); + return encode_buf; + } + + public static string decode(string dat) + { + if (dat == null || dat.Length < 4) + { + return dat; + } + int num = int.Parse(dat.Substring(0, 4), NumberStyles.AllowHexSpecifier); + string text = ""; + int num2 = 2; + string text2 = dat.Substring(4, dat.Length - 4); + foreach (char value in text2) + { + if (num2 % 4 == 0) + { + text += (char)(Convert.ToInt32(value) - 10); + } + num2++; + if (text.Length >= num) + { + break; + } + } + return text; + } + + public static string ComputeHash(string data) + { + if (string.IsNullOrEmpty(data)) + { + return null; + } + SHA1CryptoServiceProvider sHA1CryptoServiceProvider = new SHA1CryptoServiceProvider(); + byte[] bytes = Encoding.UTF8.GetBytes(data); + byte[] array = sHA1CryptoServiceProvider.ComputeHash(bytes); + string text = ""; + byte[] array2 = array; + foreach (byte b in array2) + { + text += $"{b:x2}"; + } + sHA1CryptoServiceProvider.Clear(); + return text; + } + + public static string MakeMd5(string input) + { + MD5CryptoServiceProvider mD5CryptoServiceProvider = new MD5CryptoServiceProvider(); + byte[] bytes = Encoding.UTF8.GetBytes(input + "r!I@ws8e5i="); + byte[] array = mD5CryptoServiceProvider.ComputeHash(bytes); + string text = ""; + byte[] array2 = array; + foreach (byte b in array2) + { + text += b.ToString("x2"); + } + mD5CryptoServiceProvider.Clear(); + return text; + } + + public static string ComputeSHA1(string seed) + { + if (sha1 == null) + { + sha1 = new SHA1CryptoServiceProvider(); + } + if (utf8 == null) + { + utf8 = new UTF8Encoding(); + } + if (string.IsNullOrEmpty(seed)) + { + return ""; + } + byte[] bytes = utf8.GetBytes(seed); + byte[] array = sha1.ComputeHash(bytes); + StringBuilder stringBuilder = new StringBuilder(); + int num = array.Length; + for (int i = 0; i < num; i++) + { + stringBuilder.Append(Convert.ToString(array[i], 16).PadLeft(2, '0')); + } + sha1.Initialize(); + return stringBuilder.ToString(); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/CustomPreference.cs b/SVSim.BattleEngine/Engine/Cute/CustomPreference.cs new file mode 100644 index 0000000..ad040e0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/CustomPreference.cs @@ -0,0 +1,318 @@ +using Wizard; + +namespace Cute; + +public class CustomPreference +{ + public enum eSchemeType + { + Http, + Https, + File, + Node, + StreamingAssets + } + + public enum PlatformType + { + NONE, + APPLE, + GOOGLE, + DMM, + STEAM + } + + public enum SmallResourceStatus + { + NO_SELECT, + USE_NORMAL, + USE_SMALL + } + + private const string fileScheme = "file:///"; + + private const string httpScheme = "http://"; + + private const string httpsScheme = "https://"; + + private const string jarFileScheme = "jar:file://"; + + private static string nodeServerScheme = "ws://"; + + private const string directoryLowLevelResources = "Low/"; + + private const string directoryHighLevelResources = "High/"; + + private static string directoryRoot = "dl/"; + + private static string _applicationServerUrl = ""; + + private static string _resourceServerUrl = ""; + + private static string _nodeServerUrl = ""; + + private static string _deckBuilderServerUrl = ""; + + public static string _localePref = "Eng"; + + private static string _signaturePref = ""; + + private static string _languagePref = "Eng"; + + private static string _languageSoundPref = "Eng"; + + private static string _assetbundleurl = ""; + + private static string _manifestsuburl = ""; + + private static string _soundurl = ""; + + private static string _movieurl = ""; + + private static string _manifestUrl = ""; + + private static eSchemeType _schemeType = eSchemeType.Http; + + private static eSchemeType _schemeCDNType = eSchemeType.Http; + + private static bool _isPreferenceComplete = false; + + private static bool _isLocalAssetBundles = false; + + public static bool isPreferenceComplete + { + get + { + return _isPreferenceComplete; + } + set + { + _isPreferenceComplete = value; + } + } + + public static bool isLocalAssetBundles + { + get + { + return _isLocalAssetBundles; + } + set + { + _isLocalAssetBundles = value; + } + } + + public static bool IsNormalResource => !IsSmallResource; + + public static bool IsSmallResource => PlayerPrefsCache.Instance.GetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS) == 2; + + public static string GetApplicationServerURL() + { + return GetScheme() + _applicationServerUrl; + } + + public static void SetApplicationServerURL(string strApplicationServer) + { + _applicationServerUrl = strApplicationServer; + } + + public static string GetResourceServerURL() + { + return GetCDNScheme() + _resourceServerUrl; + } + + public static void SetResourceServerURL(string strResourceServer) + { + _resourceServerUrl = strResourceServer; + } + + public static string GetNodeServerURL() + { + return nodeServerScheme + _nodeServerUrl; + } + + public static void SetNodeServerURL(string strNodeServer) + { + if (!string.IsNullOrEmpty(strNodeServer)) + { + _nodeServerUrl = strNodeServer; + } + } + + public static string GetDeckBuilderServerURL() + { + return GetScheme() + _deckBuilderServerUrl; + } + + public static void SetDeckBuilderServerURL(string strDeckBuilderServer) + { + _deckBuilderServerUrl = strDeckBuilderServer; + } + + public static int GetPlatform() + { + return 4; + } + + public static string GetAssetBundleURL() + { + return _assetbundleurl; + } + + public static string GetManifestURL() + { + return _manifestUrl; + } + + public static string GetSubManifestURL() + { + if (_isLocalAssetBundles) + { + _manifestsuburl = GetResourceServerURL() + Utility.GetRuntimePlatform() + "/"; + } + else + { + _manifestsuburl = GetResourceServerURL() + directoryRoot + "Manifest/" + GetVersionFolderName() + GetSoundMovieLanguageFolderName() + Utility.GetRuntimePlatform() + "/"; + } + return _manifestsuburl; + } + + public static string GetSoundResourceURL() + { + return _soundurl; + } + + public static string GetMoiveResourceURL() + { + return _movieurl; + } + + public static string GetScheme() + { + return _schemeType switch + { + eSchemeType.Http => "http://", + eSchemeType.Https => "https://", + eSchemeType.File => "file:///", + eSchemeType.Node => nodeServerScheme, + eSchemeType.StreamingAssets => "file:///", + _ => "http://", + }; + } + + public static string GetCDNScheme() + { + return _schemeCDNType switch + { + eSchemeType.Http => "http://", + eSchemeType.Https => "https://", + _ => "http://", + }; + } + + public static string GetVersionFolderName() + { + return Toolbox.SavedataManager.GetResourceVersion() + "/"; + } + + public static void SetScemeMode(eSchemeType schemeType) + { + _schemeType = schemeType; + } + + public static void SetScemeModeCDN(eSchemeType schemeCDNType) + { + _schemeCDNType = schemeCDNType; + } + + public static void SetOptionalNodeSceme() + { + if (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SELECT_WSS)) + { + SetNodeSceme("wss://"); + } + else + { + SetNodeSceme("ws://"); + } + } + + private static void SetNodeSceme(string scheme) + { + nodeServerScheme = scheme; + } + + public static void SetRootFolderName(string strDir) + { + directoryRoot = strDir; + } + + public static void SetTextLanguage(string strLanguage) + { + _languagePref = strLanguage; + } + + public static void SetLocale(string strLocale) + { + _localePref = strLocale; + } + + public static string GetLanguageFolderName() + { + return _languagePref + "/"; + } + + public static string GetTextLanguage() + { + return GetResourceLanguage(); + } + + public static string GetResourceLanguage() + { + return _languagePref; + } + + public static void SetSoundLanguage(string strLanguage) + { + _languageSoundPref = strLanguage; + } + + public static string GetSoundMovieLanguageFolderName() + { + return _languageSoundPref + "/"; + } + + public static string GetSoundMovieLanguage() + { + return _languageSoundPref; + } + + public static void SetSignature(string strSignature) + { + _signaturePref = strSignature; + } + + public static string GetSignaturePath() + { + return "/../" + _signaturePref; + } + + public static void createResourcePath() + { + if (_isLocalAssetBundles) + { + _assetbundleurl = GetResourceServerURL() + Utility.GetRuntimePlatform() + "/"; + _manifestsuburl = GetResourceServerURL() + Utility.GetRuntimePlatform() + "/"; + } + else + { + _assetbundleurl = GetResourceServerURL() + directoryRoot + "Resource/" + GetLanguageFolderName() + Utility.GetRuntimePlatform() + "/"; + string text = "Manifest/"; + _manifestsuburl = GetResourceServerURL() + directoryRoot + text + GetVersionFolderName() + GetSoundMovieLanguageFolderName() + Utility.GetRuntimePlatform() + "/"; + _manifestUrl = GetResourceServerURL() + directoryRoot + text + GetVersionFolderName() + GetLanguageFolderName() + Utility.GetRuntimePlatform() + "/"; + } + _soundurl = GetResourceServerURL() + directoryRoot + "Sound/" + GetSoundMovieLanguageFolderName(); + _movieurl = GetResourceServerURL() + directoryRoot + "Resource/" + GetSoundMovieLanguageFolderName() + Utility.GetRuntimePlatform() + "/"; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/CuteNetworkDefine.cs b/SVSim.BattleEngine/Engine/Cute/CuteNetworkDefine.cs new file mode 100644 index 0000000..6631b78 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/CuteNetworkDefine.cs @@ -0,0 +1,190 @@ +using System.Collections.Generic; + +namespace Cute; + +public static class CuteNetworkDefine +{ + public enum ApiType + { + SignUp, + GameStartCheck, + CheckSpecialTitle, + PaymentItemList, + PaymentStart, + PaymentCancel, + PaymentFinish, + PaymentSendLog, + PaymentPCItemList, + PaymentPCStart, + PaymentPCCancel, + PaymentPCFinish, + SteamGetUserInfo, + SteamMicroTxnInit, + BirthUpdate, + AccountMigration, + GetGameDataBySocialAccount, + GetTransitionCode, + TransitionCodeMigration, + GetGameDataByTransitionCode, + GetFacebookNonce, + CheckiCloudUser, + MigrateiCloudUser + } + + public enum ACCOUNT_TYPE + { + NONE, + GOOGLE_PLAY, + GAME_CENTER, + FACEBOOK, + DMM, + STEAM, + APPLE_ID + } + + public enum CONNECT_TYPE + { + SOCIAL_ACCOUNT_CONNECT = 1, + SOCIAL_ACCOUNT_DISCONNECT, + SOCIAL_ACCOUNT_GAME_DATA_UPDATE, + TRANS_CODE_GAME_DATA_UPDATE + } + + public const int API_RESULT_SUCCESS_CODE = 1; + + public const int RESULT_CODE_DATABASE_ERROR = 100; + + public const int RESULT_CODE_MAINTENANCE_COMMON = 101; + + public const int RESULT_CODE_SERVER_ERROR = 102; + + public const int API_RESULT_SESSION_ERROR = 201; + + public const int RESULT_CODE_ACCOUNT_BLOCK_ERROR = 203; + + public const int RESULT_CODE_ACCOUNT_LIMITED_BLOCK_ERROR = 217; + + public const string ACCOUNT_LIMITED_BLOCK_END_TIME = "account_block_end_time"; + + public const int RESULT_CODE_NETEASE_ACCOUNT_BLOCK_ERROR = 330; + + public const int API_RESULT_VERSION_ERROR = 204; + + public const int RESULT_CODE_PROCESSED_ERROR = 213; + + public const int RESULT_CODE_PAYMENT_VALIDATION_ERROR = 308; + + public const int RESULT_CODE_DMM_ONETIMETOKEN_EXPIRED = 317; + + public const int RESULT_CODE_SOLO_PLAY_ALREADY_FINISH = 1352; + + public const int RESULT_CODE_MAINTENANCE_FROM = 2000; + + public const int RESULT_CODE_MAINTENANCE_TO = 2999; + + public const string MAINTENACE_END_TIME = "maintenance_end_time"; + + public const int RESULT_CODE_MAINTENANCE_CARD_TWO_PICK = 1710; + + public const int RESULT_CODE_MAINTENANCE_CARD_OPEN_SIX = 5013; + + public const int RESULT_CODE_ALREADY_BATTLE_RESULT = 3502; + + public const int RC_OPEN_ROOM_SET_DECK_IN_BATTLE_PHASE = 1768; + + public static Dictionary ApiUrlList = new Dictionary + { + { + ApiType.SignUp, + "tool/signup" + }, + { + ApiType.CheckSpecialTitle, + "check/special_title" + }, + { + ApiType.GameStartCheck, + "check/game_start" + }, + { + ApiType.PaymentItemList, + "payment/item_list" + }, + { + ApiType.PaymentStart, + "payment/start" + }, + { + ApiType.PaymentCancel, + "payment/cancel" + }, + { + ApiType.PaymentFinish, + "payment/finish" + }, + { + ApiType.PaymentSendLog, + "payment/send_log" + }, + { + ApiType.PaymentPCItemList, + "payment_pc/item_list" + }, + { + ApiType.PaymentPCStart, + "payment_pc/start" + }, + { + ApiType.PaymentPCCancel, + "payment_pc/cancel" + }, + { + ApiType.PaymentPCFinish, + "payment_pc/finish" + }, + { + ApiType.SteamGetUserInfo, + "payment_pc/steam_get_user_info" + }, + { + ApiType.SteamMicroTxnInit, + "payment_pc/steam_micro_txn_init" + }, + { + ApiType.BirthUpdate, + "account/update_birth" + }, + { + ApiType.AccountMigration, + "account/chain_by_social_account" + }, + { + ApiType.GetGameDataBySocialAccount, + "account/get_by_social_account" + }, + { + ApiType.GetTransitionCode, + "account/publish_transition_code" + }, + { + ApiType.TransitionCodeMigration, + "account/chain_by_transition_code" + }, + { + ApiType.GetGameDataByTransitionCode, + "account/get_by_transition_code" + }, + { + ApiType.GetFacebookNonce, + "account/get_facebook_nonce" + }, + { + ApiType.CheckiCloudUser, + "account/get_by_icloud_data" + }, + { + ApiType.MigrateiCloudUser, + "account/chain_by_icloud_data" + } + }; +} diff --git a/SVSim.BattleEngine/Engine/Cute/DebugManager.cs b/SVSim.BattleEngine/Engine/Cute/DebugManager.cs new file mode 100644 index 0000000..7b687b2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/DebugManager.cs @@ -0,0 +1,102 @@ +using System; +using System.Diagnostics; +using UnityEngine; + +namespace Cute; + +public class DebugManager : MonoBehaviour +{ + public enum LOG_LEVEL + { + NORMAL, + HIGH, + VERY_HIGH, + VERY_HIGH2, + VERY_HIGH3, + VERY_HIGH4 + } + + [Conditional("USE_DBGSYS")] + public void Log(string text) + { + } + + [Conditional("USE_DBGSYS")] + public void LogWarning(string text) + { + } + + [Conditional("USE_DBGSYS")] + public void LogAppend(string text) + { + } + + [Conditional("USE_DBGSYS")] + public void LogAppendWarning(string text) + { + } + + public void ClearLog() + { + } + + [Conditional("USE_DBGSYS")] + public void TextLog(string text) + { + } + + [Conditional("USE_DBGSYS")] + public void SoundLog(string text) + { + } + + [Conditional("USE_DBGSYS")] + public void SoundLogWarning(string text) + { + } + + [Conditional("USE_DBGSYS")] + public void SoundLogAppend(string text) + { + } + + [Conditional("USE_DBGSYS")] + public void SoundLogAppendWarning(string text) + { + } + + [Conditional("USE_DBGSYS")] + public void ClearSoundLog() + { + } + + [Conditional("USE_DBGSYS")] + public void BattleLogAppend(string text) + { + } + + [Conditional("USE_DBGSYS")] + public void BattleLogAppendWarning(string text) + { + } + + [Conditional("USE_DBGSYS")] + public void ClearBattleLog() + { + } + + [Conditional("USE_DBGSYS")] + public void Log(object log, LOG_LEVEL level) + { + } + + [Conditional("USE_DBGSYS")] + public void LogError(object log) + { + } + + [Conditional("USE_DBGSYS")] + public void LogException(Exception e) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/DeviceManager.cs b/SVSim.BattleEngine/Engine/Cute/DeviceManager.cs new file mode 100644 index 0000000..5ffb492 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/DeviceManager.cs @@ -0,0 +1,284 @@ +using System; +using System.Collections; +using System.IO; +using System.Net; +using System.Net.NetworkInformation; +using System.Net.Sockets; +using System.Text; +using System.Xml; +using UnityEngine; +using Wizard; + +namespace Cute; + +public class DeviceManager : MonoBehaviour, IManager +{ + public enum TextureCompression + { + ETC, + DXT, + ATC, + PVRTC + } + + public enum DeviceType + { + NONE, + IPHONE, + ANDROID, + WINDOWS, + OSX + } + + private const string BUILDPARAMFILE = "/CuteBuildParam.xml"; + + private string strBuildVersionName = "9.9.9"; + + private TextureCompression textureCommpression; + + private IPAddress _ipAddress; + + private string _winOsVersion; + + private bool tokenSent; + + private string _getIpAddressWithFamilyTypeLog = ""; + + private void Awake() + { + CheckTextureCompression(); + } + + private void Start() + { + SetBuildVersionName(); + Toolbox.DeviceManager = this; + } + + private void Update() + { + } + + private void OnDestroy() + { + } + + public TextureCompression GetTextureCompression() + { + return textureCommpression; + } + + private void CheckTextureCompression() + { + textureCommpression = TextureCompression.DXT; + } + + public string GetModelName() + { + return SystemInfo.deviceModel; + } + + public string GetOsVersion() + { + if (string.IsNullOrEmpty(_winOsVersion)) + { + try + { + string operatingSystem = SystemInfo.operatingSystem; + string value = Environment.OSVersion.Version.ToString(); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.Append(operatingSystem.Substring(0, operatingSystem.IndexOf('(') + 1)); + stringBuilder.Append(value); + stringBuilder.Append(operatingSystem.Substring(operatingSystem.IndexOf(')'))); + _winOsVersion = stringBuilder.ToString(); + } + catch (Exception) + { + _winOsVersion = SystemInfo.operatingSystem; + } + } + return _winOsVersion; + } + + public int GetDeviceType() + { + return 3; + } + + public string GetAppVersionName() + { + return strBuildVersionName; + } + + public string GetLocale() + { + return CustomPreference._localePref; + } + + public string getSignature() + { + return ""; + } + + public bool isRootUser() + { + return false; + } + + public string GetDeviceUniqueIdentifier() + { + string text = ""; + text = SystemInfo.deviceUniqueIdentifier; + if (string.IsNullOrEmpty(text)) + { + text = ""; + } + return text; + } + + public string GetDeviceName() + { + return SystemInfo.deviceModel; + } + + public string GetGraphicsDeviceName(bool textureCheck = false) + { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.Append(SystemInfo.graphicsDeviceName); + if (textureCheck) + { + if (SystemInfo.SupportsTextureFormat(TextureFormat.ETC2_RGB) && SystemInfo.SupportsTextureFormat(TextureFormat.ETC2_RGBA8)) + { + stringBuilder.Append("[ETC2=1]"); + } + else + { + stringBuilder.Append("[ETC2=0]"); + } + if (SystemInfo.SupportsTextureFormat(TextureFormat.ASTC_6x6) && SystemInfo.SupportsTextureFormat(TextureFormat.ASTC_6x6)) + { + stringBuilder.Append("[ASTC=1]"); + } + else + { + stringBuilder.Append("[ASTC=0]"); + } + } + return stringBuilder.ToString(); + } + + private IPAddress GetIpAddressWithFamilyType(AddressFamily family = AddressFamily.InterNetwork) + { + _getIpAddressWithFamilyTypeLog = ""; + _getIpAddressWithFamilyTypeLog += "GetIpAddressWithFamilyType "; + if (family == AddressFamily.InterNetworkV6 && !Socket.OSSupportsIPv6) + { + return null; + } + UnicastIPAddressInformation unicastIPAddressInformation = null; + NetworkInterface[] allNetworkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); + _getIpAddressWithFamilyTypeLog += "GetIpAddressWithFamilyType2 "; + NetworkInterface[] array = allNetworkInterfaces; + foreach (NetworkInterface networkInterface in array) + { + if (networkInterface.OperationalStatus != OperationalStatus.Up) + { + _getIpAddressWithFamilyTypeLog = _getIpAddressWithFamilyTypeLog + " OperationalStatus" + networkInterface.OperationalStatus; + continue; + } + NetworkInterfaceType networkInterfaceType = networkInterface.NetworkInterfaceType; + if (networkInterfaceType != NetworkInterfaceType.Wireless80211 && networkInterfaceType != NetworkInterfaceType.Ethernet) + { + _getIpAddressWithFamilyTypeLog = _getIpAddressWithFamilyTypeLog + " Type " + networkInterfaceType; + continue; + } + IPInterfaceProperties iPProperties = networkInterface.GetIPProperties(); + if (iPProperties.GatewayAddresses.Count == 0) + { + _getIpAddressWithFamilyTypeLog += " GatewayAddresses.Count 0 "; + continue; + } + foreach (UnicastIPAddressInformation unicastAddress in iPProperties.UnicastAddresses) + { + if (unicastAddress.Address.AddressFamily != family) + { + continue; + } + if (IPAddress.IsLoopback(unicastAddress.Address)) + { + _getIpAddressWithFamilyTypeLog += " IsLoopback "; + continue; + } + if (!unicastAddress.IsDnsEligible) + { + if (unicastIPAddressInformation == null) + { + unicastIPAddressInformation = unicastAddress; + } + _getIpAddressWithFamilyTypeLog += " ip.IsDnsEligible "; + continue; + } + return unicastAddress.Address; + } + } + _getIpAddressWithFamilyTypeLog += "GetIpAddressWithFamilyType3 "; + return unicastIPAddressInformation?.Address; + } + + public string GetIpAddress() + { + if (_ipAddress != null) + { + return _ipAddress.ToString(); + } + LocalLog.AccumulateTraceInquiryLog("GetIpAddress " + StackTraceUtility.ExtractStackTrace()); + _ipAddress = GetIpAddressWithFamilyType(); + if (_ipAddress == null) + { + LocalLog.AccumulateTraceInquiryLog("GetIpAddress Empty " + _getIpAddressWithFamilyTypeLog + " " + StackTraceUtility.ExtractStackTrace()); + return string.Empty; + } + return _ipAddress.ToString(); + } + + public void ClearIpAddress() + { + _ipAddress = null; + LocalLog.AccumulateTraceInquiryLog("ClearIpAddress " + StackTraceUtility.ExtractStackTrace()); + } + + public string GetCarrier() + { + return ""; + } + + public void SetVersionName() + { + SetBuildVersionName(); + } + + public void SetBuildVersionName() + { + string text = Application.streamingAssetsPath + "/CuteBuildParam.xml"; + if (!File.Exists(text)) + { + return; + } + XmlDocument xmlDocument = new XmlDocument(); + xmlDocument.Load(text); + if (xmlDocument.FirstChild == null || xmlDocument.FirstChild.NextSibling == null) + { + return; + } + IEnumerator enumerator = xmlDocument.FirstChild.NextSibling.GetEnumerator(); + while (enumerator.MoveNext()) + { + XmlNode xmlNode = (XmlNode)enumerator.Current; + if (xmlNode.Name.Equals("versionName")) + { + strBuildVersionName = xmlNode.InnerText; + break; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/GameStartCheckTask.cs b/SVSim.BattleEngine/Engine/Cute/GameStartCheckTask.cs new file mode 100644 index 0000000..505ddad --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/GameStartCheckTask.cs @@ -0,0 +1,139 @@ +using System.Collections.Generic; +using LitJson; +using UnityEngine; +using Wizard; + +namespace Cute; + +public class GameStartCheckTask : NetworkTask +{ + private class CheckParams : PostParams + { + public int app_type; + + public string campaign_data = ""; + + public string campaign_sign = ""; + + public int campaign_user; + } + + private CuteNetworkDefine.ApiType apiType = CuteNetworkDefine.ApiType.GameStartCheck; + + public static bool IsSocialAccountDataTransNotSetAndTutorialClear = false; + + public static bool IsTutorialClear = false; + + public static List IsSocialAccountDataTransSet; + + public static bool IsSetTransitionPassword; + + public static int _tosId; + + public static int _privacyPolicyId; + + public static bool HasAppliedForAccountDeletion { get; private set; } = false; + + public static string RefundUrl { get; private set; } = string.Empty; + + public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}"; + + public GameStartCheckTask() + { + if (Toolbox.BootNetwork != null) + { + Toolbox.BootNetwork.IsDoneGameStartCheck = false; + } + IsSocialAccountDataTransSet = new List(); + } + + public void SetParameter() + { + CheckParams checkParams = new CheckParams(); + if (URLScheme.AppType != 0) + { + checkParams.campaign_data = URLScheme.CampaignData; + checkParams.app_type = URLScheme.AppType; + } + checkParams.campaign_sign = Toolbox.DeviceManager.getSignature(); + int num = Random.Range(0, 100000); + if (Toolbox.DeviceManager.isRootUser()) + { + checkParams.campaign_user = 2 * num + 1; + } + else + { + checkParams.campaign_user = 2 * num; + } + base.Params = checkParams; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + IsSocialAccountDataTransNotSetAndTutorialClear = false; + IsSocialAccountDataTransSet.Clear(); + IsSetTransitionPassword = false; + RefundUrl = string.Empty; + if (base.ResponseData["data"].Keys.Contains("transition_account_data")) + { + JsonData jsonData = base.ResponseData["data"]["transition_account_data"]; + for (int i = 0; i < jsonData.Count; i++) + { + if (jsonData[i]["social_account_type"].ToInt() == 1) + { + IsSocialAccountDataTransSet.Add(CuteNetworkDefine.ACCOUNT_TYPE.GOOGLE_PLAY); + } + else if (jsonData[i]["social_account_type"].ToInt() == 2) + { + IsSocialAccountDataTransSet.Add(CuteNetworkDefine.ACCOUNT_TYPE.GAME_CENTER); + } + else if (jsonData[i]["social_account_type"].ToInt() == 3) + { + IsSocialAccountDataTransSet.Add(CuteNetworkDefine.ACCOUNT_TYPE.FACEBOOK); + } + else if (jsonData[i]["social_account_type"].ToInt() == 6) + { + IsSocialAccountDataTransSet.Add(CuteNetworkDefine.ACCOUNT_TYPE.APPLE_ID); + } + } + if (base.ResponseData["data"]["now_tutorial_step"].ToInt() == 100) + { + IsTutorialClear = true; + } + if (jsonData.Count == 0 && base.ResponseData["data"]["now_tutorial_step"].ToInt() == 100) + { + IsSocialAccountDataTransNotSetAndTutorialClear = true; + } + } + if (base.ResponseData["data"].Keys.Contains("rewrite_viewer_id")) + { + Certification.ViewerId = base.ResponseData["data"]["rewrite_viewer_id"].ToInt(); + } + if (base.ResponseData["data"].Keys.Contains("is_set_transition_password")) + { + IsSetTransitionPassword = base.ResponseData["data"]["is_set_transition_password"].ToBoolean(); + } + HasAppliedForAccountDeletion = base.ResponseData["data"].Keys.Contains("account_delete_reservation_status"); + ParseAgreementData(base.ResponseData); + if (base.ResponseData["data"].Keys.Contains("refund_url")) + { + RefundUrl = base.ResponseData["data"]["refund_url"].ToString(); + } + return num; + } + + private void ParseAgreementData(JsonData responseData) + { + PlayerStaticData._tosAgreementState = (PlayerStaticData.AgreementState)responseData["data"]["tos_state"].ToInt(); + PlayerStaticData._privacyPolicyAgreementState = (PlayerStaticData.AgreementState)responseData["data"]["policy_state"].ToInt(); + PlayerStaticData.KorAuthorityAgreementState = (PlayerStaticData.AgreementState)responseData["data"]["kor_authority_state"].ToInt(); + AcceptAgreementTask._tosId = responseData["data"]["tos_id"].ToInt(); + AcceptAgreementTask._privacyPolicyId = responseData["data"]["policy_id"].ToInt(); + AcceptAgreementTask.KorAuthorityId = responseData["data"]["kor_authority_id"].ToInt(); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/GetiCloudUserDataTask.cs b/SVSim.BattleEngine/Engine/Cute/GetiCloudUserDataTask.cs new file mode 100644 index 0000000..3429bcd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/GetiCloudUserDataTask.cs @@ -0,0 +1,77 @@ +using LitJson; +using Wizard; + +namespace Cute; + +public class GetiCloudUserDataTask : NetworkTask +{ + private class iCloudUserParams : PostParams + { + public string icloud_data = ""; + } + + public class VerifiediCloudBackupUserData + { + public int iCloudViewerId { get; set; } + + public string iCloudUserName { get; set; } = " - "; + + public string UserRankRotation { get; set; } + + public string UserRankUnlimited { get; set; } + + public bool HasUserData() + { + return iCloudViewerId != 0; + } + + public void Reset() + { + iCloudViewerId = 0; + iCloudUserName = " - "; + } + } + + private CuteNetworkDefine.ApiType apiType = CuteNetworkDefine.ApiType.CheckiCloudUser; + + public static readonly VerifiediCloudBackupUserData VerifiediCloudUserData = new VerifiediCloudBackupUserData(); + + public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}"; + + public void SetParameter(string iCloudData) + { + iCloudUserParams iCloudUserParams = new iCloudUserParams(); + iCloudUserParams.icloud_data = iCloudData; + base.Params = iCloudUserParams; + } + + protected override int Parse() + { + if (resultCode != 1) + { + return resultCode; + } + JsonData jsonData = base.ResponseData["data"]; + if (jsonData["icloud_data_verified"].ToBoolean()) + { + VerifiediCloudUserData.iCloudViewerId = jsonData["icloud_viewer_id"].ToInt(); + VerifiediCloudUserData.iCloudUserName = jsonData["icloud_name"].ToString(); + string text = 1.ToString(); + string text2 = 2.ToString(); + SystemText systemText = Data.SystemText; + if (base.ResponseData["data"].Keys.Contains("rank") && base.ResponseData["data"]["rank"] != null) + { + JsonData jsonData2 = base.ResponseData["data"]["rank"]; + if (jsonData2.Keys.Contains(text)) + { + VerifiediCloudUserData.UserRankRotation = systemText.Get(jsonData2[text].ToString()); + } + if (jsonData2.Keys.Contains(text2)) + { + VerifiediCloudUserData.UserRankUnlimited = systemText.Get(jsonData2[text2].ToString()); + } + } + } + return resultCode; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/HangulManager.cs b/SVSim.BattleEngine/Engine/Cute/HangulManager.cs new file mode 100644 index 0000000..8949eb9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/HangulManager.cs @@ -0,0 +1,224 @@ +using System; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using UnityEngine; + +namespace Cute; + +public static class HangulManager +{ + private class JosiConversionRule + { + public char Type { get; private set; } + + public string Text1 { get; private set; } + + public string Text2 { get; private set; } + + public Func IsConvertToText1 { get; private set; } + + public JosiConversionRule(char type, string text1, string text2, Func isConvertToText1) + { + Type = type; + Text1 = text1; + Text2 = text2; + IsConvertToText1 = isConvertToText1; + } + } + + private class DecomposedHangul + { + public char? Chosung { get; set; } + + public char? Jungsung { get; set; } + + public char? Jongsung { get; set; } + + public DecomposedHangul() + { + Chosung = null; + Jungsung = null; + Jongsung = null; + } + + public DecomposedHangul(char hangulCharacter) + { + int num = hangulCharacter - 44032; + int num2 = (int)Mathf.Floor((float)num / (float)JUNGSUNG_TABLE.Length / (float)JONGSUNG_TABLE.Length); + Chosung = CHOSUNG_TABLE[num2]; + int num3 = (int)Mathf.Floor((float)num / (float)JONGSUNG_TABLE.Length - (float)(num2 * JUNGSUNG_TABLE.Length)); + Jungsung = JUNGSUNG_TABLE[num3]; + Jongsung = JONGSUNG_TABLE[num % JONGSUNG_TABLE.Length]; + } + } + + private const int STRING_BUILDER_CAPACITY = 512; + + private const char dHANGUL_START = '๊ฐ€'; + + private const char dHANGUL_END = 'ํžฃ'; + + private const char JOSI_TYPE_IDENTIFIER = '@'; + + private static readonly char[] CHOSUNG_TABLE = new char[19] + { + 'ใ„ฑ', 'ใ„ฒ', 'ใ„ด', 'ใ„ท', 'ใ„ธ', 'ใ„น', 'ใ…', 'ใ…‚', 'ใ…ƒ', 'ใ……', + 'ใ…†', 'ใ…‡', 'ใ…ˆ', 'ใ…‰', 'ใ…Š', 'ใ…‹', 'ใ…Œ', 'ใ…', 'ใ…Ž' + }; + + private static readonly char[] JUNGSUNG_TABLE = new char[21] + { + 'ใ…', 'ใ…', 'ใ…‘', 'ใ…’', 'ใ…“', 'ใ…”', 'ใ…•', 'ใ…–', 'ใ…—', 'ใ…˜', + 'ใ…™', 'ใ…š', 'ใ…›', 'ใ…œ', 'ใ…', 'ใ…ž', 'ใ…Ÿ', 'ใ… ', 'ใ…ก', 'ใ…ข', + 'ใ…ฃ' + }; + + private static readonly char?[] JONGSUNG_TABLE = new char?[28] + { + null, 'ใ„ฑ', 'ใ„ฒ', 'ใ„ณ', 'ใ„ด', 'ใ„ต', 'ใ„ถ', 'ใ„ท', 'ใ„น', 'ใ„บ', + 'ใ„ป', 'ใ„ผ', 'ใ„ฝ', 'ใ„พ', 'ใ„ฟ', 'ใ…€', 'ใ…', 'ใ…‚', 'ใ…„', 'ใ……', + 'ใ…†', 'ใ…‡', 'ใ…ˆ', 'ใ…Š', 'ใ…‹', 'ใ…Œ', 'ใ…', 'ใ…Ž' + }; + + private static readonly JosiConversionRule[] RULE_TABLE = new JosiConversionRule[6] + { + new JosiConversionRule('a', "์ด", "๊ฐ€", IsConvertToText1_common), + new JosiConversionRule('b', "์€", "๋Š”", IsConvertToText1_common), + new JosiConversionRule('c', "์„", "๋ฅผ", IsConvertToText1_common), + new JosiConversionRule('d', "๊ณผ", "์™€", IsConvertToText1_common), + new JosiConversionRule('e', "์œผ๋กœ", "๋กœ", IsConvertToText1_typeE), + new JosiConversionRule('f', "์ด๋ผ๋ฉด", "๋ผ๋ฉด", IsConvertToText1_common) + }; + + private static StringBuilder _strBuilder = new StringBuilder(512); + + private const string START_TAG = "START_TAG"; + + private const string END_TAG = "END_TAG"; + + private const string ENCLOSED = "ENCLOSED"; + + private const string NUMERAL_PATTERN = "(?\\[num\\])(?.*?)(?\\[/num\\])"; + + private static readonly string[] NUMERAL_TABLE = new string[100] + { + "0", "ํ•˜๋‚˜", "๋‘˜", "์…‹", "๋„ท", "๋‹ค์„ฏ", "์—ฌ์„ฏ", "์ผ๊ณฑ", "์—ฌ๋Ÿ", "์•„ํ™‰", + "์—ด", "์—ดํ•˜๋‚˜", "์—ด๋‘˜", "์—ด์…‹", "์—ด๋„ท", "์—ด๋‹ค์„ฏ", "์—ด์—ฌ์„ฏ", "์—ด์ผ๊ณฑ", "์—ด์—ฌ๋Ÿ", "์—ด์•„ํ™‰", + "์Šค๋ฌผ", "์Šค๋ฌผํ•˜๋‚˜", "์Šค๋ฌผ๋‘˜", "์Šค๋ฌผ์…‹", "์Šค๋ฌผ๋„ท", "์Šค๋ฌผ๋‹ค์„ฏ", "์Šค๋ฌผ์—ฌ์„ฏ", "์Šค๋ฌผ์ผ๊ณฑ", "์Šค๋ฌผ์—ฌ๋Ÿ", "์Šค๋ฌผ์•„ํ™‰", + "์„œ๋ฅธ", "์„œ๋ฅธํ•˜๋‚˜", "์„œ๋ฅธ๋‘˜", "์„œ๋ฅธ์…‹", "์„œ๋ฅธ๋„ท", "์„œ๋ฅธ๋‹ค์„ฏ", "์„œ๋ฅธ์—ฌ์„ฏ", "์„œ๋ฅธ์ผ๊ณฑ", "์„œ๋ฅธ์—ฌ๋Ÿ", "์„œ๋ฅธ์•„ํ™‰", + "๋งˆํ”", "๋งˆํ”ํ•˜๋‚˜", "๋งˆํ”๋‘˜", "๋งˆํ”์…‹", "๋งˆํ”๋„ท", "๋งˆํ”๋‹ค์„ฏ", "๋งˆํ”์—ฌ์„ฏ", "๋งˆํ”์ผ๊ณฑ", "๋งˆํ”์—ฌ๋Ÿ", "๋งˆํ”์•„ํ™‰", + "์‰ฐ", "์‰ฐํ•˜๋‚˜", "์‰ฐ๋‘˜", "์‰ฐ์…‹", "์‰ฐ๋„ท", "์‰ฐ๋‹ค์„ฏ", "์‰ฐ์—ฌ์„ฏ", "์‰ฐ์ผ๊ณฑ", "์‰ฐ์—ฌ๋Ÿ", "์‰ฐ์•„ํ™‰", + "์˜ˆ์ˆœ", "์˜ˆ์ˆœํ•˜๋‚˜", "์˜ˆ์ˆœ๋‘˜", "์˜ˆ์ˆœ์…‹", "์˜ˆ์ˆœ๋„ท", "์˜ˆ์ˆœ๋‹ค์„ฏ", "์˜ˆ์ˆœ์—ฌ์„ฏ", "์˜ˆ์ˆœ์ผ๊ณฑ", "์˜ˆ์ˆœ์—ฌ๋Ÿ", "์˜ˆ์ˆœ์•„ํ™‰", + "์ผํ”", "์ผํ”ํ•˜๋‚˜", "์ผํ”๋‘˜", "์ผํ”์…‹", "์ผํ”๋„ท", "์ผํ”๋‹ค์„ฏ", "์ผํ”์—ฌ์„ฏ", "์ผํ”์ผ๊ณฑ", "์ผํ”์—ฌ๋Ÿ", "์ผํ”์•„ํ™‰", + "์—ฌ๋“ ", "์—ฌ๋“ ํ•˜๋‚˜", "์—ฌ๋“ ๋‘˜", "์—ฌ๋“ ์…‹", "์—ฌ๋“ ๋„ท", "์—ฌ๋“ ๋‹ค์„ฏ", "์—ฌ๋“ ์—ฌ์„ฏ", "์—ฌ๋“ ์ผ๊ณฑ", "์—ฌ๋“ ์—ฌ๋Ÿ", "์—ฌ๋“ ์•„ํ™‰", + "์•„ํ”", "์•„ํ”ํ•˜๋‚˜", "์•„ํ”๋‘˜", "์•„ํ”์…‹", "์•„ํ”๋„ท", "์•„ํ”๋‹ค์„ฏ", "์•„ํ”์—ฌ์„ฏ", "์•„ํ”์ผ๊ณฑ", "์•„ํ”์—ฌ๋Ÿ", "์•„ํ”์•„ํ™‰" + }; + + public static string ConvertRule(string inputStr) + { + return ConvertJosiType(ConvertNumeral(inputStr)); + } + + private static string ConvertNumeral(string inputStr) + { + foreach (Match item in Regex.Matches(inputStr, "(?\\[num\\])(?.*?)(?\\[/num\\])").Cast().Reverse()) + { + Group obj = item.Groups["END_TAG"]; + inputStr = inputStr.Remove(obj.Index, obj.Length); + Group obj2 = item.Groups["ENCLOSED"]; + foreach (Match item2 in Regex.Matches(obj2.Value, "\\d+").Cast().Reverse()) + { + Group obj3 = item2.Groups[0]; + int num = int.Parse(obj3.Value); + if (0 < num && num < NUMERAL_TABLE.Length) + { + int startIndex = obj2.Index + obj3.Index; + inputStr = inputStr.Remove(startIndex, obj3.Length).Insert(startIndex, NUMERAL_TABLE[num]); + } + } + Group obj4 = item.Groups["START_TAG"]; + inputStr = inputStr.Remove(obj4.Index, obj4.Length); + } + return inputStr; + } + + private static string ConvertJosiType(string inputStr) + { + if (inputStr.Length <= 0) + { + return inputStr; + } + _strBuilder.Length = 0; + _strBuilder.Append(inputStr[0]); + int length = inputStr.Length; + for (int i = 1; i < length; i++) + { + char c = inputStr[i]; + if (c != '@') + { + _strBuilder.Append(c); + continue; + } + if (i + 1 == length) + { + _strBuilder.Append(c); + break; + } + bool flag = false; + char c2 = inputStr[i + 1]; + for (int j = 0; j < RULE_TABLE.Length; j++) + { + JosiConversionRule josiConversionRule = RULE_TABLE[j]; + if (josiConversionRule.Type == c2) + { + flag = true; + _strBuilder.Append(josiConversionRule.IsConvertToText1(inputStr[i - 1]) ? josiConversionRule.Text1 : josiConversionRule.Text2); + i++; + break; + } + } + if (!flag) + { + _strBuilder.Append(c); + } + } + return _strBuilder.ToString(); + } + + private static char? GetJongsung(char character) + { + if (character < '๊ฐ€' || 'ํžฃ' < character) + { + return null; + } + return JONGSUNG_TABLE[(character - 44032) % JONGSUNG_TABLE.Length]; + } + + private static bool IsConvertToText1_common(char latestCharacter) + { + if (GetJongsung(latestCharacter).HasValue) + { + return true; + } + if ("013678".IndexOf(latestCharacter) >= 0) + { + return true; + } + return false; + } + + private static bool IsConvertToText1_typeE(char latestCharacter) + { + char? jongsung = GetJongsung(latestCharacter); + if (jongsung.HasValue && jongsung.Value != 'ใ„น') + { + return true; + } + if ("036".IndexOf(latestCharacter) >= 0) + { + return true; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/IAchievementCallback.cs b/SVSim.BattleEngine/Engine/Cute/IAchievementCallback.cs new file mode 100644 index 0000000..c0a24d0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/IAchievementCallback.cs @@ -0,0 +1,18 @@ +using UnityEngine.SocialPlatforms; + +namespace Cute; + +public interface IAchievementCallback +{ + void OnSignIn(bool success); + + void OnSignOut(); + + void OnReleaseAchievement(bool success); + + void OnProceedAchievement(bool success); + + void OnLoadAchievements(IAchievement[] achievements); + + void OnLoadAchievementDescriptions(IAchievementDescription[] descriptions); +} diff --git a/SVSim.BattleEngine/Engine/Cute/ILocalKVS.cs b/SVSim.BattleEngine/Engine/Cute/ILocalKVS.cs new file mode 100644 index 0000000..26e4dd6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/ILocalKVS.cs @@ -0,0 +1,20 @@ +using System; + +namespace Cute; + +public interface ILocalKVS : IDisposable +{ + string savePath { get; } + + string Get(string key); + + void Set(string key, string value); + + void Delete(string key); + + void DeleteAll(); + + void Transaction(Action block); + + void Optimize(); +} diff --git a/SVSim.BattleEngine/Engine/Cute/LocalSqliteKVS.cs b/SVSim.BattleEngine/Engine/Cute/LocalSqliteKVS.cs new file mode 100644 index 0000000..7b986a5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/LocalSqliteKVS.cs @@ -0,0 +1,281 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using Sqlite3Plugin; + +namespace Cute; + +public class LocalSqliteKVS : ILocalKVS, IDisposable +{ + protected DBProxy _db; + + protected PreparedQuery _keyQuery; + + protected PreparedQuery _upsertQuery; + + protected PreparedQuery _deleteQuery; + + protected PreparedQuery _likeQuery; + + protected PreparedQuery _selectAllQuery; + + protected bool _enableCache; + + protected Dictionary _tableCache; + + public string savePath => _db.dbPath; + + protected LocalSqliteKVS(string path, bool enableCache) + { + try + { + string directoryName = Path.GetDirectoryName(path); + if (!Directory.Exists(directoryName)) + { + Directory.CreateDirectory(directoryName); + } + _db = new DBProxy(); + if (!_db.OpenWritable(path)) + { + throw new ApplicationException($"Failed to open LocalKVS at {path}"); + } + if (!_db.Exec("CREATE TABLE IF NOT EXISTS t (k TEXT NOT NULL, v TEXT NOT NULL, PRIMARY KEY(k));")) + { + throw new ApplicationException($"Failed to initialize LocalKVS at {path}"); + } + _db.Exec("pragma cache_size=0"); + _keyQuery = _db.PreparedQuery("SELECT v FROM t WHERE k=?;"); + _upsertQuery = _db.PreparedQuery("REPLACE INTO t(k,v)VALUES(?,?);"); + _deleteQuery = _db.PreparedQuery("DELETE FROM t WHERE k=?;"); + _likeQuery = _db.PreparedQuery("SELECT k FROM t WHERE k LIKE ? ESCAPE '!';"); + _selectAllQuery = _db.PreparedQuery("SELECT k FROM t;"); + _enableCache = enableCache; + if (!_enableCache) + { + return; + } + using (Query query = _db.Query("SELECT COUNT(*) FROM t;")) + { + query.Step(); + int capacity = query.GetInt(0); + _tableCache = new Dictionary(capacity); + } + using Query query2 = _db.Query("SELECT k,v FROM t;"); + while (query2.Step()) + { + string text = query2.GetText(0); + string text2 = query2.GetText(1); + _tableCache[text] = text2; + } + } + catch (Exception ex) + { + Dispose(); + throw ex; + } + } + + public static LocalSqliteKVS Open(string path, bool enableCache) + { + return new LocalSqliteKVS(path, enableCache); + } + + ~LocalSqliteKVS() + { + Dispose(); + } + + public virtual void Dispose() + { + if (_db != null) + { + if (_keyQuery != null) + { + _keyQuery.Dispose(); + _keyQuery = null; + } + if (_upsertQuery != null) + { + _upsertQuery.Dispose(); + _upsertQuery = null; + } + if (_deleteQuery != null) + { + _deleteQuery.Dispose(); + _deleteQuery = null; + } + if (_likeQuery != null) + { + _likeQuery.Dispose(); + _likeQuery = null; + } + if (_selectAllQuery != null) + { + _selectAllQuery.Dispose(); + _selectAllQuery = null; + } + _db.Dispose(); + _db = null; + _tableCache = null; + } + } + + public List FindLike(string pattern) + { + List list = new List(); + try + { + _likeQuery.BindText(1, pattern); + while (_likeQuery.Step()) + { + list.Add(_likeQuery.GetText(0)); + } + return list; + } + catch (Exception ex) + { + throw ex; + } + finally + { + _likeQuery.Reset(); + } + } + + public string EscapeLikePattern(string pattern) + { + return Regex.Replace(pattern, "[_%\\[!]", "!$0"); + } + + public void DisableCache() + { + _enableCache = false; + _tableCache = null; + } + + public List GetAll() + { + List list = new List(); + try + { + while (_selectAllQuery.Step()) + { + list.Add(_selectAllQuery.GetText(0)); + } + return list; + } + catch (Exception ex) + { + throw ex; + } + finally + { + _selectAllQuery.Reset(); + } + } + + public string Get(string key) + { + if (_enableCache) + { + if (!_tableCache.TryGetValue(key, out var value)) + { + return null; + } + return value; + } + try + { + _keyQuery.BindText(1, key); + if (_keyQuery.Step()) + { + return _keyQuery.GetText(0); + } + return null; + } + catch (Exception ex) + { + throw ex; + } + finally + { + _keyQuery.Reset(); + } + } + + public void Set(string key, string value) + { + if (_enableCache) + { + _tableCache[key] = value; + } + try + { + _upsertQuery.BindText(1, key); + _upsertQuery.BindText(2, value); + _upsertQuery.Step(); + } + catch (Exception ex) + { + throw ex; + } + finally + { + _upsertQuery.Reset(); + } + } + + public void Delete(string key) + { + if (_enableCache && !_tableCache.Remove(key)) + { + return; + } + try + { + _deleteQuery.BindText(1, key); + _deleteQuery.Step(); + } + catch (Exception ex) + { + throw ex; + } + finally + { + _deleteQuery.Reset(); + } + } + + public void Transaction(Action block) + { + if (!_db.Begin()) + { + throw new ApplicationException("Failed to begin LocalKVS transaction"); + } + try + { + block(); + _db.Commit(); + } + catch (Exception ex) + { + _db.Rollback(); + throw ex; + } + } + + public void DeleteAll() + { + _db.Exec("DELETE FROM t;"); + if (_enableCache) + { + _tableCache.Clear(); + } + } + + public void Optimize() + { + _db.Vacuum(); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/ManifestDatahashKVS.cs b/SVSim.BattleEngine/Engine/Cute/ManifestDatahashKVS.cs new file mode 100644 index 0000000..73056ba --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/ManifestDatahashKVS.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; + +namespace Cute; + +public class ManifestDatahashKVS : ILocalKVS, IDisposable +{ + protected LocalSqliteKVS _kvs; + + public string savePath => _kvs.savePath; + + public ManifestDatahashKVS(string path) + { + _kvs = LocalSqliteKVS.Open(path, enableCache: true); + } + + ~ManifestDatahashKVS() + { + Dispose(); + } + + public virtual void Dispose() + { + if (_kvs != null) + { + _kvs.Dispose(); + _kvs = null; + } + } + + public string Get(string name) + { + string text = _kvs.Get(name); + return (text == null) ? "" : text; + } + + public void Set(string name, string hash) + { + _kvs.Set(name, hash); + } + + public void Set(Dictionary _dictionary) + { + if (_dictionary.Count <= 0) + { + return; + } + foreach (KeyValuePair item in _dictionary) + { + Set(item.Key, item.Value); + } + } + + public void Delete(string name) + { + _kvs.Delete(name); + } + + public void DeleteAll() + { + _kvs.DeleteAll(); + Optimize(); + } + + public void DisableCache() + { + _kvs.DisableCache(); + } + + public void DeleteByList(List _deleteList) + { + if (_deleteList.Count > 0) + { + Transaction(delegate + { + _deleteList.ForEach(Delete); + }); + Optimize(); + } + } + + public void DeleteByPrefix(string prefix) + { + List deleteList = _kvs.FindLike(_kvs.EscapeLikePattern(prefix) + "%"); + if (deleteList.Count <= 0) + { + return; + } + Transaction(delegate + { + foreach (string item in deleteList) + { + Delete(item); + } + }); + Optimize(); + } + + public List GetAll() + { + return _kvs.GetAll(); + } + + public List FindLike(string patternEscaped) + { + return _kvs.FindLike(patternEscaped); + } + + public string EscapeLikePattern(string patternNoEscape) + { + return _kvs.EscapeLikePattern(patternNoEscape); + } + + public void Optimize() + { + _kvs.Optimize(); + } + + public void Transaction(Action block) + { + _kvs.Transaction(block); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/MovieManager.cs b/SVSim.BattleEngine/Engine/Cute/MovieManager.cs new file mode 100644 index 0000000..64e26c8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/MovieManager.cs @@ -0,0 +1,217 @@ +using System; +using System.Collections; +using UnityEngine; +using Wizard; + +namespace Cute; + +public class MovieManager : MonoBehaviour, IManager +{ + private string fileRootPath; + + private string streamingAssetfileRootPath; + + private MoviePlayer _player; + + private float _volume = 1f; + + private MovieSubtitles _movieSubtitles; + + private IEnumerator Start() + { + Toolbox.MovieManager = this; + while (!CustomPreference.isPreferenceComplete) + { + yield return null; + } + fileRootPath = "file:///" + Application.persistentDataPath + "/"; + streamingAssetfileRootPath = "file:///" + Application.streamingAssetsPath + "/"; + } + + private void CreateMoviePlayer() + { + GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("Prefab/Movie/MoviePlayer")) as GameObject; + gameObject.transform.parent = base.transform; + _player = gameObject.GetComponent(); + _player.SetVolume(_volume); + } + + public void Load(string filename) + { + if (!_player) + { + CreateMoviePlayer(); + } + _player.Load(fileRootPath + filename); + } + + public void Unload() + { + if ((bool)_player) + { + UnityEngine.Object.Destroy(_player.gameObject); + } + } + + public void Play() + { + if (IsReady() || IsPaused() || IsStopped()) + { + _player.Play(); + } + } + + public void PlayWithSubtitles(string subtitlesCSV) + { + GameObject prefab = (GameObject)Resources.Load("UI/MovieSubtitles"); + _movieSubtitles = NGUITools.AddChild(UIManager.GetInstance().UIManagerRoot.gameObject, prefab).GetComponent(); + SetCallbackStart(delegate + { + _movieSubtitles.PlaySubtitles(subtitlesCSV); + }); + Play(); + } + + public void Stop() + { + if (_movieSubtitles != null) + { + _movieSubtitles.Finish(); + _movieSubtitles = null; + } + if (IsPlaying() || IsPaused()) + { + _player.Stop(); + } + } + + public void Pause() + { + if (IsPlaying()) + { + _player.Pause(); + } + } + + public void SetVolume(float volume) + { + _volume = volume; + if ((bool)_player) + { + _player.SetVolume(volume); + } + } + + public int GetSeekPosition() + { + if (!_player) + { + return 0; + } + return _player.GetSeekPosition(); + } + + public int GetDuration() + { + if (!_player) + { + return 0; + } + return _player.GetDuration(); + } + + public int GetCurrentSeekPercent() + { + if (!_player) + { + return 0; + } + return _player.GetCurrentSeekPercent(); + } + + public void SeekTo(int seek) + { + if ((bool)_player) + { + _player.SeekTo(seek); + } + } + + public bool IsReady() + { + if (!_player) + { + return false; + } + return _player.IsReady(); + } + + public bool IsPlaying() + { + if (!_player) + { + return false; + } + return _player.IsPlaying(); + } + + public bool IsPaused() + { + if (!_player) + { + return false; + } + return _player.IsPaused(); + } + + public bool IsStopped() + { + if (!_player) + { + return false; + } + return _player.IsStopped(); + } + + public bool IsFinished() + { + if (!_player) + { + return false; + } + return _player.IsFinished(); + } + + public bool IsError() + { + if (!_player) + { + return true; + } + return _player.IsError(); + } + + public void SetCallbackReady(Action callback) + { + if ((bool)_player) + { + _player.CallbackReady += callback; + } + } + + public void SetCallbackStart(Action callback) + { + if ((bool)_player) + { + _player.CallbackStart += callback; + } + } + + public void SetCallbackEnd(Action callback) + { + if ((bool)_player) + { + _player.CallbackEnd += callback; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/MoviePlayer.cs b/SVSim.BattleEngine/Engine/Cute/MoviePlayer.cs new file mode 100644 index 0000000..524a0af --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/MoviePlayer.cs @@ -0,0 +1,155 @@ +using System; +using CriWare; +using CriWare.CriMana; +using UnityEngine; + +namespace Cute; + +public class MoviePlayer : MonoBehaviour +{ + [SerializeField] + private CriManaMovieMaterial _movieController; + + [SerializeField] + private Camera _camera; + + public event Action CallbackReady; + + public event Action CallbackStart; + + public event Action CallbackEnd; + + private void Update() + { + if (_movieController.player == null) + { + return; + } + switch (_movieController.player.status) + { + case Player.Status.Playing: + if (this.CallbackStart != null) + { + this.CallbackStart(); + this.CallbackStart = null; + } + break; + case Player.Status.PlayEnd: + Stop(); + if (this.CallbackEnd != null) + { + this.CallbackEnd(); + this.CallbackEnd = null; + } + break; + } + } + + public void Load(string filePath) + { + filePath = filePath.Replace("file:///", ""); + _movieController.maxFrameDrop = CriManaMovieMaterial.MaxFrameDrop.Ten; + _movieController.player.Stop(); + _movieController.player.SetFile(null, filePath); + _movieController.player.Prepare(); + if (this.CallbackReady != null) + { + this.CallbackReady(); + this.CallbackReady = null; + } + } + + public void Play() + { + _camera.enabled = true; + if (IsPaused()) + { + _movieController.player.Pause(sw: false); + } + else + { + _movieController.player.Start(); + } + } + + public void Stop() + { + QualitySettings.vSyncCount = 0; + _camera.enabled = false; + _movieController.player.Stop(); + } + + public void Pause() + { + _movieController.player.Pause(!_movieController.player.IsPaused()); + } + + public void SetVolume(float volume) + { + _movieController.player.SetVolume(volume); + } + + public int GetSeekPosition() + { + return (int)(_movieController.player.GetTime() / 1000); + } + + public int GetDuration() + { + int totalFrames = (int)_movieController.player.movieInfo.totalFrames; + int num = (int)(_movieController.player.movieInfo.framerateN / 1000); + if (num == 0) + { + return -1; + } + return totalFrames / num * 1000; + } + + public int GetCurrentSeekPercent() + { + return GetSeekPosition() / GetDuration() * 100; + } + + public void SeekTo(int seek) + { + int num = (int)(_movieController.player.movieInfo.framerateN / 1000); + int seekPosition = seek * num / 1000; + _movieController.player.Stop(); + _movieController.player.SetSeekPosition(seekPosition); + _movieController.player.Start(); + } + + public bool IsReady() + { + return _movieController.player.status == Player.Status.Ready; + } + + public bool IsPlaying() + { + if (_movieController.player.status == Player.Status.Playing) + { + return !IsPaused(); + } + return false; + } + + public bool IsPaused() + { + return _movieController.player.IsPaused(); + } + + public bool IsStopped() + { + return _movieController.player.status == Player.Status.Stop; + } + + public bool IsFinished() + { + return _movieController.player.status == Player.Status.PlayEnd; + } + + public bool IsError() + { + return _movieController.player.status == Player.Status.Error; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/ParallelJob.cs b/SVSim.BattleEngine/Engine/Cute/ParallelJob.cs new file mode 100644 index 0000000..8218399 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/ParallelJob.cs @@ -0,0 +1,36 @@ +using System; + +namespace Cute; + +public class ParallelJob +{ + private Action _action; + + public bool isDone { get; private set; } + + public static ParallelJob Dispatch(Action action) + { + ParallelJob parallelJob = new ParallelJob(action); + LeanThreadPool.Instance.AddJob(parallelJob); + return parallelJob; + } + + private ParallelJob(Action action) + { + isDone = false; + _action = action; + } + + internal void Run() + { + if (!isDone) + { + if (_action != null) + { + _action(); + _action = null; + } + isDone = true; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/PaymentPCFinishTask.cs b/SVSim.BattleEngine/Engine/Cute/PaymentPCFinishTask.cs new file mode 100644 index 0000000..170a064 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/PaymentPCFinishTask.cs @@ -0,0 +1,69 @@ +using Wizard; + +namespace Cute; + +public class PaymentPCFinishTask : NetworkTask +{ + public class PaymentPCFinishParams : PostParams + { + public string product_id = ""; + + public string steam_app_id = ""; + + public string steam_order_id = ""; + + public string steam_user_country = ""; + } + + private CuteNetworkDefine.ApiType apiType = CuteNetworkDefine.ApiType.PaymentPCFinish; + + public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}"; + + public void SetParameter(string ProductId, string StreamAppID = "", string SteamOrderId = "") + { + PaymentPCFinishParams paymentPCFinishParams = new PaymentPCFinishParams(); + paymentPCFinishParams.product_id = ProductId; + paymentPCFinishParams.steam_app_id = StreamAppID; + paymentPCFinishParams.steam_order_id = SteamOrderId; + paymentPCFinishParams.steam_user_country = PCPlatformSTEAM.Country; + base.Params = paymentPCFinishParams; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + if (base.ResponseData["data"].Count > 0) + { + if (base.ResponseData["data"]["purchased_times_data"] != null) + { + Data.Load.data._userCrystalCount._lastPaymentItemBuyNumber = base.ResponseData["data"]["purchased_times_data"]["number_of_product_purchased"].ToInt(); + if (base.ResponseData["data"]["purchased_times_data"].Keys.Contains("csv_data_id")) + { + Data.Load.data._userCrystalCount._lastPaymentId = base.ResponseData["data"]["purchased_times_data"]["csv_data_id"].ToString(); + } + } + else + { + Data.Load.data._userCrystalCount._lastPaymentItemBuyNumber = 0; + Data.Load.data._userCrystalCount._lastPaymentId = null; + } + Data.Load.data._userCrystalCount.total_crystal = base.ResponseData["data"]["after_free_crystal"].ToInt() + base.ResponseData["data"]["after_crystal"].ToInt(); + Data.Load.data._userCrystalCount.free_crystal = base.ResponseData["data"]["after_free_crystal"].ToInt(); + Data.Load.data._userCrystalCount.charge_crystal = base.ResponseData["data"]["after_crystal"].ToInt(); + MyPageMenu.Instance.UpdateCrystalCount(); + if (CreateItemList.GetInstance() != null) + { + CreateItemList.GetInstance().UpdateCrystalCount(); + } + if (GachaUI.GetInstance() != null) + { + GachaUI.GetInstance().UpdateUserItemCount(); + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/QualityManager.cs b/SVSim.BattleEngine/Engine/Cute/QualityManager.cs new file mode 100644 index 0000000..dd31f73 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/QualityManager.cs @@ -0,0 +1,340 @@ +using System.Collections; +using UnityEngine; + +namespace Cute; + +public class QualityManager : MonoBehaviour, IManager +{ + public enum GPUQualityLevel + { + Level_1, + Level_2, + Level_3, + Level_4 + } + + public enum AssetQualityLevel + { + None, + Level_1, + Level_2, + Max + } + + public enum SoundQualityLevel + { + None, + Level_1, + Level_2, + Max + } + + public enum MovieQualityLevel + { + None, + Level_1, + Level_2, + Max + } + + public enum MemoryQualityLevel + { + Level_1, + Level_2 + } + + public enum GameQualityLevel + { + Level_1, + Level_2, + Level_3, + Level_4 + } + + public enum OutLineLevel + { + OutLine_On, + OutLine_Off + } + + private GPUQualityLevel _gpuQualityLevel; + + private AssetQualityLevel _assetQualityLevel; + + private SoundQualityLevel _soundQualityLevel; + + private MovieQualityLevel _movieQualityLevel; + + private MemoryQualityLevel _memoryQualityLevel; + + private Vector2 _deviceResolution = Vector2.zero; + + private Vector2 _gameResolution = Vector2.zero; + + private int _defaultFrameRate = 60; + + private bool _isDeviceResolutionSetting; + + public bool isFullScreen; + + private GameQualityLevel _gameQualityLevel; + + private OutLineLevel _outlineLevel; + + public Vector2 deviceResolution => _deviceResolution; + + public Vector2 gameResolution => _gameResolution; + + private void Awake() + { + UpdateFromUnity(); + } + + private IEnumerator Start() + { + while (Toolbox.SavedataManager == null) + { + yield return 0; + } + Initialize(); + Toolbox.QualityManager = this; + } + + private void OnDestroy() + { + } + + public void Initialize() + { + CheckGPUQuality(); + CheckMemoryQuality(); + CheckAssetQuality(); + CheckSoundQuality(); + CheckMovieQuality(); + InitializeGameQuality(); + } + + private void CheckGPUQuality() + { + _gpuQualityLevel = GPUQualityLevel.Level_4; + } + + private void CheckMemoryQuality() + { + _memoryQualityLevel = MemoryQualityLevel.Level_2; + } + + private void CheckAssetQuality() + { + _assetQualityLevel = ((_memoryQualityLevel == MemoryQualityLevel.Level_1) ? AssetQualityLevel.Level_1 : AssetQualityLevel.Level_2); + SetAssetQualityLevel(_assetQualityLevel); + } + + private void CheckSoundQuality() + { + int num = Toolbox.SavedataManager.GetInt("SOUNDQUALIY"); + if (num != 0) + { + _soundQualityLevel = (SoundQualityLevel)num; + } + else + { + _soundQualityLevel = ((_memoryQualityLevel == MemoryQualityLevel.Level_1) ? SoundQualityLevel.Level_1 : SoundQualityLevel.Level_2); + } + SetSoundQualityLevel(_soundQualityLevel); + } + + private void CheckMovieQuality() + { + _movieQualityLevel = ((_memoryQualityLevel == MemoryQualityLevel.Level_1) ? MovieQualityLevel.Level_1 : MovieQualityLevel.Level_2); + } + + public static GPUQualityLevel GetGPUQualityLevel() + { + if (Toolbox.QualityManager == null) + { + return GPUQualityLevel.Level_1; + } + return Toolbox.QualityManager._gpuQualityLevel; + } + + public static MemoryQualityLevel GetMemoryQualityLevel() + { + if (Toolbox.QualityManager == null) + { + return MemoryQualityLevel.Level_1; + } + return Toolbox.QualityManager._memoryQualityLevel; + } + + public static void SetAssetQualityLevel(AssetQualityLevel _AssetQualityLevel) + { + if (Toolbox.QualityManager != null) + { + Toolbox.QualityManager._assetQualityLevel = _AssetQualityLevel; + } + } + + public static AssetQualityLevel GetAssetQualityLevel() + { + if (Toolbox.QualityManager == null) + { + return AssetQualityLevel.Level_1; + } + return Toolbox.QualityManager._assetQualityLevel; + } + + public static void SetSoundQualityLevel(SoundQualityLevel _SoundQualityLevel) + { + if (Toolbox.QualityManager != null) + { + Toolbox.QualityManager._soundQualityLevel = _SoundQualityLevel; + Toolbox.SavedataManager.SetInt("SOUNDQUALIY", (int)Toolbox.QualityManager._soundQualityLevel); + } + } + + public static SoundQualityLevel GetSoundQualityLevel() + { + if (Toolbox.QualityManager == null) + { + return SoundQualityLevel.Level_1; + } + return Toolbox.QualityManager._soundQualityLevel; + } + + public static void SetMovieQualityLevel(MovieQualityLevel _MovieQualityLevel) + { + if (Toolbox.QualityManager != null) + { + Toolbox.QualityManager._movieQualityLevel = _MovieQualityLevel; + } + } + + public static MovieQualityLevel GetMovieQualityLevel() + { + if (Toolbox.QualityManager == null) + { + return MovieQualityLevel.Level_1; + } + return Toolbox.QualityManager._movieQualityLevel; + } + + public void LimitResolution() + { + _gameResolution = _deviceResolution; + if (_deviceResolution.x > 1280f || _deviceResolution.y > 1280f) + { + float num = 1280f / _deviceResolution.x; + _gameResolution = new Vector2(_deviceResolution.x * num, _deviceResolution.y * num); + Screen.SetResolution((int)_gameResolution.x, (int)_gameResolution.y, isFullScreen); + } + } + + public void ChangeResolution(float rate, bool saveratio = true) + { + LimitResolution(); + float num = _gameResolution.x * rate / _gameResolution.x; + _gameResolution = new Vector2(_gameResolution.x * num, _gameResolution.y * num); + Screen.SetResolution((int)_gameResolution.x, (int)_gameResolution.y, isFullScreen); + } + + public void ChangeResolutionToDeviceSetting() + { + _gameResolution = _deviceResolution; + Screen.SetResolution((int)_gameResolution.x, (int)_gameResolution.y, isFullScreen); + } + + public void ChangeResolution(float width, float height, bool fullscreen) + { + if (width == 0f || height == 0f) + { + width = Screen.width; + height = Screen.height; + } + isFullScreen = fullscreen; + _deviceResolution = new Vector2(width, height); + Screen.SetResolution((int)width, (int)height, fullscreen); + } + + private void InitializeGameQuality() + { + if (_gpuQualityLevel == GPUQualityLevel.Level_4) + { + _gameQualityLevel = GameQualityLevel.Level_4; + } + else if (_gpuQualityLevel == GPUQualityLevel.Level_3) + { + _gameQualityLevel = GameQualityLevel.Level_3; + } + else if (_gpuQualityLevel == GPUQualityLevel.Level_2) + { + _gameQualityLevel = GameQualityLevel.Level_2; + } + else + { + _gameQualityLevel = GameQualityLevel.Level_1; + } + if (_memoryQualityLevel == MemoryQualityLevel.Level_1) + { + _gameQualityLevel = GameQualityLevel.Level_1; + } + if (!_isDeviceResolutionSetting) + { + _deviceResolution = new Vector2(Screen.width, Screen.height); + _isDeviceResolutionSetting = true; + } + if (_gpuQualityLevel <= GPUQualityLevel.Level_2 && Toolbox.SavedataManager.GetInt("SOUNDQUALIY") == 0) + { + SetSoundQualityLevel(SoundQualityLevel.Level_1); + } + DecideDeviceSetting(); + } + + private void DecideDeviceSetting() + { + string graphicsDeviceName = SystemInfo.graphicsDeviceName; + if (graphicsDeviceName.Contains("PowerVR") && graphicsDeviceName.Contains("SGX 540")) + { + _outlineLevel = OutLineLevel.OutLine_Off; + } + } + + public void SetGameQualityLevel(GPUQualityLevel level) + { + _gpuQualityLevel = level; + } + + public GameQualityLevel GetGameQualityLevel() + { + return _gameQualityLevel; + } + + public void SetFrameRate(int frameRate) + { + _defaultFrameRate = frameRate; + } + + public int GetFrameRate() + { + return _defaultFrameRate; + } + + public void ChangeResolutionFixedHalf() + { + } + + public void ChangeResolutionFixedBack() + { + } + + public OutLineLevel GetOutLineLevel() + { + return _outlineLevel; + } + + public void UpdateFromUnity() + { + isFullScreen = Screen.fullScreen; + _deviceResolution = new Vector2(Screen.width, Screen.height); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/SavedataManager.cs b/SVSim.BattleEngine/Engine/Cute/SavedataManager.cs new file mode 100644 index 0000000..84797f8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/SavedataManager.cs @@ -0,0 +1,90 @@ +using CodeStage.AntiCheat.ObscuredTypes; +using UnityEngine; + +namespace Cute; + +public class SavedataManager : MonoBehaviour, IManager +{ + public const string RESOURCE_VERSION_KEY = "RES_VER"; + + public const string LANGUAGE_FIRST_SET = "LANG_FIRST_SET"; + + public const string LANGUAGE_KEY = "LANG_SETTING"; + + public const string LANGUAGE_SOUND_KEY = "LANG_SOUND_SETTING"; + + public const string LANGUAGE_FONT_KEY = "LANG_FONT"; + + public static string OMOTENASHI_COUNTRY_KEY = "OMOTE_COUNTRY"; + + public static string LANGUAGE_CHANGE = "LANG_CHANGE"; + + private void Start() + { + Toolbox.SavedataManager = this; + } + + private void OnDestroy() + { + } + + public void DeleteAll() + { + ObscuredPrefs.DeleteAll(); + } + + public void DeleteKey(string key) + { + ObscuredPrefs.DeleteKey(key); + } + + public float GetFloat(string key, float defaultValue = 0f) + { + return ObscuredPrefs.GetFloat(key, defaultValue); + } + + public void SetFloat(string key, float value) + { + ObscuredPrefs.SetFloat(key, value); + } + + public int GetInt(string key, int defaultValue = 0) + { + return ObscuredPrefs.GetInt(key, defaultValue); + } + + public void SetInt(string key, int value) + { + ObscuredPrefs.SetInt(key, value); + } + + public string GetString(string key, string defaultValue = "") + { + return ObscuredPrefs.GetString(key, defaultValue); + } + + public void SetString(string key, string value) + { + ObscuredPrefs.SetString(key, value); + } + + public bool HasKey(string key) + { + return ObscuredPrefs.HasKey(key); + } + + public void Save() + { + ObscuredPrefs.Save(); + } + + public void SetResourceVersion(string version) + { + SetString("RES_VER", version); + } + + public string GetResourceVersion() + { + return GetString("RES_VER", "00000000"); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/SignUpTask.cs b/SVSim.BattleEngine/Engine/Cute/SignUpTask.cs new file mode 100644 index 0000000..39af4f7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/SignUpTask.cs @@ -0,0 +1,72 @@ +using LitJson; +using UnityEngine; + +namespace Cute; + +public class SignUpTask : NetworkTask +{ + private class LoginPostParams : PostParams + { + public string device_name = ""; + + public string client_type = ""; + + public string os_version = ""; + + public string app_version = ""; + + public string resource_version = ""; + + public string carrier = ""; + } + + private CuteNetworkDefine.ApiType apiType; + + public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}"; + + public void SetParameter() + { + LoginPostParams loginPostParams = new LoginPostParams(); + loginPostParams.device_name = Toolbox.DeviceManager.GetModelName(); + loginPostParams.client_type = Toolbox.DeviceManager.GetDeviceType().ToString(); + loginPostParams.os_version = Toolbox.DeviceManager.GetOsVersion(); + loginPostParams.app_version = Toolbox.DeviceManager.GetAppVersionName(); + loginPostParams.resource_version = "00000000"; + loginPostParams.carrier = Toolbox.DeviceManager.GetCarrier(); + base.Params = loginPostParams; + } + + protected override int Parse() + { + JsonData jsonData = base.ResponseData["data_headers"]; + resultCode = jsonData["result_code"].ToInt(); + if (resultCode != 1) + { + return resultCode; + } + int viewerId = jsonData["viewer_id"].ToInt(); + int shortUdid = jsonData["short_udid"].ToInt(); + string text = jsonData["udid"].ToString(); + if (Certification.Udid != text) + { + Debug.LogError("udidไธ€่‡ดใ—ใพใ›ใ‚“ใ€‚ไธๆญฃใฎใ‚ขใ‚ฏใ‚ปใ‚นใงใ™ใ€‚"); + } + else + { + Certification.ViewerId = viewerId; + Certification.ShortUdid = shortUdid; + Certification.SessionId = ""; + AdjustManager.ViewerIDEvent(); + GameObject gameObject = GameObject.Find("OmotePlugin"); + if (gameObject != null) + { + OmotePlugin component = gameObject.GetComponent(); + if (component != null) + { + component.SendConversion(text); + } + } + } + return resultCode; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/SoftwareResetBase.cs b/SVSim.BattleEngine/Engine/Cute/SoftwareResetBase.cs new file mode 100644 index 0000000..3892266 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/SoftwareResetBase.cs @@ -0,0 +1,48 @@ +using System; +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace Cute; + +public static class SoftwareResetBase +{ + public static bool isSoftwareReset; + + private static Action resetAction; + + public static bool IsSoftwareReset() + { + return isSoftwareReset; + } + + public static void setSoftwareResetAction(Action _action) + { + resetAction = _action; + } + + public static void SoftwareReset(string sceneName, Action _resetAction) + { + isSoftwareReset = true; + if (_resetAction != null) + { + resetAction = _resetAction; + } + resetAction.Call(); + GameObject gameObject = GameObject.Find("OmotePlugin"); + if (gameObject != null) + { + UnityEngine.Object.Destroy(gameObject); + } + Toolbox.BootSystem.VisibleBootCamera(enable: true); + GameObject gameObject2 = GameObject.Find("BootCamera"); + if (gameObject2 != null) + { + gameObject2.transform.parent = null; + UnityEngine.Object.DontDestroyOnLoad(gameObject2); + BootSystem.isRootBootCamera = true; + } + Screen.sleepTimeout = -2; + BootApp.BootScene = sceneName; + UnityEngine.SceneManagement.SceneManager.LoadScene("_SoftwareReset"); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/SoundData.cs b/SVSim.BattleEngine/Engine/Cute/SoundData.cs new file mode 100644 index 0000000..b22c902 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/SoundData.cs @@ -0,0 +1,17 @@ +namespace Cute; + +public struct SoundData +{ + public string _acbName; + + public string _cueName; + + public int _cueId; + + public SoundData(string acbName, string cueName, int cueId) + { + _acbName = acbName; + _cueName = cueName; + _cueId = cueId; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/TimeData.cs b/SVSim.BattleEngine/Engine/Cute/TimeData.cs new file mode 100644 index 0000000..aaaa248 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/TimeData.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections; +using UnityEngine; + +namespace Cute; + +public class TimeData +{ + private long serverTime; + + private long connectClientTime; + + public void Set(long setServerTime) + { + serverTime = setServerTime; + connectClientTime = (long)TimeNativePlugin.GetDeviceOperatingTime(); + } + + public DateTime GetNowTime() + { + return TimeUtil.GetNowTime(serverTime, connectClientTime); + } + + public DateTime GetNowTime_UTC() + { + return TimeUtil.GetNowTime_UTC(serverTime, connectClientTime); + } + + public float GetTimeLeftLong(long endTime) + { + return (float)TimeUtil.GetTimeLeft(serverTime, endTime, 0L).millisecond / 1000f; + } + + [Obsolete("ๅ‹•ไฝœๆœชๆคœ่จผ", false)] + public IEnumerator StartTimeLeft(MonoBehaviour obj, long endTime, Action callback) + { + IEnumerator enumerator = timeLeftCoroutine(callback, endTime, 0L); + obj.StartCoroutine(enumerator); + return enumerator; + } + + [Obsolete("ๅ‹•ไฝœๆœชๆคœ่จผ", false)] + public IEnumerator StartTimeLeft(MonoBehaviour obj, long endTime, long consumingTime, Action callback) + { + IEnumerator enumerator = timeLeftCoroutine(callback, endTime, consumingTime); + obj.StartCoroutine(enumerator); + return enumerator; + } + + [Obsolete("ๅ‹•ไฝœๆœชๆคœ่จผ", false)] + public string GetNowTimeString() + { + DateTime nowTime = GetNowTime(); + return $"{nowTime.Year:D4}-{nowTime.Month:D2}-{nowTime.Day:D2} {nowTime.Hour:D2}:{nowTime.Minute:D2}:{nowTime.Second:D2}"; + } + + [Obsolete("ๅ‹•ไฝœๆœชๆคœ่จผ", false)] + private TimeUtil.TimeLeftParam GetTimeLeft(long endTime, long consumingTime = 0L) + { + return TimeUtil.GetTimeLeft(TimeUtil.ToUnixTime(GetNowTime()), endTime, consumingTime); + } + + [Obsolete("ๅ‹•ไฝœๆœชๆคœ่จผ", false)] + private IEnumerator timeLeftCoroutine(Action callback, long endTime, long consumingTime = 0L) + { + while (true) + { + TimeUtil.TimeLeftParam timeLeft = GetTimeLeft(endTime, consumingTime); + callback(timeLeft); + if (timeLeft.isEnd) + { + break; + } + yield return null; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/TimeUtil.cs b/SVSim.BattleEngine/Engine/Cute/TimeUtil.cs new file mode 100644 index 0000000..2b0b5d3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/TimeUtil.cs @@ -0,0 +1,147 @@ +using System; + +namespace Cute; + +public class TimeUtil +{ + public struct TimeLeftParam + { + public int day; + + public int hour; + + public int minute; + + public int second; + + public int millisecond; + + public int count; + + public bool isEnd; + + public bool isCharge; + + public TimeLeftParam(long unixTime, long consumingTime) + { + if (unixTime <= 0) + { + isEnd = true; + count = 0; + day = 0; + hour = 0; + minute = 0; + second = 0; + millisecond = 0; + isCharge = true; + return; + } + isEnd = false; + if (consumingTime == 0L) + { + count = 0; + isCharge = false; + } + else + { + count = (int)(unixTime / consumingTime) + 1; + unixTime = unixTime - (count - 1) * consumingTime + 1; + if (unixTime == consumingTime) + { + isCharge = true; + } + else + { + isCharge = false; + } + } + day = (int)unixTime / 86400; + hour = (int)unixTime / 3600 % 24; + minute = (int)unixTime / 60 % 60; + second = (int)unixTime % 60; + millisecond = (int)unixTime % 1000; + } + + public override string ToString() + { + return $"ๅ›žๆ•ฐ{count:D2}ๆฎ‹ใ‚Š{day:D2}ๆ—ฅ {hour:D2}:{minute:D2}:{second:D2}"; + } + } + + private static readonly DateTime UNIX_EPOCH = new DateTime(1970, 1, 1, 0, 0, 0, 0); + + public const int DAY_HOUR = 24; + + public const int DAY_SECOND = 86400; + + public const int HOUR_SECOND = 3600; + + public const int MINUTE_SECOND = 60; + + public const int MILLI_SECOND = 1000; + + public static DateTime GetNowTime(long serverTime, long connectClientTime) + { + return UNIX_EPOCH.AddSeconds((float)serverTime + TimeNativePlugin.GetDeviceOperatingTime() - (float)connectClientTime).ToLocalTime(); + } + + public static DateTime GetNowTime_UTC(long serverTime, long connectClientTime) + { + return UNIX_EPOCH.AddSeconds((float)serverTime + TimeNativePlugin.GetDeviceOperatingTime() - (float)connectClientTime); + } + + public static DateTime GetAbsoluteTime() + { + return UNIX_EPOCH.AddSeconds(TimeNativePlugin.GetDeviceOperatingTime()); + } + + public static long ToUnixTime(string str) + { + if (str == null) + { + return 0L; + } + return ToUnixTime(DateTime.Parse(str)); + } + + public static long ToUnixTime(DateTime dateTime) + { + return (long)ToUnixTimeDouble(dateTime); + } + + public static double ToUnixTimeDouble(DateTime dateTime) + { + dateTime = dateTime.ToUniversalTime(); + return (dateTime - UNIX_EPOCH).TotalSeconds; + } + + public static DateTime FromUnixTime(long unixTime) + { + return UNIX_EPOCH.AddSeconds(Convert.ToDouble(unixTime)).ToLocalTime(); + } + + public static DateTime MicroTimeToFromUnixTime(long unixTime) + { + return FromUnixTime(unixTime / 1000); + } + + public static TimeLeftParam GetTimeLeft(long nowTime, long endTime, long consumingTime = 0L) + { + return new TimeLeftParam(endTime - nowTime, consumingTime); + } + + public static long GetElapsedTime(DateTime baseDateTime, DateTime dateTime) + { + return ToUnixTime(dateTime) - ToUnixTime(baseDateTime); + } + + public static TimeSpan GetElapsedTimeByTimeSpan(DateTime baseDateTime, DateTime dateTime) + { + return baseDateTime - dateTime; + } + + public static bool IsTermTime(string startDate, string endDate, long checkTime = 0L) + { + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/Toolbox.cs b/SVSim.BattleEngine/Engine/Cute/Toolbox.cs new file mode 100644 index 0000000..11f74e2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/Toolbox.cs @@ -0,0 +1,65 @@ +using System.Threading; + +namespace Cute; + +public class Toolbox +{ + private enum SYSTEM_INIT + { + SYSTEM_NOT_READY, + SYSTEM_READY + } + + public static bool isLoadFromLocal; + + public static bool isLoadLocalSound; + + public static BootSystem BootSystem; + + public static BootNetwork BootNetwork; + + public static SceneManager SceneManager; + + public static NetworkManager NetworkManager; + + public static AssetManager AssetManager; + + public static SavedataManager SavedataManager; + + public static DeviceManager DeviceManager; + + public static QualityManager QualityManager; + + public static ResourcesManager ResourcesManager; + + public static AudioManager AudioManager; + + public static MovieManager MovieManager; + + public static DebugManager DebugManager; + + public static Mutex mute; + + public static void Clear() + { + BootSystem = null; + BootNetwork = null; + SceneManager = null; + NetworkManager = null; + AssetManager = null; + SavedataManager = null; + DeviceManager = null; + QualityManager = null; + ResourcesManager = null; + AudioManager = null; + } + + public static bool isFrameWorkLoaded() + { + if (BootSystem != null && BootNetwork != null && SceneManager != null && NetworkManager != null && AssetManager != null && SavedataManager != null && DeviceManager != null && QualityManager != null && ResourcesManager != null && AudioManager != null) + { + return true; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/URLScheme.cs b/SVSim.BattleEngine/Engine/Cute/URLScheme.cs new file mode 100644 index 0000000..45dac98 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/URLScheme.cs @@ -0,0 +1,180 @@ +using UnityEngine; + +namespace Cute; + +public class URLScheme +{ + private enum CPTYPE + { + IORI = 1, + ALIVE + } + + private static string process = ""; + + private static string result = ""; + + private static string scheme = ""; + + private static int short_udid = 0; + + private static string udid = ""; + + private static string error_code = ""; + + private static string campaign_data = ""; + + private static int app_type = 0; + + private const string COMBINE = "combine"; + + private const string MIGRATION = "migration"; + + private const string OK = "ok"; + + private const string NG = "ng"; + + private const string IORI = "cg"; + + private const string ALIVE = "pc"; + + public const string EC_MIGRATION_CANCEL = "3070"; + + public const string EC_COMBINE_CANCEL = "3060"; + + public const string EC_MIGRATION_ALREADY_RECORDED = "3061"; + + public const string EC_COMBINE_NO_URL = "3054"; + + public const string EC_MIGRATION_NO_URL = "3063"; + + public const string EC_COMBINE_EXEC_HAVE_RECORD = "3057"; + + public static string CampaignData => campaign_data; + + public static int AppType => app_type; + + public static void URLSchemeStartAndroid() + { + GetURLSchemeParamsAndroid(); + ProcessSetting(); + } + + public static void URLSchemeStartiOS(string message) + { + GetURLSchemeParamsiOS(message); + ProcessSetting(); + } + + public static bool IsCombineOK() + { + if (process == "combine" && result == "ok") + { + return short_udid == Certification.ShortUdid; + } + return false; + } + + public static bool IsCombineNG() + { + if (process == "combine" && result == "ng") + { + return error_code != ""; + } + return false; + } + + public static bool IsMigrationOK() + { + if (process == "migration" && result == "ok") + { + return udid == Certification.Udid; + } + return false; + } + + public static bool IsMigrationNG() + { + if (process == "migration" && result == "ng") + { + return error_code != ""; + } + return false; + } + + public static bool IsMigrationFinished() + { + if (process == "migration" && result == "ng") + { + return error_code == "3061"; + } + return false; + } + + public static void Clear() + { + scheme = ""; + process = ""; + result = ""; + short_udid = 0; + udid = ""; + error_code = ""; + } + + public static void ClearCampaignData() + { + campaign_data = ""; + app_type = 0; + } + + private static void GetURLSchemeParamsAndroid() + { + Clear(); + } + + private static void GetURLSchemeParamsiOS(string url) + { + Clear(); + if (url == "") + { + url = PlayerPrefs.GetString("iOSUrlScheme", ""); + PlayerPrefs.DeleteKey("iOSUrlScheme"); + } + if (url.IndexOf("://") >= 0) + { + scheme = url.Substring(0, url.IndexOf("://")); + AnalysisResult(url.Substring(url.IndexOf("://") + 3)); + } + } + + private static void ProcessSetting() + { + if (!(scheme == "")) + { + if (IsCombineOK()) + { + DataMigration.CombineSucceed(); + } + else if (IsCombineNG()) + { + DataMigration.CombineFailed(); + } + else if (IsMigrationOK()) + { + DataMigration.MigrationSucceed(); + } + else if (IsMigrationNG()) + { + DataMigration.MigrationFailed(); + } + } + } + + private static void AnalysisResult(string host) + { + if (scheme == "shadowverse") + { + UIManager.GetInstance().AccountTransferHelper.GetAppleData(host); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/UpdateiCloudUserDataTask.cs b/SVSim.BattleEngine/Engine/Cute/UpdateiCloudUserDataTask.cs new file mode 100644 index 0000000..cdb709c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/UpdateiCloudUserDataTask.cs @@ -0,0 +1,47 @@ +using LitJson; + +namespace Cute; + +public class UpdateiCloudUserDataTask : NetworkTask +{ + private class iCloudUserParams : PostParams + { + public string carrier = ""; + + public string icloud_data = ""; + } + + private CuteNetworkDefine.ApiType apiType = CuteNetworkDefine.ApiType.MigrateiCloudUser; + + public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}"; + + public void SetParameter(string iCloudData) + { + iCloudUserParams iCloudUserParams = new iCloudUserParams(); + iCloudUserParams.icloud_data = iCloudData; + iCloudUserParams.carrier = Toolbox.DeviceManager.GetCarrier(); + base.Params = iCloudUserParams; + } + + protected override int Parse() + { + if (resultCode != 1) + { + return base.Parse(); + } + JsonData jsonData = base.ResponseData["data_headers"]; + int viewerId = jsonData["viewer_id"].ToInt(); + int shortUdid = jsonData["short_udid"].ToInt(); + string text = jsonData["udid"].ToString(); + if (Certification.Udid != text) + { + Debug.LogError("udidไธ€่‡ดใ—ใพใ›ใ‚“ใ€‚ไธๆญฃใฎใ‚ขใ‚ฏใ‚ปใ‚นใงใ™ใ€‚"); + } + else + { + Certification.ViewerId = viewerId; + Certification.ShortUdid = shortUdid; + } + return resultCode; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/WebViewManager.cs b/SVSim.BattleEngine/Engine/Cute/WebViewManager.cs new file mode 100644 index 0000000..e39779f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/WebViewManager.cs @@ -0,0 +1,276 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Wizard; + +namespace Cute; + +public class WebViewManager : MonoBehaviour +{ + private static WebViewManager instance; + + [SerializeField] + public WebViewScreen m_WebViewScreen; + + private Action onError; + + private Action onLoaded; + + private Vector4 marginNow; + + private float screenDpi; + + private bool screenDpiChangedWhileInvisible; + + private static readonly Dictionary FontFamilyDict = new Dictionary + { + { + Global.LANG_TYPE.Jpn.ToString(), + "font_jpn" + }, + { + Global.LANG_TYPE.Kor.ToString(), + "font_kor" + }, + { + Global.LANG_TYPE.Cht.ToString(), + "font_cht" + }, + { + Global.LANG_TYPE.Chs.ToString(), + "font_chs" + } + }; + + public Action Callback { get; set; } + + public static bool HasInstance => instance != null; + + public Action OnError + { + set + { + onError = value; + } + } + + public Action OnLoaded + { + set + { + onLoaded = value; + } + } + + public bool Visible { get; private set; } + + public Action OnDpiChangedAction { private get; set; } + + public static WebViewManager getInstance() + { + return instance; + } + + private void UpdateScreenDpi() + { + screenDpi = Screen.dpi; + } + + private bool IsScreenDpiChanged() + { + return Math.Abs(screenDpi - Screen.dpi) > 0.1f; + } + + private void Awake() + { + instance = this; + SetMargins(Screen.width / 30, Screen.height / 5, Screen.width / 30, Screen.height / 14); + UpdateScreenDpi(); + } + + private void OnLoadedCallback(string msg) + { + if (onLoaded != null) + { + onLoaded(msg); + } + } + + private string GetFontFamilyName() + { + if (!FontFamilyDict.TryGetValue(CustomPreference.GetTextLanguage(), out var value)) + { + return "font_alphabet"; + } + return value; + } + + private void OnErrorCallback(string error) + { + if (onError != null) + { + onError(error); + } + } + + private void OnApplicationFocus(bool focus) + { + if (focus && IsScreenDpiChanged()) + { + UpdateScreenDpi(); + if (Visible) + { + OnDpiChange(); + } + else + { + screenDpiChangedWhileInvisible = true; + } + } + } + + private void OnDpiChange() + { + if (OnDpiChangedAction != null) + { + OnDpiChangedAction(); + } + Vector4 marginBackCoroutine = marginNow; + SetMargins((int)marginBackCoroutine.x, (int)marginBackCoroutine.y, (int)marginBackCoroutine.z - 1, (int)marginBackCoroutine.w - 1); + StartCoroutine(SetMarginBackCoroutine(marginBackCoroutine)); + } + + private IEnumerator SetMarginBackCoroutine(Vector4 oldMargin) + { + yield return new WaitForSecondsRealtime(0.5f); + SetMargins((int)oldMargin.x, (int)oldMargin.y, (int)oldMargin.z, (int)oldMargin.w); + } + + public void ClearFontFilePaths() + { + } + + private void OnDestroy() + { + instance = null; + ClearFontFilePaths(); + } + + public void InitCustomFontFileInfo(Dictionary fileNamePathDict, int currentCustomFontFileIndex) + { + } + + private void InitIOSCustomFont() + { + } + + private void DisableIOSCustomFont() + { + } + + public void OpenWeb(string url) + { + m_WebViewScreen.CurBoxCollider.enabled = true; + SetMargins(UIManager.GetInstance().UIManagerRoot, m_WebViewScreen); + LoadWeb(url); + SetVisible(visible: true); + } + + public void LoadWeb(string url) + { + } + + public void ClearHistory() + { + } + + public void SetMargins(int leftMargin, int topMargin, int rightMargin, int bottomMargin) + { + marginNow = new Vector4(leftMargin, topMargin, rightMargin, bottomMargin); + } + + public void SetMargins(UIRoot trgUIRoot, WebViewScreen trgScreen) + { + float arg = trgUIRoot.activeHeight; + Func func = delegate(float deviceSize, float activeScreenSize, float screenSize, float pos) + { + screenSize += pos * 2f; + screenSize /= activeScreenSize; + screenSize = 1f - screenSize; + return (int)(screenSize * deviceSize * 0.5f); + }; + Vector2 deviceResolution = Toolbox.QualityManager.deviceResolution; + float num = Mathf.Max(deviceResolution.x, deviceResolution.y); + BoxCollider curBoxCollider = trgScreen.CurBoxCollider; + int num2 = (int)(num - num * AspectCamera.SafeAreaRate); + int num3 = (int)(num * AspectCamera.SafeAreaRate) / 30 + num2 / 2; + int rightMargin = num3; + int topMargin = func(deviceResolution.y, arg, curBoxCollider.size.y, curBoxCollider.center.y); + int bottomMargin = func(deviceResolution.y, arg, curBoxCollider.size.y, 0f - curBoxCollider.center.y); + getInstance().SetMargins(num3, topMargin, rightMargin, bottomMargin); + } + + public void UnloadWebView() + { + m_WebViewScreen.CurBoxCollider.enabled = false; + SetVisible(visible: false); + LoadWeb(CustomPreference.GetApplicationServerURL() + "information/blank"); + Callback = null; + OnLoaded = null; + OnError = null; + } + + public void DestroyWebViewObject() + { + } + + public void EvaluateJS(string js) + { + } + + public void SetVisible(bool visible) + { + Visible = visible; + if (visible && screenDpiChangedWhileInvisible) + { + screenDpiChangedWhileInvisible = false; + OnDpiChange(); + } + } + + public void ClearCaches() + { + } + + public void Reload() + { + } + + public bool CanGoBack() + { + return false; + } + + public void GoBack() + { + } + + public void Screenshot() + { + } + + public void SetScreenshotData(int width, int height) + { + } + + public void SetCallback(Action cb) + { + Callback = cb; + } + + public void CacheClear() + { + LoadWeb(CustomPreference.GetApplicationServerURL() + "information/blank"); + } +} diff --git a/SVSim.BattleEngine/Engine/Debug.cs b/SVSim.BattleEngine/Engine/Debug.cs new file mode 100644 index 0000000..5463c2a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Debug.cs @@ -0,0 +1,129 @@ +using System; +using System.Diagnostics; +using UnityEngine; +using Wizard; + +public static class Debug +{ + public static bool isDebugBuild => UnityEngine.Debug.isDebugBuild; + + [Conditional("CYG_DEBUG")] + public static void Assert(bool condition) + { + } + + [Conditional("CYG_DEBUG")] + public static void Assert(bool condition, string message) + { + } + + [Conditional("CYG_DEBUG")] + public static void Assert(bool condition, string format, params object[] args) + { + } + + [Conditional("CYG_DEBUG")] + public static void Break() + { + } + + [Conditional("CYG_DEBUG")] + public static void ClearDeveloperConsole() + { + } + + [Conditional("CYG_DEBUG")] + public static void DrawLine(Vector3 start, Vector3 end) + { + } + + [Conditional("CYG_DEBUG")] + public static void DrawLine(Vector3 start, Vector3 end, Color color) + { + } + + [Conditional("CYG_DEBUG")] + public static void DrawLine(Vector3 start, Vector3 end, Color color, float duration) + { + } + + [Conditional("CYG_DEBUG")] + public static void DrawLine(Vector3 start, Vector3 end, Color color, float duration, bool depthTest) + { + } + + [Conditional("CYG_DEBUG")] + public static void DrawRay(Vector3 start, Vector3 dir) + { + } + + [Conditional("CYG_DEBUG")] + public static void DrawRay(Vector3 start, Vector3 dir, Color color) + { + } + + [Conditional("CYG_DEBUG")] + public static void DrawRay(Vector3 start, Vector3 dir, Color color, float duration) + { + } + + [Conditional("CYG_DEBUG")] + public static void DrawRay(Vector3 start, Vector3 dir, Color color, float duration, bool depthTest) + { + } + + [Conditional("CYG_DEBUG")] + public static void Log(object message, UnityEngine.Object context = null) + { + } + + [Conditional("CYG_DEBUG")] + public static void LogFormat(string format, params object[] args) + { + } + + [Conditional("CYG_DEBUG")] + public static void LogFormat(UnityEngine.Object context, string format, params object[] args) + { + } + + public static void LogError(object message, UnityEngine.Object context = null) + { + LocalLog.AccumulateTraceLog(message.ToString()); + } + + public static void LogErrorFormat(string format, params object[] args) + { + LocalLog.AccumulateTraceLog(format.ToString()); + } + + public static void LogErrorFormat(UnityEngine.Object context, string format, params object[] args) + { + LocalLog.AccumulateTraceLog(context.ToString() + "Context:" + context.ToString() + "Params:" + args.ToString()); + } + + public static void LogException(Exception exception) + { + LocalLog.AccumulateTraceLog(exception.ToString()); + } + + public static void LogException(Exception exception, UnityEngine.Object context) + { + LocalLog.AccumulateTraceLog(exception.ToString() + "Context:" + context.ToString()); + } + + [Conditional("CYG_DEBUG")] + public static void LogWarning(object message, UnityEngine.Object context = null) + { + } + + [Conditional("CYG_DEBUG")] + public static void LogWarningFormat(string format, params object[] args) + { + } + + [Conditional("CYG_DEBUG")] + public static void LogWarningFormat(UnityEngine.Object context, string format, params object[] args) + { + } +} diff --git a/SVSim.BattleEngine/Engine/DeckDecisionUI.cs b/SVSim.BattleEngine/Engine/DeckDecisionUI.cs new file mode 100644 index 0000000..9782d42 --- /dev/null +++ b/SVSim.BattleEngine/Engine/DeckDecisionUI.cs @@ -0,0 +1,245 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Dialog.Setting; +using Wizard.RoomMatch; + +public class DeckDecisionUI : MonoBehaviour +{ + [SerializeField] + private UILabel _textForOneLine; + + [SerializeField] + private UILabel _descTextLabel; + + [SerializeField] + private UILabel _deckNameTextLabel; + + [SerializeField] + private ItemToggle m_simpleStageToggle; + + [SerializeField] + private GameObject _uiCardListPrefab; + + [SerializeField] + private GameObject _cardDetailPrefab; + + [SerializeField] + private UILabel _optionLabel; + + protected List _loadCardAssetList; + + private bool _textSetEnd; + + protected static int DetailLayer; + + protected const float CARD_DETAIL_Z = -300f; + + private ConventionDeckList conventionDeckList; + + public bool IsCanShowQRCode = true; + + private IFormatBehavior _formatBehavior; + + public DeckData DeckData { get; private set; } + + public string DeckName { get; set; } + + public UILabel OptionLabel => _optionLabel; + + public Action CardListCustomize { get; set; } + + protected CardDetailUI CardDetail { get; set; } + + protected UICardList UiCardList { get; set; } + + public Action CardDetailCustomize { get; set; } + + public bool IsShowSimpleStageOption { get; set; } + + public void SetDeckData(DeckData deck, ConventionDeckList deckList) + { + DeckData = deck; + conventionDeckList = deckList; + _formatBehavior = FormatBehaviorManager.Create(deck.Format, deckList); + } + + public virtual void Start() + { + DetailLayer = LayerMask.NameToLayer("MyPage"); + UIWidget component = GetComponent(); + if (!_textSetEnd) + { + _descTextLabel.text = Data.SystemText.Get("Card_0006"); + _deckNameTextLabel.text = Data.SystemText.Get("Card_0299", DeckName); + SetTextLabelesState(string.IsNullOrEmpty(_descTextLabel.text), string.IsNullOrEmpty(_deckNameTextLabel.text)); + } + if (IsShowSimpleStageOption) + { + SettingToggle_SimpleStage(); + component.pivot = UIWidget.Pivot.Center; + } + else + { + m_simpleStageToggle.gameObject.SetActive(value: false); + component.pivot = UIWidget.Pivot.Bottom; + } + } + + public void SetText(string descText, string cardDeckText) + { + _textForOneLine.text = descText; + _descTextLabel.text = descText; + _deckNameTextLabel.text = cardDeckText; + SetTextLabelesState(string.IsNullOrEmpty(descText), string.IsNullOrEmpty(cardDeckText)); + _textSetEnd = true; + } + + protected void OnDestroy() + { + if (_loadCardAssetList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadCardAssetList); + _loadCardAssetList = null; + } + if (UiCardList != null) + { + UnityEngine.Object.Destroy(UiCardList.gameObject); + UiCardList = null; + } + if (CardDetail != null) + { + UnityEngine.Object.Destroy(CardDetail.gameObject); + CardDetail = null; + } + } + + protected ItemToggle SettingToggle_SimpleStage(bool isSperatorUse = true) + { + SystemText systemText = Data.SystemText; + ItemToggle item = m_simpleStageToggle; + item.SetTitleLabel(systemText.Get("OtherConfig_0022")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SIMPLE_STAGE)); + item.AddChangeCallback(delegate + { + bool value = item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SIMPLE_STAGE, value); + }); + if (isSperatorUse) + { + item.SetActive_SeparatorLine(isActive: true); + } + return item; + } + + public void OnClickCreateCardList() + { + CheckTimeSlipRotationPeriodTask task = new CheckTimeSlipRotationPeriodTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + UIManager.GetInstance().createInSceneCenterLoading(); + if (CardDetail == null) + { + CardDetail = UnityEngine.Object.Instantiate(_cardDetailPrefab).GetComponent(); + CardDetail.transform.parent = base.transform.parent.parent; + CardDetail.transform.localPosition = new Vector3(0f, 0f, -300f); + CardDetail.transform.localScale = Vector3.one; + CardDetail.Initialize(DetailLayer, _formatBehavior.CardMasterId, _formatBehavior); + CardDetail.IsShowFlavorTextButton = true; + CardDetail.IsShowVoiceButton = true; + CardDetail.IsShowEvolutionButton = true; + CardDetail.IsCardTextDialogLayerSet = false; + CardDetailCustomize.Call(CardDetail); + UIManager.GetInstance().SetLayerRecursive(CardDetail.gameObject.transform, DetailLayer); + } + if (UiCardList == null) + { + bool in_DetailCameraUse = false; + UiCardList = UnityEngine.Object.Instantiate(_uiCardListPrefab).GetComponent(); + UIManager.ViewScene currentScene = UIManager.GetInstance().GetCurrentScene(); + if (currentScene != UIManager.ViewScene.MyPage && currentScene != UIManager.ViewScene.QuestSelectionPage) + { + in_DetailCameraUse = true; + } + else + { + UiCardList.SetCamera(UIManager.GetInstance().MyPageUICameraObj.GetComponent()); + } + int in_MaxCardNum = 40; + if (DeckData.Format == Format.Windfall) + { + in_MaxCardNum = 35; + } + UiCardList.Init(base.transform.parent.parent.gameObject, CardDetail, null, DeckViewClose, LayerMask.LayerToName(DetailLayer), in_DetailCameraUse, null, in_MaxCardNum); + UiCardList.SetActive(in_Active: false); + } + CardListCustomize.Call(UiCardList); + CardDetail.gameObject.SetActive(value: false); + StartCoroutine(CardLoadCoroutine(DeckData)); + })); + } + + private IEnumerator CardLoadCoroutine(DeckData inDeckData) + { + RoomBase.StartDialogLoading(); + IList cardIdList = inDeckData.GetCardIdList(); + inDeckData.GetDeckName(); + UiCardList.RemoveData(); + UiCardList._loadingEnd = false; + _loadCardAssetList = UiCardList.GetLoadFileList(cardIdList as List); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadCardAssetList, null)); + UiCardList.SetDeck(inDeckData, conventionDeckList); + yield return null; + DialogSetDisp(inDisp: false); + if (IsCanShowQRCode) + { + UiCardList.SetQRSmallTexture(); + } + UiCardList.SetActive(in_Active: true); + UIManager.GetInstance().closeInSceneCenterLoading(); + UiCardList._loadingEnd = true; + RoomBase.FinishDiloagLoading(); + } + + protected void DeckViewClose() + { + UiCardList.SetActive(in_Active: false); + if (_loadCardAssetList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadCardAssetList); + _loadCardAssetList = null; + } + DialogSetDisp(inDisp: true); + UnityEngine.Object.Destroy(UiCardList.gameObject); + UnityEngine.Object.Destroy(CardDetail.gameObject); + UiCardList = null; + CardDetail = null; + } + + protected void DialogSetDisp(bool inDisp) + { + UIManager.GetInstance().ActiveChangeDialogAll(inDisp); + } + + private void SetTextLabelesState(bool noDescText, bool noDeckNameText) + { + if (noDescText && noDeckNameText) + { + _textForOneLine.gameObject.SetActive(value: false); + _descTextLabel.gameObject.SetActive(value: false); + _deckNameTextLabel.gameObject.SetActive(value: false); + } + else if (noDeckNameText) + { + _descTextLabel.gameObject.SetActive(value: false); + _deckNameTextLabel.gameObject.SetActive(value: false); + } + else + { + _textForOneLine.gameObject.SetActive(value: false); + } + } +} diff --git a/SVSim.BattleEngine/Engine/DegreeInfo.cs b/SVSim.BattleEngine/Engine/DegreeInfo.cs new file mode 100644 index 0000000..1374669 --- /dev/null +++ b/SVSim.BattleEngine/Engine/DegreeInfo.cs @@ -0,0 +1,4 @@ +public class DegreeInfo : HeaderData +{ + public DegreeInfoDetail data; +} diff --git a/SVSim.BattleEngine/Engine/DegreeInfoDetail.cs b/SVSim.BattleEngine/Engine/DegreeInfoDetail.cs new file mode 100644 index 0000000..48df8aa --- /dev/null +++ b/SVSim.BattleEngine/Engine/DegreeInfoDetail.cs @@ -0,0 +1,6 @@ +using System.Collections.Generic; + +public class DegreeInfoDetail +{ + public List user_degree_list; +} diff --git a/SVSim.BattleEngine/Engine/DepthBlurAndBloom.cs b/SVSim.BattleEngine/Engine/DepthBlurAndBloom.cs new file mode 100644 index 0000000..82763c7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/DepthBlurAndBloom.cs @@ -0,0 +1,46 @@ +public class DepthBlurAndBloom +{ + public enum DofFocalType + { + Transform, + Position, + Point + } + + public enum DofBlur + { + Horizon, + Mixed, + Disc, + BallBlur + } + + public enum DofQuality + { + OnlyBackground = 1, + BackgroundAndForeground = 5 + } + + public enum DofTransformTarget + { + Character0, + Character1, + Character2, + Character3, + Character4, + Character5, + Character6, + Character7, + Character8, + Character9, + Character10, + Character11, + Character12, + Character13, + Character14, + Character15, + Character16, + Character17, + Character18 + } +} diff --git a/SVSim.BattleEngine/Engine/DialogSupport.cs b/SVSim.BattleEngine/Engine/DialogSupport.cs new file mode 100644 index 0000000..9373aa7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/DialogSupport.cs @@ -0,0 +1,133 @@ +using Cute; +using UnityEngine; +using UnityEngine.Networking; +using Wizard; + +public class DialogSupport : MonoBehaviour +{ + private enum Info + { + UserId, + AppVersion, + OsVersion, + Device + } + + [SerializeField] + private UITable _table; + + private GameObject[] _items; + + private const string CHECK_ON = "btn_check_on"; + + private const string CHECK_OFF = "btn_check_off"; + + private const string USERID = "&userid="; + + private const string APPVERSION = "&appver="; + + private const string OSVERSION = "&osver="; + + private const string DEVICE = "&device="; + + private const string ERRORCODE = "&errorcode="; + + private const string COUNTRY = "&country="; + + private const string CITY = "&city="; + + public string ErrorCode { get; set; } + + public static DialogBase Create(string errorCode = null) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.XL); + SystemText systemText = Data.SystemText; + dialogBase.SetTitleLabel(systemText.Get("Contact_Dialog_001_Header")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetButtonText(systemText.Get("Contact_Dialog_001_Button")); + GameObject gameObject = Object.Instantiate(UIManager.GetInstance().SupportDialogPrefab); + dialogBase.SetObj(gameObject); + DialogSupport ds = gameObject.GetComponent(); + ds.ErrorCode = errorCode; + dialogBase.onPushButton1 = delegate + { + string url = ds.GetUrl(); + UIManager.GetInstance().WebViewHelper.PrepareOpenUrl(delegate + { + LocalLog.SendAllClientTraceLog(delegate + { + BrowserURL.Open(url); + }); + }); + }; + return dialogBase; + } + + public void Start() + { + string[] array = new string[4] { "Contact_Dialog_002", "Contact_Dialog_003", "Contact_Dialog_004", "Contact_Dialog_001_dmm" }; + int childCount = _table.transform.childCount; + _items = new GameObject[childCount]; + for (int i = 0; i < childCount; i++) + { + _items[i] = _table.transform.GetChild(i).gameObject; + UIButton bt = _items[i].GetComponentInChildren(); + UISprite sp = _items[i].GetComponentInChildren(); + _items[i].GetComponentInChildren().text = Data.SystemText.Get(array[i]); + bt.onClick.Add(new EventDelegate(delegate + { + if (sp.spriteName == "btn_check_off") + { + bt.normalSprite = "btn_check_on"; + bt.pressedSprite = "btn_check_off"; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + } + else + { + bt.normalSprite = "btn_check_off"; + bt.pressedSprite = "btn_check_on"; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_OFF); + } + })); + } + } + + private bool IsChecked(Info info) + { + if ((int)info >= _items.Length) + { + return false; + } + return _items[(int)info].GetComponentInChildren().normalSprite == "btn_check_on"; + } + + public string GetUrl() + { + string key = "URL_0013_steam"; + string text = Data.SystemText.Get(key); + if (IsChecked(Info.UserId) && PlayerStaticData.UserViewerID != 0) + { + text = text + "&userid=" + PlayerStaticData.UserViewerID; + } + if (IsChecked(Info.AppVersion)) + { + text = text + "&appver=" + Toolbox.DeviceManager.GetAppVersionName(); + } + if (IsChecked(Info.OsVersion)) + { + string osVersion = Toolbox.DeviceManager.GetOsVersion(); + text = text + "&osver=" + UnityWebRequest.EscapeURL(osVersion); + } + if (IsChecked(Info.Device)) + { + text = text + "&device=" + UnityWebRequest.EscapeURL(Toolbox.DeviceManager.GetDeviceName()); + text += UnityWebRequest.EscapeURL("/" + Toolbox.DeviceManager.GetGraphicsDeviceName()); + } + if (ErrorCode != null) + { + text = text + "&errorcode=" + ErrorCode; + } + return text; + } +} diff --git a/SVSim.BattleEngine/Engine/DoMatchingBase.cs b/SVSim.BattleEngine/Engine/DoMatchingBase.cs new file mode 100644 index 0000000..c0cd367 --- /dev/null +++ b/SVSim.BattleEngine/Engine/DoMatchingBase.cs @@ -0,0 +1,103 @@ +using System.Collections.Generic; +using LitJson; +using Wizard; + +public class DoMatchingBase : BaseTask +{ + public class DoMatchingTaskParam : BaseParam + { + public int deck_no; + + public int need_init; + + public int log; + + public List excluded_field_id_list; + + public int use_stage_select; + + public int is_default_skin; + + public DoMatchingTaskParam(int deckNo, int needInit, int logdType) + { + deck_no = deckNo; + need_init = needInit; + log = logdType; + excluded_field_id_list = PlayerPrefsWrapper.CreateServerSendStageOffList(); + use_stage_select = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.USE_OFF_STAGE); + is_default_skin = (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_OPPONENT_DEFAULT_SKIN) ? 1 : 0); + } + } + + public class DoMatchingTaskIncludeCardMasterHashParam : DoMatchingTaskParam + { + public string card_master_hash; + + public DoMatchingTaskIncludeCardMasterHashParam(int deckNo, int needInit, int logdType) + : base(deckNo, needInit, logdType) + { + card_master_hash = CardMasterLocalFileUtility.GetCardMasterHash(); + } + } + + public DoMatchingBase() + { + SkipCuteTimeOutPopup(); + SkipCuteHttpStatusErrorPopup(); + SkipAllCuteResultCodeCheckErrorPopup(); + } + + public virtual void SetParameter(int deck_no, int need_init, int log, bool includeCardMasterHash = false) + { + base.Params = ((need_init == 1 || includeCardMasterHash) ? new DoMatchingTaskIncludeCardMasterHashParam(deck_no, need_init, log) : new DoMatchingTaskParam(deck_no, need_init, log)); + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + if (base.ResponseData["data"].Keys.Contains("feature_maintenance_list")) + { + List list = new List(); + for (int i = 0; i < base.ResponseData["data"]["feature_maintenance_list"].Count; i++) + { + list.Add((NetworkDefine.MAINTENANCE_TYPE)base.ResponseData["data"]["feature_maintenance_list"][i].ToInt()); + } + Data.UpdateMaintenance(new List + { + NetworkDefine.MAINTENANCE_TYPE.REPLAY_ALL, + NetworkDefine.MAINTENANCE_TYPE.NEWREPLAY_ALL, + NetworkDefine.MAINTENANCE_TYPE.NEWREPLAY_EXCLUDE_ROTATION, + NetworkDefine.MAINTENANCE_TYPE.NEWREPLAY_RECORD + }, list); + } + SettingCardMasterId(base.ResponseData["data"]); + return num; + } + + private void SettingCardMasterId(JsonData jsonData) + { + int num = jsonData["matching_state"].ToInt(); + if (num == 3004 || num == 3007 || num == 3011) + { + CardMaster.SetBattleCardMasterId(jsonData["card_master_id"].ToInt()); + } + } + + protected void SettingDoMatchingData() + { + Data.DoMatchingDetail.data = new DoMatchingDetail(); + Data.DoMatchingDetail.data.matchingState = base.ResponseData["data"]["matching_state"].ToInt(); + Data.DoMatchingDetail.data.timeoutPeriod = base.ResponseData["data"]["timeout_period"].ToInt(); + Data.DoMatchingDetail.data.retryPeriod = base.ResponseData["data"]["retry_period"].ToInt(); + Data.DoMatchingDetail.data.battleId = (base.ResponseData["data"].Keys.Contains("battle_id") ? base.ResponseData["data"]["battle_id"].ToString() : ""); + Data.DoMatchingDetail.data.nodeServerUrl = base.ResponseData["data"]["node_server_url"].ToString(); + if (base.ResponseData["data"].Keys.Contains("mission_parameter")) + { + GameMgr.GetIns().GetDataMgr().SetMissionNecessaryInformation(base.ResponseData["data"]["mission_parameter"]); + } + } +} diff --git a/SVSim.BattleEngine/Engine/DoMatchingData.cs b/SVSim.BattleEngine/Engine/DoMatchingData.cs new file mode 100644 index 0000000..c78c2ed --- /dev/null +++ b/SVSim.BattleEngine/Engine/DoMatchingData.cs @@ -0,0 +1,4 @@ +public class DoMatchingData : HeaderData +{ + public DoMatchingDetail data; +} diff --git a/SVSim.BattleEngine/Engine/DoMatchingDetail.cs b/SVSim.BattleEngine/Engine/DoMatchingDetail.cs new file mode 100644 index 0000000..5c7393d --- /dev/null +++ b/SVSim.BattleEngine/Engine/DoMatchingDetail.cs @@ -0,0 +1,41 @@ +public class DoMatchingDetail +{ + public int matchingState; + + public int timeoutPeriod; + + public int retryPeriod; + + public string battleId; + + public string nodeServerUrl; + + public int finishLoadTask_MatchingState; + + public bool isEnableWinnerReward { get; private set; } + + public int winnerRewardGrade { get; private set; } + + public string winnerRewardMessage { get; private set; } + + public long GetBattleId() + { + if (string.IsNullOrEmpty(battleId)) + { + return -1L; + } + return long.Parse(battleId); + } + + public void SetWinnerRewardInfo(int grade, string message) + { + isEnableWinnerReward = true; + winnerRewardMessage = message; + winnerRewardGrade = grade; + } + + public void ClearWinnerRewardInfo() + { + isEnableWinnerReward = false; + } +} diff --git a/SVSim.BattleEngine/Engine/DofDiffusionBloomOverlayParam.cs b/SVSim.BattleEngine/Engine/DofDiffusionBloomOverlayParam.cs new file mode 100644 index 0000000..c83f446 --- /dev/null +++ b/SVSim.BattleEngine/Engine/DofDiffusionBloomOverlayParam.cs @@ -0,0 +1,295 @@ +using System; +using UnityEngine; + +[Serializable] +public class DofDiffusionBloomOverlayParam +{ + public enum DofDiffusionBloomType + { + None, + DofBloom, + DiffusionDofBloom, + Bloom, + DiffusionBloom, + Dof, + OldDof, + OldDofFastBloom, + OverlayOnly + } + + public enum BloomScreenBlendMode + { + Screen, + Add + } + + [SerializeField] + private DofDiffusionBloomType _useDofDiffusionBloomType; + + [SerializeField] + private bool _isEnableOldDof; + + [SerializeField] + private bool _isEnableDof; + + [SerializeField] + private bool _isEnableDiffusion; + + [SerializeField] + private bool _isEnableBloom = true; + + [Header("Rich DOF")] + public DepthBlurAndBloom.DofQuality DofQualityType = DepthBlurAndBloom.DofQuality.OnlyBackground; + + public DepthBlurAndBloom.DofFocalType DofFocalType = DepthBlurAndBloom.DofFocalType.Position; + + [SerializeField] + private Transform _dofFocalTransfrom; + + [SerializeField] + private Vector3 _dofFocalPosition = Vector3.zero; + + [SerializeField] + private float _dofFocalPoint = 1f; + + public float DofSmoothness = 0.5f; + + public float DofFocalSize = 4f; + + public float DofMaxFocalSize; + + public float DofMaxBlurSpread = 1.75f; + + [SerializeField] + public float DofForegroundSize; + + [SerializeField] + public DepthBlurAndBloom.DofBlur DofBlurType; + + [Range(0f, 1f)] + [Header("Rich Bloom")] + public float BloomDofWeight = 1f; + + [Range(0f, 1.5f)] + public float BloomThreshold = 0.95f; + + [Range(0f, 15f)] + public float BloomIntensity = 8f; + + [Range(0f, 10f)] + public float BloomBlurSize = 2f; + + public BloomScreenBlendMode BloomBlendMode; + + [Range(0.1f, 10f)] + [Header("Diffusion")] + public float DiffusionBlurSize = 10f; + + [Range(0f, 2f)] + public float DiffusionBright = 1f; + + [Range(0f, 1f)] + public float DiffusionThreshold = 0.4f; + + [SerializeField] + [Range(0f, 2f)] + public float DiffusionSaturation = 1.2f; + + [SerializeField] + [Range(0f, 2f)] + public float DiffusionContrast = 1f; + + [NonSerialized] + public float DefaultDiffusionThreshold = 0.4f; + + [Range(0f, 1f)] + public float EndDiffusionThreshold = 0.8f; + + [Range(0f, 85f)] + public int FadeOutStartFrame = 82; + + [Range(0f, 85f)] + public int FadeOutEndFrame = 82; + + [NonSerialized] + public Camera TargetCamera; + + private float _ballBlurPoewrFactor; + + private float _ballBlurBrightnessThreshhold = 1f; + + private float _ballBlurBrightnessIntensity = -1f; + + private float _ballBlurSpread = 1f; + + private bool _isPointBallBlur; + + [SerializeField] + [Header("ScreenOverlay")] + private Class3dScreenOverlay _screenOverlay = new Class3dScreenOverlay(); + + public bool IsDOF; + + public bool IsBloom; + + public bool IsDiffution; + + public bool IsScreenOverlay; + + public bool IsEnable => _useDofDiffusionBloomType != DofDiffusionBloomType.None; + + public DofDiffusionBloomType UseDofDiffusionBloomType => _useDofDiffusionBloomType; + + public bool IsEnableOldDof + { + get + { + return _isEnableOldDof; + } + set + { + _isEnableOldDof = value; + } + } + + public bool IsEnableDof + { + get + { + return _isEnableDof; + } + set + { + _isEnableDof = value; + } + } + + public bool IsEnableDiffusion + { + get + { + return _isEnableDiffusion; + } + set + { + _isEnableDiffusion = value; + } + } + + public bool IsEnableBloom + { + get + { + return _isEnableBloom; + } + set + { + _isEnableBloom = value; + } + } + + public bool IsEnableOverlay => ScreenOverlay.IsEnable; + + public bool IsEnableDofAutoDisable { get; set; } = true; + + public Transform DofFocalTransfrom + { + get + { + return _dofFocalTransfrom; + } + set + { + _dofFocalTransfrom = value; + DofFocalType = DepthBlurAndBloom.DofFocalType.Transform; + } + } + + public Vector3 DofFocalPosition + { + get + { + return _dofFocalPosition; + } + set + { + _dofFocalPosition = value; + DofFocalType = DepthBlurAndBloom.DofFocalType.Position; + } + } + + public float DofFocalPoint + { + get + { + return _dofFocalPoint; + } + set + { + _dofFocalPoint = value; + DofFocalType = DepthBlurAndBloom.DofFocalType.Point; + } + } + + public float BallBlurPowerFactor + { + get + { + return _ballBlurPoewrFactor; + } + set + { + _ballBlurPoewrFactor = value; + } + } + + public float BallBlurBrightnessThreshhold + { + get + { + return _ballBlurBrightnessThreshhold; + } + set + { + _ballBlurBrightnessThreshhold = value; + } + } + + public float BallBlurBrightnessIntensity + { + get + { + return _ballBlurBrightnessIntensity; + } + set + { + _ballBlurBrightnessIntensity = value; + } + } + + public float BallBlurSpread + { + get + { + return _ballBlurSpread; + } + set + { + _ballBlurSpread = value; + } + } + + public bool IsPointBallBlur + { + get + { + return _isPointBallBlur; + } + set + { + _isPointBallBlur = value; + } + } + + public Class3dScreenOverlay ScreenOverlay => _screenOverlay; +} diff --git a/SVSim.BattleEngine/Engine/Effect.cs b/SVSim.BattleEngine/Engine/Effect.cs new file mode 100644 index 0000000..8ad99d1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Effect.cs @@ -0,0 +1,305 @@ +using CriWare; +using UnityEngine; + +public class Effect : MonoBehaviour +{ + private EffectMgr.EffectType m_Type; + + private GameObject m_GameObjIns; + + private ParticleSystem m_ParticleSystem; + + private Vector3 m_Pos; + + private bool m_Use; + + private GameObject m_ChaseObjIns; + + private GameObject m_LookAtObject; + + private bool _buff; + + private CriAtomSource m_EffectSeSource; + + private Camera _lookAtCamera; + + private bool _isFollowScale; + + public Effect() + { + m_Type = EffectMgr.EffectType.NONE; + m_GameObjIns = null; + m_Use = false; + m_Pos = new Vector3(0f, 0f, -3f); + _buff = false; + } + + public void Init(EffectMgr.EffectType type, bool isCommon = false, string SePath = "", bool isFollowScale = false) + { + m_Type = type; + if (!string.IsNullOrEmpty(SePath)) + { + m_EffectSeSource = base.gameObject.GetComponent(); + m_EffectSeSource.use3dPositioning = true; + m_EffectSeSource.playOnStart = false; + } + m_GameObjIns = base.gameObject; + m_ParticleSystem = m_GameObjIns.GetComponent(); + m_ParticleSystem.GetComponent().sortingOrder = 4; + if (isCommon) + { + m_ParticleSystem.Stop(); + } + _isFollowScale = isFollowScale; + } + + public void Play(Vector3 Pos, Quaternion Rot) + { + m_Pos = Pos; + m_GameObjIns.transform.position = m_Pos; + m_GameObjIns.transform.rotation = Rot; + On(); + m_GameObjIns.SetActive(value: true); + m_ParticleSystem.Play(); + if (m_EffectSeSource != null) + { + m_EffectSeSource.Play(); + } + } + + public void Play(Vector3 Pos) + { + m_Pos = Pos; + m_GameObjIns.transform.position = m_Pos; + On(); + m_GameObjIns.SetActive(value: true); + m_ParticleSystem.Play(); + if (m_EffectSeSource != null) + { + m_EffectSeSource.Play(); + } + } + + public void Play(Vector3 Pos, GameObject obj) + { + m_ChaseObjIns = obj; + if (obj != null) + { + _buff = true; + } + m_Pos = Pos; + m_GameObjIns.transform.position = m_Pos; + On(); + m_GameObjIns.SetActive(value: true); + m_ParticleSystem.Play(); + if (m_EffectSeSource != null) + { + m_EffectSeSource.Play(); + } + } + + public void Play(float PosX, float PosY, float PosZ) + { + m_Pos.x = PosX; + m_Pos.y = PosY; + m_Pos.z = PosZ; + m_GameObjIns.transform.position = m_Pos; + On(); + m_GameObjIns.SetActive(value: true); + m_ParticleSystem.Play(); + if (m_EffectSeSource != null) + { + m_EffectSeSource.Play(); + } + } + + public void Play(float PosX, float PosY) + { + m_Pos.x = PosX; + m_Pos.y = PosY; + m_GameObjIns.transform.position = m_Pos; + On(); + m_GameObjIns.SetActive(value: true); + m_ParticleSystem.Play(); + if (m_EffectSeSource != null) + { + m_EffectSeSource.Play(); + } + } + + public void Play() + { + On(); + m_GameObjIns.SetActive(value: true); + m_ParticleSystem.Play(); + } + + public void FadeOut() + { + m_ParticleSystem.Stop(); + } + + public void FadeIn() + { + On(); + m_ParticleSystem.Play(); + } + + public void Stop() + { + Off(); + m_GameObjIns.SetActive(value: false); + m_ParticleSystem.Stop(); + } + + public void PlayBuff(GameObject obj) + { + m_Pos = obj.transform.position; + m_GameObjIns.transform.position = m_Pos; + m_ChaseObjIns = obj; + _buff = true; + On(); + UpdatePositionAndRotation(); + m_GameObjIns.SetActive(value: true); + m_ParticleSystem.Play(); + } + + public void StopBuff() + { + m_ChaseObjIns = null; + _buff = false; + Off(); + m_GameObjIns.SetActive(value: false); + m_ParticleSystem.Stop(); + } + + public void StartLookAtEffect(GameObject fromObject, GameObject toObject) + { + m_ChaseObjIns = fromObject; + m_LookAtObject = toObject; + _buff = true; + On(); + UpdatePositionAndRotation(); + m_GameObjIns.SetActive(value: true); + m_ParticleSystem.Play(); + } + + public void StartLookAtCameraEffect(GameObject fromObject, Camera toCamera) + { + m_ChaseObjIns = fromObject; + _lookAtCamera = toCamera; + _buff = true; + On(); + UpdatePositionAndRotation(); + m_GameObjIns.SetActive(value: true); + m_ParticleSystem.Play(); + } + + public void StopLookAtEffect() + { + m_ChaseObjIns = null; + m_LookAtObject = null; + _buff = false; + Off(); + m_GameObjIns.SetActive(value: false); + m_ParticleSystem.Stop(); + } + + private void UpdatePositionAndRotation() + { + m_GameObjIns.transform.position = m_ChaseObjIns.transform.position; + m_GameObjIns.transform.rotation = CalculateRotation(); + } + + private void UpdateScale() + { + m_GameObjIns.transform.localScale = m_ChaseObjIns.transform.localScale; + } + + private Quaternion CalculateRotation() + { + if (m_LookAtObject != null) + { + Vector3 position = m_ChaseObjIns.transform.position; + Vector3 position2 = m_LookAtObject.transform.position; + float z = Mathf.Atan2(position2.y - position.y, position2.x - position.x) * 57.29578f - 90f; + return Quaternion.Euler(0f, 0f, z); + } + if (_lookAtCamera != null) + { + Vector3 position3 = m_ChaseObjIns.transform.position; + Vector3 position4 = _lookAtCamera.transform.position; + return Quaternion.FromToRotation(Vector3.forward, position3 - position4); + } + return m_ChaseObjIns.transform.rotation; + } + + private void Update() + { + if (!_buff) + { + return; + } + if (m_ChaseObjIns != null) + { + if (_isFollowScale) + { + UpdateScale(); + } + UpdatePositionAndRotation(); + } + else + { + StopBuff(); + } + } + + public void On() + { + m_Use = true; + } + + public void Off() + { + m_Use = false; + } + + public void Change() + { + m_Use = !m_Use; + } + + public void ChangeParticleColor(Color color) + { + MotionUtils.ChangeParticleSystemColor(m_ParticleSystem.gameObject, color); + } + + public EffectMgr.EffectType GetEffectType() + { + return m_Type; + } + + public GameObject GetGameObjIns() + { + return m_GameObjIns; + } + + public bool IsOn() + { + return m_Use; + } + + public bool IsPlay() + { + if (m_ParticleSystem.isPlaying || m_ParticleSystem.isPaused || m_ParticleSystem.IsAlive()) + { + return true; + } + return false; + } + + public GameObject GetChaseObjIns() + { + return m_ChaseObjIns; + } +} diff --git a/SVSim.BattleEngine/Engine/Effect3dInformation.cs b/SVSim.BattleEngine/Engine/Effect3dInformation.cs new file mode 100644 index 0000000..57fe600 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Effect3dInformation.cs @@ -0,0 +1,479 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +public class Effect3dInformation : MonoBehaviour +{ + public enum ModelBone + { + None = 1000, + Hip = 0, + Waist = 1, + Chest = 2, + Neck = 3, + Head = 4, + Shoulder_L = 5, + Arm_L = 6, + Elbow_L = 7, + Wrist_L = 8, + Shoulder_R = 9, + Arm_R = 10, + Elbow_R = 11, + Wrist_R = 12, + Eye_L = 13, + Eye_R = 14, + Mouth_Root = 15, + Prop_Under_Root = 16, + Prop_Top_Root = 17, + Bone_Max = 18 + } + + [Serializable] + public class EffectData + { + public GameObject Effect; + + private GameObject _effectInstance; + + private GameObject _attachRoot; + + public ModelBone AttachBone = ModelBone.None; + + private ModelBone _selectBone = ModelBone.None; + + public Vector3 Offset; + + public Vector3 RotateOffset; + + public ClassCharaPrm.MotionType PlayMotionType = ClassCharaPrm.MotionType.extra; + + private ClassCharaPrm.MotionType _nowMotionType = ClassCharaPrm.MotionType.idle; + + public float DelayTime; + + public float PlayTime; + + private bool _isPlay; + + public string EffectPath = ""; + + private bool _isLoad; + + private bool _isSetShader; + + private bool _isLoadMaterial; + + private bool _isLoadingMaterial; + + private string _testResoucePath = "Assets/_Wizard/Resources/"; + + private string _testEffectResoucePath = "Model/Effect/"; + + private string _resoucePath = "Assets/_WizardResources2/Resources/"; + + private string _effectResoucePath = "Jpn/Effect/Effects/"; + + public void UpdatePosition(Effect3dInformation info) + { + if (Effect != null) + { + if (_effectInstance == null) + { + LoadEffectInstance(info); + } + else + { + if (Effect.name != _effectInstance.name) + { + LoadEffectInstance(info); + } + if (!_isLoadingMaterial) + { + if (!info.IsTestScene) + { + LoadParticleMaterials(_effectInstance); + } + _isLoadingMaterial = true; + } + else if (_isLoadMaterial && !_isSetShader) + { + SetParticleShader(_effectInstance); + _isSetShader = true; + } + } + } + if (_effectInstance != null && _isPlay) + { + if (AttachBone != _selectBone || _attachRoot == null) + { + _attachRoot = info._boneList[AttachBone]; + _selectBone = AttachBone; + } + Vector3 position = _attachRoot.transform.position; + Quaternion quaternion = Quaternion.Euler(RotateOffset); + _effectInstance.transform.localRotation = _attachRoot.transform.rotation * quaternion; + Vector3 vector = _effectInstance.transform.rotation * Offset; + _effectInstance.transform.localPosition = position + vector; + } + } + + public void DestroyEffect() + { + if (_effectInstance != null) + { + UnityEngine.Object.Destroy(_effectInstance); + } + } + + public void LoadEffectInstance(Effect3dInformation info) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (!(_effectInstance == null) || !(EffectPath != "") || _isLoad) + { + return; + } + if (EffectPath.Contains(_testResoucePath)) + { + EffectPath = EffectPath.Replace(_testResoucePath, ""); + } + if (EffectPath.Contains(_testEffectResoucePath)) + { + EffectPath = EffectPath.Replace(_testEffectResoucePath, ""); + } + if (EffectPath.Contains(_resoucePath)) + { + EffectPath = EffectPath.Replace(_resoucePath, ""); + } + if (EffectPath.Contains(_effectResoucePath)) + { + EffectPath = EffectPath.Replace(_effectResoucePath, ""); + } + if (EffectPath.Contains(".prefab")) + { + EffectPath = EffectPath.Replace(".prefab", ""); + } + _ = _effectResoucePath + EffectPath; + Toolbox.ResourcesManager.GetAssetTypePath(EffectPath, ResourcesManager.AssetLoadPathType.Effect2D); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + if (info.IsLoad && !(_effectInstance != null)) + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(EffectPath, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true); + UnityEngine.Object original = Toolbox.ResourcesManager.LoadObject(assetTypePath); + _effectInstance = UnityEngine.Object.Instantiate(original, info.transform.parent) as GameObject; + Effect = _effectInstance; + _effectInstance.SetLayer(0, isSetChildren: true); + _isPlay = true; + } + })); + sequentialVfxPlayer.Register(WaitVfx.Create(0.1f)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + if (!(_effectInstance == null)) + { + _effectInstance.SetActive(value: false); + _isPlay = false; + _isLoad = true; + } + })); + BattleManagerBase.GetIns().VfxMgr.RegisterImmediateVfx(sequentialVfxPlayer); + } + + public void SetParticleShader(GameObject effectObj) + { + if (!_isLoadMaterial) + { + return; + } + Renderer[] componentsInChildren = effectObj.transform.GetComponentsInChildren(includeInactive: true); + for (int i = 0; i < componentsInChildren.Length; i++) + { + if (componentsInChildren[i].name.Contains("skn_") || componentsInChildren[i].name.Contains("emitter") || componentsInChildren[i].name.Contains("null")) + { + continue; + } + ParticleSystemRenderer particleSystemRenderer = componentsInChildren[i] as ParticleSystemRenderer; + if (particleSystemRenderer != null) + { + string[] array = componentsInChildren[i].name.Split('&'); + if (particleSystemRenderer.trailMaterial != null || array.Length > 1) + { + particleSystemRenderer.trailMaterial = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(array[1], ResourcesManager.AssetLoadPathType.Effect2DMaterials, isfetch: true)) as Material; + particleSystemRenderer.trailMaterial.shader = Shader.Find(particleSystemRenderer.trailMaterial.shader.name); + } + componentsInChildren[i].material = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(array[0], ResourcesManager.AssetLoadPathType.Effect2DMaterials, isfetch: true)) as Material; + componentsInChildren[i].material.shader = Shader.Find(componentsInChildren[i].material.shader.name); + } + else + { + componentsInChildren[i].material = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(componentsInChildren[i].name, ResourcesManager.AssetLoadPathType.Effect2DMaterials, isfetch: true)) as Material; + componentsInChildren[i].material.shader = Shader.Find(componentsInChildren[i].material.shader.name); + } + } + } + + private void SetMaterial(Renderer renderer) + { + if (renderer.name.Contains("&")) + { + string[] array = renderer.name.Split('&'); + for (int i = 0; i < array.Length; i++) + { + Toolbox.ResourcesManager.GetAssetTypePath(array[i], ResourcesManager.AssetLoadPathType.Effect2DMaterials); + renderer.material = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(renderer.name, ResourcesManager.AssetLoadPathType.Effect2DMaterials, isfetch: true)) as Material; + renderer.materials[i].shader = Shader.Find(renderer.materials[i].shader.name); + } + } + else + { + Toolbox.ResourcesManager.GetAssetTypePath(renderer.name, ResourcesManager.AssetLoadPathType.Effect2DMaterials); + renderer.material = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(renderer.name, ResourcesManager.AssetLoadPathType.Effect2DMaterials, isfetch: true)) as Material; + renderer.material.shader = Shader.Find(renderer.material.shader.name); + } + } + + public void LoadParticleMaterials(GameObject effectObj) + { + List list = new List(); + Renderer[] componentsInChildren = effectObj.transform.GetComponentsInChildren(includeInactive: true); + for (int i = 0; i < componentsInChildren.Length; i++) + { + if (componentsInChildren[i].name.Contains("skn_") || componentsInChildren[i].name.Contains("emitter") || componentsInChildren[i].name.Contains("null")) + { + continue; + } + if (componentsInChildren[i].name.Contains("&")) + { + string[] array = componentsInChildren[i].name.Split('&'); + for (int j = 0; j < array.Length; j++) + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(array[j], ResourcesManager.AssetLoadPathType.Effect2DMaterials); + if (assetTypePath.IsNotNullOrEmpty() && !list.Contains(assetTypePath)) + { + list.Add(assetTypePath); + } + } + } + else + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(componentsInChildren[i].name, ResourcesManager.AssetLoadPathType.Effect2DMaterials); + list.Add(assetTypePath2); + } + } + BattleCoroutine.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupSync(list, delegate + { + _isLoadMaterial = true; + })); + } + + public void UpdateInformation(ClassCharaPrm.MotionType type) + { + if (_effectInstance != null && PlayMotionType != type && _nowMotionType != type && _isPlay) + { + _effectInstance.SetActive(value: false); + } + _nowMotionType = type; + } + + public void Play(Effect3dInformation info) + { + if (DelayTime > 0f) + { + if (_effectInstance == null) + { + Debug.LogError("Play effect play error! " + EffectPath); + } + else + { + info.StartCoroutine(PlayEffect(info)); + } + } + else if (!(_effectInstance == null)) + { + _effectInstance.SetActive(value: true); + _isPlay = true; + if (PlayTime > 0f) + { + info.StartCoroutine(StopEffect()); + } + } + } + + private IEnumerator PlayEffect(Effect3dInformation info) + { + yield return new WaitForSeconds(DelayTime); + _effectInstance.SetActive(value: true); + _isPlay = true; + if (PlayTime > 0f) + { + info.StartCoroutine(StopEffect()); + } + } + + private IEnumerator StopEffect() + { + yield return new WaitForSeconds(PlayTime); + _effectInstance.SetActive(value: false); + _isPlay = false; + } + } + + [Serializable] + public class EffectList + { + public EffectData[] _effectData; + } + + public GameObject ModelRoot; + + public GameObject FaceRoot; + + public GameObject PropRoot; + + private Dictionary _boneList; + + public EffectList EffectsList; + + public bool FixedEffect; + + public bool SaveButton; + + public bool LoadButton; + + private string _number = ""; + + public bool IsLoad; + + public bool IsTestScene; + + private void Start() + { + _boneList = new Dictionary(); + _boneList.Add(ModelBone.None, ModelRoot); + for (int i = 0; i < 18; i++) + { + ModelBone key = (ModelBone)i; + string text = key.ToString(); + GameObject children = GetChildren(ModelRoot.transform, text); + if (children == null) + { + children = GetChildren(FaceRoot.transform, text); + if (PropRoot != null && children == null) + { + string boneName = text.Replace("Prop_", ""); + children = GetChildren(PropRoot.transform, boneName); + } + } + if (children != null) + { + _boneList.Add(key, children.gameObject); + } + } + if (IsTestScene) + { + IsLoad = true; + return; + } + List list = new List(); + EffectData[] effectData = EffectsList._effectData; + foreach (EffectData effectData2 in effectData) + { + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(effectData2.EffectPath, ResourcesManager.AssetLoadPathType.Effect2D)); + } + StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupSync(list, delegate + { + IsLoad = true; + })); + } + + public void UpdateInfo(ClassCharaPrm.MotionType type) + { + if (IsLoad && EffectsList._effectData.Length != 0) + { + EffectData[] effectData = EffectsList._effectData; + for (int i = 0; i < effectData.Length; i++) + { + effectData[i].UpdateInformation(type); + } + } + } + + public void PlayEffect(ClassCharaPrm.MotionType type) + { + if (EffectsList._effectData.Length == 0) + { + return; + } + EffectData[] effectData = EffectsList._effectData; + foreach (EffectData effectData2 in effectData) + { + if (effectData2.PlayMotionType == type) + { + effectData2.Play(this); + } + } + } + + private void LateUpdate() + { + if (EffectsList._effectData.Length != 0) + { + EffectData[] effectData = EffectsList._effectData; + for (int i = 0; i < effectData.Length; i++) + { + effectData[i].UpdatePosition(this); + } + } + } + + public void DestroyEffect() + { + if (EffectsList._effectData != null) + { + EffectData[] effectData = EffectsList._effectData; + for (int i = 0; i < effectData.Length; i++) + { + effectData[i]?.DestroyEffect(); + } + EffectsList._effectData = null; + } + } + + private GameObject GetChildren(Transform t, string boneName) + { + if (t.gameObject.name.Contains(boneName)) + { + return t.gameObject; + } + if (t.childCount == 0) + { + return null; + } + for (int i = 0; i < t.childCount; i++) + { + GameObject children = GetChildren(t.GetChild(i), boneName); + if (children != null) + { + return children; + } + } + return null; + } + + public void SaveInfo() + { + } + + public void LoadInfo(string number = "3604") + { + EffectData[] effectData = EffectsList._effectData; + for (int i = 0; i < effectData.Length; i++) + { + effectData[i].LoadEffectInstance(this); + } + _number = number; + } +} diff --git a/SVSim.BattleEngine/Engine/EmblemInfo.cs b/SVSim.BattleEngine/Engine/EmblemInfo.cs new file mode 100644 index 0000000..a520a19 --- /dev/null +++ b/SVSim.BattleEngine/Engine/EmblemInfo.cs @@ -0,0 +1,4 @@ +public class EmblemInfo : HeaderData +{ + public EmblemInfoDetail data; +} diff --git a/SVSim.BattleEngine/Engine/EmblemInfoDetail.cs b/SVSim.BattleEngine/Engine/EmblemInfoDetail.cs new file mode 100644 index 0000000..2041e26 --- /dev/null +++ b/SVSim.BattleEngine/Engine/EmblemInfoDetail.cs @@ -0,0 +1,6 @@ +using System.Collections.Generic; + +public class EmblemInfoDetail +{ + public List user_emblem_list; +} diff --git a/SVSim.BattleEngine/Engine/EmitHandUtility.cs b/SVSim.BattleEngine/Engine/EmitHandUtility.cs new file mode 100644 index 0000000..d4387c5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/EmitHandUtility.cs @@ -0,0 +1,112 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.Phase; + +public static class EmitHandUtility +{ + public static void SendSelectSkill(NetworkBattleSender.SELECT_SKILL_OPERATION skillSelectOperation, BattleManagerBase battleMgr, BattleCardBase cardInfoToSend, bool isEvolveSelect, List compInfoToSend = null, List activeSelectSkills = null, bool isBurialRite = false, bool isChoiceBrave = false) + { + NetworkStandardBattleMgr networkStandardBattleMgr = ConvertToStandardNetworkBattleMgr(battleMgr); + if (networkStandardBattleMgr == null) + { + return; + } + string text = string.Empty; + List list = new List(); + switch (skillSelectOperation) + { + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartSelect: + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartFusionSelect: + text = cardInfoToSend.Index.ToString(); + if (activeSelectSkills != null) + { + list.AddRange(from s in activeSelectSkills + where RegisterSkillConditionCheck.IsSkillConditionCheck(s, isNotHandCheck: true) + select s.SkillPrm.ownerCard.Skills.IndexOf(s)); + } + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectCard: + case NetworkBattleSender.SELECT_SKILL_OPERATION.CompleteSelect: + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectFusionIngredient: + text = (cardInfoToSend.IsPlayer ? "1" : "0") + ConvertToThreeDigitCardIndex(cardInfoToSend.Index); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CompleteFusionSelect: + text = cardInfoToSend.Index.ToString(); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartChoiceSelect: + text = cardInfoToSend.Index.ToString(); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CancelSelect: + case NetworkBattleSender.SELECT_SKILL_OPERATION.CancelChoiceSelect: + text = string.Empty; + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectChoiceCard: + case NetworkBattleSender.SELECT_SKILL_OPERATION.CompleteChoiceSelect: + { + for (int i = 0; i < compInfoToSend.Count; i++) + { + if (i > 0) + { + text += ","; + } + text += compInfoToSend[i].Index; + } + break; + } + default: + Debug.LogError("Invalid Select Skill Operation"); + return; + } + networkStandardBattleMgr.NetworkSender.SendSelectSkill(skillSelectOperation, isEvolveSelect, text, list, isBurialRite, isChoiceBrave); + } + + public static void SendSelectObject(BattleManagerBase battleMgr, BattleCardBase selectedCard) + { + if (!GameMgr.GetIns().GetDataMgr().IsRoomBattleType()) + { + return; + } + NetworkStandardBattleMgr networkStandardBattleMgr = ConvertToStandardNetworkBattleMgr(battleMgr); + if (networkStandardBattleMgr != null && battleMgr.GetCurrentPhase() is MainPhase) + { + if (selectedCard != null && selectedCard.IsInHand) + { + networkStandardBattleMgr.NetworkSender.SendSelectObject(selectedCard); + } + else + { + networkStandardBattleMgr.NetworkSender.SendSelectObject(null); + } + } + } + + public static void SendTurnEndReady(BattleManagerBase battleMgr, bool isShortenedTurn) + { + ConvertToStandardNetworkBattleMgr(battleMgr)?.NetworkSender.SendTurnEndReady(isShortenedTurn); + } + + public static void SendSlideObject(BattleManagerBase battleMgr, NetworkBattleSender.SLIDE_OBJECT_TYPE slideObjectType, BattleCardBase selectedCard = null, BattleCardBase attackingCard = null) + { + ConvertToStandardNetworkBattleMgr(battleMgr)?.NetworkSender.SendSlideObject(slideObjectType, selectedCard, attackingCard); + } + + public static void ResetSelectedSlideCard(BattleManagerBase battleMgr) + { + ConvertToStandardNetworkBattleMgr(battleMgr)?.NetworkSender.ResetSelectedSlideCard(); + } + + private static NetworkStandardBattleMgr ConvertToStandardNetworkBattleMgr(BattleManagerBase battleMgr) + { + if (ToolboxGame.RealTimeNetworkAgent == null) + { + return null; + } + return battleMgr as NetworkStandardBattleMgr; + } + + private static string ConvertToThreeDigitCardIndex(int cardIndex) + { + return cardIndex.ToString().PadLeft(3, '0'); + } +} diff --git a/SVSim.BattleEngine/Engine/EnemyAICoroutine.cs b/SVSim.BattleEngine/Engine/EnemyAICoroutine.cs new file mode 100644 index 0000000..f895252 --- /dev/null +++ b/SVSim.BattleEngine/Engine/EnemyAICoroutine.cs @@ -0,0 +1,52 @@ +using System.Collections; +using UnityEngine; + +public class EnemyAICoroutine +{ + private static EnemyAICoroutine _instance; + + private static MonoBehaviour _coroutineObject; + + public static EnemyAICoroutine GetInstance() + { + if (_instance == null) + { + _instance = new EnemyAICoroutine(); + } + if (_coroutineObject == null) + { + GameObject gameObject = Object.Instantiate(Resources.Load("Prefab/Game/_BattleCoroutine")) as GameObject; + if (gameObject != null) + { + _coroutineObject = gameObject.GetComponent(); + } + } + return _instance; + } + + public Coroutine StartCoroutine(IEnumerator enumerator) + { + return _coroutineObject.StartCoroutine(enumerator); + } + + public void StopAllCoroutines() + { + _coroutineObject.StopAllCoroutines(); + } + + public void StopCoroutine(IEnumerator enumerator) + { + if (enumerator != null) + { + _coroutineObject.StopCoroutine(enumerator); + } + } + + public void StopCoroutine(Coroutine enumerator) + { + if (enumerator != null) + { + _coroutineObject.StopCoroutine(enumerator); + } + } +} diff --git a/SVSim.BattleEngine/Engine/EnemyClassBattleCard.cs b/SVSim.BattleEngine/Engine/EnemyClassBattleCard.cs new file mode 100644 index 0000000..a7c194e --- /dev/null +++ b/SVSim.BattleEngine/Engine/EnemyClassBattleCard.cs @@ -0,0 +1,28 @@ +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class EnemyClassBattleCard : ClassBattleCardBase +{ + public EnemyClassBattleCard(ClassBuildInfo buildInfo) + : base(buildInfo) + { + } + + protected override ICardVfxCreator CreateVfxCreator(bool isPlayer, IBattleCardView battleCardView, bool isNullView) + { + if (isNullView) + { + return NullCardVfxCreator.GetInstance(); + } + return new EnemyClassCardVfxCreator((ClassBattleCardViewBase)battleCardView, this, base.SelfBattlePlayer.BattleView, _buildInfo.ResourceMgr); + } + + protected override IBattleCardView CreateView(BattleCardView.BuildInfo buildInfo, bool isNullView) + { + if (isNullView) + { + return new NullClassBattleCardView(buildInfo); + } + return new EnemyClassBattleCardView(buildInfo); + } +} diff --git a/SVSim.BattleEngine/Engine/EventBattleResult.cs b/SVSim.BattleEngine/Engine/EventBattleResult.cs new file mode 100644 index 0000000..5974044 --- /dev/null +++ b/SVSim.BattleEngine/Engine/EventBattleResult.cs @@ -0,0 +1,6 @@ +public enum EventBattleResult +{ + Lose, + Win, + NoContest +} diff --git a/SVSim.BattleEngine/Engine/FadeUtility.cs b/SVSim.BattleEngine/Engine/FadeUtility.cs new file mode 100644 index 0000000..2b86bbf --- /dev/null +++ b/SVSim.BattleEngine/Engine/FadeUtility.cs @@ -0,0 +1,140 @@ +using System; +using Cute; +using UnityEngine; + +public class FadeUtility +{ + private static readonly AnimationCurve FADE_ALPHA_ANIM_CURVE = AnimationCurve.Linear(0f, 0f, 1f, 1f); + + private const float FADE_FROM_ALPHA = 1f; + + private const float FADE_TO_ALPHA = 0f; + + private const float FADE_DURATION = 0.3f; + + private const float FADE_DELAY = 0f; + + public static void FadeInGameObject(GameObject obj, Action onFinish = null) + { + FadeFinish(obj); + FadeInObject(obj.AddMissingComponent(), delegate + { + onFinish.Call(); + }); + } + + public static void FadeOutGameObject(GameObject obj, Action onFinish = null) + { + FadeFinish(obj); + FadeOut(obj, delegate + { + onFinish.Call(); + }); + } + + public static void FadeOutObjectAndNonActive(GameObject obj) + { + FadeFinish(obj); + FadeOut(obj, delegate + { + obj.SetActive(value: false); + }); + } + + private static void FadeOut(GameObject obj, Action onFinish) + { + UIButtonColor button = obj.GetComponent(); + float originalDuration = 0f; + if (button != null) + { + originalDuration = button.duration; + button.duration = 0f; + } + TweenColor component = obj.GetComponent(); + if (component != null) + { + component.enabled = false; + } + FadeOutObject(obj.AddMissingComponent(), delegate + { + if (button != null) + { + button.duration = originalDuration; + } + onFinish(); + }); + } + + public static void ShowSoon(GameObject obj) + { + FadeFinish(obj); + UISprite component = obj.GetComponent(); + if (component != null) + { + component.alpha = 1f; + } + obj.gameObject.SetActive(value: true); + } + + public static void RemoveFadeObject(GameObject obj) + { + UITweenAlpha component = obj.GetComponent(); + if (component != null) + { + UnityEngine.Object.Destroy(component); + } + } + + public static void FadeFinish(GameObject obj) + { + UITweenAlpha component = obj.GetComponent(); + if (!(component == null)) + { + component.End(); + } + } + + public static void FadeOutObject(UITweenAlpha tweenAlpha, Action onFinish = null) + { + if (!(tweenAlpha == null)) + { + if (tweenAlpha._curve == null) + { + tweenAlpha._curve = FADE_ALPHA_ANIM_CURVE; + tweenAlpha._curve.postWrapMode = WrapMode.Once; + tweenAlpha._curve.preWrapMode = WrapMode.Once; + } + tweenAlpha._from = 1f; + tweenAlpha._to = 0f; + tweenAlpha._endTime = 0.3f; + tweenAlpha._delayTime = 0f; + tweenAlpha._finishCallBack = delegate + { + onFinish.Call(); + }; + tweenAlpha.PlayForward(isReset: true); + } + } + + public static void FadeInObject(UITweenAlpha tweenAlpha, Action onFinish = null) + { + if (!(tweenAlpha == null)) + { + if (tweenAlpha._curve == null) + { + tweenAlpha._curve = FADE_ALPHA_ANIM_CURVE; + tweenAlpha._curve.postWrapMode = WrapMode.Once; + tweenAlpha._curve.preWrapMode = WrapMode.Once; + } + tweenAlpha._from = 0f; + tweenAlpha._to = 1f; + tweenAlpha._endTime = 0.3f; + tweenAlpha._delayTime = 0f; + tweenAlpha._finishCallBack = delegate + { + onFinish.Call(); + }; + tweenAlpha.PlayForward(isReset: true); + } + } +} diff --git a/SVSim.BattleEngine/Engine/FieldBattleCard.cs b/SVSim.BattleEngine/Engine/FieldBattleCard.cs new file mode 100644 index 0000000..c20a302 --- /dev/null +++ b/SVSim.BattleEngine/Engine/FieldBattleCard.cs @@ -0,0 +1,112 @@ +using Wizard.Battle.Card; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class FieldBattleCard : BattleCardBase +{ + private static SkillCreator.SkillBuildInfo _sharedChantBuildInfo; + + public override bool IsEvolution => false; + + public override bool IsField => true; + + public override bool BaseMovable => base.Movable(); + + public override bool Attackable => false; + + public override bool IsDead => base.IsDestroyedBySkill; + + public override bool IsCantActivateFanfare => base.SelfBattlePlayer.Class.SkillApplyInformation.IsCantActivateFanfareField; + + public override bool Movable(bool isCheckOnDraw = true, bool isSkipSelecting = false, CHECK_CONDITION_MUTATIONSKILL_TYPE type = CHECK_CONDITION_MUTATIONSKILL_TYPE.NONE, bool isRecording = false) + { + type = IsCheckActiveMutationSkill; + if (!base.Movable(isCheckOnDraw, isSkipSelecting, type, isRecording)) + { + return false; + } + return IsMutationMovable(type); + } + + public FieldBattleCard(BuildInfo buildInfo) + : base(buildInfo) + { + } + + public override void Setup(bool createNullView = false, bool isRecreate = false) + { + base.Setup(createNullView, isRecreate); + base.BattleCardView.SetupIconAnimations(this, base.Skills); + } + + public override VfxBase SetUpInplay() + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + parallelVfxPlayer.Register(base.SetUpInplay()); + return parallelVfxPlayer; + } + + protected SkillCreator.SkillBuildInfo ChantSkillInfoCreate() + { + if (_sharedChantBuildInfo == null) + { + _sharedChantBuildInfo = new SkillCreator.SkillBuildInfo("chant_count_change", "self_turn_start", "{me.inplay_self.count}>0", "character=me&card_type=field&target=self", "gain_chant=1", "none"); + } + return _sharedChantBuildInfo; + } + + protected void SetChantSkill(SkillBase skill) + { + if (skill is Skill_chant_count_change skill_chant_count_change) + { + skill_chant_count_change.IsSelfChantSkill = true; + } + } + + protected override VfxBase StartPlayCard() + { + base.StartPlayCard(); + base.SelfBattlePlayer.HandCardToField(this); + return base.VfxCreator.CreatePick(); + } + + protected override ICardVfxCreator CreateVfxCreator(bool isPlayer, IBattleCardView battleCardView, bool isNullView) + { + if (isNullView) + { + return NullCardVfxCreator.GetInstance(); + } + return new FieldCardVfxCreator(isPlayer, this, battleCardView, _buildInfo.ResourceMgr); + } + + protected override IBattleCardView CreateView(BattleCardView.BuildInfo buildInfo, bool isNullView) + { + if (isNullView) + { + return new NullFieldBattleCardView(buildInfo); + } + return new FieldBattleCardView(buildInfo); + } + + public override VfxBase RecoveryInPlay(int inPlayIndex, bool newReplayMoveTurn = false) + { + return ParallelVfxPlayer.Create(base.RecoveryInPlay(inPlayIndex, newReplayMoveTurn), new FieldMaskCardInPlayVfx(base.BattleCardView)); + } + + public override BattleCardBase VirtualClone(BattlePlayerBase selfBattlePlayer, BattlePlayerBase opponentBattlePlayer) + { + VirtualFieldBattleCard virtualFieldBattleCard = new VirtualFieldBattleCard(_buildInfo.VirtualClone(selfBattlePlayer, opponentBattlePlayer)); + CopyToVirtualCardBase(virtualFieldBattleCard); + return virtualFieldBattleCard; + } + + public override VfxBase ReturnCard(SkillProcessor skillProcessor) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(base.SkillApplyInformation.AllSkillEffectStop()); + InitializeParameterOnWhenReturn(); + VfxBase vfx = base.ReturnCard(skillProcessor); + sequentialVfxPlayer.Register(vfx); + return sequentialVfxPlayer; + } +} diff --git a/SVSim.BattleEngine/Engine/FontChanger.cs b/SVSim.BattleEngine/Engine/FontChanger.cs new file mode 100644 index 0000000..9379d59 --- /dev/null +++ b/SVSim.BattleEngine/Engine/FontChanger.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections; +using Cute; +using UnityEngine; + +public class FontChanger +{ + public void Start() + { + } + + public static IEnumerator FontChange(Action callback) + { + string font = getFont(); + string text = "font_" + font + ".unity3d"; + bool isDone = false; + string filename = text.ToLower(); + Toolbox.AssetManager.CacheAsset(filename, delegate + { + AssetHandle assetHandle = Toolbox.AssetManager.GetAssetHandle(filename); + if (assetHandle != null) + { + assetHandle.isMultipleHandleIgnorAsset = true; + } + isDone = true; + }); + while (!isDone) + { + yield return 0; + } + Global.GAME_FONT = Toolbox.ResourcesManager.LoadObject("Font/" + font); + if (Global.GAME_FONT != null) + { + Global.GAME_FONT_NAME = font; + } + callback?.Invoke(); + } + + public static IEnumerator FontTryChangePersistant(Action callback) + { + string font = getFont(); + string text = "font_" + font + ".unity3d"; + bool isDone = false; + bool isHandle = false; + string filename = text.ToLower(); + Toolbox.AssetManager.CachePersistantAssetBeforeManifestLoad(filename, delegate + { + AssetHandle assetHandle = Toolbox.AssetManager.GetAssetHandle(filename); + if (assetHandle != null) + { + assetHandle.isMultipleHandleIgnorAsset = true; + Toolbox.ResourcesManager.RegistTemporaryAsset(filename); + isHandle = true; + } + isDone = true; + }); + while (!isDone) + { + yield return 0; + } + if (isHandle) + { + Global.GAME_FONT = Toolbox.ResourcesManager.LoadObject("Font/" + font); + } + else + { + Global.GAME_FONT = null; + } + if (Global.GAME_FONT != null) + { + Global.GAME_FONT_NAME = font; + } + else + { + Toolbox.AssetManager.ClearAssetCacheAssetBundle(); + Global.GAME_FONT_NAME = "A-OTF-KaiminTuStd-Bold"; + } + callback?.Invoke(); + } + + public static void FontReset() + { + Global.GAME_FONT = null; + Global.GAME_FONT_NAME = "A-OTF-KaiminTuStd-Bold"; + } + + private static string getFont() + { + return Toolbox.SavedataManager.GetString("LANG_FONT", Global.GetFontLangType(Global.LANG_TYPE.Eng.ToString())); + } +} diff --git a/SVSim.BattleEngine/Engine/ForestField.cs b/SVSim.BattleEngine/Engine/ForestField.cs new file mode 100644 index 0000000..8a2e843 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ForestField.cs @@ -0,0 +1,122 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ForestField : BackGroundBase +{ + public override int FieldId => 1; + + public ForestField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_frst_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles01").gameObject; + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + _fieldObjDictionary.Add("mainTree_door", _fieldModel.transform.Find("md_bf_frst_01_mainTree_door").gameObject); + _fieldObjDictionary.Add("moveBranch_a", _fieldModel.transform.Find("md_bf_frst_01_moveBranch_a").gameObject); + _fieldObjDictionary.Add("moveBranch_b", _fieldModel.transform.Find("md_bf_frst_01_moveBranch_b").gameObject); + m_FieldAnimatorDictionary.Add("mainTree_door", _fieldObjDictionary["mainTree_door"].GetComponent()); + m_FieldAnimatorDictionary.Add("moveBranch_a", _fieldObjDictionary["moveBranch_a"].GetComponent()); + m_FieldAnimatorDictionary.Add("moveBranch_b", _fieldObjDictionary["moveBranch_b"].GetComponent()); + _fieldParticleSystemDictionary.Add("leaf", _fieldParticles.transform.Find("leaf").GetComponent()); + _fieldParticleSystemDictionary.Add("tree_gimic_1", _fieldParticles.transform.Find("tree_gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("tree_gimic_2", _fieldParticles.transform.Find("tree_gimic_2").GetComponent()); + _fieldParticleSystemDictionary.Add("fairy_opening", _fieldParticles.transform.Find("fairy_opening").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1_2, pos); + break; + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["fairy_opening"].Play(); + m_FieldAnimatorDictionary["mainTree_door"].SetTrigger("OpenFast"); + _battleCamera.Camera.transform.localPosition = new Vector3(-660f, 200f, -150f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-15f, -90f, 90f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-500f, 10f, -20f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-40f, -90f, 90f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + m_FieldAnimatorDictionary["mainTree_door"].SetTrigger("CloseFast"); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-150f, -50f, -100f), "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeInExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-30f, -20f, 25f), "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeInExpo)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 1f, "delay", 1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 1f, "delay", 1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + m_FieldAnimatorDictionary["mainTree_door"].SetTrigger("Open"); + int rnd = Random.Range(1, 3); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_{rnd}", "se_field_" + _str3DFieldNo, 0f, 0L); + yield return new WaitForSeconds(1.5f); + switch (rnd) + { + case 1: + _fieldParticleSystemDictionary["tree_gimic_1"].Play(); + break; + case 2: + _fieldParticleSystemDictionary["tree_gimic_2"].Play(); + break; + } + yield return new WaitForSeconds(1f); + m_FieldAnimatorDictionary["mainTree_door"].SetTrigger("Close"); + yield return new WaitForSeconds(3f); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["leaf"].Play(); + m_FieldAnimatorDictionary["moveBranch_a"].speed = 1f + Random.value * 0.5f; + m_FieldAnimatorDictionary["moveBranch_a"].SetTrigger("Shake"); + m_FieldAnimatorDictionary["moveBranch_b"].speed = 1f + Random.value * 0.5f; + m_FieldAnimatorDictionary["moveBranch_b"].SetTrigger("Shake"); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/ForestNightField.cs b/SVSim.BattleEngine/Engine/ForestNightField.cs new file mode 100644 index 0000000..184d8e0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ForestNightField.cs @@ -0,0 +1,11 @@ +public class ForestNightField : ForestField +{ + public override int FieldId => 11; + + public override int FieldEffectId => 1; + + public ForestNightField(string bgmId = "NONE") + : base(bgmId) + { + } +} diff --git a/SVSim.BattleEngine/Engine/FramerateProfiler.cs b/SVSim.BattleEngine/Engine/FramerateProfiler.cs new file mode 100644 index 0000000..945cc51 --- /dev/null +++ b/SVSim.BattleEngine/Engine/FramerateProfiler.cs @@ -0,0 +1,51 @@ +using UnityEngine; + +internal class FramerateProfiler +{ + private float _lastTime; + + private int _lastFrame; + + private float _fps; + + private bool _hasValue; + + private const float MEASURE_RANGE = 5f; + + public const int FPS_GOOD = 30; + + public const int FPS_BAD = 20; + + public float? Fps + { + get + { + if (_hasValue) + { + return _fps; + } + return null; + } + } + + public void Init() + { + _lastTime = Time.realtimeSinceStartup; + _lastFrame = Time.frameCount; + _fps = 30f; + } + + public void Update() + { + float realtimeSinceStartup = Time.realtimeSinceStartup; + float num = realtimeSinceStartup - _lastTime; + if (num >= 5f) + { + int num2 = Time.frameCount - _lastFrame; + _fps = (float)num2 / num; + _lastTime = realtimeSinceStartup; + _lastFrame = Time.frameCount; + _hasValue = true; + } + } +} diff --git a/SVSim.BattleEngine/Engine/FreeMatchFinish.cs b/SVSim.BattleEngine/Engine/FreeMatchFinish.cs new file mode 100644 index 0000000..2995de8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/FreeMatchFinish.cs @@ -0,0 +1,4 @@ +public class FreeMatchFinish : HeaderData +{ + public FreeMatchFinishDetail data; +} diff --git a/SVSim.BattleEngine/Engine/FreeMatchFinishDetail.cs b/SVSim.BattleEngine/Engine/FreeMatchFinishDetail.cs new file mode 100644 index 0000000..c8ca39a --- /dev/null +++ b/SVSim.BattleEngine/Engine/FreeMatchFinishDetail.cs @@ -0,0 +1,3 @@ +public class FreeMatchFinishDetail : MatchFinishBase +{ +} diff --git a/SVSim.BattleEngine/Engine/FreeMatchResultAnimationAgent.cs b/SVSim.BattleEngine/Engine/FreeMatchResultAnimationAgent.cs new file mode 100644 index 0000000..38f0d85 --- /dev/null +++ b/SVSim.BattleEngine/Engine/FreeMatchResultAnimationAgent.cs @@ -0,0 +1,175 @@ +using System.Collections; +using UnityEngine; +using Wizard; + +public class FreeMatchResultAnimationAgent : ResultAnimationAgent +{ + public override IEnumerator RunUI(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin) + { + m_BattleCamera.m_CutInCamera.gameObject.SetActive(value: false); + if (battleResultControl.IsDraw) + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleDraw.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 48, 16, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + else if (isWin) + { + battleResultControl.TitleWin.gameObject.SetActive(value: true); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleWin.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.alpha = 0f; + battleResultControl.Bg.color = new Color32(32, 24, 0, 0); + battleResultControl.ResultTitle.spriteName = "result_top_win"; + } + else + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleLose.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleLose.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 24, 48, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + battleResultControl.MainPanel.alpha = 1f; + yield return new WaitForSeconds(0.1f); + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + else if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOUWIN); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_WIN); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + TweenAlpha.Begin(battleResultControl.Bg.gameObject, 0.5f, 0.75f); + yield return new WaitForSeconds(0.2f); + TweenAlpha.Begin(battleResultControl.ArcaneIn.gameObject, 0.5f, 1f); + TweenAlpha.Begin(battleResultControl.ArcaneOut.gameObject, 0.5f, 1f); + iTween.ScaleTo(battleResultControl.ArcaneIn.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(battleResultControl.ArcaneOut.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + if (battleResultControl.IsDraw) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_3, Vector3.zero); + battleResultControl.TitleDraw.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else if (isWin) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_1, Vector3.zero); + battleResultControl.TitleWin.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_2, Vector3.zero); + battleResultControl.TitleLose.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + HideEmotionMessage(); + if (battleResultControl.ResultMsgWindowFlag) + { + StartCoroutine(battleResultControl.ShowSpecialResultInfo()); + } + yield return new WaitForSeconds(2f); + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_3, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + if (ShowRewardDialog(battleResultControl)) + { + while (battleResultControl.IsRewardWait) + { + yield return null; + } + } + if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 0f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 3f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_1, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_2, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + } + yield return new WaitForSeconds(0.2f); + if (isWin) + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_WIN_LOOP); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_LOSE_LOOP); + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_WINDOW_APPER); + iTween.MoveTo(battleResultControl.ClassCharObj.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassCharObj"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ResultTitle.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ResultTitle"], "time", 0.5f, "delay", 0f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ClassInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassInfo"], "time", 0.5f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(1f); + if (isWin) + { + PlayWinVoice(); + } + if (battleResultControl.AddClassExp > 0) + { + battleResultControl.SettingAddClassExpTextAnimation(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP); + yield return new WaitForSeconds(0.05f); + } + yield return new WaitForSeconds(0.5f); + } + bool battlePathUIFinish = false; + battleResultControl.SetBattlePassGauge(delegate + { + battlePathUIFinish = true; + }); + while (!battlePathUIFinish) + { + yield return null; + } + if (Data.RedEtherCampaignResultData != null) + { + bool isFinishRedEther = false; + RedEtherCampaignPanel.Create(battleResultControl.gameObject, Data.RedEtherCampaignResultData, battleResultControl, delegate + { + isFinishRedEther = true; + }); + while (!isFinishRedEther) + { + yield return null; + } + yield return ShowRewardDialog(Data.RedEtherCampaignResultData.RewardList); + } + battleResultControl.GreySpriteBGVisible = false; + nextSceneSelector.Show(); + battleResultControl.PrepareAchievementLog(); + battleResultControl.FinishResult(); + } +} diff --git a/SVSim.BattleEngine/Engine/FreeMatchResultAnimationHandler.cs b/SVSim.BattleEngine/Engine/FreeMatchResultAnimationHandler.cs new file mode 100644 index 0000000..1da3e13 --- /dev/null +++ b/SVSim.BattleEngine/Engine/FreeMatchResultAnimationHandler.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +public class FreeMatchResultAnimationHandler : IResultAnimationHandler +{ + private readonly GameObject m_resultAnimationAgentObj; + + private readonly FreeMatchResultAnimationAgent m_resultAnimationAgentIns; + + public ResultAnimationAgent m_resultAnimationAgent => m_resultAnimationAgentIns; + + public FreeMatchResultAnimationHandler(BattleCamera battleCamera) + { + m_resultAnimationAgentObj = new GameObject(); + m_resultAnimationAgentIns = m_resultAnimationAgentObj.AddComponent(); + m_resultAnimationAgentIns.GetComponent().SetBattleCamera(battleCamera); + } + + public void Destroy() + { + Object.Destroy(m_resultAnimationAgentObj); + } +} diff --git a/SVSim.BattleEngine/Engine/FreeMatchResultReporter.cs b/SVSim.BattleEngine/Engine/FreeMatchResultReporter.cs new file mode 100644 index 0000000..9e2fb3a --- /dev/null +++ b/SVSim.BattleEngine/Engine/FreeMatchResultReporter.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using LitJson; +using Wizard; +using Wizard.Lottery; + +public class FreeMatchResultReporter : IBattleResultReporter +{ + public bool IsEnd => Data.FreeMatchFinish.data != null; + + public int ClassExp => GetClassExp(); + + public List UserAchievement => GetUserAchievementList(); + + public List UserMission => GetUserMissionList(); + + public List MissionRewards => Data.FreeMatchFinish.data._missionRewards; + + public List VictoryRewards => null; + + public LotteryApplyData LotteryData => LotteryApplyData.EmptyData(); + + public MyPageHomeDialogData HomeDialogData => null; + + public bool IsDataExist + { + get + { + if (Data.FreeMatchFinish.data != null) + { + return Data.FreeMatchFinish.data.IsProcessed; + } + return false; + } + } + + public void Report(bool isWin) + { + } + + public void Destroy() + { + } + + public JsonData GetFinishResponseData() + { + return Data.FreeMatchFinish.data._responseData; + } + + public List GetUserAchievementList() + { + return Data.FreeMatchFinish.data.achieved_achievement_list; + } + + public List GetUserMissionList() + { + return Data.FreeMatchFinish.data.achieved_mission_list; + } + + public int GetClassExp() + { + return Data.FreeMatchFinish.data.get_class_chara_experience; + } +} diff --git a/SVSim.BattleEngine/Engine/FriendApply.cs b/SVSim.BattleEngine/Engine/FriendApply.cs new file mode 100644 index 0000000..7f72b8b --- /dev/null +++ b/SVSim.BattleEngine/Engine/FriendApply.cs @@ -0,0 +1,42 @@ +using System; +using LitJson; + +public class FriendApply : HeaderData +{ + public uint id; + + public int viewerId; + + public string name; + + public string countryCode; + + public int rank; + + public long emblemId; + + public int degreeId; + + public DateTime lastPlayTime; + + public DateTime applyedTime; + + public int MissionType { get; private set; } + + public FriendApply(JsonData data) + { + id = (uint)data["id"].ToLong(); + viewerId = data["viewer_id"].ToInt(); + name = (string)data["name"]; + countryCode = (string)data["country_code"]; + rank = data["rank"].ToInt(); + emblemId = data["emblem_id"].ToLong(); + degreeId = data["degree_id"].ToInt(); + lastPlayTime = DateTime.Parse(data["last_play_time"].ToString()); + applyedTime = DateTime.Parse(data["create_time"].ToString()); + if (data.Keys.Contains("mission_type")) + { + MissionType = data["mission_type"].ToInt(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/FriendInfo.cs b/SVSim.BattleEngine/Engine/FriendInfo.cs new file mode 100644 index 0000000..61c8aa3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/FriendInfo.cs @@ -0,0 +1,9 @@ +public class FriendInfo : HeaderData +{ + public FriendInfoDetail data; + + public void Initialize() + { + data = new FriendInfoDetail(); + } +} diff --git a/SVSim.BattleEngine/Engine/FriendInfoDetail.cs b/SVSim.BattleEngine/Engine/FriendInfoDetail.cs new file mode 100644 index 0000000..d54a5f9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/FriendInfoDetail.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +public class FriendInfoDetail +{ + public List friendList = new List(); + + public int friendCount; + + public int friendMaxCount; +} diff --git a/SVSim.BattleEngine/Engine/GachaObj.cs b/SVSim.BattleEngine/Engine/GachaObj.cs new file mode 100644 index 0000000..d203f1e --- /dev/null +++ b/SVSim.BattleEngine/Engine/GachaObj.cs @@ -0,0 +1,34 @@ +using UnityEngine; + +public class GachaObj : MonoBehaviour +{ + [SerializeField] + private Camera m_GachaCamera; + + [SerializeField] + private GameObject m_GachaLight; + + [SerializeField] + private GameObject m_GachaBox; + + [SerializeField] + private GameObject m_ClanLabels; + + [SerializeField] + private UITexture m_DarkSideTex; + + [SerializeField] + private UITexture m_BgBlackTex; + + public Camera GachaCamera => m_GachaCamera; + + public GameObject GachaLight => m_GachaLight; + + public GameObject GachaBox => m_GachaBox; + + public GameObject ClanLabels => m_ClanLabels; + + public UITexture DarkSideTex => m_DarkSideTex; + + public UITexture BgBlackTex => m_BgBlackTex; +} diff --git a/SVSim.BattleEngine/Engine/GateField.cs b/SVSim.BattleEngine/Engine/GateField.cs new file mode 100644 index 0000000..5d065fb --- /dev/null +++ b/SVSim.BattleEngine/Engine/GateField.cs @@ -0,0 +1,83 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class GateField : BackGroundBase +{ + public override int FieldId => 8; + + public GateField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_gate_01").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles08").gameObject; + _fieldParticleSystemDictionary.Add("plasma_gimic_1", _fieldParticles.transform.Find("plasma_gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_8, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_8_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(-20f, 80f, 700f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-10f, 0f, 0f)); + yield return new WaitForSeconds(2f); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _gimicCntDictionary[obj.tag]++; + _fieldParticleSystemDictionary["plasma_gimic_1"].Play(); + yield return new WaitForSeconds(1.5f); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Gungnir.cs b/SVSim.BattleEngine/Engine/Gungnir.cs new file mode 100644 index 0000000..294ee47 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Gungnir.cs @@ -0,0 +1,303 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using BestHTTP.SocketIO; +using Cute; +using UnityEngine; +using Wizard; + +public class Gungnir : IDisposable +{ + private enum ConnectingStatus + { + ONLINE, + WAITING, + OFFLINE, + TIMEOUT + } + + public enum DisconnectStatus + { + NOT, + SELF_DISCONNECT, + OPPONENT_DISCONNECT + } + + public const string URI = "Gungnir"; + + public const string EMIT_ALIVE = "alive"; + + private const string CURRENT_SEQUENCE = "currentSeq"; + + public const string ACTION_SEQ = "actionSeq"; + + private const string OCS_KEY = "ocs"; + + private const string SCS_KEY = "scs"; + + private const string CLIENT_PUB_SEQ_KEY = "clientPubSeq"; + + private const string CLIENT_REQ_RESEND_KEY = "reqResend"; + + private const float REPORT_INTERVAL = 5f; + + private RealTimeNetworkAgent _agent; + + private ConnectionReporter _connectionReporter; + + public Action OnAlive; + + public Action OnOpponentAlive; + + public Action OnOpponentDisconnect; + + public Action OnOpponentOffLine; + + public Action OnOpponentTimeOut; + + public Action OnResendEmitData; + + public bool _isNotEmit; + + private int _receiveReSendZeroNum; + + public List _actionSeqPubSeqList = new List(); + + public int _actionSequenceNum; + + private float _gungnirLogWaitTimer; + + private Coroutine _gungnirAckCheckCoroutine; + + public const float SUCCESS_GUNGNIR_RECEIVE_LOG_TIME = 5f; + + public DisconnectStatus _DisconnectStatus { get; private set; } + + public long LastSuccessTime { get; private set; } + + public bool IsSendActionSequenceNum { get; private set; } + + public bool IsEnableTimeoutCallBack { get; set; } = true; + + public long GungnirReceiveCheckTime { get; private set; } + + public Gungnir(RealTimeNetworkAgent agent) + { + _agent = agent; + _connectionReporter = new ConnectionReporter(agent, EmitGungnir, 5f); + Tick(); + _DisconnectStatus = DisconnectStatus.NOT; + } + + private IEnumerator GungnirLogAckCheck() + { + while (true) + { + _gungnirLogWaitTimer += Time.deltaTime; + if (_gungnirLogWaitTimer >= 2f) + { + break; + } + yield return null; + } + if (!LocalLog._isSendGungnirLog) + { + _agent.NetworkLogger.LogInfo("OnGungnirLog"); + } + LocalLog._isSendGungnirLog = true; + } + + public void Start() + { + _agent.NetworkLogger.LogInfo("Gungnir: Start"); + _connectionReporter.StartReporter(); + LocalLog.InitGungnirLog(); + LocalLog.InitDisconnectLog(); + } + + public void Stop() + { + _connectionReporter.StopReporter(); + _agent.NetworkLogger.LogInfo("Gungnir: Stop"); + LocalLog.AddGungnirLog("GungnirStopReporter "); + } + + public void SetSendActionSequenceNumFlag(bool isActive) + { + if (!isActive && IsSendActionSequenceNum) + { + _agent.NetworkLogger.LogInfo("GungnirSendActionSeq:OFF"); + } + if (isActive && !IsSendActionSequenceNum) + { + _agent.NetworkLogger.LogInfo("GungnirSendActionSeq:ON"); + } + IsSendActionSequenceNum = isActive; + } + + public void EmitGungnir() + { + if (GameMgr.GetIns().IsWatchBattle || _isNotEmit) + { + return; + } + if (_agent.IsOpen()) + { + _agent.SocketManager.Socket.Emit("alive", OnAckPacket, CreateEmitData()); + if (IsRecordGungnirLog()) + { + _gungnirAckCheckCoroutine = _agent.StartCoroutine(GungnirLogAckCheck()); + } + LocalLog.AddGungnirLog("EmitGungnir"); + return; + } + LocalLog.AddGungnirLog("NotOpenEmitGungnir"); + if (!LocalLog._isSendGungnirLog) + { + _agent.NetworkLogger.LogInfo("OnGungnirLog"); + } + if (IsRecordGungnirLog()) + { + LocalLog._isSendGungnirLog = true; + } + } + + private bool IsRecordGungnirLog() + { + if (_agent == null || _agent.CurrentMatchingStatus != RealTimeNetworkAgent.MatchingStatus.Prepared || GameMgr.GetIns() == null || GameMgr.GetIns().IsWatchBattle) + { + return false; + } + return true; + } + + private byte[] CreateEmitData() + { + Dictionary dictionary = _agent.CreateEmitData("Gungnir", null, isTrySend: false); + dictionary.Add("currentSeq", _agent.MaxMessageSequenceNumber); + if (IsSendActionSequenceNum) + { + dictionary.Add("actionSeq", _actionSequenceNum); + } + return _agent.CreatePackEmitData(dictionary); + } + + private void OnAckPacket(Socket socket, Packet originalPacket, params object[] args) + { + Tick(); + OnAlive.Call(); + LocalLog.AddGungnirLog("GungnirOnAck"); + if (_gungnirAckCheckCoroutine != null) + { + _agent.StopCoroutine(_gungnirAckCheckCoroutine); + } + _gungnirLogWaitTimer = 0f; + } + + public void ReceiveGungnir(Packet originalPacket, params object[] args) + { + Dictionary dictionary = _agent.DeserializeEncryptedPacket(originalPacket); + if (dictionary.Count == 0) + { + LocalLog.AddGungnirLog("ReceiveGungnirDataZero"); + return; + } + string text = dictionary["uri"].ToString(); + if (text != NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.Gungnir]) + { + LocalLog.AddGungnirLog("ReceiveGungnirNoUri[" + text + "]"); + } + else + { + if (_agent.HandleingNodeResultCodeIfNeeded(dictionary)) + { + return; + } + if (_agent.IsExistTitleReturnError) + { + LocalLog.AddGungnirLog("ReceiveGungnirIsExistTitleReturnError"); + return; + } + GungnirReceiveCheckTime = TimeUtil.GetAbsoluteTime().Ticks; + Tick(); + OnAlive.Call(); + if (dictionary.ContainsKey(NetworkBattleDefine.NetworkParameter.resultCode.ToString()) && int.Parse(dictionary[NetworkBattleDefine.NetworkParameter.resultCode.ToString()].ToString()) == 30002) + { + return; + } + if (dictionary.ContainsKey("reqResend")) + { + int num = int.Parse(dictionary["reqResend"].ToString()); + if (num == 0) + { + _receiveReSendZeroNum++; + } + if (num == 1 || _receiveReSendZeroNum >= 2) + { + _receiveReSendZeroNum = 0; + if (dictionary.ContainsKey("clientPubSeq")) + { + int arg = int.Parse(dictionary["clientPubSeq"].ToString()); + OnResendEmitData.Call(arg); + } + } + } + if ((ConnectingStatus)Enum.Parse(typeof(ConnectingStatus), dictionary["scs"].ToString()) == ConnectingStatus.OFFLINE) + { + _agent.NetworkLogger.LogInfo("Gungnir: Self Offline"); + if (_agent.IsBattleStart) + { + _DisconnectStatus = DisconnectStatus.SELF_DISCONNECT; + } + return; + } + switch ((ConnectingStatus)Enum.Parse(typeof(ConnectingStatus), dictionary["ocs"].ToString())) + { + case ConnectingStatus.ONLINE: + OnOpponentAlive.Call(); + break; + case ConnectingStatus.WAITING: + _agent.NetworkLogger.LogInfo("Gungnir: Opponent Disconnect"); + OnOpponentDisconnect.Call(); + break; + case ConnectingStatus.OFFLINE: + OpponentOffLine(); + _agent.NetworkLogger.LogInfo("Gungnir: Opponent Offline"); + OnOpponentOffLine.Call(); + break; + case ConnectingStatus.TIMEOUT: + OpponentOffLine(); + _agent.NetworkLogger.LogInfo("Gungnir: Opponent TimeOut"); + if (IsEnableTimeoutCallBack) + { + OnOpponentTimeOut.Call(); + } + break; + } + } + } + + private void OpponentOffLine() + { + if (_agent.IsBattleStart) + { + _DisconnectStatus = DisconnectStatus.OPPONENT_DISCONNECT; + } + } + + public void Tick() + { + LastSuccessTime = TimeUtil.GetAbsoluteTime().Ticks; + } + + public void Dispose() + { + if (_gungnirAckCheckCoroutine != null) + { + _agent.StopCoroutine(_gungnirAckCheckCoroutine); + } + _connectionReporter.StopReporter(); + _connectionReporter = null; + _agent = null; + } +} diff --git a/SVSim.BattleEngine/Engine/HandViewBase.cs b/SVSim.BattleEngine/Engine/HandViewBase.cs new file mode 100644 index 0000000..7676153 --- /dev/null +++ b/SVSim.BattleEngine/Engine/HandViewBase.cs @@ -0,0 +1,194 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public abstract class HandViewBase +{ + protected readonly HandControl _handControl; + + protected readonly List _battleCardViewList; + + protected const float REARRANGE_TIME = 0.2f; + + protected const float WATCH_REARRANGE_TIME = 0.1f; + + public HandViewBase() + { + } + + public HandViewBase(GameObject handGameObject, BattleCamera battleCamera) + { + _handControl = CreateHandControl(handGameObject, battleCamera); + _battleCardViewList = new List(); + } + + public virtual void SetClassBattleCardView(IBattleCardView classBattleCardView) + { + } + + protected abstract void RearrangeHand(float rearrangeTime, bool isNewReplayMoveTurn = false); + + protected abstract HandControl CreateHandControl(GameObject handGameObject, BattleCamera battleCamera); + + public virtual void AddCardToView(IBattleCardView cardViewToAdd, float deckRearrangeTime, bool isNewReplayMoveTurn = false) + { + if (!(cardViewToAdd is NullBattleCardView)) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + deckRearrangeTime = 0f; + } + AddCardToViewWithoutRearrange(cardViewToAdd); + RearrangeHand(deckRearrangeTime, isNewReplayMoveTurn); + } + } + + public virtual void AddCardToViewWithoutRearrange(IBattleCardView cardViewToAdd) + { + if (!_battleCardViewList.Contains(cardViewToAdd)) + { + _battleCardViewList.Add(cardViewToAdd); + } + } + + public void AddCardsToView(List cardViewsToAdd, float deckRearrangeTime) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + deckRearrangeTime = 0f; + } + List list = cardViewsToAdd.FindAll((IBattleCardView cardView) => !_battleCardViewList.Contains(cardView)); + if (list.Any()) + { + _battleCardViewList.AddRange(list); + RearrangeHand(deckRearrangeTime); + } + } + + public virtual void RemoveCardFromView(IBattleCardView cardViewToRemove, float deckRearrangeTime) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + deckRearrangeTime = 0f; + } + if (_battleCardViewList.Contains(cardViewToRemove)) + { + RemoveCardFromViewWithoutRearrange(cardViewToRemove); + RearrangeHand(deckRearrangeTime); + } + } + + public virtual void RemoveCardFromViewWithoutRearrange(IBattleCardView cardViewToRemove) + { + if (_battleCardViewList.Remove(cardViewToRemove)) + { + cardViewToRemove.isHiddenFromHandView = false; + } + } + + public virtual VfxBase ShuffleHand() + { + return NullVfx.GetInstance(); + } + + public void HideCardFromView(IBattleCardView cardViewToHide) + { + float rearrangeTime = (BattleManagerBase.GetIns().IsRecovery ? 0f : 0.2f); + if (_battleCardViewList.Contains(cardViewToHide)) + { + cardViewToHide.isHiddenFromHandView = true; + RearrangeHand(rearrangeTime); + } + } + + public void UnhideCardFromView(IBattleCardView cardViewToHide, float deckRearrangeTime = 0.2f) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + deckRearrangeTime = 0f; + } + if (_battleCardViewList.Contains(cardViewToHide)) + { + cardViewToHide.isHiddenFromHandView = false; + RearrangeHand(deckRearrangeTime); + } + } + + public void LockHandState() + { + _handControl.LockHandControlState(); + } + + public virtual VfxBase HandUnfocus() + { + _handControl.SetHandState(HandControl.HandState.Unfocus); + return ParallelVfxPlayer.Create(InstantVfx.Create(delegate + { + RearrangeHand(0.2f); + }), WaitVfx.Create(0.2f)); + } + + public virtual VfxBase HandFocus() + { + _handControl.SetHandState(HandControl.HandState.Focus); + return ParallelVfxPlayer.Create(InstantVfx.Create(delegate + { + RearrangeHand(0.2f); + }), WaitVfx.Create(0.2f)); + } + + public virtual VfxBase FocusRearrangeHandHand() + { + if (_handControl.IsHandStateFocus()) + { + return HandFocus(); + } + return HandUnfocus(); + } + + public HandControl GetHandControl() + { + return _handControl; + } + + public void ReplaceCardInView(IBattleCardView originalView, IBattleCardView newView) + { + ReplaceCardInViewWithoutRearrange(originalView, newView); + } + + public void ReplaceCardInViewWithoutRearrange(IBattleCardView originalView, IBattleCardView newView) + { + _battleCardViewList.Insert(_battleCardViewList.IndexOf(originalView), newView); + _battleCardViewList.RemoveAt(_battleCardViewList.IndexOf(originalView)); + } + + public int GetViewIndex(IBattleCardView viewCard) + { + return _battleCardViewList.IndexOf(viewCard); + } + + public static VfxBase CreateHideCardMeshesVfx(IEnumerable targetCards) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + if (!GameMgr.GetIns().IsAdmin) + { + foreach (BattleCardBase targetCard in targetCards) + { + parallelVfxPlayer.Register(new ShowCardNumberLabelVfx(targetCard.BattleCardView, isShow: false)); + } + } + return parallelVfxPlayer; + } + + public void ChangeArrangeType(HandControl.ArrangeType type) + { + _handControl.ChangeArrangeType(type, 0.3f, _battleCardViewList); + } + + public virtual VfxBase AsyncTouchCard(GameObject card) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/HillField.cs b/SVSim.BattleEngine/Engine/HillField.cs new file mode 100644 index 0000000..d8a7a38 --- /dev/null +++ b/SVSim.BattleEngine/Engine/HillField.cs @@ -0,0 +1,105 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class HillField : BackGroundBase +{ + public override int FieldId => 21; + + public HillField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + switch (FieldId) + { + case 21: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_21, pos); + break; + case 23: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_23, pos); + break; + } + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + switch (FieldId) + { + case 21: + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_21_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_21_2, pos); + break; + } + break; + case 23: + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_23_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_23_2, pos); + break; + } + break; + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _battleCamera.Camera.transform.localPosition = new Vector3(-2050f, -1600f, -75f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-33f, 43f, -60f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(60f, -80f, -430f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-37f, 83f, -87f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1") + { + _ = _gimicCntDictionary[obj.tag]; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/HillRiotingField.cs b/SVSim.BattleEngine/Engine/HillRiotingField.cs new file mode 100644 index 0000000..3bdf32e --- /dev/null +++ b/SVSim.BattleEngine/Engine/HillRiotingField.cs @@ -0,0 +1,9 @@ +internal class HillRiotingField : HillField +{ + public override int FieldId => 23; + + public HillRiotingField(string bgmId = "NONE") + : base(bgmId) + { + } +} diff --git a/SVSim.BattleEngine/Engine/IDInput.cs b/SVSim.BattleEngine/Engine/IDInput.cs new file mode 100644 index 0000000..428708a --- /dev/null +++ b/SVSim.BattleEngine/Engine/IDInput.cs @@ -0,0 +1,166 @@ +using System; +using System.Text.RegularExpressions; +using UnityEngine; +using Wizard; + +public class IDInput : MonoBehaviour +{ + [Serializable] + public class LayoutSet + { + public GameObject _root; + + public UILabel[] _label; + } + + [SerializeField] + private UIButton[] m_InputBtns; + + [SerializeField] + private UIButton m_InputClearBtn; + + private UIButton m_InputOKBtn; + + [SerializeField] + private LayoutSet[] _layoutSet; + + private LayoutSet _currentLayout; + + [SerializeField] + private UIButton _pasteButton; + + private int InputIndex; + + private int _maxIndex; + + public DialogBase CurrentDialogBase; + + private const string BrankText = "_"; + + [HideInInspector] + public string InputID { get; set; } + + public static IDInput Create(GameObject parentObj) + { + return NGUITools.AddChild(parentObj, UIManager.GetInstance().IdInputPrefab).GetComponent(); + } + + public static void StartInputDialog(string dialogTitle, int number, Action onDecide) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetTitleLabel(dialogTitle); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn); + IDInput input = Create(dialogBase.gameObject); + input.CurrentDialogBase = dialogBase; + input.InitInputID(number); + dialogBase.onPushButton1 = delegate + { + onDecide(input.InputID); + }; + } + + public void InitInputID(int maxCount) + { + InputIndex = 0; + InputID = ""; + _maxIndex = maxCount - 1; + for (int i = 0; i < m_InputBtns.Length; i++) + { + UIEventListener uIEventListener = UIEventListener.Get(m_InputBtns[i].gameObject); + uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, new UIEventListener.VoidDelegate(InputNum)); + } + _pasteButton.onClick.Add(new EventDelegate(delegate + { + Paste(); + })); + LayoutSet[] layoutSet = _layoutSet; + foreach (LayoutSet layoutSet2 in layoutSet) + { + if (layoutSet2._label.Length == maxCount) + { + layoutSet2._root.SetActive(value: true); + _currentLayout = layoutSet2; + } + else + { + layoutSet2._root.SetActive(value: false); + } + } + if (_currentLayout == null) + { + Debug.LogError("ๆœช็Ÿฅใฎๆกๆ•ฐใงใ™"); + } + for (int num2 = 0; num2 < _currentLayout._label.Length; num2++) + { + _currentLayout._label[num2].text = "_"; + } + UIEventListener uIEventListener2 = UIEventListener.Get(m_InputClearBtn.gameObject); + uIEventListener2.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener2.onClick, new UIEventListener.VoidDelegate(ClearNum)); + Invoke("SetButtonEnabled", 0.01f); + } + + private void SetButtonEnabled() + { + CurrentDialogBase.SetButtonDisable(isEnableOK: true); + } + + public void InputNum(GameObject g) + { + if (InputIndex <= _maxIndex) + { + string text = g.name; + _currentLayout._label[InputIndex].text = text; + JoinNums(); + InputIndex++; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + if (InputIndex > _maxIndex) + { + CurrentDialogBase.SetButtonDisable(isEnableOK: false); + } + } + } + + public void ClearNum(GameObject g) + { + if (InputIndex > 0) + { + InputIndex--; + _currentLayout._label[InputIndex].text = "_"; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_OFF); + CurrentDialogBase.SetButtonDisable(isEnableOK: true); + } + } + + private void JoinNums() + { + string text = ""; + for (int i = 0; i < _currentLayout._label.Length && !(_currentLayout._label[i].text == "_"); i++) + { + text += _currentLayout._label[i].text; + } + InputID = text; + } + + private void Paste() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + string clipboard = ClipboardHelper.Clipboard; + clipboard = Regex.Replace(clipboard, "[๏ผ-๏ผ™]", (Match match) => ((char)(match.Value[0] - 65296 + 48)).ToString()); + clipboard = Regex.Replace(clipboard, "\\s", ""); + if (UIUtil.IsValidIdDigits(clipboard, _currentLayout._label.Length)) + { + for (int num = 0; num < _currentLayout._label.Length; num++) + { + _currentLayout._label[num].text = "_"; + } + for (int num2 = 0; num2 < clipboard.Length; num2++) + { + _currentLayout._label[num2].text = clipboard[num2].ToString(); + JoinNums(); + } + InputIndex = clipboard.Length; + CurrentDialogBase.SetButtonDisable(isEnableOK: false); + } + } +} diff --git a/SVSim.BattleEngine/Engine/InPlayCardControl.cs b/SVSim.BattleEngine/Engine/InPlayCardControl.cs new file mode 100644 index 0000000..2004cbc --- /dev/null +++ b/SVSim.BattleEngine/Engine/InPlayCardControl.cs @@ -0,0 +1,115 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Wizard.Battle.View; + +public class InPlayCardControl +{ + private readonly GameObject m_gameObject; + + private const int cMax = 5; + + private const float cBaseX = 215f; + + private Vector3[] cPos; + + private readonly Vector3 PLAYER_FIELDCARD_SPACE = new Vector3(0f, -110f, 0f); + + private readonly Vector3 ENEMY_FIELDCARD_SPACE = new Vector3(0f, 158f, 0f); + + public Transform transform { get; private set; } + + public InPlayCardControl(GameObject gameObject) + { + m_gameObject = gameObject; + transform = m_gameObject.transform; + cPos = new Vector3[5]; + } + + private void SetInPlayPosition(List battleCardViewList) + { + int num = battleCardViewList.Count; + if (num >= 5) + { + num = 5; + } + for (int i = 0; i < num; i++) + { + switch (m_gameObject.name) + { + case "FieldCard": + m_gameObject.transform.localPosition = PLAYER_FIELDCARD_SPACE; + cPos[i] = new Vector3(215f * (float)i - 215f * (float)(num - 1) / 2f, 0f, 0f); + break; + case "EFieldCard": + m_gameObject.transform.localPosition = ENEMY_FIELDCARD_SPACE; + cPos[i] = new Vector3(-215f * (float)i + 215f * (float)(num - 1) / 2f, 0f, 0f); + break; + } + } + } + + public void RearrangePlayerInplay(float time, List battleCardViewList) + { + SetInPlayPosition(battleCardViewList); + int num = 0; + foreach (IBattleCardView battleCardView in battleCardViewList) + { + if (!battleCardView.isHiddenFromInPlayView) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + Transform transform = battleCardView.Transform; + transform.localPosition = new Vector3(cPos[num].x, transform.localPosition.y, transform.localPosition.z); + } + else + { + if (battleCardView._inPlayRearrangeCoroutine != null) + { + BattleCoroutine.GetInstance().StopCoroutine(battleCardView._inPlayRearrangeCoroutine); + } + battleCardView._inPlayRearrangeCoroutine = BattleCoroutine.GetInstance().StartCoroutine(MoveCardToNewPosition(battleCardView, cPos[num], time)); + } + } + num++; + } + } + + private IEnumerator MoveCardToNewPosition(IBattleCardView cardView, Vector3 targetPosition, float time) + { + Transform cardTransform = cardView.Transform; + float startTime = Time.time; + while (true) + { + float num = (Time.time - startTime) / time; + if (num > 1f) + { + break; + } + float x = Mathf.Lerp(cardTransform.localPosition.x, targetPosition.x, num); + cardTransform.localPosition = new Vector3(x, cardTransform.localPosition.y, cardTransform.localPosition.z); + yield return null; + } + cardTransform.localPosition = new Vector3(targetPosition.x, cardTransform.localPosition.y, cardTransform.localPosition.z); + } + + public Vector3 GetPosition(int index) + { + return cPos[index]; + } + + public Vector3 GetOverflowPosition(int index, bool isPlayer) + { + float num = (isPlayer ? 1f : (-1f)); + return new Vector3((430f + 215f * (float)(index + 1)) * num, 0f, 0f); + } + + public static Vector3 CalcPosition(int cardCount, int index, bool isPlayer) + { + if (isPlayer) + { + return new Vector3(215f * (float)index - 215f * (float)(cardCount - 1) / 2f, 0f, 0f); + } + return new Vector3(-215f * (float)index + 215f * (float)(cardCount - 1) / 2f, 0f, 0f); + } +} diff --git a/SVSim.BattleEngine/Engine/InPlayViewBase.cs b/SVSim.BattleEngine/Engine/InPlayViewBase.cs new file mode 100644 index 0000000..a1bb0cd --- /dev/null +++ b/SVSim.BattleEngine/Engine/InPlayViewBase.cs @@ -0,0 +1,145 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public abstract class InPlayViewBase +{ + protected readonly InPlayCardControl inPlayCardControl; + + protected readonly List battleCardViewList; + + public InPlayViewBase() + { + } + + public InPlayViewBase(GameObject inPlayGameObject) + { + inPlayCardControl = new InPlayCardControl(inPlayGameObject); + battleCardViewList = new List(); + } + + protected abstract void RearrangeInplay(float rearrangeTime); + + public VfxBase OneTimeRearrangeInplay(float rearrangeTime) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + rearrangeTime = 0f; + } + return InstantVfx.Create(delegate + { + RearrangeInplay(rearrangeTime); + }); + } + + public void AddCardToView(IBattleCardView cardViewToAdd, float deckRearrangeTime) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + deckRearrangeTime = 0f; + } + if (!battleCardViewList.Contains(cardViewToAdd)) + { + battleCardViewList.Add(cardViewToAdd); + RearrangeInplay(deckRearrangeTime); + } + } + + public void AddCardsToView(List cardViewsToAdd, float deckRearrangeTime) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + deckRearrangeTime = 0f; + } + List source = cardViewsToAdd.FindAll((IBattleCardView cardView) => !battleCardViewList.Contains(cardView)); + if (source.Any()) + { + battleCardViewList.AddRange(source.ToList()); + RearrangeInplay(deckRearrangeTime); + } + } + + public virtual void RemoveCardFromView(IBattleCardView cardViewToRemove, float deckRearrangeTime) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + deckRearrangeTime = 0f; + } + if (battleCardViewList.Remove(cardViewToRemove)) + { + RearrangeInplay(deckRearrangeTime); + } + } + + public virtual void RemoveCardFromView(IBattleCardView cardViewToRemove) + { + battleCardViewList.Remove(cardViewToRemove); + } + + public virtual void RemoveCardsFromView(List cardViewsToRemove, float deckRearrangeTime) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + deckRearrangeTime = 0f; + } + if (cardViewsToRemove.FindAll((IBattleCardView cardView) => battleCardViewList.Remove(cardView)).Any()) + { + RearrangeInplay(deckRearrangeTime); + } + } + + public virtual VfxBase CreateRemoveCardsFromViewVfx(List cardViewsToRemove, float deckRearrangeTime) + { + return InstantVfx.Create(delegate + { + RemoveCardsFromView(cardViewsToRemove, deckRearrangeTime); + }); + } + + public void Replacement(IBattleCardView originalView, IBattleCardView newView) + { + battleCardViewList.Insert(battleCardViewList.IndexOf(originalView), newView); + battleCardViewList.RemoveAt(battleCardViewList.IndexOf(originalView)); + if (BattleManagerBase.GetIns().IsRecovery) + { + RearrangeInplay(0f); + } + else + { + RearrangeInplay(0.1f); + } + } + + public void AttachCardView(IBattleCardView cardView) + { + cardView.Transform.parent = inPlayCardControl.transform; + } + + public int GetViewIndex(IBattleCardView viewCard) + { + return battleCardViewList.IndexOf(viewCard); + } + + public Vector3 GetPositionInView(IBattleCardView battleCardView, bool isGlobal) + { + int viewIndex = GetViewIndex(battleCardView); + return GetPositionInView(viewIndex, isGlobal); + } + + public Vector3 GetPositionInView(int viewIndex, bool isGlobal) + { + Vector3 vector = inPlayCardControl.GetPosition(viewIndex); + if (isGlobal) + { + vector = inPlayCardControl.transform.TransformPoint(vector); + } + return vector; + } + + public Vector3 GetPositionInOverflowList(int indexInOverflowList, bool isPlayer) + { + return inPlayCardControl.GetOverflowPosition(indexInOverflowList, isPlayer); + } +} diff --git a/SVSim.BattleEngine/Engine/InitializeRoomBattle.cs b/SVSim.BattleEngine/Engine/InitializeRoomBattle.cs new file mode 100644 index 0000000..c6dc94b --- /dev/null +++ b/SVSim.BattleEngine/Engine/InitializeRoomBattle.cs @@ -0,0 +1,26 @@ +public class InitializeRoomBattle : HeaderData +{ + public class Result + { + public int _classId; + + public EventBattleResult _result; + + public Result(int classId, EventBattleResult result) + { + _classId = classId; + _result = result; + } + } + + public class LotteryDataInRoom + { + public bool IsShowTweetDialog { get; set; } + + public string BannerNameOnTweetDialog { get; set; } = string.Empty; + } + + public LotteryDataInRoom LotteyDataInRoom { get; set; } = new LotteryDataInRoom(); + + public bool IsUsedDeck { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/InviteFriendBattle.cs b/SVSim.BattleEngine/Engine/InviteFriendBattle.cs new file mode 100644 index 0000000..2ad1b61 --- /dev/null +++ b/SVSim.BattleEngine/Engine/InviteFriendBattle.cs @@ -0,0 +1,8 @@ +using Wizard; + +public class InviteFriendBattle : HeaderData +{ + public string RoomId { get; set; } + + public BattleParameter BattleParameterInstance { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/IronField.cs b/SVSim.BattleEngine/Engine/IronField.cs new file mode 100644 index 0000000..3b0acb4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/IronField.cs @@ -0,0 +1,85 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class IronField : BackGroundBase +{ + public override int FieldId => 30; + + public IronField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_iron_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles30").gameObject; + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("shake_1", _fieldParticles.transform.Find("shake_1").GetComponent()); + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_30, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_30_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(2128f, -71f, 238f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-4f, -85.5f, 92f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-210f, -63.4f, 270f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-3.6f, -117.4f, 95f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + _fieldParticleSystemDictionary["gimic_1"].Play(); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + yield return new WaitForSeconds(4f); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake_1"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/LaboratoryField.cs b/SVSim.BattleEngine/Engine/LaboratoryField.cs new file mode 100644 index 0000000..690e323 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LaboratoryField.cs @@ -0,0 +1,109 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class LaboratoryField : BackGroundBase +{ + public override int FieldId => 7; + + public LaboratoryField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_labo_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles07").gameObject; + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + _fieldObjDictionary.Add("golem", _fieldModel.transform.Find("md_bf_labo_01_golem").gameObject); + _fieldObjDictionary.Add("bookfall_1", _fieldModel.transform.Find("md_bf_labo_01_bookfall_1").gameObject); + _fieldObjDictionary.Add("bookfall_2", _fieldModel.transform.Find("md_bf_labo_01_bookfall_2").gameObject); + m_FieldAnimatorDictionary.Add("golem", _fieldObjDictionary["golem"].GetComponent()); + m_FieldAnimatorDictionary.Add("bookfall_1", _fieldObjDictionary["bookfall_1"].GetComponent()); + m_FieldAnimatorDictionary.Add("bookfall_2", _fieldObjDictionary["bookfall_2"].GetComponent()); + _fieldParticleSystemDictionary.Add("book_1", _fieldParticles.transform.Find("book_1").GetComponent()); + _fieldParticleSystemDictionary.Add("book_2", _fieldParticles.transform.Find("book_2").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_7, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_7_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["golem"].SetTrigger("Threat01"); + _battleCamera.Camera.transform.localPosition = new Vector3(-525f, 125f, -230f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-25f, -105f, 98f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-240f, -60f, 20f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-30f, -105f, 98f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + int num = Random.Range(1, 3); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_{num}", "se_field_" + _str3DFieldNo, 0f, 0L); + switch (num) + { + case 1: + m_FieldAnimatorDictionary["golem"].SetTrigger("Threat01"); + yield return new WaitForSeconds(7.5f); + break; + case 2: + m_FieldAnimatorDictionary["golem"].SetTrigger("Threat02"); + yield return new WaitForSeconds(2f); + break; + } + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + m_FieldAnimatorDictionary["golem"].SetTrigger("Shake"); + if (FieldId == 7) + { + m_FieldAnimatorDictionary["bookfall_1"].SetTrigger("Fall"); + m_FieldAnimatorDictionary["bookfall_2"].SetTrigger("Fall"); + yield return new WaitForSeconds(0.5f); + _fieldParticleSystemDictionary["book_1"].Play(); + _fieldParticleSystemDictionary["book_2"].Play(); + } + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/LaboratoryNightField.cs b/SVSim.BattleEngine/Engine/LaboratoryNightField.cs new file mode 100644 index 0000000..b253727 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LaboratoryNightField.cs @@ -0,0 +1,11 @@ +public class LaboratoryNightField : LaboratoryField +{ + public override int FieldId => 17; + + public override int FieldEffectId => 7; + + public LaboratoryNightField(string bgmId = "NONE") + : base(bgmId) + { + } +} diff --git a/SVSim.BattleEngine/Engine/LifeAddModifier.cs b/SVSim.BattleEngine/Engine/LifeAddModifier.cs new file mode 100644 index 0000000..dd7b82e --- /dev/null +++ b/SVSim.BattleEngine/Engine/LifeAddModifier.cs @@ -0,0 +1,23 @@ +public class LifeAddModifier : ICardLifeModifier +{ + public readonly int Life; + + public bool IsClearBeforeModifier => false; + + public bool IsChangeMaxLife => true; + + public LifeAddModifier(int life) + { + Life = life; + } + + public virtual int CalcLife(int baseLife) + { + return baseLife + Life; + } + + public int CalcMaxLife(int baseMaxLife) + { + return baseMaxLife + Life; + } +} diff --git a/SVSim.BattleEngine/Engine/LifeMultiplyModifier.cs b/SVSim.BattleEngine/Engine/LifeMultiplyModifier.cs new file mode 100644 index 0000000..7afc80e --- /dev/null +++ b/SVSim.BattleEngine/Engine/LifeMultiplyModifier.cs @@ -0,0 +1,23 @@ +public class LifeMultiplyModifier : ICardLifeModifier +{ + public readonly int Multipli; + + public bool IsClearBeforeModifier => false; + + public bool IsChangeMaxLife => true; + + public LifeMultiplyModifier(int multipli) + { + Multipli = multipli; + } + + public int CalcLife(int baseLife) + { + return baseLife * Multipli; + } + + public int CalcMaxLife(int baseMaxLife) + { + return baseMaxLife * Multipli; + } +} diff --git a/SVSim.BattleEngine/Engine/LifeSetModifier.cs b/SVSim.BattleEngine/Engine/LifeSetModifier.cs new file mode 100644 index 0000000..cc9bd78 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LifeSetModifier.cs @@ -0,0 +1,23 @@ +public class LifeSetModifier : ICardLifeModifier +{ + public readonly int Life; + + public virtual bool IsClearBeforeModifier => true; + + public bool IsChangeMaxLife => true; + + public LifeSetModifier(int life) + { + Life = life; + } + + public virtual int CalcLife(int baseLife) + { + return Life; + } + + public int CalcMaxLife(int baseMaxLife) + { + return Life; + } +} diff --git a/SVSim.BattleEngine/Engine/LitJson/ArrayMetadata.cs b/SVSim.BattleEngine/Engine/LitJson/ArrayMetadata.cs new file mode 100644 index 0000000..9b01b12 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/ArrayMetadata.cs @@ -0,0 +1,52 @@ +using System; + +namespace LitJson; + +internal struct ArrayMetadata +{ + private Type element_type; + + private bool is_array; + + private bool is_list; + + public Type ElementType + { + get + { + if (element_type == null) + { + return typeof(JsonData); + } + return element_type; + } + set + { + element_type = value; + } + } + + public bool IsArray + { + get + { + return is_array; + } + set + { + is_array = value; + } + } + + public bool IsList + { + get + { + return is_list; + } + set + { + is_list = value; + } + } +} diff --git a/SVSim.BattleEngine/Engine/LitJson/Condition.cs b/SVSim.BattleEngine/Engine/LitJson/Condition.cs new file mode 100644 index 0000000..099249d --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/Condition.cs @@ -0,0 +1,10 @@ +namespace LitJson; + +internal enum Condition +{ + InArray, + InObject, + NotAProperty, + Property, + Value +} diff --git a/SVSim.BattleEngine/Engine/LitJson/ExporterFunc.cs b/SVSim.BattleEngine/Engine/LitJson/ExporterFunc.cs new file mode 100644 index 0000000..c058768 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/ExporterFunc.cs @@ -0,0 +1,4 @@ +namespace LitJson; + +internal delegate void ExporterFunc(object obj, JsonWriter writer); +public delegate void ExporterFunc(T obj, JsonWriter writer); diff --git a/SVSim.BattleEngine/Engine/LitJson/FsmContext.cs b/SVSim.BattleEngine/Engine/LitJson/FsmContext.cs new file mode 100644 index 0000000..ec46c71 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/FsmContext.cs @@ -0,0 +1,12 @@ +namespace LitJson; + +internal class FsmContext +{ + public bool Return; + + public int NextState; + + public Lexer L; + + public int StateStack; +} diff --git a/SVSim.BattleEngine/Engine/LitJson/IJsonWrapper.cs b/SVSim.BattleEngine/Engine/LitJson/IJsonWrapper.cs new file mode 100644 index 0000000..efdc700 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/IJsonWrapper.cs @@ -0,0 +1,48 @@ +using System.Collections; + +namespace LitJson; + +public interface IJsonWrapper : IList, ICollection, IEnumerable, IOrderedDictionary, IDictionary +{ + bool IsArray { get; } + + bool IsBoolean { get; } + + bool IsDouble { get; } + + bool IsInt { get; } + + bool IsLong { get; } + + bool IsObject { get; } + + bool IsString { get; } + + bool GetBoolean(); + + double GetDouble(); + + int GetInt(); + + JsonType GetJsonType(); + + long GetLong(); + + string GetString(); + + void SetBoolean(bool val); + + void SetDouble(double val); + + void SetInt(int val); + + void SetJsonType(JsonType type); + + void SetLong(long val); + + void SetString(string val); + + string ToJson(); + + void ToJson(JsonWriter writer); +} diff --git a/SVSim.BattleEngine/Engine/LitJson/IOrderedDictionary.cs b/SVSim.BattleEngine/Engine/LitJson/IOrderedDictionary.cs new file mode 100644 index 0000000..04d1bcc --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/IOrderedDictionary.cs @@ -0,0 +1,14 @@ +using System.Collections; + +namespace LitJson; + +public interface IOrderedDictionary : IDictionary, ICollection, IEnumerable +{ + object this[int index] { get; set; } + + new IDictionaryEnumerator GetEnumerator(); + + void Insert(int index, object key, object value); + + void RemoveAt(int index); +} diff --git a/SVSim.BattleEngine/Engine/LitJson/ImporterFunc.cs b/SVSim.BattleEngine/Engine/LitJson/ImporterFunc.cs new file mode 100644 index 0000000..5044416 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/ImporterFunc.cs @@ -0,0 +1,4 @@ +namespace LitJson; + +internal delegate object ImporterFunc(object input); +public delegate TValue ImporterFunc(TJson input); diff --git a/SVSim.BattleEngine/Engine/LitJson/JsonData.cs b/SVSim.BattleEngine/Engine/LitJson/JsonData.cs new file mode 100644 index 0000000..da5c987 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/JsonData.cs @@ -0,0 +1,873 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +namespace LitJson; + +public class JsonData : IJsonWrapper, IList, ICollection, IEnumerable, IOrderedDictionary, IDictionary, IEquatable +{ + private IList inst_array; + + private bool inst_boolean; + + private double inst_double; + + private int inst_int; + + private long inst_long; + + private IDictionary inst_object; + + private string inst_string; + + private string json; + + private JsonType type; + + private IList> object_list; + + public int Count => EnsureCollection().Count; + + public bool IsArray => type == JsonType.Array; + + public bool IsBoolean => type == JsonType.Boolean; + + public bool IsDouble => type == JsonType.Double; + + public bool IsInt => type == JsonType.Int; + + public bool IsLong => type == JsonType.Long; + + public bool IsObject => type == JsonType.Object; + + public bool IsString => type == JsonType.String; + + public ICollection Keys + { + get + { + EnsureDictionary(); + return inst_object.Keys; + } + } + + public ICollection Values + { + get + { + EnsureDictionary(); + return inst_object.Values; + } + } + + int ICollection.Count => Count; + + bool ICollection.IsSynchronized => EnsureCollection().IsSynchronized; + + object ICollection.SyncRoot => EnsureCollection().SyncRoot; + + bool IDictionary.IsFixedSize => EnsureDictionary().IsFixedSize; + + bool IDictionary.IsReadOnly => EnsureDictionary().IsReadOnly; + + ICollection IDictionary.Keys + { + get + { + EnsureDictionary(); + IList list = new List(); + foreach (KeyValuePair item in object_list) + { + list.Add(item.Key); + } + return (ICollection)list; + } + } + + ICollection IDictionary.Values + { + get + { + EnsureDictionary(); + IList list = new List(); + foreach (KeyValuePair item in object_list) + { + list.Add(item.Value); + } + return (ICollection)list; + } + } + + bool IJsonWrapper.IsArray => IsArray; + + bool IJsonWrapper.IsBoolean => IsBoolean; + + bool IJsonWrapper.IsDouble => IsDouble; + + bool IJsonWrapper.IsInt => IsInt; + + bool IJsonWrapper.IsLong => IsLong; + + bool IJsonWrapper.IsObject => IsObject; + + bool IJsonWrapper.IsString => IsString; + + bool IList.IsFixedSize => EnsureList().IsFixedSize; + + bool IList.IsReadOnly => EnsureList().IsReadOnly; + + object IDictionary.this[object key] + { + get + { + return EnsureDictionary()[key]; + } + set + { + if (!(key is string)) + { + throw new ArgumentException("The key has to be a string"); + } + JsonData value2 = ToJsonData(value); + this[(string)key] = value2; + } + } + + object IOrderedDictionary.this[int idx] + { + get + { + EnsureDictionary(); + return object_list[idx].Value; + } + set + { + EnsureDictionary(); + JsonData value2 = ToJsonData(value); + KeyValuePair keyValuePair = object_list[idx]; + inst_object[keyValuePair.Key] = value2; + KeyValuePair value3 = new KeyValuePair(keyValuePair.Key, value2); + object_list[idx] = value3; + } + } + + object IList.this[int index] + { + get + { + return EnsureList()[index]; + } + set + { + EnsureList(); + JsonData value2 = ToJsonData(value); + this[index] = value2; + } + } + + public JsonData this[string prop_name] + { + get + { + EnsureDictionary(); + return inst_object[prop_name]; + } + set + { + EnsureDictionary(); + KeyValuePair keyValuePair = new KeyValuePair(prop_name, value); + if (inst_object.ContainsKey(prop_name)) + { + for (int i = 0; i < object_list.Count; i++) + { + if (object_list[i].Key == prop_name) + { + object_list[i] = keyValuePair; + break; + } + } + } + else + { + object_list.Add(keyValuePair); + } + inst_object[prop_name] = value; + json = null; + } + } + + public JsonData this[int index] + { + get + { + EnsureCollection(); + if (type == JsonType.Array) + { + return inst_array[index]; + } + return object_list[index].Value; + } + set + { + EnsureCollection(); + if (type == JsonType.Array) + { + inst_array[index] = value; + } + else + { + KeyValuePair keyValuePair = object_list[index]; + KeyValuePair value2 = new KeyValuePair(keyValuePair.Key, value); + object_list[index] = value2; + inst_object[keyValuePair.Key] = value; + } + json = null; + } + } + + public JsonData() + { + } + + public JsonData(bool boolean) + { + type = JsonType.Boolean; + inst_boolean = boolean; + } + + public JsonData(double number) + { + type = JsonType.Double; + inst_double = number; + } + + public JsonData(int number) + { + type = JsonType.Int; + inst_int = number; + } + + public JsonData(long number) + { + type = JsonType.Long; + inst_long = number; + } + + public JsonData(object obj) + { + if (obj is bool) + { + type = JsonType.Boolean; + inst_boolean = (bool)obj; + return; + } + if (obj is double) + { + type = JsonType.Double; + inst_double = (double)obj; + return; + } + if (obj is int) + { + type = JsonType.Int; + inst_int = (int)obj; + return; + } + if (obj is long) + { + type = JsonType.Long; + inst_long = (long)obj; + return; + } + if (obj is string) + { + type = JsonType.String; + inst_string = (string)obj; + return; + } + throw new ArgumentException("Unable to wrap the given object with JsonData"); + } + + public JsonData(string str) + { + type = JsonType.String; + inst_string = str; + } + + public static implicit operator JsonData(bool data) + { + return new JsonData(data); + } + + public static implicit operator JsonData(double data) + { + return new JsonData(data); + } + + public static implicit operator JsonData(int data) + { + return new JsonData(data); + } + + public static implicit operator JsonData(long data) + { + return new JsonData(data); + } + + public static implicit operator JsonData(string data) + { + return new JsonData(data); + } + + public static explicit operator bool(JsonData data) + { + if (data.type != JsonType.Boolean) + { + throw new InvalidCastException("Instance of JsonData doesn't hold a double"); + } + return data.inst_boolean; + } + + public static explicit operator double(JsonData data) + { + if (data.type != JsonType.Double) + { + throw new InvalidCastException("Instance of JsonData doesn't hold a double"); + } + return data.inst_double; + } + + public static explicit operator int(JsonData data) + { + if (data.type != JsonType.Int) + { + throw new InvalidCastException("Instance of JsonData doesn't hold an int"); + } + return data.inst_int; + } + + public static explicit operator long(JsonData data) + { + if (data.type != JsonType.Long) + { + throw new InvalidCastException("Instance of JsonData doesn't hold an int"); + } + return data.inst_long; + } + + public static explicit operator string(JsonData data) + { + if (data.type != JsonType.String) + { + throw new InvalidCastException("Instance of JsonData doesn't hold a string"); + } + return data.inst_string; + } + + void ICollection.CopyTo(Array array, int index) + { + EnsureCollection().CopyTo(array, index); + } + + void IDictionary.Add(object key, object value) + { + JsonData value2 = ToJsonData(value); + EnsureDictionary().Add(key, value2); + KeyValuePair item = new KeyValuePair((string)key, value2); + object_list.Add(item); + json = null; + } + + void IDictionary.Clear() + { + EnsureDictionary().Clear(); + object_list.Clear(); + json = null; + } + + bool IDictionary.Contains(object key) + { + return EnsureDictionary().Contains(key); + } + + IDictionaryEnumerator IDictionary.GetEnumerator() + { + return ((IOrderedDictionary)this).GetEnumerator(); + } + + void IDictionary.Remove(object key) + { + EnsureDictionary().Remove(key); + for (int i = 0; i < object_list.Count; i++) + { + if (object_list[i].Key == (string)key) + { + object_list.RemoveAt(i); + break; + } + } + json = null; + } + + IEnumerator IEnumerable.GetEnumerator() + { + return EnsureCollection().GetEnumerator(); + } + + bool IJsonWrapper.GetBoolean() + { + if (type != JsonType.Boolean) + { + throw new InvalidOperationException("JsonData instance doesn't hold a boolean"); + } + return inst_boolean; + } + + double IJsonWrapper.GetDouble() + { + if (type != JsonType.Double) + { + throw new InvalidOperationException("JsonData instance doesn't hold a double"); + } + return inst_double; + } + + int IJsonWrapper.GetInt() + { + if (type != JsonType.Int) + { + throw new InvalidOperationException("JsonData instance doesn't hold an int"); + } + return inst_int; + } + + long IJsonWrapper.GetLong() + { + if (type != JsonType.Long) + { + throw new InvalidOperationException("JsonData instance doesn't hold a long"); + } + return inst_long; + } + + string IJsonWrapper.GetString() + { + if (type != JsonType.String) + { + throw new InvalidOperationException("JsonData instance doesn't hold a string"); + } + return inst_string; + } + + void IJsonWrapper.SetBoolean(bool val) + { + type = JsonType.Boolean; + inst_boolean = val; + json = null; + } + + void IJsonWrapper.SetDouble(double val) + { + type = JsonType.Double; + inst_double = val; + json = null; + } + + void IJsonWrapper.SetInt(int val) + { + type = JsonType.Int; + inst_int = val; + json = null; + } + + void IJsonWrapper.SetLong(long val) + { + type = JsonType.Long; + inst_long = val; + json = null; + } + + void IJsonWrapper.SetString(string val) + { + type = JsonType.String; + inst_string = val; + json = null; + } + + string IJsonWrapper.ToJson() + { + return ToJson(); + } + + void IJsonWrapper.ToJson(JsonWriter writer) + { + ToJson(writer); + } + + int IList.Add(object value) + { + return Add(value); + } + + void IList.Clear() + { + EnsureList().Clear(); + json = null; + } + + bool IList.Contains(object value) + { + return EnsureList().Contains(value); + } + + int IList.IndexOf(object value) + { + return EnsureList().IndexOf(value); + } + + void IList.Insert(int index, object value) + { + EnsureList().Insert(index, value); + json = null; + } + + void IList.Remove(object value) + { + EnsureList().Remove(value); + json = null; + } + + void IList.RemoveAt(int index) + { + EnsureList().RemoveAt(index); + json = null; + } + + IDictionaryEnumerator IOrderedDictionary.GetEnumerator() + { + EnsureDictionary(); + return new OrderedDictionaryEnumerator(object_list.GetEnumerator()); + } + + void IOrderedDictionary.Insert(int idx, object key, object value) + { + string text = (string)key; + JsonData value2 = (this[text] = ToJsonData(value)); + KeyValuePair item = new KeyValuePair(text, value2); + object_list.Insert(idx, item); + } + + void IOrderedDictionary.RemoveAt(int idx) + { + EnsureDictionary(); + inst_object.Remove(object_list[idx].Key); + object_list.RemoveAt(idx); + } + + private ICollection EnsureCollection() + { + if (type == JsonType.Array) + { + return (ICollection)inst_array; + } + if (type == JsonType.Object) + { + return (ICollection)inst_object; + } + throw new InvalidOperationException("The JsonData instance has to be initialized first"); + } + + private IDictionary EnsureDictionary() + { + if (type == JsonType.Object) + { + return (IDictionary)inst_object; + } + if (type != JsonType.None) + { + throw new InvalidOperationException("Instance of JsonData is not a dictionary"); + } + type = JsonType.Object; + inst_object = new Dictionary(); + object_list = new List>(); + return (IDictionary)inst_object; + } + + private IList EnsureList() + { + if (type == JsonType.Array) + { + return (IList)inst_array; + } + if (type != JsonType.None) + { + throw new InvalidOperationException("Instance of JsonData is not a list"); + } + type = JsonType.Array; + inst_array = new List(); + return (IList)inst_array; + } + + private JsonData ToJsonData(object obj) + { + if (obj == null) + { + return null; + } + if (obj is JsonData) + { + return (JsonData)obj; + } + return new JsonData(obj); + } + + private static void WriteJson(IJsonWrapper obj, JsonWriter writer) + { + if (obj == null) + { + writer.Write(null); + } + else if (obj.IsString) + { + writer.Write(obj.GetString()); + } + else if (obj.IsBoolean) + { + writer.Write(obj.GetBoolean()); + } + else if (obj.IsDouble) + { + writer.Write(obj.GetDouble()); + } + else if (obj.IsInt) + { + writer.Write(obj.GetInt()); + } + else if (obj.IsLong) + { + writer.Write(obj.GetLong()); + } + else if (obj.IsArray) + { + writer.WriteArrayStart(); + foreach (JsonData item in (IEnumerable)obj) + { + WriteJson(item, writer); + } + writer.WriteArrayEnd(); + } + else + { + if (!obj.IsObject) + { + return; + } + writer.WriteObjectStart(); + foreach (DictionaryEntry item2 in (IDictionary)obj) + { + writer.WritePropertyName((string)item2.Key); + WriteJson((JsonData)item2.Value, writer); + } + writer.WriteObjectEnd(); + } + } + + public int Add(object value) + { + JsonData value2 = ToJsonData(value); + json = null; + return EnsureList().Add(value2); + } + + public void Clear() + { + if (IsObject) + { + ((IDictionary)this).Clear(); + } + else if (IsArray) + { + ((IList)this).Clear(); + } + } + + public bool Equals(JsonData x) + { + if (x == null) + { + return false; + } + if (x.type != type) + { + return false; + } + return type switch + { + JsonType.None => true, + JsonType.Object => inst_object.Equals(x.inst_object), + JsonType.Array => inst_array.Equals(x.inst_array), + JsonType.String => inst_string.Equals(x.inst_string), + JsonType.Int => inst_int.Equals(x.inst_int), + JsonType.Long => inst_long.Equals(x.inst_long), + JsonType.Double => inst_double.Equals(x.inst_double), + JsonType.Boolean => inst_boolean.Equals(x.inst_boolean), + _ => false, + }; + } + + public JsonType GetJsonType() + { + return type; + } + + public void SetJsonType(JsonType type) + { + if (this.type != type) + { + switch (type) + { + case JsonType.Object: + inst_object = new Dictionary(); + object_list = new List>(); + break; + case JsonType.Array: + inst_array = new List(); + break; + case JsonType.String: + inst_string = null; + break; + case JsonType.Int: + inst_int = 0; + break; + case JsonType.Long: + inst_long = 0L; + break; + case JsonType.Double: + inst_double = 0.0; + break; + case JsonType.Boolean: + inst_boolean = false; + break; + } + this.type = type; + } + } + + public string ToJson() + { + if (json != null) + { + return json; + } + StringWriter stringWriter = new StringWriter(); + JsonWriter jsonWriter = new JsonWriter(stringWriter); + jsonWriter.Validate = false; + WriteJson(this, jsonWriter); + json = stringWriter.ToString(); + return json; + } + + public void ToJson(JsonWriter writer) + { + bool validate = writer.Validate; + writer.Validate = false; + WriteJson(this, writer); + writer.Validate = validate; + } + + public override string ToString() + { + return type switch + { + JsonType.Array => "JsonData array", + JsonType.Boolean => inst_boolean.ToString(), + JsonType.Double => inst_double.ToString(), + JsonType.Int => inst_int.ToString(), + JsonType.Long => inst_long.ToString(), + JsonType.Object => "JsonData object", + JsonType.String => inst_string, + _ => "Uninitialized JsonData", + }; + } + + public int ToInt() + { + switch (type) + { + case JsonType.Int: + return inst_int; + case JsonType.Double: + return Convert.ToInt32(inst_double); + case JsonType.Long: + return Convert.ToInt32(inst_long); + case JsonType.String: + return Convert.ToInt32(inst_string); + case JsonType.Boolean: + return Convert.ToInt32(inst_boolean); + default: + Debug.LogError("JsonData ToInt error"); + return 0; + } + } + + public long ToLong() + { + switch (type) + { + case JsonType.Int: + return Convert.ToInt64(inst_int); + case JsonType.Double: + return Convert.ToInt64(inst_double); + case JsonType.Long: + return inst_long; + case JsonType.String: + return Convert.ToInt64(inst_string); + case JsonType.Boolean: + return Convert.ToInt64(inst_boolean); + default: + Debug.LogError("JsonData ToLong error"); + return 0L; + } + } + + public double ToDouble() + { + switch (type) + { + case JsonType.Int: + return Convert.ToDouble(inst_int); + case JsonType.Double: + return inst_double; + case JsonType.Long: + return Convert.ToDouble(inst_long); + case JsonType.String: + return Convert.ToDouble(inst_string); + case JsonType.Boolean: + return Convert.ToDouble(inst_boolean); + default: + Debug.LogError("JsonData ToDouble error"); + return 0.0; + } + } + + public bool ToBoolean() + { + switch (type) + { + case JsonType.Int: + return Convert.ToBoolean(inst_int); + case JsonType.Double: + return Convert.ToBoolean(inst_double); + case JsonType.Long: + return Convert.ToBoolean(inst_long); + case JsonType.String: + return Convert.ToBoolean(inst_string); + case JsonType.Boolean: + return inst_boolean; + default: + Debug.LogError("JsonData ToBoolean error"); + return false; + } + } +} diff --git a/SVSim.BattleEngine/Engine/LitJson/JsonException.cs b/SVSim.BattleEngine/Engine/LitJson/JsonException.cs new file mode 100644 index 0000000..08223f7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/JsonException.cs @@ -0,0 +1,40 @@ +using System; + +namespace LitJson; + +public class JsonException : Exception +{ + public JsonException() + { + } + + internal JsonException(ParserToken token) + : base($"Invalid token '{token}' in input string") + { + } + + internal JsonException(ParserToken token, Exception inner_exception) + : base($"Invalid token '{token}' in input string", inner_exception) + { + } + + internal JsonException(int c) + : base($"Invalid character '{(char)c}' in input string") + { + } + + internal JsonException(int c, Exception inner_exception) + : base($"Invalid character '{(char)c}' in input string", inner_exception) + { + } + + public JsonException(string message) + : base(message) + { + } + + public JsonException(string message, Exception inner_exception) + : base(message, inner_exception) + { + } +} diff --git a/SVSim.BattleEngine/Engine/LitJson/JsonMapper.cs b/SVSim.BattleEngine/Engine/LitJson/JsonMapper.cs new file mode 100644 index 0000000..0fb17ed --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/JsonMapper.cs @@ -0,0 +1,748 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Reflection; + +namespace LitJson; + +public class JsonMapper +{ + private static int max_nesting_depth; + + private static IFormatProvider datetime_format; + + private static IDictionary base_exporters_table; + + private static IDictionary custom_exporters_table; + + private static IDictionary> base_importers_table; + + private static IDictionary> custom_importers_table; + + private static IDictionary array_metadata; + + private static readonly object array_metadata_lock; + + private static IDictionary> conv_ops; + + private static readonly object conv_ops_lock; + + private static IDictionary object_metadata; + + private static readonly object object_metadata_lock; + + private static IDictionary> type_properties; + + private static readonly object type_properties_lock; + + private static JsonWriter static_writer; + + private static readonly object static_writer_lock; + + static JsonMapper() + { + array_metadata_lock = new object(); + conv_ops_lock = new object(); + object_metadata_lock = new object(); + type_properties_lock = new object(); + static_writer_lock = new object(); + max_nesting_depth = 100; + array_metadata = new Dictionary(); + conv_ops = new Dictionary>(); + object_metadata = new Dictionary(); + type_properties = new Dictionary>(); + static_writer = new JsonWriter(); + datetime_format = DateTimeFormatInfo.InvariantInfo; + base_exporters_table = new Dictionary(); + custom_exporters_table = new Dictionary(); + base_importers_table = new Dictionary>(); + custom_importers_table = new Dictionary>(); + RegisterBaseExporters(); + RegisterBaseImporters(); + } + + private static bool HasInterface(Type type, string name) + { + Type[] interfaces = type.GetInterfaces(); + for (int i = 0; i < interfaces.Length; i++) + { + if (interfaces[i].FullName.Equals(name, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + } + return false; + } + + public static PropertyInfo[] GetPublicInstanceProperties(Type type) + { + return type.GetProperties(); + } + + private static void AddArrayMetadata(Type type) + { + if (array_metadata.ContainsKey(type)) + { + return; + } + ArrayMetadata value = new ArrayMetadata + { + IsArray = type.IsArray + }; + if (HasInterface(type, "System.Collections.IList")) + { + value.IsList = true; + } + PropertyInfo[] publicInstanceProperties = GetPublicInstanceProperties(type); + foreach (PropertyInfo propertyInfo in publicInstanceProperties) + { + if (!(propertyInfo.Name != "Item")) + { + ParameterInfo[] indexParameters = propertyInfo.GetIndexParameters(); + if (indexParameters.Length == 1 && indexParameters[0].ParameterType == typeof(int)) + { + value.ElementType = propertyInfo.PropertyType; + } + } + } + lock (array_metadata_lock) + { + try + { + array_metadata.Add(type, value); + } + catch (ArgumentException) + { + } + } + } + + private static void AddObjectMetadata(Type type) + { + if (object_metadata.ContainsKey(type)) + { + return; + } + ObjectMetadata value = default(ObjectMetadata); + if (HasInterface(type, "System.Collections.IDictionary")) + { + value.IsDictionary = true; + } + value.Properties = new Dictionary(StringComparer.OrdinalIgnoreCase); + PropertyInfo[] publicInstanceProperties = GetPublicInstanceProperties(type); + foreach (PropertyInfo propertyInfo in publicInstanceProperties) + { + if (propertyInfo.Name == "Item") + { + ParameterInfo[] indexParameters = propertyInfo.GetIndexParameters(); + if (indexParameters.Length == 1 && indexParameters[0].ParameterType == typeof(string)) + { + value.ElementType = propertyInfo.PropertyType; + } + } + else + { + PropertyMetadata value2 = new PropertyMetadata + { + Info = propertyInfo, + Type = propertyInfo.PropertyType + }; + value.Properties.Add(propertyInfo.Name, value2); + } + } + FieldInfo[] fields = type.GetFields(); + foreach (FieldInfo fieldInfo in fields) + { + PropertyMetadata value3 = new PropertyMetadata + { + Info = fieldInfo, + IsField = true, + Type = fieldInfo.FieldType + }; + if (!value.Properties.ContainsKey(fieldInfo.Name)) + { + value.Properties.Add(fieldInfo.Name, value3); + } + } + lock (object_metadata_lock) + { + try + { + object_metadata.Add(type, value); + } + catch (ArgumentException) + { + } + } + } + + private static void AddTypeProperties(Type type) + { + if (type_properties.ContainsKey(type)) + { + return; + } + IList list = new List(); + PropertyInfo[] publicInstanceProperties = GetPublicInstanceProperties(type); + foreach (PropertyInfo propertyInfo in publicInstanceProperties) + { + if (!(propertyInfo.Name == "Item")) + { + list.Add(new PropertyMetadata + { + Info = propertyInfo, + IsField = false + }); + } + } + FieldInfo[] fields = type.GetFields(); + foreach (FieldInfo info in fields) + { + list.Add(new PropertyMetadata + { + Info = info, + IsField = true + }); + } + lock (type_properties_lock) + { + try + { + type_properties.Add(type, list); + } + catch (ArgumentException) + { + } + } + } + + private static MethodInfo GetConvOp(Type t1, Type t2) + { + lock (conv_ops_lock) + { + if (!conv_ops.ContainsKey(t1)) + { + conv_ops.Add(t1, new Dictionary()); + } + } + if (conv_ops[t1].ContainsKey(t2)) + { + return conv_ops[t1][t2]; + } + MethodInfo method = t1.GetMethod("op_Implicit", new Type[1] { t2 }); + lock (conv_ops_lock) + { + try + { + conv_ops[t1].Add(t2, method); + return method; + } + catch (ArgumentException) + { + return conv_ops[t1][t2]; + } + } + } + + private static object ReadValue(Type inst_type, JsonReader reader) + { + reader.Read(); + if (reader.Token == JsonToken.ArrayEnd) + { + return null; + } + if (reader.Token == JsonToken.Null) + { + if (!inst_type.IsClass) + { + throw new JsonException($"Can't assign null to an instance of type {inst_type}"); + } + return null; + } + if (reader.Token == JsonToken.Double || reader.Token == JsonToken.Int || reader.Token == JsonToken.Long || reader.Token == JsonToken.String || reader.Token == JsonToken.Boolean) + { + Type type = reader.Value.GetType(); + if (inst_type.IsAssignableFrom(type)) + { + return reader.Value; + } + if (custom_importers_table.ContainsKey(type) && custom_importers_table[type].ContainsKey(inst_type)) + { + return custom_importers_table[type][inst_type](reader.Value); + } + if (base_importers_table.ContainsKey(type) && base_importers_table[type].ContainsKey(inst_type)) + { + return base_importers_table[type][inst_type](reader.Value); + } + if (inst_type.IsEnum) + { + return Enum.ToObject(inst_type, reader.Value); + } + MethodInfo convOp = GetConvOp(inst_type, type); + if (convOp != null) + { + return convOp.Invoke(null, new object[1] { reader.Value }); + } + throw new JsonException($"Can't assign value '{reader.Value}' (type {type}) to type {inst_type}"); + } + object obj = null; + if (reader.Token == JsonToken.ArrayStart) + { + if (inst_type.FullName == "System.Object") + { + inst_type = typeof(object[]); + } + AddArrayMetadata(inst_type); + ArrayMetadata arrayMetadata = array_metadata[inst_type]; + if (!arrayMetadata.IsArray && !arrayMetadata.IsList) + { + throw new JsonException($"Type {inst_type} can't act as an array"); + } + IList list; + Type elementType; + if (!arrayMetadata.IsArray) + { + list = (IList)Activator.CreateInstance(inst_type); + elementType = arrayMetadata.ElementType; + } + else + { + list = new List(); + elementType = inst_type.GetElementType(); + } + while (true) + { + object obj2 = ReadValue(elementType, reader); + if (obj2 == null && reader.Token == JsonToken.ArrayEnd) + { + break; + } + list.Add(obj2); + } + if (arrayMetadata.IsArray) + { + int count = list.Count; + obj = Array.CreateInstance(elementType, count); + for (int i = 0; i < count; i++) + { + ((Array)obj).SetValue(list[i], i); + } + } + else + { + obj = list; + } + } + else if (reader.Token == JsonToken.ObjectStart) + { + if (inst_type == typeof(object)) + { + inst_type = typeof(Dictionary); + } + AddObjectMetadata(inst_type); + ObjectMetadata objectMetadata = object_metadata[inst_type]; + obj = Activator.CreateInstance(inst_type); + while (true) + { + reader.Read(); + if (reader.Token == JsonToken.ObjectEnd) + { + break; + } + string text = (string)reader.Value; + if (objectMetadata.Properties.ContainsKey(text)) + { + PropertyMetadata propertyMetadata = objectMetadata.Properties[text]; + if (propertyMetadata.IsField) + { + ((FieldInfo)propertyMetadata.Info).SetValue(obj, ReadValue(propertyMetadata.Type, reader)); + continue; + } + PropertyInfo propertyInfo = (PropertyInfo)propertyMetadata.Info; + if (propertyInfo.CanWrite) + { + propertyInfo.SetValue(obj, ReadValue(propertyMetadata.Type, reader), null); + } + else + { + ReadValue(propertyMetadata.Type, reader); + } + } + else if (!objectMetadata.IsDictionary) + { + if (!reader.SkipNonMembers) + { + throw new JsonException($"The type {inst_type} doesn't have the property '{text}'"); + } + ReadSkip(reader); + } + else + { + ((IDictionary)obj).Add(text, ReadValue(objectMetadata.ElementType, reader)); + } + } + } + return obj; + } + + private static IJsonWrapper ReadValue(WrapperFactory factory, JsonReader reader) + { + reader.Read(); + if (reader.Token == JsonToken.ArrayEnd || reader.Token == JsonToken.Null) + { + return null; + } + IJsonWrapper jsonWrapper = factory(); + if (reader.Token == JsonToken.String) + { + jsonWrapper.SetString((string)reader.Value); + return jsonWrapper; + } + if (reader.Token == JsonToken.Double) + { + jsonWrapper.SetDouble((double)reader.Value); + return jsonWrapper; + } + if (reader.Token == JsonToken.Int) + { + jsonWrapper.SetInt((int)reader.Value); + return jsonWrapper; + } + if (reader.Token == JsonToken.Long) + { + jsonWrapper.SetLong((long)reader.Value); + return jsonWrapper; + } + if (reader.Token == JsonToken.Boolean) + { + jsonWrapper.SetBoolean((bool)reader.Value); + return jsonWrapper; + } + if (reader.Token == JsonToken.ArrayStart) + { + jsonWrapper.SetJsonType(JsonType.Array); + while (true) + { + IJsonWrapper jsonWrapper2 = ReadValue(factory, reader); + if (jsonWrapper2 == null && reader.Token == JsonToken.ArrayEnd) + { + break; + } + jsonWrapper.Add(jsonWrapper2); + } + } + else if (reader.Token == JsonToken.ObjectStart) + { + jsonWrapper.SetJsonType(JsonType.Object); + while (true) + { + reader.Read(); + if (reader.Token == JsonToken.ObjectEnd) + { + break; + } + string key = (string)reader.Value; + jsonWrapper[key] = ReadValue(factory, reader); + } + } + return jsonWrapper; + } + + private static void ReadSkip(JsonReader reader) + { + ToWrapper(() => new JsonMockWrapper(), reader); + } + + private static void RegisterBaseExporters() + { + base_exporters_table[typeof(byte)] = delegate(object obj, JsonWriter writer) + { + writer.Write(Convert.ToInt32((byte)obj)); + }; + base_exporters_table[typeof(char)] = delegate(object obj, JsonWriter writer) + { + writer.Write(Convert.ToString((char)obj)); + }; + base_exporters_table[typeof(DateTime)] = delegate(object obj, JsonWriter writer) + { + writer.Write(Convert.ToString((DateTime)obj, datetime_format)); + }; + base_exporters_table[typeof(decimal)] = delegate(object obj, JsonWriter writer) + { + writer.Write((decimal)obj); + }; + base_exporters_table[typeof(sbyte)] = delegate(object obj, JsonWriter writer) + { + writer.Write(Convert.ToInt32((sbyte)obj)); + }; + base_exporters_table[typeof(short)] = delegate(object obj, JsonWriter writer) + { + writer.Write(Convert.ToInt32((short)obj)); + }; + base_exporters_table[typeof(ushort)] = delegate(object obj, JsonWriter writer) + { + writer.Write(Convert.ToInt32((ushort)obj)); + }; + base_exporters_table[typeof(uint)] = delegate(object obj, JsonWriter writer) + { + writer.Write(Convert.ToUInt64((uint)obj)); + }; + base_exporters_table[typeof(ulong)] = delegate(object obj, JsonWriter writer) + { + writer.Write((ulong)obj); + }; + } + + private static void RegisterBaseImporters() + { + ImporterFunc importer = (object input) => Convert.ToByte((int)input); + RegisterImporter(base_importers_table, typeof(int), typeof(byte), importer); + importer = (object input) => Convert.ToUInt64((int)input); + RegisterImporter(base_importers_table, typeof(int), typeof(ulong), importer); + importer = (object input) => Convert.ToSByte((int)input); + RegisterImporter(base_importers_table, typeof(int), typeof(sbyte), importer); + importer = (object input) => Convert.ToInt16((int)input); + RegisterImporter(base_importers_table, typeof(int), typeof(short), importer); + importer = (object input) => Convert.ToUInt16((int)input); + RegisterImporter(base_importers_table, typeof(int), typeof(ushort), importer); + importer = (object input) => Convert.ToUInt32((int)input); + RegisterImporter(base_importers_table, typeof(int), typeof(uint), importer); + importer = (object input) => Convert.ToSingle((int)input); + RegisterImporter(base_importers_table, typeof(int), typeof(float), importer); + importer = (object input) => Convert.ToDouble((int)input); + RegisterImporter(base_importers_table, typeof(int), typeof(double), importer); + importer = (object input) => Convert.ToDecimal((double)input); + RegisterImporter(base_importers_table, typeof(double), typeof(decimal), importer); + importer = (object input) => Convert.ToUInt32((long)input); + RegisterImporter(base_importers_table, typeof(long), typeof(uint), importer); + importer = (object input) => Convert.ToChar((string)input); + RegisterImporter(base_importers_table, typeof(string), typeof(char), importer); + importer = (object input) => Convert.ToDateTime((string)input, datetime_format); + RegisterImporter(base_importers_table, typeof(string), typeof(DateTime), importer); + } + + private static void RegisterImporter(IDictionary> table, Type json_type, Type value_type, ImporterFunc importer) + { + if (!table.ContainsKey(json_type)) + { + table.Add(json_type, new Dictionary()); + } + table[json_type][value_type] = importer; + } + + private static void WriteValue(object obj, JsonWriter writer, bool writer_is_private, int depth) + { + if (depth > max_nesting_depth) + { + throw new JsonException($"Max allowed object depth reached while trying to export from type {obj.GetType()}"); + } + if (obj == null) + { + writer.Write(null); + return; + } + if (obj is IJsonWrapper) + { + if (writer_is_private) + { + writer.TextWriter.Write(((IJsonWrapper)obj).ToJson()); + } + else + { + ((IJsonWrapper)obj).ToJson(writer); + } + return; + } + if (obj is string) + { + writer.Write((string)obj); + return; + } + if (obj is double) + { + writer.Write((double)obj); + return; + } + if (obj is int) + { + writer.Write((int)obj); + return; + } + if (obj is bool) + { + writer.Write((bool)obj); + return; + } + if (obj is long) + { + writer.Write((long)obj); + return; + } + if (obj is Array) + { + writer.WriteArrayStart(); + foreach (object item in (Array)obj) + { + WriteValue(item, writer, writer_is_private, depth + 1); + } + writer.WriteArrayEnd(); + return; + } + if (obj is IList) + { + writer.WriteArrayStart(); + foreach (object item2 in (IList)obj) + { + WriteValue(item2, writer, writer_is_private, depth + 1); + } + writer.WriteArrayEnd(); + return; + } + if (obj is IDictionary) + { + writer.WriteObjectStart(); + foreach (DictionaryEntry item3 in (IDictionary)obj) + { + writer.WritePropertyName((string)item3.Key); + WriteValue(item3.Value, writer, writer_is_private, depth + 1); + } + writer.WriteObjectEnd(); + return; + } + Type type = obj.GetType(); + if (custom_exporters_table.ContainsKey(type)) + { + custom_exporters_table[type](obj, writer); + return; + } + if (base_exporters_table.ContainsKey(type)) + { + base_exporters_table[type](obj, writer); + return; + } + if (obj is Enum) + { + Type underlyingType = Enum.GetUnderlyingType(type); + if (underlyingType == typeof(long) || underlyingType == typeof(uint) || underlyingType == typeof(ulong)) + { + writer.Write((ulong)obj); + } + else + { + writer.Write((int)obj); + } + return; + } + AddTypeProperties(type); + IList list = type_properties[type]; + writer.WriteObjectStart(); + foreach (PropertyMetadata item4 in list) + { + if (item4.IsField) + { + writer.WritePropertyName(item4.Info.Name); + WriteValue(((FieldInfo)item4.Info).GetValue(obj), writer, writer_is_private, depth + 1); + continue; + } + PropertyInfo propertyInfo = (PropertyInfo)item4.Info; + if (propertyInfo.CanRead) + { + writer.WritePropertyName(item4.Info.Name); + WriteValue(propertyInfo.GetValue(obj, null), writer, writer_is_private, depth + 1); + } + } + writer.WriteObjectEnd(); + } + + public static string ToJson(object obj) + { + lock (static_writer_lock) + { + static_writer.Reset(); + WriteValue(obj, static_writer, writer_is_private: true, 0); + return static_writer.ToString(); + } + } + + public static void ToJson(object obj, JsonWriter writer) + { + WriteValue(obj, writer, writer_is_private: false, 0); + } + + public static JsonData ToObject(JsonReader reader) + { + return (JsonData)ToWrapper(() => new JsonData(), reader); + } + + public static JsonData ToObject(TextReader reader) + { + JsonReader reader2 = new JsonReader(reader); + return (JsonData)ToWrapper(() => new JsonData(), reader2); + } + + public static JsonData ToObject(string json) + { + return (JsonData)ToWrapper(() => new JsonData(), json); + } + + public static T ToObject(JsonReader reader) + { + return (T)ReadValue(typeof(T), reader); + } + + public static T ToObject(TextReader reader) + { + JsonReader reader2 = new JsonReader(reader); + return (T)ReadValue(typeof(T), reader2); + } + + public static T ToObject(string json) + { + JsonReader reader = new JsonReader(json); + return (T)ReadValue(typeof(T), reader); + } + + public static object ToObject(Type toType, string json) + { + JsonReader reader = new JsonReader(json); + return ReadValue(toType, reader); + } + + public static IJsonWrapper ToWrapper(WrapperFactory factory, JsonReader reader) + { + return ReadValue(factory, reader); + } + + public static IJsonWrapper ToWrapper(WrapperFactory factory, string json) + { + JsonReader reader = new JsonReader(json); + return ReadValue(factory, reader); + } + + public static void RegisterExporter(ExporterFunc exporter) + { + ExporterFunc value = delegate(object obj, JsonWriter writer) + { + exporter((T)obj, writer); + }; + custom_exporters_table[typeof(T)] = value; + } + + public static void RegisterImporter(ImporterFunc importer) + { + ImporterFunc importer2 = (object input) => importer((TJson)input); + RegisterImporter(custom_importers_table, typeof(TJson), typeof(TValue), importer2); + } + + public static void UnregisterExporters() + { + custom_exporters_table.Clear(); + } + + public static void UnregisterImporters() + { + custom_importers_table.Clear(); + } +} diff --git a/SVSim.BattleEngine/Engine/LitJson/JsonMockWrapper.cs b/SVSim.BattleEngine/Engine/LitJson/JsonMockWrapper.cs new file mode 100644 index 0000000..7a38bf3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/JsonMockWrapper.cs @@ -0,0 +1,210 @@ +using System; +using System.Collections; + +namespace LitJson; + +public class JsonMockWrapper : IJsonWrapper, IList, ICollection, IEnumerable, IOrderedDictionary, IDictionary +{ + public bool IsArray => false; + + public bool IsBoolean => false; + + public bool IsDouble => false; + + public bool IsInt => false; + + public bool IsLong => false; + + public bool IsObject => false; + + public bool IsString => false; + + bool IList.IsFixedSize => true; + + bool IList.IsReadOnly => true; + + object IList.this[int index] + { + get + { + return null; + } + set + { + } + } + + int ICollection.Count => 0; + + bool ICollection.IsSynchronized => false; + + object ICollection.SyncRoot => null; + + bool IDictionary.IsFixedSize => true; + + bool IDictionary.IsReadOnly => true; + + ICollection IDictionary.Keys => null; + + ICollection IDictionary.Values => null; + + object IDictionary.this[object key] + { + get + { + return null; + } + set + { + } + } + + object IOrderedDictionary.this[int idx] + { + get + { + return null; + } + set + { + } + } + + public bool GetBoolean() + { + return false; + } + + public double GetDouble() + { + return 0.0; + } + + public int GetInt() + { + return 0; + } + + public JsonType GetJsonType() + { + return JsonType.None; + } + + public long GetLong() + { + return 0L; + } + + public string GetString() + { + return ""; + } + + public void SetBoolean(bool val) + { + } + + public void SetDouble(double val) + { + } + + public void SetInt(int val) + { + } + + public void SetJsonType(JsonType type) + { + } + + public void SetLong(long val) + { + } + + public void SetString(string val) + { + } + + public string ToJson() + { + return ""; + } + + public void ToJson(JsonWriter writer) + { + } + + int IList.Add(object value) + { + return 0; + } + + void IList.Clear() + { + } + + bool IList.Contains(object value) + { + return false; + } + + int IList.IndexOf(object value) + { + return -1; + } + + void IList.Insert(int i, object v) + { + } + + void IList.Remove(object value) + { + } + + void IList.RemoveAt(int index) + { + } + + void ICollection.CopyTo(Array array, int index) + { + } + + IEnumerator IEnumerable.GetEnumerator() + { + return null; + } + + void IDictionary.Add(object k, object v) + { + } + + void IDictionary.Clear() + { + } + + bool IDictionary.Contains(object key) + { + return false; + } + + void IDictionary.Remove(object key) + { + } + + IDictionaryEnumerator IDictionary.GetEnumerator() + { + return null; + } + + IDictionaryEnumerator IOrderedDictionary.GetEnumerator() + { + return null; + } + + void IOrderedDictionary.Insert(int i, object k, object v) + { + } + + void IOrderedDictionary.RemoveAt(int i) + { + } +} diff --git a/SVSim.BattleEngine/Engine/LitJson/JsonReader.cs b/SVSim.BattleEngine/Engine/LitJson/JsonReader.cs new file mode 100644 index 0000000..5a39f8a --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/JsonReader.cs @@ -0,0 +1,366 @@ +using System; +using System.Collections.Generic; +using System.IO; + +namespace LitJson; + +public class JsonReader +{ + private static IDictionary> parse_table; + + private Stack automaton_stack; + + private int current_input; + + private int current_symbol; + + private bool end_of_json; + + private bool end_of_input; + + private Lexer lexer; + + private bool parser_in_string; + + private bool parser_return; + + private bool read_started; + + private TextReader reader; + + private bool reader_is_owned; + + private bool skip_non_members; + + private object token_value; + + private JsonToken token; + + public bool AllowComments + { + get + { + return lexer.AllowComments; + } + set + { + lexer.AllowComments = value; + } + } + + public bool AllowSingleQuotedStrings + { + get + { + return lexer.AllowSingleQuotedStrings; + } + set + { + lexer.AllowSingleQuotedStrings = value; + } + } + + public bool SkipNonMembers + { + get + { + return skip_non_members; + } + set + { + skip_non_members = value; + } + } + + public bool EndOfInput => end_of_input; + + public bool EndOfJson => end_of_json; + + public JsonToken Token => token; + + public object Value => token_value; + + static JsonReader() + { + PopulateParseTable(); + } + + public JsonReader(string json_text) + : this(new StringReader(json_text), owned: true) + { + } + + public JsonReader(TextReader reader) + : this(reader, owned: false) + { + } + + private JsonReader(TextReader reader, bool owned) + { + if (reader == null) + { + throw new ArgumentNullException("reader"); + } + parser_in_string = false; + parser_return = false; + read_started = false; + automaton_stack = new Stack(); + automaton_stack.Push(65553); + automaton_stack.Push(65543); + lexer = new Lexer(reader); + end_of_input = false; + end_of_json = false; + skip_non_members = true; + this.reader = reader; + reader_is_owned = owned; + } + + private static void PopulateParseTable() + { + parse_table = new Dictionary>(); + TableAddRow(ParserToken.Array); + TableAddCol(ParserToken.Array, 91, 91, 65549); + TableAddRow(ParserToken.ArrayPrime); + TableAddCol(ParserToken.ArrayPrime, 34, 65550, 65551, 93); + TableAddCol(ParserToken.ArrayPrime, 91, 65550, 65551, 93); + TableAddCol(ParserToken.ArrayPrime, 93, 93); + TableAddCol(ParserToken.ArrayPrime, 123, 65550, 65551, 93); + TableAddCol(ParserToken.ArrayPrime, 65537, 65550, 65551, 93); + TableAddCol(ParserToken.ArrayPrime, 65538, 65550, 65551, 93); + TableAddCol(ParserToken.ArrayPrime, 65539, 65550, 65551, 93); + TableAddCol(ParserToken.ArrayPrime, 65540, 65550, 65551, 93); + TableAddRow(ParserToken.Object); + TableAddCol(ParserToken.Object, 123, 123, 65545); + TableAddRow(ParserToken.ObjectPrime); + TableAddCol(ParserToken.ObjectPrime, 34, 65546, 65547, 125); + TableAddCol(ParserToken.ObjectPrime, 125, 125); + TableAddRow(ParserToken.Pair); + TableAddCol(ParserToken.Pair, 34, 65552, 58, 65550); + TableAddRow(ParserToken.PairRest); + TableAddCol(ParserToken.PairRest, 44, 44, 65546, 65547); + TableAddCol(ParserToken.PairRest, 125, 65554); + TableAddRow(ParserToken.String); + TableAddCol(ParserToken.String, 34, 34, 65541, 34); + TableAddRow(ParserToken.Text); + TableAddCol(ParserToken.Text, 91, 65548); + TableAddCol(ParserToken.Text, 123, 65544); + TableAddRow(ParserToken.Value); + TableAddCol(ParserToken.Value, 34, 65552); + TableAddCol(ParserToken.Value, 91, 65548); + TableAddCol(ParserToken.Value, 123, 65544); + TableAddCol(ParserToken.Value, 65537, 65537); + TableAddCol(ParserToken.Value, 65538, 65538); + TableAddCol(ParserToken.Value, 65539, 65539); + TableAddCol(ParserToken.Value, 65540, 65540); + TableAddRow(ParserToken.ValueRest); + TableAddCol(ParserToken.ValueRest, 44, 44, 65550, 65551); + TableAddCol(ParserToken.ValueRest, 93, 65554); + } + + private static void TableAddCol(ParserToken row, int col, params int[] symbols) + { + parse_table[(int)row].Add(col, symbols); + } + + private static void TableAddRow(ParserToken rule) + { + parse_table.Add((int)rule, new Dictionary()); + } + + private void ProcessNumber(string number) + { + int result2; + long result3; + if ((number.IndexOf('.') != -1 || number.IndexOf('e') != -1 || number.IndexOf('E') != -1) && double.TryParse(number, out var result)) + { + token = JsonToken.Double; + token_value = result; + } + else if (int.TryParse(number, out result2)) + { + token = JsonToken.Int; + token_value = result2; + } + else if (long.TryParse(number, out result3)) + { + token = JsonToken.Long; + token_value = result3; + } + else + { + token = JsonToken.Int; + token_value = 0; + } + } + + private void ProcessSymbol() + { + if (current_symbol == 91) + { + token = JsonToken.ArrayStart; + parser_return = true; + } + else if (current_symbol == 93) + { + token = JsonToken.ArrayEnd; + parser_return = true; + } + else if (current_symbol == 123) + { + token = JsonToken.ObjectStart; + parser_return = true; + } + else if (current_symbol == 125) + { + token = JsonToken.ObjectEnd; + parser_return = true; + } + else if (current_symbol == 34) + { + if (parser_in_string) + { + parser_in_string = false; + parser_return = true; + return; + } + if (token == JsonToken.None) + { + token = JsonToken.String; + } + parser_in_string = true; + } + else if (current_symbol == 65541) + { + token_value = lexer.StringValue; + } + else if (current_symbol == 65539) + { + token = JsonToken.Boolean; + token_value = false; + parser_return = true; + } + else if (current_symbol == 65540) + { + token = JsonToken.Null; + parser_return = true; + } + else if (current_symbol == 65537) + { + ProcessNumber(lexer.StringValue); + parser_return = true; + } + else if (current_symbol == 65546) + { + token = JsonToken.PropertyName; + } + else if (current_symbol == 65538) + { + token = JsonToken.Boolean; + token_value = true; + parser_return = true; + } + } + + private bool ReadToken() + { + if (end_of_input) + { + return false; + } + lexer.NextToken(); + if (lexer.EndOfInput) + { + Close(); + return false; + } + current_input = lexer.Token; + return true; + } + + public void Close() + { + if (!end_of_input) + { + end_of_input = true; + end_of_json = true; + if (reader_is_owned) + { + reader.Dispose(); + } + reader = null; + } + } + + public bool Read() + { + if (end_of_input) + { + return false; + } + if (end_of_json) + { + end_of_json = false; + automaton_stack.Clear(); + automaton_stack.Push(65553); + automaton_stack.Push(65543); + } + parser_in_string = false; + parser_return = false; + token = JsonToken.None; + token_value = null; + if (!read_started) + { + read_started = true; + if (!ReadToken()) + { + return false; + } + } + while (true) + { + if (parser_return) + { + if (automaton_stack.Peek() == 65553) + { + end_of_json = true; + } + return true; + } + current_symbol = automaton_stack.Pop(); + ProcessSymbol(); + if (current_symbol == current_input) + { + if (!ReadToken()) + { + break; + } + continue; + } + int[] array; + try + { + array = parse_table[current_symbol][current_input]; + } + catch (KeyNotFoundException inner_exception) + { + throw new JsonException((ParserToken)current_input, inner_exception); + } + if (array[0] != 65554) + { + for (int num = array.Length - 1; num >= 0; num--) + { + automaton_stack.Push(array[num]); + } + } + } + if (automaton_stack.Peek() != 65553) + { + throw new JsonException("Input doesn't evaluate to proper JSON text"); + } + if (parser_return) + { + return true; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/LitJson/JsonToken.cs b/SVSim.BattleEngine/Engine/LitJson/JsonToken.cs new file mode 100644 index 0000000..dc62217 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/JsonToken.cs @@ -0,0 +1,17 @@ +namespace LitJson; + +public enum JsonToken +{ + None, + ObjectStart, + PropertyName, + ObjectEnd, + ArrayStart, + ArrayEnd, + Int, + Long, + Double, + String, + Boolean, + Null +} diff --git a/SVSim.BattleEngine/Engine/LitJson/JsonType.cs b/SVSim.BattleEngine/Engine/LitJson/JsonType.cs new file mode 100644 index 0000000..92daf20 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/JsonType.cs @@ -0,0 +1,13 @@ +namespace LitJson; + +public enum JsonType +{ + None, + Object, + Array, + String, + Int, + Long, + Double, + Boolean +} diff --git a/SVSim.BattleEngine/Engine/LitJson/JsonWriter.cs b/SVSim.BattleEngine/Engine/LitJson/JsonWriter.cs new file mode 100644 index 0000000..1db0098 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/JsonWriter.cs @@ -0,0 +1,435 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; + +namespace LitJson; + +public class JsonWriter +{ + private static NumberFormatInfo number_format; + + private WriterContext context; + + private Stack ctx_stack; + + private bool has_reached_end; + + private char[] hex_seq; + + private int indentation; + + private int indent_value; + + private StringBuilder inst_string_builder; + + private bool pretty_print; + + private bool validate; + + private TextWriter writer; + + public int IndentValue + { + get + { + return indent_value; + } + set + { + indentation = indentation / indent_value * value; + indent_value = value; + } + } + + public bool PrettyPrint + { + get + { + return pretty_print; + } + set + { + pretty_print = value; + } + } + + public TextWriter TextWriter => writer; + + public bool Validate + { + get + { + return validate; + } + set + { + validate = value; + } + } + + static JsonWriter() + { + number_format = NumberFormatInfo.InvariantInfo; + } + + public JsonWriter() + { + inst_string_builder = new StringBuilder(); + writer = new StringWriter(inst_string_builder); + Init(); + } + + public JsonWriter(StringBuilder sb) + : this(new StringWriter(sb)) + { + } + + public JsonWriter(TextWriter writer) + { + if (writer == null) + { + throw new ArgumentNullException("writer"); + } + this.writer = writer; + Init(); + } + + private void DoValidation(Condition cond) + { + if (!context.ExpectingValue) + { + context.Count++; + } + if (!validate) + { + return; + } + if (has_reached_end) + { + throw new JsonException("A complete JSON symbol has already been written"); + } + switch (cond) + { + case Condition.InArray: + if (!context.InArray) + { + throw new JsonException("Can't close an array here"); + } + break; + case Condition.InObject: + if (!context.InObject || context.ExpectingValue) + { + throw new JsonException("Can't close an object here"); + } + break; + case Condition.NotAProperty: + if (context.InObject && !context.ExpectingValue) + { + throw new JsonException("Expected a property"); + } + break; + case Condition.Property: + if (!context.InObject || context.ExpectingValue) + { + throw new JsonException("Can't add a property here"); + } + break; + case Condition.Value: + if (!context.InArray && (!context.InObject || !context.ExpectingValue)) + { + throw new JsonException("Can't add a value here"); + } + break; + } + } + + private void Init() + { + has_reached_end = false; + hex_seq = new char[4]; + indentation = 0; + indent_value = 4; + pretty_print = false; + validate = true; + ctx_stack = new Stack(); + context = new WriterContext(); + ctx_stack.Push(context); + } + + private static void IntToHex(int n, char[] hex) + { + for (int i = 0; i < 4; i++) + { + int num = n % 16; + if (num < 10) + { + hex[3 - i] = (char)(48 + num); + } + else + { + hex[3 - i] = (char)(65 + (num - 10)); + } + n >>= 4; + } + } + + private void Indent() + { + if (pretty_print) + { + indentation += indent_value; + } + } + + private void Put(string str) + { + if (pretty_print && !context.ExpectingValue) + { + for (int i = 0; i < indentation; i++) + { + writer.Write(' '); + } + } + writer.Write(str); + } + + private void PutNewline() + { + PutNewline(add_comma: true); + } + + private void PutNewline(bool add_comma) + { + if (add_comma && !context.ExpectingValue && context.Count > 1) + { + writer.Write(','); + } + if (pretty_print && !context.ExpectingValue) + { + writer.Write('\n'); + } + } + + private void PutString(string str) + { + Put(string.Empty); + writer.Write('"'); + int length = str.Length; + for (int i = 0; i < length; i++) + { + switch (str[i]) + { + case '\n': + writer.Write("\\n"); + continue; + case '\r': + writer.Write("\\r"); + continue; + case '\t': + writer.Write("\\t"); + continue; + case '"': + case '\\': + writer.Write('\\'); + writer.Write(str[i]); + continue; + case '\f': + writer.Write("\\f"); + continue; + case '\b': + writer.Write("\\b"); + continue; + } + if (str[i] >= ' ' && str[i] <= '~') + { + writer.Write(str[i]); + continue; + } + IntToHex(str[i], hex_seq); + writer.Write("\\u"); + writer.Write(hex_seq); + } + writer.Write('"'); + } + + private void Unindent() + { + if (pretty_print) + { + indentation -= indent_value; + } + } + + public override string ToString() + { + if (inst_string_builder == null) + { + return string.Empty; + } + return inst_string_builder.ToString(); + } + + public void Reset() + { + has_reached_end = false; + ctx_stack.Clear(); + context = new WriterContext(); + ctx_stack.Push(context); + if (inst_string_builder != null) + { + inst_string_builder.Remove(0, inst_string_builder.Length); + } + } + + public void Write(bool boolean) + { + DoValidation(Condition.Value); + PutNewline(); + Put(boolean ? "true" : "false"); + context.ExpectingValue = false; + } + + public void Write(decimal number) + { + DoValidation(Condition.Value); + PutNewline(); + Put(Convert.ToString(number, number_format)); + context.ExpectingValue = false; + } + + public void Write(double number) + { + DoValidation(Condition.Value); + PutNewline(); + string text = Convert.ToString(number, number_format); + Put(text); + if (text.IndexOf('.') == -1 && text.IndexOf('E') == -1) + { + writer.Write(".0"); + } + context.ExpectingValue = false; + } + + public void Write(int number) + { + DoValidation(Condition.Value); + PutNewline(); + Put(Convert.ToString(number, number_format)); + context.ExpectingValue = false; + } + + public void Write(long number) + { + DoValidation(Condition.Value); + PutNewline(); + Put(Convert.ToString(number, number_format)); + context.ExpectingValue = false; + } + + public void Write(string str) + { + DoValidation(Condition.Value); + PutNewline(); + if (str == null) + { + Put("null"); + } + else + { + PutString(str); + } + context.ExpectingValue = false; + } + + public void Write(ulong number) + { + DoValidation(Condition.Value); + PutNewline(); + Put(Convert.ToString(number, number_format)); + context.ExpectingValue = false; + } + + public void WriteArrayEnd() + { + DoValidation(Condition.InArray); + PutNewline(add_comma: false); + ctx_stack.Pop(); + if (ctx_stack.Count == 1) + { + has_reached_end = true; + } + else + { + context = ctx_stack.Peek(); + context.ExpectingValue = false; + } + Unindent(); + Put("]"); + } + + public void WriteArrayStart() + { + DoValidation(Condition.NotAProperty); + PutNewline(); + Put("["); + context = new WriterContext(); + context.InArray = true; + ctx_stack.Push(context); + Indent(); + } + + public void WriteObjectEnd() + { + DoValidation(Condition.InObject); + PutNewline(add_comma: false); + ctx_stack.Pop(); + if (ctx_stack.Count == 1) + { + has_reached_end = true; + } + else + { + context = ctx_stack.Peek(); + context.ExpectingValue = false; + } + Unindent(); + Put("}"); + } + + public void WriteObjectStart() + { + DoValidation(Condition.NotAProperty); + PutNewline(); + Put("{"); + context = new WriterContext(); + context.InObject = true; + ctx_stack.Push(context); + Indent(); + } + + public void WritePropertyName(string property_name) + { + DoValidation(Condition.Property); + PutNewline(); + PutString(property_name); + if (pretty_print) + { + if (property_name.Length > context.Padding) + { + context.Padding = property_name.Length; + } + for (int num = context.Padding - property_name.Length; num >= 0; num--) + { + writer.Write(' '); + } + writer.Write(": "); + } + else + { + writer.Write(':'); + } + context.ExpectingValue = true; + } +} diff --git a/SVSim.BattleEngine/Engine/LitJson/Lexer.cs b/SVSim.BattleEngine/Engine/LitJson/Lexer.cs new file mode 100644 index 0000000..53e90f6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/Lexer.cs @@ -0,0 +1,753 @@ +using System; +using System.IO; +using System.Text; + +namespace LitJson; + +internal class Lexer +{ + private delegate bool StateHandler(FsmContext ctx); + + private static int[] fsm_return_table; + + private static StateHandler[] fsm_handler_table; + + private bool allow_comments; + + private bool allow_single_quoted_strings; + + private bool end_of_input; + + private FsmContext fsm_context; + + private int input_buffer; + + private int input_char; + + private TextReader reader; + + private int state; + + private StringBuilder string_buffer; + + private string string_value; + + private int token; + + private int unichar; + + public bool AllowComments + { + get + { + return allow_comments; + } + set + { + allow_comments = value; + } + } + + public bool AllowSingleQuotedStrings + { + get + { + return allow_single_quoted_strings; + } + set + { + allow_single_quoted_strings = value; + } + } + + public bool EndOfInput => end_of_input; + + public int Token => token; + + public string StringValue => string_value; + + static Lexer() + { + PopulateFsmTables(); + } + + public Lexer(TextReader reader) + { + allow_comments = true; + allow_single_quoted_strings = true; + input_buffer = 0; + string_buffer = new StringBuilder(128); + state = 1; + end_of_input = false; + this.reader = reader; + fsm_context = new FsmContext(); + fsm_context.L = this; + } + + private static int HexValue(int digit) + { + switch (digit) + { + case 65: + case 97: + return 10; + case 66: + case 98: + return 11; + case 67: + case 99: + return 12; + case 68: + case 100: + return 13; + case 69: + case 101: + return 14; + case 70: + case 102: + return 15; + default: + return digit - 48; + } + } + + private static void PopulateFsmTables() + { + fsm_handler_table = new StateHandler[28] + { + State1, State2, State3, State4, State5, State6, State7, State8, State9, State10, + State11, State12, State13, State14, State15, State16, State17, State18, State19, State20, + State21, State22, State23, State24, State25, State26, State27, State28 + }; + fsm_return_table = new int[28] + { + 65542, 0, 65537, 65537, 0, 65537, 0, 65537, 0, 0, + 65538, 0, 0, 0, 65539, 0, 0, 65540, 65541, 65542, + 0, 0, 65541, 65542, 0, 0, 0, 0 + }; + } + + private static char ProcessEscChar(int esc_char) + { + switch (esc_char) + { + case 34: + case 39: + case 47: + case 92: + return Convert.ToChar(esc_char); + case 110: + return '\n'; + case 116: + return '\t'; + case 114: + return '\r'; + case 98: + return '\b'; + case 102: + return '\f'; + default: + return '?'; + } + } + + private static bool State1(FsmContext ctx) + { + while (ctx.L.GetChar()) + { + if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13)) + { + continue; + } + if (ctx.L.input_char >= 49 && ctx.L.input_char <= 57) + { + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 3; + return true; + } + switch (ctx.L.input_char) + { + case 34: + ctx.NextState = 19; + ctx.Return = true; + return true; + case 44: + case 58: + case 91: + case 93: + case 123: + case 125: + ctx.NextState = 1; + ctx.Return = true; + return true; + case 45: + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 2; + return true; + case 48: + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 4; + return true; + case 102: + ctx.NextState = 12; + return true; + case 110: + ctx.NextState = 16; + return true; + case 116: + ctx.NextState = 9; + return true; + case 39: + if (!ctx.L.allow_single_quoted_strings) + { + return false; + } + ctx.L.input_char = 34; + ctx.NextState = 23; + ctx.Return = true; + return true; + case 47: + if (!ctx.L.allow_comments) + { + return false; + } + ctx.NextState = 25; + return true; + default: + return false; + } + } + return true; + } + + private static bool State2(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char >= 49 && ctx.L.input_char <= 57) + { + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 3; + return true; + } + if (ctx.L.input_char == 48) + { + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 4; + return true; + } + return false; + } + + private static bool State3(FsmContext ctx) + { + while (ctx.L.GetChar()) + { + if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57) + { + ctx.L.string_buffer.Append((char)ctx.L.input_char); + continue; + } + if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13)) + { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + switch (ctx.L.input_char) + { + case 44: + case 93: + case 125: + ctx.L.UngetChar(); + ctx.Return = true; + ctx.NextState = 1; + return true; + case 46: + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 5; + return true; + case 69: + case 101: + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 7; + return true; + default: + return false; + } + } + return true; + } + + private static bool State4(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13)) + { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + switch (ctx.L.input_char) + { + case 44: + case 93: + case 125: + ctx.L.UngetChar(); + ctx.Return = true; + ctx.NextState = 1; + return true; + case 46: + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 5; + return true; + case 69: + case 101: + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 7; + return true; + default: + return false; + } + } + + private static bool State5(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57) + { + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 6; + return true; + } + return false; + } + + private static bool State6(FsmContext ctx) + { + while (ctx.L.GetChar()) + { + if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57) + { + ctx.L.string_buffer.Append((char)ctx.L.input_char); + continue; + } + if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13)) + { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + switch (ctx.L.input_char) + { + case 44: + case 93: + case 125: + ctx.L.UngetChar(); + ctx.Return = true; + ctx.NextState = 1; + return true; + case 69: + case 101: + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 7; + return true; + default: + return false; + } + } + return true; + } + + private static bool State7(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57) + { + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 8; + return true; + } + int num = ctx.L.input_char; + if (num == 43 || num == 45) + { + ctx.L.string_buffer.Append((char)ctx.L.input_char); + ctx.NextState = 8; + return true; + } + return false; + } + + private static bool State8(FsmContext ctx) + { + while (ctx.L.GetChar()) + { + if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57) + { + ctx.L.string_buffer.Append((char)ctx.L.input_char); + continue; + } + if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13)) + { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + int num = ctx.L.input_char; + if (num == 44 || num == 93 || num == 125) + { + ctx.L.UngetChar(); + ctx.Return = true; + ctx.NextState = 1; + return true; + } + return false; + } + return true; + } + + private static bool State9(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 114) + { + ctx.NextState = 10; + return true; + } + return false; + } + + private static bool State10(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 117) + { + ctx.NextState = 11; + return true; + } + return false; + } + + private static bool State11(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 101) + { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + return false; + } + + private static bool State12(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 97) + { + ctx.NextState = 13; + return true; + } + return false; + } + + private static bool State13(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 108) + { + ctx.NextState = 14; + return true; + } + return false; + } + + private static bool State14(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 115) + { + ctx.NextState = 15; + return true; + } + return false; + } + + private static bool State15(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 101) + { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + return false; + } + + private static bool State16(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 117) + { + ctx.NextState = 17; + return true; + } + return false; + } + + private static bool State17(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 108) + { + ctx.NextState = 18; + return true; + } + return false; + } + + private static bool State18(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 108) + { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + return false; + } + + private static bool State19(FsmContext ctx) + { + while (ctx.L.GetChar()) + { + switch (ctx.L.input_char) + { + case 34: + ctx.L.UngetChar(); + ctx.Return = true; + ctx.NextState = 20; + return true; + case 92: + ctx.StateStack = 19; + ctx.NextState = 21; + return true; + } + ctx.L.string_buffer.Append((char)ctx.L.input_char); + } + return true; + } + + private static bool State20(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 34) + { + ctx.Return = true; + ctx.NextState = 1; + return true; + } + return false; + } + + private static bool State21(FsmContext ctx) + { + ctx.L.GetChar(); + switch (ctx.L.input_char) + { + case 117: + ctx.NextState = 22; + return true; + case 34: + case 39: + case 47: + case 92: + case 98: + case 102: + case 110: + case 114: + case 116: + ctx.L.string_buffer.Append(ProcessEscChar(ctx.L.input_char)); + ctx.NextState = ctx.StateStack; + return true; + default: + return false; + } + } + + private static bool State22(FsmContext ctx) + { + int num = 0; + int num2 = 4096; + ctx.L.unichar = 0; + while (ctx.L.GetChar()) + { + if ((ctx.L.input_char >= 48 && ctx.L.input_char <= 57) || (ctx.L.input_char >= 65 && ctx.L.input_char <= 70) || (ctx.L.input_char >= 97 && ctx.L.input_char <= 102)) + { + ctx.L.unichar += HexValue(ctx.L.input_char) * num2; + num++; + num2 /= 16; + if (num == 4) + { + ctx.L.string_buffer.Append(Convert.ToChar(ctx.L.unichar)); + ctx.NextState = ctx.StateStack; + return true; + } + continue; + } + return false; + } + return true; + } + + private static bool State23(FsmContext ctx) + { + while (ctx.L.GetChar()) + { + switch (ctx.L.input_char) + { + case 39: + ctx.L.UngetChar(); + ctx.Return = true; + ctx.NextState = 24; + return true; + case 92: + ctx.StateStack = 23; + ctx.NextState = 21; + return true; + } + ctx.L.string_buffer.Append((char)ctx.L.input_char); + } + return true; + } + + private static bool State24(FsmContext ctx) + { + ctx.L.GetChar(); + if (ctx.L.input_char == 39) + { + ctx.L.input_char = 34; + ctx.Return = true; + ctx.NextState = 1; + return true; + } + return false; + } + + private static bool State25(FsmContext ctx) + { + ctx.L.GetChar(); + switch (ctx.L.input_char) + { + case 42: + ctx.NextState = 27; + return true; + case 47: + ctx.NextState = 26; + return true; + default: + return false; + } + } + + private static bool State26(FsmContext ctx) + { + while (ctx.L.GetChar()) + { + if (ctx.L.input_char == 10) + { + ctx.NextState = 1; + return true; + } + } + return true; + } + + private static bool State27(FsmContext ctx) + { + while (ctx.L.GetChar()) + { + if (ctx.L.input_char == 42) + { + ctx.NextState = 28; + return true; + } + } + return true; + } + + private static bool State28(FsmContext ctx) + { + while (ctx.L.GetChar()) + { + if (ctx.L.input_char != 42) + { + if (ctx.L.input_char == 47) + { + ctx.NextState = 1; + return true; + } + ctx.NextState = 27; + return true; + } + } + return true; + } + + private bool GetChar() + { + if ((input_char = NextChar()) != -1) + { + return true; + } + end_of_input = true; + return false; + } + + private int NextChar() + { + if (input_buffer != 0) + { + int result = input_buffer; + input_buffer = 0; + return result; + } + return reader.Read(); + } + + public bool NextToken() + { + fsm_context.Return = false; + while (true) + { + if (!fsm_handler_table[state - 1](fsm_context)) + { + throw new JsonException(input_char); + } + if (end_of_input) + { + return false; + } + if (fsm_context.Return) + { + break; + } + state = fsm_context.NextState; + } + string_value = string_buffer.ToString(); + string_buffer.Remove(0, string_buffer.Length); + token = fsm_return_table[state - 1]; + if (token == 65542) + { + token = input_char; + } + state = fsm_context.NextState; + return true; + } + + private void UngetChar() + { + input_buffer = input_char; + } +} diff --git a/SVSim.BattleEngine/Engine/LitJson/ObjectMetadata.cs b/SVSim.BattleEngine/Engine/LitJson/ObjectMetadata.cs new file mode 100644 index 0000000..8dfe9f9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/ObjectMetadata.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; + +namespace LitJson; + +internal struct ObjectMetadata +{ + private Type element_type; + + private bool is_dictionary; + + private IDictionary properties; + + public Type ElementType + { + get + { + if (element_type == null) + { + return typeof(JsonData); + } + return element_type; + } + set + { + element_type = value; + } + } + + public bool IsDictionary + { + get + { + return is_dictionary; + } + set + { + is_dictionary = value; + } + } + + public IDictionary Properties + { + get + { + return properties; + } + set + { + properties = value; + } + } +} diff --git a/SVSim.BattleEngine/Engine/LitJson/OrderedDictionaryEnumerator.cs b/SVSim.BattleEngine/Engine/LitJson/OrderedDictionaryEnumerator.cs new file mode 100644 index 0000000..160801f --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/OrderedDictionaryEnumerator.cs @@ -0,0 +1,39 @@ +using System.Collections; +using System.Collections.Generic; + +namespace LitJson; + +internal class OrderedDictionaryEnumerator : IDictionaryEnumerator, IEnumerator +{ + private IEnumerator> list_enumerator; + + public object Current => Entry; + + public DictionaryEntry Entry + { + get + { + KeyValuePair current = list_enumerator.Current; + return new DictionaryEntry(current.Key, current.Value); + } + } + + public object Key => list_enumerator.Current.Key; + + public object Value => list_enumerator.Current.Value; + + public OrderedDictionaryEnumerator(IEnumerator> enumerator) + { + list_enumerator = enumerator; + } + + public bool MoveNext() + { + return list_enumerator.MoveNext(); + } + + public void Reset() + { + list_enumerator.Reset(); + } +} diff --git a/SVSim.BattleEngine/Engine/LitJson/ParserToken.cs b/SVSim.BattleEngine/Engine/LitJson/ParserToken.cs new file mode 100644 index 0000000..9ebbc51 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/ParserToken.cs @@ -0,0 +1,24 @@ +namespace LitJson; + +internal enum ParserToken +{ + None = 65536, + Number, + True, + False, + Null, + CharSeq, + Char, + Text, + Object, + ObjectPrime, + Pair, + PairRest, + Array, + ArrayPrime, + Value, + ValueRest, + String, + End, + Epsilon +} diff --git a/SVSim.BattleEngine/Engine/LitJson/PropertyMetadata.cs b/SVSim.BattleEngine/Engine/LitJson/PropertyMetadata.cs new file mode 100644 index 0000000..70cbfb8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/PropertyMetadata.cs @@ -0,0 +1,13 @@ +using System; +using System.Reflection; + +namespace LitJson; + +internal struct PropertyMetadata +{ + public MemberInfo Info; + + public bool IsField; + + public Type Type; +} diff --git a/SVSim.BattleEngine/Engine/LitJson/WrapperFactory.cs b/SVSim.BattleEngine/Engine/LitJson/WrapperFactory.cs new file mode 100644 index 0000000..7fd2793 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/WrapperFactory.cs @@ -0,0 +1,3 @@ +namespace LitJson; + +public delegate IJsonWrapper WrapperFactory(); diff --git a/SVSim.BattleEngine/Engine/LitJson/WriterContext.cs b/SVSim.BattleEngine/Engine/LitJson/WriterContext.cs new file mode 100644 index 0000000..14c1631 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LitJson/WriterContext.cs @@ -0,0 +1,14 @@ +namespace LitJson; + +internal class WriterContext +{ + public int Count; + + public bool InArray; + + public bool InObject; + + public bool ExpectingValue; + + public int Padding; +} diff --git a/SVSim.BattleEngine/Engine/Load.cs b/SVSim.BattleEngine/Engine/Load.cs new file mode 100644 index 0000000..690b88e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Load.cs @@ -0,0 +1,4 @@ +public class Load : HeaderData +{ + public LoadDetail data; +} diff --git a/SVSim.BattleEngine/Engine/LoadDetail.cs b/SVSim.BattleEngine/Engine/LoadDetail.cs new file mode 100644 index 0000000..1dd4bf0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LoadDetail.cs @@ -0,0 +1,594 @@ +using System; +using System.Collections.Generic; +using LitJson; +using UnityEngine; +using Wizard; +using Wizard.UI.LoginBonus; + +public class LoadDetail +{ + private const string ARENA_INFO_KEY = "arena_info"; + + public int RotationFirstCardPackId; + + public int RotationLatestCardPackId; + + public UserInfo _userInfo = new UserInfo(); + + public UserCrystalCount _userCrystalCount = new UserCrystalCount(); + + public UserTutorial _userTutorial = new UserTutorial(); + + private List _acquiredEmblemList = new List(); + + private List _favoriteEmblemList = new List(); + + private List _acquiredDegreeList = new List(); + + private List _favoriteDegreeList = new List(); + + private List _acquiredSleeveList = new List(); + + private List _favoriteSleeveList = new List(); + + public UserConfig _userConfig = new UserConfig(); + + public ChallengeConfig _challengeConfig = new ChallengeConfig(); + + public Dictionary _userRank = new Dictionary(); + + public List _classCharaExpList = new List(); + + public Dictionary _userItemDict = new Dictionary(); + + public DateTime _masterResetNextTime; + + public int _receiveInviteCount; + + public List UnlimitedRestrictedCardList { get; private set; } = new List(); + + public List RotationCardSetList { get; private set; } = new List(); + + public Dictionary OverwriteGetRedEtherDict { get; private set; } = new Dictionary(); + + public Dictionary OverwriteUseRedEtherDict { get; private set; } = new Dictionary(); + + public bool[] LootBoxReguration { get; private set; } = new bool[6]; + + public JsonData UserDeckListRotation { get; private set; } + + public JsonData UserDeckListUnlimited { get; private set; } + + public JsonData UserDeckListPreRotation { get; private set; } + + public JsonData UserDeckListCrossover { get; private set; } + + public JsonData UserDeckListMyRotation { get; private set; } + + public List AcquiredSkinList { get; private set; } = new List(); + + public List AcquiredMyPageBGList { get; private set; } = new List(); + + public List UserCardList { get; private set; } = new List(); + + public List RankInfoList { get; private set; } = new List(); + + public Dictionary BattlePassLevelInfoList { get; private set; } = new Dictionary(); + + public List LoadingExclusionCardList { get; private set; } = new List(); + + public int BattleRecoveryStatus { get; private set; } + + public int RoomRecoveryStatus { get; private set; } + + public long DefaultEmblemId { get; private set; } + + public int DefaultDegreeId { get; private set; } + + public NormalData NormalLoginBonusData { get; private set; } + + public ContinuousData ContinuousLoginBonusData { get; private set; } + + public List SpecialLoginBonusDataList { get; private set; } = new List(); + + public FreeCardPackBoxData FreeCardPackData { get; private set; } + + public Dictionary UserItemExpireTimeDictionary { get; set; } = new Dictionary(); + + public List UserItemNotStartList { get; set; } = new List(); + + public List ReprintedBaseCardIds { get; private set; } = new List(); + + public CardMaster.UpdateInfo CardMasterUpdateInfo { get; private set; } + + public int ResourceDlViewID { get; private set; } + + public List OpenBattleFieldIdList { get; private set; } + + public void ConvertJsonData(JsonData responseData) + { + JsonData jsonData = responseData["data"]; + GameMgr.GetIns().GetDataMgr().SetMaintenanceCardIds(jsonData["maintenance_card_list"]); + JsonData jsonData2 = jsonData["unlimited_restricted_base_card_id_list"]; + if (jsonData2.IsObject) + { + foreach (string key2 in jsonData2.Keys) + { + if (int.TryParse(key2, out var result)) + { + UnlimitedRestrictedCardList.Add(new UnlimitedRestrictedCard(result, jsonData2[key2].ToInt())); + } + } + } + JsonData jsonData3 = jsonData["rotation_card_set_id_list"]; + for (int i = 0; i < jsonData3.Count; i++) + { + RotationCardSetList.Add(jsonData3[i]["card_set_id"].ToInt()); + } + RotationLatestCardPackId = RotationCardSetList[RotationCardSetList.Count - 1]; + RotationFirstCardPackId = RotationCardSetList[1]; + JsonData jsonData4 = jsonData["red_ether_overwrite_list"]; + for (int j = 0; j < jsonData4.Count; j++) + { + string key = jsonData4[j]["card_id"].ToString(); + if (jsonData4[j].Keys.Contains("get_red_ether")) + { + int value = jsonData4[j]["get_red_ether"].ToInt(); + OverwriteGetRedEtherDict.Add(key, value); + } + if (jsonData4[j].Keys.Contains("use_red_ether")) + { + int value2 = jsonData4[j]["use_red_ether"].ToInt(); + OverwriteUseRedEtherDict.Add(key, value2); + } + } + UserInfo userInfo = _userInfo; + JsonData jsonData5 = jsonData["user_info"]; + userInfo.name = jsonData5["name"].ToString(); + userInfo.birth_day = jsonData5["birth"].ToString(); + userInfo.selected_emblem_id = jsonData5["selected_emblem_id"].ToLong(); + userInfo.selected_degree_id = jsonData5["selected_degree_id"].ToInt(); + JsonData jsonData6 = jsonData5["country_code"]; + userInfo.country_code = ((jsonData6 == null) ? string.Empty : jsonData6.ToString()); + PlayerStaticData.IsOfficialUser = jsonData5["is_official"].ToInt() == 1; + PlayerStaticData.IsOfficialUserDisplay = jsonData5["is_official_mark_displayed"].ToInt() == 1; + _userRank[0] = new UserRank(); + _userRank[1] = new UserRank(); + _userRank[104] = new UserRank(); + _userRank[5] = new UserRank(); + _userRank[39] = new UserRank(); + JsonData jsonData7 = jsonData["loot_box_regulation"]; + if (jsonData7.Count > 0) + { + LootBoxReguration[0] = jsonData7["pack"].ToInt() == 1; + LootBoxReguration[1] = jsonData7["arena_2pick"].ToInt() == 1; + LootBoxReguration[2] = jsonData7["arena_sealed"].ToInt() == 1; + LootBoxReguration[3] = jsonData7["arena_colosseum"].ToInt() == 1; + LootBoxReguration[4] = jsonData7["arena_competition"].ToInt() == 1; + LootBoxReguration[5] = jsonData7["special_shop"].ToInt() == 1; + } + else + { + for (int k = 0; k < 6; k++) + { + LootBoxReguration[k] = false; + } + } + _userCrystalCount.SetUserCrystalCount(jsonData["user_crystal_count"]); + _userCrystalCount.ParseSpecialCrystal(responseData); + JsonData jsonData8 = jsonData["user_item_list"]; + for (int l = 0; l < jsonData8.Count; l++) + { + PlayerStaticData.InitializeItemNum(jsonData8[l]["item_id"].ToInt(), jsonData8[l]["number"].ToInt()); + } + Data.Load.data.UserItemExpireTimeDictionary = new Dictionary(); + Data.Load.data.UserItemNotStartList = new List(); + if (jsonData.Keys.Contains("item_expire_date")) + { + JsonData jsonData9 = jsonData["item_expire_date"]; + for (int m = 0; m < jsonData9.Count; m++) + { + JsonData jsonData10 = jsonData9[m]; + int num = jsonData10["item_id"].ToInt(); + string text = jsonData10["expire_date"].ToString(); + if (jsonData10.TryGetValue("start_date", out var value3) && new RemainTime(value3.ToString(), responseData["data_headers"]["servertime"].ToDouble()).Second > 1) + { + Data.Load.data.UserItemNotStartList.Add(num); + } + if (!string.IsNullOrEmpty(text)) + { + Data.Load.data.UserItemExpireTimeDictionary[num] = ConvertTime.ToLocal(text); + } + } + } + PlayerStaticData.UserSpotCardPointCount = jsonData["spot_point"].ToInt(); + if (jsonData.Keys.Contains("arena_info")) + { + Data.ArenaData = new ArenaData(jsonData["arena_info"]); + Data.ArenaData.ColosseumData.IsFreeEntry = jsonData["is_available_colosseum_free_entry"].ToBoolean(); + } + _receiveInviteCount = jsonData["friend_battle_invite_count"].ToInt(); + _userTutorial.Update(jsonData["user_tutorial"]); + UserDeckListRotation = jsonData["user_deck_rotation"]["user_deck_list"]; + UserDeckListUnlimited = jsonData["user_deck_unlimited"]["user_deck_list"]; + if (jsonData.Keys.Contains("user_deck_pre_rotation")) + { + UserDeckListPreRotation = jsonData["user_deck_pre_rotation"]["user_deck_list"]; + } + if (jsonData.Keys.Contains("user_deck_crossover")) + { + UserDeckListCrossover = jsonData["user_deck_crossover"]["user_deck_list"]; + } + if (jsonData.Keys.Contains("user_deck_my_rotation")) + { + UserDeckListMyRotation = jsonData["user_deck_my_rotation"]["user_deck_list"]; + } + if (Data.Master.isMasterDataLoaded) + { + DeckListUtility.SetDeckListDataWithLodeIndex(); + } + DefaultEmblemId = jsonData["default_setting"]["default_emblem_id"].ToInt(); + JsonData jsonData11 = jsonData["user_emblem_list"]; + for (int n = 0; n < jsonData11.Count; n++) + { + long num2 = jsonData11[n]["emblem_id"].ToLong(); + if (Data.Master.EmblemMgr != null) + { + Data.Master.EmblemMgr.Acquired(num2); + Data.Master.EmblemMgr.UnsetNew(num2); + } + else + { + _acquiredEmblemList.Add(num2); + } + } + if (jsonData.TryGetValue("user_favorite_emblem_list", out var value4)) + { + for (int num3 = 0; num3 < value4.Count; num3++) + { + long num4 = value4[num3].ToLong(); + if (Data.Master.EmblemMgr != null) + { + Data.Master.EmblemMgr.SetFavorite(num4, favorite: true); + } + else + { + _favoriteEmblemList.Add(num4); + } + } + } + DefaultDegreeId = jsonData["default_setting"]["default_degree_id"].ToInt(); + JsonData jsonData12 = jsonData["user_degree_list"]; + for (int num5 = 0; num5 < jsonData12.Count; num5++) + { + int num6 = (int)jsonData12[num5]["degree_id"]; + if (Data.Master.DegreeMgr != null) + { + Data.Master.DegreeMgr.Acquired(num6); + Data.Master.DegreeMgr.UnsetNew(num6); + } + else + { + _acquiredDegreeList.Add(num6); + } + } + if (jsonData.TryGetValue("user_favorite_degree_list", out var value5)) + { + for (int num7 = 0; num7 < value5.Count; num7++) + { + int num8 = value5[num7].ToInt(); + if (Data.Master.DegreeMgr != null) + { + Data.Master.DegreeMgr.SetFavorite(num8, favorite: true); + } + else + { + _favoriteDegreeList.Add(num8); + } + } + } + JsonData jsonData13 = jsonData["user_leader_skin_list"]; + for (int num9 = 0; num9 < jsonData13.Count; num9++) + { + JsonData jsonData14 = jsonData13[num9]; + if (jsonData14["is_owned"].ToBoolean()) + { + AcquiredSkinList.Add(jsonData14["leader_skin_id"].ToInt()); + } + } + JsonData jsonData15 = jsonData["user_sleeve_list"]; + for (int num10 = 0; num10 < jsonData15.Count; num10++) + { + long num11 = jsonData15[num10]["sleeve_id"].ToLong(); + if (Data.Master.SleeveMgr != null) + { + Data.Master.SleeveMgr.Acquired(num11); + Data.Master.SleeveMgr.UnsetNew(num11); + } + else + { + _acquiredSleeveList.Add(num11); + } + } + if (jsonData.TryGetValue("user_favorite_sleeve_list", out var value6)) + { + for (int num12 = 0; num12 < value6.Count; num12++) + { + long num13 = value6[num12].ToLong(); + if (Data.Master.SleeveMgr != null) + { + Data.Master.SleeveMgr.SetFavorite(num13, b: true); + } + else + { + _favoriteSleeveList.Add(num13); + } + } + } + JsonData jsonData16 = jsonData["user_mypage_list"]; + AcquiredMyPageBGList = new List(); + for (int num14 = 0; num14 < jsonData16.Count; num14++) + { + AcquiredMyPageBGList.Add(jsonData16[num14].ToString()); + } + JsonData jsonData17 = jsonData["user_card_list"]; + List favoriteCardList = GameMgr.GetIns().GetDataMgr().FavoriteCardList; + for (int num15 = 0; num15 < jsonData17.Count; num15++) + { + JsonData jsonData18 = jsonData17[num15]; + UserCard userCard = new UserCard(); + int item = (userCard.card_id = jsonData18["card_id"].ToInt()); + userCard.number = jsonData18["number"].ToInt(); + if (jsonData18["is_protected"].ToInt() != 0) + { + favoriteCardList.Add(item); + } + UserCardList.Add(userCard); + } + JsonData userClassCharaList = jsonData["user_class_list"]; + JsonData userRankMatchList = jsonData["user_rank_match_list"]; + GameMgr.GetIns().GetDataMgr().SetClassPrm(userClassCharaList, userRankMatchList); + ParseUserRank(jsonData); + JsonData jsonData19 = jsonData["rank_info"]; + int num16 = 0; + for (int num17 = 0; num17 < jsonData19.Count; num17++) + { + JsonData jsonData20 = jsonData19[num17]; + RankInfo rankInfo = new RankInfo(jsonData20); + if (num17 >= 24) + { + int num18 = jsonData20["accumulate_master_point"].ToInt(); + rankInfo._necessaryMasterPoint = num18 - num16; + num16 = num18; + } + RankInfoList.Add(rankInfo); + } + JsonData jsonData21 = jsonData["class_exp"]; + for (int num19 = 0; num19 < jsonData21.Count; num19++) + { + JsonData jsonData22 = jsonData21[num19]; + ClassCharaExp classCharaExp = new ClassCharaExp(); + classCharaExp.level = jsonData22["level"].ToInt(); + classCharaExp.necessary_exp = jsonData22["necessary_exp"].ToInt(); + classCharaExp.accumulate_exp = jsonData22["accumulate_exp"].ToInt(); + _classCharaExpList.Add(classCharaExp); + } + if (jsonData.TryGetValue("battle_pass_level_info", out var value7)) + { + foreach (JsonData value13 in value7.Values) + { + BattlePassLevelInfo battlePassLevelInfo = new BattlePassLevelInfo(value13); + BattlePassLevelInfoList.Add(battlePassLevelInfo.Level, battlePassLevelInfo); + } + } + JsonData jsonData23 = jsonData["loading_exclusion_card_list"]; + for (int num20 = 0; num20 < jsonData23.Count; num20++) + { + LoadingExclusionCardList.Add(Convert.ToInt32(jsonData23[num20].ToString())); + } + SettingRecoveryStatus(jsonData["battle_recovery_status"].ToInt(), jsonData["room_recovery_status"].ToInt()); + NormalLoginBonusData = null; + ContinuousLoginBonusData = null; + SpecialLoginBonusDataList.Clear(); + if (jsonData.Keys.Contains("daily_login_bonus")) + { + ParseLoginBonusInfo(jsonData["daily_login_bonus"]); + } + FreeCardPackData = null; + if (jsonData.TryGetValue("free_card_pack_box_campaign", out var value8)) + { + FreeCardPackData = new FreeCardPackBoxData(value8); + } + JsonData jsonData24 = jsonData["reprinted_base_card_ids"]; + ReprintedBaseCardIds.Clear(); + for (int num21 = 0; num21 < jsonData24.Count; num21++) + { + ReprintedBaseCardIds.Add(jsonData24[num21].ToInt()); + } + SpotCardData spotCardData = new SpotCardData(); + if (jsonData.Keys.Contains("spot_cards")) + { + spotCardData.SetSpotCardData(jsonData["spot_cards"]); + } + GameMgr.GetIns().GetDataMgr().SpotCardData = spotCardData; + CardMasterUpdateInfo = new CardMaster.UpdateInfo(jsonData); + if (jsonData.Keys.Contains("pre_release_info")) + { + Prerelease.Create(jsonData["pre_release_info"]); + } + if (jsonData.Keys.Contains("gathering_info")) + { + Data.MyPageNotifications.data.IsInviteGathering = jsonData["gathering_info"]["has_invite"].ToInt() != 0; + } + Data.User.ConnectTimeForMasterReset = ConvertTime.UnixTimeToDateTime(responseData["data_headers"]["servertime"].ToInt()); + Data.User.ConnectSinceStartUp = Time.realtimeSinceStartup; + _masterResetNextTime = DateTime.MinValue; + Data.Load.data._challengeConfig.UseTwoPickPremiumCard = responseData["data"]["challenge_config"]["use_challenge_two_pick_premium_card"].ToInt() == 1; + Data.Load.data._challengeConfig.TwoPickSleeveId = responseData["data"]["challenge_config"]["challenge_two_pick_sleeve_id"].ToLong(); + Data.ParseIsBattlePassPeriod(responseData["data"]); + Data.ParseMaintenance(jsonData["feature_maintenance_list"]); + ResourceDlViewID = jsonData.GetValueOrDefault("card_set_id_for_resource_dl_view", 1); + if (jsonData.Keys.Contains("open_battle_field_id_list") && jsonData.TryGetValue("open_battle_field_id_list", out var value9)) + { + OpenBattleFieldIdList = new List(); + for (int num22 = 0; num22 < value9.Count; num22++) + { + OpenBattleFieldIdList.Add(value9[num22].ToString()); + } + PlayerPrefsWrapper.TurnOnFirsStageIfStageIdListAllOff(); + } + if (jsonData.TryGetValue("crossover_info", out var value10)) + { + Data.Crossover.Parse(value10); + } + if (jsonData.TryGetValue("my_rotation_info", out var value11)) + { + bool isFinishInitializeText = Data.MyRotationAllInfo.IsFinishInitializeText; + Data.MyRotationAllInfo = new MyRotationAllInfo(); + Data.MyRotationAllInfo.Parse(value11, responseData["data_headers"]); + if (isFinishInitializeText) + { + Data.MyRotationAllInfo.InitializeText(); + } + } + if (jsonData.TryGetValue("avatar_info", out var value12)) + { + Data.AvatarBattleAllInfo = new AvatarBattleAllInfo(); + Data.AvatarBattleAllInfo.Parse(value12, responseData["data_headers"]); + } + } + + public void ParseUserRank(JsonData data) + { + if (data["user_rank"] != null) + { + for (int i = 0; i < data["user_rank"].Count; i++) + { + JsonData jsonData = data["user_rank"][i]; + Format format = Data.ParseApiFormat(jsonData["deck_format"].ToInt()); + _userRank[(int)format].Initialize(jsonData, format); + } + } + } + + public bool IsAcquiredSleeve(long sleeveId) + { + return _acquiredSleeveList.Contains(sleeveId); + } + + public bool IsFavoriteSleeve(long sleeveId) + { + return _favoriteSleeveList.Contains(sleeveId); + } + + public bool IsAcquiredEmblem(long emblemId) + { + return _acquiredEmblemList.Contains(emblemId); + } + + public bool IsFavoriteEmblem(long emblemId) + { + return _favoriteEmblemList.Contains(emblemId); + } + + public bool IsAcquiredDegree(int degreeId) + { + return _acquiredDegreeList.Contains(degreeId); + } + + public bool IsFavoriteDegree(int degreeId) + { + return _favoriteDegreeList.Contains(degreeId); + } + + public bool IsExistLoginBonusData() + { + return NormalLoginBonusData != null; + } + + public bool IsExistFreeCardPackBoxData() + { + return FreeCardPackData != null; + } + + public void SettingRecoveryStatus(int battleRecovery, int roomRecovery) + { + BattleRecoveryStatus = battleRecovery; + RoomRecoveryStatus = roomRecovery; + } + + public void InitRecoveryStatus() + { + BattleRecoveryStatus = 0; + RoomRecoveryStatus = 0; + } + + public List GetRankInfoRawList(Format format) + { + if (format == Format.Crossover) + { + return Data.Crossover.GetRankInfoRawList(); + } + return RankInfoList; + } + + public RankInfo GetRankInfo(Format format, int rankId) + { + if (format == Format.Crossover) + { + return Data.Crossover.GetRankInfo(rankId); + } + return RankInfoList[rankId - 1]; + } + + public bool IsStartRank(Format format, int rankId) + { + if (format == Format.Crossover) + { + return Data.Crossover.IsStartRank(rankId); + } + return RankInfoList[0].RankId == rankId; + } + + private void ParseLoginBonusInfo(JsonData info) + { + if (info == null) + { + return; + } + ICollection keys = info.Keys; + if (keys.Contains("normal")) + { + JsonData jsonData = info["normal"]; + if (jsonData != null && jsonData.Count > 0) + { + NormalLoginBonusData = new NormalData(jsonData); + } + } + if (keys.Contains("total")) + { + JsonData jsonData2 = info["total"]; + if (jsonData2 != null && jsonData2.Count > 0) + { + ContinuousLoginBonusData = new ContinuousData(jsonData2); + } + } + if (!keys.Contains("campaign")) + { + return; + } + JsonData jsonData3 = info["campaign"]; + if (jsonData3 != null) + { + for (int i = 0; i < jsonData3.Count; i++) + { + SpecialLoginBonusDataList.Add(new SpecialData(jsonData3[i])); + } + } + } + + public void InitializeAfterMasterLoading() + { + Data.MyRotationAllInfo.InitializeText(); + } +} diff --git a/SVSim.BattleEngine/Engine/LoadingBase.cs b/SVSim.BattleEngine/Engine/LoadingBase.cs new file mode 100644 index 0000000..c4d881a --- /dev/null +++ b/SVSim.BattleEngine/Engine/LoadingBase.cs @@ -0,0 +1,184 @@ +using System.Collections; +using Cute; +using UnityEngine; +using Wizard; + +public class LoadingBase : UIBase +{ + [SerializeField] + private GameObject mainObj; + + [SerializeField] + private UILabel ParLabel; + + [SerializeField] + private UIGauge LoadingBar; + + [SerializeField] + protected UILabel LoadTitleLabel; + + [SerializeField] + protected UILabel LoadTextLabel; + + [SerializeField] + private UITexture BGTexture; + + private int loadIndex; + + private string comment = ""; + + private Coroutine coroutine; + + protected bool isLabelUpdate = true; + + private float loadAssetsMaxNum; + + public bool IsOpponentWait; + + public float CurrentProgress { get; private set; } + + public bool MaximumValueFixedMode { get; set; } + + private void Awake() + { + MaximumValueFixedMode = false; + CurrentProgress = 0f; + } + + protected virtual void Start() + { + if ((bool)LoadTextLabel) + { + comment = Data.SystemText.Get("System_0001"); + } + if ((bool)ParLabel) + { + ParLabel.text = "0๏ผ…"; + } + if ((bool)mainObj) + { + mainObj.SetActive(value: false); + mainObj.GetComponent().uiCamera = UIManager.GetInstance().UIRootLoadingCamera; + } + OnEnable(); + } + + public virtual void fadeOutLoading() + { + } + + public void closeLoading() + { + if (base.gameObject != null) + { + Object.Destroy(base.gameObject); + } + } + + private void OnEnable() + { + if (coroutine == null) + { + setParLabelActive(isactive: true); + coroutine = StartCoroutine(lodingAnimation()); + } + } + + private void OnDisable() + { + if (coroutine != null) + { + StopCoroutine(coroutine); + coroutine = null; + } + IsOpponentWait = false; + } + + public void setMaxAssetsNum(bool enable, float num) + { + MaximumValueFixedMode = enable; + loadAssetsMaxNum = num; + } + + public void setLoadingComment(string comment) + { + this.comment = comment; + } + + public void setParLabelActive(bool isactive) + { + if ((bool)ParLabel && ParLabel.gameObject.activeSelf != isactive) + { + ParLabel.gameObject.SetActive(isactive); + } + } + + public IEnumerator lodingAnimation() + { + if ((bool)mainObj) + { + mainObj.SetActive(value: false); + } + WaitForSeconds waitTime = new WaitForSeconds(0.05f); + while (true) + { + float num = ((!MaximumValueFixedMode) ? (Toolbox.ResourcesManager.GetDownloadMaxSize() + (float)Toolbox.ResourcesManager.GetLoadingMax()) : loadAssetsMaxNum); + float num2 = CalculateProgress(); + CurrentProgress = ((num == 0f) ? 0f : (num2 / num)); + if (CurrentProgress > 1f) + { + CurrentProgress = 1f; + } + if ((bool)ParLabel) + { + ParLabel.text = $"{CurrentProgress * 100f:f1}%"; + } + if ((bool)LoadingBar) + { + LoadingBar.Value = CurrentProgress; + } + string str = ""; + for (int i = 0; i < loadIndex; i++) + { + str += "."; + } + if (Data.SystemText == null) + { + yield return 0; + } + if (isLabelUpdate && (bool)LoadTextLabel) + { + LoadTextLabel.text = comment + str; + } + loadIndex++; + if (loadIndex >= 4) + { + loadIndex = 0; + } + yield return waitTime; + if ((bool)mainObj && !mainObj.activeSelf) + { + mainObj.SetActive(value: true); + mainObj.GetComponent().enabled = true; + } + if (IsOpponentWait) + { + if (CurrentProgress >= 1f) + { + setLoadingComment(Data.SystemText.Get("Battle_0408")); + setParLabelActive(isactive: false); + } + else + { + setLoadingComment(Data.SystemText.Get("System_0001")); + setParLabelActive(isactive: true); + } + } + } + } + + protected virtual float CalculateProgress() + { + return Toolbox.ResourcesManager.GetLoadingCompleted(); + } +} diff --git a/SVSim.BattleEngine/Engine/LoadingInScene.cs b/SVSim.BattleEngine/Engine/LoadingInScene.cs new file mode 100644 index 0000000..1cf69ac --- /dev/null +++ b/SVSim.BattleEngine/Engine/LoadingInScene.cs @@ -0,0 +1,428 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; + +public class LoadingInScene : MonoBehaviour +{ + private const string LOAD_TITLE = "Load_Title"; + + private const string LOAD_DESC = "Load_Desc"; + + private const string CARD_MASK_PATH = "loading_battle_mask"; + + public const int LOADING_TIPS_INDEX_MIN = 1; + + private static int loadingTipsIndexMax; + + [SerializeField] + private UILabel LoadingLabel; + + [SerializeField] + private UIAnchor Anchor; + + [SerializeField] + private LoadingBase Progress; + + [SerializeField] + private bool Matching; + + [SerializeField] + private bool Battle; + + [SerializeField] + private bool ShowProgress; + + [SerializeField] + private NguiObjs LoadingTextObj; + + [SerializeField] + private UILabel LoadingCountLabel; + + [SerializeField] + private bool notText; + + [SerializeField] + private UITexture BGTexture; + + [SerializeField] + private UIPanel _fadeBlackPanel; + + private int DotCnt; + + private Coroutine _coroutineTextAnimation; + + private Texture2D cardMask; + + private List resourcePathList; + + public static int LoadingTipsIndexMax + { + get + { + if (loadingTipsIndexMax == 0) + { + loadingTipsIndexMax = Data.SystemText.Count("Load_Title"); + } + return loadingTipsIndexMax; + } + } + + public bool IsFadeout { get; set; } + + public LoadingBase ProgressObj => Progress; + + public void SetShowProgress(bool enable, bool immediate = false) + { + ShowProgress = enable; + float num = (enable ? 1f : 0f); + if (immediate) + { + if ((bool)Anchor) + { + UISprite component = Anchor.GetComponent(); + if ((bool)component) + { + component.alpha = 1f - num; + } + } + if ((bool)Progress) + { + UISprite component2 = Progress.GetComponent(); + if ((bool)component2) + { + component2.alpha = num; + } + } + } + else + { + if ((bool)Anchor) + { + TweenAlpha.Begin(Anchor.gameObject, 0.5f, 1f - num); + } + if ((bool)Progress) + { + TweenAlpha.Begin(Progress.gameObject, 0.5f, num); + } + } + } + + private void Start() + { + IsFadeout = false; + DotCnt = 0; + float num = (ShowProgress ? 1f : 0f); + if ((bool)Anchor) + { + TweenAlpha.Begin(Anchor.gameObject, 0f, 1f - num); + } + if ((bool)Progress) + { + TweenAlpha.Begin(Progress.gameObject, 0f, num); + } + } + + private IEnumerator SetLoadingText() + { + if (Battle) + { + List allCardIds = CardMaster.GetInstanceForBattle().GetAllCardIds(); + int count = allCardIds.Count; + CardParameter cardParameterFromId; + int cardID; + ResourcesManager.AssetLoadPathType pathType; + while (true) + { + cardID = ((Data.Load.data._userTutorial.tutorial_step == 100) ? allCardIds[UnityEngine.Random.Range(0, count)] : (UnityEngine.Random.Range(0, 10) switch + { + 1 => 101111070, + 2 => 101011010, + 3 => 100011030, + 4 => 101121020, + 5 => 101111020, + 6 => 101121040, + 7 => 101021020, + 8 => 101014010, + 9 => 101014030, + _ => 101114040, + })); + cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardID); + cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardParameterFromId.BaseCardId); + cardID = cardParameterFromId.BaseCardId; + if (!ReLotteryCheck(cardID)) + { + pathType = ResourcesManager.AssetLoadPathType.UnitCardTextures; + switch (cardParameterFromId.CharType) + { + case CardBasePrm.CharaType.CLASS: + case CardBasePrm.CharaType.EVOLUTION: + continue; + case CardBasePrm.CharaType.NORMAL: + pathType = ResourcesManager.AssetLoadPathType.UnitCardTextures; + break; + case CardBasePrm.CharaType.SPELL: + pathType = ResourcesManager.AssetLoadPathType.SpellCardTextures; + break; + case CardBasePrm.CharaType.FIELD: + case CardBasePrm.CharaType.CHANT_FIELD: + pathType = ResourcesManager.AssetLoadPathType.SpellCardTextures; + break; + } + break; + } + } + ResourcesManager resMgr = Toolbox.ResourcesManager; + LoadingTextObj.labels[0].text = cardParameterFromId.CardName; + LoadingTextObj.labels[1].SetWrapText(cardParameterFromId.Description); + resourcePathList = new List + { + resMgr.GetAssetTypePath(cardID.ToString(), pathType), + resMgr.GetAssetTypePath("class_base_common", ResourcesManager.AssetLoadPathType.ClassCharaMaterialMain), + resMgr.GetAssetTypePath("loading_battle_mask", ResourcesManager.AssetLoadPathType.UiOtherTexture) + }; + yield return StartCoroutine(resMgr.LoadAssetGroupAsync(resourcePathList, null)); + Texture value = resMgr.LoadObject(resMgr.GetAssetTypePath(cardID + "0", pathType, isfetch: true)); + Texture value2 = resMgr.LoadObject(resMgr.GetAssetTypePath("loading_battle_mask", ResourcesManager.AssetLoadPathType.UiOtherTexture, isfetch: true)); + LoadingTextObj.textures[0].mainTexture = null; + LoadingTextObj.textures[0].material = resMgr.LoadObject(resMgr.GetAssetTypePath("class_base_common", ResourcesManager.AssetLoadPathType.ClassCharaMaterialMain, isfetch: true)); + LoadingTextObj.textures[0].material.SetTexture("_MainTex", value); + LoadingTextObj.textures[0].material.SetTexture("_MaskTex", value2); + LoadingTextObj.textures[0].gameObject.SetActive(value: false); + LoadingTextObj.textures[0].gameObject.SetActive(value: true); + } + else + { + int num = UnityEngine.Random.Range(1, LoadingTipsIndexMax + 1); + LoadingTextObj.labels[0].SetWrapText(Data.SystemText.Get(string.Format("{0}{1}", "Load_Title", num.ToString("0000")))); + LoadingTextObj.labels[1].SetWrapText(Data.SystemText.Get(string.Format("{0}{1}", "Load_Desc", num.ToString("0000")))); + } + } + + private bool ReLotteryCheck(int id) + { + if (CardMaster.GetInstanceForBattle().GetCardParameterFromId(id).ResourceCardId != id || Data.Load.data.LoadingExclusionCardList.Contains(id) || CardMaster.IsMutationCardCheck(id) || (id > 800000000 && id % 800000000 < 100000000) || CardMaster.IsChoiceBraveCardCheck(id)) + { + return true; + } + return false; + } + + private void Update() + { + if ((bool)Anchor && !Anchor.gameObject.activeSelf) + { + Anchor.enabled = true; + Anchor.gameObject.SetActive(value: true); + } + } + + private void StartLoadingTextAnimation(string overrideLoadingText = null) + { + string loadingText = ((overrideLoadingText != null) ? overrideLoadingText : ((!Matching) ? Data.SystemText.Get("System_0001") : Data.SystemText.Get("Battle_0008"))); + StopLoadingTextAnimation(); + _coroutineTextAnimation = StartCoroutine(LoadingTextAnimation(loadingText)); + } + + private void StopLoadingTextAnimation() + { + if (_coroutineTextAnimation != null) + { + StopCoroutine(_coroutineTextAnimation); + _coroutineTextAnimation = null; + } + } + + private IEnumerator LoadingTextAnimation(string loadingText) + { + while (true) + { + if ((bool)LoadingLabel) + { + LoadingLabel.text = loadingText; + DotCnt++; + if (DotCnt > 3) + { + DotCnt = 0; + } + if (LoadingCountLabel != null) + { + LoadingCountLabel.text = ""; + } + for (int i = 0; i < DotCnt; i++) + { + if (LoadingCountLabel != null) + { + LoadingCountLabel.text += "."; + } + else + { + LoadingLabel.text += "."; + } + } + } + if (notText) + { + if (LoadingLabel != null) + { + LoadingLabel.text = ""; + } + if (LoadingCountLabel != null) + { + LoadingCountLabel.text = ""; + } + } + yield return new WaitForSeconds(0.05f); + } + } + + public void FadeIn(bool notBlack = false, bool notCollider = false, float alphe = 1f, float panelFadeInDuration = 0.5f, string overrideText = null) + { + StartCoroutine(FadeInAndLoad(notBlack, notCollider, alphe, panelFadeInDuration)); + StartLoadingTextAnimation(overrideText); + } + + private IEnumerator FadeInAndLoad(bool notBlack = false, bool notCollider = false, float alphe = 1f, float panelFadeInDuration = 0.5f) + { + if (notCollider) + { + GetComponent().enabled = false; + } + else + { + GetComponent().enabled = true; + } + if ((bool)Anchor) + { + Anchor.gameObject.SetActive(value: false); + } + StartFadeInUI(panelFadeInDuration); + CancelInvoke("HideObj"); + IsFadeout = false; + GameObject bgObj = base.transform.Find("Bg").gameObject; + if (notBlack) + { + bgObj.SetActive(value: false); + yield break; + } + if (LoadingTextObj != null) + { + yield return StartCoroutine(SetLoadingText()); + } + bgObj.SetActive(value: true); + bgObj.GetComponent().color = new Color(0f, 0f, 0f, alphe); + if (null != BGTexture) + { + BGTexture.alpha = 0f; + TweenAlpha.Begin(BGTexture.gameObject, 0.5f, 1f); + } + } + + public void FadeOut(bool disableCollider = false) + { + int num = 0; + try + { + num = 1; + if (null != BGTexture) + { + TweenAlpha.Begin(BGTexture.gameObject, 0.25f, 0f); + } + num = 2; + StartFadeOutUI(); + num = 3; + Invoke("HideObj", 0.5f); + num = 4; + IsFadeout = true; + if (disableCollider) + { + GetComponent().enabled = false; + } + num = 5; + } + catch (Exception ex) + { + string text = ""; + if (base.gameObject == null) + { + text += "obj null "; + } + if (BGTexture == null) + { + text += "BGTexture null "; + } + else if (BGTexture.gameObject == null) + { + text += "BGTextureObj null "; + } + LocalLog.AccumulateTraceLog("#580304 FadeOut " + num + " disableCollider " + disableCollider + text); + throw ex; + } + } + + private void StartFadeInUI(float panelFadeInDuration = 0.5f) + { + if (_fadeBlackPanel != null) + { + _fadeBlackPanel.alpha = 1f; + TweenAlpha.Begin(_fadeBlackPanel.gameObject, panelFadeInDuration, 0f); + return; + } + UIPanel component = GetComponent(); + if ((bool)component) + { + component.alpha = 0.01f; + } + TweenAlpha.Begin(base.gameObject, panelFadeInDuration, 1f); + } + + private void StartFadeOutUI(float panelFadeOutDuration = 0.5f) + { + if (_fadeBlackPanel != null) + { + _fadeBlackPanel.alpha = 0f; + TweenAlpha.Begin(_fadeBlackPanel.gameObject, panelFadeOutDuration, 1f); + } + else + { + TweenAlpha.Begin(base.gameObject, panelFadeOutDuration, 0f); + } + } + + private void HideObj() + { + int num = 0; + try + { + num = 1; + StopLoadingTextAnimation(); + num = 2; + if (cardMask != null) + { + UnityEngine.Object.Destroy(cardMask); + } + num = 3; + if (resourcePathList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(resourcePathList); + num = 4; + resourcePathList.Clear(); + resourcePathList = null; + } + num = 5; + base.gameObject.SetActive(value: false); + } + catch (Exception ex) + { + string text = ""; + if (base.gameObject == null) + { + text += "obj null "; + } + LocalLog.AccumulateTraceLog("#580304 HideObj " + num + text); + throw ex; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Localization.cs b/SVSim.BattleEngine/Engine/Localization.cs new file mode 100644 index 0000000..6557f9f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Localization.cs @@ -0,0 +1,527 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +public static class Localization +{ + public delegate byte[] LoadFunction(string path); + + public delegate void OnLocalizeNotification(); + + public static LoadFunction loadFunction; + + public static OnLocalizeNotification onLocalize; + + public static bool localizationHasBeenSet = false; + + private static string[] mLanguages = null; + + private static Dictionary mOldDictionary = new Dictionary(); + + private static Dictionary mDictionary = new Dictionary(); + + private static Dictionary mReplacement = new Dictionary(); + + private static int mLanguageIndex = -1; + + private static string mLanguage; + + private static bool mMerging = false; + + public static Dictionary dictionary + { + get + { + if (!localizationHasBeenSet) + { + LoadDictionary(PlayerPrefs.GetString("Language", "English")); + } + return mDictionary; + } + set + { + localizationHasBeenSet = value != null; + mDictionary = value; + } + } + + public static string[] knownLanguages + { + get + { + if (!localizationHasBeenSet) + { + LoadDictionary(PlayerPrefs.GetString("Language", "English")); + } + return mLanguages; + } + } + + public static string language + { + get + { + if (string.IsNullOrEmpty(mLanguage)) + { + mLanguage = PlayerPrefs.GetString("Language", "English"); + LoadAndSelect(mLanguage); + } + return mLanguage; + } + set + { + if (mLanguage != value) + { + mLanguage = value; + LoadAndSelect(value); + } + } + } + + [Obsolete("Localization is now always active. You no longer need to check this property.")] + public static bool isActive => true; + + private static bool LoadDictionary(string value) + { + byte[] array = null; + if (!localizationHasBeenSet) + { + if (loadFunction == null) + { + TextAsset textAsset = Resources.Load("Localization"); + if (textAsset != null) + { + array = textAsset.bytes; + } + } + else + { + array = loadFunction("Localization"); + } + localizationHasBeenSet = true; + } + if (LoadCSV(array)) + { + return true; + } + if (string.IsNullOrEmpty(value)) + { + value = mLanguage; + } + if (string.IsNullOrEmpty(value)) + { + return false; + } + if (loadFunction == null) + { + TextAsset textAsset2 = Resources.Load(value); + if (textAsset2 != null) + { + array = textAsset2.bytes; + } + } + else + { + array = loadFunction(value); + } + if (array != null) + { + Set(value, array); + return true; + } + return false; + } + + private static bool LoadAndSelect(string value) + { + if (!string.IsNullOrEmpty(value)) + { + if (mDictionary.Count == 0 && !LoadDictionary(value)) + { + return false; + } + if (SelectLanguage(value)) + { + return true; + } + } + if (mOldDictionary.Count > 0) + { + return true; + } + mOldDictionary.Clear(); + mDictionary.Clear(); + if (string.IsNullOrEmpty(value)) + { + PlayerPrefs.DeleteKey("Language"); + } + return false; + } + + public static void Load(TextAsset asset) + { + ByteReader byteReader = new ByteReader(asset); + Set(asset.name, byteReader.ReadDictionary()); + } + + public static void Set(string languageName, byte[] bytes) + { + ByteReader byteReader = new ByteReader(bytes); + Set(languageName, byteReader.ReadDictionary()); + } + + public static void ReplaceKey(string key, string val) + { + if (!string.IsNullOrEmpty(val)) + { + mReplacement[key] = val; + } + else + { + mReplacement.Remove(key); + } + } + + public static void ClearReplacements() + { + mReplacement.Clear(); + } + + public static bool LoadCSV(TextAsset asset, bool merge = false) + { + return LoadCSV(asset.bytes, asset, merge); + } + + public static bool LoadCSV(byte[] bytes, bool merge = false) + { + return LoadCSV(bytes, null, merge); + } + + private static bool HasLanguage(string languageName) + { + int i = 0; + for (int num = mLanguages.Length; i < num; i++) + { + if (mLanguages[i] == languageName) + { + return true; + } + } + return false; + } + + private static bool LoadCSV(byte[] bytes, TextAsset asset, bool merge = false) + { + if (bytes == null) + { + return false; + } + ByteReader byteReader = new ByteReader(bytes); + BetterList betterList = byteReader.ReadCSV(); + if (betterList.size < 2) + { + return false; + } + betterList.RemoveAt(0); + string[] array = null; + if (string.IsNullOrEmpty(mLanguage)) + { + localizationHasBeenSet = false; + } + if (!localizationHasBeenSet || (!merge && !mMerging) || mLanguages == null || mLanguages.Length == 0) + { + mDictionary.Clear(); + mLanguages = new string[betterList.size]; + if (!localizationHasBeenSet) + { + mLanguage = PlayerPrefs.GetString("Language", betterList[0]); + localizationHasBeenSet = true; + } + for (int i = 0; i < betterList.size; i++) + { + mLanguages[i] = betterList[i]; + if (mLanguages[i] == mLanguage) + { + mLanguageIndex = i; + } + } + } + else + { + array = new string[betterList.size]; + for (int j = 0; j < betterList.size; j++) + { + array[j] = betterList[j]; + } + for (int k = 0; k < betterList.size; k++) + { + if (HasLanguage(betterList[k])) + { + continue; + } + int num = mLanguages.Length + 1; + Array.Resize(ref mLanguages, num); + mLanguages[num - 1] = betterList[k]; + Dictionary dictionary = new Dictionary(); + foreach (KeyValuePair item in mDictionary) + { + string[] array2 = item.Value; + Array.Resize(ref array2, num); + array2[num - 1] = array2[0]; + dictionary.Add(item.Key, array2); + } + mDictionary = dictionary; + } + } + Dictionary dictionary2 = new Dictionary(); + for (int l = 0; l < mLanguages.Length; l++) + { + dictionary2.Add(mLanguages[l], l); + } + while (true) + { + BetterList betterList2 = byteReader.ReadCSV(); + if (betterList2 == null || betterList2.size == 0) + { + break; + } + if (!string.IsNullOrEmpty(betterList2[0])) + { + AddCSV(betterList2, array, dictionary2); + } + } + if (!mMerging && onLocalize != null) + { + mMerging = true; + OnLocalizeNotification onLocalizeNotification = onLocalize; + onLocalize = null; + onLocalizeNotification(); + onLocalize = onLocalizeNotification; + mMerging = false; + } + return true; + } + + private static void AddCSV(BetterList newValues, string[] newLanguages, Dictionary languageIndices) + { + if (newValues.size < 2) + { + return; + } + string text = newValues[0]; + if (string.IsNullOrEmpty(text)) + { + return; + } + string[] value = ExtractStrings(newValues, newLanguages, languageIndices); + if (mDictionary.ContainsKey(text)) + { + mDictionary[text] = value; + return; + } + try + { + mDictionary.Add(text, value); + } + catch (Exception ex) + { + Debug.LogError("Unable to add '" + text + "' to the Localization dictionary.\n" + ex.Message); + } + } + + private static string[] ExtractStrings(BetterList added, string[] newLanguages, Dictionary languageIndices) + { + if (newLanguages == null) + { + string[] array = new string[mLanguages.Length]; + int i = 1; + for (int num = Mathf.Min(added.size, array.Length + 1); i < num; i++) + { + array[i - 1] = added[i]; + } + return array; + } + string key = added[0]; + if (!mDictionary.TryGetValue(key, out var value)) + { + value = new string[mLanguages.Length]; + } + int j = 0; + for (int num2 = newLanguages.Length; j < num2; j++) + { + string key2 = newLanguages[j]; + int num3 = languageIndices[key2]; + value[num3] = added[j + 1]; + } + return value; + } + + private static bool SelectLanguage(string language) + { + mLanguageIndex = -1; + if (mDictionary.Count == 0) + { + return false; + } + int i = 0; + for (int num = mLanguages.Length; i < num; i++) + { + if (mLanguages[i] == language) + { + mOldDictionary.Clear(); + mLanguageIndex = i; + mLanguage = language; + PlayerPrefs.SetString("Language", mLanguage); + if (onLocalize != null) + { + onLocalize(); + } + UIRoot.Broadcast("OnLocalize"); + return true; + } + } + return false; + } + + public static void Set(string languageName, Dictionary dictionary) + { + mLanguage = languageName; + PlayerPrefs.SetString("Language", mLanguage); + mOldDictionary = dictionary; + localizationHasBeenSet = true; + mLanguageIndex = -1; + mLanguages = new string[1] { languageName }; + if (onLocalize != null) + { + onLocalize(); + } + UIRoot.Broadcast("OnLocalize"); + } + + public static void Set(string key, string value) + { + if (mOldDictionary.ContainsKey(key)) + { + mOldDictionary[key] = value; + } + else + { + mOldDictionary.Add(key, value); + } + } + + public static string Get(string key) + { + if (!localizationHasBeenSet) + { + LoadDictionary(PlayerPrefs.GetString("Language", "English")); + } + if (mLanguages == null) + { + Debug.LogError("No localization data present"); + return null; + } + string text = language; + if (mLanguageIndex == -1) + { + for (int i = 0; i < mLanguages.Length; i++) + { + if (mLanguages[i] == text) + { + mLanguageIndex = i; + break; + } + } + } + if (mLanguageIndex == -1) + { + mLanguageIndex = 0; + mLanguage = mLanguages[0]; + } + string value; + string[] value2; + switch (UICamera.currentScheme) + { + case UICamera.ControlScheme.Touch: + { + string key3 = key + " Mobile"; + if (mReplacement.TryGetValue(key3, out value)) + { + return value; + } + if (mLanguageIndex != -1 && mDictionary.TryGetValue(key3, out value2) && mLanguageIndex < value2.Length) + { + return value2[mLanguageIndex]; + } + if (mOldDictionary.TryGetValue(key3, out value)) + { + return value; + } + break; + } + case UICamera.ControlScheme.Controller: + { + string key2 = key + " Controller"; + if (mReplacement.TryGetValue(key2, out value)) + { + return value; + } + if (mLanguageIndex != -1 && mDictionary.TryGetValue(key2, out value2) && mLanguageIndex < value2.Length) + { + return value2[mLanguageIndex]; + } + if (mOldDictionary.TryGetValue(key2, out value)) + { + return value; + } + break; + } + } + if (mReplacement.TryGetValue(key, out value)) + { + return value; + } + if (mLanguageIndex != -1 && mDictionary.TryGetValue(key, out value2)) + { + if (mLanguageIndex < value2.Length) + { + string text2 = value2[mLanguageIndex]; + if (string.IsNullOrEmpty(text2)) + { + text2 = value2[0]; + } + return text2; + } + return value2[0]; + } + if (mOldDictionary.TryGetValue(key, out value)) + { + return value; + } + return key; + } + + public static string Format(string key, params object[] parameters) + { + return string.Format(Get(key), parameters); + } + + [Obsolete("Use Localization.Get instead")] + public static string Localize(string key) + { + return Get(key); + } + + public static bool Exists(string key) + { + if (!localizationHasBeenSet) + { + language = PlayerPrefs.GetString("Language", "English"); + } + if (!mDictionary.ContainsKey(key)) + { + return mOldDictionary.ContainsKey(key); + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/MailData.cs b/SVSim.BattleEngine/Engine/MailData.cs new file mode 100644 index 0000000..5762a9b --- /dev/null +++ b/SVSim.BattleEngine/Engine/MailData.cs @@ -0,0 +1,40 @@ +using System; +using LitJson; +using Wizard; + +public class MailData : HeaderData +{ + public int mail_id; + + public string message; + + public int reward_type; + + public long reward_count; + + public int item_type; + + public string create_time; + + public int limit_type; + + public long reward_limit_time; + + public long RewardUserGoodsId { get; set; } + + public MailData(JsonData data) + { + mail_id = data["present_id"].ToInt(); + message = data["message"].ToString(); + reward_type = data["reward_type"].ToInt(); + RewardUserGoodsId = data["reward_detail_id"].ToLong(); + reward_count = data["reward_count"].ToLong(); + if (reward_type == 4) + { + item_type = data["item_type"].ToInt(); + } + create_time = ConvertTime.ToLocal(DateTime.Parse(data["create_time"].ToString())); + limit_type = data["present_limit_type"].ToInt(); + reward_limit_time = data["reward_limit_time"].ToLong(); + } +} diff --git a/SVSim.BattleEngine/Engine/MailDataDetail.cs b/SVSim.BattleEngine/Engine/MailDataDetail.cs new file mode 100644 index 0000000..fe8c54f --- /dev/null +++ b/SVSim.BattleEngine/Engine/MailDataDetail.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +public class MailDataDetail +{ + public List mail_data_list; + + public List mail_history_list; + + public bool limitOverPresentDeleted; +} diff --git a/SVSim.BattleEngine/Engine/MailResult.cs b/SVSim.BattleEngine/Engine/MailResult.cs new file mode 100644 index 0000000..fc11a30 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MailResult.cs @@ -0,0 +1,4 @@ +public class MailResult : Reward +{ + public int mail_id; +} diff --git a/SVSim.BattleEngine/Engine/MailTop.cs b/SVSim.BattleEngine/Engine/MailTop.cs new file mode 100644 index 0000000..1a3a49a --- /dev/null +++ b/SVSim.BattleEngine/Engine/MailTop.cs @@ -0,0 +1,4 @@ +public class MailTop : HeaderData +{ + public MailDataDetail data; +} diff --git a/SVSim.BattleEngine/Engine/MatchFinishBase.cs b/SVSim.BattleEngine/Engine/MatchFinishBase.cs new file mode 100644 index 0000000..09ef4cf --- /dev/null +++ b/SVSim.BattleEngine/Engine/MatchFinishBase.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using LitJson; +using Wizard; + +public class MatchFinishBase +{ + public JsonData _responseData; + + public BattleManagerBase.BATTLE_RESULT_TYPE battleResult; + + public int get_class_chara_experience; + + public int class_chara_experience; + + public int class_chara_level; + + public bool IsProcessed; + + public List achieved_mission_list => AchievedInfo._missions; + + public List achieved_achievement_list => AchievedInfo._achievements; + + public List _missionRewards => AchievedInfo._rewards; + + public List _victoryRewards => AchievedInfo._victoryRewards; + + public AchievedInfo AchievedInfo { get; private set; } + + public TreasureBoxCpResultInfo TreasureBoxCpResultInfo { get; private set; } + + public MatchFinishBase() + { + get_class_chara_experience = 0; + class_chara_experience = 0; + class_chara_level = 0; + AchievedInfo = new AchievedInfo(); + TreasureBoxCpResultInfo = new TreasureBoxCpResultInfo(); + } +} diff --git a/SVSim.BattleEngine/Engine/MatchingCoroutine.cs b/SVSim.BattleEngine/Engine/MatchingCoroutine.cs new file mode 100644 index 0000000..2e8b4e1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MatchingCoroutine.cs @@ -0,0 +1,5 @@ +using UnityEngine; + +public class MatchingCoroutine : MonoBehaviour +{ +} diff --git a/SVSim.BattleEngine/Engine/MatchingIPv6Toggle.cs b/SVSim.BattleEngine/Engine/MatchingIPv6Toggle.cs new file mode 100644 index 0000000..f671d07 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MatchingIPv6Toggle.cs @@ -0,0 +1,30 @@ +using Cute; +using UnityEngine; +using Wizard; + +public class MatchingIPv6Toggle : MonoBehaviour +{ + [SerializeField] + private UIToggle _networkLineChangeToggle; + + private const string TOGGLE_PATH = "UI/layoutParts/MatchingIPv6Toggle"; + + public static void AddMatchingIPv6Toggle(DialogBase dialog) + { + MatchingIPv6Toggle matchingIPv6Toggle = Object.Instantiate(Toolbox.ResourcesManager.LoadObject("UI/layoutParts/MatchingIPv6Toggle", isServerResources: false)); + dialog.SetObj(matchingIPv6Toggle.gameObject); + matchingIPv6Toggle.SettingToggle(); + } + + public void SettingToggle() + { + _networkLineChangeToggle.onChange.Add(new EventDelegate(OnClickToggle)); + _networkLineChangeToggle.value = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SELECT_IPV6); + } + + private void OnClickToggle() + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.IS_SELECT_IPV6, _networkLineChangeToggle.value); + GameMgr.GetIns().GetSoundMgr().PlaySe(_networkLineChangeToggle.value ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF); + } +} diff --git a/SVSim.BattleEngine/Engine/Matching_Colosseum.cs b/SVSim.BattleEngine/Engine/Matching_Colosseum.cs new file mode 100644 index 0000000..7c90f52 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Matching_Colosseum.cs @@ -0,0 +1,56 @@ +using System; +using Cute; +using Wizard; + +public class Matching_Colosseum : Matching +{ + public Matching_Colosseum() + { + errorDialogReturnText = Data.SystemText.Get("Battle_0489"); + } + + public override void DoMatching(Action onFinished, int need_init, DO_MATCHING_LOG log) + { + base.DoMatching(onFinished, need_init, log); + ColosseumDoMatchingTask colosseumDoMatchingTask = new ColosseumDoMatchingTask(); + colosseumDoMatchingTask.SetParameter(selectDeckID, need_init, (int)log); + ConnectAPI(colosseumDoMatchingTask, delegate + { + if (Data.DoMatchingDetail.data.matchingState != 3009) + { + DoMatchingResultSetting(); + onFinished.Call(); + } + }); + } + + protected override void TimeOutMessageToRetry() + { + ErrorDialogWithRetry(Data.SystemText.Get("Battle_0461"), Data.SystemText.Get("Battle_0412")); + Data.ArenaData.ColosseumData.IsRankMatching = false; + } + + public override FinishTaskBase GetBattleFinishTask() + { + return new ColosseumBattleFinishTask(); + } + + protected override void OnFailed(int code) + { + if (code != 3) + { + base.OnFailed(code); + } + } + + protected override void GotoDeckSelectScene() + { + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.OnFinishChangeView = delegate + { + UIManager.GetInstance().CloseInSceneLoadingMatching(); + UIManager.GetInstance().CloseInSceneLoadingBattle(); + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Colosseum, changeViewSceneParam); + } +} diff --git a/SVSim.BattleEngine/Engine/Matching_Free.cs b/SVSim.BattleEngine/Engine/Matching_Free.cs new file mode 100644 index 0000000..588088e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Matching_Free.cs @@ -0,0 +1,58 @@ +using System; +using Cute; +using Wizard; + +public class Matching_Free : Matching +{ + public const int PRE_ROTATION_PERIOD_ERROR = 3010; + + public override void DoMatching(Action onFinished, int need_init, DO_MATCHING_LOG log) + { + base.DoMatching(onFinished, need_init, log); + FreeBattleDoMatchingTask freeBattleDoMatchingTask = new FreeBattleDoMatchingTask(); + freeBattleDoMatchingTask.SetParameter(selectDeckID, need_init, (int)log); + ConnectAPI(freeBattleDoMatchingTask, delegate + { + if (Data.DoMatchingDetail.data.matchingState != 3009) + { + DoMatchingResultSetting(); + onFinished.Call(); + } + }); + } + + protected override void OnFailed(int code) + { + if (GetLastResultCode() != 3010) + { + base.OnFailed(code); + } + } + + public override FinishTaskBase GetBattleFinishTask() + { + return new FreeBattleFinishTask(); + } + + protected override void GotoDeckSelectScene() + { + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.MyPageMenuIndex = 2; + changeViewSceneParam.OnFinishChangeView = delegate + { + UIManager.GetInstance().CloseInSceneLoadingMatching(); + UIManager.GetInstance().CloseInSceneLoadingBattle(); + MyPageMenu.Instance.ChangeMenu(2); + DeckInfoTask task = new DeckInfoTask(); + task.SetParameter(Data.CurrentFormat); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + DeckSelectUIDialog.Create(Data.SystemText.Get("Battle_0005"), task.DeckGroupListData, Data.CurrentFormat, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: true, delegate(DialogBase dialog, DeckData deckData) + { + FreeAndRankMatchDeckSelectConfirmDialog.Create(dialog, deckData, isBattleEnd: false); + }); + })); + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.MyPage, changeViewSceneParam); + } +} diff --git a/SVSim.BattleEngine/Engine/Matching_RankMatch.cs b/SVSim.BattleEngine/Engine/Matching_RankMatch.cs new file mode 100644 index 0000000..c3584ff --- /dev/null +++ b/SVSim.BattleEngine/Engine/Matching_RankMatch.cs @@ -0,0 +1,48 @@ +using System; +using Cute; +using Wizard; + +public class Matching_RankMatch : Matching +{ + public override void DoMatching(Action onFinished, int need_init, DO_MATCHING_LOG log) + { + base.DoMatching(onFinished, need_init, log); + RankBattleDoMatchingTask rankBattleDoMatchingTask = new RankBattleDoMatchingTask(); + rankBattleDoMatchingTask.SetParameter(selectDeckID, need_init, (int)log); + ConnectAPI(rankBattleDoMatchingTask, delegate + { + if (Data.DoMatchingDetail.data.matchingState != 3009) + { + DoMatchingResultSetting(); + onFinished.Call(); + } + }); + } + + public override FinishTaskBase GetBattleFinishTask() + { + return new RankBattleFinishTask(); + } + + protected override void GotoDeckSelectScene() + { + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.MyPageMenuIndex = 2; + changeViewSceneParam.OnFinishChangeView = delegate + { + UIManager.GetInstance().CloseInSceneLoadingMatching(); + UIManager.GetInstance().CloseInSceneLoadingBattle(); + MyPageMenu.Instance.ChangeMenu(2); + DeckInfoTask task = new DeckInfoTask(); + task.SetParameter(Data.CurrentFormat); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + DeckSelectUIDialog.Create(Data.SystemText.Get("Battle_0006"), task.DeckGroupListData, Data.CurrentFormat, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: true, delegate(DialogBase dialog, DeckData deckData) + { + FreeAndRankMatchDeckSelectConfirmDialog.Create(dialog, deckData, isBattleEnd: false); + }); + })); + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.MyPage, changeViewSceneParam); + } +} diff --git a/SVSim.BattleEngine/Engine/Matching_Room.cs b/SVSim.BattleEngine/Engine/Matching_Room.cs new file mode 100644 index 0000000..2162dd5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Matching_Room.cs @@ -0,0 +1,256 @@ +using System; +using Cute; +using Wizard; +using Wizard.ErrorDialog; +using Wizard.RoomMatch; + +public class Matching_Room : Matching +{ + public enum GAME_STATE + { + WAIT, + LOADING, + BATTLE, + RESULT + } + + private BattleParameter _battleParameter; + + private bool _isConvention; + + private bool _isGathering; + + private bool _isInitRoomBattle; + + private GAME_STATE _gameState; + + public const int RESULT_CODE_ROOM_NOT_FOUND = 1751; + + public const int RESULT_CODE_GATHERING_NOT_JOIN = 5304; + + public const int RESULT_CODE_GATHERING_EXPIRE = 5311; + + public bool IsStopChangeScene { get; set; } + + public override void FirstSetting(int classId, int selDeck, bool isRecovery = false) + { + _isInitRoomBattle = false; + errorDialogReturnText = Wizard.Data.SystemText.Get("Battle_0202"); + base.FirstSetting(classId, selDeck, isRecovery); + } + + public void SetBattleParameter(BattleParameter battleParameter) + { + _battleParameter = battleParameter; + } + + public Matching_Room(bool isConvention, bool isGathering) + { + _isConvention = isConvention; + _isGathering = isGathering; + errorDialogReturnText = Wizard.Data.SystemText.Get("Battle_0434"); + isDisplayCancelButton = false; + IsStopChangeScene = false; + } + + public override void DoMatching(Action onFinished, int init, DO_MATCHING_LOG log) + { + base.DoMatching(onFinished, 0, log); + RoomBattleDoMatchingTask roomBattleDoMatchingTask = ((_battleParameter.DeckFormat == Format.Hof) ? new RoomBattleDoMatchingTaskHOF() : ((_battleParameter.DeckFormat == Format.Windfall) ? new RoomBattleDoMatchingTaskWindFall() : ((_battleParameter.DeckFormat == Format.Avatar) ? new RoomBattleDoMatchingTaskAvatar(_isGathering) : ((!RoomConnectController.IsNormalMatchingAPI(_battleParameter)) ? new RoomBattle2PickDoMatchingTask(_battleParameter.TwoPickFormat, _battleParameter.Rule) : new RoomBattleDoMatchingTask(_isConvention, _isGathering))))); + roomBattleDoMatchingTask.SetParameter(selectDeckID, 0, (int)log, includeCardMasterHash: true); + ConnectAPI(roomBattleDoMatchingTask, delegate + { + if (Wizard.Data.RoomBattleMatching.data.matching_state != 3009) + { + _gameState = (GAME_STATE)Wizard.Data.RoomBattleMatching.data.battle_state; + _doMatchingResultKind = (DoMatchingResult)Wizard.Data.RoomBattleMatching.data.matching_state; + onFinished.Call(); + RoomBase.IsMatchingFinish = true; + } + }); + } + + protected override void OnFinishedDoMatching() + { + if (ToolboxGame.RealTimeNetworkAgent == null) + { + return; + } + switch (_doMatchingResultKind) + { + case DoMatchingResult.RC_BATTLE_MATCHING_NOT_JOINED_GATHERING: + OpenErrorDialog((int)_doMatchingResultKind, UIManager.ViewScene.MyPage); + return; + case DoMatchingResult.RC_BATTLE_MATCHING_GATHERING_BATTLE_END: + OpenErrorDialog((int)_doMatchingResultKind, UIManager.ViewScene.Gathering); + return; + case DoMatchingResult.RC_BATTLE_MATCHING_NOT_ROOM_ID: + OpenErrorDialog((int)_doMatchingResultKind, UIManager.ViewScene.Gathering); + return; + } + switch (_gameState) + { + case GAME_STATE.LOADING: + ErrorDialogWithReturn(Wizard.Data.SystemText.Get("Battle_0401"), Wizard.Data.SystemText.Get("Battle_0411"), Wizard.Data.SystemText.Get("Common_0132")); + break; + case GAME_STATE.BATTLE: + ErrorDialogWithReturn(Wizard.Data.SystemText.Get("Battle_0402"), Wizard.Data.SystemText.Get("Battle_0411"), Wizard.Data.SystemText.Get("Common_0132")); + break; + case GAME_STATE.RESULT: + ErrorDialogWithReturn(Wizard.Data.SystemText.Get("Battle_0403"), Wizard.Data.SystemText.Get("Battle_0411"), Wizard.Data.SystemText.Get("Common_0132")); + break; + default: + MatchingInitBattle(); + break; + } + } + + protected override void SettingOwnerToMatchingState() + { + _isInitRoomBattle = true; + errorDialogReturnText = Wizard.Data.SystemText.Get("Battle_0434"); + base.SettingOwnerToMatchingState(); + switch (_doMatchingResultKind) + { + case DoMatchingResult.RC_BATTLE_MATCHING_SUCCEEDED_OWNER: + isOwner = true; + break; + case DoMatchingResult.RC_BATTLE_MATCHING_SUCCEEDED: + isOwner = false; + break; + default: + ErrorDialogWithReturn(Wizard.Data.SystemText.Get("Battle_0404"), Wizard.Data.SystemText.Get("Error_0002"), Wizard.Data.SystemText.Get("Common_0132")); + break; + case DoMatchingResult.RC_BATTLE_MATCHING_IN_BATTLE_PHASE: + break; + } + } + + protected override NetworkBattleDefine.NetworkBattleURI GetInitBattleUri() + { + return NetworkBattleDefine.NetworkBattleURI.InitRoomBattle; + } + + protected override void GotoHomeScene() + { + RoomBase.IsMatchingFinish = false; + bool isInitRoomBattle = _isInitRoomBattle; + if (IsStopChangeScene) + { + return; + } + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.OnChange = delegate + { + UIManager.GetInstance().CloseInSceneLoadingBattle(); + }; + if (isInitRoomBattle) + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Room, changeViewSceneParam); + return; + } + changeViewSceneParam.IsCutCardMotion = true; + changeViewSceneParam.OnFinishChangeView = delegate + { + UIManager.GetInstance().CloseInSceneLoadingMatching(); + UIManager.GetInstance().CloseInSceneLoadingBattle(); + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.MyPage, changeViewSceneParam); + } + + protected override void GotoDeckSelectScene() + { + GotoHomeScene(); + } + + public override FinishTaskBase GetBattleFinishTask() + { + if (_battleParameter.DeckFormat == Format.Hof) + { + return new RoomBattleFinishTaskHOF(); + } + if (_battleParameter.DeckFormat == Format.Windfall) + { + return new RoomBattleFinishTaskWindFall(); + } + if (_battleParameter.DeckFormat == Format.Avatar) + { + return new RoomBattleFinishTaskAvatar(_isGathering); + } + if (RoomConnectController.IsNormalMatchingAPI(_battleParameter)) + { + return new RoomBattleFinishTask(_isConvention, _isGathering); + } + return new RoomBattle2PickFinishTask(_battleParameter.TwoPickFormat, _battleParameter.Rule); + } + + protected override void ErrorDialog(string text, string title, bool isFailedInitNetwork) + { + DialogBase dialogBase = CreateDialogBase(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(title); + dialogBase.SetText(text); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetButtonText(errorDialogReturnText); + dialogBase.SetFadeButtonEnabled(flag: false); + dialogBase.SetPanelDepth(5400); + dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_CANCEL_TRANS; + EventDelegate method_btn = new EventDelegate(base.ReturnScene); + dialogBase.SetButtonDelegate(method_btn); + } + + public override void TimeOutAction(string log, bool isInitNetworkFailed) + { + if (!_goTitleOnTimeout && _isGathering) + { + ErrorDialogGoToTitle(Wizard.Data.SystemText.Get("Battle_0508"), Wizard.Data.SystemText.Get("Battle_0412")); + return; + } + if (_goTitleOnTimeout && !_receivedMatchingTimeout) + { + ErrorDialogGoToTitle(Wizard.Data.SystemText.Get("Battle_0508"), Wizard.Data.SystemText.Get("Battle_0412")); + return; + } + LocalLog.AccumulateLastTraceLog("TimeOutAction " + log); + ErrorDialogGoToTitle(Wizard.Data.SystemText.Get("Error_0006"), Wizard.Data.SystemText.Get("ErrorHeader_0006")); + } + + public override void GotoBattle() + { + base.GotoBattle(); + RoomConnectController.IsAlreadyStartBattle = true; + } + + private void OnPushErrorDialogButton(UIManager.ViewScene scene) + { + bool matchingDataReady = GetMatchingDataReady(); + if (!matchingDataReady && isOffViewAllEnable) + { + UIManager.GetInstance().OffViewAll(); + } + ToolboxGame.DestroyNetworkAgent(); + if (matchingDataReady && GameMgr.GetIns().GetBattleCtrl() != null) + { + UIManager.GetInstance().StartCoroutine(BattleEndCoroutin(delegate + { + UIManager.GetInstance().ChangeViewScene(scene); + })); + } + else + { + UIManager.GetInstance().ChangeViewScene(scene); + } + } + + private void OpenErrorDialog(int errorCode, UIManager.ViewScene scene) + { + DialogBase dialogBase = CreateDialogBase(); + Dialog.Setup(dialogBase, errorCode.ToString()); + dialogBase.SetPanelDepth(5400); + dialogBase.onPushButton1 = delegate + { + OnPushErrorDialogButton(scene); + }; + _matchingTimeCheker.Stop(); + } +} diff --git a/SVSim.BattleEngine/Engine/Matching_TwoPick.cs b/SVSim.BattleEngine/Engine/Matching_TwoPick.cs new file mode 100644 index 0000000..cc6886a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Matching_TwoPick.cs @@ -0,0 +1,48 @@ +using System; +using Cute; +using Wizard; +using Wizard.Scripts.Network.Task.Arena.TwoPick; + +public class Matching_TwoPick : Matching +{ + public Matching_TwoPick() + { + errorDialogReturnText = Data.SystemText.Get("Battle_0429"); + } + + public override void DoMatching(Action onFinished, int need_init, DO_MATCHING_LOG log) + { + base.DoMatching(onFinished, need_init, log); + TwoPickDoMatchingTask twoPickDoMatchingTask = new TwoPickDoMatchingTask(); + twoPickDoMatchingTask.SetParameter(selectDeckID, need_init, (int)log); + ConnectAPI(twoPickDoMatchingTask, delegate + { + if (Data.DoMatchingDetail.data.matchingState != 3009) + { + DoMatchingResultSetting(); + onFinished.Call(); + } + }); + } + + protected override void TimeOutMessageToRetry() + { + ErrorDialogWithRetry(Data.SystemText.Get("Battle_0461"), Data.SystemText.Get("Battle_0412")); + } + + public override FinishTaskBase GetBattleFinishTask() + { + return new TwoPickFinishBattleTask(); + } + + protected override void GotoDeckSelectScene() + { + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.OnFinishChangeView = delegate + { + UIManager.GetInstance().CloseInSceneLoadingMatching(); + UIManager.GetInstance().CloseInSceneLoadingBattle(); + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.TwoPick, changeViewSceneParam); + } +} diff --git a/SVSim.BattleEngine/Engine/MaxLifeAddModifier.cs b/SVSim.BattleEngine/Engine/MaxLifeAddModifier.cs new file mode 100644 index 0000000..cba4672 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MaxLifeAddModifier.cs @@ -0,0 +1,12 @@ +public class MaxLifeAddModifier : LifeAddModifier +{ + public MaxLifeAddModifier(int life) + : base(life) + { + } + + public override int CalcLife(int baseLife) + { + return baseLife; + } +} diff --git a/SVSim.BattleEngine/Engine/MaxLifeSetModifier.cs b/SVSim.BattleEngine/Engine/MaxLifeSetModifier.cs new file mode 100644 index 0000000..2efb94d --- /dev/null +++ b/SVSim.BattleEngine/Engine/MaxLifeSetModifier.cs @@ -0,0 +1,14 @@ +public class MaxLifeSetModifier : LifeSetModifier +{ + public override bool IsClearBeforeModifier => false; + + public MaxLifeSetModifier(int life) + : base(life) + { + } + + public override int CalcLife(int baseLife) + { + return baseLife; + } +} diff --git a/SVSim.BattleEngine/Engine/MecanimSceneBase.cs b/SVSim.BattleEngine/Engine/MecanimSceneBase.cs new file mode 100644 index 0000000..30414cc --- /dev/null +++ b/SVSim.BattleEngine/Engine/MecanimSceneBase.cs @@ -0,0 +1,235 @@ +using System; +using System.Collections; +using UnityEngine; + +public class MecanimSceneBase : UIBase +{ + public const string SCENE_FIRST_START = "FirstStart"; + + public const string SCENE_OPEN = "Open"; + + public const string SCENE_CLOSE = "Close"; + + protected Animator m_animator; + + protected MecanimStateBase m_state; + + protected MecanimStateBase m_nextState; + + private Coroutine m_waitCoroutine; + + private Action m_callback; + + public MecanimStateBase CurrentState => m_state; + + public void ChangeState(MecanimStateBase state, bool skipCloseAnim = false, bool skipOpenAnim = false) + { + Action nextFunc = delegate + { + if ((bool)(m_state = m_nextState)) + { + m_state.onOpen(); + PlayAndCallback(m_state.OpenStateName, m_state.onUpdateOpenAnim, delegate + { + if ((bool)m_state) + { + m_state.onFinishOpenAnim(); + if (m_state.NextState != null) + { + ChangeState(m_state.NextState); + } + } + }, skipOpenAnim); + } + }; + if ((bool)state && !state.onOpenRequest(m_state, m_callback != null)) + { + return; + } + if ((bool)m_state) + { + if (!m_state.onCloseRequest(state, m_callback != null)) + { + return; + } + m_nextState = state; + m_state.onClose(); + PlayAndCallback(m_state.CloseStateName, m_state.onUpdateCloseAnim, delegate + { + if ((bool)m_state) + { + m_state.onFinishCloseAnim(); + nextFunc(); + } + }, skipCloseAnim); + } + else + { + m_nextState = state; + nextFunc(); + } + } + + private bool Play(string state, bool isSkip = false) + { + if (!m_animator) + { + return false; + } + if (m_waitCoroutine != null) + { + StopCoroutine(m_waitCoroutine); + m_waitCoroutine = null; + AnimatorStateInfo currentAnimatorStateInfo = m_animator.GetCurrentAnimatorStateInfo(0); + m_animator.Play(currentAnimatorStateInfo.fullPathHash, 0, 1f); + if (m_callback != null) + { + Action callback = m_callback; + m_callback = null; + callback(); + } + } + if (state != null && state.Length > 0) + { + m_animator.Play(state, 0, isSkip ? 1f : 0f); + return true; + } + return false; + } + + private bool PlayAndCallback(string state, Action update, Action callback, bool isSkip = false) + { + bool num = Play(state, isSkip); + if (num && !isSkip) + { + m_callback = callback; + m_waitCoroutine = StartCoroutine(PlayAndCallback_Coroutine(state, update)); + return num; + } + callback?.Invoke(); + return num; + } + + private IEnumerator PlayAndCallback_Coroutine(string state, Action update) + { + if ((bool)m_animator) + { + AnimatorStateInfo info; + while (true) + { + AnimatorStateInfo currentAnimatorStateInfo; + info = (currentAnimatorStateInfo = m_animator.GetCurrentAnimatorStateInfo(0)); + currentAnimatorStateInfo = currentAnimatorStateInfo; + if (currentAnimatorStateInfo.IsName(state)) + { + break; + } + yield return null; + } + float time = 0f - Time.deltaTime; + while (true) + { + float num; + time = (num = time + Time.deltaTime); + if (!(num < info.length)) + { + break; + } + update?.Invoke(); + yield return null; + } + } + m_waitCoroutine = null; + if (m_callback != null) + { + Action callback = m_callback; + m_callback = null; + callback(); + } + } + + public override void onFirstStart() + { + base.onFirstStart(); + if ((bool)(m_animator = GetComponent())) + { + Play("FirstStart"); + } + } + + protected override void onOpen() + { + base.onOpen(); + if ((bool)m_animator) + { + PlayAndCallback("Open", onUpdateOpenAnim, delegate + { + onFinishOpenAnim(); + }); + } + else + { + onFinishOpenAnim(); + } + } + + protected virtual void onUpdateOpenAnim() + { + } + + protected virtual void onFinishOpenAnim() + { + } + + protected override void onClose() + { + m_state = null; + if ((bool)m_animator) + { + PlayAndCallback("Close", onUpdateCloseAnim, delegate + { + onFinishCloseAnim(); + }); + } + else + { + onFinishCloseAnim(); + } + } + + protected virtual void onUpdateCloseAnim() + { + } + + protected virtual void onFinishCloseAnim() + { + base.onClose(); + } + + public override void onMove() + { + base.onMove(); + if ((bool)m_state && !m_state.DontMove) + { + m_state.onMove(); + } + } + + protected void CreateLoading(bool notBlack) + { + UIManager.GetInstance().createInSceneLoading(notBlack); + } + + protected void CloseLoading() + { + UIManager.GetInstance().closeInSceneLoading(); + } + + protected void onNotify(int value) + { + if ((bool)m_state) + { + m_state.onNotify(value); + } + } +} diff --git a/SVSim.BattleEngine/Engine/MecanimStateBase.cs b/SVSim.BattleEngine/Engine/MecanimStateBase.cs new file mode 100644 index 0000000..52adaf8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MecanimStateBase.cs @@ -0,0 +1,95 @@ +using UnityEngine; + +public class MecanimStateBase : MonoBehaviour +{ + [SerializeField] + private string m_openStateName; + + [SerializeField] + private string m_closeStateName; + + [SerializeField] + private MecanimStateBase m_autoNextState; + + public string OpenStateName + { + get + { + return m_openStateName; + } + set + { + m_openStateName = value; + } + } + + public string CloseStateName + { + get + { + return m_closeStateName; + } + set + { + m_closeStateName = value; + } + } + + public MecanimStateBase NextState + { + get + { + return m_autoNextState; + } + set + { + m_autoNextState = value; + } + } + + public bool DontMove { get; private set; } + + public virtual bool onOpenRequest(MecanimStateBase prev, bool isSkip) + { + return true; + } + + public virtual void onOpen() + { + DontMove = false; + } + + public virtual void onUpdateOpenAnim() + { + } + + public virtual void onFinishOpenAnim() + { + } + + public virtual bool onCloseRequest(MecanimStateBase next, bool isSkip) + { + return true; + } + + public virtual void onClose() + { + DontMove = true; + } + + public virtual void onUpdateCloseAnim() + { + } + + public virtual void onFinishCloseAnim() + { + } + + public virtual void onMove() + { + } + + public virtual void onNotify(int value) + { + } +} diff --git a/SVSim.BattleEngine/Engine/MissionInfo.cs b/SVSim.BattleEngine/Engine/MissionInfo.cs new file mode 100644 index 0000000..9bdae73 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MissionInfo.cs @@ -0,0 +1,4 @@ +public class MissionInfo : HeaderData +{ + public MissionInfoDetail data; +} diff --git a/SVSim.BattleEngine/Engine/MissionInfoDetail.cs b/SVSim.BattleEngine/Engine/MissionInfoDetail.cs new file mode 100644 index 0000000..c399d7f --- /dev/null +++ b/SVSim.BattleEngine/Engine/MissionInfoDetail.cs @@ -0,0 +1,138 @@ +using System.Collections.Generic; +using LitJson; +using Wizard; + +public class MissionInfoDetail +{ + public enum eMissionReceiveType + { + normal, + solo + } + + public List user_mission_list; + + public List user_achievement_list; + + public List total_reward_list; + + public bool _isChangeMission; + + public long _canChangeMissionTime; + + private const string REWARDS = "total_receive_count_list"; + + public BattlePassMonthlyMission BattlePassMonthlyMissionData { get; private set; } + + public eMissionReceiveType _missionReceiveType { get; private set; } + + public bool CanChangeReceiveType { get; private set; } + + public long WaitTimeCanChangeReceiveType { get; private set; } + + public MissionInfoDetail() + { + user_mission_list = new List(); + user_achievement_list = new List(); + total_reward_list = new List(); + } + + public MissionInfoDetail(JsonData data) + : this() + { + _isChangeMission = data["is_change_mission"].ToBoolean(); + if (!_isChangeMission) + { + _canChangeMissionTime = data["can_change_mission_time"].ToLong(); + } + ReadMissionList(data["user_mission_list"]); + ReadAchievementList(data["user_achievement_list"]); + ReadBattlePassMonthlyMission(data); + switch (data["mission_receive_type"].ToInt()) + { + case 0: + _missionReceiveType = eMissionReceiveType.normal; + break; + case 1: + _missionReceiveType = eMissionReceiveType.solo; + break; + } + CanChangeReceiveType = data["is_change_receive_type"].ToBoolean(); + if (!CanChangeReceiveType) + { + WaitTimeCanChangeReceiveType = data["can_change_receive_type_time"].ToLong(); + } + if (data.Keys.Contains("total_receive_count_list")) + { + ReadRewardList(data["total_receive_count_list"]); + } + } + + private void ReadMissionList(JsonData userMissionList) + { + for (int i = 0; i < userMissionList.Count; i++) + { + JsonData jsonData = userMissionList[i]; + UserMission userMission = new UserMission(); + userMission.id = (int)jsonData["id"]; + userMission.mission_id = (int)jsonData["mission_id"]; + userMission.mission_status = (int)jsonData["mission_status"]; + userMission.total_count = (int)jsonData["total_count"]; + userMission.mission_name = (string)jsonData["mission_name"]; + userMission.display_order = (int)jsonData["display_order"]; + userMission.require_number = (int)jsonData["require_number"]; + userMission.reward_type = (int)jsonData["reward_type"]; + userMission.RewardUserGoodsId = jsonData["reward_detail_id"].ToLong(); + userMission.reward_number = (int)jsonData["reward_number"]; + userMission.start_time = jsonData["start_time"].ToLong(); + userMission.default_flag = jsonData["default_flag"].ToBoolean(); + userMission.lot_type = jsonData["lot_type"].ToInt(); + user_mission_list.Add(userMission); + if (jsonData.Keys.Contains("end_time")) + { + userMission.end_time = jsonData["end_time"].ToLong(); + } + } + } + + private void ReadAchievementList(JsonData userAchievementList) + { + for (int i = 0; i < userAchievementList.Count; i++) + { + JsonData jsonData = userAchievementList[i]; + UserAchievement userAchievement = new UserAchievement(); + userAchievement.achievement_type = jsonData["achievement_type"].ToInt(); + userAchievement.achievement_status = jsonData["achievement_status"].ToInt(); + userAchievement.level = jsonData["level"].ToInt(); + userAchievement._maxLevel = jsonData["max_level"].ToInt(); + userAchievement.total_count = jsonData["total_count"].ToInt(); + userAchievement.achievement_name = jsonData["achievement_name"].ToString(); + userAchievement.require_number = jsonData["require_number"].ToInt(); + userAchievement.reward_type = jsonData["reward_type"].ToInt(); + userAchievement.RewardUserGoodsId = jsonData["reward_detail_id"].ToLong(); + userAchievement.reward_number = jsonData["reward_number"].ToInt(); + user_achievement_list.Add(userAchievement); + } + } + + private void ReadBattlePassMonthlyMission(JsonData jsonData) + { + BattlePassMonthlyMissionData = null; + if (jsonData.Keys.Contains("battle_pass_monthly_mission")) + { + BattlePassMonthlyMissionData = new BattlePassMonthlyMission(jsonData["battle_pass_monthly_mission"]); + } + } + + private void ReadRewardList(JsonData rewardList) + { + if (rewardList != null) + { + for (int i = 0; i < rewardList.Count; i++) + { + ReceivedReward item = new ReceivedReward(rewardList[i]); + total_reward_list.Add(item); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/MotionUtils.cs b/SVSim.BattleEngine/Engine/MotionUtils.cs new file mode 100644 index 0000000..261d26f --- /dev/null +++ b/SVSim.BattleEngine/Engine/MotionUtils.cs @@ -0,0 +1,301 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +public class MotionUtils +{ + public enum EaseType + { + linear, + easeInSine, + easeInQuad, + easeInCubic, + easeInQuart, + easeInQuint, + easeInExpo, + easeInBack, + easeInBounce, + easeInElastic, + easeOutSine, + easeOutQuad, + easeOutCubic, + easeOutQuart, + easeOutQuint, + easeOutExpo, + easeOutBack, + easeOutBounce, + easeOutElastic, + easeInOutSine, + easeInOutQuad, + easeInOutCubic, + easeInOutQuart, + easeInOutQuint, + easeInOutExpo, + easeInOutBack, + easeInOutBounce, + easeInOutElastic + } + + public static float GetEase(float t, EaseType e) + { + float num = 1f - t; + switch (e) + { + case EaseType.linear: + return t; + case EaseType.easeInSine: + return 1f - Mathf.Cos(t * (float)Math.PI / 2f); + case EaseType.easeInQuad: + return t * t; + case EaseType.easeInCubic: + return t * t * t; + case EaseType.easeInQuart: + return t * t * t * t; + case EaseType.easeInQuint: + return t * t * t * t * t; + case EaseType.easeInExpo: + return Mathf.Pow(2f, 10f * (t - 1f)); + case EaseType.easeInBack: + return t * t * (2.70158f * t - 1.70158f); + case EaseType.easeInBounce: + if (num < 0.36363637f) + { + return 1f - 7.5625f * num * num; + } + if (num < 0.72727275f) + { + return 1f - (7.5625f * (num - 0.54545456f) * (num - 0.54545456f) + 0.75f); + } + if (num < 0.90909094f) + { + return 1f - (7.5625f * (num - 0.8181818f) * (num - 0.8181818f) + 0.9375f); + } + return 1f - (7.5625f * (num - 21f / 22f) * (num - 21f / 22f) + 63f / 64f); + case EaseType.easeInElastic: + { + float num2 = 0.3f; + if (t == 0f) + { + return 0f; + } + if (t == 1f) + { + return 1f; + } + float num3 = num2 / ((float)Math.PI * 2f) * Mathf.Asin(1f); + return 0f - t * Mathf.Pow(2f, 10f * (t -= 1f)) * Mathf.Sin((t - num3) * ((float)Math.PI * 2f) / num2); + } + case EaseType.easeOutSine: + return Mathf.Sin(t * (float)Math.PI / 2f); + case EaseType.easeOutQuad: + return 1f - num * num; + case EaseType.easeOutCubic: + return 1f - num * num * num; + case EaseType.easeOutQuart: + return 1f - num * num * num * num; + case EaseType.easeOutQuint: + return 1f - num * num * num * num * num; + case EaseType.easeOutExpo: + return 0f - Mathf.Pow(2f, -10f * t) + 1f; + case EaseType.easeOutBack: + return 1f - num * num * (2.70158f * num - 1.70158f); + case EaseType.easeOutBounce: + if (t < 0.36363637f) + { + return 7.5625f * t * t; + } + if (t < 0.72727275f) + { + return 7.5625f * (t - 0.54545456f) * (t - 0.54545456f) + 0.75f; + } + if (t < 0.90909094f) + { + return 7.5625f * (t - 0.8181818f) * (t - 0.8181818f) + 0.9375f; + } + return 7.5625f * (t - 21f / 22f) * (t - 21f / 22f) + 63f / 64f; + case EaseType.easeOutElastic: + { + float num2 = 0.3f; + if (t == 0f) + { + return 0f; + } + if (t == 1f) + { + return 1f; + } + float num3 = num2 / ((float)Math.PI * 2f) * Mathf.Asin(1f); + return Mathf.Pow(2f, -10f * t) * Mathf.Sin((t - num3) * ((float)Math.PI * 2f) / num2) + 1f; + } + case EaseType.easeInOutSine: + return (1f - Mathf.Cos(t * (float)Math.PI)) * 0.5f; + case EaseType.easeInOutQuad: + return (t < 0.5f) ? (t * t * 2f) : (1f - num * num * 2f); + case EaseType.easeInOutCubic: + return (t < 0.5f) ? (t * t * t * 2f) : (1f - num * num * num * 2f); + case EaseType.easeInOutQuart: + return (t < 0.5f) ? (t * t * t * t * 2f) : (1f - num * num * num * num * 2f); + case EaseType.easeInOutQuint: + return (t < 0.5f) ? (t * t * t * t * t * 2f) : (1f - num * num * num * num * num * 2f); + case EaseType.easeInOutExpo: + return (t < 0.5f) ? Mathf.Pow(2f, 10f * (t * 2f - 1f)) : (0.5f * (0f - Mathf.Pow(2f, -10f * (t * 2f - 1f)) + 2f)); + case EaseType.easeInOutBack: + return (t < 0.5f) ? (0.5f * (t * 2f) * (t * 2f) * (2.525f * t * 2f - 1.525f)) : (1f - 0.5f * (num * 2f) * (num * 2f) * (2.525f * num * 2f - 1.525f)); + case EaseType.easeInOutBounce: + if (t < 0.5f) + { + return GetEase(t * 2f, EaseType.easeInBounce) * 0.5f; + } + return GetEase(t * 2f - 1f, EaseType.easeOutBounce) * 0.5f + 0.5f; + case EaseType.easeInOutElastic: + if (t < 0.5f) + { + return GetEase(t * 2f, EaseType.easeInElastic) * 0.5f; + } + return GetEase(t * 2f - 1f, EaseType.easeOutElastic) * 0.5f + 0.5f; + default: + return t; + } + } + + public static Vector3[] GetBezierQuad(Vector3 p0, Vector3 p1, Vector3 p2, int div) + { + Vector3[] array = new Vector3[div]; + for (int i = 0; i < div; i++) + { + float num = (float)i / (float)(div - 1); + float num2 = 1f - num; + array[i] = new Vector3(num2 * num2 * p0.x + 2f * num2 * num * p1.x + num * num * p2.x, num2 * num2 * p0.y + 2f * num2 * num * p1.y + num * num * p2.y, num2 * num2 * p0.z + 2f * num2 * num * p1.z + num * num * p2.z); + } + return array; + } + + public static Vector3[] GetBezierCubic(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, int div) + { + Vector3[] array = new Vector3[div]; + for (int i = 0; i < div; i++) + { + float num = (float)i / (float)(div - 1); + float num2 = 1f - num; + array[i] = new Vector3(num2 * num2 * num2 * p0.x + 3f * num2 * num2 * num * p1.x + 3f * num2 * num * num * p2.x + num * num * num * p3.x, num2 * num2 * num2 * p0.y + 3f * num2 * num2 * num * p1.y + 3f * num2 * num * num * p2.y + num * num * num * p3.y, num2 * num2 * num2 * p0.z + 3f * num2 * num2 * num * p1.z + 3f * num2 * num * num * p2.z + num * num * num * p3.z); + } + return array; + } + + public static Vector3[] GetCatmullRomSpline(Vector3[] p, int div, bool closed = false) + { + int num = p.Length; + List list = new List(); + List list2 = new List(); + if (closed) + { + list.Add(p[num - 1]); + list.AddRange(p); + list.Add(p[0]); + list.Add(p[1]); + num++; + } + else + { + list.Add(p[0]); + list.AddRange(p); + list.Add(p[num - 1]); + } + list2.Add(p[0]); + for (int i = 1; i < num; i++) + { + Vector3 vector = -1f * list[i - 1] + 3f * list[i] - 3f * list[i + 1] + 1f * list[i + 2]; + Vector3 vector2 = 2f * list[i - 1] - 5f * list[i] + 4f * list[i + 1] - 1f * list[i + 2]; + Vector3 vector3 = -1f * list[i - 1] + 0f * list[i] + 1f * list[i + 1] + 0f * list[i + 2]; + Vector3 vector4 = 0f * list[i - 1] + 2f * list[i] + 0f * list[i + 1] + 0f * list[i + 2]; + for (int j = 1; j <= div; j++) + { + float num2 = (float)j / (float)div; + list2.Add((vector * num2 * num2 * num2 + vector2 * num2 * num2 + vector3 * num2 + vector4) * 0.5f); + } + } + return list2.ToArray(); + } + + public static void SetLayerAll(GameObject obj, int layer) + { + obj.layer = layer; + for (int i = 0; i < obj.transform.childCount; i++) + { + GameObject gameObject = obj.transform.GetChild(i).gameObject; + if (gameObject.transform.childCount > 0) + { + SetLayerAll(gameObject, layer); + } + else + { + gameObject.layer = layer; + } + } + } + + public static void SetActiveAll(GameObject obj, bool flg) + { + obj.SetActive(flg); + for (int i = 0; i < obj.transform.childCount; i++) + { + GameObject gameObject = obj.transform.GetChild(i).gameObject; + if (gameObject.transform.childCount > 0) + { + SetActiveAll(gameObject, flg); + } + else + { + gameObject.SetActive(flg); + } + } + } + + public static void ChangeParticleSystemColor(GameObject particleSystemRootObject, Color newColor, Action actionOnChildrenParticleSytems = null) + { + ParticleSystem[] componentsInChildren = particleSystemRootObject.GetComponentsInChildren(); + foreach (ParticleSystem particleSystem in componentsInChildren) + { + ParticleSystem.MainModule main = particleSystem.main; + main.startColor = newColor; + ParticleSystem.Particle[] array = new ParticleSystem.Particle[particleSystem.particleCount]; + int particles = particleSystem.GetParticles(array); + for (int j = 0; j < array.Length; j++) + { + array[j].startColor = newColor; + } + particleSystem.SetParticles(array, particles); + actionOnChildrenParticleSytems?.Invoke(particleSystem); + } + } + + public static float GetAim(Vector2 p0, Vector2 p1) + { + float x = p1.x - p0.x; + return Mathf.Atan2(p1.y - p0.y, x) * 57.29578f - 90f; + } + + public static Quaternion GetAimRotation(Vector3 p0, Vector3 p1) + { + return Quaternion.FromToRotation(Vector3.up, p1 - p0); + } + + public static Vector2 GetPositionByAngle(float rot) + { + return new Vector2(Mathf.Cos(rot / 180f * (float)Math.PI), Mathf.Sin(rot / 180f * (float)Math.PI)); + } + + public static float CalculateFrameRateIndependantDampingConstant(float smoothingAmount, float decayMultiplier) + { + return 1f - Mathf.Pow(smoothingAmount, Time.smoothDeltaTime * decayMultiplier); + } + + public static int GetDigit(int value) + { + if (value == 0) + { + return 1; + } + return (int)Mathf.Log10(Mathf.Abs(value)) + 1; + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageBanner.cs b/SVSim.BattleEngine/Engine/MyPageBanner.cs new file mode 100644 index 0000000..111c2d3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageBanner.cs @@ -0,0 +1,294 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Wizard; + +public class MyPageBanner : MyPageBannerBase +{ + protected enum MoveSide + { + Left, + Right + } + + [SerializeField] + protected UICenterOnChild _uiCenterOnChild; + + [SerializeField] + protected GameObject _pagerPrefab; + + [SerializeField] + protected UIWrapContent _uiWrapContent; + + [SerializeField] + protected GameObject _pagerBaseObject; + + [SerializeField] + protected GameObject _buttonBase; + + [SerializeField] + protected GameObject _buttonLeftObject; + + [SerializeField] + protected GameObject _buttonRightObject; + + [SerializeField] + private GameObject _bgObject; + + protected bool _isAnimation; + + protected bool _isCanSlide; + + protected bool _isClickStart; + + protected Vector3 _touchPoint; + + protected int _bannerNo; + + protected List _pagerSpriteList; + + protected float _updateTimer; + + protected GameObject _centerObject; + + protected bool _isLeftButtonPressed; + + protected bool _isRightButtonPressed; + + private const int SLIDE_LIMIT_VALUE = 30; + + private const string PAGER_OFF_SPRITE_NAME = "carousel_marker_off"; + + private const string PAGER_ON_SPRITE_NAME = "carousel_marker_on"; + + private const string CSV_NAME = "banner"; + + private void Start() + { + UIEventListener.Get(_buttonLeftObject).onPress = LeftButtonOnPress; + UIEventListener.Get(_buttonRightObject).onPress = RightButtonOnPress; + } + + private void Update() + { + if (!base.IsCreateEnd) + { + return; + } + slideMoveUpdate(); + if (_bannerList.Count > 1 && _isCanSlide) + { + _updateTimer += Time.deltaTime; + float changeTime = _bannerList[_bannerNo]._changeTime; + if (_updateTimer >= changeTime) + { + SlideStartSetting(MoveSide.Right); + } + } + if (_isCanSlide) + { + if (_isLeftButtonPressed) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + SlideStartSetting(MoveSide.Left); + } + else if (_isRightButtonPressed) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + SlideStartSetting(MoveSide.Right); + } + } + } + + protected override IEnumerator CreateBannerImage() + { + _bannerList = new List(Data.MyPage.data._bannerList); + if (!base.IsEnableBanner) + { + base.gameObject.SetActive(value: false); + yield break; + } + yield return LoadBannerImage(); + while (!base.gameObject.activeInHierarchy) + { + yield return null; + } + for (int i = 0; i < _bannerList.Count; i++) + { + GameObject gameObject = UnityEngine.Object.Instantiate(_bannerImagePrefab); + gameObject.transform.SetParent(_uiWrapContent.transform); + gameObject.transform.localScale = Vector3.one; + gameObject.transform.localPosition = Vector3.zero; + _bannerList[i].BannerGameObject = gameObject; + } + _uiWrapContent.onInitializeItem = _OnInitializeItem; + _uiWrapContent.SortBasedOnScrollMovement(); + _uiCenterOnChild.onFinished = _OnFinishedCenterChild; + if (_bannerList.Count > 1) + { + GameObject gameObject2 = _uiWrapContent.transform.Find("0").gameObject; + _uiWrapContent.transform.Find((_bannerList.Count - 1).ToString()).gameObject.transform.localPosition = new Vector3(gameObject2.transform.localPosition.x - (float)_uiWrapContent.itemSize, gameObject2.transform.localPosition.y, gameObject2.transform.localPosition.z); + _pagerSpriteList = new List(); + for (int j = 0; j < _bannerList.Count; j++) + { + GameObject gameObject3 = UnityEngine.Object.Instantiate(_pagerPrefab); + gameObject3.transform.SetParent(_pagerBaseObject.transform); + gameObject3.transform.localScale = Vector3.one; + gameObject3.transform.localPosition = Vector3.zero; + gameObject3.name = j.ToString(); + _pagerSpriteList.Add(gameObject3.GetComponent()); + } + _PagerUpDate(); + UIGrid component = _pagerBaseObject.GetComponent(); + component.enabled = true; + float x = component.transform.localPosition.x - component.cellWidth * (float)(_bannerList.Count - 1) / 2f; + component.transform.localPosition = new Vector3(x, component.transform.localPosition.y, component.transform.localPosition.z); + } + else + { + _buttonBase.SetActive(value: false); + } + _centerObject = _uiWrapContent.transform.Find(_bannerNo.ToString()).gameObject; + } + + protected void BannerOnPress(GameObject inObject, bool inState) + { + if (inState && Input.GetMouseButtonDown(0)) + { + _touchPoint = Input.mousePosition; + _isClickStart = true; + _isCanSlide = true; + StartCoroutine(BannerPressAnimation(inObject)); + } + } + + private void slideMoveUpdate() + { + if (!_isAnimation) + { + _isCanSlide = true; + } + if (_isClickStart && Input.GetMouseButton(0) && _isCanSlide) + { + if (Input.mousePosition.x < _touchPoint.x - 30f) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + SlideStartSetting(MoveSide.Right); + } + else if (Input.mousePosition.x > _touchPoint.x + 30f) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + SlideStartSetting(MoveSide.Left); + } + } + } + + protected void LeftButtonOnPress(GameObject inObject, bool isPressed) + { + _isLeftButtonPressed = isPressed; + _OnFinishedCenterChild(); + } + + protected void RightButtonOnPress(GameObject inObject, bool isPressed) + { + _isRightButtonPressed = isPressed; + _OnFinishedCenterChild(); + } + + protected void SlideStartSetting(MoveSide inMoveSide) + { + _isAnimation = true; + _isCanSlide = false; + _isClickStart = false; + _touchPoint = Input.mousePosition; + _updateTimer = 0f; + if (inMoveSide == MoveSide.Left) + { + _bannerNo = ((_bannerNo - 1 < 0) ? (_bannerList.Count - 1) : (_bannerNo - 1)); + } + else + { + _bannerNo = (_bannerNo + 1) % _bannerList.Count; + } + if (_bannerList.Count == 2) + { + GameObject gameObject = _uiWrapContent.transform.Find(_bannerNo.ToString()).gameObject; + Vector3 localPosition = _centerObject.transform.localPosition; + if (inMoveSide == MoveSide.Left) + { + localPosition.x -= _uiWrapContent.itemSize; + gameObject.transform.localPosition = localPosition; + } + else + { + localPosition.x += _uiWrapContent.itemSize; + gameObject.transform.localPosition = localPosition; + } + } + _centerObject = _uiWrapContent.transform.Find(_bannerNo.ToString()).gameObject; + _uiCenterOnChild.CenterOn(_centerObject.transform); + _PagerUpDate(); + } + + protected void _OnInitializeItem(GameObject go, int wrapIndex, int realIndex) + { + int index = wrapIndex; + UIEventListener.Get(go).onPress = BannerOnPress; + go.name = index.ToString(); + InitializeEventHandler(go, _bannerList[index]); + UIEventListener uIEventListener = UIEventListener.Get(go); + uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate + { + _isClickStart = false; + }); + } + + protected void _OnFinishedCenterChild() + { + _isAnimation = false; + } + + protected void _PagerUpDate() + { + if (_bannerList.Count <= 1) + { + return; + } + for (int i = 0; i < _bannerList.Count; i++) + { + if (i == _bannerNo) + { + _pagerSpriteList[i].spriteName = "carousel_marker_on"; + } + else + { + _pagerSpriteList[i].spriteName = "carousel_marker_off"; + } + } + } + + private IEnumerator BannerPressAnimation(GameObject inTweenObject) + { + TweenScale tweenScaleComponent = inTweenObject.GetComponent(); + if ((bool)tweenScaleComponent) + { + tweenScaleComponent.PlayForward(); + while (Input.GetMouseButton(0)) + { + yield return null; + } + tweenScaleComponent.PlayReverse(); + } + } + + protected void OnDisable() + { + _isClickStart = false; + } + + public void SetChild(GameObject obj) + { + obj.transform.parent = _bgObject.transform; + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageBannerBase.cs b/SVSim.BattleEngine/Engine/MyPageBannerBase.cs new file mode 100644 index 0000000..165ee62 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageBannerBase.cs @@ -0,0 +1,749 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using LitJson; +using UnityEngine; +using Wizard; +using Wizard.Bingo; +using Wizard.Lottery; +using Wizard.UI.Dialog; + +public abstract class MyPageBannerBase : MonoBehaviour +{ + public class BannerInfo + { + public string ImageName; + + public string Click; + + public string Status; + + public List ImagePaths; + + public float _changeTime = 5f; + + public bool NeedBadge; + + public GameObject BannerGameObject { get; set; } + + public override bool Equals(object obj) + { + if (obj == null || GetType() != obj.GetType()) + { + return false; + } + BannerInfo bannerInfo = obj as BannerInfo; + if (ImageName == bannerInfo.ImageName && Click == bannerInfo.Click && Status == bannerInfo.Status && _changeTime == bannerInfo._changeTime && NeedBadge == bannerInfo.NeedBadge) + { + return true; + } + return false; + } + + public override int GetHashCode() + { + return ImageName.GetHashCode() ^ Click.GetHashCode() ^ Status.GetHashCode(); + } + + public void Parse(JsonData json) + { + ImageName = json["image_name"].ToString(); + Click = json["click"].ToString(); + Status = json["status"].ToString(); + if (json.Keys.Contains("image_paths") && json["image_paths"] != null && json["image_paths"].Count != 0) + { + ImagePaths = new List(); + JsonData jsonData = json["image_paths"]; + for (int i = 0; i < jsonData.Count; i++) + { + ImagePaths.Add(jsonData[i].ToString()); + } + } + if (json.Keys.Contains("change_time")) + { + _changeTime = (float)json["change_time"].ToDouble(); + } + if (json.Keys.Contains("has_reward")) + { + NeedBadge = json["has_reward"].ToInt() == 1; + } + } + } + + [SerializeField] + private BannerDialog _prefabDialogMypageBanner; + + [SerializeField] + private GameObject _deckIntroductionPrefab; + + [SerializeField] + protected GameObject _bannerImagePrefab; + + protected List _bannerList; + + private List _loadAssetList; + + private bool _isActive = true; + + private bool _isCreateEnd; + + private bool _isCreate; + + private Coroutine _createCoroutine; + + private const int BANNER_IMAGE_DEPTH = 5; + + public bool IsCreateEnd => _isCreateEnd; + + public bool _isFirstTips { private get; set; } + + public bool IsEnableBanner + { + get + { + if (_bannerList == null || _bannerList.Count == 0) + { + return false; + } + return true; + } + } + + protected abstract IEnumerator CreateBannerImage(); + + public void CreateMyPageBanner() + { + if (!_isCreate) + { + _createCoroutine = UIManager.GetInstance().StartCoroutine(CreateBanner()); + _isCreate = true; + } + } + + private IEnumerator CreateBanner() + { + yield return CreateBannerImage(); + _isCreateEnd = true; + _createCoroutine = null; + if (IsEnableBanner && _bannerList.Count > 0) + { + SetActive(_isActive); + } + } + + private void Start() + { + _loadAssetList = new List(); + } + + public void Show() + { + if (!_isFirstTips) + { + base.gameObject.SetActive(value: true); + } + } + + public void Hide() + { + if (!_isFirstTips) + { + base.gameObject.SetActive(value: false); + } + } + + public void SetActive(bool inActive) + { + _isActive = inActive; + if (_isCreateEnd) + { + if (!IsEnableBanner) + { + base.gameObject.SetActive(value: false); + _isActive = false; + } + else + { + base.gameObject.SetActive(inActive); + _isActive = inActive; + } + } + else + { + _isActive = inActive; + } + } + + protected IEnumerator LoadBannerImage() + { + if (IsEnableBanner) + { + _loadAssetList = new List(); + List loadImagePath = new List(); + for (int i = 0; i < _bannerList.Count; i++) + { + loadImagePath.Add(Toolbox.ResourcesManager.GetAssetTypePath(_bannerList[i].ImageName, ResourcesManager.AssetLoadPathType.UiDownLoad)); + } + yield return UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadImagePath, null)); + _loadAssetList.AddRange(loadImagePath); + } + } + + public static void SceneChangeBySetting(string click, string status) + { + switch (click) + { + case "announce": + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().WebViewHelper.OpenAnnounceWebView(status); + return; + case "colosseum": + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OpenColosseumRound(); + return; + case "dialog_text": + OnClickDialogText(status); + return; + case "lottery": + OnClickIncentiveCampaign(int.Parse(status)); + return; + case "beginner_mission": + OnClickBeginnerMission(); + return; + case "webview": + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().WebViewHelper.OpenWebviewWithPageId(status); + return; + case "webview_limited": + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().WebViewHelper.OpenWebViewDirectly(status, isLimited: true); + return; + case "battle_pass_buy": + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + BattlePassPurchaseDialog.Create(); + return; + case "browser": + OnClickOpenBrowser(status); + return; + case "data_link": + MyPageOtherButtons.CreateDataLinkDialog(); + return; + case "account_link": + MyPageOtherButtons.CreateDialogAccountLink(); + return; + case "mypage_battle": + if (MyPageMenu.Instance != null) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + MyPageMenu.Instance.ChangeMenu(2); + } + return; + case "mypage_deck": + if (MyPageMenu.Instance != null) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + MyPageMenu.Instance.ChangeMenu(4); + MyPageMenu.Instance.GoToCardDeck(); + } + return; + case "competition": + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OnClickCompetitionBanner(); + return; + case "bingo": + OnClickBingoEvent(); + return; + case "upgrade_treasure_box_cp_dialog": + OnClickTreasureBoxCpDialog(); + return; + case "red_ether": + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.RedEtherCampaignLobby); + return; + case "ts_rotation_deck": + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DeckListUI.ChangeSceneToDeckList(Format.Rotation); + return; + case "account_transition_with_two": + StartTransititonTask(); + return; + case "crystal": + return; + case "special_crystal": + return; + } + if (click.StartsWith("speed_challenge")) + { + HandleSpeedChallenge(click, status); + } + else if (SceneTransition.TransitionData.HasTransitionData(click)) + { + SceneTransition.TransitionData transitionData = new SceneTransition.TransitionData(click); + if (int.TryParse(status, out var result)) + { + transitionData.Status = result; + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SceneTransition.ChangeScene(transitionData, null); + } + } + + private static void OnClickOpenBrowser(string url) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + SystemText systemText = Data.SystemText; + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_GrayBtn); + dialogBase.SetButtonText(systemText.Get("Dia_Web_001_Button"), systemText.Get("Common_0005")); + dialogBase.SetText(systemText.Get("Common_0208")); + dialogBase.onPushButton1 = delegate + { + BrowserURL.Open(url); + }; + } + + protected void InitializeEventHandler(GameObject go, BannerInfo bannerInfo) + { + UITexture component = go.GetComponent(); + component.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(bannerInfo.ImageName, ResourcesManager.AssetLoadPathType.UiDownLoad, isfetch: true)); + component.depth = 5; + _ = Data.SystemText; + string click = bannerInfo.Click; + if (click == "dialog_info") + { + UIEventListener.Get(go).onClick = delegate + { + OnClickDialogInfo(bannerInfo); + }; + } + else if (click == "dialog") + { + UIEventListener.Get(go).onClick = delegate + { + OnClickDialog(bannerInfo); + }; + } + else if (click == "deck_intro_rotation") + { + UIEventListener.Get(go).onClick = delegate + { + OnClickDeckIntroduction(bannerInfo.Status, Format.Rotation); + }; + } + else if (click == "deck_intro_unlimited") + { + UIEventListener.Get(go).onClick = delegate + { + OnClickDeckIntroduction(bannerInfo.Status, Format.Unlimited); + }; + } + else + { + UIEventListener.Get(go).onClick = delegate + { + SceneChangeBySetting(click, bannerInfo.Status); + }; + } + } + + private static void HandleSpeedChallenge(string kind, string status) + { + SystemText systemText = Data.SystemText; + if (kind == "speed_challenge") + { + SceneChangeBySetting("mypage_battle", status); + return; + } + if (kind == "speed_challenge_clear") + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetTitleLabel(systemText.Get("SpeedChallenge_0001")); + dialogBase.SetSize(DialogBase.Size.M); + GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/Dialog/DialogSpeedChallenge")) as GameObject; + dialogBase.SetObj(gameObject); + DialogSpeedChallenge component = gameObject.GetComponent(); + string text = systemText.Get("SpeedChallenge_0003"); + if (Data.MyPage.data.SpeedChallengeInfo != null) + { + string arg = ConvertTime.ToLocal(Data.MyPage.data.SpeedChallengeInfo.Announce, ConvertTime.FORMAT.TIME_DATE_LONG_SPECIAL); + text = string.Format(text, arg); + } + component.SetText(text); + component.SetTexture("banner_000764"); + return; + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DialogBase dialogBase2 = UIManager.GetInstance().CreateDialogClose(); + dialogBase2.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase2.SetTitleLabel(systemText.Get("SpeedChallenge_0001")); + dialogBase2.SetSize(DialogBase.Size.M); + GameObject gameObject2 = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/Dialog/DialogSpeedChallengeResult")) as GameObject; + dialogBase2.SetObj(gameObject2); + DialogSpeedChallengeResult component2 = gameObject2.GetComponent(); + if (kind == "speed_challenge_lottery") + { + component2.SetRankText(systemText.Get("Mission_0055")); + } + else + { + component2.SetRankWithNumber(int.Parse(status)); + } + if (Data.MyPage.data.SpeedChallengeInfo == null) + { + return; + } + if (Data.MyPage.data.SpeedChallengeInfo.Message != null) + { + if (kind == "speed_challenge_lottery") + { + component2.SetText(Data.MyPage.data.SpeedChallengeInfo.Message); + } + else + { + component2.SetText(string.Format(Data.MyPage.data.SpeedChallengeInfo.Message, status)); + } + } + if (Data.MyPage.data.SpeedChallengeInfo.ApplyUrl != null) + { + component2.SetUrl(Data.MyPage.data.SpeedChallengeInfo.ApplyUrl); + } + } + + private static void OpenColosseumRound() + { + ColosseumEntryInfoTask task = new ColosseumEntryInfoTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, ColosseumEntryInfoConnectSuccess)); + } + + private static void ColosseumEntryInfoConnectSuccess(NetworkTask.ResultCode error) + { + bool flag = false; + if (Data.ArenaData.ColosseumData.IsTwoPickRule) + { + if (Data.ArenaData.ColosseumData.isJoin) + { + flag = true; + } + } + else if (Data.ArenaData.ColosseumData.isJoin && Data.ArenaData.ColosseumData.IsDeckEntry) + { + flag = true; + } + if (flag) + { + ChangeScene(UIManager.ViewScene.Colosseum); + return; + } + MyPageMenu.Instance.GoToColosseum(isColosseumTask: false); + MyPageMenu.Instance.ChangeMenu(3, isCutCardMotion: true); + } + + private static void OnClickCompetitionBanner() + { + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(new CompetitionCheckPeriodTask(), delegate + { + GoToCompetition(); + })); + } + + private static void GoToCompetition() + { + ArenaCompetition competitionData = Data.ArenaData.CompetitionData; + if (competitionData == null) + { + return; + } + if (competitionData.Rule == ArenaColosseum.eRule.TwoPick) + { + if (competitionData.IsCompletedTwoPickDeck > 0) + { + ChangeScene(UIManager.ViewScene.CompetitionLobby); + return; + } + if (competitionData.EntryStatus == ArenaCompetition.EntryStatusType.NotRegistDeck || competitionData.EntryStatus == ArenaCompetition.EntryStatusType.InBattle) + { + ChangeScene(UIManager.ViewScene.Competition2Pick); + return; + } + } + else if (competitionData.IsInFreeBattleRegistDeck) + { + ChangeScene(UIManager.ViewScene.CompetitionLobby); + return; + } + MyPageMenu.Instance.GoToCompetition(); + MyPageMenu.Instance.ChangeMenu(3, isCutCardMotion: true); + } + + private void OnClickDeckIntroduction(string status, Format format) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + int seriesId = int.Parse(status); + DeckIntroduction.Create(_deckIntroductionPrefab, MyPageMenu.Instance.HomeMenu.ContentsRoot, seriesId, format); + } + + private static void OnClickTreasureBoxCpDialog() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + TreasureBoxCpDialog.CreateDialog(); + } + + private static void OnClickIncentiveCampaign(int no) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + LotteryPage.ChangeSceneLotteryPage(no); + } + + private static void OnClickBingoEvent() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + BingoPage.ChangeSceneBingoPage(); + } + + private static void OnClickBeginnerMission() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ChangeScene(UIManager.ViewScene.BeginnerMission); + } + + private static void ChangeScene(UIManager.ViewScene scene) + { + if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Battle) + { + GameMgr.GetIns().GetBattleCtrl().BattleEnd(scene); + } + else + { + UIManager.GetInstance().ChangeViewScene(scene); + } + } + + private void OnClickDialogInfo(BannerInfo bannerInfo) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + List listBannerName = bannerInfo.ImagePaths; + List listImagePaths = new List(); + for (int i = 0; i < listBannerName.Count; i++) + { + listImagePaths.Add(Toolbox.ResourcesManager.GetAssetTypePath(listBannerName[i], ResourcesManager.AssetLoadPathType.UiDownLoadInfo)); + } + Toolbox.ResourcesManager.StartCoroutine_LoadAssetGroupAsync(listImagePaths, delegate + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("Common_0036")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetPanelDepth(0); + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate + { + Toolbox.ResourcesManager.RemoveAssetGroup(listImagePaths); + }); + BannerDialog bannerDialog = UnityEngine.Object.Instantiate(_prefabDialogMypageBanner); + dialogBase.SetObj(bannerDialog.gameObject); + List list = new List(); + for (int num = 0; num < listBannerName.Count; num++) + { + list.Add(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(listBannerName[num], ResourcesManager.AssetLoadPathType.UiDownLoadInfo, isfetch: true)) as Texture); + } + bannerDialog.Init(list, null, null); + }); + } + + private void OnClickDialog(BannerInfo bannerInfo) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + VoteDataTask voteDataTask = new VoteDataTask(); + int voteId = int.Parse(bannerInfo.Status); + voteDataTask.SetParameter(voteId); + StartCoroutine(Toolbox.NetworkManager.Connect(voteDataTask, delegate + { + DialogBase dialog = UIManager.GetInstance().CreateDialogClose(isSystem: true); + dialog.SetSize(DialogBase.Size.M); + dialog.SetTitleLabel(Data.VoteInfo.title_text); + dialog.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + dialog.SetFadeButtonEnabled(flag: true); + if (Data.VoteInfo.is_vote) + { + dialog.SetText(string.Format(Data.VoteInfo.after_content_text, Data.VoteInfo.vote_name)); + } + else + { + GameMgr.GetIns().GetPrefabMgr().Load("UI/layoutParts/Dialog/DialogWinnerPost"); + GameObject gameObject = GameMgr.GetIns().GetPrefabMgr().Get("UI/layoutParts/Dialog/DialogWinnerPost"); + GameObject gameObject2 = gameObject.GetComponent().objs[1]; + Action OnFinishPost = delegate + { + dialog.Close(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetPanelDepth(0); + dialogBase.SetTitleLabel(Data.VoteInfo.title_text); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetFadeButtonEnabled(flag: true); + dialogBase.SetText(Data.SystemText.Get("Dia_Vote_002")); + }; + gameObject = NGUITools.AddChild(dialog.gameObject, gameObject); + NguiObjs component = gameObject.GetComponent(); + GameObject gameObject3 = component.objs[0]; + component.labels[0].text = Data.VoteInfo.before_content_text; + foreach (KeyValuePair item in Data.VoteInfo.vote_target_list) + { + GameObject postButton = UnityEngine.Object.Instantiate(gameObject2); + NguiObjs component2 = postButton.GetComponent(); + postButton.transform.parent = gameObject3.transform; + postButton.transform.localScale = gameObject2.transform.localScale; + postButton.name = item.Key.ToString(); + component2.labels[0].text = item.Value; + postButton.gameObject.SetActive(value: true); + component2.buttons[0].onClick.Add(new EventDelegate(delegate + { + OnSelectPost(voteId, postButton, OnFinishPost); + })); + } + gameObject3.GetComponent().ResetPosition(); + } + })); + } + + private static void OnClickDialogText(string status) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetSize(DialogBase.Size.XL); + if (!(status == "netease")) + { + return; + } + dialogBase.SetTitleLabel(systemText.Get("Account_0111")); + dialogBase.SetText(systemText.Get("Account_0112")); + dialogBase.onPushButton1 = delegate + { + GetDataTranslateTask task = new GetDataTranslateTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + NtDataTranslateManager instance = NtDataTranslateManager.GetInstance(); + if (instance.isTranslate) + { + instance.ShowRebind(); + } + else + { + instance.HongKongMacaoUserConfirm(); + } + })); + }; + dialogBase.SetOnClickUrl(); + } + + private static void OnClickLegendCrystal(string status) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SpecialCrystalDialog.SetDefaultOpenPage(status); + SpecialCrystalDialog.Create(UIManager.GetInstance().LegendCrystalBuyDialogPrefab, null, null, null); + } + + private void OnSelectPost(int voteId, GameObject cardObject, Action callback) + { + int voteTargetId = int.Parse(cardObject.name); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetTitleLabel(Data.VoteInfo.title_text); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetFadeButtonEnabled(flag: true); + dialogBase.SetPanelDepth(2000); + dialogBase.SetText(string.Format(Data.SystemText.Get("Dia_Vote_001"), Data.VoteInfo.vote_target_list[voteTargetId])); + dialogBase.onPushButton1 = delegate + { + VoteTask voteTask = new VoteTask(); + voteTask.SetParameter(voteId, voteTargetId); + StartCoroutine(Toolbox.NetworkManager.Connect(voteTask, delegate + { + callback.Call(); + })); + }; + } + + private static void StartTransititonTask() + { + TransitionInfoTask task = new TransitionInfoTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + switch (task.Status) + { + case 0: + CreateTransitionDialog(); + break; + case 1: + CreateDeleteCodeDialog(); + break; + case 2: + CreateCheckTransitionDialog(); + break; + } + })); + } + + private static void CreateTransitionDialog() + { + TransitionDialog.Create(CompletePublishCode); + } + + private static void CompletePublishCode() + { + TransitionPublishTask task = new TransitionPublishTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + TransitionPublishDialog.Create(task.Password); + })); + } + + private static void CreateDeleteCodeDialog() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + SystemText systemText = Data.SystemText; + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("BeyondHandover_0013"), systemText.Get("Common_0005")); + dialogBase.SetTitleLabel(systemText.Get("BeyondHandover_0001")); + dialogBase.SetText(systemText.Get("BeyondHandover_0010")); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetButtonDelegate(new EventDelegate(delegate + { + DeleteCode(); + })); + } + + private static void DeleteCode() + { + TransitionDeleteTask task = new TransitionDeleteTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + CreateTransitionDialog(); + })); + } + + private static void CreateCheckTransitionDialog() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + SystemText systemText = Data.SystemText; + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetTitleLabel(systemText.Get("BeyondHandover_0001")); + dialogBase.SetText(systemText.Get("BeyondHandover_0011")); + dialogBase.SetSize(DialogBase.Size.M); + } + + protected void OnDestroy() + { + if (_loadAssetList != null && _loadAssetList.Count != 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadAssetList); + } + if (_createCoroutine != null) + { + UIManager.GetInstance().StopCoroutine(_createCoroutine); + } + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageBattleCampaign.cs b/SVSim.BattleEngine/Engine/MyPageBattleCampaign.cs new file mode 100644 index 0000000..2085daa --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageBattleCampaign.cs @@ -0,0 +1,105 @@ +using System.Collections; +using UnityEngine; +using Wizard; + +public class MyPageBattleCampaign : MonoBehaviour +{ + [SerializeField] + private UILabel _timeLabel; + + [SerializeField] + private GameObject _boxRoot; + + [SerializeField] + private UILabel _boxLabel; + + [SerializeField] + private UISprite _boxSprite; + + [SerializeField] + private UILabel _specialBoxLabel; + + [SerializeField] + private UISprite _specialBoxSprite; + + private const int SECONDS_PER_MINUTE = 60; + + private const string BOX_SPRITE_NAME = "box_campaign_"; + + private const int BOX_NONE_LABEL_WIDTH = 50; + + private const int BOX_LABEL_WIDTH = 150; + + private const float NORMAL_BOXROOT_ORIGIN_POSITION = -5.8f; + + private const float NORMAL_BOXROOT_POSITION = -90f; + + private float _updateTimer; + + public IEnumerator Init() + { + base.gameObject.SetActive(value: false); + while (Data.MyPage.data == null) + { + yield return null; + } + _specialBoxLabel.gameObject.SetActive(value: false); + _specialBoxSprite.gameObject.SetActive(value: false); + CampaignBattleWin campaignBattleWin = Data.MyPageNotifications.data.CampaignBattleWin; + if (campaignBattleWin.IsInSessionCampaign) + { + base.gameObject.SetActive(value: true); + _timeLabel.text = Data.SystemText.Get("MyPage_0048", ConvertTime.ToLocal(ConvertTime.UnixTimeToDateTime(campaignBattleWin.EndUnixTime))); + if (campaignBattleWin.BoxGrade == CampaignBattleWin.eBoxGrade.None) + { + _boxLabel.width = 50; + _boxLabel.text = Data.SystemText.Get("MyPage_0046", campaignBattleWin.GetBoxNum.ToString(), campaignBattleWin.MaxBoxNum.ToString()); + _boxSprite.spriteName = "box_campaign_00"; + if (campaignBattleWin.IsHaveSpecialWinReward && !campaignBattleWin.SpecialTreasureInfo.IsGotSpecialTreasureBox) + { + _boxRoot.transform.localPosition = new Vector3(-90f, _boxRoot.transform.localPosition.y, _boxRoot.transform.localPosition.z); + _specialBoxLabel.gameObject.SetActive(value: true); + _specialBoxSprite.gameObject.SetActive(value: true); + } + } + else + { + _boxLabel.width = 150; + _boxLabel.text = Data.SystemText.Get("MyPage_0047"); + _boxSprite.spriteName = "box_campaign_" + ((int)(campaignBattleWin.BoxGrade - 1)).ToString("00"); + } + } + else + { + base.gameObject.SetActive(value: false); + } + } + + public void RedrawAfterSpecialWinRewardOpened() + { + _ = Data.MyPageNotifications.data.CampaignBattleWin; + _specialBoxLabel.gameObject.SetActive(value: false); + _specialBoxSprite.gameObject.SetActive(value: false); + _boxRoot.transform.localPosition = new Vector3(-5.8f, _boxRoot.transform.localPosition.y, _boxRoot.transform.localPosition.z); + } + + private void Update() + { + if (Data.MyPage.data == null) + { + return; + } + _updateTimer -= Time.deltaTime; + if (_updateTimer < 0f) + { + CampaignBattleWin campaignBattleWin = Data.MyPageNotifications.data.CampaignBattleWin; + double num = Data.MyPage.data.ServerUnixTime + (double)Time.realtimeSinceStartup - (double)Data.MyPage.data.SinceTime; + _updateTimer = (float)(60.0 - num % 60.0); + if (num > (double)Data.MyPageNotifications.data.CampaignBattleWin.EndUnixTime) + { + campaignBattleWin.OnFinishCanpaignTime(); + base.gameObject.SetActive(value: false); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageCardDetail.cs b/SVSim.BattleEngine/Engine/MyPageCardDetail.cs new file mode 100644 index 0000000..2cc8dad --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageCardDetail.cs @@ -0,0 +1,157 @@ +using System; +using UnityEngine; +using Wizard; + +public class MyPageCardDetail : MonoBehaviour +{ + private const float POSITION_Y = -88f; + + private const float CARD_ROTATION = 100f; + + private const float CARD_ROTATION_MIN_X = -65f; + + private const float CARD_ROTATION_MAX_X = 35f; + + private const float CARD_ROTATION_MIN_Y = -50f; + + private const float CARD_ROTATION_MAX_Y = 50f; + + [SerializeField] + private GameObject prefabCardDetailWindow; + + [SerializeField] + private GameObject m_CardObj; + + [SerializeField] + private UIEventListener m_TouchEventListener; + + [SerializeField] + private UIEventListener _touchColliderBG; + + private bool m_IsDrag; + + private Vector3 m_CardViewPortPoint = Vector3.zero; + + public MyPageMenu MyPageMenuClass; + + private int _cardId; + + public SimpleCardDetail CardDetailWindow { get; private set; } + + public bool IsCardObjRotateTween { get; private set; } + + private void Start() + { + CardDetailWindow = NGUITools.AddChild(base.gameObject, prefabCardDetailWindow).GetComponent(); + CardDetailWindow.SetLocalOffset(Vector3.up * -88f); + CardDetailWindow.ActiveCraftPanel(isActive: false); + CardDetailWindow.ActiveCloseCollider(isActive: false); + SetTouchEvent(); + } + + private void Update() + { + if (IsCardObjRotateTween && m_CardObj.transform.localEulerAngles.magnitude < 3f) + { + ResetAngleCardObj(); + IsCardObjRotateTween = false; + } + } + + public void UpdateCardData(int cardId) + { + _cardId = cardId; + if (CardDetailWindow != null && CardDetailWindow.IsVisible) + { + CardDetailWindow.ChangeDetail(_cardId, CardMaster.CardMasterId.Default); + } + } + + public void ResetAngleCardObj() + { + iTween.Stop(m_CardObj); + m_CardObj.transform.localEulerAngles = Vector3.zero; + } + + private void SetTouchEvent() + { + UIEventListener touchColliderBG = _touchColliderBG; + touchColliderBG.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(touchColliderBG.onClick, new UIEventListener.VoidDelegate(OnClickBG)); + UIEventListener touchEventListener = m_TouchEventListener; + touchEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(touchEventListener.onClick, new UIEventListener.VoidDelegate(OnClick)); + UIEventListener touchEventListener2 = m_TouchEventListener; + touchEventListener2.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(touchEventListener2.onDrag, new UIEventListener.VectorDelegate(OnDrag)); + UIEventListener touchEventListener3 = m_TouchEventListener; + touchEventListener3.onDragStart = (UIEventListener.VoidDelegate)Delegate.Combine(touchEventListener3.onDragStart, new UIEventListener.VoidDelegate(OnDragStart)); + UIEventListener touchEventListener4 = m_TouchEventListener; + touchEventListener4.onDragEnd = (UIEventListener.VoidDelegate)Delegate.Combine(touchEventListener4.onDragEnd, new UIEventListener.VoidDelegate(OnDragEnd)); + } + + private void OnClickBG(GameObject gameObj) + { + if (CardDetailWindow.IsVisible) + { + CardDetailWindow.HideDetail(); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_INFO_CANCEL); + MyPageMenuClass.ShowBanner(); + } + } + + private void OnClick(GameObject gameObj) + { + if (CardDetailWindow.IsVisible) + { + CardDetailWindow.HideDetail(); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_INFO_CANCEL); + MyPageMenuClass.ShowBanner(); + } + else + { + CardDetailWindow.ChangeDetail(_cardId, CardMaster.CardMasterId.Default); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_INFO_SMALL); + MyPageMenuClass.HideBanner(); + } + } + + private void OnDrag(GameObject g, Vector2 delta) + { + if (m_IsDrag) + { + Vector3 vector = m_CardViewPortPoint - UICamera.currentCamera.ScreenToViewportPoint(UICamera.lastEventPosition); + Vector3 vector2 = new Vector3(0f - vector.y, vector.x, 0f) * 100f; + vector2 = new Vector3(Mathf.Clamp(vector2.x, -65f, 35f), Mathf.Clamp(vector2.y, -50f, 50f), 0f); + m_CardObj.transform.localEulerAngles = vector2; + } + } + + private void OnDragStart(GameObject gameObj) + { + iTween component = m_CardObj.GetComponent(); + if (null != component) + { + component.enabled = false; + } + m_CardViewPortPoint = UICamera.currentCamera.WorldToViewportPoint(m_CardObj.transform.position); + m_IsDrag = true; + } + + private void OnDragEnd(GameObject gameObj) + { + iTween component = m_CardObj.GetComponent(); + if (null != component) + { + component.enabled = true; + } + IsCardObjRotateTween = true; + iTween.RotateTo(m_CardObj, iTween.Hash("rotation", Vector3.zero, "islocal", true, "time", 0.5f)); + m_IsDrag = false; + } + + private void OnApplicationPause(bool paused) + { + if (!paused) + { + ResetAngleCardObj(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageCardPanel.cs b/SVSim.BattleEngine/Engine/MyPageCardPanel.cs new file mode 100644 index 0000000..d340fb5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageCardPanel.cs @@ -0,0 +1,156 @@ +using System.Collections; +using Cute; +using UnityEngine; +using Wizard; + +public class MyPageCardPanel : MonoBehaviour +{ + [SerializeField] + private UITexture _texture; + + [SerializeField] + private string _filePath; + + [SerializeField] + private UILabel _titleLabel; + + [SerializeField] + private GameObject _effect; + + [SerializeField] + private bool enableMaintenanceCheck; + + [SerializeField] + protected NetworkDefine.MAINTENANCE_TYPE maintenanceType; + + [SerializeField] + private NetworkDefine.MAINTENANCE_TYPE[] _maintenanceTypeList; + + private CardPanelMaintenancePlate _maintenancePlate; + + private Vector3? _savedPosition; + + public UITexture Texture => _texture; + + public string FilePath => _filePath; + + protected UILabel TitleLabel => _titleLabel; + + public int Index { get; set; } + + public bool EffectActive + { + set + { + if (_effect != null) + { + _effect.SetActive(value); + } + } + } + + public NetworkDefine.MAINTENANCE_TYPE MaintenanceType + { + get + { + return maintenanceType; + } + set + { + enableMaintenanceCheck = true; + maintenanceType = value; + } + } + + public virtual string GetResourcePath(bool isfetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(FilePath, ResourcesManager.AssetLoadPathType.CardMenu, isfetch); + } + + public void AttachCardPanelTexture() + { + Texture.mainTexture = Toolbox.ResourcesManager.LoadObject(GetResourcePath(isfetch: true)) as Texture; + } + + public virtual void CheckMaintenanceType() + { + if (!enableMaintenanceCheck) + { + return; + } + bool flag = false; + if (Data.MaintenanceCodeList.Contains(maintenanceType)) + { + flag = true; + } + if (_maintenanceTypeList != null && _maintenanceTypeList.Length != 0) + { + bool flag2 = true; + NetworkDefine.MAINTENANCE_TYPE[] maintenanceTypeList = _maintenanceTypeList; + foreach (NetworkDefine.MAINTENANCE_TYPE item in maintenanceTypeList) + { + if (!Data.MaintenanceCodeList.Contains(item)) + { + flag2 = false; + break; + } + } + if (flag2) + { + flag = true; + } + } + if (flag) + { + ShowMaintenance(); + } + else + { + HideMaintenance(); + } + } + + private void ShowMaintenance() + { + if (_maintenancePlate == null) + { + GameObject prefab = GameMgr.GetIns().GetPrefabMgr().Get("Prefab/UI/Menu/CardPanelMaintenancePlate"); + _maintenancePlate = NGUITools.AddChild(base.gameObject, prefab).GetComponent(); + } + _maintenancePlate.gameObject.SetActive(value: true); + UIManager.SetObjectToGrey(base.gameObject, b: true); + UIManager.SetObjectToGrey(_maintenancePlate.gameObject, b: false); + } + + private void HideMaintenance() + { + if (_maintenancePlate != null) + { + _maintenancePlate.gameObject.SetActive(value: false); + } + UIManager.SetObjectToGrey(base.gameObject, b: false); + } + + public void SetDisableForTutorial(bool isGrey) + { + UIManager.SetObjectToGrey(base.gameObject, isGrey); + } + + public Vector3 SavePosition() + { + _savedPosition = base.transform.localPosition; + return _savedPosition.Value; + } + + public void RestoreSavedPosition() + { + base.transform.localPosition = _savedPosition.Value; + } + + public IEnumerator DisablePanel(string text) + { + ShowMaintenance(); + yield return null; + _maintenancePlate.SetText(text); + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageCardPanelAnimation.cs b/SVSim.BattleEngine/Engine/MyPageCardPanelAnimation.cs new file mode 100644 index 0000000..8e3b7de --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageCardPanelAnimation.cs @@ -0,0 +1,301 @@ +using UnityEngine; + +public class MyPageCardPanelAnimation : MonoBehaviour +{ + public enum State + { + Start, + Move, + Color, + End + } + + private const float RANDOM_TIMER_RANGE = 0.3f; + + private const float ORIGINAL_POS_X = -22100f; + + private const float COLOR_TIME = 0.6f; + + private const float START_WAIT_TIMER = 0.05f; + + private static readonly float[] ANGLES_3 = new float[3] { 5f, 0f, -5f }; + + private static readonly float[] ANGLES_2 = new float[2] { 5f, -5f }; + + private static readonly float[] ANGLES_1 = new float[1]; + + private const float CARD_ORIGINAL_POS_X = -1000f; + + private const float CARD_DELAY_FACTOR = 0.03f; + + private const float CARD_TIME_MOTION = 0.0001f; + + private const float CARD_TIME_BASE = 0.2f; + + private const float CARD_TIME_FACTOR = 0.03f; + + private const float RANDOM_FACTOR = 5f; + + private const float ALPHA_FACTOR = 4f; + + private float ClickRotateTimeTotal; + + private float ClickRotateTime; + + private float ClickIndex; + + private bool _isCutCardMotion; + + private State _state = State.End; + + private float _timer; + + private float[] _randomTimer; + + private int[] _randomDir; + + private GameObject[] _cardPanel; + + private UIPanel[] _panel; + + private Vector3[] _defaultPosition; + + public bool IsCardMoving + { + get + { + if (!(ClickRotateTime > 0f)) + { + return _state != State.End; + } + return true; + } + } + + public void SetCardPanelList(GameObject[] list) + { + _cardPanel = new GameObject[list.Length]; + for (int i = 0; i < list.Length; i++) + { + _cardPanel[i] = list[i]; + MyPageCardPanel component = list[i].GetComponent(); + if (component != null) + { + component.Index = i; + } + } + InitRandom(); + InitializePanel(); + } + + public void UpdateCardPanelDefaultPosition(Vector3[] newPosition) + { + _defaultPosition = newPosition; + } + + public void PanelClear() + { + _panel = null; + } + + private void InitializePanel() + { + if (_panel == null) + { + _panel = new UIPanel[_cardPanel.Length]; + _defaultPosition = new Vector3[_cardPanel.Length]; + for (int i = 0; i < _cardPanel.Length; i++) + { + GameObject gameObject = _cardPanel[i]; + _panel[i] = gameObject.GetComponent(); + _defaultPosition[i] = gameObject.transform.localPosition; + } + } + } + + public void StartCardPanelAnimation(bool isCutCardMotion) + { + _state = State.Start; + _timer = 0f; + _isCutCardMotion = isCutCardMotion; + for (int i = 0; i < _cardPanel.Length; i++) + { + GameObject obj = _cardPanel[i]; + Vector3 localPosition = obj.transform.transform.localPosition; + localPosition.x = -22100f; + obj.transform.transform.localPosition = localPosition; + iTween.Stop(obj); + } + } + + public void SkipMoveAnimation() + { + _state = State.End; + ColorChange(isForceOpacity: true); + } + + private void Update() + { + if (_panel != null) + { + UpdateCard(); + } + } + + private void UpdateCard() + { + float[] array = (new float[4][] { null, ANGLES_1, ANGLES_2, ANGLES_3 })[_cardPanel.Length]; + if (_panel == null) + { + return; + } + switch (_state) + { + case State.Start: + { + ClickRotateTime = 0f; + _timer += Time.deltaTime; + for (int k = 0; k < _cardPanel.Length; k++) + { + GameObject obj = _cardPanel[k]; + Vector3 localPosition = obj.transform.transform.localPosition; + localPosition.x = -1000f; + localPosition.y = _defaultPosition[k].y; + obj.transform.transform.localPosition = localPosition; + obj.transform.transform.localEulerAngles = new Vector3(0f, 0f, array[k]); + } + for (int l = 0; l < _cardPanel.Length; l++) + { + _panel[l].alpha = 0f; + } + if (_timer >= 0.05f) + { + _state++; + } + break; + } + case State.Move: + { + for (int j = 0; j < _cardPanel.Length; j++) + { + float x = _defaultPosition[j].x; + iTween.MoveTo(_cardPanel[j], iTween.Hash("x", x, "time", _isCutCardMotion ? 0.0001f : (0.2f + (float)j * 0.03f), "delay", (float)j * 0.03f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + if (!_isCutCardMotion) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SWITCH_MENU_CARD); + } + _state++; + break; + } + case State.Color: + _timer += Time.deltaTime; + ColorChange(); + if (_timer >= 0.6f) + { + ColorChange(isForceOpacity: true); + _state++; + _timer = 0f; + InitRandom(); + } + break; + case State.End: + { + for (int i = 0; i < _cardPanel.Length; i++) + { + float num = 0f; + if ((float)i == ClickIndex && ClickRotateTime > 0f) + { + ClickRotateTime -= Time.deltaTime; + if (ClickRotateTime < 0f) + { + ClickRotateTime = 0f; + _state = State.End; + } + float num2 = (ClickRotateTimeTotal - ClickRotateTime) / ClickRotateTimeTotal; + num2 -= 1f; + num2 = 0f - (num2 * num2 * num2 * num2 - 1f); + num = 720f * num2; + } + _randomTimer[i] += Time.deltaTime; + if (_randomTimer[i] >= 0f) + { + _cardPanel[i].transform.localEulerAngles = new Vector3(0f, num + (float)_randomDir[i] * 5f * Mathf.Sin(_randomTimer[i] / 2f), array[i] + (float)_randomDir[i] * Mathf.Sin(_randomTimer[i])); + } + } + break; + } + } + } + + public void SetCardPanelAngle() + { + float[] array = (new float[4][] { null, ANGLES_1, ANGLES_2, ANGLES_3 })[_cardPanel.Length]; + for (int i = 0; i < _cardPanel.Length; i++) + { + _cardPanel[i].transform.transform.localEulerAngles = new Vector3(0f, 0f, array[i]); + } + } + + private void ColorChange(bool isForceOpacity = false) + { + if (_panel == null) + { + return; + } + for (int i = 0; i < _cardPanel.Length; i++) + { + if (_panel[i].alpha < 1f && !isForceOpacity) + { + float alpha = _panel[i].alpha; + alpha += Time.deltaTime * 4f; + if (alpha >= 1f) + { + alpha = 1f; + } + _panel[i].alpha = alpha; + } + else + { + _panel[i].alpha = 1f; + } + } + } + + public void OnClicked(int i, bool isPlaySe = true) + { + ClickRotateTimeTotal = 1f; + ClickRotateTime = ClickRotateTimeTotal; + ClickIndex = i; + if (isPlaySe) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_MENU_CARD); + } + } + + public void StopMove() + { + _state = State.End; + for (int i = 0; i < _cardPanel.Length; i++) + { + iTween.Stop(_cardPanel[i]); + if (_panel != null) + { + _panel[i].alpha = 1f; + } + } + InitRandom(); + ColorChange(isForceOpacity: true); + } + + private void InitRandom() + { + _randomDir = new int[_cardPanel.Length]; + _randomTimer = new float[_cardPanel.Length]; + for (int i = 0; i < _cardPanel.Length; i++) + { + _randomDir[i] = (((double)Random.value > 0.5) ? 1 : (-1)); + _randomTimer[i] = Random.Range(-0.3f, 0f); + } + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageCenterCard.cs b/SVSim.BattleEngine/Engine/MyPageCenterCard.cs new file mode 100644 index 0000000..ced619b --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageCenterCard.cs @@ -0,0 +1,766 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using LitJson; +using UnityEngine; +using Wizard; + +public class MyPageCenterCard : MonoBehaviour +{ + private const int CARD_VIEW_STATE_FIRST = 0; + + private const int CARD_VIEW_STATE_LOAD_WAIT = 1; + + private const int CARD_VIEW_STATE_CREATE_WAIT = 2; + + private const int CARD_VIEW_STATE_FINISH = 3; + + private readonly string CIRCLE_VIEW_LAYER_NAME = "MyPageCardList"; + + private const float CARD_ROTATION_ANIM_ANGLE_Y = 90f; + + private const float CARD_ROTATION_ANIM_TIME = 1.5f; + + private const float TRANSITIONAL_BGM_DELAY_TIME = 0.5f; + + private readonly Vector3 CARD_SCALE_NORMAL = new Vector3(80f, 80f, 64f); + + private readonly Vector3 CARD_SCALE_BIG = new Vector3(100f, 100f, 64f); + + public GameObject CardOyaObj; + + public GameObject CardDetailOya; + + [SerializeField] + private GameObject CardDetailTweenObj; + + [SerializeField] + private MyPageCardDetail m_CardDetail; + + private List _cardList; + + private List _cardListAssetPath = new List(); + + private CardBasePrm.CharaType _currentCardType = CardBasePrm.CharaType.MAX; + + private GameObject _followerCardObj; + + private GameObject _spellCardObj; + + private GameObject _amuletCardObj; + + private Transform _followerTransform; + + private Transform _spellCardTransform; + + private Transform _amuletCardTransform; + + private UILabel _followerCostLabel; + + private UILabel _followerLifeLabel; + + private UILabel _followerAtkLabel; + + private UILabel _followerNameLabel; + + private UILabel _spellNameLabel; + + private UILabel _spellCostLabel; + + private UILabel _amuletNameLabel; + + private UILabel _amuletCostLabel; + + private GameObject _followerRotationOnlyIcon; + + private GameObject _spellRotationOnlyIcon; + + private GameObject _amuletRotationOnlyIcon; + + private bool _isAfterEvo; + + [SerializeField] + private MyPageCharaMenu cardMoveManager; + + [SerializeField] + private GameObject CameraCard; + + private Vector3 _cameraCardPos; + + private bool _cameraPositionInitializeEnd; + + private int _cardViewState; + + private int _circleCardLayer; + + private IList _circleViewCardList = new List(); + + private int _scene = -1; + + private int _oldIndex; + + private int _previousCenterCardId = -1; + + private DeckGroupListData _deckGroupListData; + + public MyPageCardDetail CardDetail => m_CardDetail; + + public bool CardLoadFinish => _cardViewState >= 2; + + private void Awake() + { + _circleCardLayer = LayerMask.NameToLayer(CIRCLE_VIEW_LAYER_NAME); + } + + private void Start() + { + Vector3 localPosition = CardDetailTweenObj.transform.localPosition; + localPosition.y = 800f; + CardDetailTweenObj.transform.localPosition = localPosition; + SaveCameraFirstPosition(); + } + + private void SaveCameraFirstPosition() + { + if (!_cameraPositionInitializeEnd) + { + _cameraCardPos = CameraCard.transform.localPosition; + _cameraPositionInitializeEnd = true; + } + } + + private void initCard() + { + if (_cardList != null) + { + CardAllDelete(); + } + _cardList = UIManager.GetInstance().getCardListObjs(); + _isAfterEvo = false; + if (_followerCardObj != null) + { + UnityEngine.Object.Destroy(_followerCardObj.gameObject); + } + if (_spellCardObj != null) + { + UnityEngine.Object.Destroy(_spellCardObj.gameObject); + } + if (_amuletCardObj != null) + { + UnityEngine.Object.Destroy(_amuletCardObj.gameObject); + } + _scene = 0; + _previousCenterCardId = -1; + InstantiateCards(); + } + + private void InstantiateCards() + { + for (int i = 0; i < _cardList.Count; i++) + { + GameObject cardObj = _cardList[i].CardObj; + BoxCollider[] componentsInChildren = cardObj.GetComponentsInChildren(); + for (int j = 0; j < componentsInChildren.Length; j++) + { + componentsInChildren[j].enabled = false; + } + cardObj.transform.parent = CardOyaObj.transform; + cardObj.transform.localPosition = new Vector3(0f, 0f, 0f); + cardObj.transform.localPosition = MoveAngle(cardObj.transform.localPosition, i * (360 / _cardList.Count) + -90, 2650f); + cardObj.transform.LookAt(CardOyaObj.transform); + cardObj.SetActive(value: true); + } + SetCardTransform(); + _scene++; + } + + private IEnumerator DetailInit(int cardIndex = 0) + { + while (UIManager.GetInstance().getSelectCardListObjs() == null) + { + yield return null; + } + while (!CardLoadFinish) + { + yield return null; + } + while (MyPageMenu.Instance == null) + { + yield return null; + } + List selectCardListObjs = UIManager.GetInstance().getSelectCardListObjs(); + _cardListAssetPath.AddRange(Toolbox.ResourcesManager.CardListAssetPathList); + Toolbox.ResourcesManager.CardListAssetPathList.Clear(); + Material uIBaseSleeveTexture = UIManager.GetInstance().getUIBase_CardManager().GetUIBaseSleeveTexture(); + for (int i = 0; i < selectCardListObjs.Count; i++) + { + _currentCardType = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(selectCardListObjs[i].ids).CharType; + if (_amuletCardObj == null && (_currentCardType == CardBasePrm.CharaType.FIELD || _currentCardType == CardBasePrm.CharaType.CHANT_FIELD)) + { + CardInitAmulet(i, selectCardListObjs, uIBaseSleeveTexture); + } + if (_spellCardObj == null && _currentCardType == CardBasePrm.CharaType.SPELL) + { + CardInitSpell(i, selectCardListObjs, uIBaseSleeveTexture); + } + if (_followerCardObj == null && _currentCardType == CardBasePrm.CharaType.NORMAL) + { + CardInitFollower(i, selectCardListObjs, uIBaseSleeveTexture); + } + if (_followerCardObj != null && _spellCardObj != null && _amuletCardObj != null) + { + break; + } + } + for (int j = 0; j < selectCardListObjs.Count; j++) + { + UnityEngine.Object.Destroy(selectCardListObjs[j].CardObj); + selectCardListObjs[j] = null; + } + settingCard(cardIndex); + } + + private GameObject CardBaseInit(Transform card) + { + card.transform.localPosition = new Vector3(0f, 0f, 0f); + card.transform.localScale = new Vector3(510f, 510f, 200f); + card.transform.localEulerAngles = Vector3.zero; + Transform obj = card.Find("CardBase"); + obj.localPosition = Global.CARD_BASE_POS; + obj.localRotation = Quaternion.Euler(Global.CARD_BASE_ROT); + obj.localScale = new Vector3(1f, 1f, 1f); + Transform transform = card.Find("RotationOnlyIcon"); + if (transform != null) + { + return transform.gameObject; + } + GameObject prefab = Resources.Load("Prefab/CardDeco/RotationOnlyIcon") as GameObject; + return NGUITools.AddChild(card.gameObject, prefab); + } + + private void CardInitAmulet(int i, List detailCards, Material BaseTexture) + { + GameObject gameObject = null; + GameObject gameObject2 = null; + Material material = null; + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + Texture texture = null; + Texture texture2 = null; + _amuletCardObj = NGUITools.AddChild(CardDetailTweenObj, detailCards[i].CardObj.gameObject); + gameObject = _amuletCardObj; + gameObject.gameObject.SetActive(value: true); + gameObject.name = "AmmuletCard"; + _amuletCardTransform = gameObject.transform; + _amuletCostLabel = _amuletCardTransform.Find("Cost(Clone)/CostLabel").GetComponent(); + _amuletCardTransform.Find("Cost(Clone)").gameObject.SetActive(value: true); + _amuletNameLabel = _amuletCardTransform.Find("Name(Clone)/NameLabel").GetComponent(); + _amuletCardTransform.Find("Name(Clone)").gameObject.SetActive(value: true); + MeshRenderer component = _amuletCardTransform.Find("CardBase").GetComponent(); + component.material = BaseTexture; + component.material.SetFloat("_CullMode", 2f); + component.material.SetFloat("_ZWriteMode", 1f); + _amuletRotationOnlyIcon = CardBaseInit(_amuletCardTransform); + gameObject2 = _amuletCardTransform.Find("SpecularField").gameObject; + material = resourcesManager.LoadObject(resourcesManager.GetAssetTypePath("FieldCardFrameSpecularMat", ResourcesManager.AssetLoadPathType.CardFrameMaterialPlus, isfetch: true)); + texture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Card_Field_a_3", ResourcesManager.AssetLoadPathType.CardFrameTextureCommon, isfetch: true)); + texture2 = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Card_Field_n_3", ResourcesManager.AssetLoadPathType.CardFrameTextureCommon, isfetch: true)); + CardInitSpecular(gameObject2, material, texture, texture2); + } + + private void CardInitSpell(int i, List detailCards, Material BaseTexture) + { + GameObject gameObject = null; + GameObject gameObject2 = null; + Material material = null; + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + Texture texture = null; + Texture texture2 = null; + _spellCardObj = NGUITools.AddChild(CardDetailTweenObj, detailCards[i].CardObj.gameObject); + gameObject = _spellCardObj; + gameObject.gameObject.SetActive(value: true); + gameObject.name = "SpellCard"; + _spellCardTransform = gameObject.transform; + _spellCostLabel = _spellCardTransform.Find("Cost(Clone)/CostLabel").GetComponent(); + _spellCardTransform.Find("Cost(Clone)").gameObject.SetActive(value: true); + _spellNameLabel = _spellCardTransform.Find("Name(Clone)/NameLabel").GetComponent(); + _spellCardTransform.Find("Name(Clone)").gameObject.SetActive(value: true); + MeshRenderer component = _spellCardTransform.Find("CardBase").GetComponent(); + component.material = BaseTexture; + component.material.SetFloat("_CullMode", 2f); + component.material.SetFloat("_ZWriteMode", 1f); + _spellRotationOnlyIcon = CardBaseInit(_spellCardTransform); + gameObject2 = _spellCardTransform.Find("SpecularSpell").gameObject; + material = resourcesManager.LoadObject(resourcesManager.GetAssetTypePath("SpellCardFrameSpecularMat", ResourcesManager.AssetLoadPathType.CardFrameMaterialPlus, isfetch: true)); + texture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Card_Spell_a_3", ResourcesManager.AssetLoadPathType.CardFrameTextureCommon, isfetch: true)); + texture2 = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Card_Spell_n_3", ResourcesManager.AssetLoadPathType.CardFrameTextureCommon, isfetch: true)); + CardInitSpecular(gameObject2, material, texture, texture2); + } + + private void CardInitFollower(int i, List detailCards, Material BaseTexture) + { + GameObject gameObject = null; + GameObject gameObject2 = null; + Material material = null; + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + Texture texture = null; + Texture texture2 = null; + _followerCardObj = NGUITools.AddChild(CardDetailTweenObj, detailCards[i].CardObj.gameObject); + gameObject = _followerCardObj; + gameObject.gameObject.SetActive(value: true); + gameObject.name = "FollowerCard"; + _followerTransform = gameObject.transform; + _followerAtkLabel = _followerTransform.Find("Atk(Clone)/AtkLabel").GetComponent(); + _followerAtkLabel.gameObject.SetActive(value: true); + _followerTransform.Find("Atk(Clone)").gameObject.SetActive(value: true); + _followerLifeLabel = _followerTransform.Find("Life(Clone)/LifeLabel").GetComponent(); + _followerTransform.Find("Life(Clone)").gameObject.SetActive(value: true); + _followerCostLabel = _followerTransform.Find("Cost(Clone)/CostLabel").GetComponent(); + _followerTransform.Find("Cost(Clone)").gameObject.SetActive(value: true); + _followerNameLabel = _followerTransform.Find("Name(Clone)/NameLabel").GetComponent(); + _followerTransform.Find("Name(Clone)").gameObject.SetActive(value: true); + MeshRenderer component = _followerTransform.Find("CardBase").GetComponent(); + component.material = BaseTexture; + component.material.SetFloat("_CullMode", 2f); + component.material.SetFloat("_ZWriteMode", 1f); + _followerRotationOnlyIcon = CardBaseInit(_followerTransform); + gameObject2 = _followerTransform.Find("SpecularUnit").gameObject; + material = resourcesManager.LoadObject(resourcesManager.GetAssetTypePath("UnitCardFrameSpecularMat", ResourcesManager.AssetLoadPathType.CardFrameMaterialPlus, isfetch: true)); + texture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Card_Unit_a_4", ResourcesManager.AssetLoadPathType.CardFrameTextureCommon, isfetch: true)); + texture2 = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Card_Unit_n_4", ResourcesManager.AssetLoadPathType.CardFrameTextureCommon, isfetch: true)); + CardInitSpecular(gameObject2, material, texture, texture2); + } + + private void CardInitSpecular(GameObject specularObj, Material specularMaterial, Texture specularTexture0, Texture specularTexture1) + { + if (specularObj != null) + { + specularObj.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); + specularMaterial.shader = Shader.Find(specularMaterial.shader.name); + specularObj.GetComponent().material = specularMaterial; + specularObj.GetComponent().material.SetTexture("_AOREFSPEC", specularTexture0); + specularObj.GetComponent().material.SetTexture("_BumpMap", specularTexture1); + specularObj.SetActive(value: true); + specularObj.layer = 18; + } + } + + public bool canMyPageCardMove() + { + if (_followerCardObj == null && _spellCardObj == null && _amuletCardObj == null) + { + return false; + } + return true; + } + + public void UpdateSelectCard() + { + if (_scene == 1) + { + int nowSelIndex = cardMoveManager.getNowSelIndex(); + if (nowSelIndex > -1 && _oldIndex != nowSelIndex) + { + bool forceGraphicChange = IsAfterEvolution(_oldIndex); + _oldIndex = nowSelIndex; + settingCard(nowSelIndex, forceGraphicChange); + } + } + } + + private void settingCard(int nowIndex, bool forceGraphicChange = false) + { + if (nowIndex >= _cardList.Count) + { + return; + } + int ids = _cardList[nowIndex].ids; + if (_previousCenterCardId == ids && !forceGraphicChange) + { + return; + } + _previousCenterCardId = ids; + CardParameter cardParameterFromId = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(ids); + CardDetail.UpdateCardData(cardParameterFromId.NormalCardId); + _currentCardType = cardParameterFromId.CharType; + if (_currentCardType == CardBasePrm.CharaType.NORMAL) + { + _isAfterEvo = false; + _followerAtkLabel.text = _cardList[nowIndex].Atks; + _followerLifeLabel.text = _cardList[nowIndex].lifes; + _followerCostLabel.text = _cardList[nowIndex].Cost; + _followerNameLabel.text = _cardList[nowIndex].Names; + Global.SetRepositionNameLabel(_followerNameLabel, _cardList[nowIndex].Names, is2D: false); + _followerCardObj.gameObject.SetActive(value: false); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(_followerAtkLabel, _cardList[nowIndex].isPremiere); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(_followerCostLabel, _cardList[nowIndex].isPremiere); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(_followerLifeLabel, _cardList[nowIndex].isPremiere); + UIManager.GetInstance().getUIBase_CardManager().SetNameLabelStyle(_followerNameLabel, _cardList[nowIndex].isPremiere); + _followerCardObj.gameObject.SetActive(value: true); + if (_spellCardObj != null) + { + _spellCardObj.gameObject.SetActive(value: false); + } + if (_amuletCardObj != null) + { + _amuletCardObj.gameObject.SetActive(value: false); + } + _followerRotationOnlyIcon.SetActive(cardParameterFromId.IsResurgentCard); + } + else if (_currentCardType == CardBasePrm.CharaType.SPELL) + { + _spellNameLabel.text = _cardList[nowIndex].Names; + Global.SetRepositionNameLabel(_spellNameLabel, _cardList[nowIndex].Names, is2D: false); + _spellCostLabel.text = _cardList[nowIndex].Cost; + _spellCardObj.gameObject.SetActive(value: false); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(_spellCostLabel, _cardList[nowIndex].isPremiere); + UIManager.GetInstance().getUIBase_CardManager().SetNameLabelStyle(_spellNameLabel, _cardList[nowIndex].isPremiere); + _spellCardObj.gameObject.SetActive(value: true); + if (_followerCardObj != null) + { + _followerCardObj.gameObject.SetActive(value: false); + } + if (_amuletCardObj != null) + { + _amuletCardObj.gameObject.SetActive(value: false); + } + _spellRotationOnlyIcon.SetActive(cardParameterFromId.IsResurgentCard); + } + else if (_currentCardType == CardBasePrm.CharaType.FIELD || _currentCardType == CardBasePrm.CharaType.CHANT_FIELD) + { + _amuletNameLabel.text = _cardList[nowIndex].Names; + Global.SetRepositionNameLabel(_amuletNameLabel, _cardList[nowIndex].Names, is2D: false); + _amuletCostLabel.text = _cardList[nowIndex].Cost; + _amuletCardObj.gameObject.SetActive(value: false); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(_amuletCostLabel, _cardList[nowIndex].isPremiere); + UIManager.GetInstance().getUIBase_CardManager().SetNameLabelStyle(_amuletNameLabel, _cardList[nowIndex].isPremiere); + _amuletCardObj.gameObject.SetActive(value: true); + if (_followerCardObj != null) + { + _followerCardObj.gameObject.SetActive(value: false); + } + if (_spellCardObj != null) + { + _spellCardObj.gameObject.SetActive(value: false); + } + _amuletRotationOnlyIcon.SetActive(cardParameterFromId.IsResurgentCard); + } + Transform transform = _cardList[nowIndex].CardObj.transform; + GameObject gameObject = null; + LODGroup lODGroup = null; + LODGroup lODGroup2 = null; + switch (_currentCardType) + { + case CardBasePrm.CharaType.FIELD: + case CardBasePrm.CharaType.CHANT_FIELD: + gameObject = _amuletCardObj.gameObject; + lODGroup = transform.GetComponent(); + lODGroup2 = _amuletCardTransform.GetComponent(); + break; + case CardBasePrm.CharaType.NORMAL: + gameObject = _followerCardObj.gameObject; + lODGroup = transform.GetComponent(); + lODGroup2 = _followerTransform.GetComponent(); + break; + case CardBasePrm.CharaType.SPELL: + gameObject = _spellCardObj.gameObject; + lODGroup = transform.GetComponent(); + lODGroup2 = _spellCardTransform.GetComponent(); + break; + } + LOD[] lODs = lODGroup2.GetLODs(); + LOD[] lODs2 = lODGroup.GetLODs(); + int num = lODs.Length; + for (int i = 0; i < num; i++) + { + LOD lOD = lODs[i]; + LOD lOD2 = lODs2[i]; + lOD.renderers[0].sharedMaterials = lOD2.renderers[0].sharedMaterials; + } + gameObject.transform.localPosition = Vector3.zero; + } + + public void SetCardTransform() + { + for (int i = 0; i < _cardList.Count; i++) + { + float num = ((!(_cardList[i].CardObj.transform.position.z < -7.3f)) ? 0f : MotionUtils.GetEase(Mathf.Abs(_cardList[i].CardObj.transform.position.z + 7.3f), MotionUtils.EaseType.easeInExpo)); + _cardList[i].CardObj.transform.localPosition = new Vector3(_cardList[i].CardObj.transform.localPosition.x, 100f * num, _cardList[i].CardObj.transform.localPosition.z); + _cardList[i].CardObj.transform.localScale = CARD_SCALE_NORMAL + (CARD_SCALE_BIG - CARD_SCALE_NORMAL) * num; + } + } + + public void PlayCardRotationAnime(int index, bool isRightRotate) + { + StartCoroutine(RunCardRotationAnime(index, isRightRotate)); + } + + private IEnumerator RunCardRotationAnime(int index, bool isRightRotate) + { + CardDetail.ResetAngleCardObj(); + yield return null; + if (isRightRotate) + { + CardDetailTweenObj.transform.rotation = Quaternion.Euler(new Vector3(CardDetailTweenObj.transform.rotation.x, -90f, CardDetailTweenObj.transform.rotation.z)); + iTween.RotateTo(CardDetailTweenObj.gameObject, iTween.Hash("y", 0f, "time", 1.5f, "easetype", iTween.EaseType.easeOutExpo)); + } + else + { + CardDetailTweenObj.transform.rotation = Quaternion.Euler(new Vector3(CardDetailTweenObj.transform.rotation.x, 90f, CardDetailTweenObj.transform.rotation.z)); + iTween.RotateTo(CardDetailTweenObj.gameObject, iTween.Hash("y", 0f, "time", 1.5f, "easetype", iTween.EaseType.easeOutExpo)); + } + } + + public void ChangeEvoDisplay(int index) + { + if (isEvo(index) && index < _cardList.Count && index > -1) + { + LOD[] lODs = _followerTransform.GetComponent().GetLODs(); + Material[] materials = lODs[0].renderers[0].materials; + CardParameter cardParameterFromId = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(_cardList[index].ids); + if (!_isAfterEvo) + { + _isAfterEvo = true; + _followerCostLabel.text = _cardList[index].Evo_Costs; + _followerLifeLabel.text = _cardList[index].Evo_lifes; + _followerAtkLabel.text = _cardList[index].Evo_Atks; + _followerNameLabel.text = _cardList[index].Evo_Names; + materials[1] = Toolbox.ResourcesManager.FindCardMaterial(cardParameterFromId.ResourceCardId, ResourcesManager.AssetLoadPathType.UnitCardMaterial, isEvol: true); + } + else + { + _isAfterEvo = false; + _followerCostLabel.text = _cardList[index].Cost; + _followerLifeLabel.text = _cardList[index].lifes; + _followerAtkLabel.text = _cardList[index].Atks; + _followerNameLabel.text = _cardList[index].Names; + materials[1] = Toolbox.ResourcesManager.FindCardMaterial(cardParameterFromId.ResourceCardId, ResourcesManager.AssetLoadPathType.UnitCardMaterial); + } + materials[2] = CardCreatorBase.GetSharedClassIconMaterial(_cardList[index].clan); + LOD[] array = lODs; + for (int i = 0; i < array.Length; i++) + { + Renderer renderer = array[i].renderers[0]; + materials[0] = renderer.materials[0]; + renderer.sharedMaterials = materials; + } + } + } + + public bool IsAfterEvolution(int index) + { + return _isAfterEvo; + } + + public bool isEvo(int index) + { + if (_cardList == null || index >= _cardList.Count || index <= -1) + { + return false; + } + return _cardList[index].EvolOk; + } + + private Vector3 MoveAngle(Vector3 my, float angle, float speed) + { + float num = Mathf.Cos(angle * (float)Math.PI / 180f) * speed; + float num2 = Mathf.Sin(angle * (float)Math.PI / 180f) * speed; + return new Vector3(my.x + num, my.y, my.z + num2); + } + + public List getCardList() + { + return _cardList; + } + + private void OnDestroy() + { + CardAllDelete(); + } + + private void CardAllDelete() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_cardListAssetPath); + _cardListAssetPath.Clear(); + foreach (UIBase_CardManager.CardObjData card in _cardList) + { + UnityEngine.Object.Destroy(card.CardObj); + } + for (int i = 0; i < _cardList.Count; i++) + { + _cardList[i] = null; + } + _cardList = new List(); + UnityEngine.Object.Destroy(_followerCardObj); + _followerCardObj = null; + UnityEngine.Object.Destroy(_spellCardObj); + _spellCardObj = null; + } + + public void MoveInCameraCard() + { + SaveCameraFirstPosition(); + CameraCard.transform.localPosition = _cameraCardPos + Vector3.up * 2000f; + iTween.MoveTo(CameraCard.gameObject, iTween.Hash("position", _cameraCardPos, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + private DeckData GetLastBattleDeck(out Format format) + { + bool num = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.LAST_BATTLE_IS_DEFAULT_DECK_FOR_MYPAGE); + int lastDeckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_ID_FOR_MYPAGE); + Format format2 = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_FORMAT_FOR_MYPAGE); + if (format2 == Format.Max || format2 == Format.Hof || format2 == Format.Avatar) + { + format2 = Format.Unlimited; + } + if (num) + { + format = Format.Max; + DeckData deckData = _deckGroupListData.GetDeckListByAttribute(DeckAttributeType.DefaultDeck).FirstOrDefault((DeckData deck) => deck.GetDeckID() == lastDeckId); + if (deckData != null) + { + return deckData; + } + int classOffsetId = lastDeckId + 90; + deckData = _deckGroupListData.GetDeckListByAttribute(DeckAttributeType.DefaultDeck).FirstOrDefault((DeckData deck) => deck.GetDeckID() == classOffsetId); + if (deckData != null) + { + return deckData; + } + } + else + { + format = format2; + List list = JsonMapper.ToObject>(PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_CARD_LIST)); + long result; + bool flag = long.TryParse(PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_SLEEVE_ID), out result); + bool flag2 = false; + if (list != null && list.Count == 40 && flag) + { + flag2 = true; + } + DeckData deckData2 = _deckGroupListData.GetDeckListByAttribute(DeckAttributeType.CustomDeck, format2).FirstOrDefault((DeckData deck) => deck.GetDeckID() == lastDeckId); + if (deckData2 != null && deckData2.IsDisplayable()) + { + if (flag2) + { + long.TryParse(PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_SLEEVE_ID), out result); + list = UIManager.GetInstance().getUIBase_CardManager().SortIDList(list, CardMaster.CardMasterId.Default); + deckData2.SetCardIdList(list); + deckData2.SetDeckSleeveID(result); + deckData2.SetDeckIsComplete(isComplete: true); + } + return deckData2; + } + } + return null; + } + + public int GetDetailCardCount() + { + return _circleViewCardList.Count; + } + + private void Update() + { + switch (_cardViewState) + { + case 0: + { + UIManager.GetInstance().CreatFadeBlack(); + if (!UIManager.GetInstance().IsWizardSetupFinish() || _deckGroupListData == null) + { + break; + } + UIManager.GetInstance().Force_Increment_LockCountChangeView(); + _cardViewState++; + DeckData lastBattleDeck = GetLastBattleDeck(out var format); + if (lastBattleDeck != null) + { + UIManager.GetInstance().MyPageHomeCardLoadDeck(base.gameObject, lastBattleDeck, _circleCardLayer); + break; + } + lastBattleDeck = _deckGroupListData.GetDeckListByAttribute(DeckAttributeType.CustomDeck, format).FirstOrDefault(); + if (lastBattleDeck != null && lastBattleDeck.IsDisplayable()) + { + UIManager.GetInstance().MyPageHomeCardLoadDeck(base.gameObject, lastBattleDeck, _circleCardLayer); + } + else + { + UIManager.GetInstance().MyPageHomeCardLoadDeck(base.gameObject, _deckGroupListData.GetDeckListByAttribute(DeckAttributeType.DefaultDeck).First(), _circleCardLayer); + } + break; + } + case 1: + { + if (!UIManager.GetInstance().isCardCreatEnd()) + { + break; + } + _cardViewState++; + initCard(); + List cardListObjs = UIManager.GetInstance().getCardListObjs(); + _circleViewCardList = new List(); + bool flag = false; + bool flag2 = false; + bool flag3 = false; + for (int i = 0; i < cardListObjs.Count; i++) + { + CardBasePrm.CharaType charType = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(cardListObjs[i].ids).CharType; + if (!flag && charType == CardBasePrm.CharaType.SPELL) + { + _circleViewCardList.Add(cardListObjs[i].ids); + flag = true; + } + if (!flag2 && charType == CardBasePrm.CharaType.NORMAL) + { + _circleViewCardList.Add(cardListObjs[i].ids); + flag2 = true; + } + if (!flag3 && (charType == CardBasePrm.CharaType.FIELD || charType == CardBasePrm.CharaType.CHANT_FIELD)) + { + _circleViewCardList.Add(cardListObjs[i].ids); + flag3 = true; + } + if (flag2 && flag && flag3) + { + break; + } + } + UIManager.GetInstance().CardLoadSelect(base.gameObject, _circleViewCardList, _circleCardLayer, is2D: false, null, isDefaultSleeve: true); + break; + } + case 2: + if (UIManager.GetInstance().isCardCreatEnd()) + { + _cardViewState++; + UIManager.GetInstance().Force_Decrement_LockCountChangeView(); + StartCoroutine(DetailInit(cardMoveManager.getNowSelIndex())); + } + break; + } + } + + public void LoadDeckInfo(Action onFinish = null) + { + _deckGroupListData = null; + DeckInfoTask task = new DeckInfoTask(); + task.SetParameter(Format.All); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + _deckGroupListData = task.DeckGroupListData; + onFinish.Call(); + })); + } + + public void ReloadCardCircle() + { + if (_cardViewState == 3) + { + LoadDeckInfo(); + CardAllDelete(); + _cardViewState = 0; + } + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageCharaMenu.cs b/SVSim.BattleEngine/Engine/MyPageCharaMenu.cs new file mode 100644 index 0000000..cf6f92b --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageCharaMenu.cs @@ -0,0 +1,370 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Wizard; + +public class MyPageCharaMenu : MonoBehaviour +{ + private struct DragInfo + { + public float time; + + public float posX; + + public DragInfo(float time, float posX) + { + this.time = time; + this.posX = posX; + } + } + + private readonly Vector3 RIGHT_BASE_NO_CUSTOM_BG_POSITION = new Vector3(505f, 0f, -50f); + + [SerializeField] + private UIButton sinkaButton; + + [SerializeField] + private UILabel labelSinkaButton; + + [SerializeField] + private UITexture originalTex; + + [SerializeField] + private GameObject texBase; + + private UITexture[] caharaTex; + + [SerializeField] + private GameObject _rightBase; + + private Vector3 _rightBaseDefaultPosition; + + private bool _isFirstCallOnEnable = true; + + [SerializeField] + private MyPageCenterCard cardManager; + + [SerializeField] + private GameObject CardMainObj; + + [SerializeField] + private UIScrollView scroll; + + [SerializeField] + private GameObject scrollColliderObj; + + [SerializeField] + private UICenterOnChild scrollCenterOnChild; + + private const float SCROLL_X_SIZE = 100f; + + private float _beforeCircleAngle; + + [SerializeField] + private float InitialSpeed = 22f; + + [SerializeField] + private float DecelerationBase = 3.5f; + + [SerializeField] + private float DecelerationAdd = 10f; + + [SerializeField] + private float DragSpeed = 2.1f; + + [SerializeField] + private float DragSpeed2 = 0.1f; + + private bool _isClockwise; + + private float _currentSpeed; + + private float _currentDeceleration; + + private bool _isOnEnable; + + private IList _dragInfoList; + + private int _currentIndex; + + private int _oldIndex = -1; + + private float _soundTimer; + + private bool _isFirstUpdate = true; + + private const string LABEL_BUTTON_EVO_TEXT = "Card_0030"; + + private const string LABEL_BUTTON_RETURN_TEXT = "Card_0067"; + + public bool IsForceActive { get; set; } + + public UIButton EvolutionButton => sinkaButton; + + private void Start() + { + caharaTex = new UITexture[40]; + for (int i = 0; i < 40; i++) + { + caharaTex[i] = UnityEngine.Object.Instantiate(originalTex); + caharaTex[i].transform.parent = texBase.transform; + caharaTex[i].transform.localScale = new Vector3(0.35f, 0.35f, 1f); + caharaTex[i].transform.transform.localPosition = new Vector3((float)i * 100f, 0f, 0f); + caharaTex[i].gameObject.name = i.ToString(); + } + originalTex.gameObject.SetActive(value: false); + LoadCenterCardIndex(); + sinkaButton.onClick.Clear(); + sinkaButton.onClick.Add(new EventDelegate(delegate + { + if (!cardManager.CardDetail.IsCardObjRotateTween) + { + cardManager.ChangeEvoDisplay(_currentIndex); + cardManager.PlayCardRotationAnime(_currentIndex, cardManager.IsAfterEvolution(_currentIndex)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_MYPAGE_EVOLVE); + GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_MYPAGE_EVO_1); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_MYPAGE_EVO_1, new Vector3(0f, 0.3f, 0f)); + ChangeStateSinkaButton(_currentIndex); + } + })); + ChangeStateSinkaButton(_currentIndex); + if (_dragInfoList == null) + { + _dragInfoList = new List(); + } + UIEventListener uIEventListener = UIEventListener.Get(scrollColliderObj); + uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate + { + _currentSpeed = 0f; + }); + UIEventListener uIEventListener2 = UIEventListener.Get(scrollColliderObj); + uIEventListener2.onDragStart = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener2.onDragStart, (UIEventListener.VoidDelegate)delegate + { + _dragInfoList.Clear(); + _dragInfoList.Add(new DragInfo(Time.time, GetLastTouchPos().x)); + }); + UIEventListener uIEventListener3 = UIEventListener.Get(scrollColliderObj); + uIEventListener3.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener3.onDrag, (UIEventListener.VectorDelegate)delegate(GameObject g, Vector2 delta) + { + if (_isClockwise == delta.x < 0f) + { + _dragInfoList.Add(new DragInfo(Time.time, GetLastTouchPos().x)); + } + else + { + _currentSpeed = 0f; + _isClockwise = !_isClockwise; + _dragInfoList.Clear(); + _dragInfoList.Add(new DragInfo(Time.time, GetLastTouchPos().x)); + } + }); + UIEventListener uIEventListener4 = UIEventListener.Get(scrollColliderObj); + uIEventListener4.onDragEnd = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener4.onDragEnd, (UIEventListener.VoidDelegate)delegate + { + _dragInfoList.Add(new DragInfo(Time.time, GetLastTouchPos().x)); + int num = _dragInfoList.Count - 1; + _currentSpeed = 0f; + float num2 = Mathf.Abs(_dragInfoList[num].time - _dragInfoList[0].time); + if (!(num2 <= float.Epsilon)) + { + float num3 = Mathf.Abs(_dragInfoList[num].posX - _dragInfoList[0].posX); + if (!(num3 <= float.Epsilon)) + { + float num4 = num3 / num2; + if (!(num4 < DragSpeed)) + { + int num5 = 2; + if (num >= num5) + { + num2 = Mathf.Abs(_dragInfoList[num].time - _dragInfoList[num - num5].time); + if (num2 <= float.Epsilon) + { + return; + } + num3 = Mathf.Abs(_dragInfoList[num].posX - _dragInfoList[num - num5].posX); + if (num3 <= float.Epsilon) + { + return; + } + num4 = num3 / num2; + if (num4 < DragSpeed2) + { + return; + } + } + _currentSpeed = InitialSpeed * num4 * 0.1f; + _currentDeceleration = DecelerationBase; + } + } + } + }); + } + + private bool IsAbleUpdate() + { + if (!UIManager.GetInstance().getUIBase_CardManager().getCreateEndFlag()) + { + return false; + } + if (!MyPageMenu.Instance.IsCardLoadFinish) + { + return false; + } + if (!cardManager.canMyPageCardMove()) + { + return false; + } + return true; + } + + private void Update() + { + if (!IsAbleUpdate()) + { + return; + } + if (_isFirstUpdate) + { + _isFirstUpdate = false; + ScrollCenterOn(_currentIndex, 100f); + return; + } + if (_soundTimer > 0f) + { + _soundTimer -= Time.deltaTime; + } + if (_isOnEnable) + { + _isOnEnable = false; + ChangeStateSinkaButton(_currentIndex); + } + Vector3 localPosition = scroll.gameObject.transform.localPosition; + float num = -4000f; + float num2 = num / 360f; + float num3 = localPosition.x / num2; + float num4; + for (num4 = localPosition.x - 50f; num4 >= 0f; num4 += num) + { + } + while (num4 < num) + { + num4 -= num; + } + int num5 = (int)Mathf.Abs(num4 / 100f); + if (_oldIndex != num5) + { + if (!UIManager.GetInstance().isFading() && _soundTimer <= 0f) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_SCROLL); + _soundTimer = 0.1f; + } + _currentIndex = num5; + _oldIndex = _currentIndex; + cardManager.UpdateSelectCard(); + ChangeStateSinkaButton(_currentIndex); + GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_MYPAGE_EVO_1); + } + if (_beforeCircleAngle != num3) + { + _beforeCircleAngle = num3; + CardMainObj.transform.eulerAngles = new Vector3(0f, num3, 0f); + cardManager.SetCardTransform(); + } + if (_currentSpeed > 0f) + { + float deltaTime = Time.deltaTime; + _currentDeceleration += DecelerationAdd * deltaTime; + _currentSpeed -= _currentDeceleration * deltaTime; + if (_currentSpeed > 0f) + { + float num6 = _currentSpeed * deltaTime * (_isClockwise ? 1f : (-1f)); + num6 /= 10f; + scroll.Scroll(num6); + } + else + { + ScrollCenterOn(num5, 1f); + } + } + } + + private void ChangeStateSinkaButton(int index) + { + if (!cardManager.isEvo(index)) + { + sinkaButton.gameObject.SetActive(value: false); + return; + } + sinkaButton.gameObject.SetActive(value: true); + if (cardManager.IsAfterEvolution(index)) + { + labelSinkaButton.text = Data.SystemText.Get("Card_0067"); + } + else + { + labelSinkaButton.text = Data.SystemText.Get("Card_0030"); + } + } + + private void OnEnable() + { + if (_isFirstCallOnEnable) + { + _isFirstCallOnEnable = false; + _rightBaseDefaultPosition = _rightBase.transform.localPosition; + } + if (Data.Load.data.AcquiredMyPageBGList.Count == 0) + { + _rightBase.transform.localPosition = RIGHT_BASE_NO_CUSTOM_BG_POSITION; + } + else + { + _rightBase.transform.localPosition = _rightBaseDefaultPosition; + } + _currentSpeed = 0f; + _isOnEnable = true; + cardManager.CardDetail.ResetAngleCardObj(); + scrollColliderObj.SetActive(!IsForceActive); + } + + private void OnDisable() + { + if (!(cardManager.CardDetail.CardDetailWindow == null)) + { + cardManager.CardDetail.CardDetailWindow.HideDetail(); + } + } + + private void LoadCenterCardIndex() + { + _currentIndex = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.HOME_CENTER_CARD_INDEX); + } + + public void SaveCenterCardIndex() + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.HOME_CENTER_CARD_INDEX, _currentIndex); + } + + public int getNowSelIndex() + { + return _currentIndex; + } + + private Vector2 GetLastTouchPos() + { + return UICamera.currentCamera.ScreenToWorldPoint(UICamera.lastEventPosition); + } + + private void ScrollCenterOn(int index) + { + scrollCenterOnChild.CenterOn(caharaTex[index].transform); + } + + private void ScrollCenterOn(int index, float springStrength) + { + float springStrength2 = scrollCenterOnChild.springStrength; + scrollCenterOnChild.springStrength = springStrength; + scrollCenterOnChild.CenterOn(caharaTex[index].transform); + scrollCenterOnChild.springStrength = springStrength2; + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageHomeStatic.cs b/SVSim.BattleEngine/Engine/MyPageHomeStatic.cs new file mode 100644 index 0000000..bc3580a --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageHomeStatic.cs @@ -0,0 +1,88 @@ +using System; +using UnityEngine; + +public class MyPageHomeStatic : MonoBehaviour +{ + [SerializeField] + private MyPageCenterCard _centerCardMove; + + [SerializeField] + private MyPageCharaMenu _charaMenu; + + [SerializeField] + private MyPageCardDetail _cardDetail; + + [SerializeField] + private GameObject _contentsRoot; + + [SerializeField] + private MyPageMenu _myPageMenu; + + public bool CardLoadFinish => _centerCardMove.CardLoadFinish; + + public void SetActive(bool isActive) + { + _contentsRoot.SetActive(isActive); + } + + public void CenterCardCreateStart(Action onFinish) + { + _centerCardMove.LoadDeckInfo(onFinish); + } + + public void OnDestroy() + { + if (_charaMenu != null) + { + _charaMenu.SaveCenterCardIndex(); + } + } + + public void Show() + { + _contentsRoot.SetActive(value: true); + AspectCameraPerspective[] array = UnityEngine.Object.FindObjectsOfType(); + for (int i = 0; i < array.Length; i++) + { + array[i].UpdateFov(); + } + _centerCardMove.MoveInCameraCard(); + } + + public void StartCardUpAnimation() + { + _centerCardMove.MoveInCameraCard(); + } + + public void Hide() + { + _contentsRoot.SetActive(value: false); + } + + public int GetDetailCardCount() + { + return _centerCardMove.GetDetailCardCount(); + } + + public void Initialize() + { + _cardDetail.MyPageMenuClass = _myPageMenu; + } + + public void SetTutorialMode() + { + UIManager.SetObjectToGrey(_charaMenu.EvolutionButton.gameObject, b: true); + } + + public void FinishFirstTips() + { + bool activeSelf = _charaMenu.EvolutionButton.gameObject.activeSelf; + UIManager.SetObjectToGrey(_charaMenu.EvolutionButton.gameObject, b: false); + _charaMenu.EvolutionButton.gameObject.SetActive(activeSelf); + } + + public void ReloadCardCircle() + { + _centerCardMove.ReloadCardCircle(); + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageItem.cs b/SVSim.BattleEngine/Engine/MyPageItem.cs new file mode 100644 index 0000000..76d718b --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageItem.cs @@ -0,0 +1,314 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +public class MyPageItem : MonoBehaviour +{ + protected const float APPEAR_ANIMATION_DISTANCE_X = 1000f; + + protected const float APPEAR_ANIMATION_TIME = 0.3f; + + protected const float APPEAR_ANIMATION_DELAY = 0.1f; + + protected const float TWEEN_MOVE_TIME = 0.3f; + + protected const float TWEEN_DELAY_TIME = 0.1f; + + private const float CARD_PANEL_LEFT_X = -328f; + + [SerializeField] + private MyPageCardPanelAnimation _cardMove; + + [SerializeField] + private MyPageCardPanel[] _cardPanelList; + + private MyPageMenu _parent; + + private Dictionary _defaultPosition = new Dictionary(); + + private bool _isAttachAtlasEnd; + + private bool cardAnimationInitialized; + + public MyPageCardPanel[] CardPanelList => _cardPanelList; + + protected bool IsCardMoving + { + get + { + if (_cardMove != null) + { + return _cardMove.IsCardMoving; + } + return false; + } + } + + public TopBar TopBar => _parent.TopBar; + + protected MyPageCardPanelAnimation CardAnimation => _cardMove; + + protected MyPageMenu Parent => _parent; + + public bool IsEnableFooterCurrentMenu { get; set; } + + public void SetCardPanelList(MyPageCardPanel[] myPageCardPanels) + { + _cardPanelList = myPageCardPanels; + } + + public virtual void Initialize(MyPageMenu parent) + { + _parent = parent; + SaveCardPanelDefaultPosition(); + if (cardAnimationInitialized) + { + return; + } + cardAnimationInitialized = true; + if (_cardMove != null) + { + GameObject[] array = new GameObject[_cardPanelList.Length]; + for (int i = 0; i < _cardPanelList.Length; i++) + { + array[i] = _cardPanelList[i].gameObject; + } + _cardMove.SetCardPanelList(array); + } + } + + public virtual void Show(bool skipCardAnimation = false) + { + base.gameObject.SetActive(value: true); + IsEnableFooterCurrentMenu = false; + } + + public virtual void Hide() + { + base.gameObject.SetActive(value: false); + } + + public virtual void OnClose() + { + } + + public void AttachAtlas() + { + if (!_isAttachAtlasEnd) + { + _isAttachAtlasEnd = true; + UIManager.GetInstance().AttachAtlas(base.gameObject); + } + } + + protected void StartCardPanelAppearAnimation() + { + if (_cardMove != null) + { + _cardMove.StartCardPanelAnimation(isCutCardMotion: false); + } + } + + protected void SaveCardPanelDefaultPosition() + { + int num = _cardPanelList.Length; + if (num > 0) + { + Vector3[] array = new Vector3[num]; + for (int i = 0; i < num; i++) + { + array[i] = _cardPanelList[i].SavePosition(); + } + CardAnimation.UpdateCardPanelDefaultPosition(array); + } + } + + protected void RestoreCardPanelPosition() + { + if (_cardPanelList == null) + { + return; + } + for (int i = 0; i < _cardPanelList.Length; i++) + { + if (_cardPanelList[i] != null) + { + _cardPanelList[i].RestoreSavedPosition(); + _cardPanelList[i].gameObject.SetActive(value: true); + _cardPanelList[i].EffectActive = false; + _cardPanelList[i].EffectActive = true; + _cardPanelList[i].CheckMaintenanceType(); + UITweenAlpha component = _cardPanelList[i].GetComponent(); + if (component != null) + { + UnityEngine.Object.Destroy(component); + } + } + } + } + + public virtual void OnMyPageInfoReceive() + { + if (_cardPanelList == null) + { + return; + } + for (int i = 0; i < _cardPanelList.Length; i++) + { + if (_cardPanelList[i] != null) + { + _cardPanelList[i].CheckMaintenanceType(); + } + } + } + + protected void RemoveITween(GameObject obj) + { + iTween component = obj.GetComponent(); + if (component != null) + { + UnityEngine.Object.Destroy(component); + } + } + + protected void TweenMoveTo(GameObject obj, float x) + { + RemoveITween(obj); + iTween.MoveTo(obj, iTween.Hash("x", x, "time", 0.3f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + protected void TweenMoveTo(GameObject obj, float x, float y) + { + RemoveITween(obj); + iTween.MoveTo(obj, iTween.Hash("x", x, "y", y, "time", 0.3f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + protected void MoveCardPanelLeftPosition(GameObject moveObj) + { + CardAnimation.StopMove(); + TweenMoveTo(moveObj, -328f); + } + + public void AppearAnimationFromRight(GameObject obj) + { + RemoveITween(obj); + obj.gameObject.SetActive(value: true); + iTween.MoveFrom(obj, iTween.Hash("x", obj.transform.localPosition.x + 1000f, "time", 0.3f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + protected void FadeOutCardPanel(MyPageCardPanel panel, Action onFinish) + { + panel.EffectActive = false; + FadeOutObject(panel.gameObject.AddMissingComponent(), delegate + { + onFinish.Call(); + }); + } + + protected void FadeOutCardPanelAndNonActive(MyPageCardPanel panel) + { + FadeOutCardPanel(panel, delegate + { + panel.gameObject.SetActive(value: false); + }); + } + + protected static void FadeOutObject(UITweenAlpha tweenAlpha, Action onFinish = null) + { + tweenAlpha.End(); + FadeUtility.FadeOutObject(tweenAlpha, onFinish); + } + + protected static void FadeInObject(UITweenAlpha tweenAlpha, Action onFinish = null) + { + tweenAlpha.End(); + FadeUtility.FadeInObject(tweenAlpha, onFinish); + } + + protected void ResetAlphaAndRemoveTween(UISprite spriteObj) + { + UITweenAlpha component = spriteObj.GetComponent(); + if (component != null) + { + UnityEngine.Object.Destroy(component); + } + spriteObj.alpha = 1f; + } + + public static CardPanelMaintenancePlate SetMaintenanceVisible(bool isMaintenance, UIButton button, CardPanelMaintenancePlate currentPlate, int buttonLabelDepth) + { + if (isMaintenance) + { + if (currentPlate == null) + { + GameObject prefab = GameMgr.GetIns().GetPrefabMgr().Get("Prefab/UI/Menu/CardPanelMaintenancePlate"); + currentPlate = NGUITools.AddChild(button.gameObject, prefab).GetComponent(); + currentPlate.SetDepth(buttonLabelDepth + 1); + } + currentPlate.gameObject.SetActive(value: true); + UIManager.SetObjectToGrey(button.gameObject, b: true); + UIManager.SetObjectToGrey(currentPlate.gameObject, b: false); + button.isEnabled = false; + } + else + { + if (currentPlate != null) + { + currentPlate.gameObject.SetActive(value: false); + } + UIManager.SetObjectToGrey(button.gameObject, b: false); + button.isEnabled = true; + } + return currentPlate; + } + + protected void SaveDefaultPosition(GameObject obj) + { + if (obj != null) + { + _defaultPosition[obj.GetInstanceID()] = obj.transform.localPosition; + } + } + + protected void RestoreDefaultPosition(GameObject obj) + { + if (_defaultPosition.ContainsKey(obj.GetInstanceID())) + { + obj.transform.localPosition = _defaultPosition[obj.GetInstanceID()]; + } + } + + protected void ShowMenu(MyPageCardPanel selectedPanel, GameObject menuRoot, bool isAnimate) + { + int index = selectedPanel.Index; + selectedPanel.RestoreSavedPosition(); + MoveCardPanelLeftPosition(selectedPanel.gameObject); + if (isAnimate) + { + CardAnimation.OnClicked(index); + } + for (int i = 0; i < CardPanelList.Length; i++) + { + if (i == index) + { + continue; + } + MyPageCardPanel myPageCardPanel = CardPanelList[i]; + if (myPageCardPanel.gameObject.activeSelf) + { + if (isAnimate) + { + FadeOutCardPanelAndNonActive(myPageCardPanel); + } + else + { + myPageCardPanel.gameObject.SetActive(value: false); + } + } + } + menuRoot.SetActive(value: true); + RestoreDefaultPosition(menuRoot); + AppearAnimationFromRight(menuRoot); + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageItemArena.cs b/SVSim.BattleEngine/Engine/MyPageItemArena.cs new file mode 100644 index 0000000..f88ae14 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageItemArena.cs @@ -0,0 +1,1280 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Convention; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.ErrorDialog; +using Wizard.RoomMatch; + +public class MyPageItemArena : MyPageItem +{ + private enum StartMenu + { + CARD_PANEL, + COLOSSEUM, + CONVENTION, + CHALLENGE, + GATHERING, + COMPETITION + } + + private enum CONVENTION_START_BUTTON + { + HOLDING, + ENTRY, + HISTORY + } + + private enum CONVENTION_JOING_BUTTON + { + JOING, + HISTORY + } + + private readonly Vector3 CARD_POS_LEFT = new Vector3(-203f, 0f, 0f); + + private readonly Vector3 CARD_POS_RIGHT = new Vector3(203f, 0f, 0f); + + private readonly Vector3 CARD_POS_3_LEFT = new Vector3(-367f, 0f, 0f); + + private readonly Vector3 CARD_POS_CENTER = new Vector3(0f, 20f, 0f); + + private readonly Vector3 CARD_POS_3_RIGHT = new Vector3(367f, 0f, 0f); + + private readonly Vector2 CARD_PANEL_LEFT_POS = new Vector2(-328f, 0f); + + private const int HEROES_SKIP_PAGE = 2; + + public const int ARENA_CONFIG_DIALOG_DEPTH = 100; + + private List _conventionMenuStartBackEvent; + + private List _panelResources = new List(); + + private bool _isSetConventionListMenuBackEvent; + + private const int GATHERING_CREATE_OLD_TIME_ERROR = 5317; + + private bool _goColosseumStartTask; + + private StartMenu _startMenu; + + private ConventionInfo _goConventionInfo; + + [SerializeField] + private UIButton _conventionRoomJoinButton; + + [SerializeField] + private UIButton _conventionRoomCreateButton; + + [SerializeField] + private UIButton _conventionDeckViewButton; + + [SerializeField] + private GameObject _conventionButtonBase; + + [SerializeField] + private GameObject cardPanelRoot; + + [SerializeField] + private GameObject conventionMenuRoot; + + [SerializeField] + private MyPageCardPanel _challengeCardPanel; + + [SerializeField] + public MyPageCardPanel _colosseumCardPanel; + + [SerializeField] + private MyPageCardPanel _conventionCardPanel; + + [SerializeField] + private MyPageCardPanel _competitonCardPanel; + + [SerializeField] + private MyPageBattleCampaign _battleCampaignClass; + + [SerializeField] + private GameObject _conventionBadge; + + [SerializeField] + private UIButton _challengeCardPanelButton; + + [SerializeField] + private GameObject _challengeMenuRoot; + + [SerializeField] + private ArenaConfigDialog _arenaConfigDialog; + + [SerializeField] + private GameObject _colosseumRoot; + + [SerializeField] + private GameObject _colosseumEntryRoot; + + [SerializeField] + private GameObject _competitionRoot; + + [SerializeField] + private GameObject _competitionEntryRoot; + + private bool _isPanelResourceLoaded; + + [SerializeField] + private GameObject _conventionModeSelectRoot; + + [SerializeField] + private UIButton _officialConventionButton; + + [SerializeField] + private GameObject _conventionSelectGatheringInviteBadge; + + [SerializeField] + private UIButton _gatheringButton; + + [SerializeField] + private GameObject _gatheringActionSelectRoot; + + [SerializeField] + private UIButton _gatheringCreateButton; + + [SerializeField] + private UIButton _gatheringEntryButton; + + [SerializeField] + private GameObject _gatheringRunnninRoot; + + [SerializeField] + private GameObject _gatheringRunningBadge; + + [SerializeField] + private UIButton _moveGatheringPageButton; + + [SerializeField] + private GameObject _gatheringCreateDialogPrefab; + + [SerializeField] + private GameObject _gatheringEntryBadge; + + private bool _isCompetitionEntry; + + [SerializeField] + private UILabel _conventionCardButtonTitle; + + [SerializeField] + private UILabel _conventionCardButtonSubTitle; + + [SerializeField] + private GameObject _deckEntryLimitRoot; + + [SerializeField] + private UILabel _deckEntryLimitLabel; + + [SerializeField] + private GameObject _gatheringEntryLimitRoot; + + [SerializeField] + private UILabel _gatheringEntryLimitLabel; + + [SerializeField] + private ConventionListUI _conventionListPrefab; + + private ConventionListUI _conventionList; + + private CardPanelMaintenancePlate _gatheringAllMaintenancePlate; + + private CardPanelMaintenancePlate _gatheringCreateMaintenancePlate; + + private MyPageMenu _myPageMenu; + + private bool _firstCompetitionInitialize; + + private bool IsEnableOfficialConvention + { + get + { + if (!Wizard.Data.MyPage.data._isJoinConvention) + { + return Wizard.Data.MyPage.data._isAdminWatcher; + } + return true; + } + } + + public override void Initialize(MyPageMenu parent) + { + _myPageMenu = parent; + cardPanelRoot.SetActive(value: true); + SaveDefaultPosition(_challengeMenuRoot); + SaveDefaultPosition(_colosseumRoot); + SaveDefaultPosition(_competitionRoot); + SaveDefaultPosition(_conventionButtonBase); + SaveDefaultPosition(_conventionModeSelectRoot); + SaveDefaultPosition(_gatheringActionSelectRoot); + SaveDefaultPosition(_gatheringRunnninRoot); + _colosseumCardPanel.GetComponent().MyPageFreeEntryIcon = _colosseumEntryRoot.GetComponent()._freeEntryIcon; + _gatheringEntryLimitRoot.SetActive(value: false); + } + + public void CardPanelInitialize() + { + ArenaCompetition competitionData = Wizard.Data.ArenaData.CompetitionData; + if (competitionData.IsCompetitionPeriod) + { + if (!_firstCompetitionInitialize) + { + _firstCompetitionInitialize = true; + _isCompetitionEntry = competitionData.IsEntry; + } + SetCardPanelList(new MyPageCardPanel[3] { _challengeCardPanel, _competitonCardPanel, _conventionCardPanel }); + CompetitionCardPanel competitionCardPanel = _competitonCardPanel.GetComponent(); + competitionCardPanel.IsEntry = competitionData.IsEntry; + _competitionEntryRoot.GetComponent().EntryAction = delegate + { + _isCompetitionEntry = true; + competitionCardPanel.IsEntry = _isCompetitionEntry; + competitionCardPanel.PanelImageUpdate(callEntryMenuUpdate: false); + }; + } + else if (Wizard.Data.ArenaData.ColosseumData.IsColosseumPeriod) + { + SetCardPanelList(new MyPageCardPanel[3] { _challengeCardPanel, _colosseumCardPanel, _conventionCardPanel }); + } + else + { + SetCardPanelList(new MyPageCardPanel[2] { _challengeCardPanel, _conventionCardPanel }); + } + base.Initialize(_myPageMenu); + } + + public override void Show(bool skipCardAnimation = false) + { + base.Show(skipCardAnimation); + if (_conventionList != null) + { + _conventionList.gameObject.SetActive(value: false); + } + conventionMenuRoot.SetActive(value: false); + _conventionCardPanel.gameObject.SetActive(value: false); + _competitionEntryRoot.gameObject.SetActive(value: false); + _conventionModeSelectRoot.gameObject.SetActive(value: false); + _gatheringActionSelectRoot.gameObject.SetActive(value: false); + _gatheringRunnninRoot.gameObject.SetActive(value: false); + _conventionBadge.gameObject.SetActive(value: false); + UIManager.GetInstance().StartCoroutine(ShowCoroutine()); + } + + private IEnumerator ShowCoroutine() + { + _challengeMenuRoot.SetActive(value: false); + _colosseumEntryRoot.SetActive(value: false); + _competitionEntryRoot.SetActive(value: false); + while (!MyPageMenu.IsMyPageRequestEnd) + { + yield return null; + } + CardPanelInitialize(); + while (UIManager.GetInstance().IsLocked()) + { + yield return null; + } + MyPageCardPanel[] cardPanelList; + if (!_isPanelResourceLoaded) + { + _isPanelResourceLoaded = true; + UIManager.GetInstance().createInSceneCenterLoading(); + cardPanelList = base.CardPanelList; + foreach (MyPageCardPanel myPageCardPanel in cardPanelList) + { + _panelResources.Add(myPageCardPanel.GetResourcePath(isfetch: false)); + } + yield return Toolbox.ResourcesManager.LoadAssetGroupSync(_panelResources, null); + cardPanelList = base.CardPanelList; + for (int i = 0; i < cardPanelList.Length; i++) + { + cardPanelList[i].AttachCardPanelTexture(); + } + UIManager.GetInstance().closeInSceneCenterLoading(); + } + cardPanelList = base.CardPanelList; + for (int i = 0; i < cardPanelList.Length; i++) + { + cardPanelList[i].gameObject.SetActive(value: false); + } + base.Show(); + if (!IsEnableOfficialConvention) + { + _conventionCardPanel.MaintenanceType = NetworkDefine.MAINTENANCE_TYPE.GATHERING_ALL; + } + _conventionButtonBase.SetActive(value: false); + StartMenu saveStartMenu = _startMenu; + if (_startMenu == StartMenu.CHALLENGE) + { + _startMenu = StartMenu.CARD_PANEL; + SetCardPanelAnimation(); + ShowChallengInfo(); + } + else if (_startMenu == StartMenu.COLOSSEUM) + { + _startMenu = StartMenu.CARD_PANEL; + UITweenAlpha component = _colosseumCardPanel.gameObject.GetComponent(); + if (component != null) + { + component.End(); + } + if (_goColosseumStartTask) + { + ColosseumEntryInfoTask task = new ColosseumEntryInfoTask(); + yield return UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, ColosseumEntryInfoTaskSuccess)); + } + else + { + ColosseumEntryInfoTaskSuccess(NetworkTask.ResultCode.Success); + } + SetCardPanelAnimation(); + base.CardAnimation.SetCardPanelAngle(); + for (int j = 0; j < base.CardPanelList.Length; j++) + { + base.CardPanelList[j].gameObject.SetActive(value: false); + } + _colosseumCardPanel.gameObject.SetActive(value: true); + _colosseumCardPanel.gameObject.transform.localPosition = new Vector3(CARD_PANEL_LEFT_POS.x, CARD_PANEL_LEFT_POS.y); + _colosseumCardPanel.GetComponent().alpha = 0f; + MyPageItem.FadeInObject(_colosseumCardPanel.gameObject.AddMissingComponent(), delegate + { + _colosseumCardPanel.EffectActive = true; + }); + } + else if (_startMenu == StartMenu.CONVENTION) + { + _startMenu = StartMenu.CARD_PANEL; + ConventionInfoTask task2 = new ConventionInfoTask(); + Action callbackOnSuccess = delegate + { + if (_goConventionInfo == null) + { + ShowConventionListMenu(task2); + UpdateConventionCardPanelLabelOnConventionSelect(); + } + else + { + ShowConventionRoomMenu(task2, _goConventionInfo); + } + conventionMenuRoot.SetActive(value: true); + _conventionCardPanel.gameObject.SetActive(value: true); + TweenMoveTo(_conventionCardPanel.gameObject, CARD_PANEL_LEFT_POS.x, CARD_PANEL_LEFT_POS.y); + base.IsEnableFooterCurrentMenu = true; + base.Parent.SetBackButtonEnable(); + }; + yield return StartCoroutine(Toolbox.NetworkManager.Connect(task2, callbackOnSuccess)); + } + else if (_startMenu == StartMenu.GATHERING) + { + _startMenu = StartMenu.CARD_PANEL; + conventionMenuRoot.SetActive(value: true); + _conventionCardPanel.gameObject.SetActive(value: true); + base.IsEnableFooterCurrentMenu = true; + base.Parent.SetBackButtonEnable(); + if (Wizard.Data.MyPageNotifications.data.GatheringMyPageInfo.IsEntry) + { + ShowGatheringActiveMenu(); + } + else + { + ShowGatheringCreateOrEntry(); + } + base.CardAnimation.StopMove(); + TweenMoveTo(_conventionCardPanel.gameObject, CARD_PANEL_LEFT_POS.x, CARD_PANEL_LEFT_POS.y); + } + else if (_startMenu == StartMenu.COMPETITION) + { + _startMenu = StartMenu.CARD_PANEL; + CompetitionDirectShow(); + } + else + { + ShowCardPanel(); + _conventionCardPanel.GetComponent().onClick.Clear(); + _conventionCardPanel.GetComponent().onClick.Add(new EventDelegate(delegate + { + OnClickConventionCardPanel(); + })); + } + ShowGatheringBadge(); + Offline.IsConventionMode = false; + if (saveStartMenu != StartMenu.CONVENTION) + { + UpdateConventionCardPanelLabelOnConventionSelect(); + } + StartCoroutine(_battleCampaignClass.Init()); + } + + public void CompetitionShow() + { + base.TopBar.SetTitleLabel(Wizard.Data.SystemText.Get("Competition_0006")); + } + + public void CompetitionDirectShow() + { + CompetitionShow(); + UITweenAlpha component = _competitonCardPanel.gameObject.GetComponent(); + if (component != null) + { + component.End(); + } + base.IsEnableFooterCurrentMenu = true; + base.Parent.SetBackButtonEnable(); + FadeOutCardPanelAndNonActive(_competitonCardPanel); + _competitionEntryRoot.SetActive(value: true); + RestoreDefaultPosition(_competitionRoot); + AppearAnimation(_competitionRoot); + MyPageMenu.Instance.SetDefaultBackButtonHandler(); + for (int i = 0; i < base.CardPanelList.Length; i++) + { + base.CardPanelList[i].gameObject.SetActive(value: false); + } + _competitonCardPanel.gameObject.SetActive(value: true); + RemoveITween(_competitonCardPanel.gameObject); + _competitonCardPanel.transform.localPosition = new Vector3(CARD_PANEL_LEFT_POS.x, CARD_PANEL_LEFT_POS.y); + _competitonCardPanel.GetComponent().alpha = 0f; + MyPageItem.FadeInObject(_competitonCardPanel.gameObject.AddMissingComponent(), delegate + { + _competitonCardPanel.EffectActive = true; + }); + } + + private void OnClickConventionCardPanel() + { + if (base.CardAnimation.IsCardMoving) + { + return; + } + if (Wizard.Data.MyPage.data._isAdminWatcher) + { + OnClickConventionCardPanelForAdmin(); + return; + } + conventionMenuRoot.SetActive(value: true); + base.Parent.SetDefaultBackButtonHandler(); + base.Parent.SetBackButtonEnable(); + base.IsEnableFooterCurrentMenu = true; + base.CardAnimation.OnClicked(_conventionCardPanel.Index); + _conventionCardPanel.GetComponent().onClick.Clear(); + AllClickEventClear(); + FadeOutCardPanelAndNonActive(_challengeCardPanel); + FadeOutCardPanelAndNonActive(_colosseumCardPanel); + FadeOutCardPanelAndNonActive(_competitonCardPanel); + TweenMoveTo(_conventionCardPanel.gameObject, CARD_PANEL_LEFT_POS.x, CARD_PANEL_LEFT_POS.y); + if (Wizard.Data.MyPage.data._isJoinConvention) + { + ShowConventionSelectMenu(); + } + else + { + OnClickGathering(playSe: false); + } + } + + private void ShowConventionSelectMenu() + { + FadeUtility.ShowSoon(_gatheringButton.gameObject); + FadeUtility.ShowSoon(_officialConventionButton.gameObject); + RestoreDefaultPosition(_conventionModeSelectRoot); + AppearAnimationFromRight(_conventionModeSelectRoot); + base.TopBar.SetTitleLabel(Wizard.Data.SystemText.Get("MyPage_0024")); + _conventionSelectGatheringInviteBadge.SetActive(Wizard.Data.MyPageNotifications.data.IsInviteGathering || Wizard.Data.MyPageNotifications.data.GatheringMyPageInfo.IsMatchingNotification); + _gatheringButton.onClick.Clear(); + _gatheringButton.onClick.Add(new EventDelegate(delegate + { + OnClickGathering(playSe: true); + })); + _officialConventionButton.onClick.Clear(); + _officialConventionButton.onClick.Add(new EventDelegate(delegate + { + OnClickOfficialConvention(); + })); + bool isMaintenance = Wizard.Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GATHERING_ALL); + _gatheringAllMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance, _gatheringButton, _gatheringAllMaintenancePlate, _gatheringButton.GetComponentInChildren().depth + 1); + } + + private void FadeOutConventionGatheringSelect() + { + FadeUtility.FadeOutObjectAndNonActive(_gatheringButton.gameObject); + FadeUtility.FadeOutObjectAndNonActive(_officialConventionButton.gameObject); + } + + public void ShowGatheringBadge() + { + _conventionBadge.SetActive(Wizard.Data.MyPageNotifications.data.IsInviteGathering || Wizard.Data.MyPageNotifications.data.GatheringMyPageInfo.IsMatchingNotification); + _gatheringEntryBadge.SetActive(Wizard.Data.MyPageNotifications.data.IsInviteGathering); + _gatheringRunningBadge.SetActive(Wizard.Data.MyPageNotifications.data.GatheringMyPageInfo.IsMatchingNotification); + } + + private void OnClickOfficialConvention() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + FadeOutConventionGatheringSelect(); + _conventionCardPanel.GetComponent().onClick.Clear(); + OnClickConventionCardButtonNew(); + } + + private void OnClickGathering(bool playSe) + { + if (playSe) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + } + base.IsEnableFooterCurrentMenu = true; + _gatheringButton.onClick.Clear(); + FadeOutConventionGatheringSelect(); + if (Wizard.Data.MyPageNotifications.data.GatheringMyPageInfo.IsEntry) + { + ShowGatheringActiveMenu(); + } + else + { + ShowGatheringCreateOrEntry(); + } + } + + private void ShowGatheringCreateOrEntry() + { + base.TopBar.SetTitleLabel(Wizard.Data.SystemText.Get("Gathering_0002")); + _gatheringActionSelectRoot.SetActive(value: true); + RestoreDefaultPosition(_gatheringActionSelectRoot); + AppearAnimationFromRight(_gatheringActionSelectRoot); + FadeUtility.ShowSoon(_gatheringCreateButton.gameObject); + FadeUtility.ShowSoon(_gatheringEntryButton.gameObject); + _gatheringCreateButton.onClick.Clear(); + _gatheringCreateButton.onClick.Add(new EventDelegate(delegate + { + OnClickGatheringCreate(); + })); + _gatheringEntryButton.onClick.Clear(); + _gatheringEntryButton.onClick.Add(new EventDelegate(delegate + { + OnClickGatheringEntry(); + })); + bool isMaintenance = Wizard.Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GATHERING_CREATE); + _gatheringCreateMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance, _gatheringCreateButton, _gatheringCreateMaintenancePlate, _gatheringCreateButton.GetComponentInChildren().depth + 1); + if (IsEnableOfficialConvention) + { + SetBackButtonHandler(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + FadeUtility.FadeOutObjectAndNonActive(_gatheringCreateButton.gameObject); + FadeUtility.FadeOutObjectAndNonActive(_gatheringEntryButton.gameObject); + ShowConventionSelectMenu(); + }); + } + else + { + base.Parent.SetDefaultBackButtonHandler(); + } + } + + private void ShowGatheringActiveMenu() + { + _gatheringRunnninRoot.SetActive(value: true); + RestoreDefaultPosition(_gatheringRunnninRoot); + AppearAnimationFromRight(_gatheringRunnninRoot); + base.TopBar.SetTitleLabel(Wizard.Data.SystemText.Get("Gathering_0002")); + FadeUtility.ShowSoon(_moveGatheringPageButton.gameObject); + _moveGatheringPageButton.onClick.Clear(); + _moveGatheringPageButton.onClick.Add(new EventDelegate(delegate + { + OnClickMoveGatheringPageButton(); + })); + if (IsEnableOfficialConvention) + { + SetBackButtonHandler(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + FadeOutRunningGatheringActionMenu(); + ShowConventionSelectMenu(); + }); + } + } + + private void SetBackButtonHandler(Action onBackButton) + { + List originalBackEvent = new List(base.TopBar.BackButton.onClick); + base.TopBar.SetBackButtonEvent(null, UIManager.ViewScene.None, new EventDelegate(delegate + { + onBackButton(); + base.TopBar.BackButton.onClick = originalBackEvent; + })); + } + + private void FadeOutRunningGatheringActionMenu() + { + FadeUtility.FadeOutObjectAndNonActive(_moveGatheringPageButton.gameObject); + } + + private void OnClickMoveGatheringPageButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Gathering); + } + + private void OnClickGatheringCreate() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + GatheringCreateDialog.Create(_gatheringCreateDialogPrefab).OnDecideRule = OnDecideGatheringRule; + } + + private void OnDecideGatheringRule(GatheringRule rule) + { + if (rule.IsOwnerEntryBattle && rule.IsEntryDeckOnly) + { + ShowConfirmCreateDeck(rule); + } + else + { + CreateGathering(rule, null); + } + } + + private void ShowConfirmCreateDeck(GatheringRule rule) + { + SystemText systemText = Wizard.Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(systemText.Get("Gathering_0021")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetTitleLabel(systemText.Get("Gathering_0025")); + dialogBase.SetButtonText(systemText.Get("Gathering_0022")); + dialogBase.onPushButton1 = delegate + { + ShowDeckListDialog(rule); + }; + } + + private void ShowDeckListDialog(GatheringRule rule) + { + string deckListHeader = Wizard.Data.SystemText.Get("Gathering_0026"); + MultiDeckSelectDialog.Create(RoomConnectController.RuleSelectDeckCount(rule.BattleParameterInstance.Rule), rule.BattleParameterInstance.DeckFormat, deckListHeader).OnDecide = delegate(List deckList) + { + OnDecideGatheringDeck(deckList, rule); + }; + } + + private void OnDecideGatheringDeck(List deckList, GatheringRule rule) + { + CreateGathering(rule, deckList); + } + + private void CreateGathering(GatheringRule rule, List deckList) + { + if (rule.Type == GatheringRule.eType.FREE_BATTLE) + { + GatheringCreateTask gatheringCreateTask = new GatheringCreateTask(); + gatheringCreateTask.SetParameter(rule, deckList); + gatheringCreateTask.AddSkipCuteCheckResultCode(5317); + StartCoroutine(Toolbox.NetworkManager.Connect(gatheringCreateTask, delegate + { + OnSuccessCreateGathering(); + }, null, delegate(int errorCode) + { + OnCreateGatheringError(errorCode); + })); + } + else if (rule.Type == GatheringRule.eType.TOURNAMENT) + { + GatheringTornamentCreateTask gatheringTornamentCreateTask = new GatheringTornamentCreateTask(); + gatheringTornamentCreateTask.SetParameter(rule, deckList); + gatheringTornamentCreateTask.AddSkipCuteCheckResultCode(5317); + StartCoroutine(Toolbox.NetworkManager.Connect(gatheringTornamentCreateTask, delegate + { + OnSuccessCreateGathering(); + }, null, delegate(int errorCode) + { + OnCreateGatheringError(errorCode); + })); + } + else + { + Debug.LogError("ๅคงไผšๆ–นๅผใŒไธๆญฃใงใ™ " + rule.Type); + } + } + + private void OnCreateGatheringError(int errorCode) + { + if (errorCode == 5317) + { + Dialog.Create(errorCode).OnClose = delegate + { + GatheringCreateDialog.Create(_gatheringCreateDialogPrefab).OnDecideRule = OnDecideGatheringRule; + }; + } + } + + private void OnSuccessCreateGathering() + { + GatheringChat.ResetLatestReadChatMessageId(); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Gathering); + } + + private void OnClickGatheringEntry() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Gathering); + } + + private void UpdateConventionCardPanelLabelOnConventionSelect() + { + SystemText systemText = Wizard.Data.SystemText; + if (Wizard.Data.MyPageNotifications.data.GatheringMyPageInfo.IsEntry && Wizard.Data.MyPage.data._conventionBattleStartTime == null) + { + UpdateConventionCardPanelLabelGathering(); + return; + } + _gatheringEntryLimitRoot.SetActive(value: false); + if (Wizard.Data.MyPage.data._conventionBattleStartTime != null && !Wizard.Data.MyPage.data._isAdminWatcher) + { + _deckEntryLimitRoot.SetActive(value: true); + _deckEntryLimitLabel.text = systemText.Get("Arena_0070", Wizard.Data.MyPage.data._conventionBattleStartTime); + } + else + { + _deckEntryLimitRoot.SetActive(value: false); + } + if (Wizard.Data.MyPage.data._isAdminWatcher) + { + _conventionCardButtonTitle.text = systemText.Get("Arena_0128"); + _conventionCardButtonSubTitle.text = systemText.Get("Arena_0129"); + } + else + { + _conventionCardButtonTitle.text = systemText.Get("MyPage_0024"); + _conventionCardButtonSubTitle.text = systemText.Get("Arena_0127"); + } + } + + private void UpdateConventionCardPanelLabelGathering() + { + _deckEntryLimitRoot.SetActive(value: false); + _gatheringEntryLimitRoot.SetActive(value: true); + SystemText systemText = Wizard.Data.SystemText; + _conventionCardButtonTitle.text = systemText.Get("MyPage_0024"); + _conventionCardButtonSubTitle.text = systemText.Get("Arena_0127"); + if (Wizard.Data.MyPageNotifications.data.GatheringMyPageInfo.IsDeckEntry) + { + _gatheringEntryLimitLabel.text = systemText.Get("Gathering_0023", Wizard.Data.MyPageNotifications.data.GatheringMyPageInfo.DeckEntryFinishTime); + } + else if (Wizard.Data.MyPageNotifications.data.GatheringMyPageInfo.IsOpening) + { + _gatheringEntryLimitLabel.text = systemText.Get("Gathering_0032"); + } + else + { + _gatheringEntryLimitLabel.text = systemText.Get("Gathering_0024", Wizard.Data.MyPageNotifications.data.GatheringMyPageInfo.FinishTime); + } + if (Wizard.Data.MyPageNotifications.data.GatheringMyPageInfo.IsBattleFinish) + { + _gatheringEntryLimitRoot.SetActive(value: false); + } + } + + protected void OnDestroy() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_panelResources); + _panelResources.Clear(); + } + + private void ShowCardPanel() + { + FadeUtility.RemoveFadeObject(_conventionCardPanel.gameObject); + FadeUtility.RemoveFadeObject(_colosseumCardPanel.gameObject); + FadeUtility.RemoveFadeObject(_challengeCardPanel.gameObject); + _colosseumCardPanel.GetComponent().SetIconDisplayPermission(isPermission: true); + UIButton component = _colosseumCardPanel.GetComponent(); + _challengeCardPanelButton.onClick.Clear(); + _challengeCardPanelButton.onClick.Add(new EventDelegate(delegate + { + OnClickChallengeCardPanel(); + })); + component.onClick.Clear(); + component.onClick.Add(new EventDelegate(delegate + { + OnClickColosseumCardButton(); + })); + _colosseumRoot.SetActive(value: false); + UIButton component2 = _competitonCardPanel.GetComponent(); + component2.onClick.Clear(); + component2.onClick.Add(new EventDelegate(delegate + { + OnClickCompetitionCardButton(); + })); + _competitionRoot.SetActive(value: false); + _conventionCardPanel.GetComponent().enabled = true; + _challengeMenuRoot.SetActive(value: false); + SetCardPanelAnimation(); + StartCardPanelAppearAnimation(); + } + + private void SetCardPanelAnimation() + { + for (int i = 0; i < base.CardPanelList.Length; i++) + { + MyPageCardPanel obj = base.CardPanelList[i]; + obj.gameObject.SetActive(value: true); + obj.EffectActive = false; + obj.EffectActive = true; + obj.CheckMaintenanceType(); + } + if (base.CardPanelList.Length == 2) + { + base.CardPanelList[0].transform.localPosition = CARD_POS_LEFT; + base.CardPanelList[1].transform.localPosition = CARD_POS_RIGHT; + } + else if (base.CardPanelList.Length == 3) + { + base.CardPanelList[0].transform.localPosition = CARD_POS_3_LEFT; + base.CardPanelList[1].transform.localPosition = CARD_POS_CENTER; + base.CardPanelList[2].transform.localPosition = CARD_POS_3_RIGHT; + } + List list = new List(); + for (int j = 0; j < base.CardPanelList.Length; j++) + { + MyPageCardPanel myPageCardPanel = base.CardPanelList[j]; + if (myPageCardPanel.isActiveAndEnabled) + { + list.Add(myPageCardPanel.gameObject); + } + } + SaveCardPanelDefaultPosition(); + base.CardAnimation.PanelClear(); + base.CardAnimation.SetCardPanelList(list.ToArray()); + base.CardAnimation.SetCardPanelAngle(); + } + + public void GoToColosseum(bool isColosseumTask) + { + _startMenu = StartMenu.COLOSSEUM; + _goColosseumStartTask = isColosseumTask; + AllClickEventClear(); + MyPageMenu.Instance.SetDefaultBackButtonHandler(); + base.CardAnimation.SkipMoveAnimation(); + } + + public void GoToCompetition() + { + _startMenu = StartMenu.COMPETITION; + AllClickEventClear(); + MyPageMenu.Instance.SetDefaultBackButtonHandler(); + base.CardAnimation.SkipMoveAnimation(); + UIManager.GetInstance().CheckFirstTips(CompetitionUtility.GetCompetitionTipsType(Wizard.Data.ArenaData.CompetitionData.Rule)); + } + + public void GoToConventionListMenu() + { + _startMenu = StartMenu.CONVENTION; + _goConventionInfo = null; + } + + public void GoToConventionActionMenu(ConventionInfo conventionInfo) + { + _startMenu = StartMenu.CONVENTION; + _goConventionInfo = conventionInfo; + } + + public void GoToGatheringMenu() + { + _startMenu = StartMenu.GATHERING; + _goConventionInfo = null; + } + + public void AppearAnimation(GameObject obj, string completeMessage = "") + { + obj.gameObject.SetActive(value: true); + iTween component = obj.gameObject.GetComponent(); + if (component != null) + { + UnityEngine.Object.Destroy(component); + } + Hashtable hashtable = new Hashtable(); + hashtable.Add("x", obj.transform.localPosition.x + 1000f); + hashtable.Add("time", 0.3f); + hashtable.Add("delay", 0.1f); + hashtable.Add("islocal", true); + hashtable.Add("easetype", iTween.EaseType.easeOutExpo); + if (completeMessage != "") + { + hashtable.Add("oncomplete", completeMessage); + hashtable.Add("oncompletetarget", _colosseumEntryRoot); + } + iTween.MoveFrom(obj, hashtable); + } + + private void OnClickColosseumCardButton() + { + AllClickEventClear(); + base.CardAnimation.OnClicked(_colosseumCardPanel.Index); + ColosseumEntryInfoTask task = new ColosseumEntryInfoTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, ColosseumEntryInfoTaskSuccess)); + } + + private void OnClickCompetitionCardButton() + { + AllClickEventClear(); + base.CardAnimation.OnClicked(_competitonCardPanel.Index); + CompetitionEntryInfo(); + } + + private void ColosseumEntryInfoTaskSuccess(NetworkTask.ResultCode inResult) + { + base.IsEnableFooterCurrentMenu = true; + _colosseumCardPanel.GetComponent().SetIconDisplayPermission(isPermission: false); + _colosseumEntryRoot.SetActive(value: true); + base.Parent.SetBackButtonEnable(); + base.TopBar.SetTitleLabel(Wizard.Data.SystemText.Get("Colosseum_0001")); + TweenMoveTo(_colosseumCardPanel.gameObject, CARD_PANEL_LEFT_POS.x, CARD_PANEL_LEFT_POS.y); + _challengeCardPanel.EffectActive = false; + FadeOutCardPanelAndNonActive(_challengeCardPanel); + if (_conventionCardPanel.gameObject.activeSelf) + { + _conventionCardPanel.EffectActive = false; + FadeOutCardPanelAndNonActive(_conventionCardPanel); + } + RestoreDefaultPosition(_colosseumRoot); + if (Wizard.Data.ArenaData.ColosseumData.IsDeckDeleted) + { + AppearAnimation(_colosseumRoot, "ColosseumDeckDeletedDialogMessageReceiver"); + } + else + { + AppearAnimation(_colosseumRoot); + } + _colosseumCardPanel.GetComponent().NowUpdate(); + MyPageMenu.Instance.SetDefaultBackButtonHandler(); + if (Wizard.Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.Avatar) + { + CheckFirstTips(FirstTips.TipsType.HeroesGrandPrix, Wizard.Data.ArenaData.ColosseumData); + } + else if (Wizard.Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.WindFall) + { + CheckFirstTips(FirstTips.TipsType.ColosseumWindFall, Wizard.Data.ArenaData.ColosseumData); + } + else if (Wizard.Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.TwoPickChaos) + { + CheckFirstTips(FirstTips.TipsType.Colosseum2PickChaos, Wizard.Data.ArenaData.ColosseumData); + } + else + { + CheckFirstTips(FirstTips.TipsType.Colosseum, Wizard.Data.ArenaData.ColosseumData); + } + } + + private void CheckFirstTips(FirstTips.TipsType tipsType, ArenaColosseum colosseumData) + { + if (!FirstTips.IsFirstTipsOpen(tipsType) && (!colosseumData.NeedsFirstTips || colosseumData.ColosseumId <= PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.FIRST_TIPS_COLOSSEUM_ID))) + { + return; + } + int startPage = 0; + if (Wizard.Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.Avatar) + { + if (!FirstTips.IsFirstTipsOpen(FirstTips.TipsType.HeroesFreeMatch)) + { + startPage = 2; + } + FirstTips.SaveFinishFirstTips(FirstTips.TipsType.HeroesFreeMatch); + } + UIManager.GetInstance().StartFirstTips(tipsType, null, startPage, Wizard.Data.ArenaData.ColosseumData.ChaoseTipsId); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.FIRST_TIPS_COLOSSEUM_ID, colosseumData.ColosseumId); + } + + public void CompetitionEntryInfo() + { + base.IsEnableFooterCurrentMenu = true; + _competitionEntryRoot.SetActive(value: true); + base.Parent.SetBackButtonEnable(); + CompetitionShow(); + TweenMoveTo(_competitonCardPanel.gameObject, CARD_PANEL_LEFT_POS.x, CARD_PANEL_LEFT_POS.y); + _challengeCardPanel.EffectActive = false; + FadeOutCardPanelAndNonActive(_challengeCardPanel); + _conventionCardPanel.EffectActive = false; + FadeOutCardPanelAndNonActive(_conventionCardPanel); + MyPageMenu.Instance.SetDefaultBackButtonHandler(); + AppearAnimation(_competitionRoot); + UIManager.GetInstance().CheckFirstTips(CompetitionUtility.GetCompetitionTipsType(Wizard.Data.ArenaData.CompetitionData.Rule)); + } + + private void SetFade(bool inDisp, GameObject inFadeObject, Action inFinishAction) + { + UITweenAlpha uITweenAlpha = inFadeObject.AddMissingComponent(); + uITweenAlpha._from = 0f; + uITweenAlpha._to = 1f; + uITweenAlpha._curve = AnimationCurve.Linear(0f, 0f, 1f, 1f); + uITweenAlpha._endTime = 0.1f; + if (inDisp) + { + uITweenAlpha._finishCallBack = delegate + { + inFadeObject.SetActive(value: true); + if (inFinishAction != null) + { + inFinishAction(); + } + }; + inFadeObject.SetActive(value: true); + uITweenAlpha.PlayForward(isReset: true); + return; + } + uITweenAlpha._finishCallBack = delegate + { + inFadeObject.SetActive(value: false); + if (inFinishAction != null) + { + inFinishAction(); + } + }; + uITweenAlpha.PlayReverse(isReset: true); + } + + private void DetailStart() + { + ColosseumEntry component = _colosseumEntryRoot.GetComponent(); + _challengeCardPanel.gameObject.SetActive(value: false); + _colosseumCardPanel.gameObject.SetActive(value: false); + _conventionCardPanel.gameObject.SetActive(value: false); + _colosseumRoot.SetActive(value: true); + _colosseumEntryRoot.SetActive(value: false); + component.OpenDetail(); + base.Parent.SetBackButtonEnable(); + base.TopBar.SetTitleLabel(Wizard.Data.SystemText.Get("Colosseum_0001")); + } + + private void OnClickConventionCardPanelForAdmin() + { + IDInput.StartInputDialog(Wizard.Data.SystemText.Get("Arena_0130"), 5, OnDecideConventionId); + } + + private void OnDecideConventionId(string conventionId) + { + Action onDecide = delegate(string roomId) + { + OnDecideConventionWatch(conventionId, roomId); + }; + IDInput.StartInputDialog(Wizard.Data.SystemText.Get("RoomBattle_0006"), 5, onDecide); + } + + private void OnDecideConventionWatch(string conventionId, string roomId) + { + RoomConnectController.InitializeParameter initializeParameter = new RoomConnectController.InitializeParameter(RoomConnectController.PositionMode.WATCHER, new BattleParameter(NetworkDefine.ServerBattleType.Free, Format.Max, TwoPickFormat.None, RoomConnectController.BattleRule.Bo1, isOpenDeckRoom: false), roomId); + ConventionInfo conventionInfo = new ConventionInfo(conventionId); + initializeParameter.ConventionInfo = conventionInfo; + StartCoroutine(base.Parent.BattleMenu.JoinRoom(initializeParameter, isInvite: false)); + } + + private void OnClickConventionCardButtonNew() + { + AllClickEventClear(); + FadeOutCardPanelAndNonActive(_challengeCardPanel); + FadeOutCardPanelAndNonActive(_colosseumCardPanel); + TweenMoveTo(_conventionCardPanel.gameObject, CARD_PANEL_LEFT_POS.x, CARD_PANEL_LEFT_POS.y); + ConventionInfoTask task = new ConventionInfoTask(); + Action callbackOnSuccess = delegate + { + ShowConventionListMenu(task); + }; + StartCoroutine(Toolbox.NetworkManager.Connect(task, callbackOnSuccess)); + } + + private void ShowConventionListMenu(ConventionInfoTask task) + { + if (_conventionList != null) + { + UnityEngine.Object.Destroy(_conventionList.gameObject); + } + _conventionCardButtonTitle.text = Wizard.Data.SystemText.Get("MyPage_0024"); + base.TopBar.SetTitleLabel(Wizard.Data.SystemText.Get("Gathering_0001")); + base.IsEnableFooterCurrentMenu = true; + _conventionList = NGUITools.AddChild(base.gameObject, _conventionListPrefab.gameObject).GetComponent(); + _conventionList.Show(task.OfflineConventionList); + AppearAnimationFromRight(_conventionList.gameObject); + _conventionList.OnSelect = delegate(ConventionInfo convention) + { + OnClickConvention(task, convention); + }; + if (_isSetConventionListMenuBackEvent) + { + return; + } + _isSetConventionListMenuBackEvent = true; + SetBackButtonHandler(delegate + { + _isSetConventionListMenuBackEvent = false; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + if (_conventionList != null) + { + UnityEngine.Object.Destroy(_conventionList.gameObject); + } + ShowConventionSelectMenu(); + }); + } + + private void OnClickConvention(ConventionInfoTask task, ConventionInfo convention) + { + if (convention.Status == ConventionInfo.ConventionStatus.GameStart) + { + UIManager.GetInstance().CreatFadeClose(delegate + { + UIManager.GetInstance().CreatFadeOpen(); + ShowConventionRoomMenu(task, convention); + if (_conventionList != null) + { + _conventionList.Hide(); + } + }); + } + else + { + Offline.IsConventionMode = true; + DeckListUI.ChangeSceneToDeckList(convention.BattleParameterInstance.DeckFormat, null, convention); + } + } + + private void ShowConventionRoomMenu(ConventionInfoTask task, ConventionInfo data) + { + AllClickEventClear(); + Wizard.Data.CurrentFormat = data.BattleParameterInstance.DeckFormat; + SystemText systemText = Wizard.Data.SystemText; + base.TopBar.SetTitleLabel(systemText.Get("MyPage_0042") + " " + UIUtil.GetFormatName(data.BattleParameterInstance.DeckFormat)); + _conventionCardButtonTitle.text = systemText.Get("MyPage_0042"); + _conventionCardButtonSubTitle.text = systemText.Get("MyPage_0044"); + if (data.Status == ConventionInfo.ConventionStatus.DeckEntry) + { + _deckEntryLimitLabel.text = systemText.Get("Arena_0070", Wizard.Data.MyPage.data._conventionBattleStartTime); + _deckEntryLimitRoot.SetActive(value: true); + } + else + { + _deckEntryLimitRoot.SetActive(value: false); + } + _conventionButtonBase.SetActive(value: true); + _conventionCardPanel.GetComponent().onClick.Clear(); + RestoreDefaultPosition(_conventionButtonBase); + AppearAnimation(_conventionButtonBase); + GameObject[] array = new GameObject[3] { _conventionRoomCreateButton.gameObject, _conventionRoomJoinButton.gameObject, _conventionRoomJoinButton.gameObject }; + for (int i = 0; i < array.Length; i++) + { + array[i].SetActive(value: true); + ResetAlphaAndRemoveTween(array[i].GetComponent()); + } + _conventionRoomCreateButton.onClick.Clear(); + _conventionRoomCreateButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + RoomConnectController.InitializeParameter param = new RoomConnectController.InitializeParameter(RoomConnectController.PositionMode.OWNER, data.BattleParameterInstance, "") + { + IsEnableTurnSelect = data.IsSelectableTurn, + ConventionInfo = data + }; + StartCoroutine(base.Parent.BattleMenu.JoinRoom(param, isInvite: false)); + })); + _conventionRoomJoinButton.onClick.Clear(); + _conventionRoomJoinButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + base.Parent.BattleMenu.StartRoomIDInput(isWatch: false, data); + })); + _conventionDeckViewButton.onClick.Clear(); + _conventionDeckViewButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + Offline.IsConventionMode = true; + DeckListUI.ChangeSceneToDeckList(data.BattleParameterInstance.DeckFormat, null, data); + })); + SetBackButtonHandler(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().CreatFadeClose(delegate + { + UIManager.GetInstance().CreatFadeOpen(); + ShowConventionListMenu(task); + UpdateConventionCardPanelLabelOnConventionSelect(); + _conventionButtonBase.SetActive(value: false); + }); + }); + } + + private void AllClickEventClear() + { + MyPageCardPanel[] cardPanelList = base.CardPanelList; + for (int i = 0; i < cardPanelList.Length; i++) + { + cardPanelList[i].GetComponent().onClick.Clear(); + } + } + + public void GoToChallengeMenu() + { + _startMenu = StartMenu.CHALLENGE; + } + + private void OnClickChallengeCardPanel() + { + if (!base.IsCardMoving) + { + AllClickEventClear(); + base.CardAnimation.OnClicked(_challengeCardPanel.Index); + ShowChallengInfo(); + } + } + + private void ShowChallengInfo() + { + base.IsEnableFooterCurrentMenu = true; + base.Parent.SetBackButtonEnable(); + base.TopBar.SetTitleLabel(Wizard.Data.SystemText.Get("Arena_NewMode")); + TweenMoveTo(_challengeCardPanel.gameObject, CARD_PANEL_LEFT_POS.x, CARD_PANEL_LEFT_POS.y); + if (_conventionCardPanel.gameObject.activeSelf) + { + _conventionCardPanel.EffectActive = false; + FadeOutCardPanelAndNonActive(_conventionCardPanel); + } + if (_competitonCardPanel.gameObject.activeSelf) + { + _competitonCardPanel.EffectActive = false; + FadeOutCardPanelAndNonActive(_competitonCardPanel); + } + if (_colosseumCardPanel.gameObject.activeSelf) + { + _colosseumCardPanel.EffectActive = false; + FadeOutCardPanelAndNonActive(_colosseumCardPanel); + } + RestoreDefaultPosition(_challengeMenuRoot); + AppearAnimation(_challengeMenuRoot); + MyPageMenu.Instance.SetDefaultBackButtonHandler(); + UIManager.GetInstance().CheckFirstTips(FirstTips.TipsType.Challenge); + } + + private void OnClickArenaConfigButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + CreateArenaConfigDialog(); + } + + private void CreateArenaConfigDialog() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Wizard.Data.SystemText.Get("Colosseum_0120")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + ArenaConfigDialog arenaConfigDialog = UnityEngine.Object.Instantiate(_arenaConfigDialog); + arenaConfigDialog.Initialize(); + dialogBase.SetObj(arenaConfigDialog.gameObject); + dialogBase.SetPanelDepth(100); + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate + { + arenaConfigDialog.Final(); + }); + } + + public void RedrawBattleCampaign() + { + _battleCampaignClass.RedrawAfterSpecialWinRewardOpened(); + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageItemBattle.cs b/SVSim.BattleEngine/Engine/MyPageItemBattle.cs new file mode 100644 index 0000000..8b54966 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageItemBattle.cs @@ -0,0 +1,1174 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.RoomMatch; + +public class MyPageItemBattle : MyPageItem +{ + private enum RankMatchLayoutType + { + Default, + DefaultWithReward, + DefaultWithRewardAndSpeicalReward, + Crossover, + CrossoverWithReward, + CrossoverWithRewardAndSpeicalReward + } + + private struct FormatSelectLayout + { + public int GridY { get; private set; } + + public int Interval { get; private set; } + + public bool IsEnableRewardButton { get; private set; } + + public bool IsEnableSpecialRewardButton { get; private set; } + + public bool IsEnableCrossOver { get; private set; } + + public Vector3 RewardPosition { get; private set; } + + public Vector3 SpecialWinRewardPosition { get; private set; } + + public FormatSelectLayout(int gridY, int interval, bool enableRewardButton, bool enableSpecialRewardButton, bool enableCrossOver, Vector3 rewardPosition, Vector3 specialWinRewardPosition) + { + GridY = gridY; + Interval = interval; + IsEnableRewardButton = enableRewardButton; + IsEnableCrossOver = enableCrossOver; + IsEnableSpecialRewardButton = enableSpecialRewardButton; + RewardPosition = rewardPosition; + SpecialWinRewardPosition = specialWinRewardPosition; + } + } + + [Serializable] + private class RankMatchLayout + { + public UIButton RotationButton; + + public UILabel RotationLabel; + + public UITexture RotationRankTexture; + + public UIButton UnlimitedButton; + + public UILabel UnlimitedLabel; + + public UITexture UnlimitedRankTexture; + + public UIButton CrossoverButton; + + public UILabel CrossoverLabel; + + public UITexture CrossoverRankTexture; + + public UIButton WinRewardButton; + + public UIButton SpecialWinRewardButton; + + public GameObject SpecialWinRewardIcon; + + public void ClearButtonOnClickEvent() + { + ClearButtonOnClickEventCore(RotationButton); + ClearButtonOnClickEventCore(UnlimitedButton); + ClearButtonOnClickEventCore(CrossoverButton); + ClearButtonOnClickEventCore(WinRewardButton); + ClearButtonOnClickEventCore(SpecialWinRewardButton); + static void ClearButtonOnClickEventCore(UIButton button) + { + if (!(button == null)) + { + button.onClick.Clear(); + } + } + } + + public void SetButtonOnClickEvent(UIButton button, Action onClick) + { + if (!(button == null)) + { + button.onClick.Add(new EventDelegate(delegate + { + onClick(); + })); + } + } + } + + private const int FREE_MATCH_TOP_BUTTON_Y_NORMAL = 57; + + private const int FREE_MATCH_TOP_BUTTON_Y_PRE_ROTATION = 163; + + private readonly Vector3 RANK_ROTATION_POSITION_WITH_REWARD = new Vector3(215f, 106f, 0f); + + private readonly Vector3 RANK_UNLIMITED_POSITION_WITH_REWARD = new Vector3(215f, -44f, 0f); + + private const int CARD_INDEX_FREE_MATCH = 0; + + private const int CARD_INDEX_RANK_MATCH = 1; + + private const int CARD_INDEX_ROOM_MATCH = 2; + + [SerializeField] + private UIButton _freeMatchButton; + + [SerializeField] + private UIButton _rankMatchButton; + + [SerializeField] + private MyPageCardPanel _freeMatchCardPanel; + + [SerializeField] + private MyPageCardPanel _rankMatchCardPanel; + + [SerializeField] + private MyPageBattleCampaign _battleCampaignClass; + + [SerializeField] + private MyPageCardPanel _roomMatchCardPanel; + + [SerializeField] + private UIButton _roomMatchButton; + + [SerializeField] + private UITexture _rankIcon; + + [SerializeField] + private GameObject _inviteIconCardPanel; + + [SerializeField] + private UIButton _roomCreateButton; + + [SerializeField] + private UIButton _roomJoinButton; + + [SerializeField] + private UIButton _roomWatchButton; + + [SerializeField] + private GameObject _roomInviteIconOnJoinButton; + + [SerializeField] + private UILabel _roomWatchLabel; + + [SerializeField] + private UIButton _roomCreateNormalBattleButton; + + [SerializeField] + private UIButton _roomCreate2PickBattleButton; + + [SerializeField] + private UILabel _roomCreateNormalLabel; + + [SerializeField] + private GameObject _roomActionRoot; + + [SerializeField] + private GameObject _roomCreateTypeRoot; + + [SerializeField] + private GameObject _cardPanelRoomMatch; + + [SerializeField] + private GameObject _roomInviteMenuRoot; + + [SerializeField] + private UIButton _roomIdInputButtonInInvite; + + [SerializeField] + private UIButton _roomInviteReceiveButton; + + [SerializeField] + private GameObject _inviteReceveDialog; + + [SerializeField] + private GameObject _formatSelectRootRankMatch; + + [SerializeField] + private RankMatchLayout _rankMatchLayouts = new RankMatchLayout(); + + [SerializeField] + private UIGrid _rankMatchGrid; + + [SerializeField] + private GameObject _winRewardDialogBoxPrefab; + + [SerializeField] + private GameObject _specialWinRewardDialogBoxPrefab; + + [SerializeField] + private GameObject _formatSelectRootFreeMatch; + + [SerializeField] + private UIButton _rotationButtonFreeMatch; + + [SerializeField] + private UILabel _rotationButtonFreeMatchLabel; + + [SerializeField] + private UIButton _unlimitedButtonFreeMatch; + + [SerializeField] + private UILabel _unlimitedButtonFreeMatchLabel; + + [SerializeField] + private GameObject _roomCampaignRoot; + + [SerializeField] + private GameObject _roomCampaignTimeRoot; + + [SerializeField] + private UILabel _roomCampaignEndTime; + + [SerializeField] + private GameObject _freeMatchPreReleaseApeal; + + [SerializeField] + private UIButton _preReleaseFreeMatchButton; + + [SerializeField] + private UILabel _preReleaseFreeMatchLabel; + + [SerializeField] + private UIButton _crossoverFreeMatchButton; + + [SerializeField] + private UILabel _crossoverFreeMatchLabel; + + [SerializeField] + private UIButton _myrotaionFreeMatchButton; + + [SerializeField] + private UILabel _myRotationFreeMatchLabel; + + [SerializeField] + private UIButton _avatarBattleFreeMatchButton; + + [SerializeField] + private UILabel _avatarBattleFreeMatchLabel; + + [SerializeField] + private CardDetailUI _cardDetailPrefab; + + [SerializeField] + private GameObject _rewardDetailCamera; + + private CardDetailUI _cardDetail; + + private CardPanelMaintenancePlate _roomWatchMaintenancePlate; + + private CardPanelMaintenancePlate _roomCreateMaintenancePlate; + + private CardPanelMaintenancePlate _roomJoinMaintenancePlate; + + private CardPanelMaintenancePlate _roomCreateNormalMaintenancePlate; + + private CardPanelMaintenancePlate _roomCreate2PickMaintenancePlate; + + private CardPanelMaintenancePlate _freeRotationMaintenancePlate; + + private CardPanelMaintenancePlate _freeUnlimitedMaintenancePlate; + + private CardPanelMaintenancePlate _freePreReleaseMaintenancePlate; + + private CardPanelMaintenancePlate _rankRotationMaintenancePlate; + + private CardPanelMaintenancePlate _rankUnlimitedMaintenancePlate; + + private CardPanelMaintenancePlate _freeCrossoverMaintenancePlate; + + private CardPanelMaintenancePlate _rankCrossoverMaintenancePlate; + + private CardPanelMaintenancePlate _freeMyRotationReleaseMaintenancePlate; + + private CardPanelMaintenancePlate _freeAvatarReleaseMaintenancePlate; + + private RoomRuleSetting _roomCreateSetting; + + private RoomRuleSetting _roomCreateSetting2Pick; + + private IDInput _roomInput; + + private List _rankIconPathList = new List(); + + private bool _isStopSendMyPageRefreshTask; + + private static readonly Dictionary RANK_FORMAT_SELECT_LAYOUT = new Dictionary + { + { + RankMatchLayoutType.Default, + new FormatSelectLayout(57, 150, enableRewardButton: false, enableSpecialRewardButton: false, enableCrossOver: false, Vector3.zero, Vector3.zero) + }, + { + RankMatchLayoutType.DefaultWithReward, + new FormatSelectLayout(106, 150, enableRewardButton: true, enableSpecialRewardButton: false, enableCrossOver: false, new Vector3(381f, -141f, 0f), Vector3.zero) + }, + { + RankMatchLayoutType.DefaultWithRewardAndSpeicalReward, + new FormatSelectLayout(106, 150, enableRewardButton: true, enableSpecialRewardButton: true, enableCrossOver: false, new Vector3(381f, -141f, 0f), new Vector3(175f, -141f, 0f)) + }, + { + RankMatchLayoutType.Crossover, + new FormatSelectLayout(163, 146, enableRewardButton: false, enableSpecialRewardButton: false, enableCrossOver: true, Vector3.zero, Vector3.zero) + }, + { + RankMatchLayoutType.CrossoverWithReward, + new FormatSelectLayout(162, 131, enableRewardButton: true, enableSpecialRewardButton: true, enableCrossOver: false, new Vector3(381f, -190f, 0f), Vector3.zero) + }, + { + RankMatchLayoutType.CrossoverWithRewardAndSpeicalReward, + new FormatSelectLayout(162, 131, enableRewardButton: true, enableSpecialRewardButton: true, enableCrossOver: true, new Vector3(381f, -190f, 0f), new Vector3(175f, -190f, 0f)) + } + }; + + public RoomConnectController RoomConnectControllerInstance { get; private set; } + + public override void OnMyPageInfoReceive() + { + base.OnMyPageInfoReceive(); + Format inFormat = ((PlayerStaticData.UserRank(Format.Rotation) <= PlayerStaticData.UserRank(Format.Unlimited)) ? Format.Unlimited : Format.Rotation); + PlayerStaticData.LoadUserRankTexture(inFormat); + PlayerStaticData.AttachUserRankTexture(_rankIcon, PlayerStaticData.RankTexSize.L); + InitializeRankIcon(); + _inviteIconCardPanel.SetActive(base.Parent.IsEnableRoomInvite); + } + + public override void Initialize(MyPageMenu parent) + { + base.Initialize(parent); + GameObject[] array = new GameObject[10] { _roomCreateButton.gameObject, _roomJoinButton.gameObject, _roomWatchButton.gameObject, _roomCreateNormalBattleButton.gameObject, _roomCreate2PickBattleButton.gameObject, _roomCreateTypeRoot, _roomInviteMenuRoot, _formatSelectRootRankMatch, _formatSelectRootFreeMatch, _roomActionRoot }; + foreach (GameObject obj in array) + { + SaveDefaultPosition(obj); + } + InitializeCardDetail(); + } + + private void InitializeCardDetail() + { + _rewardDetailCamera.SetActive(value: false); + if (!(_cardDetail != null)) + { + int detailLayer = LayerMask.NameToLayer("Detail"); + _cardDetail = UnityEngine.Object.Instantiate(_cardDetailPrefab); + _cardDetail.transform.parent = base.transform; + _cardDetail.transform.localPosition = Vector3.zero; + _cardDetail.transform.localScale = Vector3.one; + _cardDetail.gameObject.SetActive(value: false); + _cardDetail.Initialize(detailLayer, CardMaster.CardMasterId.Default); + _cardDetail.IsShowFlavorTextButton = false; + _cardDetail.IsShowVoiceButton = false; + _cardDetail.IsShowEvolutionButton = false; + } + } + + private void InitializeRankIcon() + { + List list = new List(); + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(PlayerStaticData.UserRank(Format.Rotation).ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_L)); + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(PlayerStaticData.UserRank(Format.Unlimited).ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_L)); + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(PlayerStaticData.UserRank(Format.Crossover).ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_L)); + if (LoadCheckRankIcon(list)) + { + List oldFilePath = _rankIconPathList; + _rankIconPathList = list; + Toolbox.ResourcesManager.StartCoroutine_LoadAssetGroupSync(_rankIconPathList, delegate + { + UpdateRankIcon(); + if (oldFilePath.Count > 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(oldFilePath); + } + }); + } + else + { + UpdateRankIcon(); + } + } + + private void UpdateRankIcon() + { + Texture mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(PlayerStaticData.UserRank(Format.Rotation).ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_L, isfetch: true)) as Texture; + Texture mainTexture2 = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(PlayerStaticData.UserRank(Format.Unlimited).ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_L, isfetch: true)) as Texture; + Texture mainTexture3 = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(PlayerStaticData.UserRank(Format.Crossover).ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_L, isfetch: true)) as Texture; + RankMatchLayout rankMatchLayouts = _rankMatchLayouts; + if (rankMatchLayouts.RotationRankTexture != null) + { + rankMatchLayouts.RotationRankTexture.mainTexture = mainTexture; + } + if (rankMatchLayouts.UnlimitedRankTexture != null) + { + rankMatchLayouts.UnlimitedRankTexture.mainTexture = mainTexture2; + } + if (rankMatchLayouts.CrossoverRankTexture != null) + { + rankMatchLayouts.CrossoverRankTexture.mainTexture = mainTexture3; + } + } + + public override void OnClose() + { + base.OnClose(); + Toolbox.ResourcesManager.RemoveAssetGroup(_rankIconPathList); + _rankIconPathList.Clear(); + } + + private bool LoadCheckRankIcon(List newList) + { + if (_rankIconPathList.Count != newList.Count) + { + return true; + } + for (int i = 0; i < newList.Count; i++) + { + if (_rankIconPathList[i] != newList[i]) + { + return true; + } + } + return false; + } + + public override void Show(bool skipCardAnimation = false) + { + RestoreCardPanelPosition(); + RestoreDefaultPosition(_roomCreateNormalBattleButton.gameObject); + RestoreDefaultPosition(_roomCreate2PickBattleButton.gameObject); + RestoreDefaultPosition(_roomCreateTypeRoot); + UpdateCampaignInfo(); + base.Show(skipCardAnimation); + if (FirstTips.IsFirstTipsOpen(FirstTips.TipsType.Battle)) + { + UIManager.GetInstance().CheckFirstTips(FirstTips.TipsType.Battle); + FirstTips.SaveFinishFirstTips(FirstTips.TipsType.BattleBeforeFormatUser); + } + else if (FirstTips.IsFirstTipsOpen(FirstTips.TipsType.BattleBeforeFormatUser)) + { + UIManager.GetInstance().CheckFirstTips(FirstTips.TipsType.BattleBeforeFormatUser); + } + _freeMatchPreReleaseApeal.SetActive(Prerelease.Instance.IsEnableFreeMatch); + _preReleaseFreeMatchButton.gameObject.SetActive(Prerelease.Instance.IsEnableFreeMatch); + _crossoverFreeMatchButton.gameObject.SetActive(Data.Crossover.IsWithinFreeMatchPeriod); + _myrotaionFreeMatchButton.gameObject.SetActive(Data.MyRotationAllInfo.IsWithinFreeMatchPeriod); + _avatarBattleFreeMatchButton.gameObject.SetActive(Data.AvatarBattleAllInfo.IsWithinFreeMatchPeriod); + int num = ((Data.MyRotationAllInfo.IsWithinFreeMatchPeriod || Prerelease.Instance.IsEnableFreeMatch || Data.Crossover.IsWithinFreeMatchPeriod || Data.AvatarBattleAllInfo.IsWithinFreeMatchPeriod) ? 163 : 57); + UIUtil.SetLocalPositionY(_rotationButtonFreeMatch.transform, num); + ShowCardPanelMenu(skipCardAnimation); + } + + private void UpdateCampaignInfo() + { + _roomCampaignTimeRoot.SetActive(value: true); + if (Data.MyPageNotifications.data.RoomRule.NormalRuleFormatList.Contains(Format.Hof)) + { + _roomCampaignRoot.gameObject.SetActive(value: true); + _roomCampaignEndTime.text = Data.SystemText.Get("MyPage_0048", Data.MyPageNotifications.data.RoomRule.NormalRuleFormatEndTime[Format.Hof]); + } + else if (Data.MyPageNotifications.data.RoomRule.NormalRuleFormatList.Contains(Format.Windfall)) + { + _roomCampaignRoot.gameObject.SetActive(value: true); + _roomCampaignEndTime.text = Data.SystemText.Get("MyPage_0048", Data.MyPageNotifications.data.RoomRule.NormalRuleFormatEndTime[Format.Windfall]); + } + else if (Data.MyPageNotifications.data.RoomRule.SpecialTwoPickRuleFormatList.Contains(TwoPickFormat.Cube)) + { + _roomCampaignRoot.gameObject.SetActive(value: true); + _roomCampaignEndTime.text = Data.SystemText.Get("MyPage_0048", Data.MyPageNotifications.data.RoomRule.TwoPickRuleFormatEndTime[TwoPickFormat.Cube]); + } + else if (Data.MyPageNotifications.data.RoomRule.SpecialTwoPickRuleFormatList.Contains(TwoPickFormat.Chaos)) + { + _roomCampaignRoot.gameObject.SetActive(value: true); + _roomCampaignEndTime.text = Data.SystemText.Get("MyPage_0048", Data.MyPageNotifications.data.RoomRule.TwoPickRuleFormatEndTime[TwoPickFormat.Chaos]); + } + else if (Data.MyPageNotifications.data.RoomRule.NormalRuleFormatList.Contains(Format.Avatar)) + { + _roomCampaignRoot.gameObject.SetActive(value: true); + _roomCampaignEndTime.text = Data.SystemText.Get("MyPage_0048", Data.MyPageNotifications.data.RoomRule.NormalRuleFormatEndTime[Format.Avatar]); + } + else if (Data.MyPage.data.IsRoomNonPossessionCardCampaign()) + { + _roomCampaignRoot.gameObject.SetActive(value: true); + _roomCampaignEndTime.text = Data.SystemText.Get("MyPage_0048", Data.MyPage.data.RoomNonPossessionCardCampaign.EndLocalTimeString); + } + else if (Data.MyPage.data._lotteryData.IsCampaignTimeNow()) + { + _roomCampaignRoot.gameObject.SetActive(value: true); + _roomCampaignTimeRoot.SetActive(value: false); + } + else + { + _roomCampaignRoot.gameObject.SetActive(value: false); + } + } + + private void ShowCardPanelMenu(bool skipCardAnimation = false) + { + if (!skipCardAnimation) + { + StartCardPanelAppearAnimation(); + } + SetNotRoomCardPanelVisible(visible: true); + _roomActionRoot.SetActive(value: false); + _roomCreateTypeRoot.SetActive(value: false); + _roomInviteMenuRoot.SetActive(value: false); + _formatSelectRootRankMatch.SetActive(value: false); + _formatSelectRootFreeMatch.SetActive(value: false); + _freeMatchButton.onClick.Clear(); + _freeMatchButton.onClick.Add(new EventDelegate(delegate + { + OnPushFreeMatch(); + })); + _rankMatchButton.onClick.Clear(); + _rankMatchButton.onClick.Add(new EventDelegate(delegate + { + OnPushRankMatch(); + })); + _roomMatchButton.onClick.Clear(); + _roomMatchButton.onClick.Add(new EventDelegate(delegate + { + OnPushRoomMatch(); + })); + _inviteIconCardPanel.SetActive(base.Parent.IsEnableRoomInvite); + StartCoroutine(_battleCampaignClass.Init()); + } + + private void OnPushFreeMatch() + { + if (!base.IsCardMoving) + { + ShowFreeMatchFormatSelect(isPlaySe: true); + } + } + + public void ShowFreeMatchFormatSelect(bool isPlaySe) + { + if (Data.AvatarBattleAllInfo.IsWithinFreeMatchPeriod) + { + UIManager.GetInstance().CheckFirstTips(FirstTips.TipsType.HeroesFreeMatch); + } + FormatSelectCommon(Data.SystemText.Get("MyPage_0010"), 0, _freeMatchButton, _formatSelectRootFreeMatch, isPlaySe); + SetupFreeMatch(); + MoveCardPanelLeftPosition(_freeMatchCardPanel.gameObject); + FadeOutCardPanelAndNonActive(_roomMatchCardPanel); + FadeOutCardPanelAndNonActive(_rankMatchCardPanel); + } + + private void OnClickFormatFreeMatch(Format type) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ShowMatchDeckSelect(type, DataMgr.BattleType.FreeBattle); + } + + private void OnPushRankMatch() + { + if (!base.IsCardMoving) + { + ShowRankMatchFormatSelect(isPlaySe: true); + } + } + + public void ShowRankMatchFormatSelect(bool isPlaySe) + { + FormatSelectCommon(Data.SystemText.Get("MyPage_0011"), 1, _rankMatchButton, _formatSelectRootRankMatch, isPlaySe); + SetupRankMatch(); + MoveCardPanelLeftPosition(_rankMatchCardPanel.gameObject); + FadeOutCardPanelAndNonActive(_freeMatchCardPanel); + FadeOutCardPanelAndNonActive(_roomMatchCardPanel); + } + + private RankMatchLayoutType GetRankMatchLayoutType() + { + CampaignBattleWin campaignBattleWin = Data.MyPageNotifications.data.CampaignBattleWin; + if (Data.Crossover.IsWithinRankMatchPeriod) + { + if (!campaignBattleWin.IsInSessionCampaign || !campaignBattleWin.IsHaveSpecialWinReward) + { + if (!campaignBattleWin.IsInSessionCampaign) + { + return RankMatchLayoutType.Crossover; + } + return RankMatchLayoutType.CrossoverWithReward; + } + return RankMatchLayoutType.CrossoverWithRewardAndSpeicalReward; + } + if (!campaignBattleWin.IsInSessionCampaign || !campaignBattleWin.IsHaveSpecialWinReward) + { + if (!campaignBattleWin.IsInSessionCampaign) + { + return RankMatchLayoutType.Default; + } + return RankMatchLayoutType.DefaultWithReward; + } + return RankMatchLayoutType.DefaultWithRewardAndSpeicalReward; + } + + private void FormatSelectCommon(string topBarTitle, int cardIndex, UIButton cardButton, GameObject formatSelectRoot, bool isPlaySe) + { + base.CardAnimation.OnClicked(cardIndex, isPlaySe); + formatSelectRoot.SetActive(value: true); + RestoreDefaultPosition(formatSelectRoot); + AppearAnimationFromRight(formatSelectRoot); + cardButton.onClick.Clear(); + base.Parent.SetBackButtonEnable(); + base.Parent.SetDefaultBackButtonHandler(); + base.IsEnableFooterCurrentMenu = true; + base.TopBar.SetTitleLabel(topBarTitle); + } + + private void SetupFreeMatch() + { + bool isMaintenance = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.FREEBATTLE_ROTATION); + bool isMaintenance2 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.FREEBATTLE_UNLIMITED); + bool isMaintenance3 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.FREEBATTLE_PREROTATION); + bool isMaintenance4 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.FREEBATTLE_CROSSOVER); + bool isMaintenance5 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.FREEBATTLE_MYROTATION); + bool isMaintenance6 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.FREEBATTLE_AVATAR); + _freeRotationMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance, _rotationButtonFreeMatch, _freeRotationMaintenancePlate, _rotationButtonFreeMatchLabel.depth + 1); + _freeUnlimitedMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance2, _unlimitedButtonFreeMatch, _freeUnlimitedMaintenancePlate, _unlimitedButtonFreeMatchLabel.depth + 1); + _freePreReleaseMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance3, _preReleaseFreeMatchButton, _freePreReleaseMaintenancePlate, _preReleaseFreeMatchLabel.depth + 1); + _freeCrossoverMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance4, _crossoverFreeMatchButton, _freeCrossoverMaintenancePlate, _crossoverFreeMatchLabel.depth + 1); + _freeMyRotationReleaseMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance5, _myrotaionFreeMatchButton, _freeMyRotationReleaseMaintenancePlate, _myRotationFreeMatchLabel.depth + 1); + _freeAvatarReleaseMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance6, _avatarBattleFreeMatchButton, _freeAvatarReleaseMaintenancePlate, _avatarBattleFreeMatchLabel.depth + 1); + _rotationButtonFreeMatch.onClick.Clear(); + _unlimitedButtonFreeMatch.onClick.Clear(); + _preReleaseFreeMatchButton.onClick.Clear(); + _crossoverFreeMatchButton.onClick.Clear(); + _myrotaionFreeMatchButton.onClick.Clear(); + _avatarBattleFreeMatchButton.onClick.Clear(); + _rotationButtonFreeMatch.onClick.Add(new EventDelegate(delegate + { + OnClickFormatFreeMatch(Format.Rotation); + })); + _unlimitedButtonFreeMatch.onClick.Add(new EventDelegate(delegate + { + OnClickFormatFreeMatch(Format.Unlimited); + })); + _preReleaseFreeMatchButton.onClick.Add(new EventDelegate(delegate + { + OnClickFormatFreeMatch(Format.PreRotation); + })); + _crossoverFreeMatchButton.onClick.Add(new EventDelegate(delegate + { + OnClickFormatFreeMatch(Format.Crossover); + })); + _myrotaionFreeMatchButton.onClick.Add(new EventDelegate(delegate + { + OnClickFormatFreeMatch(Format.MyRotation); + })); + _avatarBattleFreeMatchButton.onClick.Add(new EventDelegate(delegate + { + OnClickFormatFreeMatch(Format.Avatar); + })); + } + + private void SetupRankMatch() + { + RankMatchLayoutType rankMatchLayoutType = GetRankMatchLayoutType(); + FormatSelectLayout formatSelectLayout = RANK_FORMAT_SELECT_LAYOUT[rankMatchLayoutType]; + bool isMaintenance = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.RANKBATTLE_ROTATION); + bool isMaintenance2 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.RANKBATTLE_UNLIMITED); + bool isMaintenance3 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.RANKBATTLE_CROSSOVER); + _rankRotationMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance, _rankMatchLayouts.RotationButton, _rankRotationMaintenancePlate, _rankMatchLayouts.RotationLabel.depth + 1); + _rankUnlimitedMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance2, _rankMatchLayouts.UnlimitedButton, _rankUnlimitedMaintenancePlate, _rankMatchLayouts.UnlimitedLabel.depth + 1); + _rankCrossoverMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance3, _rankMatchLayouts.CrossoverButton, _rankCrossoverMaintenancePlate, _rankMatchLayouts.CrossoverLabel.depth + 1); + _rankMatchLayouts.CrossoverButton.gameObject.SetActive(formatSelectLayout.IsEnableCrossOver); + _rankMatchLayouts.WinRewardButton.gameObject.SetActive(formatSelectLayout.IsEnableRewardButton); + _rankMatchLayouts.SpecialWinRewardButton.gameObject.SetActive(formatSelectLayout.IsEnableSpecialRewardButton); + if (Data.MyPageNotifications.data.CampaignBattleWin.SpecialTreasureInfo != null) + { + _rankMatchLayouts.SpecialWinRewardIcon.SetActive(Data.MyPageNotifications.data.CampaignBattleWin.SpecialTreasureInfo.IsTreasureBoxReadyToOpen); + UIManager.GetInstance()._Footer.InviteIconDisp(Data.MyPageNotifications.data.CampaignBattleWin.SpecialTreasureInfo.IsTreasureBoxReadyToOpen); + } + _rankMatchLayouts.WinRewardButton.transform.localPosition = formatSelectLayout.RewardPosition; + _rankMatchLayouts.SpecialWinRewardButton.transform.localPosition = formatSelectLayout.SpecialWinRewardPosition; + _rankMatchGrid.cellHeight = formatSelectLayout.Interval; + _rankMatchGrid.transform.localPosition = new Vector3(_rankMatchGrid.transform.localPosition.x, formatSelectLayout.GridY, _rankMatchGrid.transform.localPosition.z); + _rankMatchGrid.Reposition(); + _rankMatchLayouts.ClearButtonOnClickEvent(); + _rankMatchLayouts.SetButtonOnClickEvent(_rankMatchLayouts.RotationButton, delegate + { + OnClickFormatRankMatch(Format.Rotation); + }); + _rankMatchLayouts.SetButtonOnClickEvent(_rankMatchLayouts.UnlimitedButton, delegate + { + OnClickFormatRankMatch(Format.Unlimited); + }); + _rankMatchLayouts.SetButtonOnClickEvent(_rankMatchLayouts.CrossoverButton, delegate + { + OnClickFormatRankMatch(Format.Crossover); + }); + _rankMatchLayouts.SetButtonOnClickEvent(_rankMatchLayouts.WinRewardButton, OnClickWinReward); + _rankMatchLayouts.SetButtonOnClickEvent(_rankMatchLayouts.SpecialWinRewardButton, OnClickSpecialWinReward); + } + + private void OnClickFormatRankMatch(Format format) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ShowMatchDeckSelect(format, DataMgr.BattleType.RankBattle); + } + + private static string GetRewardDialogName(CampaignRewardInfo info) + { + return info.Type switch + { + UserGoods.Type.Sleeve => Data.Master.SleeveMgr.Get(info.GoodsId).sleeve_name, + UserGoods.Type.Emblem => Data.Master.EmblemMgr.Get(info.GoodsId)._name, + _ => UserGoods.getUserGoodsName(info.Type, info.GoodsId), + }; + } + + private List GetWinnarRewardDialogData() + { + List list = new List(); + for (int i = 0; i < base.Parent.WinnerRewardInfoCopy.Count; i++) + { + CampaignRewardInfo campaignRewardInfo = base.Parent.WinnerRewardInfoCopy[i]; + PurchaseRewardInfo purchaseRewardInfo = new PurchaseRewardInfo(); + purchaseRewardInfo.PurchaseNthText = GetRewardDialogName(campaignRewardInfo); + purchaseRewardInfo.IsGet = campaignRewardInfo.IsReceived; + ShopCommonRewardInfo shopCommonRewardInfo = new ShopCommonRewardInfo(); + shopCommonRewardInfo.Type = (int)campaignRewardInfo.Type; + shopCommonRewardInfo.Num = campaignRewardInfo.GoodsCount; + shopCommonRewardInfo.UserGoodsId = campaignRewardInfo.GoodsId; + purchaseRewardInfo.RewardInfoList.Add(shopCommonRewardInfo); + list.Add(purchaseRewardInfo); + } + return list; + } + + private void OnClickWinReward() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + _rewardDetailCamera.SetActive(value: true); + DialogBase obj = PurchaseRewardDialog.Create(GetWinnarRewardDialogData(), attachBottomObj: MyPageRewardDialogBoxCount.Create(_winRewardDialogBoxPrefab, Data.MyPageNotifications.data.CampaignBattleWin), cardDetail: _cardDetail, useLargeDetailDialog: true, layout: PurchaseRewardDialog.Layout.TITLE_BOTTOM, detailDialogTitleOverride: Data.SystemText.Get("Mission_0025")); + obj.SetTitleLabel(Data.SystemText.Get("MyPage_0081")); + obj.OnClose = delegate + { + _rewardDetailCamera.SetActive(value: false); + }; + obj.SetLayer("Loading"); + } + + private void OnClickSpecialWinReward() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + _rewardDetailCamera.SetActive(value: true); + GetWinnarRewardDialogData(); + GameObject obj = MyPageSpecialWinRewardDialog.Create(_specialWinRewardDialogBoxPrefab, base.Parent.GetNotTouchMypageCollider()); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("MyPage_0108")); + dialogBase.SetObj(obj); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + dialogBase.OnClose = delegate + { + _rewardDetailCamera.SetActive(value: false); + }; + dialogBase.SetLayer("MyPage"); + dialogBase.SetPanelDepth(100, isSetBackViewDepthImmediately: true); + } + + public void ShowMatchDeckSelect(Format format, DataMgr.BattleType battleType) + { + Data.CurrentFormat = format; + GameMgr.GetIns().GetDataMgr().m_BattleType = battleType; + DeckInfoTask task = new DeckInfoTask(); + task.SetParameter(format); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + DeckSelectUIDialog.Create(DeckSelectUIDialog.GetTitleByBattleType(GameMgr.GetIns().GetDataMgr().m_BattleType), task.DeckGroupListData, format, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: true, delegate(DialogBase dialog, DeckData deckData) + { + FreeAndRankMatchDeckSelectConfirmDialog.Create(dialog, deckData, isBattleEnd: false); + }); + })); + } + + private void OnPushRoomMatch() + { + if (!base.IsCardMoving) + { + base.Parent.SetBackButtonEnable(); + base.Parent.SetDefaultBackButtonHandler(); + base.CardAnimation.OnClicked(2); + ShowRoomActionMenu(cutCardPanelAnimation: false); + MoveCardPanelLeftPosition(_cardPanelRoomMatch); + } + } + + private void SetNotRoomCardPanelVisible(bool visible) + { + _freeMatchCardPanel.gameObject.SetActive(visible); + _rankMatchCardPanel.gameObject.SetActive(visible); + } + + private void FadeOutNotRoomCardPanel() + { + FadeOutCardPanelAndNonActive(_freeMatchCardPanel); + FadeOutCardPanelAndNonActive(_rankMatchCardPanel); + } + + private void SetRoomActionButtonEnable(bool isEnabled) + { + _roomCreateButton.isEnabled = isEnabled; + _roomJoinButton.isEnabled = isEnabled; + _roomWatchButton.isEnabled = isEnabled; + } + + private void SetRoomActionButtonGameObjectActive(bool isActive) + { + _roomCreateButton.gameObject.SetActive(isActive); + _roomJoinButton.gameObject.SetActive(isActive); + _roomWatchButton.gameObject.SetActive(isActive); + } + + private void ShowRoomActionMenu(bool cutCardPanelAnimation) + { + base.IsEnableFooterCurrentMenu = true; + if (cutCardPanelAnimation) + { + SetNotRoomCardPanelVisible(visible: false); + } + else + { + FadeOutNotRoomCardPanel(); + } + _roomMatchButton.onClick.Clear(); + _roomActionRoot.gameObject.SetActive(value: true); + SetRoomActionButtonGameObjectActive(isActive: true); + SetRoomActionButtonEnable(isEnabled: true); + RestoreDefaultPosition(_roomCreateButton.gameObject); + RestoreDefaultPosition(_roomJoinButton.gameObject); + RestoreDefaultPosition(_roomWatchButton.gameObject); + RestoreDefaultPosition(_roomActionRoot); + ResetAlphaAndRemoveTween(_roomCreateButton.gameObject.GetComponent()); + ResetAlphaAndRemoveTween(_roomJoinButton.gameObject.GetComponent()); + ResetAlphaAndRemoveTween(_roomWatchButton.gameObject.GetComponent()); + _roomInviteIconOnJoinButton.gameObject.SetActive(base.Parent.IsEnableRoomInvite); + _roomCreateButton.onClick.Clear(); + _roomCreateButton.onClick.Add(new EventDelegate(delegate + { + SetRoomActionButtonEnable(isEnabled: false); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OnPushRoomCreateButton(isFadeOut: true); + })); + _roomJoinButton.onClick.Clear(); + _roomJoinButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + if (base.Parent.IsEnableRoomInvite) + { + SetRoomActionButtonEnable(isEnabled: false); + FadeOutRoomActionButton(isFadeOut: true); + ShowRoomJoinMenuExistInvite(); + } + else + { + StartRoomIDInput(isWatch: false); + } + })); + _roomWatchButton.onClick.Clear(); + _roomWatchButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + StartRoomIDInput(isWatch: true); + })); + base.TopBar.SetTitleLabel(Data.SystemText.Get("RoomBattle_0001")); + AppearAnimationFromRight(_roomActionRoot); + RefreshRoomActionButtonMaintenancePlate(); + } + + private void OnPushRoomCreateButton(bool isFadeOut) + { + _roomCreateSetting = new RoomRuleSetting(); + _roomCreateSetting2Pick = new RoomRuleSetting(); + _roomCreateSetting2Pick.BattleParameterInstance.BattleType = NetworkDefine.ServerBattleType.RoomTwoPick; + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_ROTATION) && _roomCreateSetting.BattleParameterInstance.DeckFormat == Format.Rotation) + { + _roomCreateSetting.BattleParameterInstance.DeckFormat = Format.Unlimited; + } + RefreshRoomTypeSelectBattleButton(); + _roomCreateButton.isEnabled = false; + _roomJoinButton.isEnabled = false; + _roomWatchButton.isEnabled = false; + FadeOutRoomActionButton(isFadeOut); + RestoreDefaultPosition(_roomCreateTypeRoot); + _roomCreateTypeRoot.SetActive(value: true); + AppearAnimationFromRight(_roomCreateTypeRoot); + _roomCreateNormalBattleButton.gameObject.SetActive(value: true); + _roomCreate2PickBattleButton.gameObject.SetActive(value: true); + List tempBackButtonEvent = new List(base.TopBar.BackButton.onClick); + base.TopBar.SetBackButtonEvent(null, UIManager.ViewScene.None, new EventDelegate(delegate + { + RemoveITween(_roomCreateTypeRoot); + BackOnRoomCreateMenu(tempBackButtonEvent); + })); + } + + private void FadeOutRoomActionButton(bool isFadeOut) + { + if (isFadeOut) + { + SetRoomActionButtonGameObjectActive(isActive: true); + FadeUtility.FadeOutObjectAndNonActive(_roomCreateButton.gameObject); + FadeUtility.FadeOutObjectAndNonActive(_roomJoinButton.gameObject); + FadeUtility.FadeOutObjectAndNonActive(_roomWatchButton.gameObject); + } + else + { + SetRoomActionButtonGameObjectActive(isActive: false); + } + } + + private void BackOnRoomCreateMenu(List tempBackButtonEvent) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + _roomCreateButton.gameObject.SetActive(value: true); + UISprite roomCreateButtonSprite = _roomCreateButton.GetComponent(); + ResetAlphaAndRemoveTween(roomCreateButtonSprite); + _roomJoinButton.gameObject.SetActive(value: true); + ResetAlphaAndRemoveTween(_roomJoinButton.GetComponent()); + ShowRoomActionMenu(cutCardPanelAnimation: true); + _roomWatchButton.gameObject.SetActive(value: true); + ResetAlphaAndRemoveTween(_roomWatchButton.GetComponent()); + RefreshRoomActionButtonMaintenancePlate(); + MyPageItem.FadeOutObject(_roomCreateNormalBattleButton.gameObject.AddMissingComponent(), delegate + { + _roomCreateNormalBattleButton.gameObject.SetActive(value: false); + roomCreateButtonSprite.panel.Refresh(); + }); + MyPageItem.FadeOutObject(_roomCreate2PickBattleButton.gameObject.AddMissingComponent(), delegate + { + _roomCreate2PickBattleButton.gameObject.SetActive(value: false); + roomCreateButtonSprite.panel.Refresh(); + }); + base.TopBar.BackButton.onClick = tempBackButtonEvent; + } + + private void RefreshRoomActionButtonMaintenancePlate() + { + if (!Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_ALL_MAINTENANCE)) + { + _roomCreateMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance: false, _roomCreateButton, _roomCreateMaintenancePlate, _roomWatchLabel.depth); + _roomJoinMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance: false, _roomJoinButton, _roomJoinMaintenancePlate, _roomWatchLabel.depth); + _roomCreateButton.isEnabled = true; + _roomJoinButton.isEnabled = true; + _roomWatchButton.isEnabled = true; + } + else + { + _roomCreateMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance: true, _roomCreateButton, _roomCreateMaintenancePlate, _roomWatchLabel.depth); + _roomJoinMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance: true, _roomJoinButton, _roomJoinMaintenancePlate, _roomWatchLabel.depth); + } + bool isMaintenance = false; + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_WATCHING_MAINTENANCE) || Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_ALL_MAINTENANCE)) + { + isMaintenance = true; + } + _roomWatchMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance, _roomWatchButton, _roomWatchMaintenancePlate, _roomWatchLabel.depth); + } + + private void RefreshRoomTypeSelectBattleButton() + { + _roomCreateNormalBattleButton.gameObject.SetActive(value: true); + ResetAlphaAndRemoveTween(_roomCreateNormalBattleButton.GetComponent()); + AppearAnimationFromRight(_roomCreateNormalBattleButton.gameObject); + _roomCreateNormalBattleButton.onClick.Clear(); + _roomCreateNormalBattleButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OnClickRoomCreateNormalRule(); + })); + bool isMaintenance = false; + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_BATTLE_MAINTENANCE)) + { + isMaintenance = true; + } + _roomCreateNormalMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance, _roomCreateNormalBattleButton, _roomCreateNormalMaintenancePlate, _roomCreateNormalLabel.depth + 1); + _roomCreate2PickBattleButton.gameObject.SetActive(value: true); + ResetAlphaAndRemoveTween(_roomCreate2PickBattleButton.GetComponent()); + _roomCreate2PickBattleButton.onClick.Clear(); + _roomCreate2PickBattleButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OnClickRoomCreateTwoPick(); + })); + bool isMaintenance2 = false; + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_TWOPICK_MAINTENANCE)) + { + isMaintenance2 = true; + } + _roomCreate2PickMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance2, _roomCreate2PickBattleButton, _roomCreate2PickMaintenancePlate, _roomCreateNormalLabel.depth + 1); + } + + private void OnClickRoomCreateNormalRule() + { + _roomCreateSetting.BattleParameterInstance.DeckFormat = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.ROOM_MATCH_FORMAT); + _roomCreateSetting.BattleParameterInstance.Rule = RoomRuleSelectDialog.GetLastRule(PlayerPrefsWrapper.LAST_ROOM_MATCH_RULE, _roomCreateSetting.BattleParameterInstance.Rule); + RoomRuleSelectDialog.Create(_roomCreateSetting, out var _, isTwoPick: false); + _roomCreateSetting.OnDecide = OnSelectRoomCreateNormalRule; + } + + private void OnClickRoomCreateTwoPick() + { + _roomCreateSetting2Pick.BattleParameterInstance.Rule = RoomRuleSelectDialog.GetLastRule(PlayerPrefsWrapper.LAST_ROOM_MATCH_RULE_2PICK, _roomCreateSetting2Pick.BattleParameterInstance.Rule); + _roomCreateSetting2Pick.BattleParameterInstance.TwoPickFormat = RoomRuleSelectDialog.GetLastTwoPickFormat(PlayerPrefsWrapper.LAST_ROOM_MATCH_FORMAT_2PICK, TwoPickFormat.Normal); + RoomRuleSelectDialog.Create(_roomCreateSetting2Pick, out var _, isTwoPick: true); + _roomCreateSetting2Pick.OnDecide = OnSelectRoomCreateRule2Pick; + } + + private void OnSelectRoomCreateNormalRule() + { + RoomConnectController.InitializeParameter initializeParameter = new RoomConnectController.InitializeParameter(RoomConnectController.PositionMode.OWNER, _roomCreateSetting.BattleParameterInstance, ""); + initializeParameter.IsPermitFriendWatch = _roomCreateSetting.EnableFriendWatch; + initializeParameter.IsPermitGuildWatch = _roomCreateSetting.EnableGuildWatch; + StartCoroutine(JoinRoom(initializeParameter, isInvite: false)); + } + + private void OnSelectRoomCreateRule2Pick() + { + RoomConnectController.InitializeParameter initializeParameter = new RoomConnectController.InitializeParameter(RoomConnectController.PositionMode.OWNER, _roomCreateSetting2Pick.BattleParameterInstance, ""); + initializeParameter.IsPermitFriendWatch = _roomCreateSetting2Pick.EnableFriendWatch; + initializeParameter.IsPermitGuildWatch = _roomCreateSetting2Pick.EnableGuildWatch; + StartCoroutine(JoinRoom(initializeParameter, isInvite: false)); + } + + private void ShowRoomJoinMenuExistInvite() + { + RestoreDefaultPosition(_roomInviteMenuRoot); + _roomInviteMenuRoot.gameObject.SetActive(value: true); + AppearAnimationFromRight(_roomInviteMenuRoot); + _roomIdInputButtonInInvite.onClick.Clear(); + _roomIdInputButtonInInvite.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + StartRoomIDInput(isWatch: false); + })); + _roomInviteReceiveButton.onClick.Clear(); + _roomInviteReceiveButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + InviteGetListTask inviteGetListTask = new InviteGetListTask(); + inviteGetListTask.SetParameter(); + inviteGetListTask.SkipAllCuteResultCodeCheckErrorPopup(); + StartCoroutine(Toolbox.NetworkManager.Connect(inviteGetListTask, CreateInviteFriendDialog)); + })); + } + + protected void CreateInviteFriendDialog(NetworkTask.ResultCode inResultCode) + { + RoomInviteReceiveDialog component = UnityEngine.Object.Instantiate(_inviteReceveDialog).GetComponent(); + component.MyPageClass = base.Parent; + component.SetFriendList(); + } + + public void StartRoomIDInput(bool isWatch, ConventionInfo conventionInfo = null) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetTitleLabel(systemText.Get("RoomBattle_0006")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn); + dialogBase.onPushButton1 = delegate + { + RoomConnectController.InitializeParameter initializeParameter = new RoomConnectController.InitializeParameter((!isWatch) ? RoomConnectController.PositionMode.VISITOR : RoomConnectController.PositionMode.WATCHER, new BattleParameter(NetworkDefine.ServerBattleType.Free, Format.Max, TwoPickFormat.None, RoomConnectController.BattleRule.None, isOpenDeckRoom: false), _roomInput.InputID); + if (conventionInfo != null) + { + initializeParameter.IsEnableTurnSelect = conventionInfo.IsSelectableTurn; + initializeParameter.ConventionInfo = conventionInfo; + } + base.Parent.StartCoroutine(JoinRoom(initializeParameter, isInvite: false)); + }; + _roomInput = IDInput.Create(dialogBase.gameObject); + _roomInput.CurrentDialogBase = dialogBase; + _roomInput.InitInputID(5); + } + + public void SpecialWinRewardIconActive(bool active) + { + _rankMatchLayouts.SpecialWinRewardIcon.SetActive(active); + } + + public void RedrawBattleCampaign() + { + _battleCampaignClass.RedrawAfterSpecialWinRewardOpened(); + } + + public IEnumerator JoinRoom(RoomConnectController.InitializeParameter param, bool isInvite) + { + bool oldBackKeyEnable = GameMgr.GetIns().GetInputMgr().isBackKeyEnable; + base.TopBar.SetBackButtonEnable(enable: false); + _isStopSendMyPageRefreshTask = true; + yield return JoinRoomSub(param, isInvite); + _isStopSendMyPageRefreshTask = false; + base.TopBar.SetBackButtonEnable(oldBackKeyEnable); + } + + private IEnumerator JoinRoomSub(RoomConnectController.InitializeParameter param, bool isInvite) + { + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true); + GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.RoomBattle; + RoomConnectControllerInstance = new RoomConnectController(param); + yield return UIManager.GetInstance().StartCoroutine(RoomConnectControllerInstance.StartConnect()); + if (RoomConnectControllerInstance.ConnectRoomResultType == RoomConnectController.ConnectRoomResult.SUCCESS) + { + UIManager.GetInstance()._Footer.InviteIconDisp(inDisp: false); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Room); + } + else if (isInvite && Data.Load.data._receiveInviteCount <= 1 && !RoomConnectControllerInstance.IsEnterErrorDeckCount) + { + ClearInviteIcon(); + ShowRoomActionMenu(cutCardPanelAnimation: true); + _roomInviteMenuRoot.gameObject.SetActive(value: false); + } + UIManager.GetInstance().closeInSceneCenterLoading(); + } + + private void ClearInviteIcon() + { + if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.MyPage) + { + UIManager.GetInstance()._Footer.InviteIconDisp(inDisp: false); + _inviteIconCardPanel.SetActive(value: false); + _roomInviteIconOnJoinButton.SetActive(value: false); + base.Parent.RoomInviteClear(); + Data.Load.data._receiveInviteCount = 0; + } + } + + public void GoToFreeMatch() + { + ShowCardPanelMenu(); + RestoreCardPanelPosition(); + MoveCardPanelLeftPosition(_freeMatchCardPanel.gameObject); + ShowFreeMatchFormatSelect(isPlaySe: true); + base.CardAnimation.SkipMoveAnimation(); + } + + public void GoToRoomMatch() + { + ShowCardPanelMenu(); + RestoreCardPanelPosition(); + MoveCardPanelLeftPosition(_cardPanelRoomMatch); + ShowRoomActionMenu(cutCardPanelAnimation: true); + base.CardAnimation.SkipMoveAnimation(); + } + + public bool IsStopSendMyPageRefreshTask() + { + if (!_isStopSendMyPageRefreshTask) + { + if (RoomConnectControllerInstance != null) + { + return RoomConnectControllerInstance.IsExistNodeErrorDialog(); + } + return false; + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageItemCard.cs b/SVSim.BattleEngine/Engine/MyPageItemCard.cs new file mode 100644 index 0000000..2f58367 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageItemCard.cs @@ -0,0 +1,371 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard; + +public class MyPageItemCard : MyPageItem +{ + private enum DeckMenuType + { + Default, + WithDeckIntroduction, + CrossoverWithDeckIntroduction + } + + private readonly int DECK_MENU_TOP_BUTTON_POSITION_Y_PREROTATION = 145; + + private readonly int DECK_MENU_TOP_BUTTON_POSITION_Y = 49; + + [SerializeField] + private UIButton _deckButton; + + [SerializeField] + private UIButton _cardListButton; + + [SerializeField] + private GameObject _deckEditMenuRoot; + + [SerializeField] + private GameObject[] _deckEditMenuTypeRoots; + + [SerializeField] + private UIButton[] _deckUnlimitedButtons; + + [SerializeField] + private UIButton[] _deckRotationButtons; + + [SerializeField] + private UILabel[] _rotationPeriodLabel; + + [SerializeField] + private UIButton _deckPreRotationButton; + + [SerializeField] + private UIButton _deckCrossoverButton; + + [SerializeField] + private UIButton _deckMyRotationButton; + + [SerializeField] + private UIButton[] _deckIntroductionButtons; + + [SerializeField] + private GameObject _deckIntroductionPrefab; + + [SerializeField] + private Transform[] _firstTipsPositions; + + [SerializeField] + private UILabel _preReleaseTimeLimitLabel; + + private Effect _firstTipsEffect; + + private List _loadAssetList = new List(); + + private bool _tipsCrystalChanged; + + private DeckMenuType _deckMenuType; + + private const int CARD_INDEX_DECK = 0; + + private const int CARD_INDEX_CARD_LIST = 1; + + public override void Initialize(MyPageMenu parent) + { + base.Initialize(parent); + UIButton[] deckUnlimitedButtons = _deckUnlimitedButtons; + for (int i = 0; i < deckUnlimitedButtons.Length; i++) + { + deckUnlimitedButtons[i].onClick.Add(new EventDelegate(OnPushDeckEditUnlimited)); + } + deckUnlimitedButtons = _deckRotationButtons; + for (int i = 0; i < deckUnlimitedButtons.Length; i++) + { + deckUnlimitedButtons[i].onClick.Add(new EventDelegate(OnPushDeckEditRotation)); + } + deckUnlimitedButtons = _deckIntroductionButtons; + for (int i = 0; i < deckUnlimitedButtons.Length; i++) + { + deckUnlimitedButtons[i].onClick.Add(new EventDelegate(OnPushDeckIntroduction)); + } + _deckPreRotationButton.onClick.Add(new EventDelegate(OnClickDeckEditPreRotation)); + _deckCrossoverButton.onClick.Add(new EventDelegate(OnClickDeckEditCrossover)); + _deckMyRotationButton.onClick.Add(new EventDelegate(OnClickDeckEditMyRotation)); + InitializeRotationPeriodLabel(); + SaveDefaultPosition(_deckEditMenuRoot); + } + + public override void Show(bool skipCardAnimation = false) + { + base.Show(skipCardAnimation); + _deckEditMenuRoot.SetActive(value: false); + _deckCrossoverButton.gameObject.SetActive(IsEnableSpecialFormat(Format.Crossover)); + _deckMyRotationButton.gameObject.SetActive(IsEnableSpecialFormat(Format.MyRotation)); + _deckMenuType = GetDeckMenuType(); + SetupDeckMenuType(); + RestoreCardPanelPosition(); + StartCardPanelAppearAnimation(); + _deckButton.onClick.Clear(); + _deckButton.onClick.Add(new EventDelegate(delegate + { + OnPushDeckButton(); + })); + _cardListButton.onClick.Clear(); + _cardListButton.onClick.Add(new EventDelegate(delegate + { + OnPushCardListButton(); + })); + RestoreDefaultPosition(_deckEditMenuRoot); + switch (Prerelease.Status) + { + case Prerelease.eStatus.PRE_ROTATION: + _preReleaseTimeLimitLabel.text = Data.SystemText.Get("MyPage_0048", ConvertTime.ToLocal(Prerelease.Instance.EndTime)); + break; + case Prerelease.eStatus.DISPLAY_DECK_ONLY: + _preReleaseTimeLimitLabel.text = Data.SystemText.Get("MyPage_0070"); + break; + } + if (_deckMenuType == DeckMenuType.Default) + { + bool flag = Prerelease.Status != Prerelease.eStatus.NONE; + _deckPreRotationButton.gameObject.SetActive(flag); + int num = (flag ? DECK_MENU_TOP_BUTTON_POSITION_Y_PREROTATION : DECK_MENU_TOP_BUTTON_POSITION_Y); + UIButton[] deckRotationButtons = _deckRotationButtons; + foreach (UIButton obj in deckRotationButtons) + { + Vector3 localPosition = obj.transform.localPosition; + obj.transform.localPosition = new Vector3(localPosition.x, num, localPosition.z); + } + } + UIManager.GetInstance().CheckFirstTips(FirstTips.TipsType.Card); + } + + private void InitializeRotationPeriodLabel() + { + string shortName = Data.Master.CardSetNameMgr.Get(Data.Load.data.RotationFirstCardPackId.ToString()).ShortName; + string shortName2 = Data.Master.CardSetNameMgr.Get(Data.Load.data.RotationLatestCardPackId.ToString()).ShortName; + int num = Data.Load.data.RotationFirstCardPackId - 10000; + int num2 = Data.Load.data.RotationLatestCardPackId - 10000; + string text = Data.SystemText.Get("MyPage_0115", shortName, shortName2, num.ToString(), num2.ToString()); + UILabel[] rotationPeriodLabel = _rotationPeriodLabel; + for (int i = 0; i < rotationPeriodLabel.Length; i++) + { + rotationPeriodLabel[i].text = text; + } + } + + private void OnDisable() + { + if (_firstTipsEffect != null) + { + _firstTipsEffect.Stop(); + } + if (_tipsCrystalChanged) + { + _tipsCrystalChanged = false; + } + } + + private void OnPushDeckButton() + { + if (base.IsCardMoving) + { + return; + } + _deckMenuType = GetDeckMenuType(); + SetupDeckMenuType(); + base.Parent.SetDefaultBackButtonHandler(); + base.CardAnimation.OnClicked(0); + ShowDeckMenu(); + if (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.FIRST_TIPS_AFTER_ROTATION_USER_FLAG)) + { + if (FirstTips.IsFirstTipsOpen(FirstTips.TipsType.DeckAfterFormatUser)) + { + FirstTips.TipsType tipsType = FirstTips.TipsType.DeckAfterFormatUser; + FirstTips firstTips = UIManager.GetInstance().CheckFirstTips(tipsType); + if (firstTips != null) + { + firstTips.IsEnableBackKeyChange = false; + } + UIManager.SetObjectToGrey(base.TopBar.BuyCrystalButton.gameObject, b: true); + base.TopBar.BuyCrystalButton.isEnabled = false; + StartCoroutine(FirstTipsCoroutine(tipsType)); + FirstTips.SaveFinishFirstTips(FirstTips.TipsType.DeckBeforeFormatUser); + SetDeckTutorialMode(isTutorial: true); + } + } + else if (FirstTips.IsFirstTipsOpen(FirstTips.TipsType.DeckBeforeFormatUser)) + { + UIManager.GetInstance().CheckFirstTips(FirstTips.TipsType.DeckBeforeFormatUser); + } + _deckEditMenuRoot.SetActive(value: false); + _deckEditMenuRoot.SetActive(value: true); + } + + private IEnumerator FirstTipsCoroutine(FirstTips.TipsType type) + { + bool finishLoad = false; + _loadAssetList.AddRange(GameMgr.GetIns().GetEffectMgr().InitCommonEffect("Json/EffectTutorialData", isBattle: true, isField: false, isBattleEffect: false, delegate + { + finishLoad = true; + })); + while (FirstTips.IsFirstTipsOpen(type)) + { + yield return null; + } + while (!finishLoad) + { + yield return null; + } + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_Home_001_Title")); + dialogBase.SetText(Data.SystemText.Get("FirstTips_0035")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetPanelDepth(3000); + dialogBase.OnClose = delegate + { + Vector3 pos = _firstTipsPositions[(int)_deckMenuType].TransformPoint(0f, 0f, 0f); + _firstTipsEffect = GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_TUTORIAL_TAP_1, pos, MyPageItemSoroPlay.EFFECT_ROTATION); + _firstTipsEffect.Play(pos, MyPageItemSoroPlay.EFFECT_ROTATION); + _firstTipsEffect.transform.parent = _firstTipsPositions[(int)_deckMenuType]; + }; + } + + private void SetDeckTutorialMode(bool isTutorial) + { + Footer footer = UIManager.GetInstance()._Footer; + for (int i = 0; i < footer._underButtons.Length; i++) + { + footer.SetButtonEnableColorChange(i, !isTutorial); + } + UIButton[] deckUnlimitedButtons = _deckUnlimitedButtons; + for (int j = 0; j < deckUnlimitedButtons.Length; j++) + { + UIManager.SetObjectToGrey(deckUnlimitedButtons[j].gameObject, isTutorial); + } + deckUnlimitedButtons = _deckIntroductionButtons; + for (int j = 0; j < deckUnlimitedButtons.Length; j++) + { + UIManager.SetObjectToGrey(deckUnlimitedButtons[j].gameObject, isTutorial); + } + UIManager.SetObjectToGrey(_deckPreRotationButton.gameObject, isTutorial); + UIManager.SetObjectToGrey(_deckCrossoverButton.gameObject, isTutorial); + UIManager.SetObjectToGrey(_deckMyRotationButton.gameObject, isTutorial); + base.TopBar.SetBackButtonEnable(!isTutorial); + } + + private void SetupDeckMenuType() + { + foreach (DeckMenuType value in Enum.GetValues(typeof(DeckMenuType))) + { + GameObject gameObject = _deckEditMenuTypeRoots[(int)value]; + if (!(gameObject == null)) + { + gameObject.SetActive(value == _deckMenuType); + } + } + } + + private bool IsEnableSpecialFormat(Format format) + { + if (!DeckListUI.CheckSpecialFormatPeriod(format)) + { + return false; + } + return DeckListUtility.DeckGroupDataBaseClone().Any((DeckGroup deckgroup) => deckgroup.DeckFormat == format); + } + + private DeckMenuType GetDeckMenuType() + { + if (Prerelease.Status != Prerelease.eStatus.NONE) + { + return DeckMenuType.Default; + } + if (IsEnableSpecialFormat(Format.Crossover) || IsEnableSpecialFormat(Format.MyRotation)) + { + return DeckMenuType.CrossoverWithDeckIntroduction; + } + if (!Data.MyPage.data._bannerList.Any((MyPageBannerBase.BannerInfo info) => info.Click == "deck_intro_rotation" || info.Click == "deck_intro_unlimited")) + { + return DeckMenuType.Default; + } + return DeckMenuType.WithDeckIntroduction; + } + + private void OnPushCardListButton() + { + if (!base.IsCardMoving) + { + base.CardAnimation.OnClicked(1); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.CardAllList); + } + } + + private void ShowDeckMenu() + { + base.IsEnableFooterCurrentMenu = true; + base.Parent.SetBackButtonEnable(); + _deckButton.onClick.Clear(); + base.TopBar.SetTitleLabel(Data.SystemText.Get("MyPage_0014")); + MoveCardPanelLeftPosition(_deckButton.gameObject); + FadeOutCardPanelAndNonActive(_cardListButton.GetComponent()); + _deckEditMenuRoot.SetActive(value: true); + AppearAnimationFromRight(_deckEditMenuRoot); + } + + private void OnPushDeckEditUnlimited() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DeckListUI.ChangeSceneToDeckList(Format.Unlimited); + } + + private void OnPushDeckEditRotation() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DeckListUI.ChangeSceneToDeckList(Format.Rotation); + if (_firstTipsEffect != null) + { + UnityEngine.Object.Destroy(_firstTipsEffect.gameObject); + } + } + + private void OnClickDeckEditPreRotation() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DeckListUI.ChangeSceneToDeckList(Format.PreRotation); + } + + private void OnClickDeckEditCrossover() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DeckListUI.ChangeSceneToDeckList(Format.Crossover); + } + + private void OnClickDeckEditMyRotation() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DeckListUI.ChangeSceneToDeckList(Format.MyRotation); + } + + private void OnPushDeckIntroduction() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DeckIntroduction.Create(_deckIntroductionPrefab, base.gameObject, -1, Format.Rotation); + } + + public void GoToCardDeck() + { + ShowDeckMenu(); + } + + private void OnDestroy() + { + if (_loadAssetList.Count > 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadAssetList); + } + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageItemHome.cs b/SVSim.BattleEngine/Engine/MyPageItemHome.cs new file mode 100644 index 0000000..aeec28f --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageItemHome.cs @@ -0,0 +1,580 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; + +public class MyPageItemHome : MyPageItem +{ + private enum Notification + { + Info, + Max + } + + private const string TEXTURE_ROOM_CAMPAIGN = "campaign_banner_mypage"; + + public static readonly Vector3 TUTORIAL_OFFSET_FOOTER = new Vector3(0f, 19f, 0f); + + [SerializeField] + private GameObject _bannerPrefab; + + [SerializeField] + private GameObject _subBannerPrefab; + + private GameObject _bannerObject; + + private GameObject _subBannerObject; + + private MyPageBanner _banner; + + private MyPageSubBanner _subBanner; + + [SerializeField] + private UIButton _giftButton; + + [SerializeField] + private GameObject _giftNumberRoot; + + [SerializeField] + private UILabel _giftNumber; + + private int _giftCount; + + [SerializeField] + private UIButton _missionButton; + + [SerializeField] + private UILabel _missionNumberLabel; + + [SerializeField] + private UIButton _guildButton; + + [SerializeField] + private UILabel _guildNotificationLabel; + + [SerializeField] + private GameObject _cardDetailObj; + + [SerializeField] + private GameObject _contentsRoot; + + [SerializeField] + private UIButton _battlePassButton; + + [SerializeField] + private GameObject _homeDialogPrefab; + + [SerializeField] + private GameObject[] _customMyPageHideList; + + [SerializeField] + private GameObject[] _customMyPageOnlyList; + + [SerializeField] + private UIButton _bgCustomButton; + + [SerializeField] + private UIButton _hideUIButton; + + [SerializeField] + private GameObject[] _hideUIList; + + [SerializeField] + private UIButton _restoreUIButton; + + private MyPageHomeStatic _homeStatic; + + private const int GIFT_MAX_COUNT = 99; + + public const int MISSION_MAX_COUNT = 99; + + private bool _isFinishInitialize; + + private int _notificationMask; + + public GameObject ContentsRoot => _contentsRoot; + + public bool IsCustomMyPage => Data.MyPage.data.BGInfo.BGType != MyPageDetail.BGType.Deck; + + public void SetHomeStatic(MyPageHomeStatic homeDeck) + { + _homeStatic = homeDeck; + CreateBanner(); + } + + public override void Initialize(MyPageMenu parent) + { + base.Initialize(parent); + _giftButton.onClick.Add(new EventDelegate(delegate + { + OnPushGiftButton(); + })); + _missionButton.onClick.Add(new EventDelegate(delegate + { + OnPushMissionButton(); + })); + _guildButton.onClick.Add(new EventDelegate(delegate + { + OnPushGuildButton(); + })); + _battlePassButton.onClick.Add(new EventDelegate(delegate + { + OnPushBattlePassButton(); + })); + _bgCustomButton.onClick.Add(new EventDelegate(delegate + { + OnPushBGCustomButton(); + })); + _hideUIButton.onClick.Add(new EventDelegate(delegate + { + OnPushHideUIButton(); + })); + _restoreUIButton.onClick.Add(new EventDelegate(delegate + { + OnPushRestoreUIButton(); + })); + _guildNotificationLabel.gameObject.SetActive(value: false); + } + + public override void OnMyPageInfoReceive() + { + base.OnMyPageInfoReceive(); + _bannerObject.GetComponent().CreateMyPageBanner(); + _subBanner.CreateMyPageBanner(); + UpdateGuildNotification(); + UpdateMissionNumber(); + _giftCount = Data.MyPage.data.unread_mail_count; + SetUnreadGiftCount(_giftCount); + UIManager.GetInstance().StartCoroutine(WaitForTreasureBoxCpRewardDialogClosed(delegate + { + CheckNotify(delegate + { + CheckHomeDialog(); + }); + })); + UpdateMaintenance(); + } + + private IEnumerator WaitForTreasureBoxCpRewardDialogClosed(Action onFinish) + { + while (!base.Parent._treasureBoxCpRewardDialogClosed) + { + yield return null; + } + onFinish.Call(); + } + + public override void Show(bool skipCardAnimation = false) + { + base.Show(skipCardAnimation); + _contentsRoot.SetActive(value: true); + if (!IsCustomMyPage) + { + _homeStatic.Show(); + } + _hideUIButton.gameObject.SetActive(IsCustomMyPage); + _restoreUIButton.gameObject.SetActive(value: false); + _bannerObject.SetActive(!base.Parent.IsFirstGuid); + _subBannerObject.SetActive(!base.Parent.IsFirstGuid); + _bgCustomButton.gameObject.SetActive(Data.Load.data.AcquiredMyPageBGList.Count > 0); + UpdateMaintenance(); + CheckShopTutorial(); + OnUpdateCustomMyPageEnable(isHomeActive: true); + } + + public void OnUpdateCustomMyPageEnable(bool isHomeActive) + { + _hideUIButton.gameObject.SetActive(IsCustomMyPage); + if (isHomeActive && IsCustomMyPage) + { + _banner.Show(); + _subBanner.Show(); + } + else + { + CommonBackGround.Instance.EffectVisible = true; + } + GameObject[] customMyPageHideList = _customMyPageHideList; + foreach (GameObject gameObject in customMyPageHideList) + { + if (gameObject != null) + { + gameObject.SetActive(!IsCustomMyPage); + } + } + customMyPageHideList = _customMyPageOnlyList; + foreach (GameObject gameObject2 in customMyPageHideList) + { + if (gameObject2 != null) + { + gameObject2.SetActive(IsCustomMyPage); + } + } + if (_homeStatic != null && _homeStatic.CardLoadFinish) + { + _homeStatic.SetActive(!IsCustomMyPage && isHomeActive); + } + if (!(base.Parent.CustomBGControl != null)) + { + return; + } + base.Parent.CustomBGControl.SetEnable(IsCustomMyPage && isHomeActive); + if (!(IsCustomMyPage && isHomeActive)) + { + return; + } + base.Parent.CustomBGControl.Show(delegate + { + if (isHomeActive && IsCustomMyPage) + { + CommonBackGround.Instance.EffectVisible = false; + } + }); + } + + private void CheckShopTutorial() + { + if (Data.Load.data._userTutorial.TutorialStep == 41) + { + DialogBase dialogBase = MyPageMenu.CreateDialogForTutorial(); + dialogBase.SetText(Data.SystemText.Get("Tutorial_0012")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + base.Parent.SetGuideToOkOnlyDialog(dialogBase); + UIManager.SetObjectToGrey(_giftButton.gameObject, b: true); + UIManager.SetObjectToGrey(_missionButton.gameObject, b: true); + UIManager.SetObjectToGrey(_guildButton.gameObject, b: true); + UIManager.SetObjectToGrey(_battlePassButton.gameObject, b: true); + UIManager.SetObjectToGrey(_bgCustomButton.gameObject, b: true); + _homeStatic.SetTutorialMode(); + dialogBase.OnClose = delegate + { + Footer footer = UIManager.GetInstance()._Footer; + base.Parent.SetGuideEffect(footer._underButtons[5].transform, TUTORIAL_OFFSET_FOOTER, 180f); + }; + } + } + + public override void Hide() + { + base.Hide(); + _homeStatic.Hide(); + base.gameObject.SetActive(value: true); + _contentsRoot.SetActive(value: false); + } + + private void UpdateMaintenance() + { + if (!base.Parent.IsFirstGuid) + { + bool b = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GIFT_MAINTENANCE); + bool b2 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.MISSION_MAINTENANCE); + bool b3 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GUILD_MAINTENANCE); + UIManager.SetObjectToGrey(_giftButton.gameObject, b); + UIManager.SetObjectToGrey(_missionButton.gameObject, b2); + UIManager.SetObjectToGrey(_guildButton.gameObject, b3); + bool flag = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.BATTLE_PASS); + bool flag2 = !Data.IsBattlePassPeriod; + UIManager.SetObjectToGrey(_battlePassButton.gameObject, flag || flag2); + } + } + + public void OnReadGift() + { + _giftCount--; + SetUnreadGiftCount(_giftCount); + } + + private void CheckNotify(Action onFinish) + { + if (!_contentsRoot.activeSelf || Data.Load.data._userTutorial.TutorialStep != 100) + { + return; + } + DateTime last_announce_time = Data.MyPage.data.last_announce_time; + if (last_announce_time > GameMgr.GetIns().AnnounceTime) + { + GameMgr.GetIns().AnnounceTime = last_announce_time; + _notificationMask |= 1; + if (_notificationMask != 0) + { + StartCoroutine(ShowNextNotification(onFinish)); + } + } + else + { + onFinish.Call(); + } + } + + private void CheckHomeDialog() + { + MyPageHomeDialogData myPageHomeDialogData = Data.MyPage.data.MyPageHomeDialogData; + if (myPageHomeDialogData.IsEnable) + { + MyPageHomeDialog.Create(_homeDialogPrefab, myPageHomeDialogData, null); + } + } + + private IEnumerator ShowNextNotification(Action onFinish) + { + while (UIManager.GetInstance().isFading() || UIManager.GetInstance().isOpenDialog()) + { + yield return null; + } + if (_notificationMask == 0) + { + yield break; + } + int i; + for (i = 0; (_notificationMask & (1 << i)) == 0; i++) + { + } + _notificationMask ^= 1 << i; + DialogBase dialogBase = null; + if (1 == 0) + { + yield break; + } + if (_notificationMask != 0 && dialogBase != null) + { + dialogBase.OnClose = delegate + { + StartCoroutine(ShowNextNotification(onFinish)); + }; + } + else + { + onFinish.Call(); + } + } + + public void OnMyPageFadeOpen(bool isHomeActive) + { + OnUpdateCustomMyPageEnable(isHomeActive); + _restoreUIButton.gameObject.SetActive(value: false); + } + + private void Update() + { + if (!_isFinishInitialize && _homeStatic.CardLoadFinish) + { + _isFinishInitialize = true; + GameObject obj = _giftButton.gameObject.transform.parent.gameObject; + bool activeSelf = obj.activeSelf; + obj.SetActive(value: false); + obj.SetActive(value: true); + obj.SetActive(activeSelf); + } + } + + private void OnPushGiftButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + MailTopTask mailTopTask = GameMgr.GetIns().GetMailTopTask(); + mailTopTask.SetParameter(Data.Load.data._userTutorial.TutorialStep != 100); + StartCoroutine(Toolbox.NetworkManager.Connect(mailTopTask, OnRequestGift)); + } + + private void OnRequestGift(NetworkTask.ResultCode error) + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Mail); + } + + private void OnPushMissionButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + MissionInfoTask missionInfoTask = GameMgr.GetIns().GetMissionInfoTask(); + missionInfoTask.SetParameter(); + StartCoroutine(Toolbox.NetworkManager.Connect(missionInfoTask, OpenMission)); + } + + private void OpenMission(NetworkTask.ResultCode error) + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Mission); + } + + public void UpdateMissionNumber() + { + if (!(_missionNumberLabel.gameObject == null)) + { + int unreceived_mission_reward_count = Data.MyPage.data.unreceived_mission_reward_count; + _missionNumberLabel.gameObject.SetActive(unreceived_mission_reward_count > 0); + _missionNumberLabel.text = unreceived_mission_reward_count.ToString(); + if (unreceived_mission_reward_count > 99) + { + _missionNumberLabel.text = 99 + "+"; + } + else + { + _missionNumberLabel.text = unreceived_mission_reward_count.ToString(); + } + } + } + + private void OnPushBattlePassButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.BattlePass); + } + + private void OnPushBGCustomButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + MyPageBGCustomDialog.Create(OnDecideMyPageBG); + } + + private void OnPushHideUIButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ToggleUIVisible(visible: false); + } + + private void OnPushRestoreUIButton() + { + ToggleUIVisible(visible: true); + } + + private void ToggleUIVisible(bool visible) + { + GameObject[] hideUIList = _hideUIList; + foreach (GameObject gameObject in hideUIList) + { + if (gameObject != null) + { + gameObject.SetActive(visible); + } + } + base.Parent.TopBar.gameObject.SetActive(visible); + UIManager.GetInstance()._Footer.ShowFooterMenu(visible); + _restoreUIButton.gameObject.SetActive(!visible); + } + + public void OnDecideMyPageBG(MyPageDetail.BGType bgType, string selectId, List randomIdList) + { + if (bgType == MyPageDetail.BGType.RandomBG) + { + selectId = DecideRandomBG(randomIdList); + } + base.Parent.ChangeMyPageBG(bgType, selectId); + } + + public static string DecideRandomBG(List randomIdList) + { + System.Random random = new System.Random(); + return randomIdList[random.Next(0, randomIdList.Count)]; + } + + public void ShowBanner() + { + if (Data.Load.data._userTutorial.TutorialStep == 100) + { + _banner.Show(); + _subBanner.Show(); + } + } + + public void HideBanner() + { + _banner.Hide(); + _subBanner.Hide(); + } + + private void CreateBanner() + { + _bannerObject = NGUITools.AddChild(_contentsRoot, _bannerPrefab); + _banner = _bannerObject.GetComponent(); + _homeStatic.Initialize(); + _subBannerObject = NGUITools.AddChild(_contentsRoot, _subBannerPrefab); + _subBanner = _subBannerObject.GetComponent(); + _banner._isFirstTips = false; + _subBanner._isFirstTips = false; + } + + private void OnPushGuildButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Guild); + } + + private void UpdateGuildNotification() + { + _guildNotificationLabel.gameObject?.SetActive(IsGuildNotification()); + } + + private bool IsGuildNotification() + { + GuildNotification guildNotification = Data.MyPageNotifications.data.GuildNotification; + if (!guildNotification.GuildId.HasValue) + { + return guildNotification.IsInvited; + } + if (guildNotification.GuildId.Value != PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.JOINING_GUILD_ID)) + { + return true; + } + if (guildNotification.GuildRoomMessageId.HasValue && guildNotification.GuildRoomMessageId.Value > PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.READ_LATEST_GUILD_CHAT_MESSAGE_ID)) + { + return true; + } + if (guildNotification.IsJoinRequest) + { + return true; + } + return false; + } + + public void SetFirstTips() + { + _banner._isFirstTips = true; + _banner.SetActive(inActive: false); + _subBanner._isFirstTips = true; + _subBanner.SetActive(inActive: false); + _homeStatic.SetTutorialMode(); + } + + public void SetGuideEffectToGiftButton() + { + base.Parent.SetGuideEffect(_giftButton.transform, new Vector3(-14f, 0f, 0f), -90f); + } + + public void SetGiftReceiveTutorialMode() + { + UIManager.SetObjectToGrey(_missionButton.gameObject, b: true); + UIManager.SetObjectToGrey(_guildButton.gameObject, b: true); + UIManager.SetObjectToGrey(_battlePassButton.gameObject, b: true); + UIManager.SetObjectToGrey(_bgCustomButton.gameObject, b: true); + } + + public void FinishFirstTips() + { + UIManager.SetObjectToGrey(_giftButton.gameObject, b: false); + UIManager.SetObjectToGrey(_missionButton.gameObject, b: false); + UIManager.SetObjectToGrey(_guildButton.gameObject, b: false); + UIManager.SetObjectToGrey(_battlePassButton.gameObject, b: false); + UIManager.SetObjectToGrey(_bgCustomButton.gameObject, b: false); + _homeStatic.FinishFirstTips(); + } + + public void SetUnreadGiftCount(int count) + { + if (!(_giftNumberRoot.gameObject == null)) + { + _giftNumberRoot.gameObject.SetActive(count > 0); + if (count > 99) + { + _giftNumber.text = 99 + "+"; + } + else + { + _giftNumber.text = count.ToString(); + } + } + } + + public void HideAndRepositionSubBanner(string click) + { + _subBanner.HideAndRepositionBanner(click); + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageItemShop.cs b/SVSim.BattleEngine/Engine/MyPageItemShop.cs new file mode 100644 index 0000000..8067eaa --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageItemShop.cs @@ -0,0 +1,443 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; + +public class MyPageItemShop : MyPageItem +{ + private const float SET_ACTIVE_APPEAL_OBJ_DELAY_TIME = 0.15f; + + [SerializeField] + private ShopSupplyCardPanel _supplyCardPanel; + + [SerializeField] + private ShopPanelAppealItem _supplyAppealItem; + + [SerializeField] + private MyPageCardPanel _cardPackCardPanel; + + [SerializeField] + private ShopPanelAppealItem _cardPackAppealItem; + + [SerializeField] + private MyPageCardPanel _crystalCardPanel; + + [SerializeField] + private UIButton _supplyButton; + + [SerializeField] + private UIButton _buyCardSleeveButton; + + [SerializeField] + private ShopPanelAppealItem _sleeveAppealItem; + + [SerializeField] + private UIButton _buyLeaderSkinButton; + + [SerializeField] + private ShopPanelAppealItem _skinAppealItem; + + [SerializeField] + private UIButton _buyItemButton; + + [SerializeField] + private DialogItemPurchase _itemPurchaseDialog; + + [SerializeField] + private SpotCardExchangeDialog _dialogSpotCardExchange; + + [SerializeField] + private GameObject _supplyMenuRoot; + + [SerializeField] + private UIButton _cardButton; + + [SerializeField] + private GameObject _cardMenuRoot; + + [SerializeField] + private UIButton _buyCardPackButton; + + [SerializeField] + private ShopPanelAppealItem _packAppealItem; + + [SerializeField] + private UIButton _buyDeckButton; + + [SerializeField] + private ShopPanelAppealItem _deckAppealItem; + + [SerializeField] + private UIButton _exchangeSpotCardButton; + + [SerializeField] + private GameObject _cardPackMenuRoot; + + [SerializeField] + private UIButton _crystalButton; + + [SerializeField] + private UILabel _supplyMaintenanceBaseLabel; + + [SerializeField] + private MyPageShopCrystalApeal _crystalAppeal; + + [SerializeField] + private GameObject _cardBuyCampaignRoot; + + [SerializeField] + private UILabel _cardBuyCampaignLabel; + + private CardPanelMaintenancePlate _buyCardSleeveMaintenancePlate; + + private CardPanelMaintenancePlate _buyLeaderSkinMaintenancePlate; + + private CardPanelMaintenancePlate _buyItemMaintenancePlate; + + private CardPanelMaintenancePlate _buyCardPackMaintenancePlate; + + private CardPanelMaintenancePlate _buyBuildDeckMaintenancePlate; + + private CardPanelMaintenancePlate _exchangeSpotCardMaintenancePlate; + + private const string SLEEVE_BTN_SPRITE_NAME_BASE = "btn_supply_sleeve"; + + private const string SKIN_BTN_SPRITE_NAME_BASE = "btn_supply_skin"; + + private List _shopCardPanelResource = new List(); + + private const int CARD_INDEX_SUPPLY = 0; + + private const int CARD_INDEX_CARD = 1; + + private const int CARD_INDEX_CRYSTAL = 2; + + private bool IsSpecialSleeveMode => Data.MyPageNotifications.data.ShopNotification.AppealSleeve.IsCollaborationPanel; + + private bool IsSpecialSkinMode => Data.MyPageNotifications.data.ShopNotification.AppealLeaderSkin.IsCollaborationPanel; + + public MyPageShopCrystalApeal CrystalAppeal => _crystalAppeal; + + private bool IsTutorial => Data.Load.data._userTutorial.TutorialStep == 41; + + public override void Initialize(MyPageMenu parent) + { + base.Initialize(parent); + _buyCardSleeveButton.onClick.Add(new EventDelegate(delegate + { + OnPushBuyCardSleeve(); + })); + _buyLeaderSkinButton.onClick.Add(new EventDelegate(delegate + { + OnPushBuyLeaderSkin(); + })); + _buyItemButton.onClick.Add(new EventDelegate(delegate + { + OnPushBuyItem(); + })); + _buyCardPackButton.onClick.Add(new EventDelegate(delegate + { + OnPusBuyCardPack(); + })); + _buyDeckButton.onClick.Add(new EventDelegate(delegate + { + OnPushBuyBuildDeck(); + })); + _exchangeSpotCardButton.onClick.Add(new EventDelegate(delegate + { + OnPushExchangeSpotCard(); + })); + SaveDefaultPosition(_cardPackMenuRoot); + SaveDefaultPosition(_cardPackMenuRoot); + SaveDefaultPosition(_supplyMenuRoot); + } + + public override void Show(bool skipCardAnimation = false) + { + base.Show(skipCardAnimation); + _supplyMenuRoot.SetActive(value: false); + _cardPackMenuRoot.SetActive(value: false); + RestoreCardPanelPosition(); + StartCardPanelAppearAnimation(); + _supplyButton.onClick.Clear(); + _supplyButton.onClick.Add(new EventDelegate(delegate + { + OnPushSupplyButton(); + })); + _cardButton.onClick.Clear(); + _cardButton.onClick.Add(new EventDelegate(delegate + { + OnPushCardButton(); + })); + RestoreDefaultPosition(_cardPackMenuRoot); + RestoreDefaultPosition(_supplyMenuRoot); + if (IsTutorial) + { + SetTutorial(); + UIManager.GetInstance()._Footer.SetButtonEnableColorChange(5, btnIsEnable: false); + } + ShowCardPanelAppeal(); + UIManager.GetInstance().StartCoroutine(_crystalCardPanel.DisablePanel(Data.SystemText.Get("System_0074"))); + UIManager.GetInstance().StartCoroutine(LoadCardPanelCoroutine()); + } + + private IEnumerator LoadCardPanelCoroutine() + { + ShopNotification shopNotification = Data.MyPageNotifications.data.ShopNotification; + bool flag = shopNotification.AppealSleeve.IsCollaborationPanel || shopNotification.AppealLeaderSkin.IsCollaborationPanel; + if ((flag && !_supplyCardPanel.IsLoadedSpecialCardPanelResource) || (!flag && !_supplyCardPanel.IsLoadedDefaultCardPanelResource)) + { + _shopCardPanelResource.Add(_supplyCardPanel.GetResourcePath(isfetch: false)); + yield return Toolbox.ResourcesManager.LoadAssetGroupSync(_shopCardPanelResource, null); + _supplyCardPanel.AttachCardPanelTexture(); + } + } + + private void OnDestroy() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_shopCardPanelResource); + _shopCardPanelResource.Clear(); + } + + public override void OnMyPageInfoReceive() + { + base.OnMyPageInfoReceive(); + if (IsTutorial) + { + SetTutorial(); + } + } + + private void SetCardPanelTutorialMode() + { + UIManager.SetObjectToGrey(_supplyCardPanel.gameObject, b: true); + UIManager.SetObjectToGrey(_crystalButton.gameObject, b: true); + } + + private void SetTutorial() + { + SetCardPanelTutorialMode(); + UIManager.SetObjectToGrey(base.TopBar.BackButton.gameObject, b: true); + UIManager.SetObjectToGrey(base.TopBar.BuyCrystalButton.gameObject, b: true); + base.TopBar.BuyCrystalButton.isEnabled = false; + Footer footer = UIManager.GetInstance()._Footer; + for (int i = 0; i < footer._underButtons.Length; i++) + { + if (i == 5) + { + footer.SetButtonEnableColorChange(i, !base.gameObject.activeInHierarchy); + } + else + { + footer.SetButtonEnableColorChange(i, btnIsEnable: false); + } + } + if (base.gameObject.activeInHierarchy) + { + base.Parent.SetGuideEffect(_cardPackCardPanel.transform, new Vector3(-40f, 0f, 0f), -45f); + } + } + + private void OnPushCardButton() + { + if (!base.IsCardMoving) + { + base.Parent.SetDefaultBackButtonHandler(); + base.CardAnimation.OnClicked(1); + ShowCardMenu(); + if (IsTutorial) + { + base.Parent.SetGuideEffect(_buyCardPackButton.transform, Vector3.zero, -45f); + } + } + } + + private void OnPushSupplyButton() + { + if (!IsTutorial && !base.IsCardMoving) + { + base.Parent.SetDefaultBackButtonHandler(); + ShowSupplyMenu(); + base.CardAnimation.OnClicked(0); + } + } + + private void ShowSupplyMenu() + { + base.IsEnableFooterCurrentMenu = true; + base.Parent.SetBackButtonEnable(); + _supplyButton.onClick.Clear(); + base.TopBar.SetTitleLabel(Data.SystemText.Get("MyPage_0017")); + SetSpriteSpecialBtn(_buyCardSleeveButton, "btn_supply_sleeve", IsSpecialSleeveMode); + SetSpriteSpecialBtn(_buyLeaderSkinButton, "btn_supply_skin", IsSpecialSkinMode); + _supplyAppealItem.DelaySetActiveAppealObj(isActive: false, 0.15f); + MoveCardPanelLeftPosition(_supplyCardPanel.gameObject); + FadeOutCardPanelAndNonActive(_cardPackCardPanel); + FadeOutCardPanelAndNonActive(_crystalCardPanel); + _supplyMenuRoot.SetActive(value: true); + AppearAnimationFromRight(_supplyMenuRoot); + bool isMaintenance = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.SHOP_SLEEVE_MAINTENANCE); + bool isMaintenance2 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.SHOP_SKIN_MAINTENANCE); + bool isMaintenance3 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.SHOP_ITEM_MAINTENANCE); + _buyCardSleeveMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance, _buyCardSleeveButton, _buyCardSleeveMaintenancePlate, _supplyMaintenanceBaseLabel.depth); + _buyLeaderSkinMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance2, _buyLeaderSkinButton, _buyLeaderSkinMaintenancePlate, _supplyMaintenanceBaseLabel.depth); + _buyItemMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance3, _buyItemButton, _buyItemMaintenancePlate, _supplyMaintenanceBaseLabel.depth); + } + + private void SetSpriteSpecialBtn(UIButton button, string buttonSpriteNameBase, bool isSpecial) + { + button.normalSprite = (isSpecial ? (buttonSpriteNameBase + "_special") : buttonSpriteNameBase); + } + + public void GoToShopSupply() + { + ShowSupplyMenu(); + } + + public void GoToShopCard() + { + ShowCardMenu(); + } + + private void OnPushBuyCardSleeve() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.CardSleevePurchasePage); + } + + private void OnPushBuyLeaderSkin() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.ClassSkinPurchasePage); + } + + private void OnPushBuyItem() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + _itemPurchaseDialog.CreateItemPurcahseDialog(); + } + + private void ShowCardMenu() + { + if (!IsTutorial) + { + base.IsEnableFooterCurrentMenu = true; + } + base.Parent.SetBackButtonEnable(); + _cardButton.onClick.Clear(); + base.TopBar.SetTitleLabel(Data.SystemText.Get("MyPage_0016")); + _cardPackAppealItem.DelaySetActiveAppealObj(isActive: false, 0.15f); + RestoreCardPanelPosition(); + MoveCardPanelLeftPosition(_cardPackCardPanel.gameObject); + FadeOutCardPanelAndNonActive(_supplyCardPanel); + FadeOutCardPanelAndNonActive(_crystalCardPanel); + _cardPackMenuRoot.SetActive(value: true); + AppearAnimationFromRight(_cardPackMenuRoot); + bool isMaintenance = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.SHOP_CARDPACK_MAINTENANCE); + bool isMaintenance2 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.SHOP_BUILDDECK_MAINTENANCE); + bool isMaintenance3 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.SPOTCARD_EXCHANGE); + _buyCardPackMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance, _buyCardPackButton, _buyCardPackMaintenancePlate, _supplyMaintenanceBaseLabel.depth); + _buyBuildDeckMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance2, _buyDeckButton, _buyBuildDeckMaintenancePlate, _supplyMaintenanceBaseLabel.depth); + _exchangeSpotCardMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance3, _exchangeSpotCardButton, _exchangeSpotCardMaintenancePlate, _supplyMaintenanceBaseLabel.depth); + if (IsTutorial) + { + UIManager.SetObjectToGrey(_buyDeckButton.gameObject, b: true); + UIManager.SetObjectToGrey(_exchangeSpotCardButton.gameObject, b: true); + SetCardPanelTutorialMode(); + } + } + + private void OnPusBuyCardPack() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Gacha, null, new GachaUIParam()); + if (IsTutorial) + { + base.Parent.SetGuideEffect(base.Parent.transform, Vector3.zero, 0f); + base.Parent.FirstGuidEffect.gameObject.SetActive(value: false); + } + } + + private void OnPushBuyBuildDeck() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.BuildDeckPurchasePage); + } + + private void OnPushExchangeSpotCard() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + _dialogSpotCardExchange.CreateSpotCardExchangeDialog(); + } + + private void OnPushBuyCrystal() + { + } + + private void ShowCardPanelAppeal() + { + if (IsTutorial) + { + _supplyAppealItem.SetActiveAppealObj(isActive: false); + _cardPackAppealItem.SetActiveAppealObj(isActive: false); + _sleeveAppealItem.SetActiveAppealObj(isActive: false); + _skinAppealItem.SetActiveAppealObj(isActive: false); + _packAppealItem.SetActiveAppealObj(isActive: false); + _deckAppealItem.SetActiveAppealObj(isActive: false); + _crystalAppeal.gameObject.SetActive(value: false); + _cardBuyCampaignRoot.SetActive(value: false); + return; + } + bool flag = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.SHOP_SLEEVE_MAINTENANCE); + bool flag2 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.SHOP_SKIN_MAINTENANCE); + bool flag3 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.SHOP_CARDPACK_MAINTENANCE); + bool flag4 = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.SHOP_BUILDDECK_MAINTENANCE); + ShopNotification shopNotification = Data.MyPageNotifications.data.ShopNotification; + ShopNotification.ShopAppealInfo appeal = PriorizeAppealInfo(new List { shopNotification.AppealSleeve, shopNotification.AppealLeaderSkin }); + _supplyAppealItem.SetAppeal(appeal); + ShopNotification.ShopAppealInfo appeal2 = PriorizeAppealInfo(new List { shopNotification.AppealCardPack, shopNotification.AppealBuildDeck }); + _cardPackAppealItem.SetAppeal(appeal2); + _sleeveAppealItem.SetAppeal(shopNotification.AppealSleeve); + _skinAppealItem.SetAppeal(shopNotification.AppealLeaderSkin); + _packAppealItem.SetAppeal(shopNotification.AppealCardPack); + _deckAppealItem.SetAppeal(shopNotification.AppealBuildDeck); + _supplyAppealItem.SetActiveAppealObj(!flag && !flag2); + _cardPackAppealItem.SetActiveAppealObj(!flag3 && !flag4); + _sleeveAppealItem.SetActiveAppealObj(!flag); + _skinAppealItem.SetActiveAppealObj(!flag2); + _packAppealItem.SetActiveAppealObj(!flag3); + _deckAppealItem.SetActiveAppealObj(!flag4); + if (!flag3 && Prerelease.Status == Prerelease.eStatus.PRE_ROTATION) + { + _cardBuyCampaignRoot.SetActive(value: true); + _cardBuyCampaignLabel.text = Data.SystemText.Get("MyPage_0048", ConvertTime.ToLocal(Prerelease.Instance.EndTime)); + _cardPackAppealItem.SetActiveAppealObj(isActive: false); + } + else + { + _cardBuyCampaignRoot.SetActive(value: false); + } + _crystalAppeal.gameObject.SetActive(value: false); + } + + private ShopNotification.ShopAppealInfo PriorizeAppealInfo(List appealInfoList) + { + List list = appealInfoList.FindAll((ShopNotification.ShopAppealInfo info) => info.NeedsCampaignDisplay); + if (list.Count > 0) + { + return list[0]; + } + List list2 = appealInfoList.FindAll((ShopNotification.ShopAppealInfo info) => info.RemainTime != null); + if (list2.Count > 0) + { + return list2.FindMin((ShopNotification.ShopAppealInfo info) => info.RemainTime.Second); + } + ShopNotification.ShopAppealInfo shopAppealInfo = appealInfoList.Find((ShopNotification.ShopAppealInfo info) => info.IsNew); + if (shopAppealInfo == null) + { + return new ShopNotification.ShopAppealInfo(); + } + return shopAppealInfo; + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageItemSoroPlay.cs b/SVSim.BattleEngine/Engine/MyPageItemSoroPlay.cs new file mode 100644 index 0000000..feed2aa --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageItemSoroPlay.cs @@ -0,0 +1,244 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Story; + +public class MyPageItemSoroPlay : MyPageItem +{ + private readonly Vector3 CARD_POS_LEFT = new Vector3(-203f, 0f, 0f); + + private readonly Vector3 CARD_POS_RIGHT = new Vector3(203f, 0f, 0f); + + private readonly Vector3 CARD_POS_QUEST_EXIST_LEFT = new Vector3(-367f, 0f, 0f); + + private readonly Vector3 CARD_POS_QUEST_EXIST_CENTER = new Vector3(0f, 20f, 0f); + + private readonly Vector3 CARD_POS_QUEST_EXIST_RIGHT = new Vector3(367f, 0f, 0f); + + [SerializeField] + private UIButton _storyButton; + + [SerializeField] + private UIButton _practiceButton; + + [SerializeField] + private UIButton _questButton; + + [SerializeField] + private StoryCardPanel _storyCardPanel; + + [SerializeField] + private MyPageCardPanel _practiceCardPanel; + + [SerializeField] + private GameObject _practiceTypeSelectRoot; + + [SerializeField] + private UIButton _practiceBattleButton; + + [SerializeField] + private UIButton _practiceBattlePazzle; + + [SerializeField] + private UILabel _practiceTypePuzzleLabel; + + [SerializeField] + private MyPageCardPanel _questCardPanel; + + [SerializeField] + private GameObject _questExtraIcon; + + [SerializeField] + private GameObject _questBand; + + [SerializeField] + private UILabel _questBandLabel; + + [SerializeField] + private GameObject _questEndTimeRoot; + + [SerializeField] + private UILabel _questEndTimeLabel; + + [SerializeField] + private GameObject _practiceBadge; + + [SerializeField] + private GameObject _puzzleBadge; + + public static readonly Quaternion EFFECT_ROTATION = Quaternion.Euler(0f, 0f, -38f); + + private CardPanelMaintenancePlate _puzzleMaintenancePlate; + + private void Start() + { + _storyButton.onClick.Add(new EventDelegate(delegate + { + OnPushMainStory(); + })); + _questButton.onClick.Add(new EventDelegate(delegate + { + OnPushQuest(); + })); + _practiceBattleButton.onClick.Add(new EventDelegate(delegate + { + OnClickPracticeTypeBattle(); + })); + _practiceBattlePazzle.onClick.Add(new EventDelegate(delegate + { + OnClickPracticeTypePuzzle(); + })); + } + + public override void Initialize(MyPageMenu parent) + { + base.Initialize(parent); + SaveDefaultPosition(_practiceTypeSelectRoot); + } + + public override void Show(bool skipCardAnimation = false) + { + base.Show(skipCardAnimation); + SetCardPanelAnimation(); + StartCardPanelAppearAnimation(); + _practiceButton.onClick.Clear(); + _practiceButton.onClick.Add(new EventDelegate(delegate + { + OnPushPractive(); + })); + UpdateQuestBadgeIcon(); + _questBandLabel.text = Data.MyPageNotifications.data.QuestOpenInfo.QuestPanelBandText; + _questBand.SetActive(value: true); + _questEndTimeRoot.SetActive(value: true); + _practiceTypeSelectRoot.SetActive(value: false); + _storyCardPanel.DispAppealRibbon(Data.MyPageNotifications.data.StoryNotification.IsDisplayRibbon); + _storyCardPanel.DispAppealBadge(Data.MyPageNotifications.data.StoryNotification.IsDisplayBadge); + _practiceBadge.SetActive(Data.MyPageNotifications.data.IsPracticePuzzleBadgeEnable); + _puzzleBadge.SetActive(Data.MyPageNotifications.data.IsPracticePuzzleBadgeEnable); + UIManager.GetInstance().CheckFirstTips(FirstTips.TipsType.SoroPlay2); + } + + private void SetCardPanelAnimation() + { + for (int i = 0; i < base.CardPanelList.Length; i++) + { + MyPageCardPanel obj = base.CardPanelList[i]; + obj.gameObject.SetActive(value: true); + obj.EffectActive = false; + obj.EffectActive = true; + obj.CheckMaintenanceType(); + } + if (Data.MyPageNotifications.data.QuestOpenInfo.IsOpen) + { + _questCardPanel.gameObject.SetActive(value: true); + _storyCardPanel.transform.localPosition = CARD_POS_QUEST_EXIST_LEFT; + _questCardPanel.transform.localPosition = CARD_POS_QUEST_EXIST_CENTER; + _practiceCardPanel.transform.localPosition = CARD_POS_QUEST_EXIST_RIGHT; + _questEndTimeLabel.text = Data.SystemText.Get("MyPage_0048", ConvertTime.ToLocal(Data.MyPageNotifications.data.QuestOpenInfo.EndTime)); + } + else + { + _questCardPanel.gameObject.SetActive(value: false); + _storyCardPanel.transform.localPosition = CARD_POS_LEFT; + _practiceCardPanel.transform.localPosition = CARD_POS_RIGHT; + } + List list = new List(); + for (int j = 0; j < base.CardPanelList.Length; j++) + { + MyPageCardPanel myPageCardPanel = base.CardPanelList[j]; + if (myPageCardPanel.isActiveAndEnabled) + { + list.Add(myPageCardPanel.gameObject); + } + } + SaveCardPanelDefaultPosition(); + base.CardAnimation.PanelClear(); + base.CardAnimation.SetCardPanelList(list.ToArray()); + base.CardAnimation.SetCardPanelAngle(); + } + + private void OnPushMainStory() + { + if (!base.IsCardMoving) + { + base.CardAnimation.OnClicked(_storyCardPanel.Index); + Data.SelectedStoryInfo = new SelectedStoryInfo(StoryEntranceType.AllStory); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.StorySelectionWorld); + } + } + + public void GotoPracticeTypeSelect() + { + ShowPracticeTypeSelect(); + } + + private void OnPushPractive() + { + if (!base.IsCardMoving) + { + base.CardAnimation.OnClicked(_practiceCardPanel.Index); + ShowPracticeTypeSelect(); + } + } + + private void ShowPracticeTypeSelect() + { + _practiceButton.onClick.Clear(); + bool isMaintenance = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.PRACTICE_PUZZLE); + _puzzleMaintenancePlate = MyPageItem.SetMaintenanceVisible(isMaintenance, _practiceBattlePazzle, _puzzleMaintenancePlate, _practiceTypePuzzleLabel.depth); + base.TopBar.SetTitleLabel(Data.SystemText.Get("MyPage_0009")); + base.IsEnableFooterCurrentMenu = true; + FadeOutCardPanel(_storyCardPanel, null); + if (Data.MyPageNotifications.data.QuestOpenInfo.IsOpen) + { + FadeOutCardPanel(_questCardPanel, null); + } + MoveCardPanelLeftPosition(_practiceCardPanel.gameObject); + _practiceTypeSelectRoot.SetActive(value: true); + RestoreDefaultPosition(_practiceTypeSelectRoot.gameObject); + AppearAnimationFromRight(_practiceTypeSelectRoot); + base.Parent.SetBackButtonEnable(); + } + + private void OnClickPracticeTypeBattle() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.Practice; + PracticeDeckInfoTask task = new PracticeDeckInfoTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + Format value = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_FORMAT); + DeckSelectUIDialog.Create(Data.SystemText.Get("Story_0017"), task.DeckGroupListData, value, DeckSelectUIDialog.eFormatChangeUIType.UseOtherCategory, isVisibleCreateNew: true, delegate(DialogBase dialog, DeckData deck) + { + PracticeDeckSelectConfirmDialog.Create(dialog, deck, isBattleAgain: false); + }); + })); + } + + private void OnClickPracticeTypePuzzle() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.PracticePuzzle); + } + + private void OnPushQuest() + { + if (!base.IsCardMoving) + { + _questExtraIcon.SetActive(value: false); + base.CardAnimation.OnClicked(_questCardPanel.Index); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.QuestSelectionPage); + } + } + + public void UpdateQuestBadgeIcon() + { + bool active = false; + if (Data.Load.data._userTutorial.TutorialStep == 100) + { + active = Data.MyPageNotifications.data.QuestOpenInfo.IsDisplayBadge; + } + _questExtraIcon.SetActive(active); + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageMenu.cs b/SVSim.BattleEngine/Engine/MyPageMenu.cs new file mode 100644 index 0000000..981ff9f --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageMenu.cs @@ -0,0 +1,1321 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Convention; +using Cute; +using UnityEngine; +using Wizard; + +public class MyPageMenu : UIBase +{ + private const float TRANSITIONAL_BGM_DELAY_TIME = 0.5f; + + private static readonly string MYPAGE_LAYER_NAME = "MyPage"; + + private const int TUTORIAL_DIALOG_DEPTH = 3000; + + private static MyPageMenu _instance; + + public const int HOME_INDEX = 0; + + public const int STORY_INDEX = 1; + + public const int BATTLE_INDEX = 2; + + public const int ARENA_INDEX = 3; + + public const int DECK_INDEX = 4; + + public const int SHOP_INDEX = 5; + + public const int OTHER_INDEX = 6; + + private const int MYPAGE_ITEM_MAX = 7; + + private const float TWEEN_DISTANCE_X_MOVE_NAME_FRAME = 450f; + + private const float TWEEN_DELAY_MOVE_NAME_FRAME = 0f; + + private const float TWEEN_DISTANCE_Y_BACK_BUTTON = 500f; + + private const float TWEEN_DELAY_BACK_BUTTON = 0.1f; + + private const float TWEEN_TIME_TOP_BAR = 0.3f; + + private GameObject[] _pagePrefab; + + private const int MYPAGE_TREASURE_CP_REWARD_DIALOG = 37; + + private const int BG_REMAKE_RELEASE_MEMORY_COUNT = 50; + + [SerializeField] + private GameObject _pagePrefabHome; + + [SerializeField] + private GameObject _pagePrefabSoroPlay; + + [SerializeField] + private GameObject _pagePrefabBattle; + + [SerializeField] + private GameObject _pagePrefabArena; + + [SerializeField] + private GameObject _pagePrefabCard; + + [SerializeField] + private GameObject _pagePrefabShop; + + [SerializeField] + private GameObject _pagePrefabOther; + + [SerializeField] + private GameObject _myPageLayerRoot; + + [SerializeField] + private MyPageHomeStatic _homeStatic; + + [SerializeField] + private MyPageCustomBGControl _customBGControlOriginal; + + private MyPageCustomBGControl _customBGControl; + + [SerializeField] + private RewardBase _rewardBase; + + [SerializeField] + private BoxCollider _notTouchMypageCollider; + + [SerializeField] + private MyPageMaintenanceNotification _maintenanceNotificationPrefab; + + private MyPageMaintenanceNotification _maintenanceNotification; + + private GameObject[] _pageInstance; + + private MyPageItem[] _pageItem; + + private int _currentIndex; + + private List _loadFileList = new List(); + + private MyPageItemBattle _pageItemBattle; + + private MyPageItemHome _pageItemHome; + + private MyPageItemSoroPlay _pageItemSoroPlay; + + private MyPageItemShop _pageItemShop; + + private MyPageItemArena _pageItemArena; + + private MyPageItemCard _pageItemCard; + + private bool _isEnableRoomInvite; + + private float _nameWindowDefaultX; + + private bool _changeMenuCalled; + + private bool _isSetupFinish; + + private bool _isFirstLoad = true; + + private Transform _firstGuidEffectParent; + + private GameObject _boxOpenEffectObj; + + private GameObject _treasureEffectObj; + + private int _remakeCustomBgCount; + + private bool _loadResourceFinish; + + private bool _isFirstChangeMenuCall = true; + + private bool _isStopMyPageRefreshOnce; + + public static bool IsMyPageRequestEnd { get; set; } + + public static MyPageMenu Instance => _instance; + + public bool _treasureBoxCpRewardDialogClosed { get; private set; } = true; + + public bool IsEnableRoomInvite => _isEnableRoomInvite; + + public TopBar TopBar { get; set; } + + public MyPageItemHome HomeMenu => _pageItemHome; + + public MyPageItemBattle BattleMenu => _pageItemBattle; + + public MyPageCustomBGControl CustomBGControl => _customBGControl; + + public bool IsCardLoadFinish => _homeStatic.CardLoadFinish; + + public bool IsFirstGuid => Data.Load.data._userTutorial.TutorialStep != 100; + + public Effect FirstGuidEffect { get; private set; } + + public bool IsEnableFooterCurrentMenu => _pageItem[_currentIndex].IsEnableFooterCurrentMenu; + + public int currentIndex => _currentIndex; + + public bool IsVisible => _myPageLayerRoot.activeInHierarchy; + + public bool IsSetupComplete { get; private set; } + + public bool IsFadeoutEnd { get; private set; } + + public List WinnerRewardInfoCopy { get; private set; } = new List(); + + private void Awake() + { + _instance = this; + _pagePrefab = new GameObject[7]; + _pagePrefab[0] = _pagePrefabHome; + _pagePrefab[1] = _pagePrefabSoroPlay; + _pagePrefab[2] = _pagePrefabBattle; + _pagePrefab[3] = _pagePrefabArena; + _pagePrefab[4] = _pagePrefabCard; + _pagePrefab[5] = _pagePrefabShop; + _pagePrefab[6] = _pagePrefabOther; + _pageInstance = new GameObject[_pagePrefab.Length]; + _pageItem = new MyPageItem[_pagePrefab.Length]; + TopBar = UIManager.GetInstance().CreateTopBar(base.gameObject, ""); + UIManager.GetInstance().SetLayerRecursive(TopBar.transform, LayerMask.NameToLayer("MyPage")); + TopBar.BackButtonLabel.text = Data.SystemText.Get("Common_0137"); + TopBar.transform.parent = _myPageLayerRoot.transform; + UIManager.SetObjectToGrey(TopBar.BuyCrystalButton.gameObject, b: true); + TopBar.BuyCrystalButton.isEnabled = false; + UIEventListener.Get(TopBar.NameWindowBg).onClick = delegate + { + OnClickNameWindow(); + }; + _nameWindowDefaultX = TopBar.NameWindowObject.transform.localPosition.x; + _customBGControlOriginal.gameObject.SetActive(value: false); + } + + public override void onFirstStart() + { + _instance = this; + base.onFirstStart(); + } + + protected override void onOpen() + { + base.onOpen(); + LocalLog.AddRoomCreateLog("onOpen "); + _myPageLayerRoot.SetActive(value: true); + if (!_isSetupFinish) + { + _isSetupFinish = true; + IsSetupComplete = false; + IsFadeoutEnd = false; + OpenSetup(); + StartCoroutine(Setup()); + CommonBackGround.Instance.ChangeMyPageBG(); + assetSetting(); + } + _notTouchMypageCollider.enabled = false; + } + + protected override void onClose() + { + base.onClose(); + _myPageLayerRoot.SetActive(value: false); + DestroyMyPageItem(); + if (CommonBackGround.Instance != null) + { + CommonBackGround.Instance.EffectVisible = true; + } + _isSetupFinish = false; + } + + public void OpenSetup() + { + CreateMyPageItem(); + MyPageItem[] pageItem = _pageItem; + for (int i = 0; i < pageItem.Length; i++) + { + pageItem[i].AttachAtlas(); + } + } + + public static IEnumerator OnMyPageOpen(UIManager uiManager, UIManager.ChangeViewSceneParam param) + { + IsMyPageRequestEnd = false; + while (!IsMyPageRequestEnd) + { + yield return null; + } + if (Data.MyPage.CardUpdateFlag) + { + if (Instance != null) + { + Instance.ReloadCardCircle(); + } + Data.MyPage.CardUpdateFlag = false; + } + if (Instance != null) + { + Instance.ChangeMenu(param.MyPageMenuIndex, param.IsCutCardMotion); + if (param.MyPageMenuIndex != 0 && Instance._customBGControl != null) + { + Instance._customBGControl.SetEnable(enable: false); + } + } + else + { + uiManager._Footer.UpdateCurrentIndex(param.MyPageMenuIndex); + } + } + + private void CreateMyPageItem() + { + for (int i = 0; i < _pagePrefab.Length; i++) + { + if (!(_pageItem[i] != null)) + { + _pageInstance[i] = UnityEngine.Object.Instantiate(_pagePrefab[i]); + _pageInstance[i].transform.parent = _myPageLayerRoot.transform; + _pageInstance[i].transform.localPosition = Vector3.zero; + _pageInstance[i].transform.localScale = Vector3.one; + _pageInstance[i].transform.localRotation = Quaternion.identity; + _pageItem[i] = _pageInstance[i].GetComponent(); + _pageItem[i].Initialize(this); + _pageInstance[i].SetActive(value: false); + } + } + _pageItemHome = _pageInstance[0].GetComponent(); + _pageItemBattle = _pageInstance[2].GetComponent(); + _pageItemShop = _pageInstance[5].GetComponent(); + _pageItemArena = _pageInstance[3].GetComponent(); + _pageItemCard = _pageInstance[4].GetComponent(); + _pageItemSoroPlay = _pageInstance[1].GetComponent(); + _pageItemHome.SetHomeStatic(_homeStatic); + if (_loadResourceFinish) + { + AttachCardPanelTexture(); + } + } + + public void ChangeMyPageBG(MyPageDetail.BGType type, string id) + { + if (type == MyPageDetail.BGType.Deck) + { + _pageItemHome.OnUpdateCustomMyPageEnable(isHomeActive: true); + if (_customBGControl != null) + { + _customBGControl.FadeOutDestroy(); + _customBGControl = null; + _homeStatic.StartCardUpAnimation(); + } + } + else + { + ChangeBGToCustomBG(id); + } + } + + private void ChangeBGToCustomBG(string id) + { + string text = ((_customBGControl != null) ? _customBGControl.Id : string.Empty); + if (id == text) + { + return; + } + MyPageCustomBGControl oldControl = _customBGControl; + if (oldControl != null) + { + oldControl.FadeoutStandby(); + } + _customBGControl = NGUITools.AddChild(_customBGControlOriginal.transform.parent.gameObject, _customBGControlOriginal.gameObject).GetComponent(); + _customBGControl.gameObject.SetActive(value: true); + _customBGControl.Load(id, isDisplaySoon: true, delegate + { + _pageItemHome.OnUpdateCustomMyPageEnable(isHomeActive: true); + if (oldControl != null) + { + oldControl.FadeOutDestroy(); + } + OnRemakeCustomBg(); + }); + } + + private void DestroyMyPageItem() + { + if (FirstGuidEffect != null) + { + FirstGuidEffect.transform.parent = _firstGuidEffectParent; + } + for (int i = 0; i < _pageItem.Length; i++) + { + if (_pageItem[i] != null) + { + _pageItem[i].OnClose(); + UnityEngine.Object.Destroy(_pageItem[i].gameObject); + _pageItem[i] = null; + } + } + _pageItemHome = null; + _pageItemBattle = null; + _pageItemShop = null; + _pageItemArena = null; + _pageItemCard = null; + if (_customBGControl != null) + { + UnityEngine.Object.Destroy(_customBGControl.gameObject); + } + _customBGControl = null; + _remakeCustomBgCount = 0; + ReleaseMemory(runGCCollect: true); + } + + private IEnumerator Setup() + { + LocalLog.AddRoomCreateLog("Setup1 "); + Offline.IsConventionMode = false; + if (UIManager.GetInstance() != null) + { + TopBar.SetBackButtonEnable(enable: true); + if (UIManager.GetInstance()._Footer != null) + { + UIManager.GetInstance()._Footer.ShowFooterMenu(isShow: true); + } + } + bool finishTutorialResouce = true; + if (Data.Load.data._userTutorial.TutorialStep != 100) + { + finishTutorialResouce = false; + _loadFileList.AddRange(GameMgr.GetIns().GetEffectMgr().InitCommonEffect("Json/EffectTutorialData", isBattle: true, isField: false, isBattleEffect: false, delegate + { + finishTutorialResouce = true; + FirstGuidEffect = GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_TUTORIAL_TAP_1, Vector3.zero, Quaternion.identity); + FirstGuidEffect.gameObject.SetActive(value: false); + })); + } + while (!finishTutorialResouce) + { + yield return null; + } + LocalLog.AddRoomCreateLog("Setup2 "); + GameMgr.GetIns().GetPrefabMgr().Load("Prefab/UI/Menu/CardPanelMaintenancePlate"); + RefreshStaticData(); + yield return StartCoroutine(GetMyPageInfo()); + if (Data.MyPage.data.BGInfo.BGType != MyPageDetail.BGType.Deck) + { + _customBGControl = NGUITools.AddChild(_customBGControlOriginal.transform.parent.gameObject, _customBGControlOriginal.gameObject).GetComponent(); + _customBGControl.gameObject.SetActive(value: true); + CommonBackGround.Instance.EffectVisible = false; + if (!_customBGControl.IsLoadRequestEnd) + { + string id = Data.MyPage.data.BGInfo.Id; + if (Data.MyPage.data.BGInfo.BGType == MyPageDetail.BGType.RandomBG) + { + id = MyPageItemHome.DecideRandomBG(Data.MyPage.data.BGInfo.RandomIdList); + } + _customBGControl.Load(id, isDisplaySoon: false, null); + } + } + if (!_loadResourceFinish) + { + LoadResource(); + } + while (!_loadResourceFinish || (_customBGControl != null && _customBGControl.IsLoading)) + { + yield return null; + } + LocalLog.AddRoomCreateLog("Setup3 "); + if (Data.Load.data._userTutorial.TutorialStep == 31) + { + StartCoroutine(OpenFirstTipsAndGuid(FirstTips.TipsType.MyPage)); + } + while (!IsCardLoadFinish) + { + yield return null; + } + while (!CommonBackGround.Instance.IsFinishLod) + { + yield return null; + } + LocalLog.AddRoomCreateLog("Setup4 "); + yield return StartCoroutine(SetupFinish()); + } + + private void RefreshStaticData() + { + GameMgr.GetIns().GetDataMgr().SetQuestBattleData(null); + PracticePuzzleUI.ClearInMyPageScene(); + GameMgr.GetIns().GetDataMgr().QuestFirstSelectType = QuestSelectionPage.FirstSelectType.NONE; + Data.RedEtherCampaignResultData = null; + } + + private IEnumerator SetupFinish() + { + LocalLog.AddRoomCreateLog("SetupFinish "); + if (_isFirstLoad) + { + _isFirstLoad = false; + GameMgr.GetIns().GetSoundMgr().Stop_Play_BGM(Bgm.BGM_TYPE.HOME, null, 0.5f); + ParticleSystem bgEffect = CommonBackGround.Instance.GetBgEffectNow(CommonBackGround.Instance.BGType); + while (!bgEffect.GetComponent().isFinished) + { + yield return null; + } + UIManager.GetInstance().DestroyView(UIManager.ViewScene.Title); + if (0 == 0) + { + FadeOpen(); + } + } + else + { + FadeOpen(); + } + } + + private void FadeOpen() + { + LocalLog.AddRoomCreateLog("FadeOpen "); + IsSetupComplete = true; + _pageItemHome.OnMyPageFadeOpen(_currentIndex == 0); + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.HOME); + UIManager.GetInstance().OnReadyViewScene(isFadein: true, null, delegate + { + IsFadeoutEnd = true; + }); + } + + protected override void OnDestroy() + { + base.OnDestroy(); + UnloadResource(); + DestroyMyPageItem(); + resetAssetBaundleSetting(); + } + + private void Update() + { + } + + private void BackKeyCheck() + { + } + + private IEnumerator OpenFirstTipsAndGuid(FirstTips.TipsType type) + { + SetTutorialMode(); + _pageItemHome.SetGiftReceiveTutorialMode(); + bool finishTips = false; + UIManager.GetInstance().StartFirstTips(type, delegate + { + finishTips = true; + }); + while (!finishTips) + { + yield return null; + } + DialogBase dialogBase = CreateDialogForTutorial(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_Home_001_Title")); + dialogBase.SetText(Data.SystemText.Get("Tutorial_0010")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.OnClose = delegate + { + _pageItemHome.SetGuideEffectToGiftButton(); + }; + SetGuideToOkOnlyDialog(dialogBase); + _pageItemHome.SetFirstTips(); + } + + private IEnumerator FirstGuideDelay(DialogBase dialog, float delayTime) + { + yield return new WaitForSeconds(delayTime); + if (dialog != null) + { + SetGuideToOkOnlyDialog(dialog); + } + } + + public void SetGuideToOkOnlyDialog(DialogBase dialog) + { + SetGuideEffect(dialog.Btn1GameObject.transform, new Vector3(-95f, 0f, 0f), -90f); + dialog.OnCloseStart = (Action)Delegate.Combine(dialog.OnCloseStart, (Action)delegate + { + FirstGuidEffect.transform.parent = base.transform.parent; + FirstGuidEffect.gameObject.SetActive(value: false); + }); + } + + public void SetTutorialMode() + { + Footer footer = UIManager.GetInstance()._Footer; + for (int i = 0; i < footer._underButtons.Length; i++) + { + footer.SetButtonEnableColorChange(i, btnIsEnable: false); + } + UIManager.SetObjectToGrey(TopBar.BuyCrystalButton.gameObject, b: true); + TopBar.BuyCrystalButton.isEnabled = false; + _homeStatic.SetTutorialMode(); + UIManager.GetInstance()._Footer.UpdateArenaBadgeIcon(); + UIManager.GetInstance()._Footer.SoloPlayIconDisp(inDisp: false); + } + + public void FinishTutorialMode() + { + _homeStatic.FinishFirstTips(); + } + + public static DialogBase CreateDialogForTutorial() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + int num = LayerMask.NameToLayer(MYPAGE_LAYER_NAME); + dialogBase.SetPanelDepth(3000); + dialogBase.gameObject.SetLayer(num, isSetChildren: true); + dialogBase.SetBackViewLayer(num); + return dialogBase; + } + + public void FinishFirstTips() + { + if (IsFirstGuid) + { + ResetFirstGuide(); + Footer footer = UIManager.GetInstance()._Footer; + for (int i = 0; i < footer._underButtons.Length; i++) + { + footer.SetButtonEnableColorChange(i); + } + _pageItemHome.FinishFirstTips(); + } + } + + public void ResetFirstGuide() + { + if (FirstGuidEffect != null) + { + FirstGuidEffect.Stop(); + FirstGuidEffect.transform.parent = _firstGuidEffectParent; + } + } + + private IEnumerator GetMyPageInfo() + { + LocalLog.AddRoomCreateLog("GetMyPageInfo1 "); + while (Toolbox.NetworkManager == null && !Global.IS_LOAD_ALLDONE) + { + yield return null; + } + TopBar.NameLabel.text = PlayerStaticData.UserName; + TopBar.RupyLabel.gameObject.SetActive(value: false); + TopBar.CrystalLabel.gameObject.SetActive(value: false); + TopBar.RankTexture.gameObject.SetActive(value: false); + TopBar.SetActiveBattlePoint(isActive: false); + UIManager uiMgr = UIManager.GetInstance(); + uiMgr.createInSceneCenterLoading(); + if (TaskManager.GetInstance().IsMyPageSend()) + { + LocalLog.SendLastTraceLog(null); + } + LocalLog.AddRoomCreateLog("GetMyPageInfo2 "); + yield return StartCoroutine(MasterResetMonthTask.MasterReset()); + MyPageTask task = GameMgr.GetIns().GetMyPageTask(); + task.SetParameter(); + yield return StartCoroutine(Toolbox.NetworkManager.Connect(task, OnRequestMyPageLoad)); + while (!task.isServerResultCodeOK() || task.IsResourceVersionUpError) + { + yield return null; + } + LocalLog.AddRoomCreateLog("GetMyPageInfo3 "); + WinnerRewardInfoCopy.Clear(); + foreach (CampaignRewardInfo reward in Data.MyPageNotifications.data.CampaignBattleWin.RewardList) + { + WinnerRewardInfoCopy.Add(reward); + } + bool finishDeckInfoTask = false; + _homeStatic.CenterCardCreateStart(delegate + { + finishDeckInfoTask = true; + }); + while (!finishDeckInfoTask) + { + yield return null; + } + yield return StartCoroutine(_pageItemShop.CrystalAppeal.Initialize(Data.MyPage.data.ServerUnixTime)); + TopBar.RupyLabel.gameObject.SetActive(value: true); + TopBar.CrystalLabel.gameObject.SetActive(value: true); + LocalLog.AddRoomCreateLog("GetMyPageInfo4 "); + if (Data.MyPage.data.IsExistUnfinishedBattle) + { + DateTime startTime = DateTime.Now; + while ((DateTime.Now - startTime).TotalMilliseconds < (double)Data.MyPage.data.BattleFinishWaitTime) + { + yield return null; + } + MyPageFinishBattleTask myPageFinishBattleTask = new MyPageFinishBattleTask(); + myPageFinishBattleTask.SetParameter(); + if (Data.TreasureBoxCp.IsReceivable) + { + _treasureBoxCpRewardDialogClosed = false; + myPageFinishBattleTask.UnfinishedBattleDialogCloseCallBack = delegate + { + UIManager.GetInstance().StartCoroutine(OpenTreasureBoxCpTreasureBox()); + }; + } + yield return StartCoroutine(Toolbox.NetworkManager.Connect(myPageFinishBattleTask)); + while (!task.isServerResultCodeOK()) + { + yield return null; + } + } + else + { + _ = Data.MyPage.data.IsExistUnfinishedRoom; + } + if (Data.TreasureBoxCp.IsReceivable && !Data.MyPage.data.CanGiveDailyLoginBonus && !Data.MyPage.data.IsExistUnfinishedBattle) + { + _treasureBoxCpRewardDialogClosed = false; + UIManager.GetInstance().StartCoroutine(OpenTreasureBoxCpTreasureBox()); + } + LocalLog.AddRoomCreateLog("GetMyPageInfo5 "); + uiMgr.closeInSceneCenterLoading(); + TopBar.RankTexture.gameObject.SetActive(value: true); + TopBar.SetActiveBattlePoint(isActive: true); + Format inFormat = PlayerStaticData.HighRankFormat(); + PlayerStaticData.LoadUserRankTexture(inFormat); + PlayerStaticData.AttachUserEmblemTexture(TopBar.EmblemTexture, PlayerStaticData.EmblemTexSize.M); + PlayerStaticData.AttachUserRankTexture(TopBar.RankTexture, PlayerStaticData.RankTexSize.S); + if (PlayerStaticData.IsMasterRank(inFormat)) + { + TopBar.SetBattlePoint(PlayerStaticData.UserMasterPointHighAllFormat(), PlayerStaticData.IsMasterRank(inFormat)); + } + else + { + TopBar.SetBattlePoint(PlayerStaticData.UserBattlePointHighFormat(), PlayerStaticData.IsMasterRank(inFormat)); + } + while (!_changeMenuCalled) + { + yield return null; + } + _changeMenuCalled = false; + MyPageItem[] pageItem = _pageItem; + for (int num = 0; num < pageItem.Length; num++) + { + pageItem[num].OnMyPageInfoReceive(); + } + } + + private IEnumerator OpenTreasureBoxCpTreasureBox() + { + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = false; + int rupyNumBeforeOpenTreasureBox = PlayerStaticData.UserRupyCount; + MypageTreasureBoxCpOpenTask treasureBoxCpOpentask = new MypageTreasureBoxCpOpenTask(); + treasureBoxCpOpentask.SetParameter(); + yield return StartCoroutine(Toolbox.NetworkManager.Connect(treasureBoxCpOpentask, delegate + { + string atlasName = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Arena, null); + _loadFileList.Add(atlasName); + UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetAsync(atlasName, delegate + { + atlasName = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Arena, null, isload: true); + UIAtlas component = Toolbox.ResourcesManager.LoadObject(atlasName).GetComponent(); + UIManager.GetInstance().StartCoroutine(RunOpenBoxEffect(treasureBoxCpOpentask.Result, component, rupyNumBeforeOpenTreasureBox, delegate + { + CreateTreasureBoxCpRewardDialog(treasureBoxCpOpentask.Result, delegate + { + RunHideBoxEffect(); + UIManager.GetInstance().UpDateRupyNum(); + }); + })); + })); + })); + } + + private void OnRequestMyPageLoad(NetworkTask.ResultCode error) + { + if (Data.Load.data._receiveInviteCount > 0) + { + _isEnableRoomInvite = true; + } + else + { + _isEnableRoomInvite = false; + } + bool flag = false; + if (Data.MyPageNotifications.data.CampaignBattleWin.SpecialTreasureInfo != null) + { + flag = Data.MyPageNotifications.data.CampaignBattleWin.SpecialTreasureInfo.IsTreasureBoxReadyToOpen; + } + UIManager.GetInstance()._Footer.InviteIconDisp(_isEnableRoomInvite || flag); + UpdateCrystalCount(); + UpdateRupyCount(); + IsMyPageRequestEnd = true; + } + + private void LoadResource() + { + UIManager uiManager = UIManager.GetInstance(); + ResourcesManager resourceManager = Toolbox.ResourcesManager; + List cardPanelList = new List(); + MyPageItem[] pageItem = _pageItem; + for (int i = 0; i < pageItem.Length; i++) + { + MyPageCardPanel[] cardPanelList2 = pageItem[i].CardPanelList; + foreach (MyPageCardPanel myPageCardPanel in cardPanelList2) + { + if (!string.IsNullOrEmpty(myPageCardPanel.FilePath) && !(myPageCardPanel.Texture == null)) + { + string resourcePath = myPageCardPanel.GetResourcePath(isfetch: false); + _loadFileList.Add(resourcePath); + cardPanelList.Add(myPageCardPanel); + uiManager.Force_Increment_LockCountChangeView(); + } + } + } + resourceManager.StartCoroutine_LoadAssetGroupSync(_loadFileList, delegate + { + _loadResourceFinish = true; + int k = 0; + for (int count = cardPanelList.Count; k < count; k++) + { + MyPageCardPanel myPageCardPanel2 = cardPanelList[k]; + myPageCardPanel2.Texture.mainTexture = resourceManager.LoadObject(myPageCardPanel2.GetResourcePath(isfetch: true)) as Texture; + uiManager.Force_Decrement_LockCountChangeView(); + } + }); + } + + private void AttachCardPanelTexture() + { + MyPageItem[] pageItem = _pageItem; + for (int i = 0; i < pageItem.Length; i++) + { + MyPageCardPanel[] cardPanelList = pageItem[i].CardPanelList; + foreach (MyPageCardPanel myPageCardPanel in cardPanelList) + { + if (!string.IsNullOrEmpty(myPageCardPanel.FilePath) && !(myPageCardPanel.Texture == null)) + { + myPageCardPanel.AttachCardPanelTexture(); + } + } + } + } + + private void UnloadResource() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadFileList); + _loadFileList.Clear(); + } + + public void ReloadCardCircle() + { + _homeStatic.ReloadCardCircle(); + } + + public static void SetEnableReloadCard() + { + if (!(Instance == null)) + { + Data.MyPage.CardUpdateFlag = true; + } + } + + public int GetDetailCardCount() + { + return _homeStatic.GetDetailCardCount(); + } + + private void HideNameWindow() + { + iTween.MoveTo(TopBar.NameWindowObject, iTween.Hash("x", TopBar.NameWindowObject.transform.localPosition.x - 450f, "time", 0.3f, "delay", 0f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + public void RemoveTween(GameObject obj) + { + iTween component = obj.GetComponent(); + if (component != null) + { + UnityEngine.Object.Destroy(component); + } + } + + public void SetBackButtonEnable() + { + HideNameWindow(); + TopBar.SetBackButtonActive(inActive: true); + RemoveTween(TopBar.TitleObject.gameObject); + RemoveTween(TopBar.BackButton.gameObject); + TopBar.RestorePosition(); + iTween.MoveFrom(TopBar.TitleObject, iTween.Hash("y", TopBar.TitleObject.transform.localPosition.y + 500f, "time", 0.3f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveFrom(TopBar.BackButton.gameObject, iTween.Hash("y", TopBar.BackButton.transform.localPosition.y + 500f, "time", 0.3f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + public void SetNameBarEnable() + { + iTween.MoveTo(TopBar.NameWindowObject, iTween.Hash("x", _nameWindowDefaultX, "time", 0.3f, "delay", 0, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + TopBar.SetBackButtonActive(inActive: false); + TopBar.ChangeNameWindowMode(); + } + + public void ChangeMenu(int index, bool isCutCardMotion = false) + { + UIManager.GetInstance()._Footer.UpdateCurrentIndex(index); + SetNameBarEnable(); + SetDefaultBackButtonHandler(); + if (!_isFirstChangeMenuCall && _currentIndex >= 0 && _currentIndex < _pageItem.Length) + { + _pageItem[_currentIndex].Hide(); + if (_currentIndex == 0 && _currentIndex != index) + { + OnChangeFromHome(); + } + } + _currentIndex = index; + if (index >= 0 && index < _pageItem.Length) + { + _pageItem[index].Show(isCutCardMotion); + } + bool flag = index == 0; + CommonBackGround.Instance.SetMagicCircle(!flag); + Offline.IsConventionMode = false; + _changeMenuCalled = true; + _isFirstChangeMenuCall = false; + } + + private void OnChangeFromHome() + { + if (!(_customBGControl == null)) + { + if (Data.MyPage.data.BGInfo.BGType == MyPageDetail.BGType.RandomBG) + { + RemakeCustomBgForRandom(); + } + if (Data.MyPage.data.BGInfo.BGType == MyPageDetail.BGType.CustomBG) + { + _customBGControl.FadeOut(); + } + CommonBackGround.Instance.EffectVisible = true; + } + } + + private void OnRemakeCustomBg() + { + _remakeCustomBgCount++; + if (_remakeCustomBgCount >= 50) + { + _remakeCustomBgCount = 0; + ReleaseMemory(runGCCollect: true); + } + } + + private static void ReleaseMemory(bool runGCCollect) + { + UIManager.GetInstance().StartCoroutine(ReleaseMemoryBody(runGCCollect)); + } + + private static IEnumerator ReleaseMemoryBody(bool runGCCollect) + { + yield return Resources.UnloadUnusedAssets(); + if (runGCCollect) + { + GC.Collect(); + } + } + + private void RemakeCustomBgForRandom() + { + string text = MyPageItemHome.DecideRandomBG(Data.MyPage.data.BGInfo.RandomIdList); + if (_customBGControl != null && text == _customBGControl.Id) + { + _customBGControl.FadeOut(); + return; + } + _customBGControl.FadeOutDestroy(); + _customBGControl = null; + _customBGControl = NGUITools.AddChild(_customBGControlOriginal.transform.parent.gameObject, _customBGControlOriginal.gameObject).GetComponent(); + _customBGControl.gameObject.SetActive(value: true); + UIManager.GetInstance().OpenNotTouch(); + _customBGControl.Load(text, isDisplaySoon: false, delegate + { + UIManager.GetInstance().offNotTouch(); + OnRemakeCustomBg(); + }); + } + + public void SetDefaultBackButtonHandler() + { + TopBar.SetBackButtonEvent(null, UIManager.ViewScene.None, new EventDelegate(delegate + { + _pageItem[_currentIndex].Show(); + SetNameBarEnable(); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SWITCH_MENU); + })); + } + + public void GoToFreeMatch() + { + SetBackButtonEnable(); + _pageItemBattle.GoToFreeMatch(); + } + + public void GoToRoomMatch() + { + SetBackButtonEnable(); + _pageItemBattle.GoToRoomMatch(); + } + + public void SetAfterSpecialWinRewardOpened() + { + _pageItemBattle.SpecialWinRewardIconActive(active: false); + _pageItemBattle.RedrawBattleCampaign(); + _pageItemArena.RedrawBattleCampaign(); + } + + public void GoToPracticeTypeSelect() + { + _pageItemSoroPlay.GotoPracticeTypeSelect(); + } + + public void GoToChallengeMenu() + { + _pageItemArena.GoToChallengeMenu(); + } + + public void GoToColosseum(bool isColosseumTask = true) + { + _pageItemArena.GoToColosseum(isColosseumTask); + } + + public void GoToCompetition() + { + _pageItemArena.GoToCompetition(); + } + + public void GoToConventionListMenu() + { + _pageItemArena.GoToConventionListMenu(); + } + + public void GoToConventionActionMenu(ConventionInfo conventionInfo) + { + _pageItemArena.GoToConventionActionMenu(conventionInfo); + } + + public void GoToGatheringActionMenu() + { + _pageItemArena.GoToGatheringMenu(); + } + + public void GoToShopSupply() + { + _pageItemShop.GoToShopSupply(); + } + + public void GoToShopCard() + { + _pageItemShop.GoToShopCard(); + } + + public void GoToCardDeck() + { + _pageItemCard.GoToCardDeck(); + } + + private static UIManager.ChangeViewSceneParam CreateMyPageChangeParam(int index, bool isCutCard) + { + return new UIManager.ChangeViewSceneParam + { + MyPageMenuIndex = index, + IsCutCardMotion = isCutCard, + IsUpdateFooterMenuTexture = true + }; + } + + public static void ChangeSceneAndBuyCard(Action onChange) + { + UIManager.ChangeViewSceneParam changeViewSceneParam = CreateMyPageChangeParam(5, isCutCard: true); + changeViewSceneParam.OnFinishChangeView = delegate + { + Instance.GoToShopCard(); + onChange.Call(); + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.MyPage, changeViewSceneParam); + } + + public static void ChangeSceneAndBuySupply(Action onChange) + { + UIManager.GetInstance()._Footer.UpdateCurrentIndex(5); + UIManager.ChangeViewSceneParam changeViewSceneParam = CreateMyPageChangeParam(5, isCutCard: true); + changeViewSceneParam.OnFinishChangeView = delegate + { + Instance.GoToShopSupply(); + onChange.Call(); + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.MyPage, changeViewSceneParam); + } + + public void ShowBanner() + { + if (_pageItemHome != null) + { + _pageItemHome.ShowBanner(); + } + } + + public void HideBanner() + { + if (_pageItemHome != null) + { + _pageItemHome.HideBanner(); + } + } + + public void RoomInviteClear() + { + _isEnableRoomInvite = false; + } + + public void OnReadGift() + { + if (_pageItemHome != null) + { + _pageItemHome.OnReadGift(); + } + } + + private void OnClickCrystalBuyButton() + { + } + + private void OnClickNameWindow() + { + if (!IsFirstGuid) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.IsUpdateFooterMenuTexture = true; + changeViewSceneParam.OnChange = delegate + { + CommonBackGround.Instance.SetMagicCircle(isVisible: true); + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Profile, changeViewSceneParam); + } + } + + public void UpdateCrystalCount() + { + UIManager.GetInstance().UpDateCrystalNum(); + } + + public void UpdateRupyCount() + { + UIManager.GetInstance().UpDateRupyNum(); + } + + public void UpdateMissionCount() + { + if (_pageItemHome != null) + { + _pageItemHome.UpdateMissionNumber(); + } + } + + public void ShowNotification(List notifications) + { + if (notifications.Count != 0) + { + if (_maintenanceNotification != null) + { + UnityEngine.Object.Destroy(_maintenanceNotification.gameObject); + _maintenanceNotification = null; + } + _maintenanceNotification = NGUITools.AddChild(base.gameObject, _maintenanceNotificationPrefab.gameObject).GetComponent(); + _maintenanceNotification.gameObject.layer = LayerMask.NameToLayer("SystemUI"); + StartCoroutine(_maintenanceNotification.Show(notifications)); + } + } + + private IEnumerator RunOpenBoxEffect(MypageTreasureBoxCpOpenTask.MypageTreasureBoxCpOpenTaskData result, UIAtlas arenaAtlas, int rupyNumBeforeOpenTreasureBox, Action endAction) + { + UIManager.GetInstance().UpdateLastRupyNum(rupyNumBeforeOpenTreasureBox); + while (!IsFadeoutEnd) + { + yield return null; + } + UIManager.GetInstance().OpenNotTouch(); + _notTouchMypageCollider.enabled = true; + yield return new WaitForSeconds(1f); + _boxOpenEffectObj = NGUITools.AddChild(base.gameObject, Resources.Load("UI/layoutParts/RankWinnerRewardResultPanel") as GameObject); + NguiObjs component = _boxOpenEffectObj.GetComponent(); + UISprite bg = component.sprites[0]; + UISprite window = component.sprites[1]; + UISprite box = component.sprites[2]; + box.atlas = arenaAtlas; + UILabel label = component.labels[0]; + label.text = Data.SystemText.Get("TreasureBoxCp_0026"); + UIPanel panel = _boxOpenEffectObj.GetComponent(); + panel.alpha = 0f; + box.spriteName = $"box_2pick_0{TreasureBoxCp.GRADE_TO_TREASURE_BOX_ID[result.Grade]}_close"; + string loadEffectName = $"cmn_arena_treasure_{TreasureBoxCp.GRADE_TO_TREASURE_BOX_ID[result.Grade] + 1}"; + List list = new List(); + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(loadEffectName, ResourcesManager.AssetLoadPathType.Effect2D)); + yield return UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(list, null)); + _treasureEffectObj = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(loadEffectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject); + _treasureEffectObj.transform.parent = _boxOpenEffectObj.transform; + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_treasureEffectObj, null); + _boxOpenEffectObj.SetLayer(LayerMask.NameToLayer("SystemUI"), isSetChildren: true); + bg.alpha = 0f; + box.alpha = 0f; + label.alpha = 0f; + panel.alpha = 1f; + TweenAlpha.Begin(bg.gameObject, 0.5f, 0.65f); + TweenAlpha.Begin(label.gameObject, 0.5f, 1f); + TweenAlpha.Begin(box.gameObject, 0.5f, 1f); + label.transform.localPosition = new Vector3(100f, 0f, 0f); + window.transform.localScale = new Vector3(1f, 0.01f, 1f); + box.transform.localPosition = new Vector3(180f, 0f, 0f); + iTween.MoveTo(label.gameObject, iTween.Hash("x", 20f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(window.gameObject, iTween.Hash("y", 1f, "time", 0.5f, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.MoveTo(box.gameObject, iTween.Hash("y", 20f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(0.8f); + TweenAlpha.Begin(label.gameObject, 0.5f, 0f); + iTween.MoveTo(box.gameObject, iTween.Hash("x", 0f, "time", 0.7f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_2PICK_BOX_OPEN); + yield return new WaitForSeconds(1f); + _treasureEffectObj.transform.localPosition = box.transform.localPosition; + _treasureEffectObj.transform.localScale = Vector3.one * 320f * 1.75f; + _treasureEffectObj.SetActive(value: true); + box.gameObject.SetActive(value: false); + yield return new WaitForSeconds(1.2f); + endAction.Call(); + } + + private void CreateTreasureBoxCpRewardDialog(MypageTreasureBoxCpOpenTask.MypageTreasureBoxCpOpenTaskData result, Action endAction) + { + if (result == null || result.RewardDataList.Count() <= 0) + { + _treasureBoxCpRewardDialogClosed = true; + endAction.Call(); + return; + } + UIManager.GetInstance().createInSceneCenterLoading(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetLayer("MyPage"); + dialogBase.SetPanelDepth(1000, isSetBackViewDepthImmediately: true); + dialogBase.SetTitleLabel(Data.SystemText.Get("TreasureBoxCp_0001")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetPanelSortingOrder(37); + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate + { + _treasureBoxCpRewardDialogClosed = true; + }); + RewardBase component = NGUITools.AddChild(dialogBase.gameObject, _rewardBase.gameObject).GetComponent(); + for (int num = 0; num < result.RewardDataList.Count; num++) + { + component.AddReward(result.RewardDataList[num]); + } + UIPanel component2 = component.gameObject.GetComponent(); + component2.sortingOrder = 37; + component2.depth = 1005; + component.EndCreate(); + endAction.Call(); + } + + private void RunHideBoxEffect() + { + _treasureEffectObj.SetActive(value: false); + _boxOpenEffectObj.SetActive(value: false); + UnityEngine.Object.Destroy(_boxOpenEffectObj); + UnityEngine.Object.Destroy(_treasureEffectObj); + UIManager.GetInstance().offNotTouch(); + _notTouchMypageCollider.enabled = false; + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = true; + } + + public static void SetMyPageRefreshDisableOnce() + { + if (!(Instance == null)) + { + Instance._isStopMyPageRefreshOnce = true; + } + } + + protected void OnApplicationFocus(bool focusStatus) + { + if (focusStatus && _isStopMyPageRefreshOnce) + { + _isStopMyPageRefreshOnce = false; + } + else if (!UIManager.GetInstance().IsCrystalDialogExe && UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.MyPage && focusStatus && !BattleMenu.IsStopSendMyPageRefreshTask() && !Toolbox.NetworkManager.isConnect && !Toolbox.NetworkManager.isTimeOut && !Toolbox.NetworkManager.isError && Data.MyPage != null && Data.MyPage.data != null) + { + MyPageRefreshTask myPageRefreshTask = new MyPageRefreshTask(); + myPageRefreshTask.SetParameter(); + StartCoroutine(Toolbox.NetworkManager.Connect(myPageRefreshTask, delegate + { + RefreshInviteIcon(); + RefreshGatheringNotification(); + })); + } + } + + private void RefreshInviteIcon() + { + bool isInvite = false; + if (Data.Load.data._receiveInviteCount > 0) + { + isInvite = true; + } + bool isTreasureBoxReadyToOpen = false; + if (Data.MyPageNotifications.data.CampaignBattleWin.SpecialTreasureInfo != null) + { + isTreasureBoxReadyToOpen = Data.MyPageNotifications.data.CampaignBattleWin.SpecialTreasureInfo.IsTreasureBoxReadyToOpen; + } + ReceivedInvite(isInvite, isTreasureBoxReadyToOpen); + } + + private void RefreshGatheringNotification() + { + UIManager.GetInstance()._Footer.UpdateArenaBadgeIcon(); + if (_pageItemArena != null) + { + _pageItemArena.ShowGatheringBadge(); + } + } + + public void ReceivedInvite(bool isInvite, bool isTreasureBoxReadyToOpen = false) + { + _isEnableRoomInvite = isInvite; + UIManager.GetInstance()._Footer.InviteIconDisp(isInvite || isTreasureBoxReadyToOpen); + } + + public void SpecialWinRewardOpened() + { + bool isEnableRoomInvite = _isEnableRoomInvite; + UIManager.GetInstance()._Footer.InviteIconDisp(isEnableRoomInvite); + } + + public BoxCollider GetNotTouchMypageCollider() + { + return _notTouchMypageCollider; + } + + public void SetGatheringPush(bool isNotification) + { + Data.MyPageNotifications.data.GatheringMyPageInfo.IsMatchingNotification = isNotification; + UIManager.GetInstance()._Footer.UpdateArenaBadgeIcon(); + } + + public void SetGuideEffect(Transform parent, Vector3 localPosition, float rotation) + { + if (!(FirstGuidEffect == null)) + { + FirstGuidEffect.gameObject.SetActive(value: true); + FirstGuidEffect.transform.parent = parent; + FirstGuidEffect.transform.localPosition = localPosition; + FirstGuidEffect.transform.localRotation = Quaternion.Euler(0f, 0f, rotation); + FirstGuidEffect.gameObject.SetLayer(parent.gameObject.layer, isSetChildren: true); + } + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageShopCrystalApeal.cs b/SVSim.BattleEngine/Engine/MyPageShopCrystalApeal.cs new file mode 100644 index 0000000..6199f95 --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageShopCrystalApeal.cs @@ -0,0 +1,93 @@ +using System.Collections; +using UnityEngine; +using Wizard; + +public class MyPageShopCrystalApeal : MonoBehaviour +{ + private enum State + { + INIT, + SUCCESS, + ERROR + } + + private const int TIME_LIMIT_BORDER_SECOND = 172800; + + [SerializeField] + private UILabel _timeLimit; + + [SerializeField] + private GameObject _newIcon; + + private State _state; + + public IEnumerator Initialize(double serverTime) + { + _state = State.INIT; + PaymentPC paymentImpl = PaymentPC.GetInstance(); + paymentImpl.initialize(); + paymentImpl.ProductListSucceeded += OnSuccessGetProductList; + paymentImpl.ProductListFailed += OnFailedGetProductList; + while (_state == State.INIT) + { + yield return null; + } + ClearPaymentHandler(); + if (_state == State.ERROR) + { + yield break; + } + RemainTime remainTime = null; + foreach (string productId in paymentImpl.ProductIdList) + { + if (paymentImpl.ProductCurrentPurchaseCount.ContainsKey(productId)) + { + int num = paymentImpl.ProductCurrentPurchaseCount[productId]; + int num2 = paymentImpl.ProductPurchaseLimitCount[productId]; + if (num >= num2) + { + continue; + } + } + RemainTime remainTime2 = new RemainTime(paymentImpl.ProductEndTime[productId], serverTime); + if (remainTime2.Second <= 172800 && remainTime2.Second > 0) + { + if (remainTime == null) + { + remainTime = remainTime2; + } + else if (remainTime2.Second < remainTime.Second) + { + remainTime = remainTime2; + } + } + } + if (remainTime != null) + { + _timeLimit.gameObject.SetActive(value: true); + _timeLimit.text = remainTime.GetShowText(); + } + else + { + _timeLimit.gameObject.SetActive(value: false); + } + _newIcon.SetActive(Data.Load.data._userCrystalCount.NeedNewIcon); + } + + private void OnSuccessGetProductList() + { + _state = State.SUCCESS; + } + + private void OnFailedGetProductList() + { + _state = State.ERROR; + } + + private void ClearPaymentHandler() + { + PaymentPC instance = PaymentPC.GetInstance(); + instance.ProductListSucceeded -= OnSuccessGetProductList; + instance.ProductListFailed -= OnFailedGetProductList; + } +} diff --git a/SVSim.BattleEngine/Engine/MyPageSubBanner.cs b/SVSim.BattleEngine/Engine/MyPageSubBanner.cs new file mode 100644 index 0000000..9918aff --- /dev/null +++ b/SVSim.BattleEngine/Engine/MyPageSubBanner.cs @@ -0,0 +1,79 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Wizard; + +public class MyPageSubBanner : MyPageBannerBase +{ + private const int BANNER_VERTICAL_SPACING = 73; + + [SerializeField] + private GameObject _bannerRoot; + + [SerializeField] + private GameObject _roomCampaignBadge; + + public void HideAndRepositionBanner(string click) + { + if (_bannerList == null || _bannerList.Count <= 0) + { + return; + } + foreach (BannerInfo banner in _bannerList) + { + if (banner.Click == click) + { + banner.BannerGameObject.SetActive(value: false); + } + } + RepositionBannerObject(); + } + + protected override IEnumerator CreateBannerImage() + { + _roomCampaignBadge.SetActive(value: false); + if (Data.MyPage.data._subBannerInfoList != null) + { + _bannerList = new List(Data.MyPage.data._subBannerInfoList); + } + if (_bannerList == null || _bannerList.Count <= 0) + { + base.gameObject.SetActive(value: false); + yield break; + } + yield return LoadBannerImage(); + while (!base.gameObject.activeInHierarchy) + { + yield return null; + } + for (int i = 0; i < _bannerList.Count; i++) + { + GameObject gameObject = NGUITools.AddChild(_bannerRoot, _bannerImagePrefab); + InitializeEventHandler(gameObject, _bannerList[i]); + if (_bannerList[i].NeedBadge) + { + GameObject obj = NGUITools.AddChild(gameObject, _roomCampaignBadge); + obj.transform.localPosition = _roomCampaignBadge.transform.localPosition; + obj.SetActive(value: true); + } + _bannerList[i].BannerGameObject = gameObject; + } + RepositionBannerObject(); + } + + private void RepositionBannerObject() + { + int num = 0; + foreach (BannerInfo banner in _bannerList) + { + GameObject bannerGameObject = banner.BannerGameObject; + if (bannerGameObject.activeSelf) + { + Vector3 zero = Vector3.zero; + zero += Vector3.down * num * 73f; + bannerGameObject.transform.localPosition = zero; + num++; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/NGUIDebug.cs b/SVSim.BattleEngine/Engine/NGUIDebug.cs new file mode 100644 index 0000000..349d1f9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NGUIDebug.cs @@ -0,0 +1,146 @@ +using System.Collections.Generic; +using UnityEngine; + +[AddComponentMenu("NGUI/Internal/Debug")] +public class NGUIDebug : MonoBehaviour +{ + private static bool mRayDebug = false; + + private static List mLines = new List(); + + private static NGUIDebug mInstance = null; + + public static bool debugRaycast + { + get + { + return mRayDebug; + } + set + { + mRayDebug = value; + if (value && Application.isPlaying) + { + CreateInstance(); + } + } + } + + public static void CreateInstance() + { + if (mInstance == null) + { + GameObject obj = new GameObject("_NGUI Debug"); + mInstance = obj.AddComponent(); + Object.DontDestroyOnLoad(obj); + } + } + + private static void LogString(string text) + { + if (Application.isPlaying) + { + if (mLines.Count > 20) + { + mLines.RemoveAt(0); + } + mLines.Add(text); + CreateInstance(); + } + } + + public static void Log(params object[] objs) + { + string text = ""; + for (int i = 0; i < objs.Length; i++) + { + text = ((i != 0) ? (text + ", " + objs[i].ToString()) : (text + objs[i].ToString())); + } + LogString(text); + } + + public static void Clear() + { + mLines.Clear(); + } + + public static void DrawBounds(Bounds b) + { + _ = b.center; + _ = b.center - b.extents; + _ = b.center + b.extents; + } + + private void OnGUI() + { + Rect position = new Rect(5f, 5f, 1000f, 22f); + if (mRayDebug) + { + string text = "Scheme: " + UICamera.currentScheme; + GUI.color = Color.black; + GUI.Label(position, text); + position.y -= 1f; + position.x -= 1f; + GUI.color = Color.white; + GUI.Label(position, text); + position.y += 18f; + position.x += 1f; + text = "Hover: " + NGUITools.GetHierarchy(UICamera.hoveredObject).Replace("\"", ""); + GUI.color = Color.black; + GUI.Label(position, text); + position.y -= 1f; + position.x -= 1f; + GUI.color = Color.white; + GUI.Label(position, text); + position.y += 18f; + position.x += 1f; + text = "Selection: " + NGUITools.GetHierarchy(UICamera.selectedObject).Replace("\"", ""); + GUI.color = Color.black; + GUI.Label(position, text); + position.y -= 1f; + position.x -= 1f; + GUI.color = Color.white; + GUI.Label(position, text); + position.y += 18f; + position.x += 1f; + text = "Controller: " + NGUITools.GetHierarchy(UICamera.controllerNavigationObject).Replace("\"", ""); + GUI.color = Color.black; + GUI.Label(position, text); + position.y -= 1f; + position.x -= 1f; + GUI.color = Color.white; + GUI.Label(position, text); + position.y += 18f; + position.x += 1f; + text = "Active events: " + UICamera.CountInputSources(); + if (UICamera.disableController) + { + text += ", disabled controller"; + } + if (UICamera.inputHasFocus) + { + text += ", input focus"; + } + GUI.color = Color.black; + GUI.Label(position, text); + position.y -= 1f; + position.x -= 1f; + GUI.color = Color.white; + GUI.Label(position, text); + position.y += 18f; + position.x += 1f; + } + int i = 0; + for (int count = mLines.Count; i < count; i++) + { + GUI.color = Color.black; + GUI.Label(position, mLines[i]); + position.y -= 1f; + position.x -= 1f; + GUI.color = Color.white; + GUI.Label(position, mLines[i]); + position.y += 18f; + position.x += 1f; + } + } +} diff --git a/SVSim.BattleEngine/Engine/NGUIMath.cs b/SVSim.BattleEngine/Engine/NGUIMath.cs new file mode 100644 index 0000000..1817133 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NGUIMath.cs @@ -0,0 +1,1033 @@ +using System.Diagnostics; +using UnityEngine; + +public static class NGUIMath +{ + [DebuggerHidden] + [DebuggerStepThrough] + public static float Lerp(float from, float to, float factor) + { + return from * (1f - factor) + to * factor; + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static int ClampIndex(int val, int max) + { + if (val >= 0) + { + if (val >= max) + { + return max - 1; + } + return val; + } + return 0; + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static int RepeatIndex(int val, int max) + { + if (max < 1) + { + return 0; + } + while (val < 0) + { + val += max; + } + while (val >= max) + { + val -= max; + } + return val; + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static float WrapAngle(float angle) + { + while (angle > 180f) + { + angle -= 360f; + } + while (angle < -180f) + { + angle += 360f; + } + return angle; + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static float Wrap01(float val) + { + return val - (float)Mathf.FloorToInt(val); + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static int HexToDecimal(char ch) + { + switch (ch) + { + case '0': + return 0; + case '1': + return 1; + case '2': + return 2; + case '3': + return 3; + case '4': + return 4; + case '5': + return 5; + case '6': + return 6; + case '7': + return 7; + case '8': + return 8; + case '9': + return 9; + case 'A': + case 'a': + return 10; + case 'B': + case 'b': + return 11; + case 'C': + case 'c': + return 12; + case 'D': + case 'd': + return 13; + case 'E': + case 'e': + return 14; + case 'F': + case 'f': + return 15; + default: + return 15; + } + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static char DecimalToHexChar(int num) + { + if (num > 15) + { + return 'F'; + } + if (num < 10) + { + return (char)(48 + num); + } + return (char)(65 + num - 10); + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static string DecimalToHex8(int num) + { + num &= 0xFF; + return num.ToString("X2"); + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static string DecimalToHex24(int num) + { + num &= 0xFFFFFF; + return num.ToString("X6"); + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static string DecimalToHex32(int num) + { + return num.ToString("X8"); + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static int ColorToInt(Color c) + { + return 0 | (Mathf.RoundToInt(c.r * 255f) << 24) | (Mathf.RoundToInt(c.g * 255f) << 16) | (Mathf.RoundToInt(c.b * 255f) << 8) | Mathf.RoundToInt(c.a * 255f); + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static Color IntToColor(int val) + { + float num = 0.003921569f; + Color black = Color.black; + black.r = num * (float)((val >> 24) & 0xFF); + black.g = num * (float)((val >> 16) & 0xFF); + black.b = num * (float)((val >> 8) & 0xFF); + black.a = num * (float)(val & 0xFF); + return black; + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static string IntToBinary(int val, int bits) + { + string text = ""; + int num = bits; + while (num > 0) + { + if (num == 8 || num == 16 || num == 24) + { + text += " "; + } + text += (((val & (1 << --num)) != 0) ? '1' : '0'); + } + return text; + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static Color HexToColor(uint val) + { + return IntToColor((int)val); + } + + public static Rect ConvertToTexCoords(Rect rect, int width, int height) + { + Rect result = rect; + if ((float)width != 0f && (float)height != 0f) + { + result.xMin = rect.xMin / (float)width; + result.xMax = rect.xMax / (float)width; + result.yMin = 1f - rect.yMax / (float)height; + result.yMax = 1f - rect.yMin / (float)height; + } + return result; + } + + public static Rect ConvertToPixels(Rect rect, int width, int height, bool round) + { + Rect result = rect; + if (round) + { + result.xMin = Mathf.RoundToInt(rect.xMin * (float)width); + result.xMax = Mathf.RoundToInt(rect.xMax * (float)width); + result.yMin = Mathf.RoundToInt((1f - rect.yMax) * (float)height); + result.yMax = Mathf.RoundToInt((1f - rect.yMin) * (float)height); + } + else + { + result.xMin = rect.xMin * (float)width; + result.xMax = rect.xMax * (float)width; + result.yMin = (1f - rect.yMax) * (float)height; + result.yMax = (1f - rect.yMin) * (float)height; + } + return result; + } + + public static Rect MakePixelPerfect(Rect rect) + { + rect.xMin = Mathf.RoundToInt(rect.xMin); + rect.yMin = Mathf.RoundToInt(rect.yMin); + rect.xMax = Mathf.RoundToInt(rect.xMax); + rect.yMax = Mathf.RoundToInt(rect.yMax); + return rect; + } + + public static Rect MakePixelPerfect(Rect rect, int width, int height) + { + rect = ConvertToPixels(rect, width, height, round: true); + rect.xMin = Mathf.RoundToInt(rect.xMin); + rect.yMin = Mathf.RoundToInt(rect.yMin); + rect.xMax = Mathf.RoundToInt(rect.xMax); + rect.yMax = Mathf.RoundToInt(rect.yMax); + return ConvertToTexCoords(rect, width, height); + } + + public static Vector2 ConstrainRect(Vector2 minRect, Vector2 maxRect, Vector2 minArea, Vector2 maxArea) + { + Vector2 zero = Vector2.zero; + float num = maxRect.x - minRect.x; + float num2 = maxRect.y - minRect.y; + float num3 = maxArea.x - minArea.x; + float num4 = maxArea.y - minArea.y; + if (num > num3) + { + float num5 = num - num3; + minArea.x -= num5; + maxArea.x += num5; + } + if (num2 > num4) + { + float num6 = num2 - num4; + minArea.y -= num6; + maxArea.y += num6; + } + if (minRect.x < minArea.x) + { + zero.x += minArea.x - minRect.x; + } + if (maxRect.x > maxArea.x) + { + zero.x -= maxRect.x - maxArea.x; + } + if (minRect.y < minArea.y) + { + zero.y += minArea.y - minRect.y; + } + if (maxRect.y > maxArea.y) + { + zero.y -= maxRect.y - maxArea.y; + } + return zero; + } + + public static Bounds CalculateAbsoluteWidgetBounds(Transform trans) + { + if (trans != null) + { + UIWidget[] componentsInChildren = trans.GetComponentsInChildren(); + if (componentsInChildren.Length == 0) + { + return new Bounds(trans.position, Vector3.zero); + } + Vector3 center = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue); + Vector3 point = new Vector3(float.MinValue, float.MinValue, float.MinValue); + int i = 0; + for (int num = componentsInChildren.Length; i < num; i++) + { + UIWidget uIWidget = componentsInChildren[i]; + if (!uIWidget.enabled) + { + continue; + } + Vector3[] worldCorners = uIWidget.worldCorners; + for (int j = 0; j < 4; j++) + { + Vector3 vector = worldCorners[j]; + if (vector.x > point.x) + { + point.x = vector.x; + } + if (vector.y > point.y) + { + point.y = vector.y; + } + if (vector.z > point.z) + { + point.z = vector.z; + } + if (vector.x < center.x) + { + center.x = vector.x; + } + if (vector.y < center.y) + { + center.y = vector.y; + } + if (vector.z < center.z) + { + center.z = vector.z; + } + } + } + Bounds result = new Bounds(center, Vector3.zero); + result.Encapsulate(point); + return result; + } + return new Bounds(Vector3.zero, Vector3.zero); + } + + public static Bounds CalculateRelativeWidgetBounds(Transform trans) + { + return CalculateRelativeWidgetBounds(trans, trans, considerInactive: false); + } + + public static Bounds CalculateRelativeWidgetBounds(Transform trans, bool considerInactive) + { + return CalculateRelativeWidgetBounds(trans, trans, considerInactive); + } + + public static Bounds CalculateRelativeWidgetBounds(Transform relativeTo, Transform content) + { + return CalculateRelativeWidgetBounds(relativeTo, content, considerInactive: false); + } + + public static Bounds CalculateRelativeWidgetBounds(Transform relativeTo, Transform content, bool considerInactive, bool considerChildren = true) + { + if (content != null && relativeTo != null) + { + bool isSet = false; + Matrix4x4 toLocal = relativeTo.worldToLocalMatrix; + Vector3 vMin = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue); + Vector3 vMax = new Vector3(float.MinValue, float.MinValue, float.MinValue); + CalculateRelativeWidgetBounds(content, considerInactive, isRoot: true, ref toLocal, ref vMin, ref vMax, ref isSet, considerChildren); + if (isSet) + { + Bounds result = new Bounds(vMin, Vector3.zero); + result.Encapsulate(vMax); + return result; + } + } + return new Bounds(Vector3.zero, Vector3.zero); + } + + [DebuggerHidden] + [DebuggerStepThrough] + private static void CalculateRelativeWidgetBounds(Transform content, bool considerInactive, bool isRoot, ref Matrix4x4 toLocal, ref Vector3 vMin, ref Vector3 vMax, ref bool isSet, bool considerChildren) + { + if (content == null || (!considerInactive && !NGUITools.GetActive(content.gameObject))) + { + return; + } + UIPanel uIPanel = (isRoot ? null : content.GetComponent()); + if (uIPanel != null && !uIPanel.enabled) + { + return; + } + if (uIPanel != null && uIPanel.clipping != UIDrawCall.Clipping.None) + { + Vector3[] worldCorners = uIPanel.worldCorners; + for (int i = 0; i < 4; i++) + { + Vector3 vector = toLocal.MultiplyPoint3x4(worldCorners[i]); + if (vector.x > vMax.x) + { + vMax.x = vector.x; + } + if (vector.y > vMax.y) + { + vMax.y = vector.y; + } + if (vector.z > vMax.z) + { + vMax.z = vector.z; + } + if (vector.x < vMin.x) + { + vMin.x = vector.x; + } + if (vector.y < vMin.y) + { + vMin.y = vector.y; + } + if (vector.z < vMin.z) + { + vMin.z = vector.z; + } + isSet = true; + } + return; + } + UIWidget component = content.GetComponent(); + if (component != null && component.enabled) + { + Vector3[] worldCorners2 = component.worldCorners; + for (int j = 0; j < 4; j++) + { + Vector3 vector2 = toLocal.MultiplyPoint3x4(worldCorners2[j]); + if (vector2.x > vMax.x) + { + vMax.x = vector2.x; + } + if (vector2.y > vMax.y) + { + vMax.y = vector2.y; + } + if (vector2.z > vMax.z) + { + vMax.z = vector2.z; + } + if (vector2.x < vMin.x) + { + vMin.x = vector2.x; + } + if (vector2.y < vMin.y) + { + vMin.y = vector2.y; + } + if (vector2.z < vMin.z) + { + vMin.z = vector2.z; + } + isSet = true; + } + if (!considerChildren) + { + return; + } + } + int k = 0; + for (int childCount = content.childCount; k < childCount; k++) + { + CalculateRelativeWidgetBounds(content.GetChild(k), considerInactive, isRoot: false, ref toLocal, ref vMin, ref vMax, ref isSet, considerChildren: true); + } + } + + public static Vector3 SpringDampen(ref Vector3 velocity, float strength, float deltaTime) + { + if (deltaTime > 1f) + { + deltaTime = 1f; + } + float f = 1f - strength * 0.001f; + int num = Mathf.RoundToInt(deltaTime * 1000f); + float num2 = Mathf.Pow(f, num); + Vector3 vector = velocity * ((num2 - 1f) / Mathf.Log(f)); + velocity *= num2; + return vector * 0.06f; + } + + public static Vector2 SpringDampen(ref Vector2 velocity, float strength, float deltaTime) + { + if (deltaTime > 1f) + { + deltaTime = 1f; + } + float f = 1f - strength * 0.001f; + int num = Mathf.RoundToInt(deltaTime * 1000f); + float num2 = Mathf.Pow(f, num); + Vector2 vector = velocity * ((num2 - 1f) / Mathf.Log(f)); + velocity *= num2; + return vector * 0.06f; + } + + public static float SpringLerp(float strength, float deltaTime) + { + if (deltaTime > 1f) + { + deltaTime = 1f; + } + int num = Mathf.RoundToInt(deltaTime * 1000f); + deltaTime = 0.001f * strength; + float num2 = 0f; + for (int i = 0; i < num; i++) + { + num2 = Mathf.Lerp(num2, 1f, deltaTime); + } + return num2; + } + + public static float SpringLerp(float from, float to, float strength, float deltaTime) + { + if (deltaTime > 1f) + { + deltaTime = 1f; + } + int num = Mathf.RoundToInt(deltaTime * 1000f); + deltaTime = 0.001f * strength; + for (int i = 0; i < num; i++) + { + from = Mathf.Lerp(from, to, deltaTime); + } + return from; + } + + public static Vector2 SpringLerp(Vector2 from, Vector2 to, float strength, float deltaTime) + { + return Vector2.Lerp(from, to, SpringLerp(strength, deltaTime)); + } + + public static Vector3 SpringLerp(Vector3 from, Vector3 to, float strength, float deltaTime) + { + return Vector3.Lerp(from, to, SpringLerp(strength, deltaTime)); + } + + public static Quaternion SpringLerp(Quaternion from, Quaternion to, float strength, float deltaTime) + { + return Quaternion.Slerp(from, to, SpringLerp(strength, deltaTime)); + } + + public static float RotateTowards(float from, float to, float maxAngle) + { + float num = WrapAngle(to - from); + if (Mathf.Abs(num) > maxAngle) + { + num = maxAngle * Mathf.Sign(num); + } + return from + num; + } + + private static float DistancePointToLineSegment(Vector2 point, Vector2 a, Vector2 b) + { + float sqrMagnitude = (b - a).sqrMagnitude; + if (sqrMagnitude == 0f) + { + return (point - a).magnitude; + } + float num = Vector2.Dot(point - a, b - a) / sqrMagnitude; + if (num < 0f) + { + return (point - a).magnitude; + } + if (num > 1f) + { + return (point - b).magnitude; + } + Vector2 vector = a + num * (b - a); + return (point - vector).magnitude; + } + + public static float DistanceToRectangle(Vector2[] screenPoints, Vector2 mousePos) + { + bool flag = false; + int val = 4; + for (int i = 0; i < 5; i++) + { + Vector3 vector = screenPoints[RepeatIndex(i, 4)]; + Vector3 vector2 = screenPoints[RepeatIndex(val, 4)]; + if (vector.y > mousePos.y != vector2.y > mousePos.y && mousePos.x < (vector2.x - vector.x) * (mousePos.y - vector.y) / (vector2.y - vector.y) + vector.x) + { + flag = !flag; + } + val = i; + } + if (!flag) + { + float num = -1f; + for (int j = 0; j < 4; j++) + { + Vector3 vector3 = screenPoints[j]; + Vector3 vector4 = screenPoints[RepeatIndex(j + 1, 4)]; + float num2 = DistancePointToLineSegment(mousePos, vector3, vector4); + if (num2 < num || num < 0f) + { + num = num2; + } + } + return num; + } + return 0f; + } + + public static float DistanceToRectangle(Vector3[] worldPoints, Vector2 mousePos, Camera cam) + { + Vector2[] array = new Vector2[4]; + for (int i = 0; i < 4; i++) + { + array[i] = cam.WorldToScreenPoint(worldPoints[i]); + } + return DistanceToRectangle(array, mousePos); + } + + public static Vector2 GetPivotOffset(UIWidget.Pivot pv) + { + Vector2 zero = Vector2.zero; + switch (pv) + { + case UIWidget.Pivot.Top: + case UIWidget.Pivot.Center: + case UIWidget.Pivot.Bottom: + zero.x = 0.5f; + break; + case UIWidget.Pivot.TopRight: + case UIWidget.Pivot.Right: + case UIWidget.Pivot.BottomRight: + zero.x = 1f; + break; + default: + zero.x = 0f; + break; + } + switch (pv) + { + case UIWidget.Pivot.Left: + case UIWidget.Pivot.Center: + case UIWidget.Pivot.Right: + zero.y = 0.5f; + break; + case UIWidget.Pivot.TopLeft: + case UIWidget.Pivot.Top: + case UIWidget.Pivot.TopRight: + zero.y = 1f; + break; + default: + zero.y = 0f; + break; + } + return zero; + } + + public static UIWidget.Pivot GetPivot(Vector2 offset) + { + if (offset.x == 0f) + { + if (offset.y == 0f) + { + return UIWidget.Pivot.BottomLeft; + } + if (offset.y == 1f) + { + return UIWidget.Pivot.TopLeft; + } + return UIWidget.Pivot.Left; + } + if (offset.x == 1f) + { + if (offset.y == 0f) + { + return UIWidget.Pivot.BottomRight; + } + if (offset.y == 1f) + { + return UIWidget.Pivot.TopRight; + } + return UIWidget.Pivot.Right; + } + if (offset.y == 0f) + { + return UIWidget.Pivot.Bottom; + } + if (offset.y == 1f) + { + return UIWidget.Pivot.Top; + } + return UIWidget.Pivot.Center; + } + + public static void MoveWidget(UIRect w, float x, float y) + { + MoveRect(w, x, y); + } + + public static void MoveRect(UIRect rect, float x, float y) + { + int num = Mathf.FloorToInt(x + 0.5f); + int num2 = Mathf.FloorToInt(y + 0.5f); + rect.cachedTransform.localPosition += new Vector3(num, num2); + int num3 = 0; + if ((bool)rect.leftAnchor.target) + { + num3++; + rect.leftAnchor.absolute += num; + } + if ((bool)rect.rightAnchor.target) + { + num3++; + rect.rightAnchor.absolute += num; + } + if ((bool)rect.bottomAnchor.target) + { + num3++; + rect.bottomAnchor.absolute += num2; + } + if ((bool)rect.topAnchor.target) + { + num3++; + rect.topAnchor.absolute += num2; + } + if (num3 != 0) + { + rect.UpdateAnchors(); + } + } + + public static void ResizeWidget(UIWidget w, UIWidget.Pivot pivot, float x, float y, int minWidth, int minHeight) + { + ResizeWidget(w, pivot, x, y, 2, 2, 100000, 100000); + } + + public static void ResizeWidget(UIWidget w, UIWidget.Pivot pivot, float x, float y, int minWidth, int minHeight, int maxWidth, int maxHeight) + { + if (pivot == UIWidget.Pivot.Center) + { + int num = Mathf.RoundToInt(x - (float)w.width); + int num2 = Mathf.RoundToInt(y - (float)w.height); + num -= num & 1; + num2 -= num2 & 1; + if ((num | num2) != 0) + { + num >>= 1; + num2 >>= 1; + AdjustWidget(w, -num, -num2, num, num2, minWidth, minHeight); + } + return; + } + Vector3 vector = new Vector3(x, y); + vector = Quaternion.Inverse(w.cachedTransform.localRotation) * vector; + switch (pivot) + { + case UIWidget.Pivot.BottomLeft: + AdjustWidget(w, vector.x, vector.y, 0f, 0f, minWidth, minHeight, maxWidth, maxHeight); + break; + case UIWidget.Pivot.Left: + AdjustWidget(w, vector.x, 0f, 0f, 0f, minWidth, minHeight, maxWidth, maxHeight); + break; + case UIWidget.Pivot.TopLeft: + AdjustWidget(w, vector.x, 0f, 0f, vector.y, minWidth, minHeight, maxWidth, maxHeight); + break; + case UIWidget.Pivot.Top: + AdjustWidget(w, 0f, 0f, 0f, vector.y, minWidth, minHeight, maxWidth, maxHeight); + break; + case UIWidget.Pivot.TopRight: + AdjustWidget(w, 0f, 0f, vector.x, vector.y, minWidth, minHeight, maxWidth, maxHeight); + break; + case UIWidget.Pivot.Right: + AdjustWidget(w, 0f, 0f, vector.x, 0f, minWidth, minHeight, maxWidth, maxHeight); + break; + case UIWidget.Pivot.BottomRight: + AdjustWidget(w, 0f, vector.y, vector.x, 0f, minWidth, minHeight, maxWidth, maxHeight); + break; + case UIWidget.Pivot.Bottom: + AdjustWidget(w, 0f, vector.y, 0f, 0f, minWidth, minHeight, maxWidth, maxHeight); + break; + case UIWidget.Pivot.Center: + break; + } + } + + public static void AdjustWidget(UIWidget w, float left, float bottom, float right, float top) + { + AdjustWidget(w, left, bottom, right, top, 2, 2, 100000, 100000); + } + + public static void AdjustWidget(UIWidget w, float left, float bottom, float right, float top, int minWidth, int minHeight) + { + AdjustWidget(w, left, bottom, right, top, minWidth, minHeight, 100000, 100000); + } + + public static void AdjustWidget(UIWidget w, float left, float bottom, float right, float top, int minWidth, int minHeight, int maxWidth, int maxHeight) + { + Vector2 pivotOffset = w.pivotOffset; + Transform cachedTransform = w.cachedTransform; + Quaternion localRotation = cachedTransform.localRotation; + int num = Mathf.FloorToInt(left + 0.5f); + int num2 = Mathf.FloorToInt(bottom + 0.5f); + int num3 = Mathf.FloorToInt(right + 0.5f); + int num4 = Mathf.FloorToInt(top + 0.5f); + if (pivotOffset.x == 0.5f && (num == 0 || num3 == 0)) + { + num = num >> 1 << 1; + num3 = num3 >> 1 << 1; + } + if (pivotOffset.y == 0.5f && (num2 == 0 || num4 == 0)) + { + num2 = num2 >> 1 << 1; + num4 = num4 >> 1 << 1; + } + Vector3 vector = localRotation * new Vector3(num, num4); + Vector3 vector2 = localRotation * new Vector3(num3, num4); + Vector3 vector3 = localRotation * new Vector3(num, num2); + Vector3 vector4 = localRotation * new Vector3(num3, num2); + Vector3 vector5 = localRotation * new Vector3(num, 0f); + Vector3 vector6 = localRotation * new Vector3(num3, 0f); + Vector3 vector7 = localRotation * new Vector3(0f, num4); + Vector3 vector8 = localRotation * new Vector3(0f, num2); + Vector3 zero = Vector3.zero; + if (pivotOffset.x == 0f && pivotOffset.y == 1f) + { + zero.x = vector.x; + zero.y = vector.y; + } + else if (pivotOffset.x == 1f && pivotOffset.y == 0f) + { + zero.x = vector4.x; + zero.y = vector4.y; + } + else if (pivotOffset.x == 0f && pivotOffset.y == 0f) + { + zero.x = vector3.x; + zero.y = vector3.y; + } + else if (pivotOffset.x == 1f && pivotOffset.y == 1f) + { + zero.x = vector2.x; + zero.y = vector2.y; + } + else if (pivotOffset.x == 0f && pivotOffset.y == 0.5f) + { + zero.x = vector5.x + (vector7.x + vector8.x) * 0.5f; + zero.y = vector5.y + (vector7.y + vector8.y) * 0.5f; + } + else if (pivotOffset.x == 1f && pivotOffset.y == 0.5f) + { + zero.x = vector6.x + (vector7.x + vector8.x) * 0.5f; + zero.y = vector6.y + (vector7.y + vector8.y) * 0.5f; + } + else if (pivotOffset.x == 0.5f && pivotOffset.y == 1f) + { + zero.x = vector7.x + (vector5.x + vector6.x) * 0.5f; + zero.y = vector7.y + (vector5.y + vector6.y) * 0.5f; + } + else if (pivotOffset.x == 0.5f && pivotOffset.y == 0f) + { + zero.x = vector8.x + (vector5.x + vector6.x) * 0.5f; + zero.y = vector8.y + (vector5.y + vector6.y) * 0.5f; + } + else if (pivotOffset.x == 0.5f && pivotOffset.y == 0.5f) + { + zero.x = (vector5.x + vector6.x + vector7.x + vector8.x) * 0.5f; + zero.y = (vector7.y + vector8.y + vector5.y + vector6.y) * 0.5f; + } + minWidth = Mathf.Max(minWidth, w.minWidth); + minHeight = Mathf.Max(minHeight, w.minHeight); + int num5 = w.width + num3 - num; + int num6 = w.height + num4 - num2; + Vector3 zero2 = Vector3.zero; + int num7 = num5; + if (num5 < minWidth) + { + num7 = minWidth; + } + else if (num5 > maxWidth) + { + num7 = maxWidth; + } + if (num5 != num7) + { + if (num != 0) + { + zero2.x -= Mathf.Lerp(num7 - num5, 0f, pivotOffset.x); + } + else + { + zero2.x += Mathf.Lerp(0f, num7 - num5, pivotOffset.x); + } + num5 = num7; + } + int num8 = num6; + if (num6 < minHeight) + { + num8 = minHeight; + } + else if (num6 > maxHeight) + { + num8 = maxHeight; + } + if (num6 != num8) + { + if (num2 != 0) + { + zero2.y -= Mathf.Lerp(num8 - num6, 0f, pivotOffset.y); + } + else + { + zero2.y += Mathf.Lerp(0f, num8 - num6, pivotOffset.y); + } + num6 = num8; + } + if (pivotOffset.x == 0.5f) + { + num5 = num5 >> 1 << 1; + } + if (pivotOffset.y == 0.5f) + { + num6 = num6 >> 1 << 1; + } + Vector3 vector9 = (cachedTransform.localPosition = cachedTransform.localPosition + zero + localRotation * zero2); + w.SetDimensions(num5, num6); + if (w.isAnchored) + { + cachedTransform = cachedTransform.parent; + float num9 = vector9.x - pivotOffset.x * (float)num5; + float num10 = vector9.y - pivotOffset.y * (float)num6; + if ((bool)w.leftAnchor.target) + { + w.leftAnchor.SetHorizontal(cachedTransform, num9); + } + if ((bool)w.rightAnchor.target) + { + w.rightAnchor.SetHorizontal(cachedTransform, num9 + (float)num5); + } + if ((bool)w.bottomAnchor.target) + { + w.bottomAnchor.SetVertical(cachedTransform, num10); + } + if ((bool)w.topAnchor.target) + { + w.topAnchor.SetVertical(cachedTransform, num10 + (float)num6); + } + } + } + + public static int AdjustByDPI(float height) + { + float num = Screen.dpi; + RuntimePlatform platform = Application.platform; + if (num == 0f) + { + num = ((platform == RuntimePlatform.Android || platform == RuntimePlatform.IPhonePlayer) ? 160f : 96f); + } + int num2 = Mathf.RoundToInt(height * (96f / num)); + if ((num2 & 1) == 1) + { + num2++; + } + return num2; + } + + public static Vector2 ScreenToPixels(Vector2 pos, Transform relativeTo) + { + Camera camera = NGUITools.FindCameraForLayer(relativeTo.gameObject.layer); + if (camera == null) + { + return pos; + } + Vector3 position = camera.ScreenToWorldPoint(pos); + return relativeTo.InverseTransformPoint(position); + } + + public static Vector2 ScreenToParentPixels(Vector2 pos, Transform relativeTo) + { + int layer = relativeTo.gameObject.layer; + if (relativeTo.parent != null) + { + relativeTo = relativeTo.parent; + } + Camera camera = NGUITools.FindCameraForLayer(layer); + if (camera == null) + { + return pos; + } + Vector3 vector = camera.ScreenToWorldPoint(pos); + return (relativeTo != null) ? relativeTo.InverseTransformPoint(vector) : vector; + } + + public static Vector3 WorldToLocalPoint(Vector3 worldPos, Camera worldCam, Camera uiCam, Transform relativeTo) + { + worldPos = worldCam.WorldToViewportPoint(worldPos); + worldPos = uiCam.ViewportToWorldPoint(worldPos); + if (relativeTo == null) + { + return worldPos; + } + relativeTo = relativeTo.parent; + if (relativeTo == null) + { + return worldPos; + } + return relativeTo.InverseTransformPoint(worldPos); + } + + public static void OverlayPosition(this Transform trans, Vector3 worldPos, Camera worldCam, Camera myCam) + { + worldPos = worldCam.WorldToViewportPoint(worldPos); + worldPos = myCam.ViewportToWorldPoint(worldPos); + Transform parent = trans.parent; + trans.localPosition = ((parent != null) ? parent.InverseTransformPoint(worldPos) : worldPos); + } + + public static void OverlayPosition(this Transform trans, Vector3 worldPos, Camera worldCam) + { + Camera camera = NGUITools.FindCameraForLayer(trans.gameObject.layer); + if (camera != null) + { + trans.OverlayPosition(worldPos, worldCam, camera); + } + } + + public static void OverlayPosition(this Transform trans, Transform target) + { + Camera camera = NGUITools.FindCameraForLayer(trans.gameObject.layer); + Camera camera2 = NGUITools.FindCameraForLayer(target.gameObject.layer); + if (camera != null && camera2 != null) + { + trans.OverlayPosition(target.position, camera2, camera); + } + } +} diff --git a/SVSim.BattleEngine/Engine/NGUITools.cs b/SVSim.BattleEngine/Engine/NGUITools.cs new file mode 100644 index 0000000..e65695f --- /dev/null +++ b/SVSim.BattleEngine/Engine/NGUITools.cs @@ -0,0 +1,1653 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using UnityEngine; + +public static class NGUITools +{ + private static AudioListener mListener; + + private static bool mLoaded = false; + + private static float mGlobalVolume = 1f; + + private static float mLastTimestamp = 0f; + + private static AudioClip mLastClip; + + private static Vector3[] mSides = new Vector3[4]; + + public static KeyCode[] keys = new KeyCode[145] + { + KeyCode.Backspace, + KeyCode.Tab, + KeyCode.Clear, + KeyCode.Return, + KeyCode.Pause, + KeyCode.Escape, + KeyCode.Space, + KeyCode.Exclaim, + KeyCode.DoubleQuote, + KeyCode.Hash, + KeyCode.Dollar, + KeyCode.Ampersand, + KeyCode.Quote, + KeyCode.LeftParen, + KeyCode.RightParen, + KeyCode.Asterisk, + KeyCode.Plus, + KeyCode.Comma, + KeyCode.Minus, + KeyCode.Period, + KeyCode.Slash, + KeyCode.Alpha0, + KeyCode.Alpha1, + KeyCode.Alpha2, + KeyCode.Alpha3, + KeyCode.Alpha4, + KeyCode.Alpha5, + KeyCode.Alpha6, + KeyCode.Alpha7, + KeyCode.Alpha8, + KeyCode.Alpha9, + KeyCode.Colon, + KeyCode.Semicolon, + KeyCode.Less, + KeyCode.Equals, + KeyCode.Greater, + KeyCode.Question, + KeyCode.At, + KeyCode.LeftBracket, + KeyCode.Backslash, + KeyCode.RightBracket, + KeyCode.Caret, + KeyCode.Underscore, + KeyCode.BackQuote, + KeyCode.A, + KeyCode.B, + KeyCode.C, + KeyCode.D, + KeyCode.E, + KeyCode.F, + KeyCode.G, + KeyCode.H, + KeyCode.I, + KeyCode.J, + KeyCode.K, + KeyCode.L, + KeyCode.M, + KeyCode.N, + KeyCode.O, + KeyCode.P, + KeyCode.Q, + KeyCode.R, + KeyCode.S, + KeyCode.T, + KeyCode.U, + KeyCode.V, + KeyCode.W, + KeyCode.X, + KeyCode.Y, + KeyCode.Z, + KeyCode.Delete, + KeyCode.Keypad0, + KeyCode.Keypad1, + KeyCode.Keypad2, + KeyCode.Keypad3, + KeyCode.Keypad4, + KeyCode.Keypad5, + KeyCode.Keypad6, + KeyCode.Keypad7, + KeyCode.Keypad8, + KeyCode.Keypad9, + KeyCode.KeypadPeriod, + KeyCode.KeypadDivide, + KeyCode.KeypadMultiply, + KeyCode.KeypadMinus, + KeyCode.KeypadPlus, + KeyCode.KeypadEnter, + KeyCode.KeypadEquals, + KeyCode.UpArrow, + KeyCode.DownArrow, + KeyCode.RightArrow, + KeyCode.LeftArrow, + KeyCode.Insert, + KeyCode.Home, + KeyCode.End, + KeyCode.PageUp, + KeyCode.PageDown, + KeyCode.F1, + KeyCode.F2, + KeyCode.F3, + KeyCode.F4, + KeyCode.F5, + KeyCode.F6, + KeyCode.F7, + KeyCode.F8, + KeyCode.F9, + KeyCode.F10, + KeyCode.F11, + KeyCode.F12, + KeyCode.F13, + KeyCode.F14, + KeyCode.F15, + KeyCode.Numlock, + KeyCode.CapsLock, + KeyCode.ScrollLock, + KeyCode.RightShift, + KeyCode.LeftShift, + KeyCode.RightControl, + KeyCode.LeftControl, + KeyCode.RightAlt, + KeyCode.LeftAlt, + KeyCode.Mouse3, + KeyCode.Mouse4, + KeyCode.Mouse5, + KeyCode.Mouse6, + KeyCode.JoystickButton0, + KeyCode.JoystickButton1, + KeyCode.JoystickButton2, + KeyCode.JoystickButton3, + KeyCode.JoystickButton4, + KeyCode.JoystickButton5, + KeyCode.JoystickButton6, + KeyCode.JoystickButton7, + KeyCode.JoystickButton8, + KeyCode.JoystickButton9, + KeyCode.JoystickButton10, + KeyCode.JoystickButton11, + KeyCode.JoystickButton12, + KeyCode.JoystickButton13, + KeyCode.JoystickButton14, + KeyCode.JoystickButton15, + KeyCode.JoystickButton16, + KeyCode.JoystickButton17, + KeyCode.JoystickButton18, + KeyCode.JoystickButton19 + }; + + public static float soundVolume + { + get + { + if (!mLoaded) + { + mLoaded = true; + mGlobalVolume = PlayerPrefs.GetFloat("Sound", 1f); + } + return mGlobalVolume; + } + set + { + if (mGlobalVolume != value) + { + mLoaded = true; + mGlobalVolume = value; + PlayerPrefs.SetFloat("Sound", value); + } + } + } + + public static string clipboard + { + get + { + TextEditor textEditor = new TextEditor(); + textEditor.Paste(); + return textEditor.content.text; + } + set + { + TextEditor textEditor = new TextEditor(); + textEditor.content = new GUIContent(value); + textEditor.OnFocus(); + textEditor.Copy(); + } + } + + public static Vector2 screenSize => new Vector2(Screen.width, Screen.height); + + public static AudioSource PlaySound(AudioClip clip) + { + return PlaySound(clip, 1f, 1f); + } + + public static AudioSource PlaySound(AudioClip clip, float volume) + { + return PlaySound(clip, volume, 1f); + } + + public static AudioSource PlaySound(AudioClip clip, float volume, float pitch) + { + float time = RealTime.time; + if (mLastClip == clip && mLastTimestamp + 0.1f > time) + { + return null; + } + mLastClip = clip; + mLastTimestamp = time; + volume *= soundVolume; + if (clip != null && volume > 0.01f) + { + if (mListener == null || !GetActive(mListener)) + { + if (UnityEngine.Object.FindObjectsOfType(typeof(AudioListener)) is AudioListener[] array) + { + for (int i = 0; i < array.Length; i++) + { + if (GetActive(array[i])) + { + mListener = array[i]; + break; + } + } + } + if (mListener == null) + { + Camera camera = Camera.main; + if (camera == null) + { + camera = UnityEngine.Object.FindObjectOfType(typeof(Camera)) as Camera; + } + if (camera != null) + { + mListener = camera.gameObject.AddComponent(); + } + } + } + if (mListener != null && mListener.enabled && GetActive(mListener.gameObject)) + { + AudioSource audioSource = mListener.GetComponent(); + if (audioSource == null) + { + audioSource = mListener.gameObject.AddComponent(); + } + audioSource.priority = 50; + audioSource.pitch = pitch; + audioSource.PlayOneShot(clip, volume); + return audioSource; + } + } + return null; + } + + public static int RandomRange(int min, int max) + { + if (min == max) + { + return min; + } + return UnityEngine.Random.Range(min, max + 1); + } + + public static string GetHierarchy(GameObject obj) + { + if (obj == null) + { + return ""; + } + string text = obj.name; + while (obj.transform.parent != null) + { + obj = obj.transform.parent.gameObject; + text = obj.name + "\\" + text; + } + return text; + } + + public static T[] FindActive() where T : Component + { + return UnityEngine.Object.FindObjectsOfType(typeof(T)) as T[]; + } + + public static Camera FindCameraForLayer(int layer) + { + int num = 1 << layer; + Camera cachedCamera; + for (int i = 0; i < UICamera.list.size; i++) + { + cachedCamera = UICamera.list.buffer[i].cachedCamera; + if ((bool)cachedCamera && (cachedCamera.cullingMask & num) != 0) + { + return cachedCamera; + } + } + cachedCamera = Camera.main; + if ((bool)cachedCamera && (cachedCamera.cullingMask & num) != 0) + { + return cachedCamera; + } + Camera[] array = new Camera[Camera.allCamerasCount]; + int allCameras = Camera.GetAllCameras(array); + for (int j = 0; j < allCameras; j++) + { + cachedCamera = array[j]; + if ((bool)cachedCamera && cachedCamera.enabled && (cachedCamera.cullingMask & num) != 0) + { + return cachedCamera; + } + } + return null; + } + + public static void AddWidgetCollider(GameObject go) + { + AddWidgetCollider(go, considerInactive: false); + } + + public static void AddWidgetCollider(GameObject go, bool considerInactive) + { + if (!(go != null)) + { + return; + } + Collider component = go.GetComponent(); + BoxCollider boxCollider = component as BoxCollider; + if (boxCollider != null) + { + UpdateWidgetCollider(boxCollider, considerInactive); + } + else + { + if (component != null) + { + return; + } + BoxCollider2D component2 = go.GetComponent(); + if (component2 != null) + { + UpdateWidgetCollider(component2, considerInactive); + return; + } + UICamera uICamera = UICamera.FindCameraForLayer(go.layer); + if (uICamera != null && (uICamera.eventType == UICamera.EventType.World_2D || uICamera.eventType == UICamera.EventType.UI_2D)) + { + component2 = go.AddComponent(); + component2.isTrigger = true; + UIWidget component3 = go.GetComponent(); + if (component3 != null) + { + component3.autoResizeBoxCollider = true; + } + UpdateWidgetCollider(component2, considerInactive); + } + else + { + boxCollider = go.AddComponent(); + boxCollider.isTrigger = true; + UIWidget component4 = go.GetComponent(); + if (component4 != null) + { + component4.autoResizeBoxCollider = true; + } + UpdateWidgetCollider(boxCollider, considerInactive); + } + } + } + + public static void UpdateWidgetCollider(GameObject go) + { + UpdateWidgetCollider(go, considerInactive: false); + } + + public static void UpdateWidgetCollider(GameObject go, bool considerInactive) + { + if (!(go != null)) + { + return; + } + BoxCollider component = go.GetComponent(); + if (component != null) + { + UpdateWidgetCollider(component, considerInactive); + return; + } + BoxCollider2D component2 = go.GetComponent(); + if (component2 != null) + { + UpdateWidgetCollider(component2, considerInactive); + } + } + + public static void UpdateWidgetCollider(BoxCollider box, bool considerInactive) + { + if (!(box != null)) + { + return; + } + GameObject gameObject = box.gameObject; + UIWidget component = gameObject.GetComponent(); + if (component != null) + { + Vector4 drawRegion = component.drawRegion; + if (drawRegion.x != 0f || drawRegion.y != 0f || drawRegion.z != 1f || drawRegion.w != 1f) + { + Vector4 drawingDimensions = component.drawingDimensions; + box.center = new Vector3((drawingDimensions.x + drawingDimensions.z) * 0.5f, (drawingDimensions.y + drawingDimensions.w) * 0.5f); + box.size = new Vector3(drawingDimensions.z - drawingDimensions.x, drawingDimensions.w - drawingDimensions.y); + } + else + { + Vector3[] localCorners = component.localCorners; + box.center = Vector3.Lerp(localCorners[0], localCorners[2], 0.5f); + box.size = localCorners[2] - localCorners[0]; + } + } + else + { + Bounds bounds = NGUIMath.CalculateRelativeWidgetBounds(gameObject.transform, considerInactive); + box.center = bounds.center; + box.size = new Vector3(bounds.size.x, bounds.size.y, 0f); + } + } + + public static void UpdateWidgetCollider(BoxCollider2D box, bool considerInactive) + { + if (box != null) + { + GameObject gameObject = box.gameObject; + UIWidget component = gameObject.GetComponent(); + if (component != null) + { + Vector3[] localCorners = component.localCorners; + box.offset = Vector3.Lerp(localCorners[0], localCorners[2], 0.5f); + box.size = localCorners[2] - localCorners[0]; + } + else + { + Bounds bounds = NGUIMath.CalculateRelativeWidgetBounds(gameObject.transform, considerInactive); + box.offset = bounds.center; + box.size = new Vector2(bounds.size.x, bounds.size.y); + } + } + } + + public static string GetTypeName() + { + string text = typeof(T).ToString(); + if (text.StartsWith("UI")) + { + text = text.Substring(2); + } + else if (text.StartsWith("UnityEngine.")) + { + text = text.Substring(12); + } + return text; + } + + public static string GetTypeName(UnityEngine.Object obj) + { + if (obj == null) + { + return "Null"; + } + string text = obj.GetType().ToString(); + if (text.StartsWith("UI")) + { + text = text.Substring(2); + } + else if (text.StartsWith("UnityEngine.")) + { + text = text.Substring(12); + } + return text; + } + + public static void RegisterUndo(UnityEngine.Object obj, string name) + { + } + + public static void SetDirty(UnityEngine.Object obj) + { + } + + public static void CheckForPrefabStage(GameObject gameObject) + { + } + + public static GameObject AddChild(GameObject parent) + { + return AddChild(parent, undo: true); + } + + public static GameObject AddChild(GameObject parent, bool undo) + { + GameObject gameObject = new GameObject(); + if (parent != null) + { + Transform transform = gameObject.transform; + transform.parent = parent.transform; + transform.localPosition = Vector3.zero; + transform.localRotation = Quaternion.identity; + transform.localScale = Vector3.one; + gameObject.layer = parent.layer; + } + return gameObject; + } + + public static GameObject AddChild(GameObject parent, GameObject prefab) + { + GameObject gameObject = UnityEngine.Object.Instantiate(prefab); + if (gameObject != null && parent != null) + { + Transform transform = gameObject.transform; + transform.parent = parent.transform; + transform.localPosition = Vector3.zero; + transform.localRotation = Quaternion.identity; + transform.localScale = Vector3.one; + gameObject.layer = parent.layer; + } + return gameObject; + } + + public static int CalculateRaycastDepth(GameObject go) + { + UIWidget component = go.GetComponent(); + if (component != null) + { + return component.raycastDepth; + } + UIWidget[] componentsInChildren = go.GetComponentsInChildren(); + if (componentsInChildren.Length == 0) + { + return 0; + } + int num = int.MaxValue; + int i = 0; + for (int num2 = componentsInChildren.Length; i < num2; i++) + { + if (componentsInChildren[i].enabled) + { + num = Mathf.Min(num, componentsInChildren[i].raycastDepth); + } + } + return num; + } + + public static int CalculateNextDepth(GameObject go) + { + if ((bool)go) + { + int num = -1; + UIWidget[] componentsInChildren = go.GetComponentsInChildren(); + int i = 0; + for (int num2 = componentsInChildren.Length; i < num2; i++) + { + num = Mathf.Max(num, componentsInChildren[i].depth); + } + return num + 1; + } + return 0; + } + + public static int CalculateNextDepth(GameObject go, bool ignoreChildrenWithColliders) + { + if ((bool)go && ignoreChildrenWithColliders) + { + int num = -1; + UIWidget[] componentsInChildren = go.GetComponentsInChildren(); + int i = 0; + for (int num2 = componentsInChildren.Length; i < num2; i++) + { + UIWidget uIWidget = componentsInChildren[i]; + if (!(uIWidget.cachedGameObject != go) || (!(uIWidget.GetComponent() != null) && !(uIWidget.GetComponent() != null))) + { + num = Mathf.Max(num, uIWidget.depth); + } + } + return num + 1; + } + return CalculateNextDepth(go); + } + + public static int AdjustDepth(GameObject go, int adjustment) + { + if (go != null) + { + UIPanel component = go.GetComponent(); + if (component != null) + { + UIPanel[] componentsInChildren = go.GetComponentsInChildren(includeInactive: true); + for (int i = 0; i < componentsInChildren.Length; i++) + { + componentsInChildren[i].depth += adjustment; + } + return 1; + } + component = FindInParents(go); + if (component == null) + { + return 0; + } + UIWidget[] componentsInChildren2 = go.GetComponentsInChildren(includeInactive: true); + int j = 0; + for (int num = componentsInChildren2.Length; j < num; j++) + { + UIWidget uIWidget = componentsInChildren2[j]; + if (!(uIWidget.panel != component)) + { + uIWidget.depth += adjustment; + } + } + return 2; + } + return 0; + } + + public static void BringForward(GameObject go) + { + switch (AdjustDepth(go, 1000)) + { + case 1: + NormalizePanelDepths(); + break; + case 2: + NormalizeWidgetDepths(); + break; + } + } + + public static void PushBack(GameObject go) + { + switch (AdjustDepth(go, -1000)) + { + case 1: + NormalizePanelDepths(); + break; + case 2: + NormalizeWidgetDepths(); + break; + } + } + + public static void NormalizeDepths() + { + NormalizeWidgetDepths(); + NormalizePanelDepths(); + } + + public static void NormalizeWidgetDepths() + { + NormalizeWidgetDepths(FindActive()); + } + + public static void NormalizeWidgetDepths(GameObject go) + { + NormalizeWidgetDepths(go.GetComponentsInChildren()); + } + + public static void NormalizeWidgetDepths(UIWidget[] list) + { + int num = list.Length; + if (num <= 0) + { + return; + } + Array.Sort(list, UIWidget.FullCompareFunc); + int num2 = 0; + int depth = list[0].depth; + for (int i = 0; i < num; i++) + { + UIWidget uIWidget = list[i]; + if (uIWidget.depth == depth) + { + uIWidget.depth = num2; + continue; + } + depth = uIWidget.depth; + num2 = (uIWidget.depth = num2 + 1); + } + } + + public static void NormalizePanelDepths() + { + UIPanel[] array = FindActive(); + int num = array.Length; + if (num <= 0) + { + return; + } + Array.Sort(array, UIPanel.CompareFunc); + int num2 = 0; + int depth = array[0].depth; + for (int i = 0; i < num; i++) + { + UIPanel uIPanel = array[i]; + if (uIPanel.depth == depth) + { + uIPanel.depth = num2; + continue; + } + depth = uIPanel.depth; + num2 = (uIPanel.depth = num2 + 1); + } + } + + public static UIPanel CreateUI(bool advanced3D) + { + return CreateUI(null, advanced3D, -1); + } + + public static UIPanel CreateUI(bool advanced3D, int layer) + { + return CreateUI(null, advanced3D, layer); + } + + public static UIPanel CreateUI(Transform trans, bool advanced3D, int layer) + { + UIRoot uIRoot = ((trans != null) ? FindInParents(trans.gameObject) : null); + if (uIRoot == null && UIRoot.list.Count > 0) + { + foreach (UIRoot item in UIRoot.list) + { + if (item.gameObject.layer == layer) + { + uIRoot = item; + break; + } + } + } + if (uIRoot == null) + { + int i = 0; + for (int count = UIPanel.list.Count; i < count; i++) + { + UIPanel uIPanel = UIPanel.list[i]; + GameObject gameObject = uIPanel.gameObject; + if (gameObject.hideFlags == HideFlags.None && gameObject.layer == layer) + { + trans.parent = uIPanel.transform; + trans.localScale = Vector3.one; + return uIPanel; + } + } + } + if (uIRoot != null) + { + UICamera componentInChildren = uIRoot.GetComponentInChildren(); + if (componentInChildren != null && componentInChildren.GetComponent().orthographic == advanced3D) + { + trans = null; + uIRoot = null; + } + } + if (uIRoot == null) + { + GameObject gameObject2 = AddChild(null, undo: false); + uIRoot = gameObject2.AddComponent(); + if (layer == -1) + { + layer = LayerMask.NameToLayer("UI"); + } + if (layer == -1) + { + layer = LayerMask.NameToLayer("2D UI"); + } + gameObject2.layer = layer; + if (advanced3D) + { + gameObject2.name = "UI Root (3D)"; + uIRoot.scalingStyle = UIRoot.Scaling.Constrained; + } + else + { + gameObject2.name = "UI Root"; + uIRoot.scalingStyle = UIRoot.Scaling.Flexible; + } + } + UIPanel uIPanel2 = uIRoot.GetComponentInChildren(); + if (uIPanel2 == null) + { + Camera[] array = FindActive(); + float num = -1f; + bool flag = false; + int num2 = 1 << uIRoot.gameObject.layer; + foreach (Camera camera in array) + { + if (camera.clearFlags == CameraClearFlags.Color || camera.clearFlags == CameraClearFlags.Skybox) + { + flag = true; + } + num = Mathf.Max(num, camera.depth); + camera.cullingMask &= ~num2; + } + Camera camera2 = AddChild(uIRoot.gameObject, undo: false); + camera2.gameObject.AddComponent(); + camera2.clearFlags = (flag ? CameraClearFlags.Depth : CameraClearFlags.Color); + camera2.backgroundColor = Color.grey; + camera2.cullingMask = num2; + camera2.depth = num + 1f; + if (advanced3D) + { + camera2.nearClipPlane = 0.1f; + camera2.farClipPlane = 4f; + camera2.transform.localPosition = new Vector3(0f, 0f, -700f); + } + else + { + camera2.orthographic = true; + camera2.orthographicSize = 1f; + camera2.nearClipPlane = -10f; + camera2.farClipPlane = 10f; + } + AudioListener[] array2 = FindActive(); + if (array2 == null || array2.Length == 0) + { + camera2.gameObject.AddComponent(); + } + uIPanel2 = uIRoot.gameObject.AddComponent(); + } + if (trans != null) + { + while (trans.parent != null) + { + trans = trans.parent; + } + if (IsChild(trans, uIPanel2.transform)) + { + uIPanel2 = trans.gameObject.AddComponent(); + } + else + { + trans.parent = uIPanel2.transform; + trans.localScale = Vector3.one; + trans.localPosition = Vector3.zero; + SetChildLayer(uIPanel2.cachedTransform, uIPanel2.cachedGameObject.layer); + } + } + return uIPanel2; + } + + public static void SetChildLayer(Transform t, int layer) + { + for (int i = 0; i < t.childCount; i++) + { + Transform child = t.GetChild(i); + child.gameObject.layer = layer; + SetChildLayer(child, layer); + } + } + + public static T AddChild(GameObject parent) where T : Component + { + GameObject gameObject = AddChild(parent); + gameObject.name = GetTypeName(); + return gameObject.AddComponent(); + } + + public static T AddChild(GameObject parent, bool undo) where T : Component + { + GameObject gameObject = AddChild(parent, undo); + gameObject.name = GetTypeName(); + return gameObject.AddComponent(); + } + + public static T AddWidget(GameObject go, int depth = int.MaxValue) where T : UIWidget + { + if (depth == int.MaxValue) + { + depth = CalculateNextDepth(go); + } + T val = AddChild(go); + val.width = 100; + val.height = 100; + val.depth = depth; + return val; + } + + public static UISprite AddSprite(GameObject go, UIAtlas atlas, string spriteName, int depth = int.MaxValue) + { + UISpriteData uISpriteData = ((atlas != null) ? atlas.GetSprite(spriteName) : null); + UISprite uISprite = AddWidget(go, depth); + uISprite.type = ((uISpriteData != null && uISpriteData.hasBorder) ? UIBasicSprite.Type.Sliced : UIBasicSprite.Type.Simple); + uISprite.atlas = atlas; + uISprite.spriteName = spriteName; + return uISprite; + } + + public static GameObject GetRoot(GameObject go) + { + Transform transform = go.transform; + while (true) + { + Transform parent = transform.parent; + if (parent == null) + { + break; + } + transform = parent; + } + return transform.gameObject; + } + + public static T FindInParents(GameObject go) where T : Component + { + if (go == null) + { + return null; + } + T component = go.GetComponent(); + if (component == null) + { + Transform parent = go.transform.parent; + while (parent != null && component == null) + { + component = parent.gameObject.GetComponent(); + parent = parent.parent; + } + } + return component; + } + + public static T FindInParents(Transform trans) where T : Component + { + if (trans == null) + { + return null; + } + return trans.GetComponentInParent(); + } + + public static void Destroy(UnityEngine.Object obj) + { + if (!obj) + { + return; + } + if (obj is Transform) + { + Transform transform = obj as Transform; + GameObject gameObject = transform.gameObject; + if (Application.isPlaying) + { + transform.parent = null; + UnityEngine.Object.Destroy(gameObject); + } + else + { + UnityEngine.Object.DestroyImmediate(gameObject); + } + } + else if (obj is GameObject) + { + GameObject gameObject2 = obj as GameObject; + Transform transform2 = gameObject2.transform; + if (Application.isPlaying) + { + transform2.parent = null; + UnityEngine.Object.Destroy(gameObject2); + } + else + { + UnityEngine.Object.DestroyImmediate(gameObject2); + } + } + else if (Application.isPlaying) + { + UnityEngine.Object.Destroy(obj); + } + else + { + UnityEngine.Object.DestroyImmediate(obj); + } + } + + public static void DestroyChildren(this Transform t) + { + bool isPlaying = Application.isPlaying; + while (t.childCount != 0) + { + Transform child = t.GetChild(0); + if (isPlaying) + { + child.parent = null; + UnityEngine.Object.Destroy(child.gameObject); + } + else + { + UnityEngine.Object.DestroyImmediate(child.gameObject); + } + } + } + + public static void DestroyImmediate(UnityEngine.Object obj) + { + if (obj != null) + { + if (Application.isEditor) + { + UnityEngine.Object.DestroyImmediate(obj); + } + else + { + UnityEngine.Object.Destroy(obj); + } + } + } + + public static void Broadcast(string funcName) + { + GameObject[] array = UnityEngine.Object.FindObjectsOfType(typeof(GameObject)) as GameObject[]; + int i = 0; + for (int num = array.Length; i < num; i++) + { + array[i].SendMessage(funcName, SendMessageOptions.DontRequireReceiver); + } + } + + public static void Broadcast(string funcName, object param) + { + GameObject[] array = UnityEngine.Object.FindObjectsOfType(typeof(GameObject)) as GameObject[]; + int i = 0; + for (int num = array.Length; i < num; i++) + { + array[i].SendMessage(funcName, param, SendMessageOptions.DontRequireReceiver); + } + } + + public static bool IsChild(Transform parent, Transform child) + { + if (parent == null || child == null) + { + return false; + } + while (child != null) + { + if (child == parent) + { + return true; + } + child = child.parent; + } + return false; + } + + private static void Activate(Transform t) + { + Activate(t, compatibilityMode: false); + } + + private static void Activate(Transform t, bool compatibilityMode) + { + SetActiveSelf(t.gameObject, state: true); + if (!compatibilityMode) + { + return; + } + int i = 0; + for (int childCount = t.childCount; i < childCount; i++) + { + if (t.GetChild(i).gameObject.activeSelf) + { + return; + } + } + int j = 0; + for (int childCount2 = t.childCount; j < childCount2; j++) + { + Activate(t.GetChild(j), compatibilityMode: true); + } + } + + private static void Deactivate(Transform t) + { + SetActiveSelf(t.gameObject, state: false); + } + + public static void SetActive(GameObject go, bool state) + { + SetActive(go, state, compatibilityMode: true); + } + + public static void SetActive(GameObject go, bool state, bool compatibilityMode) + { + if ((bool)go) + { + if (state) + { + Activate(go.transform, compatibilityMode); + CallCreatePanel(go.transform); + } + else + { + Deactivate(go.transform); + } + } + } + + [DebuggerHidden] + [DebuggerStepThrough] + private static void CallCreatePanel(Transform t) + { + UIWidget component = t.GetComponent(); + if (component != null) + { + component.CreatePanel(); + } + int i = 0; + for (int childCount = t.childCount; i < childCount; i++) + { + CallCreatePanel(t.GetChild(i)); + } + } + + public static void SetActiveChildren(GameObject go, bool state) + { + Transform transform = go.transform; + if (state) + { + int i = 0; + for (int childCount = transform.childCount; i < childCount; i++) + { + Activate(transform.GetChild(i)); + } + } + else + { + int j = 0; + for (int childCount2 = transform.childCount; j < childCount2; j++) + { + Deactivate(transform.GetChild(j)); + } + } + } + + [Obsolete("Use NGUITools.GetActive instead")] + public static bool IsActive(Behaviour mb) + { + if (mb != null && mb.enabled) + { + return mb.gameObject.activeInHierarchy; + } + return false; + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static bool GetActive(Behaviour mb) + { + if ((bool)mb && mb.enabled) + { + return mb.gameObject.activeInHierarchy; + } + return false; + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static bool GetActive(GameObject go) + { + if ((bool)go) + { + return go.activeInHierarchy; + } + return false; + } + + [DebuggerHidden] + [DebuggerStepThrough] + public static void SetActiveSelf(GameObject go, bool state) + { + go.SetActive(state); + } + + public static void SetLayer(GameObject go, int layer) + { + go.layer = layer; + Transform transform = go.transform; + int i = 0; + for (int childCount = transform.childCount; i < childCount; i++) + { + SetLayer(transform.GetChild(i).gameObject, layer); + } + } + + public static Vector3 Round(Vector3 v) + { + v.x = Mathf.Round(v.x); + v.y = Mathf.Round(v.y); + v.z = Mathf.Round(v.z); + return v; + } + + public static void MakePixelPerfect(Transform t) + { + UIWidget component = t.GetComponent(); + if (component != null) + { + component.MakePixelPerfect(); + } + if (t.GetComponent() == null && t.GetComponent() == null) + { + t.localPosition = Round(t.localPosition); + t.localScale = Round(t.localScale); + } + int i = 0; + for (int childCount = t.childCount; i < childCount; i++) + { + MakePixelPerfect(t.GetChild(i)); + } + } + + public static bool Save(string fileName, byte[] bytes) + { + string path = Application.persistentDataPath + "/" + fileName; + if (bytes == null) + { + if (File.Exists(path)) + { + File.Delete(path); + } + return true; + } + FileStream fileStream = null; + try + { + fileStream = File.Create(path); + } + catch (Exception ex) + { + Debug.LogError(ex.Message); + return false; + } + fileStream.Write(bytes, 0, bytes.Length); + fileStream.Close(); + return true; + } + + public static byte[] Load(string fileName) + { + string path = Application.persistentDataPath + "/" + fileName; + if (File.Exists(path)) + { + return File.ReadAllBytes(path); + } + return null; + } + + public static Color ApplyPMA(Color c) + { + if (c.a != 1f) + { + c.r *= c.a; + c.g *= c.a; + c.b *= c.a; + } + return c; + } + + public static void MarkParentAsChanged(GameObject go) + { + UIRect[] componentsInChildren = go.GetComponentsInChildren(); + int i = 0; + for (int num = componentsInChildren.Length; i < num; i++) + { + componentsInChildren[i].ParentHasChanged(); + } + } + + [Obsolete("Use NGUIText.EncodeColor instead")] + public static string EncodeColor(Color c) + { + return NGUIText.EncodeColor24(c); + } + + [Obsolete("Use NGUIText.ParseColor instead")] + public static Color ParseColor(string text, int offset) + { + return NGUIText.ParseColor24(text, offset); + } + + [Obsolete("Use NGUIText.StripSymbols instead")] + public static string StripSymbols(string text) + { + return NGUIText.StripSymbols(text); + } + + public static T AddMissingComponent(this GameObject go) where T : Component + { + T val = go.GetComponent(); + if (val == null) + { + val = go.AddComponent(); + } + return val; + } + + public static Vector3[] GetSides(this Camera cam) + { + return cam.GetSides(Mathf.Lerp(cam.nearClipPlane, cam.farClipPlane, 0.5f), null); + } + + public static Vector3[] GetSides(this Camera cam, float depth) + { + return cam.GetSides(depth, null); + } + + public static Vector3[] GetSides(this Camera cam, Transform relativeTo) + { + return cam.GetSides(Mathf.Lerp(cam.nearClipPlane, cam.farClipPlane, 0.5f), relativeTo); + } + + public static Vector3[] GetSides(this Camera cam, float depth, Transform relativeTo) + { + if (cam.orthographic) + { + float orthographicSize = cam.orthographicSize; + float num = 0f - orthographicSize; + float num2 = orthographicSize; + float y = 0f - orthographicSize; + float y2 = orthographicSize; + Rect rect = cam.rect; + Vector2 vector = screenSize; + float num3 = vector.x / vector.y; + num3 *= rect.width / rect.height; + num *= num3; + num2 *= num3; + Transform transform = cam.transform; + Quaternion rotation = transform.rotation; + Vector3 position = transform.position; + int num4 = Mathf.RoundToInt(vector.x); + int num5 = Mathf.RoundToInt(vector.y); + if ((num4 & 1) == 1) + { + position.x -= 1f / vector.x; + } + if ((num5 & 1) == 1) + { + position.y += 1f / vector.y; + } + mSides[0] = rotation * new Vector3(num, 0f, depth) + position; + mSides[1] = rotation * new Vector3(0f, y2, depth) + position; + mSides[2] = rotation * new Vector3(num2, 0f, depth) + position; + mSides[3] = rotation * new Vector3(0f, y, depth) + position; + if (num3 > 1.7777778f) + { + mSides[0] *= AspectCamera.SafeAreaRate; + mSides[2] *= AspectCamera.SafeAreaRate; + } + } + else + { + mSides[0] = cam.ViewportToWorldPoint(new Vector3(0f, 0.5f, depth)); + mSides[1] = cam.ViewportToWorldPoint(new Vector3(0.5f, 1f, depth)); + mSides[2] = cam.ViewportToWorldPoint(new Vector3(1f, 0.5f, depth)); + mSides[3] = cam.ViewportToWorldPoint(new Vector3(0.5f, 0f, depth)); + } + if (relativeTo != null) + { + for (int i = 0; i < 4; i++) + { + mSides[i] = relativeTo.InverseTransformPoint(mSides[i]); + } + } + return mSides; + } + + public static Vector3[] GetWorldCorners(this Camera cam) + { + float depth = Mathf.Lerp(cam.nearClipPlane, cam.farClipPlane, 0.5f); + return cam.GetWorldCorners(depth, null); + } + + public static Vector3[] GetWorldCorners(this Camera cam, float depth) + { + return cam.GetWorldCorners(depth, null); + } + + public static Vector3[] GetWorldCorners(this Camera cam, Transform relativeTo) + { + return cam.GetWorldCorners(Mathf.Lerp(cam.nearClipPlane, cam.farClipPlane, 0.5f), relativeTo); + } + + public static Vector3[] GetWorldCorners(this Camera cam, float depth, Transform relativeTo) + { + if (cam.orthographic) + { + float orthographicSize = cam.orthographicSize; + float num = 0f - orthographicSize; + float num2 = orthographicSize; + float y = 0f - orthographicSize; + float y2 = orthographicSize; + Rect rect = cam.rect; + Vector2 vector = screenSize; + float num3 = vector.x / vector.y; + num3 *= rect.width / rect.height; + num *= num3; + num2 *= num3; + Transform transform = cam.transform; + Quaternion rotation = transform.rotation; + Vector3 position = transform.position; + mSides[0] = rotation * new Vector3(num, y, depth) + position; + mSides[1] = rotation * new Vector3(num, y2, depth) + position; + mSides[2] = rotation * new Vector3(num2, y2, depth) + position; + mSides[3] = rotation * new Vector3(num2, y, depth) + position; + } + else + { + mSides[0] = cam.ViewportToWorldPoint(new Vector3(0f, 0f, depth)); + mSides[1] = cam.ViewportToWorldPoint(new Vector3(0f, 1f, depth)); + mSides[2] = cam.ViewportToWorldPoint(new Vector3(1f, 1f, depth)); + mSides[3] = cam.ViewportToWorldPoint(new Vector3(1f, 0f, depth)); + } + if (relativeTo != null) + { + for (int i = 0; i < 4; i++) + { + mSides[i] = relativeTo.InverseTransformPoint(mSides[i]); + } + } + return mSides; + } + + public static string GetFuncName(object obj, string method) + { + if (obj == null) + { + return ""; + } + string text = obj.GetType().ToString(); + int num = text.LastIndexOf('/'); + if (num > 0) + { + text = text.Substring(num + 1); + } + if (!string.IsNullOrEmpty(method)) + { + return text + "/" + method; + } + return text; + } + + public static void Execute(GameObject go, string funcName) where T : Component + { + T[] components = go.GetComponents(); + foreach (T val in components) + { + MethodInfo method = val.GetType().GetMethod(funcName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + if (method != null) + { + method.Invoke(val, null); + } + } + } + + public static void ExecuteAll(GameObject root, string funcName) where T : Component + { + Execute(root, funcName); + Transform transform = root.transform; + int i = 0; + for (int childCount = transform.childCount; i < childCount; i++) + { + ExecuteAll(transform.GetChild(i).gameObject, funcName); + } + } + + public static void ImmediatelyCreateDrawCalls(GameObject root) + { + ExecuteAll(root, "Start"); + ExecuteAll(root, "Start"); + ExecuteAll(root, "Update"); + ExecuteAll(root, "Update"); + ExecuteAll(root, "LateUpdate"); + } + + public static string KeyToCaption(KeyCode key) + { + return key switch + { + KeyCode.None => null, + KeyCode.Backspace => "BS", + KeyCode.Tab => "Tab", + KeyCode.Clear => "Clr", + KeyCode.Return => "NT", + KeyCode.Pause => "PS", + KeyCode.Escape => "Esc", + KeyCode.Space => "SP", + KeyCode.Exclaim => "!", + KeyCode.DoubleQuote => "\"", + KeyCode.Hash => "#", + KeyCode.Dollar => "$", + KeyCode.Ampersand => "&", + KeyCode.Quote => "'", + KeyCode.LeftParen => "(", + KeyCode.RightParen => ")", + KeyCode.Asterisk => "*", + KeyCode.Plus => "+", + KeyCode.Comma => ",", + KeyCode.Minus => "-", + KeyCode.Period => ".", + KeyCode.Slash => "/", + KeyCode.Alpha0 => "0", + KeyCode.Alpha1 => "1", + KeyCode.Alpha2 => "2", + KeyCode.Alpha3 => "3", + KeyCode.Alpha4 => "4", + KeyCode.Alpha5 => "5", + KeyCode.Alpha6 => "6", + KeyCode.Alpha7 => "7", + KeyCode.Alpha8 => "8", + KeyCode.Alpha9 => "9", + KeyCode.Colon => ":", + KeyCode.Semicolon => ";", + KeyCode.Less => "<", + KeyCode.Equals => "=", + KeyCode.Greater => ">", + KeyCode.Question => "?", + KeyCode.At => "@", + KeyCode.LeftBracket => "[", + KeyCode.Backslash => "\\", + KeyCode.RightBracket => "]", + KeyCode.Caret => "^", + KeyCode.Underscore => "_", + KeyCode.BackQuote => "`", + KeyCode.A => "A", + KeyCode.B => "B", + KeyCode.C => "C", + KeyCode.D => "D", + KeyCode.E => "E", + KeyCode.F => "F", + KeyCode.G => "G", + KeyCode.H => "H", + KeyCode.I => "I", + KeyCode.J => "J", + KeyCode.K => "K", + KeyCode.L => "L", + KeyCode.M => "M", + KeyCode.N => "N0", + KeyCode.O => "O", + KeyCode.P => "P", + KeyCode.Q => "Q", + KeyCode.R => "R", + KeyCode.S => "S", + KeyCode.T => "T", + KeyCode.U => "U", + KeyCode.V => "V", + KeyCode.W => "W", + KeyCode.X => "X", + KeyCode.Y => "Y", + KeyCode.Z => "Z", + KeyCode.Delete => "Del", + KeyCode.Keypad0 => "K0", + KeyCode.Keypad1 => "K1", + KeyCode.Keypad2 => "K2", + KeyCode.Keypad3 => "K3", + KeyCode.Keypad4 => "K4", + KeyCode.Keypad5 => "K5", + KeyCode.Keypad6 => "K6", + KeyCode.Keypad7 => "K7", + KeyCode.Keypad8 => "K8", + KeyCode.Keypad9 => "K9", + KeyCode.KeypadPeriod => ".", + KeyCode.KeypadDivide => "/", + KeyCode.KeypadMultiply => "*", + KeyCode.KeypadMinus => "-", + KeyCode.KeypadPlus => "+", + KeyCode.KeypadEnter => "NT", + KeyCode.KeypadEquals => "=", + KeyCode.UpArrow => "UP", + KeyCode.DownArrow => "DN", + KeyCode.RightArrow => "LT", + KeyCode.LeftArrow => "RT", + KeyCode.Insert => "Ins", + KeyCode.Home => "Home", + KeyCode.End => "End", + KeyCode.PageUp => "PU", + KeyCode.PageDown => "PD", + KeyCode.F1 => "F1", + KeyCode.F2 => "F2", + KeyCode.F3 => "F3", + KeyCode.F4 => "F4", + KeyCode.F5 => "F5", + KeyCode.F6 => "F6", + KeyCode.F7 => "F7", + KeyCode.F8 => "F8", + KeyCode.F9 => "F9", + KeyCode.F10 => "F10", + KeyCode.F11 => "F11", + KeyCode.F12 => "F12", + KeyCode.F13 => "F13", + KeyCode.F14 => "F14", + KeyCode.F15 => "F15", + KeyCode.Numlock => "Num", + KeyCode.CapsLock => "Cap", + KeyCode.ScrollLock => "Scr", + KeyCode.RightShift => "RS", + KeyCode.LeftShift => "LS", + KeyCode.RightControl => "RC", + KeyCode.LeftControl => "LC", + KeyCode.RightAlt => "RA", + KeyCode.LeftAlt => "LA", + KeyCode.Mouse0 => "M0", + KeyCode.Mouse1 => "M1", + KeyCode.Mouse2 => "M2", + KeyCode.Mouse3 => "M3", + KeyCode.Mouse4 => "M4", + KeyCode.Mouse5 => "M5", + KeyCode.Mouse6 => "M6", + KeyCode.JoystickButton0 => "(A)", + KeyCode.JoystickButton1 => "(B)", + KeyCode.JoystickButton2 => "(X)", + KeyCode.JoystickButton3 => "(Y)", + KeyCode.JoystickButton4 => "(RB)", + KeyCode.JoystickButton5 => "(LB)", + KeyCode.JoystickButton6 => "(Back)", + KeyCode.JoystickButton7 => "(Start)", + KeyCode.JoystickButton8 => "(LS)", + KeyCode.JoystickButton9 => "(RS)", + KeyCode.JoystickButton10 => "J10", + KeyCode.JoystickButton11 => "J11", + KeyCode.JoystickButton12 => "J12", + KeyCode.JoystickButton13 => "J13", + KeyCode.JoystickButton14 => "J14", + KeyCode.JoystickButton15 => "J15", + KeyCode.JoystickButton16 => "J16", + KeyCode.JoystickButton17 => "J17", + KeyCode.JoystickButton18 => "J18", + KeyCode.JoystickButton19 => "J19", + _ => null, + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Nat2Field.cs b/SVSim.BattleEngine/Engine/Nat2Field.cs new file mode 100644 index 0000000..53905b7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Nat2Field.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using UnityEngine; + +public class Nat2Field : NateField +{ + public override int FieldId => 32; + + public Nat2Field(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_nat2_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles" + FieldId).gameObject; + _fieldParticleSystemDictionary.Add("gimic_on1", _fieldParticles.transform.Find("gimic_on1").GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_on2", _fieldParticles.transform.Find("gimic_on2").GetComponent()); + _fieldParticleSystemDictionary.Add("shake_1", _fieldParticles.transform.Find("shake_1").GetComponent()); + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_32, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_32_1, pos); + } +} diff --git a/SVSim.BattleEngine/Engine/Nat3Field.cs b/SVSim.BattleEngine/Engine/Nat3Field.cs new file mode 100644 index 0000000..072f9b5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Nat3Field.cs @@ -0,0 +1,88 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Nat3Field : NateField +{ + public override int FieldId => 33; + + public Nat3Field(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_nat3_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles33").gameObject; + _fieldObjDictionary.Add("lid", _fieldModel.transform.Find("md_bf_nat3_01_pipemove_lid").gameObject); + _fieldObjDictionary.Add("big", _fieldModel.transform.Find("md_bf_nat3_01_pipemove_big").gameObject); + m_FieldAnimatorDictionary.Add("big", _fieldObjDictionary["big"].GetComponent()); + m_FieldAnimatorDictionary.Add("lid", _fieldObjDictionary["lid"].GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_33, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_33_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_33_2, pos); + break; + } + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + if (Random.Range(0, 2) == 0) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["lid"].SetTrigger("Open"); + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(8f); + } + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + m_FieldAnimatorDictionary["big"].SetTrigger("Impact"); + m_FieldAnimatorDictionary["lid"].SetTrigger("Impact"); + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Nat4Field.cs b/SVSim.BattleEngine/Engine/Nat4Field.cs new file mode 100644 index 0000000..b271d0c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Nat4Field.cs @@ -0,0 +1,80 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Nat4Field : NateField +{ + public override int FieldId => 34; + + public Nat4Field(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_nat4_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles34").gameObject; + _fieldObjDictionary.Add("lid", _fieldModel.transform.Find("md_bf_nat4_01_pipemove_lid").gameObject); + _fieldObjDictionary.Add("big", _fieldModel.transform.Find("md_bf_nat4_01_pipemove_big").gameObject); + m_FieldAnimatorDictionary.Add("big", _fieldObjDictionary["big"].GetComponent()); + m_FieldAnimatorDictionary.Add("lid", _fieldObjDictionary["lid"].GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_34, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_34_1, pos); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + if (Random.Range(0, 2) == 0) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["lid"].SetTrigger("Open"); + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(8f); + } + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + m_FieldAnimatorDictionary["big"].SetTrigger("Impact"); + m_FieldAnimatorDictionary["lid"].SetTrigger("Impact"); + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/NateField.cs b/SVSim.BattleEngine/Engine/NateField.cs new file mode 100644 index 0000000..003bcb3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NateField.cs @@ -0,0 +1,110 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class NateField : BackGroundBase +{ + public override int FieldId => 31; + + public NateField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_nate_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles" + FieldId).gameObject; + _fieldParticleSystemDictionary.Add("gimic_on1", _fieldParticles.transform.Find("gimic_on1").GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_on2", _fieldParticles.transform.Find("gimic_on2").GetComponent()); + _fieldParticleSystemDictionary.Add("shake_1", _fieldParticles.transform.Find("shake_1").GetComponent()); + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_31, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_31_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_31_2, pos); + break; + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _battleCamera.Camera.transform.localPosition = new Vector3(1680f, -475f, -226f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-16f, -63f, 82f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(57f, -54f, 30f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-20f, -110f, 98f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1") + { + switch (_gimicCntDictionary[obj.tag]) + { + case 0: + case 1: + case 2: + _gimicCntDictionary[obj.tag]++; + _fieldParticleSystemDictionary["gimic_on1"].transform.GetChild(_gimicCntDictionary[obj.tag] - 1).GetComponent().Play(); + _fieldParticleSystemDictionary["gimic_on2"].transform.GetChild(_gimicCntDictionary[obj.tag] - 1).GetComponent().Play(); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + break; + case 3: + { + _gimicCntDictionary[obj.tag]++; + for (int i = 0; i < _fieldParticleSystemDictionary["gimic_on1"].transform.childCount; i++) + { + _fieldParticleSystemDictionary["gimic_on1"].transform.GetChild(i).GetComponent().Stop(); + } + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_2", "se_field_" + _str3DFieldNo, 0f, 0L); + yield return new WaitForSeconds(2f); + _gimicCntDictionary[obj.tag] = 0; + break; + } + } + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake_1"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkBattleGenericTool.cs b/SVSim.BattleEngine/Engine/NetworkBattleGenericTool.cs new file mode 100644 index 0000000..3bd9754 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkBattleGenericTool.cs @@ -0,0 +1,852 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class NetworkBattleGenericTool +{ + public static NetworkBattleDefine.NetworkCardPlaceState GetCardPlaceState(BattlePlayerBase player, int index) + { + NetworkBattleDefine.NetworkCardPlaceState result = NetworkBattleDefine.NetworkCardPlaceState.None; + if (player.HandCardList != null && player.HandCardList.SingleOrDefault((BattleCardBase c) => c.Index == index) != null) + { + result = NetworkBattleDefine.NetworkCardPlaceState.Hand; + } + else if (player.DeckCardList != null && player.DeckCardList.SingleOrDefault((BattleCardBase c) => c.Index == index) != null) + { + result = NetworkBattleDefine.NetworkCardPlaceState.Deck; + } + else if (player.ClassAndInPlayCardList != null && player.ClassAndInPlayCardList.SingleOrDefault((BattleCardBase c) => c.Index == index) != null) + { + result = NetworkBattleDefine.NetworkCardPlaceState.Field; + } + else if (player.CemeteryList != null && player.CemeteryList.FirstOrDefault((BattleCardBase c) => c.Index == index) != null) + { + result = NetworkBattleDefine.NetworkCardPlaceState.Cemetery; + } + else if (player.BanishList != null && player.BanishList.FirstOrDefault((BattleCardBase c) => c.Index == index) != null) + { + result = NetworkBattleDefine.NetworkCardPlaceState.Banish; + } + else if (player.FusionIngredientList != null && player.FusionIngredientList.SingleOrDefault((BattleCardBase c) => c.Index == index) != null) + { + result = NetworkBattleDefine.NetworkCardPlaceState.FusionIngredient; + } + if (player.UniteList != null && player.UniteList.FirstOrDefault((BattleCardBase c) => c.Index == index) != null) + { + result = NetworkBattleDefine.NetworkCardPlaceState.Unite; + } + return result; + } + + public static BattleCardBase GetIndexToCardBase(BattleManagerBase battleManagerBase, BattlePlayerBase player, int index) + { + BattleCardBase battleCardBase = null; + if (player.HandCardList != null) + { + battleCardBase = battleManagerBase.GetBattleCardIdx(player.HandCardList, index); + } + if (battleCardBase == null && player.DeckCardList != null) + { + battleCardBase = battleManagerBase.GetBattleCardIdx(player.DeckCardList, index); + } + if (battleCardBase == null && player.ClassAndInPlayCardList != null) + { + battleCardBase = battleManagerBase.GetBattleCardIdx(player.ClassAndInPlayCardList, index); + } + if (battleCardBase == null && player.CemeteryList != null) + { + battleCardBase = battleManagerBase.GetBattleCardIdx(player.CemeteryList, index); + } + if (battleCardBase == null && player.NecromanceZoneList != null) + { + battleCardBase = battleManagerBase.GetBattleCardIdx(player.NecromanceZoneList, index); + } + if (battleCardBase == null && player.BanishList != null) + { + battleCardBase = battleManagerBase.GetBattleCardIdx(player.BanishList, index); + } + if (battleCardBase == null && player.FusionIngredientList != null) + { + battleCardBase = battleManagerBase.GetBattleCardIdx(player.FusionIngredientList, index); + } + if (battleCardBase == null && player.ClassAndInPlayCardList != null) + { + List list = new List(player.ClassAndInPlayCardList); + if (player.CemeteryList != null) + { + list.AddRange(player.CemeteryList); + } + if (player.BanishList != null) + { + list.AddRange(player.BanishList); + } + for (int i = 0; i < list.Count; i++) + { + BattleCardBase battleCardBase2 = list[i]; + if (!(battleCardBase2 is NullBattleCard)) + { + battleCardBase = battleCardBase2.GetOnCards.FirstOrDefault((BattleCardBase c) => c.Index == index); + if (battleCardBase != null) + { + break; + } + } + } + } + if (battleCardBase == null && player.UniteList != null) + { + battleCardBase = battleManagerBase.GetBattleCardIdx(player.UniteList, index); + } + if (battleCardBase == null && player.GetOnList != null) + { + battleCardBase = battleManagerBase.GetBattleCardIdx(player.GetOnList, index); + } + return battleCardBase; + } + + public static List GetOpposingCardObjTarget(BattleManagerBase battleManagerBase, List actions) + { + List list = new List(); + foreach (NetworkBattleReceiver.TargetData action in actions) + { + int targetIndex = action.TargetIndex; + bool isSelf = action.IsSelf; + BattleCardBase battleCardBase = null; + battleCardBase = ((!isSelf) ? battleManagerBase.GetBattleCardIdx(battleManagerBase.BattlePlayer.AllCards.ToList(), targetIndex) : GetIndexToCardBase(battleManagerBase, battleManagerBase.BattleEnemy, targetIndex)); + if (battleCardBase != null) + { + list.Add(battleCardBase); + } + } + return list; + } + + public static List LookForActionDataToTargetCard(BattleManagerBase battleManagerBase, List actions) + { + List list = new List(); + foreach (NetworkBattleReceiver.TargetData action in actions) + { + int targetIndex = action.TargetIndex; + bool isSelf = action.IsSelf; + BattleCardBase battleCardBase = null; + battleCardBase = ((!isSelf) ? GetIndexToCardBase(battleManagerBase, battleManagerBase.BattlePlayer, targetIndex) : battleManagerBase.GetBattleCardIdx(battleManagerBase.BattleEnemy.ClassAndInPlayCardList, targetIndex)); + list.Add(battleCardBase); + } + return list; + } + + public static bool IsAttachedSkill(SkillBase skill) + { + ISkillApplyInformation skillApplyInformation = skill.SkillPrm.ownerCard.SkillApplyInformation; + if (skillApplyInformation != null && skillApplyInformation.AttachedSkillsInfo != null && skillApplyInformation.AttachedSkillsInfo.AttachedSkills != null && skillApplyInformation.AttachedSkillsInfo.AttachedSkills.ToList().Count > 0) + { + foreach (SkillBase attachedSkill in skillApplyInformation.AttachedSkillsInfo.AttachedSkills) + { + if (attachedSkill == skill) + { + return true; + } + } + } + return false; + } + + public static SkillBase SearchPublishedSkillCountToSkill(BattleCardBase card, int skillId) + { + foreach (SkillBase skill in card.Skills) + { + if (GetPublishSkillCount(skill) == skillId) + { + return skill; + } + } + return null; + } + + public static int GetSkillIndex(SkillBase skill) + { + int num = 0; + SkillCollectionBase skillCollectionBase = skill.SkillPrm.ownerCard.Skills; + if (skill.OnWhenEvolveStart != 0 || skill.OnWhenEvolveOtherStart != 0 || skill.OnWhenEvolveSelfAndOtherStart != 0 || skill.OnWhenChoiceEvolveStart != 0 || skill.OnWhenEvolveBeforeStart != 0) + { + skillCollectionBase = skill.SkillPrm.ownerCard.EvolutionSkills; + } + foreach (SkillBase item in skillCollectionBase) + { + if (!(item is Skill_none)) + { + if (item == skill) + { + break; + } + num++; + } + } + return num; + } + + public static SkillBase SerchIndexToSkill(SkillCollectionBase skills, int skillIndex) + { + int num = 0; + foreach (SkillBase skill in skills) + { + if (!(skill is Skill_none)) + { + if (num == skillIndex) + { + return skill; + } + num++; + } + } + return null; + } + + public static SkillBase SearchCardSkillIndex(BattleCardBase card, int skillIndex, bool isEvol) + { + int num = 0; + SkillCollectionBase skillCollectionBase = card.NormalSkills; + if (card.IsSpell) + { + skillIndex++; + } + if (isEvol) + { + skillCollectionBase = card.EvolutionSkills; + if (skillCollectionBase.Count() == 0) + { + skillCollectionBase = card.NormalSkills; + } + } + foreach (SkillBase item in skillCollectionBase) + { + if (!(item is Skill_none)) + { + if (num == skillIndex) + { + return item; + } + num++; + } + } + return null; + } + + public static string MakeLogCode(SkillBase skill) + { + BattleCardBase ownerCard = skill.SkillPrm.ownerCard; + return string.Concat(string.Concat("" + CardMaster.GetInstanceForBattle().GetCardParameterFromId(ownerCard.CardId).BaseCardId + "|", GetSkillIndex(skill).ToString(), "|"), ownerCard.IsEvolution ? "1" : "0"); + } + + public static bool IsBurialRite(SkillBase skill, bool notCheckPrevious = false) + { + if (skill.PreprocessList != null) + { + if (skill.PreprocessList.Any((SkillPreprocessBase s) => s is SkillPreprocessBurialRite)) + { + return true; + } + if (!notCheckPrevious && skill.PreprocessList.Any((SkillPreprocessBase s) => s is SkillPreprocessReferencePrevious) && SkillPreprocessReferencePrevious.GetPreviousSkill(skill.SkillPrm.ownerCard.EvolutionSkills.Contains(skill) ? skill.SkillPrm.ownerCard.EvolutionSkills : skill.SkillPrm.ownerCard.NormalSkills, skill).PreprocessList.Any((SkillPreprocessBase s) => s is SkillPreprocessBurialRite)) + { + return true; + } + } + return false; + } + + public static bool IsReceiveSelectDataOnBurialRite(BattleManagerBase mgr, SkillBase skill) + { + NetworkBattleManagerBase networkBattleManagerBase = mgr as NetworkBattleManagerBase; + NetworkBattleReceiver.ReceiveData receiveData = networkBattleManagerBase.networkBattleData.GetReceiveData(); + if (receiveData != null) + { + if (skill.PreprocessList.Any((SkillPreprocessBase s) => s is SkillPreprocessReferencePrevious)) + { + skill = SkillPreprocessReferencePrevious.GetPreviousSkill(skill.SkillPrm.ownerCard.EvolutionSkills.Contains(skill) ? skill.SkillPrm.ownerCard.EvolutionSkills : skill.SkillPrm.ownerCard.NormalSkills, skill); + } + int index = skill.SkillPrm.ownerCard.Skills.IndexOf(skill); + List opponentTargetDataList = receiveData.OpponentTargetDataList; + if (opponentTargetDataList != null && opponentTargetDataList.Any((NetworkBattleReceiver.TargetData t) => t.SelectSkillIndexList.Contains(index)) && GetOpposingCardObjTarget(networkBattleManagerBase, opponentTargetDataList).Count >= 1) + { + return true; + } + List playerTargetDataList = receiveData.PlayerTargetDataList; + if (playerTargetDataList != null && playerTargetDataList.Any((NetworkBattleReceiver.TargetData t) => t.SelectSkillIndexList.Contains(index)) && GetOpposingCardObjTarget(networkBattleManagerBase, playerTargetDataList).Count >= 1) + { + return true; + } + } + return false; + } + + public static bool IsOpenChoiceSkillCard(BattleCardBase card, bool isEvolve) + { + foreach (SkillBase item in isEvolve ? card.EvolutionSkills : card.Skills) + { + if (IsOpenChoiceSkill(item)) + { + return true; + } + } + return false; + } + + public static bool IsOpenChoiceSkill(SkillBase skill) + { + if (skill.ApplyingTargetFilter is SkillTargetChosenCardsFilter && !(skill is Skill_token_draw) && !(skill is Skill_update_deck)) + { + return true; + } + return false; + } + + public static bool IsChoiceCard(BattleCardBase card, bool isEvol = false) + { + return GetChoiceSkill(card, isEvol) != null; + } + + public static SkillBase GetChoiceSkill(BattleCardBase card, bool isEvol = false) + { + SkillCollectionBase skillCollectionBase = card.Skills; + if (isEvol) + { + skillCollectionBase = card.EvolutionSkills; + } + foreach (SkillBase item in skillCollectionBase) + { + if (item.IsTargetChoiceSelectSkill) + { + return item; + } + } + return null; + } + + public static bool IsAcceleratedCard(BattleCardBase card) + { + for (int i = 0; i < card.Skills.Count(); i++) + { + if (card.Skills.Get(i) is Skill_pp_fixeduse { IsMutationFixedUseCost: not false } && card.Skills.Get(i + 1) is Skill_transform { TransformId: not -1 } skill_transform && CardMaster.GetInstanceForBattle().GetCardParameterFromId(skill_transform.TransformId).CharType == CardBasePrm.CharaType.SPELL) + { + return true; + } + } + return false; + } + + public static bool IsCrystallizeCard(BattleCardBase card) + { + for (int i = 0; i < card.Skills.Count(); i++) + { + if (card.Skills.Get(i) is Skill_pp_fixeduse { IsMutationFixedUseCost: not false } && card.Skills.Get(i + 1) is Skill_transform { TransformId: not -1 } skill_transform && (CardMaster.GetInstanceForBattle().GetCardParameterFromId(skill_transform.TransformId).CharType == CardBasePrm.CharaType.CHANT_FIELD || CardMaster.GetInstanceForBattle().GetCardParameterFromId(skill_transform.TransformId).CharType == CardBasePrm.CharaType.FIELD)) + { + return true; + } + } + return false; + } + + public static SkillBase GetMutationPpFixedUseSkill(BattleCardBase card) + { + foreach (SkillBase skill in card.Skills) + { + if (skill is Skill_pp_fixeduse && (skill as Skill_pp_fixeduse).IsMutationOnCost) + { + return skill; + } + } + return null; + } + + public static bool IsIncludedCard(List checkIndexList, IEnumerable cards) + { + foreach (BattleCardBase card in cards) + { + if (checkIndexList.Contains(card.Index)) + { + return true; + } + } + return false; + } + + public static int GetSkillMovementNum(SkillBase skillBase) + { + if (GameMgr.GetIns().IsAINetwork) + { + return -1; + } + return (skillBase._executionInfoCreator as NetworkExecutionInfoCreator).GetSkillMovementNum(); + } + + public static int GetPublishSkillCount(SkillBase skill) + { + int result = -1; + if (GameMgr.GetIns().IsAINetwork) + { + return result; + } + if (skill != null) + { + result = skill.PublishedActiveSkillCount; + if (skill.PublishedActiveSkillCount == -1) + { + BattleCardBase skillCard = skill.SkillPrm.ownerCard; + SkillBase skillBase = BattleManagerBase.GetIns().PublishedSkillList.FindAll((SkillBase x) => x.GetType() == skill.GetType() && x.SkillTimingText == skill.SkillTimingText).FindLast((SkillBase x) => x.SkillPrm.ownerCard.Index == skillCard.Index && x.SkillPrm.ownerCard.IsPlayer == skillCard.IsPlayer); + if (skillBase != null) + { + result = skillBase.PublishedActiveSkillCount; + } + } + } + return result; + } + + public static bool IsUnapprovedTarget(SkillBase skill) + { + bool isOnFusion = skill.OnWhenFusion != 0; + bool flag = IsUnapprovedTarget(skill.ApplyingTargetFilter, skill, isOnFusion); + bool flag2 = skill is NetworkSkill_attach_skill && skill.ApplyingTargetFilter is NetworkSkillTargetLastTargetFilter; + if (skill.ApplyAndFilter.Count > 0) + { + for (int i = 0; i < skill.ApplyAndFilter.Count; i++) + { + flag |= IsUnapprovedTarget(skill.ApplyAndFilter[i].TargetFilter, skill, isOnFusion); + flag2 |= skill is NetworkSkill_attach_skill && skill.ApplyAndFilter[i].TargetFilter is NetworkSkillTargetLastTargetFilter; + } + } + if (flag2) + { + SkillBase lastTargetSkillReferenceSkill = GetLastTargetSkillReferenceSkill(skill); + if (lastTargetSkillReferenceSkill != null) + { + flag |= IsUnapprovedTarget(lastTargetSkillReferenceSkill); + flag = flag || lastTargetSkillReferenceSkill is Skill_return_card; + } + } + return flag; + } + + public static SkillBase GetLastTargetSkillReferenceSkill(SkillBase lastTargetSkill) + { + SkillCollectionBase skillCollectionBase = lastTargetSkill.SkillPrm.ownerCard.NormalSkills; + int num = skillCollectionBase.IndexOf(lastTargetSkill); + if (num == -1) + { + skillCollectionBase = lastTargetSkill.SkillPrm.ownerCard.EvolutionSkills; + num = skillCollectionBase.IndexOf(lastTargetSkill); + } + num--; + while (num > -1) + { + if (skillCollectionBase.ElementAt(num).ApplyingTargetFilter is NetworkSkillTargetLastTargetFilter) + { + num--; + continue; + } + return skillCollectionBase.ElementAt(num); + } + return null; + } + + public static bool IsUnapprovedTarget(ISkillTargetFilter skillTargetFilter, SkillBase skill, bool isOnFusion = false) + { + if (!(skillTargetFilter is SkillTargetDeckFilter) && !(skillTargetFilter is SkillTargetHandFilter) && !(skillTargetFilter is SkillTargetHandOtherSelfFilter) && !(skillTargetFilter is SkillTargetSkillDrewCardFilter) && !(skillTargetFilter is SkillTargetDiscardCardListFilter) && !(skillTargetFilter is SkillTargetHandBanishedCardListFilter) && !(skillTargetFilter is SkillTargetDeckBanishedCardListFilter) && (!isOnFusion || !(skillTargetFilter is SkillTargetSelfFilter))) + { + if (skill.OnWhenDraw != 0 && skill is NetworkSkill_attach_skill) + { + return skillTargetFilter is SkillTargetHandSelfFilter; + } + return false; + } + return true; + } + + public static bool IsNeedUnapprovedListSkill(SkillBase skill) + { + bool flag = RegisterTool.IsSkillRandom(skill); + if (skill.IsRandomUntilDrawSkill) + { + return true; + } + if (skill.ApplyAndFilter.Count > 0) + { + for (int i = 0; i < skill.ApplyAndFilter.Count; i++) + { + if (IsUnapprovedTarget(skill.ApplyAndFilter[i].TargetFilter, skill) && !IsOnlyAllCardFilter(skill.ApplyAndFilter[i].CardFilterList) && flag) + { + return true; + } + } + } + if (!IsUnapprovedTarget(skill)) + { + return false; + } + if (IsOnlyAllCardFilter(skill.ApplyCardFilterList)) + { + return false; + } + if (!flag) + { + return false; + } + return true; + } + + private static bool IsTargetDeckOrHand(ISkillTargetFilter applyingTargetFilter) + { + if (!(applyingTargetFilter is SkillTargetDeckFilter) && !(applyingTargetFilter is SkillTargetHandFilter)) + { + return applyingTargetFilter is SkillTargetHandOtherSelfFilter; + } + return true; + } + + private static bool IsOnlyAllCardFilter(List applyCardFilterList) + { + for (int i = 0; i < applyCardFilterList.Count; i++) + { + if (!(applyCardFilterList[i] is SkillAllCardFilter)) + { + return false; + } + } + return true; + } + + public static void SettingRegisterTargetGroupAndInsert() + { + List registerDataList = (BattleManagerBase.GetIns() as NetworkBattleManagerBase).RegisterActionManager.RegisterDataList; + foreach (RegisterLotCardBase item in registerDataList.FindAll((RegisterActionBase x) => x is RegisterLotCardBase).ConvertAll((RegisterActionBase x) => x as RegisterLotCardBase)) + { + RegisterActionBase registerActionBase = null; + int num = 0; + foreach (RegisterActionBase item2 in registerDataList) + { + if (item2 is RegisterLotCardBase || item2.PrivateGroupIndexMsg != "") + { + continue; + } + bool flag = false; + if (!item2.IsUseLotCard(item)) + { + continue; + } + if (item2 is RegisterStateChangeCard) + { + if ((item2 as RegisterStateChangeCard).FromPlaceState == item.GetFromPlaceState()) + { + flag = true; + } + } + else + { + flag = true; + } + if (!flag) + { + continue; + } + if (item2 is RegisterCopyToken) + { + item.SettingGroupIndexMsg(item2, num); + if (item.GroupMsgList.Count > num + 1) + { + num++; + } + } + else + { + item.SettingGroupIndexMsg(item2); + } + if (registerActionBase == null) + { + int num2 = registerDataList.IndexOf(item); + int num3 = registerDataList.IndexOf(item2); + if (num2 > num3) + { + registerActionBase = item2; + } + } + } + if (registerActionBase != null) + { + int index = registerDataList.IndexOf(registerActionBase); + registerDataList.Remove(item); + registerDataList.Insert(index, item); + } + } + } + + public static RegisterLotCardBase MakeRegisterLotAndRandomAdvance(SkillBase skillBase, IEnumerable cards, SkillConditionCheckerOption checkerOption) + { + NetworkBattleManagerBase networkBattleManagerBase = BattleManagerBase.GetIns() as NetworkBattleManagerBase; + List unapprovedList = networkBattleManagerBase.networkBattleData.GetReceiveData().unapprovedList; + NetworkExecutionInfoCreator networkExec = skillBase._executionInfoCreator as NetworkExecutionInfoCreator; + int num = 0; + RegisterLotCardBase result = null; + List list = new List(); + list = networkBattleManagerBase.RegisterActionManager.RegisterDataList.FindAll((RegisterActionBase x) => x is RegisterLotCardBase).ConvertAll((RegisterActionBase x) => x as RegisterLotCardBase); + for (int num2 = 0; num2 < cards.Count(); num2++) + { + CardDataModel unapprovedCard = GetCardDataModel(skillBase, cards.ElementAt(num2), unapprovedList, networkExec); + list = list.Where((RegisterLotCardBase data) => data.IsAlreadyAddedIndex(unapprovedCard.Index, unapprovedCard.fromState)).ToList(); + if (list.Count == 0) + { + break; + } + } + if (skillBase.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.CardFilterList.Any((ISkillCardFilter cf) => cf is SkillLastTargetTribeFilter))) + { + networkBattleManagerBase.RegisterActionManager.Add(new RegisterExtract(isSelf: false, skillBase.SkillPrm.ownerCard.SelfBattlePlayer.GetLastTargetCardsList(0), RegisterActionBase.ActionBaseParameter.tribe.ToString(), isBase: false)); + } + for (int num3 = 0; num3 < cards.Count(); num3++) + { + BattleCardBase battleCardBase = cards.ElementAt(num3); + CardDataModel cardDataModel = GetCardDataModel(skillBase, battleCardBase, unapprovedList, networkExec); + if (cardDataModel == null) + { + continue; + } + if (GetCardPlaceState(battleCardBase.SelfBattlePlayer, battleCardBase.Index) == NetworkBattleDefine.NetworkCardPlaceState.Deck) + { + networkBattleManagerBase.StableRandomDouble(); + continue; + } + bool lotFirstSettingFlag = false; + RegisterLotCardBase registerLotCardBase = AddLotRegisterData(networkBattleManagerBase, networkBattleManagerBase.RegisterActionManager, battleCardBase, skillBase.SkillPrm.ownerCard, skillBase, cardDataModel.fromState, list, out lotFirstSettingFlag); + if (lotFirstSettingFlag) + { + registerLotCardBase.SettingTargetStatusToSearchSkill(networkBattleManagerBase, skillBase, num, cardDataModel, checkerOption); + } + if (RegisterTool.HasTargetOverCostFromFilter(skillBase)) + { + num++; + } + result = registerLotCardBase; + } + return result; + } + + private static CardDataModel GetCardDataModel(SkillBase skillBase, BattleCardBase carddata, List unapprovedList, NetworkExecutionInfoCreator networkExec) + { + if (RegisterSkillConditionCheck.DoesSkillUsePrivateCount(skillBase) && skillBase is Skill_powerup) + { + int skillConditionCount = RegisterSkillConditionCheck.GetMovementCount(skillBase); + return unapprovedList.Find((CardDataModel x) => x.Index == carddata.Index && x.skillMovementNum / skillConditionCount == networkExec.GetSkillMovementNum() && x.publishedActiveSkillCount == skillBase.PublishedActiveSkillCount); + } + return unapprovedList.Find((CardDataModel x) => x.Index == carddata.Index && x.skillMovementNum == networkExec.GetSkillMovementNum() && x.publishedActiveSkillCount == skillBase.PublishedActiveSkillCount); + } + + public static VfxBase Event_SetupPlayerUnapprovedAddEvent(SkillBase skillBase, IEnumerable cards, SkillConditionCheckerOption checkerOption, SkillProcessor skillProcessor) + { + if (cards == null) + { + return NullVfx.GetInstance(); + } + if (skillBase is Skill_summon_card { IsDeckSelfSummon: not false } && cards.Count() > 0 && !cards.ElementAt(0).IsInplay) + { + return NullVfx.GetInstance(); + } + NetworkBattleManagerBase networkBattleManagerBase = BattleManagerBase.GetIns() as NetworkBattleManagerBase; + int skillMovementNum = GetSkillMovementNum(skillBase); + foreach (BattleCardBase card in cards) + { + bool isCardId = false; + NetworkBattleDefine.NetworkCardPlaceState to = GetCardPlaceState(skillBase.SkillPrm.ownerCard.SelfBattlePlayer, card.Index); + NetworkBattleDefine.NetworkCardPlaceState networkCardPlaceState = NetworkBattleDefine.NetworkCardPlaceState.Deck; + if (skillBase.OnDisCardStart != 0) + { + networkCardPlaceState = NetworkBattleDefine.NetworkCardPlaceState.Hand; + to = NetworkBattleDefine.NetworkCardPlaceState.Cemetery; + } + else if (skillBase.ApplyingTargetFilter is SkillTargetDeckFilter) + { + networkCardPlaceState = NetworkBattleDefine.NetworkCardPlaceState.Deck; + } + else if (skillBase.ApplyingTargetFilter is SkillTargetHandFilter || skillBase.ApplyingTargetFilter is SkillTargetHandOtherSelfFilter) + { + networkCardPlaceState = NetworkBattleDefine.NetworkCardPlaceState.Hand; + } + else if (skillBase.IsHaveApplicableTargetFilter() && (card.IsInCemetery || card.IsInNecromanceZone)) + { + networkCardPlaceState = NetworkBattleDefine.NetworkCardPlaceState.Cemetery; + if (skillBase is Skill_token_draw { IsOpen: "true" } || skillBase is Skill_summon_token) + { + isCardId = true; + } + } + else if (skillBase.IsHaveApplicableTargetFilter() && card.IsFusionIngredient) + { + networkCardPlaceState = NetworkBattleDefine.NetworkCardPlaceState.FusionIngredient; + } + else if (skillBase.ApplyingTargetFilter is SkillTargetSelfFilter && skillBase.ApplyAndFilter.Count > 0) + { + for (int i = 0; i < skillBase.ApplyAndFilter.Count; i++) + { + if (skillBase.ApplyAndFilter[i].TargetFilter is SkillTargetDeckFilter) + { + networkCardPlaceState = NetworkBattleDefine.NetworkCardPlaceState.Deck; + } + else if (skillBase.ApplyAndFilter[i].TargetFilter is SkillTargetHandFilter || skillBase.ApplyAndFilter[i].TargetFilter is SkillTargetHandOtherSelfFilter) + { + networkCardPlaceState = NetworkBattleDefine.NetworkCardPlaceState.Hand; + } + else if (skillBase.ApplyAndFilter[i].TargetFilter is SkillTargetGameFusionIngredientedCards || skillBase.ApplyAndFilter[i].TargetFilter is SkillTargetDiscardCardListFilter) + { + networkCardPlaceState = (card.IsFusionIngredient ? NetworkBattleDefine.NetworkCardPlaceState.FusionIngredient : NetworkBattleDefine.NetworkCardPlaceState.Cemetery); + } + } + } + if ((skillBase is Skill_banish || skillBase is Skill_discard) && !RegisterValidate.IsDeckRandomEachSkill(skillBase)) + { + isCardId = true; + } + networkBattleManagerBase.RegisterUnapprovedList.Add(new RegisterUnapproved(skillBase, card, networkCardPlaceState, to, skillMovementNum, isCardId)); + } + return NullVfx.GetInstance(); + } + + public static RegisterLotCardBase AddLotRegisterData(NetworkBattleManagerBase battleMgr, RegisterActionManager registerCardList, BattleCardBase unapprovedCard, BattleCardBase skillCard, SkillBase skillBase, NetworkBattleDefine.NetworkCardPlaceState fromPlace, List sameTargetDataList, out bool lotFirstSettingFlag) + { + lotFirstSettingFlag = false; + RegisterLotCardBase registerLotCardBase = null; + if (!RegisterTool.HasTargetOverCostFromFilter(skillBase)) + { + List list = new List(); + list = registerCardList.RegisterDataList.FindAll((RegisterActionBase x) => x is RegisterLotCardBase).ConvertAll((RegisterActionBase x) => x as RegisterLotCardBase); + if (sameTargetDataList.Count > 0) + { + battleMgr.StableRandomDouble(); + return sameTargetDataList[0]; + } + int skillMovementNum = GetSkillMovementNum(skillBase); + RegisterLotCardBase registerLotCardBase2 = list.Find((RegisterLotCardBase x) => x.GetLotSkillBase() == skillBase && x.GetSkillMovementNum() == skillMovementNum); + if (registerLotCardBase2 != null && !skillBase.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => !(f.SelectFilter is SkillSelectAllFilter) && (!(f.SelectFilter is SkillRandomSelectFilter) || f.SelectFilter.CalcCount(skillBase.OptionValue) <= 1))) + { + registerLotCardBase2.AddTargetIndexAndPlaceGroup(unapprovedCard.Index); + registerLotCardBase2.AddRandomList(battleMgr.StableRandomDouble()); + return registerLotCardBase2; + } + } + registerLotCardBase = new RegisterLotCardBase(registerCardList, battleMgr, battleMgr.StableRandomDouble(), unapprovedCard.IsPlayer, fromPlace, unapprovedCard.Index, skillBase); + if (!RegisterValidate.IsDeckRandomEachSkill(skillBase)) + { + registerCardList.Add(registerLotCardBase); + } + lotFirstSettingFlag = true; + return registerLotCardBase; + } + + public static bool IsSendUnapprovedList(SkillBase skill) + { + if (IsNeedUnapprovedListSkill(skill) || IsTargetDeckSelf(skill)) + { + return true; + } + if (RegisterFilter.IsFilterCardUnapproved(skill) && RegisterFilter.IsFilterCard(skill)) + { + return true; + } + return false; + } + + public static bool IsTargetDeckSelf(SkillBase skill) + { + if (skill.ConditionTargetFilter is SkillTargetDeckSelfFilter) + { + return true; + } + return false; + } + + public static string FindDictionaryURI(Dictionary data) + { + if (data.ContainsKey("uri")) + { + return data["uri"].ToString(); + } + return ""; + } + + public static void CreateLoadAndPlayEffectVfxLastTurnLog() + { + CreateLoadAndPlayEffectVfxCheckLog(isLastTurn: true); + } + + public static void CreateLoadAndPlayEffectVfxClientInfoLog() + { + CreateLoadAndPlayEffectVfxCheckLog(isLastTurn: false); + } + + private static void CreateLoadAndPlayEffectVfxCheckLog(bool isLastTurn) + { + try + { + BattleManagerBase ins = BattleManagerBase.GetIns(); + if (ins == null) + { + return; + } + foreach (LoadAndPlayEffectVfx item in ins.VfxMgr.GetSequentialVfxQueues().ToList().FindAll((VfxBase x) => x is LoadAndPlayEffectVfx) + .ConvertAll((VfxBase x) => x as LoadAndPlayEffectVfx)) + { + if (item.LoadingVfx != null && item.LoadingVfx is SkillBase.WaitEffectLoadVfx) + { + SkillBase.WaitEffectLoadVfx waitEffectLoadVfx = item.LoadingVfx as SkillBase.WaitEffectLoadVfx; + if (waitEffectLoadVfx.LoadVfx != null) + { + string log = "LoadVfxIsEnd=" + waitEffectLoadVfx.LoadVfx.IsEnd; + if (isLastTurn) + { + LocalLog.AccumulateLastTraceLog(log); + } + else + { + LocalLog.AccumulateTraceLog(log); + } + } + } + string log2 = "loadEffect.LoadFileName=" + item.LoadFileName; + if (isLastTurn) + { + LocalLog.AccumulateLastTraceLog(log2); + } + else + { + LocalLog.AccumulateTraceLog(log2); + } + if (item.WaitLoadEffectAndSetSeVfxData != null) + { + string log3 = "WaitLoadEffectAndSetSeVfxData Step" + item.WaitLoadEffectAndSetSeVfxData.NowStep; + if (isLastTurn) + { + LocalLog.AccumulateLastTraceLog(log3); + } + else + { + LocalLog.AccumulateTraceLog(log3); + } + } + if (item.PlayEffectAndSeVfxData != null) + { + string log4 = "PlayEffectAndSeVfxData Step" + item.PlayEffectAndSeVfxData.NowStep; + if (isLastTurn) + { + LocalLog.AccumulateLastTraceLog(log4); + } + else + { + LocalLog.AccumulateTraceLog(log4); + } + } + } + } + catch + { + LocalLog.AccumulateLastTraceLog("VfxCheckLog Error"); + } + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkBattleSenderDefine.cs b/SVSim.BattleEngine/Engine/NetworkBattleSenderDefine.cs new file mode 100644 index 0000000..790797f --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkBattleSenderDefine.cs @@ -0,0 +1,8 @@ +public class NetworkBattleSenderDefine +{ + public enum SendCommonParameter + { + orderList, + battleCode + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkLog.cs b/SVSim.BattleEngine/Engine/NetworkLog.cs new file mode 100644 index 0000000..614cef8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkLog.cs @@ -0,0 +1,31 @@ +using System; + +public class NetworkLog +{ + public enum LogLevel + { + Info, + Warning, + Error + } + + private const string FORMAT = "{0}:[{1}]{2}"; + + public LogLevel Level { get; } + + public string Message { get; } + + public DateTime Time { get; } + + public NetworkLog(LogLevel level, string message) + { + Level = level; + Message = message; + Time = DateTime.UtcNow; + } + + public override string ToString() + { + return $"{Time}:[{Level.ToString()}]{Message}"; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkMatchNextSceneSelector.cs b/SVSim.BattleEngine/Engine/NetworkMatchNextSceneSelector.cs new file mode 100644 index 0000000..b92272f --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkMatchNextSceneSelector.cs @@ -0,0 +1,90 @@ +using System; +using Cute; +using UnityEngine; +using Wizard; + +public class NetworkMatchNextSceneSelector : INextSceneSelector +{ + private BattleResultUIController m_battleResultNewControl; + + private bool _movingToMyPage; + + public NetworkMatchNextSceneSelector(BattleResultUIController battleResultControl) + { + m_battleResultNewControl = battleResultControl; + _movingToMyPage = false; + } + + public void Setup(bool isWin, GameObject gameObject) + { + if (m_battleResultNewControl.ResultMsgReportBtnFlag) + { + m_battleResultNewControl.ReportBtnObj.labels[0].text = Data.SystemText.Get("Con_Management_001_Button"); + m_battleResultNewControl.ReportBtnObj.gameObject.SetActive(value: true); + m_battleResultNewControl.ReportBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.ReportBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + ConsistencyReportButtonAction.CreateReportConfirmWindow(); + })); + } + m_battleResultNewControl.MissionBtnObj.labels[0].text = Data.SystemText.Get("Battle_0200"); + m_battleResultNewControl.MissionBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.MissionBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + UIManager.GetInstance().createInSceneCenterLoading(); + MissionInfoTask missionInfoTask = GameMgr.GetIns().GetMissionInfoTask(); + missionInfoTask.SetParameter(); + m_battleResultNewControl.StartCoroutine(Toolbox.NetworkManager.Connect(missionInfoTask, delegate + { + m_battleResultNewControl.CreateMissionList(); + }, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + })); + m_battleResultNewControl.HomeBtnObj.labels[0].text = Data.SystemText.Get("Battle_0202"); + m_battleResultNewControl.HomeBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.HomeBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + MoveToMyPage(); + })); + m_battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Battle_0204"); + m_battleResultNewControl.RetryBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.RetryBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + DeckInfoTask task = new DeckInfoTask(); + task.SetParameter(Data.CurrentFormat); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + Action onUpdateDeckUICustomize = delegate(DeckUI deckUI) + { + if (deckUI.Deck.Format == GameMgr.GetIns().GetDataMgr().GetSelectDeckFormat() && deckUI.Deck.GetDeckID() == GameMgr.GetIns().GetDataMgr().GetSelectDeckId()) + { + deckUI.SetTextAppealLabelLeft(Data.SystemText.Get("Card_0235")); + } + }; + DeckSelectUIDialog.Create(DeckSelectUIDialog.GetTitleByBattleType(GameMgr.GetIns().GetDataMgr().m_BattleType), task.DeckGroupListData, Data.CurrentFormat, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: true, delegate(DialogBase dialog, DeckData deckData) + { + FreeAndRankMatchDeckSelectConfirmDialog.Create(dialog, deckData, isBattleEnd: true); + }, new DeckSelectUI.InitOptions + { + OnUpdateDeckUICustomize = onUpdateDeckUICustomize + }); + })); + })); + } + + public void Show() + { + iTween.MoveTo(m_battleResultNewControl.ButtonGrid.gameObject, iTween.Hash("position", m_battleResultNewControl.DefaultPosDict["ButtonGrid"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + private void MoveToMyPage() + { + if (!_movingToMyPage) + { + _movingToMyPage = true; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL_TRANS); + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.MyPage); + } + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkOperationCollection.cs b/SVSim.BattleEngine/Engine/NetworkOperationCollection.cs new file mode 100644 index 0000000..c5e8d01 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkOperationCollection.cs @@ -0,0 +1,245 @@ +using System; +using System.Collections.Generic; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class NetworkOperationCollection : NetworkOperationCollectionBase +{ + private bool _sendEcho; + + private bool _isTurnStart; + + public const int NOT_ECHO_PLAY_CARD_INDEX = -1; + + private int _playCardIndexToEcho = -1; + + private NetworkBattleDefine.PlayActionType _actionTypeToEcho; + + private bool _isReceivedBattleFinish; + + public NetworkOperationCollection(NetworkBattleManagerBase networkBattleMgr, OperateMgr operateMgr, NetworkBattleReceiver.ReceiveData receivedData, NetworkBattleData networkBattleData, bool isPlayer) + : base(networkBattleMgr, operateMgr, receivedData, networkBattleData, isPlayer) + { + } + + public override void RetryOperation() + { + _networkBattleMgr.NetworkSender.EmitRetry(_receivedData.receiveUri); + } + + public override void SwapOperation(Func, VfxBase> OnReceiveOpponentMulligan, Func, VfxBase> OnReceivePlayerMulligan) + { + RegisterSequentialVfx(OperatePlayerMulligan(_receivedData, OnReceivePlayerMulligan)); + } + + public override void SecondMulliganOperation(Func, VfxBase> OnReceiveOpponentMulligan, Func, VfxBase> OnReceivePlayerMulligan, Func OnEndMulligan) + { + LocalLog.AccumulateLastTraceLog("SecondMulliganOperation" + _networkBattleData.isOppoMulliganEnd); + RegisterSequentialVfx(OperatePlayerMulligan(_receivedData, OnReceivePlayerMulligan)); + RegisterSequentialVfx(OperateOppoMulligan(_receivedData, OnReceiveOpponentMulligan)); + if (_networkBattleData.isOppoMulliganEnd) + { + RegisterSequentialVfx(OnEndMulligan.GetAllFuncVfxResults()); + } + } + + public override void TurnStartOperation(NetworkBattleDefine.NetworkBattleURI lastReceivedUri, int lastReceivedTime) + { + if (ToolboxGame.RealTimeNetworkAgent.GetTurnState() || _networkBattleMgr.BattleEnemy.IsExtraTurn || _networkBattleData.isEnemyFirstTurn) + { + if (_networkBattleMgr.BattleEnemy.IsExtraTurn) + { + RegisterSequentialVfx(_networkBattleMgr.ControlTurnStartPlayer()); + } + else + { + RegisterSequentialVfx(_networkBattleMgr.ControlTurnStartOpponent()); + } + _sendEcho = true; + _isTurnStart = true; + } + if (lastReceivedUri == NetworkBattleDefine.NetworkBattleURI.Judge && _networkBattleData.GetReceiveData().NodeResultCode == NetworkBattleDefine.ReceiveNodeResultCode.CurrentBattleError) + { + string[] obj = new string[6] + { + "#732070_", + (_isReceivedBattleFinish ? 1 : 0).ToString(), + "_", + null, + null, + null + }; + int result = (int)_receivedData.result; + obj[3] = result.ToString(); + obj[4] = "_"; + obj[5] = lastReceivedTime.ToString(); + LocalLog.AccumulateTraceLog(string.Concat(obj)); + } + } + + public override void TurnEndWithSkillActivationOperation(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction) + { + if (_networkBattleData.nowReceiveUri != NetworkBattleDefine.NetworkBattleURI.TurnEndActions) + { + _networkBattleData.isReceiveTurnEndAction = true; + RegisterSequentialVfx(_operateMgr.TurnEndOperation(isPlayer: false)); + _sendEcho = true; + } + } + + public override void TurnEndOperation(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction) + { + if (_networkBattleData.nowReceiveUri != NetworkBattleDefine.NetworkBattleURI.TurnEnd) + { + if (_networkBattleMgr.JudgeCurrentFinishStatus() == NetworkBattleReceiver.RESULT_CODE.NotFinish && !_networkBattleData.isReceiveTurnEndAction) + { + RegisterSequentialVfx(_operateMgr.TurnEndOperation(isPlayer: false)); + } + _networkBattleData.isReceiveTurnEndAction = false; + _networkBattleMgr.SendJudge(); + } + else + { + LocalLog.AccumulateLastTraceLog("AlreadyTurnEndSend"); + } + } + + public override void TurnEndFinalOperation() + { + _networkBattleMgr.SendJudge(); + } + + public override void JudgeOperation() + { + if (_networkBattleMgr.JudgeCurrentFinishStatus() != NetworkBattleReceiver.RESULT_CODE.NotFinish) + { + _networkBattleMgr.BattleFinishReceiveAfterFinishBattleSend(NetworkBattleSender.JUDGE_RESULT_STATUS.BattleFinishToJudge); + } + else + { + RegisterSequentialVfx(_networkBattleMgr.ControlTurnStartPlayer()); + } + } + + public override void PlayHandCardOperation(PlayHandCardReflection networkPlayCardAction, List choiceIdList = null, bool isChoice = false) + { + CommonPlayHandCardOperation(networkPlayCardAction, _networkBattleMgr.BattleEnemy, isPlayer: false, _receivedData.OpponentTargetDataList, choiceIdList, isChoice); + } + + public override void PlaySkillSelectHandCardOperation(PlayHandCardReflection networkPlayCardAction, List choiceIdList = null) + { + SetupNetworkPlayCardAction(networkPlayCardAction, _receivedData.OpponentTargetDataList); + RegisterSequentialVfx(InstantVfx.Create(delegate + { + networkPlayCardAction.PlayAction(isPlayer: false, choiceIdList); + })); + } + + public override void InPlayActionOperation(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction) + { + LocalLog.AccumulateLastTraceLog("PlayActionsReceive"); + switch (_receivedData.actionType) + { + case NetworkBattleDefine.PlayActionType.PLAY_HAND: + if (!_receivedData.IsChoiceBrave) + { + PlayHandCardOperation(networkPlayCardAction, _receivedData.choiceIdList, _receivedData.IsChoice); + } + else + { + ChoiceBraveOperation(networkPlayCardAction, _receivedData.choiceIdList); + } + break; + case NetworkBattleDefine.PlayActionType.PLAY_HAND_SELECT: + if (!_receivedData.IsChoiceBrave) + { + PlaySkillSelectHandCardOperation(networkPlayCardAction, _receivedData.choiceIdList); + } + else + { + ChoiceBraveOperation(networkPlayCardAction, _receivedData.choiceIdList); + } + break; + case NetworkBattleDefine.PlayActionType.ATTACK: + case NetworkBattleDefine.PlayActionType.EVOLUTION: + case NetworkBattleDefine.PlayActionType.EVOLUTION_SELECT: + networkInPlayAction.ReadySetting(_receivedData.OpponentTargetDataList, _receivedData.actionType, _receivedData.playCardIndex); + networkInPlayAction.Play(_isPlayer, _receivedData.choiceIdList, _receivedData.IsChoice); + _sendEcho = true; + _playCardIndexToEcho = _receivedData.playCardIndex; + break; + case NetworkBattleDefine.PlayActionType.FUSION: + FusionCardOperation(networkPlayCardAction, isPlayer: false, _receivedData.OpponentTargetDataList); + break; + } + _actionTypeToEcho = _receivedData.actionType; + } + + public override void RetireOperation() + { + _networkBattleMgr.ReceiveRetire(_receivedData.isWin); + } + + public override void ChatStampOperation() + { + ClassCharaPrm.EmotionType oppoChatStamp = (ClassCharaPrm.EmotionType)_receivedData.oppoChatStamp; + if (!ClassCharaPrm.IsEvolutionEmotionType(oppoChatStamp)) + { + VfxBase vfx = _networkBattleMgr.BattleEnemy.Emotion.PlayEmotion(oppoChatStamp, 1.5f); + ImmediateVfxMgr.GetInstance().Register(vfx); + } + } + + public override void DataInconsistencyBattleEndOperation() + { + JudgeEndTypeToLose(_receivedData.judgeEndType); + } + + public override void TouchOperation() + { + } + + public override void SelectSkillOperation(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction) + { + } + + public override void SelectObjectOperation() + { + } + + public override void TurnEndReady() + { + } + + public override void SlideObject() + { + } + + public override void BattleFinishOperation() + { + _isReceivedBattleFinish = true; + _networkBattleMgr.JudgeResultReceive(_receivedData.result); + } + + public override void MaintenanceOperation() + { + } + + public override void JudgeResultOperation() + { + _networkBattleMgr.JudgeResultReceive(_receivedData.result); + } + + public override void WriteOperationToTraceLog() + { + LocalLog.AccumulateLastTraceLog("StartOperateURI:" + _receivedData.dataUri); + } + + public override void SendEcho() + { + if (_sendEcho) + { + _networkBattleMgr.SendEcho(_playCardIndexToEcho, _actionTypeToEcho, isNotActiveSeq: false, _isTurnStart); + } + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkRecoveryBattleData.cs b/SVSim.BattleEngine/Engine/NetworkRecoveryBattleData.cs new file mode 100644 index 0000000..3de2117 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkRecoveryBattleData.cs @@ -0,0 +1,18 @@ +public class NetworkRecoveryBattleData : NetworkWatchBattleData +{ + public NetworkRecoveryBattleData(NetworkBattleManagerBase battleMgr) + : base(battleMgr) + { + } + + public override void BeforeSettingReceiveData() + { + SetEnemyFirstTurn(); + base.BeforeSettingReceiveData(); + } + + protected override ReplaceReceivedCard CreateReplaceReceivedCard(CardDataModel cardData) + { + return new RecoveryReplaceReceivedCard(_battleMgr, cardData); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkReplayBattleReceiver.cs b/SVSim.BattleEngine/Engine/NetworkReplayBattleReceiver.cs new file mode 100644 index 0000000..25686f4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkReplayBattleReceiver.cs @@ -0,0 +1,12 @@ +public class NetworkReplayBattleReceiver : NetworkWatchBattleReceiver +{ + public NetworkReplayBattleReceiver(NetworkBattleManagerBase battlemgr) + : base(battlemgr) + { + } + + protected override int ConvertToInt(object intStr) + { + return int.Parse(intStr.ToString()); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkReplayBattleSetupCardEvent.cs b/SVSim.BattleEngine/Engine/NetworkReplayBattleSetupCardEvent.cs new file mode 100644 index 0000000..eabd58f --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkReplayBattleSetupCardEvent.cs @@ -0,0 +1,37 @@ +public class NetworkReplayBattleSetupCardEvent : NetworkBattleSetupCardEvent +{ + public NetworkReplayBattleSetupCardEvent(BattleManagerBase manager, RegisterActionManager registerCardList, NetworkBattleData data) + : base(manager, registerCardList, data) + { + } + + public override void SetupCardSkillEvent(BattleCardBase card) + { + SetupPreAndPostEvolutionSkillEvents(card); + } + + protected override bool IsSendUnapprovedList(SkillBase skill) + { + return false; + } + + protected override bool IsCheckValidateCard() + { + return false; + } + + protected override bool IsCheckSkillConditionCard(BattleCardBase card) + { + return false; + } + + public override bool IsSettingUnapprovedCard(SkillBase skill) + { + return false; + } + + protected override bool IsSetNotCheckSelectSkillCard() + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkillPreprocessConditionCheck.cs b/SVSim.BattleEngine/Engine/NetworkSkillPreprocessConditionCheck.cs new file mode 100644 index 0000000..c248f76 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkillPreprocessConditionCheck.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; + +public class NetworkSkillPreprocessConditionCheck : SkillPreprocessConditionCheck +{ + private NetworkBattleSetupCardEvent _networkBattleSetupCardEvent; + + public NetworkSkillPreprocessConditionCheck(SkillBase skill, string condition) + : base(skill, condition) + { + _networkBattleSetupCardEvent = (BattleManagerBase.GetIns() as NetworkBattleManagerBase)._networkBattleSetupCardEventBase; + if (_skill != null) + { + _skill.OnSkillStart -= _networkBattleSetupCardEvent.EventPreprocessConditionCheck; + _skill.OnSkillStart += _networkBattleSetupCardEvent.EventPreprocessConditionCheck; + } + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool preexecutionCheck = false) + { + if (_networkBattleSetupCardEvent.IsSettingUnapprovedCard(_skill) && RegisterSkillConditionCheck.IsPreprocessConditionCheck(_filter, _skill)) + { + (_skill._executionInfoCreator as NetworkExecutionInfoCreator).SetReceiveSkillConditionCheck(); + _skill.OnSkillStart -= _networkBattleSetupCardEvent.ReplacePreprocessConditionCheck; + _skill.OnSkillStart += _networkBattleSetupCardEvent.ReplacePreprocessConditionCheck; + return true; + } + BattleCardBase ownerCard = _skill.SkillPrm.ownerCard; + GameMgr ins = GameMgr.GetIns(); + if (!ownerCard.IsPlayer && !ins.IsAdminWatch && RegisterFilter.IsFilterPreprocessCondition(_skill) && !GameMgr.GetIns().IsReplayBattle) + { + if (preexecutionCheck && _filter.VariableCompareFilter.Any((SkillVariableComareFilter c) => c.Text.Contains(SkillFilterCreator.ContentKeyword.last_target.ToString()))) + { + List lastTargetCardsList = ownerCard.SelfBattlePlayer.GetLastTargetCardsList(0); + if (lastTargetCardsList.Count == 0) + { + return false; + } + if (lastTargetCardsList[0].LastDrawOpenCard == null || lastTargetCardsList[0].LastDrawOpenCard != lastTargetCardsList[0]) + { + return true; + } + bool isSkipPrivateCardCheck = option.IsSkipPrivateCardCheck; + option.IsSkipPrivateCardCheck = true; + bool result = base.IsRight(playerInfoPair, option, preexecutionCheck); + option.IsSkipPrivateCardCheck = isSkipPrivateCardCheck; + return result; + } + return true; + } + return base.IsRight(playerInfoPair, option, preexecutionCheck); + } + + public ConditionSkillFilterCollection GetConditionSkillFilterCollection() + { + return _filter; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkillRandomEachSameBaseCardIdFilter.cs b/SVSim.BattleEngine/Engine/NetworkSkillRandomEachSameBaseCardIdFilter.cs new file mode 100644 index 0000000..8538050 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkillRandomEachSameBaseCardIdFilter.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using Wizard.Battle.View.Vfx; + +public class NetworkSkillRandomEachSameBaseCardIdFilter : SkillRandomEachSameBaseCardIdFilter +{ + public NetworkSkillRandomEachSameBaseCardIdFilter(int randomCount, BattlePlayerBase player, SkillBase skill) + : base(randomCount, player) + { + if (!player.IsPlayer) + { + skill.OnSkillStart += CaliculateCount; + skill.OnSkillEnd += ResetCalcCount; + } + } + + public void CaliculateCount(SkillBase skill, List targetCards, SkillConditionCheckerOption checkerOption) + { + _count = targetCards.Count; + } + + public VfxBase ResetCalcCount(SkillBase skill, List targetCards, SkillConditionCheckerOption checkerOption, SkillProcessor skillProcessor) + { + _count = 0; + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkillRandomSelectUntilFilter.cs b/SVSim.BattleEngine/Engine/NetworkSkillRandomSelectUntilFilter.cs new file mode 100644 index 0000000..5e0295d --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkillRandomSelectUntilFilter.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkillRandomSelectUntilFilter : SkillRandomSelectUntilFilter +{ + public NetworkSkillRandomSelectUntilFilter(string randomCountText, BattlePlayerBase player, SkillBase skill) + : base(randomCountText, player) + { + if (!player.IsPlayer) + { + skill.OnSkillStart += CaliculateCount; + skill.OnSkillEnd += ResetCalcCount; + } + } + + public void CaliculateCount(SkillBase skill, List targetCards, SkillConditionCheckerOption checkerOption) + { + BattlePlayerBase battlePlayerBase = ((skill.ApplyBattlePlayerFilter is SelfBattlePlayerFilter) ? skill.SkillPrm.selfBattlePlayer : skill.SkillPrm.opponentBattlePlayer); + if (targetCards.Count <= 0 && battlePlayerBase.DeckCardList.Count <= 0) + { + _count = 1; + return; + } + _count = targetCards.Count; + if (((NetworkBattleManagerBase)battlePlayerBase.BattleMgr).networkBattleData.GetReceiveData().unapprovedList.Any((CardDataModel u) => u.Index == -99)) + { + _count++; + } + } + + public VfxBase ResetCalcCount(SkillBase skill, List targetCards, SkillConditionCheckerOption checkerOption, SkillProcessor skillProcessor) + { + _count = 0; + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkillTargetLastTargetFilter.cs b/SVSim.BattleEngine/Engine/NetworkSkillTargetLastTargetFilter.cs new file mode 100644 index 0000000..f2e2340 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkillTargetLastTargetFilter.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class NetworkSkillTargetLastTargetFilter : SkillTargetLastTargetFilter +{ + private SkillBase _skill; + + private NetworkBattleSetupCardEvent _networkBattleSetupCardEvent; + + public NetworkSkillTargetLastTargetFilter(string option, SkillBase skill) + : base(option) + { + _skill = skill; + _networkBattleSetupCardEvent = (BattleManagerBase.GetIns() as NetworkBattleManagerBase)._networkBattleSetupCardEventBase; + if (_skill != null) + { + _skill.OnSkillStart -= _networkBattleSetupCardEvent.EventDiscardOrBanishSkillConditionCheck; + _skill.OnSkillStart += _networkBattleSetupCardEvent.EventDiscardOrBanishSkillConditionCheck; + } + } + + public override IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + if (_networkBattleSetupCardEvent.IsSettingUnapprovedCard(_skill) && IsLastTargetDiscardOrBanishSkill(option) && RegisterSkillConditionCheck.CheckLastTargetFilter(_skill)) + { + (_skill._executionInfoCreator as NetworkExecutionInfoCreator).SetReceiveSkillConditionCheck(); + _skill.OnSkillStart -= _networkBattleSetupCardEvent.ReplaceLastTargetDiscardOrBanishSkillOption; + _skill.OnSkillStart += _networkBattleSetupCardEvent.ReplaceLastTargetDiscardOrBanishSkillOption; + } + return base.Filtering(battlePlayerInfos, option); + } + + private bool IsLastTargetDiscardOrBanishSkill(SkillConditionCheckerOption option) + { + if (option == null) + { + return false; + } + if (option.SelectedCards.Count < 1) + { + return false; + } + if (option.SelectedCards[0].SelectSkill is Skill_discard || option.SelectedCards[0].SelectSkill is Skill_banish) + { + return true; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_attach_skill.cs b/SVSim.BattleEngine/Engine/NetworkSkill_attach_skill.cs new file mode 100644 index 0000000..8726e26 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_attach_skill.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_attach_skill : Skill_attach_skill +{ + public NetworkSkill_attach_skill(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + NetworkSkill_attach_skill networkSkill_attach_skill = this; + base.OnSkillStart += delegate(SkillBase skill, List targetCards, SkillConditionCheckerOption checkerOption) + { + if (networkSkill_attach_skill.IsBattleLog && networkSkill_attach_skill.IsTargetInOpponentHand() && networkSkill_attach_skill.IsTargetSelectedCard) + { + SkillCreator.SkillBuildInfo buildInfo = Skill_attach_skill.CreateAttachSkillBuildInfo(option); + networkSkill_attach_skill.LoggingOpponentPrivateCard(targetCards, buildInfo); + } + }; + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(_effectTargets); + IEnumerable source = from s in _attachSkills + where s is NetworkSkill_token_draw && s.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.token_draw, "_OPT_NULL_").Contains(SkillFilterCreator.ContentKeyword.load_target_card_id.ToString()) + select s as NetworkSkill_token_draw; + if (source.Count() == 0) + { + return result; + } + for (int num = 0; num < source.Count(); num++) + { + source.ElementAt(num).CreateTokenCardAttachTiming(base.SkillPrm.ownerCard.SkillApplyInformation.LoadTargetList()); + } + return result; + } + + public override void CallOnAttachSkill(List targetCards) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnAttachSkill(base.BuildInfo, targetCards, base.SkillPrm.ownerCard); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_attack_by_life.cs b/SVSim.BattleEngine/Engine/NetworkSkill_attack_by_life.cs new file mode 100644 index 0000000..2adda72 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_attack_by_life.cs @@ -0,0 +1,17 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_attack_by_life : Skill_attack_by_life +{ + public NetworkSkill_attack_by_life(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_attack_count.cs b/SVSim.BattleEngine/Engine/NetworkSkill_attack_count.cs new file mode 100644 index 0000000..f6cc812 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_attack_count.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_attack_count : Skill_attack_count +{ + public NetworkSkill_attack_count(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList(), updateAttackEffect: true); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } + + protected override void CallOnChangeMaxAttackableCount(List targetCards) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnChangeMaxAttackableCount(base.SkillPrm.ownerCard, targetCards, GetSetAttackCount()); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_attract_skill_target.cs b/SVSim.BattleEngine/Engine/NetworkSkill_attract_skill_target.cs new file mode 100644 index 0000000..55e60d5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_attract_skill_target.cs @@ -0,0 +1,7 @@ +public class NetworkSkill_attract_skill_target : Skill_attract_skill_target +{ + public NetworkSkill_attract_skill_target(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_banish.cs b/SVSim.BattleEngine/Engine/NetworkSkill_banish.cs new file mode 100644 index 0000000..d85fdfc --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_banish.cs @@ -0,0 +1,16 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_banish : Skill_banish +{ + public NetworkSkill_banish(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter callParameter) + { + bool isOpen = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.is_open, SkillFilterCreator.ContentKeyword._false.ToStringCustom()) == SkillFilterCreator.ContentKeyword._true.ToStringCustom(); + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnSkillDestroyOrBanish(base.SkillPrm.ownerCard, isBurialRite: false, isOpen); + return base.Start(callParameter); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_bp_modifier.cs b/SVSim.BattleEngine/Engine/NetworkSkill_bp_modifier.cs new file mode 100644 index 0000000..c280358 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_bp_modifier.cs @@ -0,0 +1,15 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_bp_modifier : Skill_bp_modifier +{ + public NetworkSkill_bp_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + protected override VfxBase AddBp(BattlePlayerBase target, int value) + { + target.CallOnAddBp(value, base.SkillPrm.ownerCard); + return base.AddBp(target, value); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_cant_activate_fanfare.cs b/SVSim.BattleEngine/Engine/NetworkSkill_cant_activate_fanfare.cs new file mode 100644 index 0000000..5959503 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_cant_activate_fanfare.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_cant_activate_fanfare : Skill_cant_activate_fanfare +{ + public NetworkSkill_cant_activate_fanfare(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList()); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnGiveCantActivateFanfare(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + List list = new List(); + for (int i = 0; i < buffInfoContainer.Count; i++) + { + list.Add(buffInfoContainer[i]._targetCard); + } + VfxWithLoading result = base.Stop(skillProcessor); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnDepriveCantActivateFanfare(base.SkillPrm.ownerCard, list); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_cant_attack.cs b/SVSim.BattleEngine/Engine/NetworkSkill_cant_attack.cs new file mode 100644 index 0000000..21a5d41 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_cant_attack.cs @@ -0,0 +1,18 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_cant_attack : Skill_cant_attack +{ + public NetworkSkill_cant_attack(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList(), updateAttackEffect: true, useRecordAttackEffect: false, isCantAttackSkill: true); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_cant_evolution.cs b/SVSim.BattleEngine/Engine/NetworkSkill_cant_evolution.cs new file mode 100644 index 0000000..351d0e8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_cant_evolution.cs @@ -0,0 +1,7 @@ +public class NetworkSkill_cant_evolution : Skill_cant_evolution +{ + public NetworkSkill_cant_evolution(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_cant_play.cs b/SVSim.BattleEngine/Engine/NetworkSkill_cant_play.cs new file mode 100644 index 0000000..c5a1556 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_cant_play.cs @@ -0,0 +1,17 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_cant_play : Skill_cant_play +{ + public NetworkSkill_cant_play(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_change_affiliation.cs b/SVSim.BattleEngine/Engine/NetworkSkill_change_affiliation.cs new file mode 100644 index 0000000..b2edbff --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_change_affiliation.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_change_affiliation : Skill_change_affiliation +{ + public NetworkSkill_change_affiliation(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnChangeAffiliation(base.SkillPrm.ownerCard, parameter.targetCards.ToList(), _clan, _tribeInfo); + return result; + } + + public override void RegisterStop(BattleCardBase card) + { + RegisterAttach register = new RegisterAttach(new List { card }, this, isDelete: true); + (BattleManagerBase.GetIns() as NetworkBattleManagerBase)._networkBattleSetupCardEventBase.AddRegisterActionManager(register); + } + + public override void SkillCreateEnd() + { + base.SkillCreateEnd(); + if (NetworkBattleGenericTool.IsUnapprovedTarget(this) && base.SkillPrm.ownerCard.IsPlayer) + { + base.OnSkillEnd += NetworkBattleGenericTool.Event_SetupPlayerUnapprovedAddEvent; + } + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_change_cemetery.cs b/SVSim.BattleEngine/Engine/NetworkSkill_change_cemetery.cs new file mode 100644 index 0000000..d7cbb28 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_change_cemetery.cs @@ -0,0 +1,23 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_change_cemetery : Skill_change_cemetery +{ + public NetworkSkill_change_cemetery(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + if (base.AddCemeteryCount > 0) + { + (base.SkillPrm.selfBattlePlayer.BattleMgr as NetworkBattleManagerBase).RegisterActionManager.Add(new RegisterPlayerParameter(RegisterActionBase.ActionBaseParameter.cemetery, base.AddCemeteryCount, base.SkillPrm.selfBattlePlayer.IsPlayer)); + } + if (base.GainCemeteryCount > 0) + { + (base.SkillPrm.selfBattlePlayer.BattleMgr as NetworkBattleManagerBase).RegisterActionManager.Add(new RegisterPlayerParameter(RegisterActionBase.ActionBaseParameter.cemetery, -1 * base.GainCemeteryCount, base.SkillPrm.selfBattlePlayer.IsPlayer)); + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_change_super_skybound_art_count.cs b/SVSim.BattleEngine/Engine/NetworkSkill_change_super_skybound_art_count.cs new file mode 100644 index 0000000..a425b4a --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_change_super_skybound_art_count.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_change_super_skybound_art_count : Skill_change_super_skybound_art_count +{ + public NetworkSkill_change_super_skybound_art_count(NetworkBattleManagerBase battleManager, SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + List targetCards = parameter.targetCards.Where((BattleCardBase t) => t.HasSuperSkyboundArt && (t.IsPlayer || GameMgr.GetIns().IsAdminWatch)).ToList(); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnChangeUnionBurstAndSkyboundArt(targetCards); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_change_union_burst_count.cs b/SVSim.BattleEngine/Engine/NetworkSkill_change_union_burst_count.cs new file mode 100644 index 0000000..09c59e1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_change_union_burst_count.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_change_union_burst_count : Skill_change_union_burst_count +{ + public NetworkSkill_change_union_burst_count(NetworkBattleManagerBase battleManager, SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + Func, SkillConditionCheckerOption, SkillProcessor, VfxBase> value = delegate(SkillBase localSkill, List localCards, SkillConditionCheckerOption checkerOption, SkillProcessor skillProcessor) + { + if (!(localSkill.ApplyingTargetFilter is SkillTargetHandSelfFilter) && NetworkBattleGenericTool.IsUnapprovedTarget(localSkill) && localCards.Count() > 0) + { + int gainUnionBurstCount = ((Skill_change_union_burst_count)localSkill).GetGainUnionBurstCount(); + RegisterChangeUnionBurstCount data = new RegisterChangeUnionBurstCount(localCards, localSkill, gainUnionBurstCount); + battleManager.RegisterActionManager.Add(data); + } + return NullVfx.GetInstance(); + }; + base.OnSkillEnd -= value; + base.OnSkillEnd += value; + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + List source = parameter.targetCards.Where((BattleCardBase t) => t.HasUnionBurst && (t.IsPlayer || GameMgr.GetIns().IsAdminWatch)).ToList(); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnChangeUnionBurstAndSkyboundArt(source.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_change_white_ritual_stack.cs b/SVSim.BattleEngine/Engine/NetworkSkill_change_white_ritual_stack.cs new file mode 100644 index 0000000..87b6b91 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_change_white_ritual_stack.cs @@ -0,0 +1,26 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_change_white_ritual_stack : Skill_change_white_ritual_stack +{ + public NetworkSkill_change_white_ritual_stack(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + (base.SkillPrm.selfBattlePlayer.BattleMgr as NetworkBattleManagerBase).RegisterInplayWhiteRitualStack(base.SkillPrm.selfBattlePlayer); + return result; + } + + protected override void CallOnChangeWhiteRitualStack(BattleCardBase target, int changeCount) + { + base.SkillPrm.selfBattlePlayer.CallOnChangeWhiteRitualStack(target, changeCount); + } + + protected override void CallOnSkillDestroy() + { + base.SkillPrm.selfBattlePlayer.CallOnSkillDestroyOrBanish(base.SkillPrm.ownerCard); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_chant_count_change.cs b/SVSim.BattleEngine/Engine/NetworkSkill_chant_count_change.cs new file mode 100644 index 0000000..29c64ae --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_chant_count_change.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_chant_count_change : Skill_chant_count_change +{ + public NetworkSkill_chant_count_change(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + protected override VfxBase CheckChantCountDestroy(BattleCardBase card, SkillProcessor skillProcessor) + { + if (card.ChantCount <= 0) + { + base.SkillPrm.selfBattlePlayer.CallOnSkillDestroyOrBanish(base.SkillPrm.ownerCard); + } + return base.CheckChantCountDestroy(card, skillProcessor); + } + + protected override void CallOnChantCountChange(List targetCards) + { + base.SkillPrm.selfBattlePlayer.CallOnChantCountChange(base.SkillPrm.ownerCard, targetCards, (gainChant > 0) ? (gainChant * -1) : addChant); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_clear_destroyed_and_discarded_card_list.cs b/SVSim.BattleEngine/Engine/NetworkSkill_clear_destroyed_and_discarded_card_list.cs new file mode 100644 index 0000000..42d8c4f --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_clear_destroyed_and_discarded_card_list.cs @@ -0,0 +1,20 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_clear_destroyed_and_discarded_card_list : Skill_clear_destroyed_and_discarded_card_list +{ + public NetworkSkill_clear_destroyed_and_discarded_card_list(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + for (int i = 0; i < parameter.targetCards.Count(); i++) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnClearDestroyedCardList(parameter.targetCards.ElementAt(i).SelfBattlePlayer.IsPlayer); + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_consume_ep_modifier.cs b/SVSim.BattleEngine/Engine/NetworkSkill_consume_ep_modifier.cs new file mode 100644 index 0000000..7d755d7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_consume_ep_modifier.cs @@ -0,0 +1,17 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_consume_ep_modifier : Skill_consume_ep_modifier +{ + public NetworkSkill_consume_ep_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_copy_skill.cs b/SVSim.BattleEngine/Engine/NetworkSkill_copy_skill.cs new file mode 100644 index 0000000..5aa944e --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_copy_skill.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_copy_skill : Skill_copy_skill +{ + public NetworkSkill_copy_skill(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + bool updateAttackEffect = SkillType == "quick" || SkillType == "rush"; + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(new List { base.SkillPrm.ownerCard }, updateAttackEffect); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList(), updateAttackEffect); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_cost_change.cs b/SVSim.BattleEngine/Engine/NetworkSkill_cost_change.cs new file mode 100644 index 0000000..246c66b --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_cost_change.cs @@ -0,0 +1,262 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_cost_change : Skill_cost_change +{ + private bool isCall; + + public bool IsForHandResident { get; private set; } + + public NetworkSkill_cost_change(NetworkBattleManagerBase battleManager, SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + NetworkSkill_cost_change networkSkill_cost_change = this; + base.OnSkillEnd += delegate + { + networkSkill_cost_change.isCall = false; + return NullVfx.GetInstance(); + }; + base.OnSkillStart += delegate(SkillBase skill, List targetCards, SkillConditionCheckerOption checkerOption) + { + if (!networkSkill_cost_change.isCall && networkSkill_cost_change.IsSend(networkSkill_cost_change) && !(skill.ApplyBattlePlayerFilter is BothBattlePlayerFilter) && !skill.IsUserSelectType && battleManager._networkBattleSetupCardEventBase.IsSettingUnapprovedCard(networkSkill_cost_change) && ((networkSkill_cost_change.SkillPrm.ownerCard.IsPlayer && networkSkill_cost_change.ApplyBattlePlayerFilter is OpponentBattlePlayerFilter) || (!networkSkill_cost_change.SkillPrm.ownerCard.IsPlayer && networkSkill_cost_change.ApplyBattlePlayerFilter is SelfBattlePlayerFilter)) && networkSkill_cost_change.IsPrivate()) + { + networkSkill_cost_change.SettingCostChangeData(); + ICardCostModifier modifire = networkSkill_cost_change.CreateCostModifier(); + networkSkill_cost_change.PrivateTargetRegister(battleManager, modifire, targetCards); + networkSkill_cost_change.isCall = true; + } + }; + OnAccumulationCostChange = (Action, ICardCostModifier>)Delegate.Combine(OnAccumulationCostChange, (Action, ICardCostModifier>)delegate(BattleCardBase ownerCard, List targetCards, ICardCostModifier modifier) + { + List list = targetCards.Where((BattleCardBase c) => c.IsInHand || c.IsInDeck).ToList(); + bool flag = list.Count == 1 && list.Any((BattleCardBase c) => c == ownerCard) && networkSkill_cost_change.OnWhenFusion == 0 && networkSkill_cost_change.OnWhenReturnStart == 0 && !networkSkill_cost_change.IsOpen(); + if ((!networkSkill_cost_change.isCall || networkSkill_cost_change.HasEachTargetOption()) && networkSkill_cost_change.IsSend(networkSkill_cost_change) && list != null && list.Count > 0 && !flag) + { + List list2 = list.Where((BattleCardBase c) => c.IsPlayer).ToList(); + List list3 = list.Where((BattleCardBase c) => !c.IsPlayer).ToList(); + bool flag2 = networkSkill_cost_change.IsPrivate(); + if (list2.Count > 0) + { + networkSkill_cost_change.PublicTargetRegister(battleManager, modifier, list2); + } + if (list3.Count > 0) + { + if (flag2) + { + networkSkill_cost_change.PrivateTargetRegister(battleManager, modifier, list3); + } + else + { + networkSkill_cost_change.PublicTargetRegister(battleManager, modifier, list3); + } + } + networkSkill_cost_change.isCall = true; + } + }); + } + + private bool IsPrivate() + { + if (NetworkBattleGenericTool.IsNeedUnapprovedListSkill(this) || RegisterFilter.IsFilterCard(this)) + { + return !IsOpen(); + } + return false; + } + + public override void SkillCreateEnd() + { + base.SkillCreateEnd(); + if (base.SkillPrm.ownerCard.IsPlayer) + { + if (NetworkBattleGenericTool.IsNeedUnapprovedListSkill(this)) + { + NetworkExecutionInfoCreator networkExecutionInfoCreator = base._executionInfoCreator as NetworkExecutionInfoCreator; + if (base.IsWhenDestroySkill || OnWhenReturnStart != 0) + { + networkExecutionInfoCreator.SetPlaySkill(); + base.OnSkillEnd += PublicAnytimeRandomTargetRegister; + isCall = true; + } + else + { + base.OnSkillEnd += NetworkBattleGenericTool.Event_SetupPlayerUnapprovedAddEvent; + } + } + } + else if (NetworkBattleGenericTool.IsNeedUnapprovedListSkill(this)) + { + NetworkExecutionInfoCreator networkExecutionInfoCreator2 = base._executionInfoCreator as NetworkExecutionInfoCreator; + if (base.IsWhenDestroySkill || OnWhenReturnStart != 0) + { + networkExecutionInfoCreator2.SetPlaySkill(); + base.OnSkillEnd += PrivateAnytimeRandomTargetRegister; + isCall = true; + } + networkExecutionInfoCreator2.SetUnapproved(); + } + } + + public void CheckForHandResident(List skillList) + { + IsForHandResident = false; + if (base.OptionValue.HasInfoByName(SkillFilterCreator.ContentKeyword.set) || base.OptionValue.HasInfoByName(SkillFilterCreator.ContentKeyword.random_set_range)) + { + if (base.ApplyingTargetFilter is SkillTargetHandFilter && base.ApplySelectFilter is SkillSelectAllFilter && OnSelfTurnStartStart == 1) + { + IsForHandResident = true; + } + else if (base.ApplyingTargetFilter is SkillTargetSkillDrewCardFilter && skillList.Any((SkillBase s) => s.SkillTimingText == SkillTimingText && s.ApplyingTargetFilter is SkillTargetDestroyedThisTurnCardListFilter)) + { + IsForHandResident = true; + } + else if (skillList.Any((SkillBase s) => s.SkillTimingText == SkillTimingText && s is Skill_draw) && !base.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessTurnEndStop)) + { + IsForHandResident = true; + } + } + } + + private VfxBase PublicAnytimeRandomTargetRegister(SkillBase skillBase, List cards, SkillConditionCheckerOption checkerOption, SkillProcessor skillProcessor) + { + if (cards != null && cards.Count() >= 1) + { + PublicTargetRegister(BattleManagerBase.GetIns() as NetworkBattleManagerBase, CreateCostModifier(), cards); + return NetworkBattleGenericTool.Event_SetupPlayerUnapprovedAddEvent(skillBase, cards, checkerOption, skillProcessor); + } + if (cards == null || cards.Count() == 0) + { + (BattleManagerBase.GetIns() as NetworkBattleManagerBase).StableRandomDouble(); + } + return NullVfx.GetInstance(); + } + + private VfxBase PrivateAnytimeRandomTargetRegister(SkillBase skillBase, IEnumerable cards, SkillConditionCheckerOption checkerOption, SkillProcessor skillProcessor) + { + RegisterLotCardBase registerLotCardBase = null; + NetworkBattleManagerBase networkBattleManagerBase = BattleManagerBase.GetIns() as NetworkBattleManagerBase; + if (skillBase.SkillPrm.ownerCard.SelfBattlePlayer.IsSelfTurn && cards != null && cards.Count() >= 1) + { + registerLotCardBase = NetworkBattleGenericTool.MakeRegisterLotAndRandomAdvance(skillBase, cards, checkerOption); + } + else + { + NetworkBattleDefine.NetworkCardPlaceState networkCardPlaceState = NetworkBattleDefine.NetworkCardPlaceState.None; + if (skillBase.ApplyingTargetFilter is SkillTargetHandFilter || skillBase.ApplyingTargetFilter is SkillTargetHandOtherSelfFilter) + { + networkCardPlaceState = NetworkBattleDefine.NetworkCardPlaceState.Hand; + } + else if (skillBase.ApplyingTargetFilter is SkillTargetDeckFilter) + { + networkCardPlaceState = NetworkBattleDefine.NetworkCardPlaceState.Deck; + } + double num = 0.0; + registerLotCardBase = new RegisterLotCardBase(rand: (cards == null || cards.Count() < 1) ? networkBattleManagerBase.StableRandomDouble() : networkBattleManagerBase.randomResult, registerActionManager: networkBattleManagerBase.RegisterActionManager, mgr: networkBattleManagerBase, isplayer: false, from: networkCardPlaceState, targetIndex: -1, skill: this); + registerLotCardBase.SettingTargetStatusToSearchSkill(networkBattleManagerBase, skillBase); + networkBattleManagerBase.RegisterActionManager.Add(registerLotCardBase); + } + SettingCostChangeData(); + RegisterCostChangeCard data = new RegisterCostChangeCard(networkBattleManagerBase, networkBattleManagerBase.RegisterActionManager, CreateCostModifier(), null, this, checkerOption, registerLotCardBase, isNotCheckCard: true); + networkBattleManagerBase.RegisterActionManager.Add(data); + return NullVfx.GetInstance(); + } + + private void PrivateTargetRegister(NetworkBattleManagerBase battleManager, ICardCostModifier modifire, List targets) + { + bool flag = base.ApplyBattlePlayerFilter is SelfBattlePlayerFilter; + if (!base.SkillPrm.ownerCard.IsPlayer) + { + flag = !flag; + } + RegisterTargetBase registerTargetBase = null; + SkillConditionCheckerOption skillConditionCheckerOption = new SkillConditionCheckerOption(); + if (NetworkBattleGenericTool.IsNeedUnapprovedListSkill(this)) + { + if (targets.Count == 0) + { + return; + } + battleManager._networkBattleSetupCardEventBase.SetSkillTargetsConditionCheckUList(this, targets, skillConditionCheckerOption); + registerTargetBase = NetworkBattleGenericTool.MakeRegisterLotAndRandomAdvance(this, targets, skillConditionCheckerOption); + } + else if (RegisterFilter.IsFilterCard(this)) + { + if ((base.ApplyingTargetFilter is SkillTargetSkillUpdateDeckCardFilter && targets.Count == 0) || (base.ApplyingTargetFilter is SkillTargetLoadTargetFilter && OnBeforeAttackStart != 0 && targets.Count((BattleCardBase c) => !c.IsInCemetery) == 0)) + { + return; + } + battleManager._networkBattleSetupCardEventBase.SetSkillTargetsCondition(this, skillConditionCheckerOption); + registerTargetBase = new RegisterFilter(battleManager.RegisterActionManager, battleManager, flag, this, targets, isStop: false, skillConditionCheckerOption); + battleManager.RegisterActionManager.Add(registerTargetBase); + } + RegisterCostChangeCard register = new RegisterCostChangeCard(battleManager, battleManager.RegisterActionManager, modifire, targets, this, skillConditionCheckerOption, registerTargetBase); + battleManager._networkBattleSetupCardEventBase.AddRegisterActionManager(register); + } + + private void PublicTargetRegister(NetworkBattleManagerBase battleManager, ICardCostModifier modifire, List targets) + { + SkillConditionCheckerOption option = new SkillConditionCheckerOption(); + battleManager._networkBattleSetupCardEventBase.SetSkillTargetsCondition(this, option); + RegisterCostChangeCard register = new RegisterCostChangeCard(battleManager, battleManager.RegisterActionManager, modifire, targets, this, option); + battleManager._networkBattleSetupCardEventBase.AddRegisterActionManager(register); + } + + private bool IsSend(SkillBase skill) + { + if (((skill.SkillPrm.ownerCard.FinalMetamorphoseCard != null) ? skill.SkillPrm.ownerCard.FinalMetamorphoseCard : skill.SkillPrm.ownerCard).IsInHand && skill.OnWhenReturnStart == 0 && skill.OnWhenFusion == 0 && !IsOpen()) + { + return false; + } + return true; + } + + public override void SetEventAfterReplace(BattleCardBase card, BuffInfo buff) + { + card.OnResetCardParameter += delegate + { + card.RemoveBuffInfo(buff); + }; + } + + protected override bool IsUnconditionalCostChange() + { + BattleCardBase ownerCard = base.SkillPrm.ownerCard; + GameMgr ins = GameMgr.GetIns(); + if (!ownerCard.IsPlayer && !ins.IsAdminWatch && !GameMgr.GetIns().IsReplayBattle && RegisterFilter.IsFilterPreprocessCondition(this)) + { + return !IsRightSkillPreprocessConditionCheck(); + } + return false; + } + + private bool IsRightSkillPreprocessConditionCheck() + { + if (!(base.PreprocessList.FirstOrDefault((SkillPreprocessBase p) => p is SkillPreprocessConditionCheck) is SkillPreprocessConditionCheck skillPreprocessConditionCheck)) + { + return true; + } + return skillPreprocessConditionCheck.GetFilter().VariableCompareFilter.All((SkillVariableComareFilter s) => s.Filtering(base.OptionValue)); + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int count = base.CostModifierTypeList.Count; + VfxWithLoading result = base.Start(parameter); + List range = base.CostModifierTypeList.GetRange(count, base.CostModifierTypeList.Count - count); + bool isOpenCard = base.SkillPrm.ownerCard.IsPlayer && base.PreprocessList.FirstOrDefault((SkillPreprocessBase p) => p is SkillPreprocessOpenCard) != null && base.ApplyingTargetFilter is SkillTargetHandSelfFilter; + base.SkillPrm.selfBattlePlayer.CallOnCostChange(base.SkillPrm.ownerCard, _targets, (from c in range + where c is CostAddModifier + select c.Cost).ToList(), (from c in range + where c is CostSetModifier + select c.Cost).ToList(), _isCostUpList, IsHalfRoundUpCostSkill(SkillFilterCreator.ContentKeyword.add), OnWhenSpellChargeStart != 0, isOpenCard); + return result; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnRemoveCostChange(buffInfoContainer, OnWhenSpellChargeStart != 0, _addValue == int.MinValue || _addValue <= 0); + return base.Stop(skillProcessor); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_damage.cs b/SVSim.BattleEngine/Engine/NetworkSkill_damage.cs new file mode 100644 index 0000000..f504a7f --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_damage.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_damage : Skill_damage +{ + private List TargetList; + + private List DamageList; + + public NetworkSkill_damage(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter callParameter) + { + TargetList = new List(); + DamageList = new List(); + List effectTargets = callParameter.targetCards.Where((BattleCardBase t) => !t.IsDead).ToList(); + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnSkillDamageStart(base.SkillPrm.ownerCard); + VfxWithLoading result = base.Start(callParameter); + base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "_OPT_NULL_"); + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnDamage(TargetList, effectTargets, DamageList); + return result; + } + + public override void RegisterDamageTriggerSkill(SkillProcessor skillProcessor, IEnumerable target, int defDamage, BattleCardBase.DamageResult damageResult) + { + TargetList.Add(target.FirstOrDefault()); + DamageList.Add(damageResult); + base.RegisterDamageTriggerSkill(skillProcessor, target, defDamage, damageResult); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_damage_cut.cs b/SVSim.BattleEngine/Engine/NetworkSkill_damage_cut.cs new file mode 100644 index 0000000..1fc2574 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_damage_cut.cs @@ -0,0 +1,17 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_damage_cut : Skill_damage_cut +{ + public NetworkSkill_damage_cut(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, _targetCards); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(_targetCards); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_damage_modifier.cs b/SVSim.BattleEngine/Engine/NetworkSkill_damage_modifier.cs new file mode 100644 index 0000000..1ec1d97 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_damage_modifier.cs @@ -0,0 +1,17 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_damage_modifier : Skill_damage_modifier +{ + public NetworkSkill_damage_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_destroy.cs b/SVSim.BattleEngine/Engine/NetworkSkill_destroy.cs new file mode 100644 index 0000000..e7c45a4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_destroy.cs @@ -0,0 +1,15 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_destroy : Skill_destroy +{ + public NetworkSkill_destroy(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter callParameter) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnSkillDestroyOrBanish(base.SkillPrm.ownerCard); + return base.Start(callParameter); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_discard.cs b/SVSim.BattleEngine/Engine/NetworkSkill_discard.cs new file mode 100644 index 0000000..ffd6cab --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_discard.cs @@ -0,0 +1,19 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_discard : Skill_discard +{ + public NetworkSkill_discard(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter callParameter) + { + if (callParameter.targetCards.Count() > 0) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnDiscard(callParameter.targetCards.ToList()); + } + return base.Start(callParameter); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_drain.cs b/SVSim.BattleEngine/Engine/NetworkSkill_drain.cs new file mode 100644 index 0000000..6367426 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_drain.cs @@ -0,0 +1,18 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_drain : Skill_drain +{ + public NetworkSkill_drain(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_evolve.cs b/SVSim.BattleEngine/Engine/NetworkSkill_evolve.cs new file mode 100644 index 0000000..ec1119a --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_evolve.cs @@ -0,0 +1,19 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_evolve : Skill_evolve +{ + public NetworkSkill_evolve(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter callParameter) + { + VfxWithLoading vfxWithLoading = base.Start(callParameter); + if (!(vfxWithLoading is NullVfxWithLoading)) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnAfterSkillEvolve(_evolvedBySkill); + } + return vfxWithLoading; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_extra_turn.cs b/SVSim.BattleEngine/Engine/NetworkSkill_extra_turn.cs new file mode 100644 index 0000000..7837d04 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_extra_turn.cs @@ -0,0 +1,21 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_extra_turn : Skill_extra_turn +{ + public NetworkSkill_extra_turn(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + base.OnSkillStart += delegate + { + (BattleManagerBase.GetIns() as NetworkBattleManagerBase).RegisterActionManager.Add(new RegisterExtraTurn(GetAddTurn(), base.SkillPrm.ownerCard.IsPlayer)); + }; + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_force_avarice.cs b/SVSim.BattleEngine/Engine/NetworkSkill_force_avarice.cs new file mode 100644 index 0000000..2004cf4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_force_avarice.cs @@ -0,0 +1,32 @@ +public class NetworkSkill_force_avarice : Skill_force_avarice +{ + public NetworkSkill_force_avarice(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + ClassBattleCardBase classData = skillPrm.selfBattlePlayer.Class as ClassBattleCardBase; + classData.OnForceAvariceChange += delegate(BattlePlayerBase player, int forceAvaricePoint) + { + int num = 0; + if (skillPrm.selfBattlePlayer.BattleMgr is NetworkStandardBattleMgr) + { + NetworkStandardBattleMgr networkStandardBattleMgr = (NetworkStandardBattleMgr)skillPrm.selfBattlePlayer.BattleMgr; + if (networkStandardBattleMgr != null) + { + num = ((!classData.IsPlayer) ? 1 : 0); + if (!SkillConditionAvarice.IsAvarice(skillPrm.selfBattlePlayer.TurnDrawCards.Count)) + { + if (networkStandardBattleMgr.beforeAvariceCount[num] == 0 && forceAvaricePoint >= 1) + { + networkStandardBattleMgr.RegisterAvariceTrigger(player, 1); + } + else if (networkStandardBattleMgr.beforeAvariceCount[num] >= 1 && forceAvaricePoint <= 0) + { + networkStandardBattleMgr.RegisterAvariceTrigger(player, 0); + } + } + networkStandardBattleMgr.beforeAvariceCount[num] = forceAvaricePoint; + } + } + }; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_force_berserk.cs b/SVSim.BattleEngine/Engine/NetworkSkill_force_berserk.cs new file mode 100644 index 0000000..7f85e94 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_force_berserk.cs @@ -0,0 +1,32 @@ +public class NetworkSkill_force_berserk : Skill_force_berserk +{ + public NetworkSkill_force_berserk(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + ClassBattleCardBase classData = skillPrm.selfBattlePlayer.Class as ClassBattleCardBase; + classData.OnForceBerserkChange += delegate(BattlePlayerBase player, int forceBerserkPoint) + { + int num = 0; + if (skillPrm.selfBattlePlayer.BattleMgr is NetworkStandardBattleMgr) + { + NetworkStandardBattleMgr networkStandardBattleMgr = (NetworkStandardBattleMgr)skillPrm.selfBattlePlayer.BattleMgr; + if (networkStandardBattleMgr != null) + { + num = ((!classData.IsPlayer) ? 1 : 0); + if (!SkillConditionHalfLife.IsHalfLife(classData.Life)) + { + if (networkStandardBattleMgr.beforeRevengeCount[num] == 0 && forceBerserkPoint >= 1) + { + networkStandardBattleMgr.RegisterRevengeTrigger(player, 1); + } + else if (networkStandardBattleMgr.beforeRevengeCount[num] >= 1 && forceBerserkPoint <= 0) + { + networkStandardBattleMgr.RegisterRevengeTrigger(player, 0); + } + } + networkStandardBattleMgr.beforeRevengeCount[num] = forceBerserkPoint; + } + } + }; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_force_skill_target.cs b/SVSim.BattleEngine/Engine/NetworkSkill_force_skill_target.cs new file mode 100644 index 0000000..08a027e --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_force_skill_target.cs @@ -0,0 +1,7 @@ +public class NetworkSkill_force_skill_target : Skill_force_skill_target +{ + public NetworkSkill_force_skill_target(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_force_wrath.cs b/SVSim.BattleEngine/Engine/NetworkSkill_force_wrath.cs new file mode 100644 index 0000000..4bf8e19 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_force_wrath.cs @@ -0,0 +1,20 @@ +public class NetworkSkill_force_wrath : Skill_force_wrath +{ + public NetworkSkill_force_wrath(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + ClassBattleCardBase classData = skillPrm.selfBattlePlayer.Class as ClassBattleCardBase; + classData.OnForceWrathChange += delegate(BattlePlayerBase player, int forceWrathPoint) + { + if (skillPrm.selfBattlePlayer.BattleMgr is NetworkStandardBattleMgr) + { + NetworkStandardBattleMgr networkStandardBattleMgr = (NetworkStandardBattleMgr)skillPrm.selfBattlePlayer.BattleMgr; + if (networkStandardBattleMgr != null) + { + int num = ((!classData.IsPlayer) ? 1 : 0); + networkStandardBattleMgr.beforeWrathCount[num] = forceWrathPoint; + } + } + }; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_fusion_metamorphose.cs b/SVSim.BattleEngine/Engine/NetworkSkill_fusion_metamorphose.cs new file mode 100644 index 0000000..c31b342 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_fusion_metamorphose.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_fusion_metamorphose : Skill_fusion_metamorphose +{ + public override bool IsTargetIndicate => false; + + public NetworkSkill_fusion_metamorphose(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + List list = parameter.targetCards.Where((BattleCardBase c) => c.IsInHand).ToList(); + VfxWithLoading result = base.Start(parameter); + if (list.Count > 0) + { + base.SkillPrm.selfBattlePlayer.CallOnFusionMetamorphose(_metamorphoseCardId); + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_generic_value_modifier.cs b/SVSim.BattleEngine/Engine/NetworkSkill_generic_value_modifier.cs new file mode 100644 index 0000000..1644317 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_generic_value_modifier.cs @@ -0,0 +1,120 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using Wizard; + +public class NetworkSkill_generic_value_modifier : Skill_generic_value_modifier +{ + private List genericValueCards; + + private List _filters; + + private bool IsNeedExtract => _setOptionText.Contains("last_target.charge_count"); + + public NetworkSkill_generic_value_modifier(NetworkBattleManagerBase battleManager, SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + NetworkSkill_generic_value_modifier networkSkill_generic_value_modifier = this; + genericValueCards = new List(); + _filters = new List(); + string text = _setOptionText.Split(':')[0]; + ConvertAndSetConditionsToTargetText(text); + if (base.SkillPrm.ownerCard.IsPlayer) + { + return; + } + base.OnSkillStart += delegate(SkillBase skill, List targetsCard, SkillConditionCheckerOption checkeroption) + { + networkSkill_generic_value_modifier.genericValueCards = networkSkill_generic_value_modifier.GetGenericValueCards(checkeroption); + if (networkSkill_generic_value_modifier.IsNeedExtract && networkSkill_generic_value_modifier.genericValueCards.Count > 0) + { + RegisterExtract register = new RegisterExtract(networkSkill_generic_value_modifier.SkillPrm.ownerCard.IsPlayer, networkSkill_generic_value_modifier.genericValueCards, RegisterActionBase.ActionBaseParameter.cost.ToString(), isBase: true); + battleManager._networkBattleSetupCardEventBase.AddRegisterActionManager(register); + } + }; + } + + public override void InsertTargetInfo(CallParameter parameter) + { + if (base.SkillPrm.ownerCard.IsPlayer && !GameMgr.GetIns().IsWatchBattle) + { + base.InsertTargetInfo(parameter); + return; + } + int[] skillGenericArray = new int[0]; + foreach (BattleCardBase targetCard in parameter.targetCards) + { + targetCard.SkillApplyInformation.SetSkillGenericArray(skillGenericArray); + } + } + + private void ConvertAndSetConditionsToTargetText(string text) + { + if (text.Contains('{')) + { + string[] array = text.Split('{'); + for (int i = 1; i < array.Length; i++) + { + ConvertAndSetConditionToTargetText(array[i].Split('}')[0]); + } + } + else + { + ConvertAndSetConditionToTargetText(text); + } + } + + private void ConvertAndSetConditionToTargetText(string text) + { + string[] array = text.Split('.'); + ApplySkillTargetFilterCollection applySkillTargetFilterCollection = new ApplySkillTargetFilterCollection(); + for (int i = 0; i < array.Count(); i++) + { + SkillFilterCreator.ContentKeyword keyword = SkillFilterCreator.Str2ContentKeyword(array[i]); + if (SkillFilterCreator.PLAYER_FILTER_NAMES.Contains(array[i])) + { + applySkillTargetFilterCollection.BattlePlayerFilter = SkillFilterCreator.CreateBattlePlayerFilter(keyword); + continue; + } + if (SkillFilterCreator.PLAYER_TARGET_FILTER_NAMES.Contains(array[i])) + { + SkillFilterCreator.ParseContentInfo(array[i], out var retParsedInfo); + applySkillTargetFilterCollection.TargetFilter = SkillFilterCreator.CreatePlayerTargetFilter(retParsedInfo, keyword, base.SkillPrm.ownerCard, this); + } + if (SkillFilterCreator.CARD_TYPE_FILTER_NAMES.Contains(text)) + { + applySkillTargetFilterCollection.CardFilterList.Add(SkillFilterCreator.CreateCardTypeFilter(keyword)); + } + else if (SkillFilterCreator.CARD_CONDITION_FILTER_NAMES.Any(text.StartsWith)) + { + applySkillTargetFilterCollection.CardFilterList.Add(SkillFilterCreator.CreateCardConditionFilter(text, base.SkillPrm.ownerCard)); + } + else if (SkillFilterCreator.CARD_SELECT_FILTER_NAMES.Any(text.StartsWith)) + { + applySkillTargetFilterCollection.SelectFilter = SkillFilterCreator.CreateCardSelectFilter(text); + } + else if (SkillFilterCreator.CARD_PARAMETER_COMPARE_FILTER_NAMES.Any((string n) => Regex.IsMatch(text, "^" + n + "[<>!:=]=?"))) + { + applySkillTargetFilterCollection.CardFilterList.Add(SkillFilterCreator.CreateCardParameterCompareFilter(text, base.SkillPrm.ownerCard)); + } + } + _filters.Add(applySkillTargetFilterCollection); + } + + private List GetGenericValueCards(SkillConditionCheckerOption option) + { + List list = new List(); + for (int i = 0; i < _filters.Count; i++) + { + IEnumerable source = _filters[i].Filtering(new BattlePlayerReadOnlyInfoPair(base.SkillPrm.selfBattlePlayer, base.SkillPrm.opponentBattlePlayer), option, null).Cast(); + for (int j = 0; j < source.Count(); j++) + { + if (!list.Contains(source.ElementAt(j))) + { + list.Add(source.ElementAt(j)); + } + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_guard.cs b/SVSim.BattleEngine/Engine/NetworkSkill_guard.cs new file mode 100644 index 0000000..7582327 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_guard.cs @@ -0,0 +1,17 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_guard : Skill_guard +{ + public NetworkSkill_guard(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, _targetCards); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(_targetCards); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_heal.cs b/SVSim.BattleEngine/Engine/NetworkSkill_heal.cs new file mode 100644 index 0000000..fcf223a --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_heal.cs @@ -0,0 +1,21 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_heal : Skill_heal +{ + public NetworkSkill_heal(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter callParameter) + { + VfxWithLoading vfxWithLoading = base.Start(callParameter); + if (vfxWithLoading is NullVfxWithLoading) + { + return vfxWithLoading; + } + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnHeal(base.SkillPrm.ownerCard, callParameter.targetCards.ToList(), HealResultList.Select((BattleCardBase.HealResult r) => r.HealAmount).ToList()); + return vfxWithLoading; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_ignore_guard.cs b/SVSim.BattleEngine/Engine/NetworkSkill_ignore_guard.cs new file mode 100644 index 0000000..60ce2fb --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_ignore_guard.cs @@ -0,0 +1,17 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_ignore_guard : Skill_ignore_guard +{ + public NetworkSkill_ignore_guard(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_independent.cs b/SVSim.BattleEngine/Engine/NetworkSkill_independent.cs new file mode 100644 index 0000000..35384b9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_independent.cs @@ -0,0 +1,17 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_independent : Skill_independent +{ + public NetworkSkill_independent(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_indestructible.cs b/SVSim.BattleEngine/Engine/NetworkSkill_indestructible.cs new file mode 100644 index 0000000..27208f5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_indestructible.cs @@ -0,0 +1,18 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_indestructible : Skill_indestructible +{ + public NetworkSkill_indestructible(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_invoke_skill.cs b/SVSim.BattleEngine/Engine/NetworkSkill_invoke_skill.cs new file mode 100644 index 0000000..650871e --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_invoke_skill.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +internal class NetworkSkill_invoke_skill : Skill_invoke_skill +{ + public NetworkSkill_invoke_skill(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + if (GameMgr.GetIns().IsUseUnapprovedList(base.SkillPrm.ownerCard.IsPlayer)) + { + string invokeType = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.invoke_type); + NetworkBattleManagerBase obj = base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr as NetworkBattleManagerBase; + List skillConditionCheckList = obj.networkBattleData.GetReceiveData().SkillConditionCheckList; + List unapprovedList = obj.networkBattleData.GetReceiveData().unapprovedList; + foreach (BattleCardBase targetCard in parameter.targetCards) + { + List list = ((!(invokeType == SkillTiming.when_play.ToString())) ? targetCard.Skills.Where((SkillBase s) => IsInvokableSkill(s, invokeType)).ToList() : targetCard.NormalSkills.Where((SkillBase s) => IsInvokableSkill(s, invokeType)).ToList()); + foreach (SkillBase skill in list) + { + if (skillConditionCheckList.Any((CardDataModel c) => skill.PublishedActiveSkillCount == c.publishedActiveSkillCount && c.IsInvoked)) + { + skill.SetInvoked(flag: true); + } + else if (unapprovedList.Any((CardDataModel c) => skill.PublishedActiveSkillCount == c.publishedActiveSkillCount && c.IsInvoked)) + { + skill.SetInvoked(flag: true); + } + } + } + } + return base.Start(parameter); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_killer.cs b/SVSim.BattleEngine/Engine/NetworkSkill_killer.cs new file mode 100644 index 0000000..d57b840 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_killer.cs @@ -0,0 +1,18 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_killer : Skill_killer +{ + public NetworkSkill_killer(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_lose.cs b/SVSim.BattleEngine/Engine/NetworkSkill_lose.cs new file mode 100644 index 0000000..fc469ea --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_lose.cs @@ -0,0 +1,23 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_lose : Skill_lose +{ + public NetworkSkill_lose(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList()); + if (_ability == SkillFilterCreator.ContentKeyword.guard.ToString()) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnLoseSkill(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_metamorphose.cs b/SVSim.BattleEngine/Engine/NetworkSkill_metamorphose.cs new file mode 100644 index 0000000..2641066 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_metamorphose.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_metamorphose : Skill_metamorphose +{ + public override bool IsTargetIndicate => false; + + public NetworkSkill_metamorphose(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + List list = parameter.targetCards.Where((BattleCardBase c) => c.IsInHand || c.IsInplay).ToList(); + if (list.Count > 0) + { + base.SkillPrm.selfBattlePlayer.CallOnMetamorphose(base.SkillPrm.ownerCard, list, _metamorphoseCardId); + } + return base.Start(parameter); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_not_be_attacked.cs b/SVSim.BattleEngine/Engine/NetworkSkill_not_be_attacked.cs new file mode 100644 index 0000000..decc01d --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_not_be_attacked.cs @@ -0,0 +1,18 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_not_be_attacked : Skill_not_be_attacked +{ + public NetworkSkill_not_be_attacked(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_play_count_change.cs b/SVSim.BattleEngine/Engine/NetworkSkill_play_count_change.cs new file mode 100644 index 0000000..94a0b59 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_play_count_change.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_play_count_change : Skill_play_count_change +{ + private NetworkBattleManagerBase _networkBattleMgr; + + public NetworkSkill_play_count_change(NetworkBattleManagerBase battleManager, SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + _networkBattleMgr = battleManager; + base.OnSkillEnd += RegisterPlayCountChange; + } + + private VfxBase RegisterPlayCountChange(SkillBase skill, List cards, SkillConditionCheckerOption checkerOption, SkillProcessor skillProcessor) + { + _networkBattleMgr.RegisterActionManager.Add(new RegisterPlayCountChange(base.SkillPrm.ownerCard.IsPlayer, GetAddCount())); + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_possess_ep_modifier.cs b/SVSim.BattleEngine/Engine/NetworkSkill_possess_ep_modifier.cs new file mode 100644 index 0000000..5337bcd --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_possess_ep_modifier.cs @@ -0,0 +1,28 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_possess_ep_modifier : Skill_possess_ep_modifier +{ + public NetworkSkill_possess_ep_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + protected override VfxBase AddEp(SkillProcessor skillProcessor, int add, BattlePlayerBase battlePlayer) + { + battlePlayer.CallOnEpModifier(base.SkillPrm.ownerCard, add, isAdd: true); + if (base.SkillPrm.selfBattlePlayer.BattleMgr is NetworkStandardBattleMgr networkStandardBattleMgr && add < 0 && battlePlayer.IsSelfTurn) + { + networkStandardBattleMgr.RegisterUseEpTrigger(base.SkillPrm.selfBattlePlayer); + } + return base.AddEp(skillProcessor, add, battlePlayer); + } + + protected override VfxBase SetEp(int set, BattlePlayerBase battlePlayer) + { + if (set >= 0) + { + battlePlayer.CallOnEpModifier(base.SkillPrm.ownerCard, set, isAdd: false); + } + return base.SetEp(set, battlePlayer); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_power_down.cs b/SVSim.BattleEngine/Engine/NetworkSkill_power_down.cs new file mode 100644 index 0000000..0d8d773 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_power_down.cs @@ -0,0 +1,34 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_power_down : Skill_power_down +{ + public NetworkSkill_power_down(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnPowerDownStart(); + VfxWithLoading result = base.Start(parameter); + if (_gainOffense > 0 || _gainLife > 0 || _gainMaxLife > 0) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnPowerDown(base.SkillPrm.ownerCard, parameter.targetCards.ToList(), _gainOffense * -1, _gainLife * -1, _gainMaxLife * -1, isSet: false); + return result; + } + if (_setOffense != Skill_power_down.SETPRM_NONE || _setLife != Skill_power_down.SETPRM_NONE || _setMaxLife != Skill_power_down.SETPRM_NONE) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnPowerDown(base.SkillPrm.ownerCard, parameter.targetCards.ToList(), _setOffense, _setLife, _setMaxLife, isSet: true); + return result; + } + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnRemoveLatestOperationJsonData(NetworkBattleReceiver.ReplayOperationType.GainPowerDown); + return result; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnDeprivePowerDown(buffInfoContainer); + return base.Stop(skillProcessor); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_power_modifier.cs b/SVSim.BattleEngine/Engine/NetworkSkill_power_modifier.cs new file mode 100644 index 0000000..a5c05ce --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_power_modifier.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Linq; + +public class NetworkSkill_power_modifier : Skill_power_modifier +{ + public NetworkSkill_power_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + protected override void IncrementGameBuffCount(List inplayTargetCards) + { + base.IncrementGameBuffCount(inplayTargetCards); + if (inplayTargetCards.Any()) + { + (base.SkillPrm.selfBattlePlayer.BattleMgr as NetworkBattleManagerBase).RegisterActionManager.Add(new RegisterPlayerParameter(RegisterActionBase.ActionBaseParameter.buffUnit, 1, base.SkillPrm.selfBattlePlayer.IsPlayer)); + } + } + + protected override void CallPowerUpEvent(List targetCards) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnPowerUp(base.SkillPrm.ownerCard, targetCards, (_addOffense > 0) ? _addOffense : (-_gainOffense), (_addLife > 0) ? _addLife : (-_gainLife), _multiplyOffense, _multiplyLife, _addMaxLife); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_powerup.cs b/SVSim.BattleEngine/Engine/NetworkSkill_powerup.cs new file mode 100644 index 0000000..a0ecd8d --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_powerup.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_powerup : Skill_powerup +{ + public NetworkSkill_powerup(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + protected override void IncrementGameBuffCount(List inplayTargetCards) + { + base.IncrementGameBuffCount(inplayTargetCards); + if (inplayTargetCards.Any()) + { + (base.SkillPrm.selfBattlePlayer.BattleMgr as NetworkBattleManagerBase).RegisterActionManager.Add(new RegisterPlayerParameter(RegisterActionBase.ActionBaseParameter.buffUnit, 1, base.SkillPrm.selfBattlePlayer.IsPlayer)); + } + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnDeprivePowerUp(_targetList); + return base.Stop(skillProcessor); + } + + protected override VfxBase GiveCombatModifier(BattleCardBase card, ICardOffenseModifier offenseModifier, ICardLifeModifier lifeModifier, CallParameter parameter) + { + bool flag = !GameMgr.GetIns().IsReplayBattle && (!base.SkillPrm.ownerCard.IsPlayer || GameMgr.GetIns().IsWatchBattle); + if (card.IsInDeck && flag && (BattleManagerBase.GetIns() as NetworkBattleManagerBase).networkBattleData.GetReceiveData().GetReceiveCardList().Any(delegate(CardDataModel c) + { + bool flag2 = c.ToStateList.Contains(NetworkBattleDefine.NetworkCardPlaceState.Deck); + return c.Index == card.Index && !flag2; + })) + { + AddBuffInfoIfNeeded(card); + card.SkillApplyInformation.GiveBuff(); + if (GetAddLife() > 0) + { + card.SkillApplyInformation.GiveBuffLife(); + } + card.OnRemoveFromInPlayAfterOneTime += delegate + { + card.SkillApplyInformation.DepriveBuff(); + return NullVfx.GetInstance(); + }; + return NullVfx.GetInstance(); + } + return base.GiveCombatModifier(card, offenseModifier, lifeModifier, parameter); + } + + protected override void CallPowerUpEvent(List targetCards) + { + List cards = targetCards.Where((BattleCardBase c) => c.MetamorphoseCard == null).ToList(); + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnPowerUp(base.SkillPrm.ownerCard, cards, _addOffense, _addLife, _multiplyOffense, _multiplyLife, _addMaxLife); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_pp_modifier.cs b/SVSim.BattleEngine/Engine/NetworkSkill_pp_modifier.cs new file mode 100644 index 0000000..4a6ee3a --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_pp_modifier.cs @@ -0,0 +1,26 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_pp_modifier : Skill_pp_modifier +{ + public NetworkSkill_pp_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + if (_decreaseTurnPp != Skill_pp_modifier.PP_NONE) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + } + return result; + } + + protected override void AddPp(BattlePlayerBase player, int add) + { + player.CallOnAddPp(add, base.SkillPrm.ownerCard); + base.AddPp(player, add); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_quick.cs b/SVSim.BattleEngine/Engine/NetworkSkill_quick.cs new file mode 100644 index 0000000..413ac39 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_quick.cs @@ -0,0 +1,18 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_quick : Skill_quick +{ + public NetworkSkill_quick(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList(), updateAttackEffect: true, useRecordAttackEffect: true); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_random_array.cs b/SVSim.BattleEngine/Engine/NetworkSkill_random_array.cs new file mode 100644 index 0000000..103d280 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_random_array.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using System.Linq; + +public class NetworkSkill_random_array : Skill_random_array +{ + public NetworkSkill_random_array(NetworkBattleManagerBase battleManager, SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + NetworkSkill_random_array networkSkill_random_array = this; + if (GameMgr.GetIns().IsAdminWatch || base.SkillPrm.ownerCard.IsPlayer) + { + return; + } + base.OnSkillStart += delegate(SkillBase skill, List targetsCard, SkillConditionCheckerOption checkeroption) + { + if (!targetsCard.Any((BattleCardBase c) => !c.IsInHand && !c.IsInDeck)) + { + List receiveCardList = battleManager.networkBattleData.GetReceiveData().GetReceiveCardList(); + int i; + for (i = 0; i < targetsCard.Count; i++) + { + CardDataModel cardDataModel = receiveCardList.SingleOrDefault((CardDataModel c) => c.Index == targetsCard[i].Index); + if (cardDataModel != null && !(cardDataModel.AttachTarget == string.Empty)) + { + string[] array = cardDataModel.AttachTarget.Split(','); + for (int num = 0; num < array.Length; num++) + { + if (int.TryParse(array[num], out var targetSkillCount)) + { + SkillBase skillBase = battleManager.PublishedSkillList.SingleOrDefault((SkillBase s) => s.PublishedActiveSkillCount == targetSkillCount); + if (skillBase != null && skillBase.PreprocessList.SingleOrDefault((SkillPreprocessBase p) => p is SkillPreprocessRandomArrayIndex) is SkillPreprocessRandomArrayIndex skillPreprocessRandomArrayIndex) + { + networkSkill_random_array.AddSelectedIndex(targetsCard[i], skillPreprocessRandomArrayIndex.RandomIndexes.ToList()); + } + } + } + } + } + } + }; + } + + private void AddSelectedIndex(BattleCardBase key, List values) + { + if (!base.SelectedIndex.ContainsKey(key)) + { + base.SelectedIndex[key] = new List(); + } + for (int i = 0; i < values.Count; i++) + { + if (!base.SelectedIndex[key].Contains(values[i])) + { + base.SelectedIndex[key].Add(values[i]); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_reflection.cs b/SVSim.BattleEngine/Engine/NetworkSkill_reflection.cs new file mode 100644 index 0000000..cf9cd8e --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_reflection.cs @@ -0,0 +1,17 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_reflection : Skill_reflection +{ + public NetworkSkill_reflection(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_remove_by_banish.cs b/SVSim.BattleEngine/Engine/NetworkSkill_remove_by_banish.cs new file mode 100644 index 0000000..6d84bcc --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_remove_by_banish.cs @@ -0,0 +1,7 @@ +public class NetworkSkill_remove_by_banish : Skill_remove_by_banish +{ + public NetworkSkill_remove_by_banish(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_remove_by_destroy.cs b/SVSim.BattleEngine/Engine/NetworkSkill_remove_by_destroy.cs new file mode 100644 index 0000000..5f5dc60 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_remove_by_destroy.cs @@ -0,0 +1,17 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_remove_by_destroy : Skill_remove_by_destroy +{ + public NetworkSkill_remove_by_destroy(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_repeat_skill.cs b/SVSim.BattleEngine/Engine/NetworkSkill_repeat_skill.cs new file mode 100644 index 0000000..6b461bf --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_repeat_skill.cs @@ -0,0 +1,17 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +internal class NetworkSkill_repeat_skill : Skill_repeat_skill +{ + public NetworkSkill_repeat_skill(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_return_card.cs b/SVSim.BattleEngine/Engine/NetworkSkill_return_card.cs new file mode 100644 index 0000000..57a41a3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_return_card.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_return_card : Skill_return_card +{ + public NetworkSkill_return_card(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter callParameter) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnSkillReturn(); + return base.Start(callParameter); + } + + protected override void RegisterReturnOtherTriggerSkill(SkillProcessor skillProcessor, List targets) + { + base.RegisterReturnOtherTriggerSkill(skillProcessor, targets); + if (base.SkillPrm.selfBattlePlayer.BattleMgr is NetworkStandardBattleMgr) + { + (base.SkillPrm.selfBattlePlayer.BattleMgr as NetworkStandardBattleMgr).RegisterReturnCardTrigger(base.SkillPrm.selfBattlePlayer, targets.Count); + } + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_rob_skill.cs b/SVSim.BattleEngine/Engine/NetworkSkill_rob_skill.cs new file mode 100644 index 0000000..22dad35 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_rob_skill.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_rob_skill : Skill_rob_skill +{ + public NetworkSkill_rob_skill(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + bool updateAttackEffect = SkillType == "quick" || SkillType == "rush"; + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(new List { base.SkillPrm.ownerCard }, updateAttackEffect); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList(), updateAttackEffect); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_rush.cs b/SVSim.BattleEngine/Engine/NetworkSkill_rush.cs new file mode 100644 index 0000000..f62274d --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_rush.cs @@ -0,0 +1,17 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_rush : Skill_rush +{ + public NetworkSkill_rush(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(_targetCards, updateAttackEffect: true, useRecordAttackEffect: true); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, _targetCards); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_select.cs b/SVSim.BattleEngine/Engine/NetworkSkill_select.cs new file mode 100644 index 0000000..438d112 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_select.cs @@ -0,0 +1,7 @@ +public class NetworkSkill_select : Skill_select +{ + public NetworkSkill_select(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_shield.cs b/SVSim.BattleEngine/Engine/NetworkSkill_shield.cs new file mode 100644 index 0000000..739897b --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_shield.cs @@ -0,0 +1,18 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_shield : Skill_shield +{ + public NetworkSkill_shield(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_shortage_deck_win.cs b/SVSim.BattleEngine/Engine/NetworkSkill_shortage_deck_win.cs new file mode 100644 index 0000000..a10c036 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_shortage_deck_win.cs @@ -0,0 +1,16 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_shortage_deck_win : Skill_shortage_deck_win +{ + public NetworkSkill_shortage_deck_win(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnAttachShortageDeckWin(base.SkillPrm.ownerCard); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_sneak.cs b/SVSim.BattleEngine/Engine/NetworkSkill_sneak.cs new file mode 100644 index 0000000..b3b6bfb --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_sneak.cs @@ -0,0 +1,18 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_sneak : Skill_sneak +{ + public NetworkSkill_sneak(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_special_lose.cs b/SVSim.BattleEngine/Engine/NetworkSkill_special_lose.cs new file mode 100644 index 0000000..06357d1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_special_lose.cs @@ -0,0 +1,20 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_special_lose : Skill_special_lose +{ + public NetworkSkill_special_lose(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading vfxWithLoading = base.Start(parameter); + if (BattleManagerBase.GetIns().IsRecovery) + { + ((NetworkBattleManagerBase)BattleManagerBase.GetIns())._specialWinVfx = vfxWithLoading; + } + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnSpecialLose(base.SkillPrm.ownerCard); + return vfxWithLoading; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_special_win.cs b/SVSim.BattleEngine/Engine/NetworkSkill_special_win.cs new file mode 100644 index 0000000..54ddea6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_special_win.cs @@ -0,0 +1,20 @@ +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_special_win : Skill_special_win +{ + public NetworkSkill_special_win(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading vfxWithLoading = base.Start(parameter); + if (BattleManagerBase.GetIns().IsRecovery) + { + ((NetworkBattleManagerBase)BattleManagerBase.GetIns())._specialWinVfx = vfxWithLoading; + } + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnSpecialWin(base.SkillPrm.ownerCard); + return vfxWithLoading; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_stack_white_ritual.cs b/SVSim.BattleEngine/Engine/NetworkSkill_stack_white_ritual.cs new file mode 100644 index 0000000..9e2fddf --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_stack_white_ritual.cs @@ -0,0 +1,22 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_stack_white_ritual : Skill_stack_white_ritual +{ + public NetworkSkill_stack_white_ritual(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + if (base.SkillPrm.selfBattlePlayer.InPlayCards.Any((BattleCardBase c) => c != base.SkillPrm.ownerCard && c.IsTribe(CardBasePrm.TribeType.WHITE_RITUAL))) + { + base.SkillPrm.selfBattlePlayer.CallOnSkillDestroyOrBanish(base.SkillPrm.ownerCard); + } + VfxWithLoading result = base.Start(parameter); + (base.SkillPrm.selfBattlePlayer.BattleMgr as NetworkBattleManagerBase).RegisterInplayWhiteRitualStack(base.SkillPrm.selfBattlePlayer); + base.SkillPrm.selfBattlePlayer.CallOnChangeWhiteRitualStack(base.SkillPrm.ownerCard, _addCount); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_summon_card.cs b/SVSim.BattleEngine/Engine/NetworkSkill_summon_card.cs new file mode 100644 index 0000000..f3e97b3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_summon_card.cs @@ -0,0 +1,17 @@ +using System.Linq; + +public class NetworkSkill_summon_card : Skill_summon_card +{ + public NetworkSkill_summon_card(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + protected override void CallOnSummonCards() + { + if (_summonedCardsList != null && _summonedCardsList.summonedCards.Count() > 0) + { + base.SkillPrm.selfBattlePlayer.CallOnSummonCards(base.SkillPrm.ownerCard, _summonedCardsList.summonedCards.ToList(), base.SkillPrm.ownerCard.IsPlayer, base.IsDeckSelfSummon, _isIgnoreVoice); + } + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_summon_token.cs b/SVSim.BattleEngine/Engine/NetworkSkill_summon_token.cs new file mode 100644 index 0000000..4c595a3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_summon_token.cs @@ -0,0 +1,18 @@ +using System.Linq; + +public class NetworkSkill_summon_token : Skill_summon_token +{ + public NetworkSkill_summon_token(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + protected override void CallOnSummonTokenCards(bool isOwnerEffect) + { + if (_summonedCardsList != null && (_summonedCardsList.summonedCards.Count() > 0 || _summonedCardsList.overflowCards.Count() > 0)) + { + bool isSelf = ((_summonedCardsList.summonedCards.Count() > 0) ? _summonedCardsList.summonedCards.First().IsPlayer : _summonedCardsList.overflowCards.First().IsPlayer); + _summonPlayer.CallOnSummonTokenCards(base.SkillPrm.ownerCard, _summonedCardsList.summonedCards.ToList(), _summonedCardsList.overflowCards.ToList(), isSelf, isOwnerEffect, _isIgnoreVoice, _isRandomVoice, _isEvoVoice); + } + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_token_draw.cs b/SVSim.BattleEngine/Engine/NetworkSkill_token_draw.cs new file mode 100644 index 0000000..a1638a7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_token_draw.cs @@ -0,0 +1,122 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_token_draw : Skill_token_draw +{ + public List DrawList { get; private set; } + + public NetworkSkill_token_draw(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + DrawList = new List(); + } + + public override VfxWithLoading Start(CallParameter parameter) + { + if (DrawList.Count > 0) + { + List list = new List(); + base.TokenModifierList = new List(); + int i; + for (i = 0; i < DrawList.Count; i++) + { + BattleCardBase battleCardBase = base.SkillPrm.selfBattlePlayer.ReservedCardList.FirstOrDefault((BattleCardBase c) => c.Index == DrawList[i].Index); + if (battleCardBase != null) + { + DrawList[i] = battleCardBase; + base.SkillPrm.selfBattlePlayer.ReservedCardList.Remove(DrawList[i]); + } + list.Add(DrawList[i]); + TokenDrawModifier tokenDrawModifier = _selfBattlePlayer.Class.SkillApplyInformation.GetTokenDrawModifier(DrawList[i].CardId); + if (tokenDrawModifier != null) + { + base.TokenModifierList.Add(DrawList[i].CardId); + for (int num = 0; num < tokenDrawModifier.MultiplyCount - 1; num++) + { + list.Add(CreateToken(DrawList, DrawList[i].CardId, i, isCopy: false)); + } + } + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + for (int num2 = 0; num2 < list.Count; num2++) + { + list[num2].SetOnDraw(draw: true); + } + vfxWithLoadingSequential.RegisterToLoadingVfx(base.SkillPrm.selfBattlePlayer.BattleMgr.LoadCardResources(list)); + return CreateTokenDrawVfx(parameter, list, vfxWithLoadingSequential, _playerSide, isReservation: true); + } + return base.Start(parameter); + } + + protected override VfxWithLoading CreateTokenDrawVfx(CallParameter parameter, List drawList, VfxWithLoadingSequential vfxWithLoading, BattlePlayerBase playerSide, bool isReservation = false) + { + VfxWithLoading result = base.CreateTokenDrawVfx(parameter, drawList, vfxWithLoading, playerSide, isReservation); + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnTokenDraw(base.SkillPrm.ownerCard, drawList, parameter.targetCards.ToList(), playerSide.IsPlayer, IsVisibleTarget, isReservation); + return result; + } + + protected override BattleCardBase CreateTokenCard(BattlePlayerBase player, int id, int index, NetworkBattleDefine.NetworkCardPlaceState toState, bool isCopy = false) + { + BattleManagerBase.CardCreateInfo info = new BattleManagerBase.CardCreateInfo(id, player.IsPlayer, base.ApplyingTargetFilter is SkillTargetChosenCardsFilter, toState, base.IsOpponentHandCopy, this); + return BattleManagerBase.GetIns().CreateBattleCardWithGameObject(info, new BattleManagerBase.IndexInfo(-1, -1, isCopy, index)); + } + + public override bool IsVisibleDrawSkillTarget(BattlePlayerBase selfBattlePlayer, CallParameter parameter) + { + if (!selfBattlePlayer.IsPlayer && !GameMgr.GetIns().IsAdminWatch) + { + if (DrawList.Count <= 0) + { + if (parameter.targetCards.Count() <= 0 || (!(base.ApplyingTargetFilter is SkillTargetHandOtherSelfFilter) && !(base.ApplyingTargetFilter is SkillTargetHandFilter) && !(base.ApplyingTargetFilter is SkillTargetDeckFilter) && !(base.ApplyingTargetFilter is SkillTargetChosenCardsFilter) && !(base.ApplyingTargetFilter is SkillTargetDiscardThisTurnCardListFilter) && !IsTargetHandOtherSelfFilter())) + { + return !IsHaveApplicableTargetFilter(); + } + return false; + } + return false; + } + return true; + } + + public void CreateTokenCardAttachTiming(IEnumerable targetCards) + { + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(base.SkillPrm.selfBattlePlayer, base.SkillPrm.opponentBattlePlayer); + SkillCollectionBase.SetupOptionValue(base.OptionValue, playerInfoPair, base.SkillPrm.ownerCard, this); + if (!CreateTokenInfo(targetCards, isReserve: true)) + { + return; + } + List list = new List(); + for (int i = 0; i < _tokenIds.Count(); i++) + { + BattleCardBase battleCardBase = CreateToken(targetCards.ToList(), _tokenIds.ElementAt(i), i, isCopy: true); + DrawList.Add(battleCardBase); + base.SkillPrm.selfBattlePlayer.ReservedCardList.Add(battleCardBase); + list.Add(battleCardBase); + BuffInfo buffInfo = base.SkillPrm.selfBattlePlayer.Class.BuffInfoList.LastOrDefault((BuffInfo b) => b.SkillFrom == this); + if (buffInfo != null) + { + buffInfo.TargetCard = battleCardBase; + } + } + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnCreateReservedCards(base.SkillPrm.ownerCard, list, base.SkillPrm.ownerCard.IsPlayer); + } + + private BattleCardBase CreateToken(List targetCards, int tokenId, int index, bool isCopy) + { + int id = tokenId; + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(tokenId); + if (IsMakeFoil) + { + id = cardParameterFromId.FoilCardId; + } + int index2 = -1; + if (targetCards.Count() > 0) + { + index2 = ((targetCards.Count() < _tokenIds.Count()) ? targetCards.First().Index : targetCards.ElementAt(index).Index); + } + return CreateTokenCard(_playerSide, id, index2, NetworkBattleDefine.NetworkCardPlaceState.Reservation, isCopy); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_trigger.cs b/SVSim.BattleEngine/Engine/NetworkSkill_trigger.cs new file mode 100644 index 0000000..5afa1d5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_trigger.cs @@ -0,0 +1,17 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_trigger : Skill_trigger +{ + public NetworkSkill_trigger(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_unite.cs b/SVSim.BattleEngine/Engine/NetworkSkill_unite.cs new file mode 100644 index 0000000..b468b7a --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_unite.cs @@ -0,0 +1,15 @@ +public class NetworkSkill_unite : Skill_unite +{ + public NetworkSkill_unite(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + protected override void CallOnUnite() + { + if (_uniteCardPair != null) + { + base.SkillPrm.selfBattlePlayer.CallOnUnite(base.SkillPrm.ownerCard, _uniteCardPair._materialCards, _uniteCardPair._uniteCards[0]); + } + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_untouchable.cs b/SVSim.BattleEngine/Engine/NetworkSkill_untouchable.cs new file mode 100644 index 0000000..ddc617d --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_untouchable.cs @@ -0,0 +1,18 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NetworkSkill_untouchable : Skill_untouchable +{ + public NetworkSkill_untouchable(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnShowSkillEffect(base.SkillPrm.ownerCard, parameter.targetCards.ToList()); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnUpdateSkillEffect(parameter.targetCards.ToList()); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkSkill_update_deck.cs b/SVSim.BattleEngine/Engine/NetworkSkill_update_deck.cs new file mode 100644 index 0000000..055e40b --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkSkill_update_deck.cs @@ -0,0 +1,44 @@ +using System.Linq; + +public class NetworkSkill_update_deck : Skill_update_deck +{ + private const int ADD_DECK_TRIGGER = 1; + + public NetworkSkill_update_deck(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + protected override BattleCardBase CreateTokenCard(CallParameter parameter, int tokenId, int repeatCount, int tokenIdIndex, BattlePlayerBase targetPlayer) + { + if (BattleManagerBase.IsForecast) + { + return targetPlayer.CreateNextIndexCard(tokenId); + } + int targetIndex = -1; + if (_updateType != "change" && _isUsingTargetCards && repeatCount == -1 && !(base.ApplyingTargetFilter is SkillTargetChosenCardsFilter)) + { + targetIndex = parameter.targetCards.ToList()[tokenIdIndex].Index; + } + int copySelectIndex = -1; + if (_isUsingTargetCards) + { + copySelectIndex = parameter.targetCards.First().Index; + } + bool skillCopy = false; + if (_isUsingTargetCards && (base.ApplyingTargetFilter is SkillTargetHandOtherSelfFilter || base.ApplyingTargetFilter is SkillTargetHandFilter || base.ApplyingTargetFilter is SkillTargetDeckFilter || base.ApplyingTargetFilter is SkillTargetLastTargetFilter)) + { + skillCopy = true; + } + if (!_isReferenceOpponentCard && !_isReferenceFusionedCard && _isUsingTargetCards && !base.IsOpen && (GameMgr.GetIns().IsWatchBattle || !targetPlayer.IsPlayer)) + { + CardDataModel cardDataModel = (targetPlayer.BattleMgr as NetworkBattleManagerBase).networkBattleData.GetReceiveData().GetReceiveCardList().FirstOrDefault((CardDataModel c) => c.CardId > 0 && c.Index == targetPlayer.cardTotalNum && c.ToStateList.Any((NetworkBattleDefine.NetworkCardPlaceState s) => s == NetworkBattleDefine.NetworkCardPlaceState.Field) && (!GameMgr.GetIns().IsWatchBattle || c.isOpponent != targetPlayer.IsPlayer)); + if (cardDataModel != null) + { + tokenId = cardDataModel.CardId; + } + } + BattleManagerBase.CardCreateInfo info = new BattleManagerBase.CardCreateInfo(tokenId, targetPlayer.IsPlayer, base.IsTargetChoiceSelectSkill, NetworkBattleDefine.NetworkCardPlaceState.Deck, _isReferenceOpponentCard, this); + return BattleManagerBase.GetIns().CreateBattleCardWithGameObject(info, new BattleManagerBase.IndexInfo(-1, targetIndex, skillCopy, copySelectIndex), repeatCount, _updateType == "change"); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkStandardBattleMgr.cs b/SVSim.BattleEngine/Engine/NetworkStandardBattleMgr.cs new file mode 100644 index 0000000..a984f1e --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkStandardBattleMgr.cs @@ -0,0 +1,485 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard; +using Wizard.Battle.Phase; +using Wizard.Battle.View.Vfx; +using Wizard.BattleMgr; + +public class NetworkStandardBattleMgr : NetworkBattleManagerBase +{ + public int[] beforeRevengeCount = new int[2]; + + public int[] beforeAvariceCount = new int[2]; + + public int[] beforeWrathCount = new int[2]; + + private bool _isEmitTurnEndFinal; + + public BattleFinishToOpponentDisConnectChecker battleFinishToOpponentDisConnectChecker { get; private set; } + + public BattleStopChecker battleStopChecker { get; private set; } + + public NetworkStandardBattleMgr(IBattleMgrContentsCreator contentsCreator) + : base(contentsCreator) + { + if (!base.IsRecovery) + { + LocalLog.SetLastTraceLogTurn(0); + } + else + { + LocalLog.SendLastTraceLog(null); + } + battleFinishToOpponentDisConnectChecker = new BattleFinishToOpponentDisConnectChecker(this); + _intervalCheckList.Add(battleFinishToOpponentDisConnectChecker); + battleFinishToOpponentDisConnectChecker.OnDisConnectWin += delegate + { + OppoDisconnectVictory(); + }; + battleStopChecker = new BattleStopChecker(); + _intervalCheckList.Add(battleStopChecker); + base.opponentRecoveryToDispChecker.OnDisp += delegate + { + DispOpponentRecovery(flag: true); + }; + base.opponentRecoveryToDispChecker.OnErase += delegate + { + DispOpponentRecovery(flag: false); + }; + base.disconnectToLoseChecker.OnDisconnectLose += delegate + { + DisconnectLose(); + }; + base.disconnectToLoseChecker.OnBeforeDisconnectLose += delegate + { + BeforeDisconnectLose(); + }; + base.disconnectToLoseChecker.OnDisconnectCheck += delegate + { + ServerSendDisconnectCheck(); + }; + base.opponentNotTurnStartToWinChecker.OnOpponentNotTurnStartToWin += delegate + { + OpponentNotTurnStartVictory(); + }; + base.opponentNotTurnEndToWinChecker.OnOpponentNotTurnEndToWin += delegate + { + OpponentNotTurnEndVictory(); + }; + base.notMulliganEndToJudgeChecker.OnNotMulliganEndJudge += delegate + { + NotMulliganToJudge(); + }; + base.notTurnEndToLoseChecker.OnNotTurnEndToLose += delegate + { + TurnEndLose(); + }; + base.notTurnStartToLoseChecker.OnNotTurnStartToLose += delegate + { + TurnStartLose(); + }; + base.judgeResultFailedToRetryChecker.OnRetry += delegate + { + FinishBattleSend(NetworkBattleSender.JUDGE_RESULT_STATUS.FailedToRetryJudgeResult); + }; + battleStopChecker.OnBattleStop += delegate + { + FinishBattleSend(NetworkBattleSender.JUDGE_RESULT_STATUS.BattleStopToJudgeResult, isWin: false, isNotRetry: true); + }; + base.NetworkSender = new NetworkBattleSender(this, RegisterActionManager, base.RegisterUnapprovedList, networkConsistency); + receiveIntervalTrigger = new ReceiveIntervalTriggerStandard(); + SendIntervalTriggerMain = new SendIntervalTriggerStandard(); + Screen.sleepTimeout = -1; + } + + public override void SettingOpponentAliveEvent() + { + base.SettingOpponentAliveEvent(); + NetworkStatus opponentNetworkStatus = ToolboxGame.RealTimeNetworkAgent.OpponentNetworkStatus; + opponentNetworkStatus.OnOffLine = (Action)Delegate.Combine(opponentNetworkStatus.OnOffLine, new Action(base.OppoDisconnectVictory)); + NetworkStatus opponentNetworkStatus2 = ToolboxGame.RealTimeNetworkAgent.OpponentNetworkStatus; + opponentNetworkStatus2.OnTimeOut = (Action)Delegate.Combine(opponentNetworkStatus2.OnTimeOut, new Action(base.OppoDisconnectVictory)); + } + + protected override void SendTurnStart() + { + if (!base.IsRecovery && !IsVirtualBattle) + { + base.NetworkSender.SendTurnStart(); + } + } + + protected override void SendTurnEndAction() + { + if (!base.IsRecovery && !(ToolboxGame.RealTimeNetworkAgent == null) && !IsVirtualBattle) + { + base.NetworkSender.SendTurnEndAction(); + if (!IsBattleGameFinishStatus()) + { + RealTimeNetworkAgent realTimeNetworkAgent = ToolboxGame.RealTimeNetworkAgent; + realTimeNetworkAgent.OnAck = (Action>)Delegate.Combine(realTimeNetworkAgent.OnAck, new Action>(AckEmitTurnEndAction)); + } + } + } + + public override void SendTurnEnd() + { + if (!base.IsRecovery && !(ToolboxGame.RealTimeNetworkAgent == null) && !IsVirtualBattle) + { + bool isNextTurnTimeDecrement = false; + bool isNowTurnTimeDecrement = false; + if (turnEndTimeController != null) + { + isNextTurnTimeDecrement = turnEndTimeController.IsNextTurnTimeDecrement; + isNowTurnTimeDecrement = turnEndTimeController.IsNowTurnTimeDecrement; + } + base.NetworkSender.SendTurnEnd(isNextTurnTimeDecrement, isNowTurnTimeDecrement, final: false); + } + } + + protected override void SendChatStamp(ClassCharaPrm.EmotionType emoteType) + { + if (!base.IsRecovery) + { + NetworkBattleSender networkSender = base.NetworkSender; + int num = (int)emoteType; + networkSender.SendChatStamp(num.ToString()); + } + } + + protected override void SendPlayCard(BattleCardBase playCard, List playSelectCard, SendKeyActionDataManager sendKeyActionDataManager) + { + if (!base.IsRecovery && !IsVirtualBattle) + { + base.NetworkSender.SendPlayCard(playCard, playSelectCard, base.validateSkillIndexList, sendKeyActionDataManager, base.registerSelectTypeSkillIndexList); + } + } + + protected override void SendAttackData(BattleCardBase attackCard, BattleCardBase targetCard) + { + if (!base.IsRecovery && !IsVirtualBattle) + { + base.NetworkSender.SendAtkData(attackCard, targetCard); + } + } + + protected override void SendEvolveData(BattleCardBase playCard, List playSelectCard, SendKeyActionDataManager sendKeyActionDataManager) + { + if (!base.IsRecovery && !IsVirtualBattle) + { + base.NetworkSender.SendEvolData(playCard, playSelectCard, base.validateSkillIndexList, sendKeyActionDataManager, base.registerSelectTypeSkillIndexList); + } + } + + protected override void SendFusionData(BattleCardBase playCard, List playSelectCard, SendKeyActionDataManager sendKeyActionDataManager) + { + if (!base.IsRecovery && !IsVirtualBattle) + { + base.NetworkSender.SendFusionData(playCard, playSelectCard, sendKeyActionDataManager, base.registerSelectTypeSkillIndexList); + } + } + + public void SendRetire() + { + if (!base.IsRecovery) + { + base.NetworkSender.SendRetire(); + } + } + + protected override void SendJudgement() + { + if (!base.IsRecovery && !BattlePlayer.IsSelfTurn) + { + base.NetworkSender.SendJudge(); + } + } + + public override void SendEcho(int playIndex, NetworkBattleDefine.PlayActionType actionType, bool isNotActiveSeq = false, bool isTurnStart = false) + { + if (!base.IsRecovery) + { + base.NetworkSender.SendEcho(playIndex, actionType, sendKeyActionDataManager, isNotActiveSeq, isTurnStart); + } + } + + protected override void SetupNetworkEvent(bool isRecovery) + { + base.SetupNetworkEvent(isRecovery); + BattlePlayer.OnPlayerActive += delegate + { + if (turnEndTimeController != null) + { + turnEndTimeController.StartCountDown("OnPlayerActive"); + } + }; + BattlePlayer battlePlayer = BattlePlayer; + battlePlayer.OnPostTurnEndComplete = (Action)Delegate.Combine(battlePlayer.OnPostTurnEndComplete, (Action)delegate + { + if (turnEndTimeController != null) + { + turnEndTimeController.EndCountDown("OnTurnEndComplete"); + } + SendTurnEndAction(); + }); + } + + public override VfxBase ChangePhase(IPhase phase) + { + if (phase is NetworkMulliganPhase) + { + base.notMulliganEndToJudgeChecker.StartChecker(); + base.disconnectToDispChecker.OnDisp += delegate + { + ControlDisconnectOffTouchAndView(flag: true); + }; + base.disconnectToDispChecker.OnErase += delegate + { + ControlDisconnectOffTouchAndView(flag: false); + }; + } + return base.ChangePhase(phase); + } + + private void ServerSendDisconnectCheck() + { + FinishBattleSend(NetworkBattleSender.JUDGE_RESULT_STATUS.ServerSendDisconnectCheck); + } + + public override void PlayRetire() + { + if (JudgeResultReceiveCode == NetworkBattleReceiver.RESULT_CODE.NotFinish && !_isSendSpecialWin) + { + base.IsPlayerRetire = true; + SendRetire(); + } + } + + protected override void DelayLoadCompleteOpponentResources() + { + base.DelayLoadCompleteOpponentResources(); + SetupNetworkBattlePlayersEvent(); + } + + public override VfxBase JudgeBattleResult() + { + if (!BattlePlayer.IsSelfTurn && JudgeCurrentFinishStatus() != NetworkBattleReceiver.RESULT_CODE.NotFinish) + { + battleFinishToOpponentDisConnectChecker.StartChecker("JudgeBattleResult"); + } + return base.JudgeBattleResult(); + } + + public override void SendFinishBattleTask() + { + base.NetworkSender.SetEmitStopOutsideJudgeResult(); + base.SendFinishBattleTask(); + } + + protected override void AckEmitBattleFinish(Dictionary objs) + { + battleFinishToOpponentDisConnectChecker.StartChecker("AckEmitBattleFinish"); + base.AckEmitBattleFinish(objs); + } + + private void SetupNetworkBattlePlayersEvent() + { + SetupBattlePlayerEvent(BattlePlayer); + SetupBattlePlayerEvent(BattleEnemy); + } + + private void SetupBattlePlayerEvent(BattlePlayerBase battlePlayerBase) + { + BattlePlayerBase enemy = battlePlayerBase.Class.OpponentBattlePlayer; + ((ClassSkillApplyInformation)battlePlayerBase.Class.SkillApplyInformation).OnLifeChange += delegate(RegisterActionBase.ActionBaseParameter param, ClassSkillApplyInformation.LifeInfomation lifeInfo) + { + if (param != RegisterActionBase.ActionBaseParameter.set || lifeInfo.MaxLife < lifeInfo.BeforeLife) + { + if (param == RegisterActionBase.ActionBaseParameter.set && lifeInfo.MaxLife < lifeInfo.BeforeLife) + { + RegisterActionManager.Add(new RegisterPlayerParameter(param, lifeInfo.MaxLife, battlePlayerBase.Class.IsPlayer)); + } + else + { + RegisterActionManager.Add(new RegisterPlayerParameter(param, lifeInfo.Life - lifeInfo.BeforeLife, battlePlayerBase.Class.IsPlayer)); + } + if (battlePlayerBase.Class.SkillApplyInformation.ForceBerserkCount == 0) + { + if (!SkillConditionHalfLife.IsHalfLife(lifeInfo.BeforeLife) && SkillConditionHalfLife.IsHalfLife(lifeInfo.Life)) + { + RegisterRevengeTrigger(battlePlayerBase, 1); + } + else if (SkillConditionHalfLife.IsHalfLife(lifeInfo.BeforeLife) && !SkillConditionHalfLife.IsHalfLife(lifeInfo.Life)) + { + RegisterRevengeTrigger(battlePlayerBase, 0); + } + } + } + }; + ((ClassSkillApplyInformation)battlePlayerBase.Class.SkillApplyInformation).OnPpChange += delegate(RegisterActionBase.ActionBaseParameter param, ClassSkillApplyInformation.PpModifyInformation ppInfo) + { + RegisterActionManager.Add(new RegisterPlayerParameter(param, ppInfo.AddPpValue, battlePlayerBase.Class.IsPlayer)); + }; + battlePlayerBase.OnChangeDeckAfterEvent += delegate(int previousCount, SkillProcessor skillProcessor, List summonCards) + { + if (previousCount % 2 == 1 && battlePlayerBase.DeckCardList.Count % 2 == 0) + { + RegisterResonanceTrigger(battlePlayerBase, 1); + } + else if (previousCount % 2 == 0 && battlePlayerBase.DeckCardList.Count % 2 == 1) + { + RegisterResonanceTrigger(battlePlayerBase, 0); + } + }; + battlePlayerBase.OnDrawCards += delegate(int beforeTurnDrawCardsCount, int turnDrawCardsCount, List drawCards, BattlePlayerBase player, bool isOpen) + { + if (player.Class.SkillApplyInformation.ForceAvariceCount == 0 && !SkillConditionAvarice.IsAvarice(beforeTurnDrawCardsCount) && SkillConditionAvarice.IsAvarice(turnDrawCardsCount)) + { + RegisterAvariceTrigger(player, 1); + } + }; + battlePlayerBase.OnTurnEndStart += delegate + { + SettingTurnEndRestore(battlePlayerBase); + RegisterMaxAtkTrigger(battlePlayerBase); + }; + battlePlayerBase.OnTurnStartBeforeDraw += delegate + { + SettingTurnStartRestore(battlePlayerBase); + RegisterBeforeTurnDamageFromUnit(battlePlayerBase.IsSelfTurn ? enemy : battlePlayerBase); + return NullVfx.GetInstance(); + }; + BattlePlayerBase battlePlayerBase2 = battlePlayerBase; + battlePlayerBase2.OnTurnEndSkillAfter = (Func)Delegate.Combine(battlePlayerBase2.OnTurnEndSkillAfter, (Func)delegate + { + if (battlePlayerBase.Class.SkillApplyInformation.ForceAvariceCount == 0 && SkillConditionAvarice.IsAvarice(battlePlayerBase.TurnDrawCards.Count)) + { + RegisterAvariceTrigger(battlePlayerBase, 0); + } + if (enemy.Class.SkillApplyInformation.ForceAvariceCount == 0 && SkillConditionAvarice.IsAvarice(enemy.TurnDrawCards.Count)) + { + RegisterAvariceTrigger(enemy, 0); + } + return NullVfx.GetInstance(); + }); + } + + private IEnumerator WaitToSendTurnEnd() + { + yield return new WaitForSeconds(0.5f); + SendTurnEnd(); + } + + private void AckEmitTurnEndAction(Dictionary objs) + { + RealTimeNetworkAgent realTimeNetworkAgent = ToolboxGame.RealTimeNetworkAgent; + realTimeNetworkAgent.OnAck = (Action>)Delegate.Remove(realTimeNetworkAgent.OnAck, new Action>(AckEmitTurnEndAction)); + BattleCoroutine.GetInstance().StartCoroutine(WaitToSendTurnEnd()); + } + + private void NotMulliganToJudge() + { + if (IsSendSwap) + { + OpponentNotMulliganEndVictory(); + } + else + { + MulliganLose(); + } + } + + private void MulliganLose() + { + FinishBattleSend(NetworkBattleSender.JUDGE_RESULT_STATUS.MulliganLose); + } + + protected override void DisconnectLose() + { + FinishBattleSend(NetworkBattleSender.JUDGE_RESULT_STATUS.DisconnectLose); + } + + private void TurnEndLose() + { + FinishBattleSend(NetworkBattleSender.JUDGE_RESULT_STATUS.TurnEndLose); + } + + private void TurnStartLose() + { + FinishBattleSend(NetworkBattleSender.JUDGE_RESULT_STATUS.TurnStartLose); + } + + public void RegisterRevengeTrigger(BattlePlayerBase player, int isRevenge) + { + RegisterEnhanceTrigger registerEnhanceTrigger = new RegisterEnhanceTrigger(player); + registerEnhanceTrigger.SettingRevenge(isRevenge); + RegisterActionManager.Add(registerEnhanceTrigger); + } + + public void RegisterResonanceTrigger(BattlePlayerBase player, int isResonance) + { + RegisterEnhanceTrigger registerEnhanceTrigger = new RegisterEnhanceTrigger(player); + registerEnhanceTrigger.SettingResonance(isResonance); + RegisterActionManager.Add(registerEnhanceTrigger); + } + + public void RegisterAvariceTrigger(BattlePlayerBase player, int isAvarice) + { + RegisterEnhanceTrigger registerEnhanceTrigger = new RegisterEnhanceTrigger(player); + registerEnhanceTrigger.SettingAvarice(isAvarice); + RegisterActionManager.Add(registerEnhanceTrigger); + } + + public void RegisterReturnCardTrigger(BattlePlayerBase player, int returnCard) + { + RegisterEnhanceTrigger registerEnhanceTrigger = new RegisterEnhanceTrigger(player); + registerEnhanceTrigger.SettingReturnCard(returnCard); + RegisterActionManager.Add(registerEnhanceTrigger); + } + + public void RegisterUseEpTrigger(BattlePlayerBase player) + { + RegisterEnhanceTrigger registerEnhanceTrigger = new RegisterEnhanceTrigger(player); + registerEnhanceTrigger.SettingUseEp(); + RegisterActionManager.Add(registerEnhanceTrigger); + } + + public void RegisterMaxAtkTrigger(BattlePlayerBase player) + { + RegisterEnhanceTrigger registerEnhanceTrigger = new RegisterEnhanceTrigger(player); + int maxAtk = (from c in player.InPlayCards + where c.IsUnit + select c.Atk).DefaultIfEmpty().Max(); + registerEnhanceTrigger.SettingMaxAtk(maxAtk); + RegisterActionManager.Add(registerEnhanceTrigger); + } + + public void RegisterBeforeTurnDamageFromUnit(BattlePlayerBase player) + { + RegisterEnhanceTrigger registerEnhanceTrigger = new RegisterEnhanceTrigger(player); + int specificTurnCausedDamageValue = player.Class.SkillApplyInformation.GetSpecificTurnCausedDamageValue(player.Class, new TurnPlayerInfo(SkillFilterCreator.ContentKeyword.me.ToStringCustom(), 0)); + registerEnhanceTrigger.SettingBeforeTurnDamageFromUnit(specificTurnCausedDamageValue); + RegisterActionManager.Add(registerEnhanceTrigger); + } + + public override void BattleFinishToTurnEndFinal(bool isSelfTurn) + { + if (isSelfTurn && !_isEmitTurnEndFinal) + { + _isEmitTurnEndFinal = true; + base.NetworkSender.SendTurnEndFinish(); + } + base.BattleFinishToTurnEndFinal(isSelfTurn); + } + + protected override void ControlDisconnectOffTouchAndView(bool flag) + { + if (!battleFinishToOpponentDisConnectChecker.IsStart) + { + base.ControlDisconnectOffTouchAndView(flag); + } + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkStatus.cs b/SVSim.BattleEngine/Engine/NetworkStatus.cs new file mode 100644 index 0000000..9bc9f05 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkStatus.cs @@ -0,0 +1,63 @@ +using System; +using Cute; + +public class NetworkStatus : IDisposable +{ + public enum Status + { + None, + Alive, + Disconnect, + OffLine, + TimeOut + } + + public Action OnAlive; + + public Action OnDisconnect; + + public Action OnOffLine; + + public Action OnTimeOut; + + public Status Current { get; private set; } + + public bool IsAlive => Current == Status.Alive; + + public NetworkStatus() + { + Current = Status.None; + } + + public void ToKeepAlive() + { + OnAlive.Call(); + Current = Status.Alive; + } + + public void ToDisconnect() + { + OnDisconnect.Call(); + Current = Status.Disconnect; + } + + public void ToOffLine() + { + OnOffLine.Call(); + Current = Status.OffLine; + } + + public void ToTimeOut() + { + OnTimeOut.Call(); + Current = Status.TimeOut; + } + + public void Dispose() + { + OnAlive = null; + OnDisconnect = null; + OnOffLine = null; + OnTimeOut = null; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkUserInfoData.cs b/SVSim.BattleEngine/Engine/NetworkUserInfoData.cs new file mode 100644 index 0000000..9d113e7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkUserInfoData.cs @@ -0,0 +1,532 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; + +public class NetworkUserInfoData +{ + public class NetworkUserInfo + { + public int Rank { get; private set; } + + public bool IsMasterRank { get; private set; } + + public int BattlePoint { get; private set; } + + public int MasterPoint { get; private set; } + + public int ClassId { get; private set; } + + public int SubClassId { get; private set; } = 10; + + public int CharaId { get; private set; } + + public string MyRotationId { get; private set; } = ""; + + public string AvatarBattleId { get; private set; } = ""; + + public void SetParameter(Dictionary info) + { + Rank = Convert.ToInt32(info["rank"]); + IsMasterRank = info.ContainsKey("isMasterRank") && Convert.ToInt32(info["isMasterRank"]) != 0; + BattlePoint = (info.ContainsKey("battlePoint") ? Convert.ToInt32(info["battlePoint"]) : 0); + MasterPoint = (info.ContainsKey("masterPoint") ? Convert.ToInt32(info["masterPoint"]) : 0); + ClassId = Convert.ToInt32(info["classId"]); + if (info.ContainsKey("subclassId")) + { + SubClassId = Convert.ToInt32(info["subclassId"]); + } + CharaId = Convert.ToInt32(info["charaId"]); + if (info.ContainsKey("rotationId")) + { + MyRotationId = Convert.ToString(info["rotationId"]); + } + AvatarBattleId = info["charaId"].ToString(); + } + } + + private Dictionary _selfInfo = new Dictionary(); + + private Dictionary _oppoInfo = new Dictionary(); + + private List _selfDeck; + + private List _oppoDeck; + + public const int DUMMY_CARD_ID = 100011010; + + public const string KEY_IS_OFFICIAL_USER = "isOfficial"; + + private const string KEY_OPPO_DECK_COUNT = "oppoDeckCount"; + + public const string KEY_DECK_COUNT = "deckCount"; + + public int TurnState { get; set; } + + public NetworkUserInfo SelfBattleStartInfo { get; private set; } + + public NetworkUserInfo OppoBattleStartInfo { get; private set; } + + public List _selfFirstCards { get; set; } + + public List _oppoFirstCards { get; set; } + + public NetworkUserInfoData() + { + TurnState = -1; + } + + public void InitializeSelfInfo() + { + SelfBattleStartInfo = null; + _selfDeck = null; + } + + public void SetSelfInfo(Dictionary info, bool isWatchReplayRecovery) + { + _selfInfo = info; + if (isWatchReplayRecovery) + { + SetNetworkSelfInfo(info); + } + if (_selfInfo != null && _selfInfo.ContainsKey("seed")) + { + LocalLog.AccumulateLastTraceLog("SetSelfInfo seed" + Convert.ToInt32(_selfInfo["seed"])); + } + } + + public void SetNetworkSelfInfo(Dictionary info) + { + if (SelfBattleStartInfo == null) + { + SelfBattleStartInfo = new NetworkUserInfo(); + } + SelfBattleStartInfo.SetParameter(info); + GameMgr.GetIns().GetDataMgr().SetPlayerCharaId(GetSelfCharaId()); + GameMgr.GetIns().GetDataMgr().SetPlayerSubClassID(GetSelfSubClassId()); + GameMgr.GetIns().GetDataMgr().SetPlayerMyRotationInfo(GetSelfMyRotationId()); + GameMgr.GetIns().GetDataMgr().SetPlayerAvatarBattleInfo(GetSelfAvatarBattleId()); + Data.RoomTwoPickBeforeBattleInfo.ReceiveBackDraftCharaId(GetSelfCharaId()); + if (_selfInfo != null && _selfInfo.ContainsKey("seed")) + { + LocalLog.AccumulateLastTraceLog("SetNetworkSelfInfo seed" + Convert.ToInt32(_selfInfo["seed"])); + } + } + + private int GetDeckMaxNum(bool isSelf) + { + if (isSelf && _selfInfo.ContainsKey("deckCount")) + { + return Convert.ToInt32(_selfInfo["deckCount"]); + } + if (!isSelf && _oppoInfo.ContainsKey("deckCount")) + { + return Convert.ToInt32(_oppoInfo["deckCount"]); + } + return GameMgr.GetIns().GetDataMgr().GetDeckMaxCount(isSelf); + } + + public void SetSelfDeck(List deckDatas) + { + if (GameMgr.GetIns().IsReplayBattle || !GameMgr.GetIns().IsWatchBattle) + { + int deckMaxNum = GetDeckMaxNum(isSelf: true); + _selfDeck = new List(deckMaxNum); + List list = new List(); + for (int i = 0; i < deckMaxNum; i++) + { + CardDataModel cardDataModel = new CardDataModel(); + Dictionary dictionary = deckDatas[i] as Dictionary; + cardDataModel.Index = Convert.ToInt32(dictionary[NetworkBattleDefine.NetworkParameter.idx.ToString()]); + cardDataModel.CardId = Convert.ToInt32(dictionary[NetworkBattleDefine.NetworkParameter.cardId.ToString()]); + _selfDeck.Add(cardDataModel); + list.Add(cardDataModel.CardId); + } + Data.RoomTwoPickBeforeBattleInfo.ReceiveBackDraftCardIdList(list); + } + } + + public void SetOppoDeck(List deckDatas) + { + int deckMaxNum = GetDeckMaxNum(isSelf: false); + _oppoDeck = new List(deckMaxNum); + for (int i = 0; i < deckMaxNum; i++) + { + CardDataModel cardDataModel = new CardDataModel(); + Dictionary dictionary = deckDatas[i] as Dictionary; + cardDataModel.Index = Convert.ToInt32(dictionary[NetworkBattleDefine.NetworkParameter.idx.ToString()]); + cardDataModel.CardId = Convert.ToInt32(dictionary[NetworkBattleDefine.NetworkParameter.cardId.ToString()]); + _oppoDeck.Add(cardDataModel); + } + } + + public void SetOpponentInfo(Dictionary info, bool isWatchReplayRecovery) + { + OppoBattleStartInfo = null; + if (!GameMgr.GetIns().IsWatchBattle && !GameMgr.GetIns().IsReplayBattle) + { + _oppoDeck = null; + } + _oppoInfo = info; + if (isWatchReplayRecovery) + { + SetOpponentNetworkInfo(info); + } + if (_oppoInfo.Keys.Contains("oppoDeckCount")) + { + GameMgr.GetIns().GetDataMgr().SetDeckMaxCount(Convert.ToInt32(_oppoInfo["oppoDeckCount"]), isSelf: false); + } + } + + public void SetOpponentNetworkInfo(Dictionary info) + { + OppoBattleStartInfo = new NetworkUserInfo(); + OppoBattleStartInfo.SetParameter(info); + } + + public int GetFieldId() + { + return Convert.ToInt32(_selfInfo["fieldId"]); + } + + public int GetRandomSeed() + { + if (_selfInfo == null || !_selfInfo.ContainsKey("seed")) + { + string text = "NotSeed "; + text = text + ((_selfInfo == null) ? "infoNull" : "noneKey") + " "; + if (_selfInfo != null) + { + foreach (KeyValuePair item in _selfInfo) + { + text = text + item.Key + ":" + item.Value?.ToString() + " "; + } + } + LocalLog.AccumulateLastTraceLog(text); + return 0; + } + return Convert.ToInt32(_selfInfo["seed"]); + } + + public int GetSelfViewerId() + { + return Convert.ToInt32(_selfInfo["viewerId"]); + } + + public string GetSelfName() + { + return _selfInfo["userName"].ToString(); + } + + public int GetSelfBattlePoint() + { + if (SelfBattleStartInfo == null) + { + return 0; + } + return SelfBattleStartInfo.BattlePoint; + } + + public int GetSelfMasterPoint() + { + if (SelfBattleStartInfo == null) + { + return 0; + } + return SelfBattleStartInfo.MasterPoint; + } + + public int GetSelfClassId() + { + if (SelfBattleStartInfo == null) + { + return 0; + } + return SelfBattleStartInfo.ClassId; + } + + public int GetSelfSubClassId() + { + if (SelfBattleStartInfo == null) + { + return 0; + } + return SelfBattleStartInfo.SubClassId; + } + + public int GetSelfCharaId() + { + if (SelfBattleStartInfo == null) + { + return 0; + } + return SelfBattleStartInfo.CharaId; + } + + public string GetSelfMyRotationId() + { + if (SelfBattleStartInfo == null) + { + return ""; + } + return SelfBattleStartInfo.MyRotationId; + } + + public string GetSelfAvatarBattleId() + { + if (SelfBattleStartInfo == null) + { + return ""; + } + return SelfBattleStartInfo.AvatarBattleId; + } + + public long GetSelfSleeveId() + { + return Convert.ToInt64(_selfInfo["sleeveId"]); + } + + public long GetSelfEmblemId() + { + return Convert.ToInt64(_selfInfo["emblemId"]); + } + + public int GetSelfDegreeId() + { + return Convert.ToInt32(_selfInfo["degreeId"]); + } + + public int GetSelfRank() + { + if (SelfBattleStartInfo == null) + { + return 0; + } + return SelfBattleStartInfo.Rank; + } + + public string GetSelfCountryCode() + { + return _selfInfo["country_code"].ToString(); + } + + public bool GetSelfIsOfficialUser() + { + return Convert.ToBoolean(_selfInfo["isOfficial"]); + } + + public int GetSelfChaosId() + { + if (!GameMgr.GetIns().IsNetworkBattle && !GameMgr.GetIns().IsReplayBattle) + { + return -1; + } + if (_selfInfo.ContainsKey("chaosId")) + { + return Convert.ToInt32(_selfInfo["chaosId"]); + } + return -1; + } + + public string GetOpponentName() + { + return _oppoInfo["userName"].ToString(); + } + + public int GetOpponentBattlePoint() + { + if (OppoBattleStartInfo == null) + { + return 0; + } + return OppoBattleStartInfo.BattlePoint; + } + + public int GetOpponentMasterPoint() + { + if (OppoBattleStartInfo == null) + { + return 0; + } + return OppoBattleStartInfo.MasterPoint; + } + + public int GetOpponentClassId() + { + if (OppoBattleStartInfo == null) + { + return 0; + } + return OppoBattleStartInfo.ClassId; + } + + public int GetOpponentSubClassId() + { + if (OppoBattleStartInfo == null) + { + return 10; + } + return OppoBattleStartInfo.SubClassId; + } + + public int GetOpponentCharaId() + { + if (OppoBattleStartInfo == null) + { + return 0; + } + return OppoBattleStartInfo.CharaId; + } + + public string GetOpponentMyRotationId() + { + if (OppoBattleStartInfo == null) + { + return ""; + } + return OppoBattleStartInfo.MyRotationId; + } + + public string GetOpponentAvatarBattleId() + { + if (SelfBattleStartInfo == null) + { + return ""; + } + return OppoBattleStartInfo.AvatarBattleId; + } + + public long GetOpponentSleeveId() + { + return Convert.ToInt64(_oppoInfo["sleeveId"]); + } + + public long GetOpponentEmblemId() + { + return Convert.ToInt64(_oppoInfo["emblemId"]); + } + + public int GetOpponentDegreeId() + { + return Convert.ToInt32(_oppoInfo["degreeId"]); + } + + public int GetOpponentRank() + { + if (OppoBattleStartInfo == null) + { + return 0; + } + return OppoBattleStartInfo.Rank; + } + + public int GetOpponentUserID() + { + if (GameMgr.GetIns().IsWatchBattle) + { + return Convert.ToInt32(_oppoInfo["viewerId"]); + } + return Convert.ToInt32(_selfInfo["oppoId"]); + } + + public bool GetOpponentIsMasterRank() + { + if (OppoBattleStartInfo == null) + { + return false; + } + return OppoBattleStartInfo.IsMasterRank; + } + + public string GetOpponentCountryCode() + { + return _oppoInfo["country_code"].ToString(); + } + + public bool GetOpponentIsOfficialUser() + { + return Convert.ToBoolean(_oppoInfo["isOfficial"]); + } + + public int GetOpponentChaosId() + { + if (!GameMgr.GetIns().IsNetworkBattle && !GameMgr.GetIns().IsReplayBattle) + { + return -1; + } + if (_oppoInfo.ContainsKey("chaosId")) + { + return Convert.ToInt32(_oppoInfo["chaosId"]); + } + return -1; + } + + public bool GetOpponentChaosOverrideSkin() + { + if (!GameMgr.GetIns().IsNetworkBattle && !GameMgr.GetIns().IsReplayBattle) + { + return false; + } + if (_oppoInfo.ContainsKey("isChaosSkinOverride")) + { + return Convert.ToBoolean(_oppoInfo["isChaosSkinOverride"]); + } + return false; + } + + public List GetSelfDeck() + { + if (GameMgr.GetIns().IsWatchBattle && _selfDeck == null) + { + int deckMaxNum = GetDeckMaxNum(isSelf: true); + _selfDeck = IdListConvertToModelList(Enumerable.Repeat(100011010, deckMaxNum).ToList()); + } + return _selfDeck; + } + + public List GetOpponentDeck() + { + if (_oppoDeck == null) + { + int deckMaxNum = GetDeckMaxNum(isSelf: false); + _oppoDeck = IdListConvertToModelList(Enumerable.Repeat(100011010, deckMaxNum).ToList()); + } + return _oppoDeck; + } + + private List IdListConvertToModelList(List idList) + { + List list = new List(idList.Count); + for (int i = 0; i < idList.Count; i++) + { + CardDataModel cardDataModel = new CardDataModel(); + cardDataModel.Index = i + 1; + cardDataModel.CardId = idList[i]; + list.Add(cardDataModel); + } + return list; + } + + public void ReplaceFirstCardData() + { + List list = new List(); + NetworkBattleManagerBase networkBattleManagerBase = BattleManagerBase.GetIns() as NetworkBattleManagerBase; + for (int i = 0; i < _selfFirstCards.Count; i++) + { + ReplaceReceivedCard replaceReceivedCard = new ReplaceReceivedCard(networkBattleManagerBase, _selfFirstCards[i]); + list.Add(replaceReceivedCard.ReplaceCard(networkBattleManagerBase.BattlePlayer)); + } + if (GameMgr.GetIns().IsAdmin) + { + for (int j = 0; j < _oppoFirstCards.Count; j++) + { + ReplaceReceivedCard replaceReceivedCard2 = new ReplaceReceivedCard(networkBattleManagerBase, _oppoFirstCards[j]); + list.Add(replaceReceivedCard2.ReplaceCard(networkBattleManagerBase.BattleEnemy)); + } + } + if (!networkBattleManagerBase.IsRecovery && list.Count > 0) + { + networkBattleManagerBase.VfxMgr.RegisterSequentialVfx(networkBattleManagerBase.LoadCardResources(list)); + } + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkUtility.cs b/SVSim.BattleEngine/Engine/NetworkUtility.cs new file mode 100644 index 0000000..a504dec --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkUtility.cs @@ -0,0 +1,25 @@ +using System; +using Cute; + +public static class NetworkUtility +{ + public static int GetTimeSpanSecond(long oldTimer) + { + if (oldTimer == 0L) + { + return 0; + } + long ticks = TimeUtil.GetAbsoluteTime().Ticks - oldTimer; + return (int)new TimeSpan(ticks).TotalSeconds; + } + + public static float GetTimeSpanMilliSecond(long oldTimer) + { + if (oldTimer == 0L) + { + return 0f; + } + long ticks = DateTime.Now.Ticks - oldTimer; + return (float)new TimeSpan(ticks).TotalSeconds; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkWatchBattleData.cs b/SVSim.BattleEngine/Engine/NetworkWatchBattleData.cs new file mode 100644 index 0000000..3b67994 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkWatchBattleData.cs @@ -0,0 +1,105 @@ +using System.Collections.Generic; +using System.Linq; + +public class NetworkWatchBattleData : NetworkBattleData +{ + public class FromStateData + { + public int Index; + + public bool IsOpponent; + + public NetworkBattleDefine.NetworkCardPlaceState FromState; + + public FromStateData(int index, bool isOpponent, NetworkBattleDefine.NetworkCardPlaceState fromState) + { + Index = index; + IsOpponent = isOpponent; + FromState = fromState; + } + } + + public NetworkWatchBattleData(NetworkBattleManagerBase battleMgr) + : base(battleMgr) + { + } + + public override void BeforeSettingReceiveData() + { + if (GameMgr.GetIns().IsReplayBattle) + { + return; + } + List watchCardList = receiveData.watchCardList; + new Dictionary(); + List list = new List(); + List list2 = new List(); + foreach (CardDataModel card in watchCardList) + { + ReplaceReceivedCard replaceReceivedCard = CreateReplaceReceivedCard(card); + NetworkBattleDefine.NetworkCardPlaceState fromState = card.fromState; + FromStateData fromStateData = list.FirstOrDefault((FromStateData f) => f.Index == card.Index && f.IsOpponent == card.isOpponent); + if (fromStateData != null) + { + fromState = fromStateData.FromState; + } + else + { + FromStateData item = new FromStateData(card.Index, card.isOpponent, card.fromState); + list.Add(item); + } + if (card.CardId == 0) + { + if (card.isOpponent) + { + replaceReceivedCard.SetPrivateCardSpellboost(_battleMgr.BattleEnemy); + } + continue; + } + if (GameMgr.GetIns().IsAdmin || !card.isOpponent) + { + if (receiveData.IsFusion && card.fromState == NetworkBattleDefine.NetworkCardPlaceState.Hand) + { + continue; + } + NetworkBattleDefine.NetworkCardPlaceState networkCardPlaceState = card.ToStateList.FirstOrDefault(); + if (receiveData.dataUri == NetworkBattleDefine.NetworkBattleURI.Deal || (receiveData.IsChoice && receiveData.choiceIdList.Contains(card.CardId)) || networkCardPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Deck || (card.fromState == NetworkBattleDefine.NetworkCardPlaceState.Hand && networkCardPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Field) || (card.fromState == NetworkBattleDefine.NetworkCardPlaceState.Field && networkCardPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Hand) || (card.fromState == NetworkBattleDefine.NetworkCardPlaceState.Field && networkCardPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Cemetery) || (card.fromState == NetworkBattleDefine.NetworkCardPlaceState.Hand && networkCardPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Cemetery) || (card.fromState == NetworkBattleDefine.NetworkCardPlaceState.Field && networkCardPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Banish) || (card.fromState == NetworkBattleDefine.NetworkCardPlaceState.Hand && networkCardPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Banish) || (card.fromState == NetworkBattleDefine.NetworkCardPlaceState.Field && networkCardPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Unite) || fromState == NetworkBattleDefine.NetworkCardPlaceState.Hand) + { + continue; + } + } + else + { + if (card.fromState == NetworkBattleDefine.NetworkCardPlaceState.Field && card.ToStateList.FirstOrDefault() == NetworkBattleDefine.NetworkCardPlaceState.Cemetery) + { + continue; + } + if (!card.ToStateList.Contains(NetworkBattleDefine.NetworkCardPlaceState.Field) && !card.ToStateList.Contains(NetworkBattleDefine.NetworkCardPlaceState.Cemetery) && !card.ToStateList.Contains(NetworkBattleDefine.NetworkCardPlaceState.Banish) && !card.ToStateList.Contains(NetworkBattleDefine.NetworkCardPlaceState.Unite)) + { + bool num = card.fromState == NetworkBattleDefine.NetworkCardPlaceState.Deck && card.ToStateList.Contains(NetworkBattleDefine.NetworkCardPlaceState.Hand) && card.IsOpen; + bool isFusion = receiveData.IsFusion; + bool flag = card.fromState == NetworkBattleDefine.NetworkCardPlaceState.Hand && card.ToStateList.Contains(NetworkBattleDefine.NetworkCardPlaceState.Hand) && card.IsOpen; + if (!num && !isFusion && !flag) + { + continue; + } + } + } + if (!card.isOpponent) + { + if (!GameMgr.GetIns().IsReplayBattle && !_battleMgr.IsRecovery) + { + list2.Add(replaceReceivedCard.ReplaceCard(_battleMgr.BattlePlayer)); + } + } + else + { + list2.Add(replaceReceivedCard.ReplaceCard(_battleMgr.BattleEnemy)); + } + } + if (!_battleMgr.IsRecovery && list2.Count > 0) + { + _battleMgr.VfxMgr.RegisterSequentialVfx(_battleMgr.LoadCardResources(list2)); + } + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkWatchBattleReceiver.cs b/SVSim.BattleEngine/Engine/NetworkWatchBattleReceiver.cs new file mode 100644 index 0000000..ef2c40c --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkWatchBattleReceiver.cs @@ -0,0 +1,266 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.RoomMatch; + +public class NetworkWatchBattleReceiver : NetworkBattleReceiver +{ + private List _lastUnapprovedList; + + public NetworkWatchBattleReceiver(NetworkBattleManagerBase battlemgr) + : base(battlemgr) + { + } + + public override void ReceivedTouchData(NetworkBattleDefine.NetworkBattleURI uri, bool isHaveSequence, Dictionary data, bool isPlayer = false, WatchDataHandler handler = null) + { + ConvertReciveTouchDataToMakeData(uri, isHaveSequence, data, isPlayer, handler); + if (!receiveStop) + { + if (isHaveSequence) + { + networkBattleMgr.ConductReceiveData(_receiveData, isPlayer); + } + else + { + networkBattleMgr.ConductReceiveData_NotHaveSequence(_receiveData, isPlayer); + } + } + } + + protected override bool ConvertReceiveDataToMakeData(NetworkBattleDefine.NetworkBattleURI uri, bool isHaveSequence, Dictionary datas, bool isPlayer = false, WatchDataHandler handler = null) + { + bool result = base.ConvertReceiveDataToMakeData(uri, isHaveSequence, datas, isPlayer, handler); + try + { + _receiveData.result = RESULT_CODE.NotFinish; + foreach (KeyValuePair data in datas) + { + if (!Enum.IsDefined(typeof(NetworkBattleDefine.NetworkParameter), data.Key.ToString())) + { + continue; + } + switch ((NetworkBattleDefine.NetworkParameter)Enum.Parse(typeof(NetworkBattleDefine.NetworkParameter), data.Key.ToString())) + { + case NetworkBattleDefine.NetworkParameter.vid: + if (handler != null) + { + _receiveData.isSelf = (IsSelfVid(ConvertToInt(data.Value), handler) ? true : false); + } + break; + case NetworkBattleDefine.NetworkParameter.finishData: + foreach (object item in data.Value as List) + { + Dictionary resultData = item as Dictionary; + SetResultData(resultData, handler); + } + break; + case NetworkBattleDefine.NetworkParameter.result: + if (handler != null) + { + SetResultData(datas, handler); + } + break; + case NetworkBattleDefine.NetworkParameter.uList: + _lastUnapprovedList = _receiveData.unapprovedList; + break; + case NetworkBattleDefine.NetworkParameter.value: + { + List list = data.Value as List; + switch (uri) + { + case NetworkBattleDefine.NetworkBattleURI.SelectSkill: + ParseSelectSkillData(list); + break; + case NetworkBattleDefine.NetworkBattleURI.SelectObject: + { + string text = list[0].ToString(); + _receiveData._selectObjectTargetType = (NetworkBattleSender.SELECT_OBJECT_TARGET_TYPE)Enum.Parse(typeof(NetworkBattleSender.SELECT_OBJECT_TARGET_TYPE), text[0].ToString()); + if (_receiveData._selectObjectTargetType == NetworkBattleSender.SELECT_OBJECT_TARGET_TYPE.Select) + { + _receiveData._isPlayerCard = text[1].Equals('1'); + _receiveData.idx = int.Parse(text.Substring(2, text.Length - 2)); + } + break; + } + case NetworkBattleDefine.NetworkBattleURI.TurnEndReady: + _receiveData._isNotTurnEndReady = handler.IsIncludedUri(NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.TurnEnd]); + _receiveData._isShortenedTurn = bool.Parse(list[0].ToString()); + break; + case NetworkBattleDefine.NetworkBattleURI.SlideObject: + { + string startPoint = list[0].ToString(); + string endPoint = list[1].ToString(); + CreateSlideObjectReceiveData(startPoint, endPoint); + break; + } + } + break; + } + case NetworkBattleDefine.NetworkParameter.spin: + _receiveData.spin = GetSpinCount(data.Value); + break; + } + } + return result; + } + catch + { + LocalLog.AccumulateLastTraceLog("ConvertReciveDataToMakeData Watch Error"); + return false; + } + } + + private void SetResultData(Dictionary resultData, WatchDataHandler handler) + { + if (IsSelfVid(ConvertToInt(resultData[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.vid]]), handler)) + { + _receiveData.result = (RESULT_CODE)ConvertToInt(resultData[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.result]]); + } + else + { + _receiveData.opponentResult = (RESULT_CODE)ConvertToInt(resultData[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.result]]); + } + } + + private void ParseSelectSkillData(List selectSkillData) + { + _receiveData._selectSkillOperation = (NetworkBattleSender.SELECT_SKILL_OPERATION)Enum.Parse(typeof(NetworkBattleSender.SELECT_SKILL_OPERATION), selectSkillData[0].ToString()); + _receiveData._isEvolveTargetSelect = bool.Parse(selectSkillData[1].ToString()); + _receiveData._isBurialRiteSelect = bool.Parse(selectSkillData[2].ToString()); + string text = selectSkillData[3].ToString(); + switch (_receiveData._selectSkillOperation) + { + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartSelect: + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartChoiceSelect: + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartFusionSelect: + _receiveData.idx = int.Parse(text); + if (selectSkillData.Count > 5) + { + _receiveData.ActiveSelectSkillIndexList.AddRange((selectSkillData[5] as List).Select((object d) => int.Parse(d.ToString()))); + } + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectCard: + case NetworkBattleSender.SELECT_SKILL_OPERATION.CompleteSelect: + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectFusionIngredient: + { + string text2 = text.Substring(0, 1); + string s = text.Substring(1, 3); + _receiveData._isPlayerCard = text2.Equals("1"); + _receiveData._selectedCardIndex = int.Parse(s); + _receiveData.unapprovedList = _lastUnapprovedList; + _lastUnapprovedList = null; + if (selectSkillData.Count > 4) + { + _receiveData.IsChoiceBraveSelect = selectSkillData[4].ToString() == "1"; + } + break; + } + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectChoiceCard: + case NetworkBattleSender.SELECT_SKILL_OPERATION.CompleteChoiceSelect: + if (text.Contains(",")) + { + string[] array = text.Split(','); + for (int i = 0; i < array.Count(); i++) + { + _receiveData._selectedChoiceCardIdList.Add(int.Parse(array[i])); + } + } + else if (text != string.Empty) + { + _receiveData._selectedChoiceCardIdList.Add(int.Parse(text)); + } + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CancelSelect: + case NetworkBattleSender.SELECT_SKILL_OPERATION.CancelChoiceSelect: + break; + } + } + + private void ConvertReciveTouchDataToMakeData(NetworkBattleDefine.NetworkBattleURI uri, bool isHaveSequence, Dictionary datas, bool isPlayer = false, WatchDataHandler handler = null) + { + if (isHaveSequence) + { + _receiveData = new ReceiveData(); + } + _receiveData.dataUri = uri; + try + { + foreach (KeyValuePair data in datas) + { + if (Enum.IsDefined(typeof(NetworkBattleDefine.NetworkParameter), data.Key.ToString()) && (NetworkBattleDefine.NetworkParameter)Enum.Parse(typeof(NetworkBattleDefine.NetworkParameter), data.Key.ToString()) == NetworkBattleDefine.NetworkParameter.touch) + { + List list = data.Value as List; + _receiveData.idx = ConvertToInt(list[1]); + _receiveData.isSelf = isPlayer; + } + } + } + catch + { + LocalLog.AccumulateLastTraceLog("ConvertReciveTouchDataToMakeData Error"); + Debug.LogError("ConvertReciveTouchDataToMakeData Error"); + } + } + + protected override void CheckDuplicateDataAddtoList(List list, CardDataModel cardDataModel) + { + CardDataModel cardDataModel2 = list.Find((CardDataModel x) => x.Index == cardDataModel.Index && x.CardId == cardDataModel.CardId && x.isOpponent == cardDataModel.isOpponent && x.publishedActiveSkillCount == cardDataModel.publishedActiveSkillCount && x.IsOpen == cardDataModel.IsOpen && x.skillMovementNum == cardDataModel.skillMovementNum); + if (cardDataModel2 == null) + { + list.Add(cardDataModel); + return; + } + SkillBase skillBase = networkBattleMgr.PublishedSkillList.FirstOrDefault((SkillBase s) => s.PublishedActiveSkillCount == cardDataModel.publishedActiveSkillCount); + if (skillBase != null && skillBase.OnWhenDrawOtherStart != 0) + { + list.Add(cardDataModel); + } + else + { + cardDataModel2.ToStateList.Add(cardDataModel.ToStateList.First()); + } + } + + protected override List MakeReceiveCardData(object cardData, BattleManagerBase mgr, WatchDataHandler handler) + { + Dictionary dictionary = cardData as Dictionary; + List list = base.MakeReceiveCardData(cardData, mgr, handler); + foreach (CardDataModel item in list) + { + if (dictionary.ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.cardId])) + { + item.CardId = ConvertToInt(dictionary[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.cardId]]); + item.playCardCost = CardMaster.GetInstanceForBattle().GetCardParameterFromId(item.CardId).Cost; + } + else if (dictionary.ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.cardId])) + { + item.CardId = ConvertToInt(dictionary[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.cardId]]); + item.playCardCost = CardMaster.GetInstanceForBattle().GetCardParameterFromId(item.CardId).Cost; + } + if (dictionary.ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.cost])) + { + item.playCardCost = ConvertToInt(dictionary[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.cost]]); + } + if (dictionary.ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.pos])) + { + item.RedrawCardPosition = ConvertToInt(dictionary[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.pos]]); + } + if (dictionary.ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.vid])) + { + item.isOpponent = ((handler != null) ? (!handler.isOwner(dictionary[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.vid]].ToString())) : (ConvertToInt(dictionary[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.vid]].ToString()) != PlayerStaticData.UserViewerID)); + } + if (dictionary.ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.is_open])) + { + item.IsOpen = ConvertToInt(dictionary[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.is_open]]) == 1; + } + } + return list; + } + + private bool IsSelfVid(int vid, WatchDataHandler handler = null) + { + return handler.isOwner(vid.ToString()); + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkWatchBattleSetupCardEvent.cs b/SVSim.BattleEngine/Engine/NetworkWatchBattleSetupCardEvent.cs new file mode 100644 index 0000000..2b378de --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkWatchBattleSetupCardEvent.cs @@ -0,0 +1,120 @@ +using System.Linq; + +public class NetworkWatchBattleSetupCardEvent : NetworkBattleSetupCardEvent +{ + public NetworkWatchBattleSetupCardEvent(BattleManagerBase manager, RegisterActionManager registerCardList, NetworkBattleData data) + : base(manager, registerCardList, data) + { + } + + protected override void SkillEventSetting(BattleCardBase card, SkillBase skill) + { + if (skill is Skill_none && !skill.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessBurialRite)) + { + return; + } + NetworkExecutionInfoCreator networkExecutionInfoCreator = skill._executionInfoCreator as NetworkExecutionInfoCreator; + bool flag = RegisterValidate.IsValidateCard(skill); + NetworkBattleReceiver.ReceiveData receiveData = base.networkBattleData.GetReceiveData(); + if (!GameMgr.GetIns().IsAdmin) + { + SettingConditionValidateCard(skill, card, networkExecutionInfoCreator); + } + if (!IsSettingUnapprovedCard(skill) || IsNotSettingUnapproved(skill)) + { + return; + } + if (RegisterFilter.IsFilterCard(skill)) + { + if (!card.IsPlayer && RegisterFilter.IsHandAllSelect(skill) && !GameMgr.GetIns().IsAdmin) + { + networkExecutionInfoCreator.SetHandAllSelect(); + } + else if (RegisterFilter.IsDeckAllSelect(skill)) + { + networkExecutionInfoCreator.SetUseUListOnlySelfTurn(); + if (!card.IsPlayer && !GameMgr.GetIns().IsAdmin) + { + networkExecutionInfoCreator.SetDeckAllSelect(); + } + } + if (RegisterFilter.IsFilterCardUnapproved(skill)) + { + networkExecutionInfoCreator.SetUnapproved(); + if (RegisterFilter.IsSkillUpdateDeckCard(skill)) + { + networkExecutionInfoCreator.SetUseUListOnlySelfTurn(); + } + } + return; + } + if ((!GameMgr.GetIns().IsAdmin || (GameMgr.GetIns().IsAdminWatch && skill.ApplyingTargetFilter is SkillTargetDeckSelfFilter)) && flag && !(skill.ApplyingTargetFilter is SkillTargetDiscardThisTurnCardListFilter)) + { + if (!NetworkBattleGenericTool.IsBurialRite(skill)) + { + if (!RegisterValidate.IsOpenMyHandSkill(skill) && !RegisterValidate.IsSendOpenMyCardsSkill(skill)) + { + networkExecutionInfoCreator.SetUnapproved(); + } + } + else if (!card.IsPlayer) + { + networkExecutionInfoCreator.SetNotCheckBuriaRiteCondition(value: true); + } + } + if (!GameMgr.GetIns().IsAdmin && !card.IsPlayer && receiveData != null) + { + _networkBattleSetupValidateEvent.OpponentPlayerIncludedValidateSkillToNotPlay(skill); + } + SettingUnapprovedRegisterLotEvent(skill, networkExecutionInfoCreator); + bool flag2 = (GameMgr.GetIns().IsAdmin || card.IsPlayer) && RegisterSkillConditionCheck.IsGameAddDeckCardsNumInvestigationSkill(skill); + SettingReplaceSkillOption(skill, card, networkExecutionInfoCreator, !RegisterSkillConditionCheck.DoesSkillUsePrivateCount(skill, notHandCheck: true) && !flag2); + if (!card.IsPlayer && !GameMgr.GetIns().IsAdmin) + { + SettingBurialRiteSkillPlayOrNotPlay(skill, networkExecutionInfoCreator); + CheckApplySelectFilter(skill, networkExecutionInfoCreator); + } + } + + protected override bool IsSendUnapprovedList(SkillBase skill) + { + return false; + } + + protected override bool IsCheckValidateCard() + { + return false; + } + + protected override bool IsCheckSkillConditionCard(BattleCardBase card) + { + return true; + } + + protected override bool CheckSkillCondition(SkillBase skill) + { + if (skill.SkillPrm.ownerCard.IsPlayer) + { + return RegisterSkillConditionCheck.IsSkillConditionCheck(skill, isNotHandCheck: true); + } + if (!RegisterSkillConditionCheck.IsSkillConditionCheck(skill, GameMgr.GetIns().IsAdmin)) + { + if (!GameMgr.GetIns().IsAdmin) + { + return RegisterSkillConditionCheck.IsSelectedCardSkillConditionCheck(skill); + } + return false; + } + return true; + } + + public override bool IsSettingUnapprovedCard(SkillBase skill) + { + return true; + } + + protected override bool IsSetNotCheckSelectSkillCard() + { + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/NewReplayOperateReceive.cs b/SVSim.BattleEngine/Engine/NewReplayOperateReceive.cs new file mode 100644 index 0000000..bd21c64 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NewReplayOperateReceive.cs @@ -0,0 +1,312 @@ +public class NewReplayOperateReceive : OperateReceive +{ + private bool _isFirstMulligan = true; + + public NewReplayOperateReceive(NetworkBattleManagerBase networkBattleMgr, RegisterActionManager registerCardList, OperateMgr operateMgr, NetworkBattleData networkBattleData) + : base(networkBattleMgr, registerCardList, operateMgr, networkBattleData) + { + } + + protected override PlayHandCardReflection CreateNetworkPlayCardAction() + { + return new ReplayPlayCardAction(_battleMgr, _operateMgr, _networkBattleData); + } + + protected override InPlayCardReflection CreateNetworkInPlayAction() + { + return new ReplayInPlayAction(_battleMgr, _operateMgr); + } + + public void StartReplayOperate(NewReplayOperationCollection networkOperationCollection, NetworkBattleReceiver.ReplayReceiveData receiveData) + { + switch (receiveData.Operation) + { + case NetworkBattleReceiver.ReplayOperationType.MulliganStart: + networkOperationCollection.DealOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.MulliganEnd: + if (_isFirstMulligan) + { + _isFirstMulligan = false; + networkOperationCollection.SwapOperation(OnReceiveOpponentMulligan, OnReceivePlayerMulligan); + } + else + { + _isFirstMulligan = true; + networkOperationCollection.SecondMulliganOperation(OnReceiveOpponentMulligan, OnReceivePlayerMulligan, OnEndMulligan); + } + break; + case NetworkBattleReceiver.ReplayOperationType.TurnStart: + networkOperationCollection.TurnStartOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.TurnStartFinish: + networkOperationCollection.TurnStartFinishOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.TurnEnd: + networkOperationCollection.TurnEndOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.TurnEndFinish: + networkOperationCollection.TurnEndFinishOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.AddPpTotal: + networkOperationCollection.AddPpTotalOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.AddPp: + networkOperationCollection.AddPpOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.AddBp: + networkOperationCollection.AddBpOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.AddEp: + networkOperationCollection.AddEpOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.SetEp: + networkOperationCollection.SetEpOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Draw: + networkOperationCollection.DrawCardOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.TokenDraw: + networkOperationCollection.TokenDrawCardOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.CreateReservedCard: + networkOperationCollection.CreateReservedCardOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Play: + if (receiveData.IsChoiceBraveData) + { + networkOperationCollection.PlayChoiceBraveCardOperation(); + } + else + { + networkOperationCollection.PlayHandCardOperation(); + } + break; + case NetworkBattleReceiver.ReplayOperationType.ShowWhenPlayEffect: + networkOperationCollection.ShowWhenPlayEffectOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.SummonToken: + networkOperationCollection.SummonTokenOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.SummonCard: + networkOperationCollection.SummonCardOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.AttackStart: + networkOperationCollection.AttackStartOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Attack: + networkOperationCollection.AttackOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.CostChange: + networkOperationCollection.CostChangeOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.RemoveCostChange: + networkOperationCollection.RemoveCostChangeOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.PowerUp: + networkOperationCollection.PowerUpOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.GainPowerDown: + networkOperationCollection.GainPowerDownOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.SetPowerDown: + networkOperationCollection.SetPowerDownOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.DepriveBuff: + networkOperationCollection.DepriveBuffOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.SpellCharge: + networkOperationCollection.SpellChargeOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Damage: + networkOperationCollection.DamageOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Heal: + networkOperationCollection.HealOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Discard: + networkOperationCollection.DiscardOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.DestroyOrBanish: + networkOperationCollection.DestroyOrBanishOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Evolve: + networkOperationCollection.EvolveOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.SkillEvolve: + networkOperationCollection.SkillEvolveOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Return: + networkOperationCollection.ReturnOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.StartSelect: + networkOperationCollection.StartSelectOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Select: + networkOperationCollection.SelectOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.CompSelect: + networkOperationCollection.CompleteSelectOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.CancelSelect: + networkOperationCollection.CancelSelectOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.StartChoice: + networkOperationCollection.StartChoiceOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.CompChoice: + networkOperationCollection.CompleteChoiceOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.CancelChoice: + networkOperationCollection.CancelChoiceOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.StartFusion: + networkOperationCollection.StartFusionOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.SelectFusion: + networkOperationCollection.SelectFusionOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.CompFusion: + networkOperationCollection.CompleteFusionOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.CancelFusion: + networkOperationCollection.CancelFusionOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.ChantCountChange: + networkOperationCollection.ChantCountChangeOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.ChangeWhiteRitualStack: + networkOperationCollection.ChangeWhiteRitualStackOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Necromance: + networkOperationCollection.Necromance(); + break; + case NetworkBattleReceiver.ReplayOperationType.ChangeMaxAttackableCount: + networkOperationCollection.ChangeMaxAttackableCountOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateDeck: + networkOperationCollection.UpdateDeckOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.IndexChange: + networkOperationCollection.IndexChangeOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Metamorphose: + networkOperationCollection.MetamorphoseOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Geton: + networkOperationCollection.GetonOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Getoff: + networkOperationCollection.GetoffOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.Unite: + networkOperationCollection.UniteOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.OpenCard: + networkOperationCollection.OpenCardOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.AttachSkill: + networkOperationCollection.ShowSkillEffectOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.ShowSkillEffect: + networkOperationCollection.ShowSkillEffectOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.ShowSkillInductionEffect: + networkOperationCollection.ShowSkillInductionEffect(); + break; + case NetworkBattleReceiver.ReplayOperationType.ShowIndependentEffect: + networkOperationCollection.ShowIndependentEffect(); + break; + case NetworkBattleReceiver.ReplayOperationType.ChangeAffiliation: + networkOperationCollection.ChangeAffiliationOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.OnChangeUnionBurstAndSkyboundArt: + networkOperationCollection.ShowChangeUnionBurstAndSkyboundArtEffect(); + break; + case NetworkBattleReceiver.ReplayOperationType.ShowRepeatSkillEffect: + networkOperationCollection.ShowRepeatSkillEffect(); + break; + case NetworkBattleReceiver.ReplayOperationType.GiveCantActivateFanfare: + networkOperationCollection.GiveCantActivateFanfareOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.DepriveCantActivateFanfare: + networkOperationCollection.DepriveCantActivateFanfareOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.LoseSkill: + networkOperationCollection.LoseSkillOperation(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateHandInfo: + networkOperationCollection.UpdateHandInfo(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateChoiceBraveButtonEffet: + networkOperationCollection.UpdateChoiceBraveButtonEffet(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateInplayInfo: + networkOperationCollection.UpdateInplayInfo(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateDeckInfo: + networkOperationCollection.UpdateDeckInfo(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateAttachedCardInfo: + networkOperationCollection.UpdateAttachedCardInfo(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateFusionCardInfo: + networkOperationCollection.UpdateFusionCardInfo(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateStatusPanel: + networkOperationCollection.UpdateStatusPanel(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateBattleInfo: + networkOperationCollection.UpdateBattleLog(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateClassInfoUi: + networkOperationCollection.UpdateClassInfoUi(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateMyRotationBonus: + networkOperationCollection.UpdateMyRotationBonus(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateAvatarBattleDescInfo: + networkOperationCollection.UpdateAvatarBattleDescValueList(); + break; + case NetworkBattleReceiver.ReplayOperationType.UpdateAttackableEffect: + networkOperationCollection.UpdateAttackableEffect(); + break; + case NetworkBattleReceiver.ReplayOperationType.SkillProcessStart: + networkOperationCollection.SkillProcessStart(); + break; + case NetworkBattleReceiver.ReplayOperationType.SkillVfxStart: + networkOperationCollection.SkillVfxStart(); + break; + case NetworkBattleReceiver.ReplayOperationType.SkillVfxEnd: + networkOperationCollection.SkillVfxEnd(); + break; + case NetworkBattleReceiver.ReplayOperationType.ClearSideLog: + networkOperationCollection.ClearSideLog(); + break; + case NetworkBattleReceiver.ReplayOperationType.ClearDestroyedCardList: + networkOperationCollection.ClearDestroyedCardList(); + break; + case NetworkBattleReceiver.ReplayOperationType.PlayEmotion: + networkOperationCollection.PlayEmotion(); + break; + case NetworkBattleReceiver.ReplayOperationType.AttachShortageDeckWin: + networkOperationCollection.AttachShortageDeckWin(); + break; + case NetworkBattleReceiver.ReplayOperationType.ShortageDeckWin: + networkOperationCollection.ShortageDeckWin(); + break; + case NetworkBattleReceiver.ReplayOperationType.ShortageDeckLose: + networkOperationCollection.ShortageDeckLose(); + break; + case NetworkBattleReceiver.ReplayOperationType.SpecialWin: + networkOperationCollection.SpecialWin(); + break; + case NetworkBattleReceiver.ReplayOperationType.SpecialLose: + networkOperationCollection.SpecialLose(); + break; + case NetworkBattleReceiver.ReplayOperationType.BattleFinish: + networkOperationCollection.BattleFinish(); + break; + } + } +} diff --git a/SVSim.BattleEngine/Engine/NewReplayOperationCollection.cs b/SVSim.BattleEngine/Engine/NewReplayOperationCollection.cs new file mode 100644 index 0000000..c97c7d6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NewReplayOperationCollection.cs @@ -0,0 +1,924 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class NewReplayOperationCollection +{ + private readonly NetworkBattleReceiver.ReplayReceiveData _receivedData; + + private readonly NewReplayBattleMgr _networkReplayBattleMgr; + + private readonly NetworkBattleData _networkBattleData; + + private ReplayBattlePlayer ReplayBattlePlayer; + + private ReplayBattleEnemy ReplayBattleEnemy; + + public NewReplayOperationCollection(NetworkReplayBattleMgr networkReplayBattleMgr, NetworkBattleReceiver.ReplayReceiveData receiveData, NetworkBattleData networkBattleData) + { + _receivedData = receiveData; + _networkReplayBattleMgr = networkReplayBattleMgr as NewReplayBattleMgr; + _networkBattleData = networkBattleData; + ReplayBattlePlayer = _networkReplayBattleMgr.BattlePlayer as ReplayBattlePlayer; + ReplayBattleEnemy = _networkReplayBattleMgr.BattleEnemy as ReplayBattleEnemy; + } + + private void RegisterSequentialVfx(VfxBase operationVfx) + { + if (_networkReplayBattleMgr.IsDuringSkillProcess) + { + if (operationVfx is VfxWithLoading vfxWithLoadingToRegister) + { + _networkReplayBattleMgr.SkillVfxStack.Peek().RegisterVfxWithLoading(vfxWithLoadingToRegister); + } + else + { + _networkReplayBattleMgr.SkillVfxStack.Peek().RegisterToMainVfx(operationVfx); + } + } + else + { + _networkReplayBattleMgr.VfxMgr.RegisterSequentialVfx(operationVfx); + } + } + + public void DealOperation() + { + _networkReplayBattleMgr.SetSkillDescriptionValueList(ReplayBattlePlayer.AllCards.ToList(), _receivedData.CardInfoList); + _networkReplayBattleMgr.OperateReceive.OnReceiveDeal(_receivedData.selfIdxList, _receivedData.oppoIdxList); + RegisterSequentialVfx(WaitVfx.Create(0.2f)); + } + + public void SwapOperation(Func, VfxBase> OnReceiveOpponentMulligan, Func, VfxBase> OnReceivePlayerMulligan) + { + OperateMulligan(OnReceiveOpponentMulligan, OnReceivePlayerMulligan); + } + + public void SecondMulliganOperation(Func, VfxBase> OnReceiveOpponentMulligan, Func, VfxBase> OnReceivePlayerMulligan, Func OnEndMulligan) + { + OperateMulligan(OnReceiveOpponentMulligan, OnReceivePlayerMulligan); + RegisterSequentialVfx(OnEndMulligan.GetAllFuncVfxResults()); + } + + private void OperateMulligan(Func, VfxBase> OnReceiveOpponentMulligan, Func, VfxBase> OnReceivePlayerMulligan) + { + if (_receivedData.isSelf) + { + _networkReplayBattleMgr.SetSkillDescriptionValueList(ReplayBattlePlayer.AllCards.ToList(), _receivedData.CardInfoList); + } + RegisterSequentialVfx(_receivedData.isSelf ? OperatePlayerMulligan(_receivedData, OnReceivePlayerMulligan) : OperateOppoMulligan(_receivedData, OnReceiveOpponentMulligan)); + } + + private VfxBase OperatePlayerMulligan(NetworkBattleReceiver.ReplayReceiveData receiveData, Func, VfxBase> OnReceivePlayerMulligan) + { + if (_networkBattleData.isPlayerMulliganEnd) + { + return NullVfx.GetInstance(); + } + if (receiveData.selfIdxList != null && receiveData.selfIdxList.Count >= 1) + { + _networkBattleData.isPlayerMulliganEnd = true; + return OnReceivePlayerMulligan.GetAllFuncVfxResults(receiveData.selfIdxList); + } + return NullVfx.GetInstance(); + } + + protected virtual VfxBase OperateOppoMulligan(NetworkBattleReceiver.ReplayReceiveData receiveData, Func, VfxBase> OnReceiveOpponentMulligan) + { + if (_networkBattleData.isOppoMulliganEnd) + { + return NullVfx.GetInstance(); + } + if (receiveData.oppoIdxList != null && receiveData.oppoIdxList.Count >= 1) + { + _networkBattleData.isOppoMulliganEnd = true; + return OnReceiveOpponentMulligan.GetAllFuncVfxResults(receiveData.oppoIdxList); + } + return NullVfx.GetInstance(); + } + + public void TurnStartOperation() + { + RegisterSequentialVfx(_receivedData.isSelf ? ReplayBattlePlayer.StartTurnControl() : ReplayBattleEnemy.StartTurnControl()); + } + + public void TurnStartFinishOperation() + { + RegisterSequentialVfx(_receivedData.isSelf ? ReplayBattlePlayer.TurnStartFinish() : ReplayBattleEnemy.TurnStartFinish()); + } + + public void TurnEndOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.TurnEnd()); + } + + public void TurnEndFinishOperation() + { + if (_receivedData.isSelf) + { + ReplayBattlePlayer.IsSelfTurn = false; + } + else + { + ReplayBattleEnemy.IsSelfTurn = false; + } + } + + public void AddPpTotalOperation() + { + RegisterSequentialVfx(_receivedData.isSelf ? ReplayBattlePlayer.AddPpTotal(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.AddPpTotalCount, _receivedData.Pp, _receivedData.BySkill) : ReplayBattleEnemy.AddPpTotal(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.AddPpTotalCount, _receivedData.Pp)); + } + + public void AddPpOperation() + { + RegisterSequentialVfx(_receivedData.isSelf ? ReplayBattlePlayer.AddPp(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.Pp) : ReplayBattleEnemy.AddPp(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.Pp)); + } + + public void AddBpOperation() + { + RegisterSequentialVfx(_receivedData.isSelf ? ReplayBattlePlayer.AddBp(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.Bp) : ReplayBattleEnemy.AddBp(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.Bp)); + } + + public void AddEpOperation() + { + RegisterSequentialVfx(_receivedData.isSelf ? ReplayBattlePlayer.AddEp(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.Ep, _receivedData.EffectInfo) : ReplayBattleEnemy.AddEp(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.Ep, _receivedData.EffectInfo)); + } + + public void SetEpOperation() + { + RegisterSequentialVfx(_receivedData.isSelf ? ReplayBattlePlayer.SetEp(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.Ep, _receivedData.EffectInfo) : ReplayBattleEnemy.SetEp(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.Ep, _receivedData.EffectInfo)); + } + + public void DrawCardOperation() + { + if (_receivedData.isSelf) + { + List list = new List(); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + for (int i = 0; i < _receivedData.CardInfoList.Count; i++) + { + BattleCardBase drawCard = _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.DeckCardList, _receivedData.CardInfoList[i].Index); + _networkReplayBattleMgr.ClearAndUpdateParameterModifier(drawCard, _receivedData.CardInfoList[i]); + int cost = drawCard.Cost; + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + drawCard.BattleCardView.UpdateCost(drawCard.BattleCardView.GetUseCostList(cost, useNomalCost: true), isGenerateInHand: true, playEffect: false, isForceUpdate: true); + })); + list.Add(drawCard); + } + RegisterSequentialVfx(parallelVfxPlayer); + RegisterSequentialVfx(ReplayBattlePlayer.DrawCard(list, _receivedData.CardInfoList, _receivedData.IsOpenDrawSkill)); + RegisterSequentialVfx(_networkReplayBattleMgr.UpdateHandInfo(ReplayBattlePlayer.HandCardList, ReplayBattleEnemy.HandCardList, _receivedData.CardInfoList, ReplayBattlePlayer.AllCardsWithSkillIngredient, ReplayBattleEnemy.AllCardsWithSkillIngredient)); + return; + } + List list2 = new List(); + if (_receivedData.IsOpenDrawSkill) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + for (int num = 0; num < _receivedData.CardInfoList.Count; num++) + { + BattleCardBase battleCardIdx = _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattleEnemy.DeckCardList, _receivedData.CardInfoList[num].Index); + VfxWith vfxWith = _networkReplayBattleMgr.ReplaceReceivedCard(battleCardIdx, _receivedData.CardInfoList[num], ReplayBattleEnemy, isFusion: false); + BattleCardBase card = vfxWith.Value; + int cost2 = _receivedData.CardInfoList[num].Cost; + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + card.BattleCardView.UpdateParameterView(card.Atk, card.Life, cost2, card.BaseParameter.CardName, card.IsInplay); + })); + list2.Add(card); + sequentialVfxPlayer.Register(vfxWith.Vfx); + } + RegisterSequentialVfx(sequentialVfxPlayer); + } + else + { + list2 = _receivedData.CardInfoList.Select((NetworkBattleReceiver.CardInfo cardInfo) => _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattleEnemy.DeckCardList, cardInfo.Index)).ToList(); + } + RegisterSequentialVfx(ReplayBattleEnemy.DrawCard(list2, _receivedData.CardInfoList, _receivedData.IsOpen, _receivedData.IsOpenDrawSkill)); + } + + public void TokenDrawCardOperation() + { + if (_receivedData.isSelf) + { + List targets = _receivedData.TargetIndexList.Select((int i) => _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.AllCardsWithSkillIngredient, i)).ToList(); + RegisterSequentialVfx(ReplayBattlePlayer.TokenDrawCard(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.CardInfoList, targets, _receivedData.IsOpen, _receivedData.IsReserved, _receivedData.EffectInfo)); + RegisterSequentialVfx(_networkReplayBattleMgr.UpdateHandInfo(ReplayBattlePlayer.HandCardList, ReplayBattleEnemy.HandCardList, _receivedData.CardInfoList, ReplayBattlePlayer.AllCardsWithSkillIngredient, ReplayBattleEnemy.AllCardsWithSkillIngredient)); + } + else + { + List targets2 = _receivedData.TargetIndexList.Select((int i) => _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattleEnemy.AllCardsWithSkillIngredient, i)).ToList(); + RegisterSequentialVfx(ReplayBattleEnemy.TokenDrawCard(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.CardInfoList, targets2, _receivedData.IsOpen, _receivedData.IsReserved, _receivedData.EffectInfo)); + } + } + + public void CreateReservedCardOperation() + { + if (_receivedData.isSelf) + { + RegisterSequentialVfx(ReplayBattlePlayer.CreateReservedCard(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.CardInfoList)); + } + else + { + RegisterSequentialVfx(ReplayBattleEnemy.CreateReservedCard(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.CardInfoList)); + } + } + + public void PlayHandCardOperation() + { + if (ReplayBattlePlayer.IsSelfTurn) + { + BattleCardBase indexToCardBase = NetworkBattleGenericTool.GetIndexToCardBase(_networkReplayBattleMgr, ReplayBattlePlayer, _receivedData.CardInfo.Index); + _networkReplayBattleMgr.UpdateSkillDescriptionValueList(indexToCardBase, _receivedData.CardInfo); + _networkReplayBattleMgr.UpdateExecutedFixedUseCostIndex(indexToCardBase, _receivedData.CardInfo); + _networkReplayBattleMgr.UpdateUnionBurstAndSkyboundArtModifier(indexToCardBase, _receivedData.CardInfo); + RegisterSequentialVfx(ReplayBattlePlayer.PlayCard(indexToCardBase, _receivedData.Cost, _receivedData.TransformCardId, _receivedData.TransformType, _receivedData.CardInfo)); + return; + } + BattleCardBase battleCardBase = NetworkBattleGenericTool.GetIndexToCardBase(_networkReplayBattleMgr, ReplayBattleEnemy, _receivedData.CardInfo.Index); + if (_receivedData.TransformCardId == -1 || _receivedData.TransformType == BattleCardBase.TransformType.Accelerate || _receivedData.TransformType == BattleCardBase.TransformType.Crystallize) + { + VfxWith vfxWith = _networkReplayBattleMgr.ReplaceReceivedCard(battleCardBase, _receivedData.CardInfo, ReplayBattleEnemy, isFusion: false); + battleCardBase = vfxWith.Value; + RegisterSequentialVfx(vfxWith.Vfx); + } + RegisterSequentialVfx(ReplayBattleEnemy.PlayCard(battleCardBase, _receivedData.Cost, _receivedData.TransformCardId, _receivedData.TransformType, _receivedData.CardInfo)); + } + + public void PlayChoiceBraveCardOperation() + { + if (ReplayBattlePlayer.IsSelfTurn) + { + RegisterSequentialVfx(ReplayBattlePlayer.PlayChoiceBraveCard(_receivedData.Cost, _receivedData.TransformCardId, _receivedData.CardInfo)); + } + else + { + RegisterSequentialVfx(ReplayBattleEnemy.PlayChoiceBraveCard(_receivedData.Cost, _receivedData.TransformCardId, _receivedData.CardInfo)); + } + } + + public void ShowWhenPlayEffectOperation() + { + BattleCardBase battleCardBase = (_receivedData.isSelf ? NetworkBattleGenericTool.GetIndexToCardBase(_networkReplayBattleMgr, ReplayBattlePlayer, _receivedData.CardIndex) : NetworkBattleGenericTool.GetIndexToCardBase(_networkReplayBattleMgr, ReplayBattleEnemy, _receivedData.CardIndex)); + RegisterSequentialVfx(_networkReplayBattleMgr.CreateWhenPlayEffect(_receivedData.WhenPlayEffectType, battleCardBase.BattleCardView, _receivedData.IsInvoked)); + } + + public void SummonTokenOperation() + { + if (_receivedData.isSelf) + { + RegisterSequentialVfx(ReplayBattlePlayer.SummonToken(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.CardInfoList, _receivedData.EffectInfo, _receivedData.IsOwnerEffect, _receivedData.IsIgnoreVoice, _receivedData.IsRandomVoice, _receivedData.IsEvoVoice)); + } + else + { + RegisterSequentialVfx(ReplayBattleEnemy.SummonToken(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.CardInfoList, _receivedData.EffectInfo, _receivedData.IsOwnerEffect, _receivedData.IsIgnoreVoice, _receivedData.IsRandomVoice, _receivedData.IsEvoVoice)); + } + } + + public void SummonCardOperation() + { + if (_receivedData.isSelf) + { + List list = new List(); + for (int i = 0; i < _receivedData.CardInfoList.Count; i++) + { + BattleCardBase battleCardIdx = _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.AllCards.ToList(), _receivedData.CardInfoList[i].Index); + _networkReplayBattleMgr.UpdateParameterModifierAndCostView(battleCardIdx, _receivedData.CardInfoList[i]); + list.Add(battleCardIdx); + } + RegisterSequentialVfx(ReplayBattlePlayer.SummonCard(GetOwnerCard(_receivedData.OwnerCardName), list, _receivedData.IsDeckSelf, _receivedData.IsBurialRite, _receivedData.EffectInfo, _receivedData.IsIgnoreVoice, _receivedData.CardInfoList)); + return; + } + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + List list2 = new List(); + for (int j = 0; j < _receivedData.CardInfoList.Count; j++) + { + BattleCardBase battleCardIdx2 = _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattleEnemy.AllCards.ToList(), _receivedData.CardInfoList[j].Index); + VfxWith vfxWith = _networkReplayBattleMgr.ReplaceReceivedCard(battleCardIdx2, _receivedData.CardInfoList[j], ReplayBattleEnemy, isFusion: false); + list2.Add(vfxWith.Value); + sequentialVfxPlayer.Register(vfxWith.Vfx); + } + RegisterSequentialVfx(sequentialVfxPlayer); + RegisterSequentialVfx(ReplayBattleEnemy.SummonCard(GetOwnerCard(_receivedData.OwnerCardName), list2, _receivedData.IsDeckSelf, _receivedData.IsBurialRite, _receivedData.EffectInfo, _receivedData.IsIgnoreVoice, _receivedData.CardInfoList)); + } + + public void AttackStartOperation() + { + if (_receivedData.isSelf) + { + BattleCardBase indexToCardBase = NetworkBattleGenericTool.GetIndexToCardBase(_networkReplayBattleMgr, ReplayBattlePlayer, _receivedData.CardIndex); + BattleCardBase indexToCardBase2 = NetworkBattleGenericTool.GetIndexToCardBase(_networkReplayBattleMgr, ReplayBattleEnemy, _receivedData.TargetIndexList[0]); + RegisterSequentialVfx(ReplayBattlePlayer.AttackStart(indexToCardBase, indexToCardBase2)); + } + else + { + BattleCardBase indexToCardBase3 = NetworkBattleGenericTool.GetIndexToCardBase(_networkReplayBattleMgr, ReplayBattleEnemy, _receivedData.CardIndex); + BattleCardBase indexToCardBase4 = NetworkBattleGenericTool.GetIndexToCardBase(_networkReplayBattleMgr, ReplayBattlePlayer, _receivedData.TargetIndexList[0]); + RegisterSequentialVfx(ReplayBattleEnemy.AttackStart(indexToCardBase3, indexToCardBase4)); + } + } + + public void AttackOperation() + { + List cardListFromCardNameList = GetCardListFromCardNameList(_receivedData.DestroyCardNameList); + List cardListFromCardNameList2 = GetCardListFromCardNameList(_receivedData.BanishCardNameList); + if (_receivedData.isSelf) + { + BattleCardBase indexToCardBase = NetworkBattleGenericTool.GetIndexToCardBase(_networkReplayBattleMgr, ReplayBattlePlayer, _receivedData.CardIndex); + BattleCardBase indexToCardBase2 = NetworkBattleGenericTool.GetIndexToCardBase(_networkReplayBattleMgr, ReplayBattleEnemy, _receivedData.TargetIndexList[0]); + RegisterSequentialVfx(ReplayBattlePlayer.Attack(indexToCardBase, indexToCardBase2, _receivedData.DealDamageList[0], _receivedData.ReceiveDamage, cardListFromCardNameList, _receivedData.DestroyTypeList, cardListFromCardNameList2, _receivedData.HealList[0], _receivedData.CardInfo, _receivedData.SideLogSkillInfoList, _receivedData.IsAttackerDead, _receivedData.IsTargetDead)); + } + else + { + BattleCardBase indexToCardBase3 = NetworkBattleGenericTool.GetIndexToCardBase(_networkReplayBattleMgr, ReplayBattleEnemy, _receivedData.CardIndex); + BattleCardBase indexToCardBase4 = NetworkBattleGenericTool.GetIndexToCardBase(_networkReplayBattleMgr, ReplayBattlePlayer, _receivedData.TargetIndexList[0]); + RegisterSequentialVfx(ReplayBattleEnemy.Attack(indexToCardBase3, indexToCardBase4, _receivedData.DealDamageList[0], _receivedData.ReceiveDamage, cardListFromCardNameList, _receivedData.DestroyTypeList, cardListFromCardNameList2, _receivedData.HealList[0], _receivedData.CardInfo, _receivedData.SideLogSkillInfoList, _receivedData.IsAttackerDead, _receivedData.IsTargetDead)); + } + } + + public void CostChangeOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.CostChange(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.AddCostList, _receivedData.SetCostList, _receivedData.IsCostUpList, _receivedData.IsHalf, _receivedData.IsSpellCharge, _receivedData.IsOpenCard, _receivedData.EffectInfo)); + } + + public void RemoveCostChangeOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.RemoveCostChange(GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.RemoveCostChangeList, _receivedData.IsSpellCharge, _receivedData.IsAdd)); + } + + public void PowerUpOperation() + { + List cardListFromCardNameList = GetCardListFromCardNameList(_receivedData.DestroyCardNameList); + List cardListFromCardNameList2 = GetCardListFromCardNameList(_receivedData.BanishCardNameList); + BattleCardBase playVoiceOnDeathCard = GetPlayVoiceOnDeathCard(_receivedData.PlayVoiceOnDeathCard); + RegisterSequentialVfx(_networkReplayBattleMgr.PowerUp(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.Attack, _receivedData.Life, _receivedData.MultiplyAttack, _receivedData.MultiplyLife, _receivedData.MaxLife, cardListFromCardNameList, _receivedData.DestroyTypeList, cardListFromCardNameList2, _receivedData.EffectInfo, playVoiceOnDeathCard, _receivedData.SideLogSkillInfoList)); + } + + public void GainPowerDownOperation() + { + List cardListFromCardNameList = GetCardListFromCardNameList(_receivedData.DestroyCardNameList); + List cardListFromCardNameList2 = GetCardListFromCardNameList(_receivedData.BanishCardNameList); + BattleCardBase playVoiceOnDeathCard = GetPlayVoiceOnDeathCard(_receivedData.PlayVoiceOnDeathCard); + RegisterSequentialVfx(_networkReplayBattleMgr.GainPowerDown(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.Attack, _receivedData.Life, _receivedData.MaxLife, cardListFromCardNameList, _receivedData.DestroyTypeList, cardListFromCardNameList2, _receivedData.EffectInfo, playVoiceOnDeathCard, _receivedData.SideLogSkillInfoList)); + } + + public void SetPowerDownOperation() + { + List cardListFromCardNameList = GetCardListFromCardNameList(_receivedData.DestroyCardNameList); + List cardListFromCardNameList2 = GetCardListFromCardNameList(_receivedData.BanishCardNameList); + BattleCardBase playVoiceOnDeathCard = GetPlayVoiceOnDeathCard(_receivedData.PlayVoiceOnDeathCard); + RegisterSequentialVfx(_networkReplayBattleMgr.SetPowerDown(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.Attack, _receivedData.Life, _receivedData.MaxLife, cardListFromCardNameList, _receivedData.DestroyTypeList, cardListFromCardNameList2, _receivedData.EffectInfo, playVoiceOnDeathCard, _receivedData.SideLogSkillInfoList)); + } + + public void DepriveBuffOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.DepriveBuff(GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.DepriveOffenseBuffList, _receivedData.DepriveLifeBuffList)); + } + + public void SpellChargeOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.SpellCharge(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.AddSpellChargeList, _receivedData.EffectInfo)); + } + + private BattleCardBase GetPlayVoiceOnDeathCard(string card) + { + if (string.IsNullOrEmpty(card)) + { + return null; + } + List source = (IsPlayerCardName(card) ? ReplayBattlePlayer.AllCardsWithCemeteryAndBanish : ReplayBattleEnemy.AllCardsWithCemeteryAndBanish); + return _networkReplayBattleMgr.GetBattleCardIdx(source.ToList(), Convert.ToInt32(card.Substring(1))); + } + + private List GetCardListFromCardNameList(List cardNameList) + { + List list = new List(); + for (int i = 0; i < cardNameList.Count; i++) + { + List list2 = (IsPlayerCardName(cardNameList[i]) ? ReplayBattlePlayer.AllCardsWithSkillIngredient : ReplayBattleEnemy.AllCardsWithSkillIngredient); + list.Add(_networkReplayBattleMgr.GetBattleCardIdx(list2, Convert.ToInt32(cardNameList[i].Substring(1)))); + } + return list; + } + + private BattleCardBase GetOwnerCard(string cardName) + { + if (string.IsNullOrEmpty(cardName)) + { + return null; + } + List list = (IsPlayerCardName(cardName) ? ReplayBattlePlayer.AllCardsWithSkillIngredient : ReplayBattleEnemy.AllCardsWithSkillIngredient); + return _networkReplayBattleMgr.GetBattleCardIdx(list, Convert.ToInt32(cardName.Substring(1))); + } + + private bool IsPlayerCardName(string name) + { + return name.Substring(0, 1) == "p"; + } + + public void DamageOperation() + { + List cardListFromCardNameList = GetCardListFromCardNameList(_receivedData.DestroyCardNameList); + List cardListFromCardNameList2 = GetCardListFromCardNameList(_receivedData.BanishCardNameList); + BattleCardBase playVoiceOnDeathCard = GetPlayVoiceOnDeathCard(_receivedData.PlayVoiceOnDeathCard); + RegisterSequentialVfx(_networkReplayBattleMgr.Damage(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.DealDamageList, cardListFromCardNameList, _receivedData.DestroyTypeList, cardListFromCardNameList2, _receivedData.EffectInfo, _receivedData.IsReflectionDamage, playVoiceOnDeathCard, _receivedData.SideLogSkillInfoList, GetCardListFromCardNameList(_receivedData.EffectTargetCardNameList))); + } + + public void HealOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.Heal(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.HealList, _receivedData.EffectInfo)); + } + + public void DiscardOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.Discard(GetCardListFromCardNameList(_receivedData.CardNameList))); + } + + public void DestroyOrBanishOperation() + { + BattleCardBase playVoiceOnDeathCard = GetPlayVoiceOnDeathCard(_receivedData.PlayVoiceOnDeathCard); + List list = new List(); + if (_receivedData.IsOpen) + { + if (_receivedData.CardInfoList != null) + { + if (_receivedData.isSelf) + { + for (int i = 0; i < _receivedData.CardInfoList.Count; i++) + { + BattleCardBase battleCardIdx = _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.DeckCardList, _receivedData.CardInfoList[i].Index); + _networkReplayBattleMgr.ClearAndUpdateParameterModifier(battleCardIdx, _receivedData.CardInfoList[i]); + list.Add(battleCardIdx); + } + } + else + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + for (int j = 0; j < _receivedData.CardInfoList.Count; j++) + { + BattleCardBase battleCardIdx2 = _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattleEnemy.DeckCardList, _receivedData.CardInfoList[j].Index); + VfxWith vfxWith = _networkReplayBattleMgr.ReplaceReceivedCard(battleCardIdx2, _receivedData.CardInfoList[j], ReplayBattleEnemy, isFusion: false); + list.Add(vfxWith.Value); + parallelVfxPlayer.Register(vfxWith.Vfx); + } + RegisterSequentialVfx(parallelVfxPlayer); + } + } + } + else + { + list = GetCardListFromCardNameList(_receivedData.BanishCardNameList); + } + RegisterSequentialVfx(_networkReplayBattleMgr.DestroyOrBanish(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.DestroyCardNameList), _receivedData.DestroyTypeList, list, GetCardListFromCardNameList(_receivedData.IndestructibleCardNameList), _receivedData.EffectInfo, playVoiceOnDeathCard, _receivedData.IsBurialRite, _receivedData.IsOpen, _receivedData.SideLogSkillInfoList)); + } + + public void EvolveOperation() + { + if (_receivedData.CardInfo.IsSelf) + { + RegisterSequentialVfx(ReplayBattlePlayer.Evolve(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.ClassAndInPlayCardList, _receivedData.CardInfo.Index), !_receivedData.IsNotConsumeEp, _receivedData.TransformCardId, _receivedData.CardInfo, _receivedData.CardInfoList)); + } + else + { + RegisterSequentialVfx(ReplayBattleEnemy.Evolve(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattleEnemy.ClassAndInPlayCardList, _receivedData.CardInfo.Index), !_receivedData.IsNotConsumeEp, _receivedData.TransformCardId, _receivedData.CardInfo)); + } + } + + public void SkillEvolveOperation() + { + if (_receivedData.isSelf) + { + RegisterSequentialVfx(_networkReplayBattleMgr.SkillEvolve(GetOwnerCard(_receivedData.OwnerCardName), ReplayBattlePlayer.ClassAndInPlayCardList, _receivedData.CardInfoList, _receivedData.EffectInfo, _receivedData.EvolveMeWhenAttackIndex)); + } + else + { + RegisterSequentialVfx(_networkReplayBattleMgr.SkillEvolve(GetOwnerCard(_receivedData.OwnerCardName), ReplayBattleEnemy.ClassAndInPlayCardList, _receivedData.CardInfoList, _receivedData.EffectInfo, _receivedData.EvolveMeWhenAttackIndex)); + } + } + + public void ReturnOperation() + { + BattleCardBase playVoiceOnDeathCard = GetPlayVoiceOnDeathCard(_receivedData.PlayVoiceOnDeathCard); + RegisterSequentialVfx(_networkReplayBattleMgr.Return(GetCardListFromCardNameList(_receivedData.CardNameList), GetCardListFromCardNameList(_receivedData.BanishCardNameList), GetCardListFromCardNameList(_receivedData.DestroyCardNameList), _receivedData.DestroyTypeList, _receivedData.SideLogSkillInfoList, playVoiceOnDeathCard)); + if (_receivedData.CardInfoList != null) + { + RegisterSequentialVfx(_networkReplayBattleMgr.UpdateHandInfo(ReplayBattlePlayer.HandCardList, ReplayBattleEnemy.HandCardList, _receivedData.CardInfoList, ReplayBattlePlayer.AllCardsWithSkillIngredient, ReplayBattleEnemy.AllCardsWithSkillIngredient)); + } + } + + public void StartSelectOperation() + { + if (_receivedData.IsEvolve || _receivedData.IsChoiceBraveData) + { + RegisterSequentialVfx(ReplayBattlePlayer.StartSelect(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.ClassAndInPlayCardList, _receivedData.CardIndex), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.IsEvolve, _receivedData.CardInfo, _receivedData.IsChoiceBraveData)); + } + else + { + RegisterSequentialVfx(ReplayBattlePlayer.StartSelect(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.HandCardList, _receivedData.CardIndex), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.IsEvolve, _receivedData.CardInfo, isChoiceBrave: false)); + } + } + + public void SelectOperation() + { + IEnumerable source = (IsPlayerCardName(_receivedData.SelectCard) ? ReplayBattlePlayer.AllCards : ReplayBattleEnemy.AllCards); + BattleCardBase battleCardIdx = _networkReplayBattleMgr.GetBattleCardIdx(source.ToList(), Convert.ToInt32(_receivedData.SelectCard.Substring(1))); + if (_receivedData.IsEvolve || _receivedData.IsChoiceBraveData) + { + RegisterSequentialVfx(ReplayBattlePlayer.Select(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.ClassAndInPlayCardList, _receivedData.CardIndex), battleCardIdx, GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.IsEvolve, _receivedData.CardInfo, _receivedData.IsBurialRite)); + } + else + { + RegisterSequentialVfx(ReplayBattlePlayer.Select(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.HandCardList, _receivedData.CardIndex), battleCardIdx, GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.IsEvolve, _receivedData.CardInfo, _receivedData.IsBurialRite)); + } + } + + public void CompleteSelectOperation() + { + RegisterSequentialVfx(ReplayBattlePlayer.CompleteSelect(_networkReplayBattleMgr.GetBattleCardIdx((_receivedData.IsEvolve || _receivedData.IsChoiceBraveData) ? ReplayBattlePlayer.ClassAndInPlayCardList : ReplayBattlePlayer.HandCardList, _receivedData.CardIndex), GetCardListFromCardNameList(_receivedData.CardNameList)[0], _receivedData.IsEvolve, _receivedData.IsBurialRite, _receivedData.IsChoiceBraveData)); + } + + public void CancelSelectOperation() + { + if (_receivedData.IsEvolve || _receivedData.IsChoiceBraveData) + { + RegisterSequentialVfx(ReplayBattlePlayer.CancelSelect(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.ClassAndInPlayCardList, _receivedData.CardIndex), _receivedData.IsEvolve, _receivedData.IsChoiceBraveData)); + } + else + { + RegisterSequentialVfx(ReplayBattlePlayer.CancelSelect(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.HandCardList, _receivedData.CardIndex), _receivedData.IsEvolve, _receivedData.IsChoiceBraveData)); + } + } + + public void StartChoiceOperation() + { + if (_receivedData.IsEvolve || _receivedData.IsChoiceBraveData) + { + RegisterSequentialVfx(ReplayBattlePlayer.StartChoice(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.ClassAndInPlayCardList, _receivedData.CardIndex), _receivedData.CardInfoList, _receivedData.IsEvolve)); + } + else + { + RegisterSequentialVfx(ReplayBattlePlayer.StartChoice(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.HandCardList, _receivedData.CardIndex), _receivedData.CardInfoList, _receivedData.IsEvolve)); + } + } + + public void CompleteChoiceOperation() + { + RegisterSequentialVfx(ReplayBattlePlayer.SelectChoice(_receivedData.TargetIndexList, _receivedData.IsTransformSelect)); + RegisterSequentialVfx(ReplayBattlePlayer.CompleteChoice(_networkReplayBattleMgr.GetBattleCardIdx((_receivedData.IsEvolve || _receivedData.IsChoiceBraveData) ? ReplayBattlePlayer.ClassAndInPlayCardList : ReplayBattlePlayer.HandCardList, _receivedData.CardIndex), _receivedData.IsTransformSelect, _receivedData.IsEvolve, _receivedData.IsChoiceBraveData)); + } + + public void CancelChoiceOperation() + { + if (_receivedData.IsEvolve || _receivedData.IsChoiceBraveData) + { + RegisterSequentialVfx(ReplayBattlePlayer.CancelChoice(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.ClassAndInPlayCardList, _receivedData.CardIndex), _receivedData.IsEvolve)); + } + else + { + RegisterSequentialVfx(ReplayBattlePlayer.CancelChoice(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.HandCardList, _receivedData.CardIndex), _receivedData.IsEvolve)); + } + } + + public void StartFusionOperation() + { + List selectableCards = _receivedData.TargetIndexList.Select((int i) => _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.HandCardList, i)).ToList(); + RegisterSequentialVfx(ReplayBattlePlayer.StartFusion(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.HandCardList, _receivedData.CardIndex), selectableCards, _receivedData.CardInfo)); + } + + public void SelectFusionOperation() + { + RegisterSequentialVfx(ReplayBattlePlayer.SelectFusion(_receivedData.CardIndex, _receivedData.IsActive, _receivedData.MaxSelectCount, _receivedData.CanFusionMetamorphose)); + RegisterSequentialVfx(WaitVfx.Create(0.5f)); + } + + public void CompleteFusionOperation() + { + if (_receivedData.isSelf) + { + List ingredientCards = _receivedData.CardInfoList.Select((NetworkBattleReceiver.CardInfo i) => _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.HandCardList, i.Index)).ToList(); + RegisterSequentialVfx(ReplayBattlePlayer.CompleteFusion(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.HandCardList, _receivedData.CardInfo.Index), ingredientCards, _receivedData.CardInfo, _receivedData.IsFusionMetamorphose, _receivedData.FusionMetamorphoseCardId, _receivedData.SideLogSkillInfoList)); + return; + } + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattleCardBase battleCardIdx = _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattleEnemy.HandCardList, _receivedData.CardInfo.Index); + VfxWith vfxWith = _networkReplayBattleMgr.ReplaceReceivedCard(battleCardIdx, _receivedData.CardInfo, ReplayBattleEnemy, isFusion: true); + battleCardIdx = vfxWith.Value; + battleCardIdx.BattleCardView.UpdateParameterView(battleCardIdx.Atk, battleCardIdx.Life, _receivedData.CardInfo.Cost, battleCardIdx.BaseParameter.CardName, battleCardIdx.IsInplay); + sequentialVfxPlayer.Register(vfxWith.Vfx); + List list = new List(); + for (int num = 0; num < _receivedData.CardInfoList.Count; num++) + { + BattleCardBase battleCardIdx2 = _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattleEnemy.HandCardList, _receivedData.CardInfoList[num].Index); + VfxWith vfxWith2 = _networkReplayBattleMgr.ReplaceReceivedCard(battleCardIdx2, _receivedData.CardInfoList[num], ReplayBattleEnemy, isFusion: true); + BattleCardBase value = vfxWith2.Value; + value.BattleCardView.UpdateParameterView(value.Atk, value.Life, _receivedData.CardInfoList[num].Cost, value.BaseParameter.CardName, value.IsInplay); + list.Add(value); + sequentialVfxPlayer.Register(vfxWith2.Vfx); + } + RegisterSequentialVfx(sequentialVfxPlayer); + RegisterSequentialVfx(ReplayBattleEnemy.CompleteFusion(battleCardIdx, list, _receivedData.CardInfo, _receivedData.IsFusionMetamorphose, _receivedData.FusionMetamorphoseCardId, _receivedData.SideLogSkillInfoList)); + } + + public void CancelFusionOperation() + { + RegisterSequentialVfx(ReplayBattlePlayer.CancelFusion(_networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.HandCardList, _receivedData.CardIndex))); + } + + public void ChantCountChangeOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.ChantCountChange(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.ChangeCount, _receivedData.EffectInfo)); + } + + public void ChangeWhiteRitualStackOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.ChangeWhiteRitualStack(GetCardListFromCardNameList(_receivedData.CardNameList).First(), _receivedData.ChangeCount, _receivedData.IsDestroy, _receivedData.CardInfo)); + } + + public void Necromance() + { + RegisterSequentialVfx(_networkReplayBattleMgr.Necromance(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.IsFusionNecromance)); + } + + public void ChangeMaxAttackableCountOperation() + { + List cardListFromCardNameList = GetCardListFromCardNameList(_receivedData.CardNameList); + for (int i = 0; i < cardListFromCardNameList.Count(); i++) + { + cardListFromCardNameList.ElementAt(i).attackCountinfo.Add(new BattleCardBase.SetAttackCountInfo(null, _receivedData.ChangeCount)); + } + } + + public void UpdateDeckOperation() + { + if (_receivedData.isSelf) + { + RegisterSequentialVfx(ReplayBattlePlayer.UpdateDeck(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.CardInfoList, _receivedData.IsChange, _receivedData.IsOpen, _receivedData.EffectInfo)); + } + else + { + RegisterSequentialVfx(ReplayBattleEnemy.UpdateDeck(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.CardInfoList, _receivedData.IsChange, _receivedData.IsOpen, _receivedData.EffectInfo)); + } + } + + public void IndexChangeOperation() + { + if (_receivedData.isSelf) + { + _networkReplayBattleMgr.IndexChange(ReplayBattlePlayer, _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.DeckCardList, _receivedData.CardIndexList[0]), _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.DeckCardList, _receivedData.CardIndexList[1])); + } + else + { + _networkReplayBattleMgr.IndexChange(ReplayBattleEnemy, _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattleEnemy.DeckCardList, _receivedData.CardIndexList[0]), _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattleEnemy.DeckCardList, _receivedData.CardIndexList[1])); + } + } + + public void MetamorphoseOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.Metamorphose(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.CardIdList, _receivedData.EffectInfo)); + } + + public void GetonOperation() + { + if (_receivedData.isSelf) + { + List targets = _receivedData.TargetIndexList.Select((int i) => _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.ClassAndInPlayCardList, i)).ToList(); + RegisterSequentialVfx(_networkReplayBattleMgr.Geton(GetOwnerCard(_receivedData.OwnerCardName), targets, _receivedData.EffectInfo)); + } + else + { + List targets2 = _receivedData.TargetIndexList.Select((int i) => _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattleEnemy.ClassAndInPlayCardList, i)).ToList(); + RegisterSequentialVfx(_networkReplayBattleMgr.Geton(GetOwnerCard(_receivedData.OwnerCardName), targets2, _receivedData.EffectInfo)); + } + } + + public void GetoffOperation() + { + if (_receivedData.isSelf) + { + RegisterSequentialVfx(ReplayBattlePlayer.Getoff(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.CardInfoList, _receivedData.EffectInfo)); + } + else + { + RegisterSequentialVfx(ReplayBattleEnemy.Getoff(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.CardInfoList, _receivedData.EffectInfo)); + } + } + + public void UniteOperation() + { + if (_receivedData.isSelf) + { + RegisterSequentialVfx(ReplayBattlePlayer.Unite(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.CardIdList[0], _receivedData.CardIndexList[0], _receivedData.EffectInfo)); + } + else + { + RegisterSequentialVfx(ReplayBattleEnemy.Unite(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.CardIdList[0], _receivedData.CardIndexList[0], _receivedData.EffectInfo)); + } + } + + public void OpenCardOperation() + { + if (_receivedData.isSelf) + { + BattleCardBase battleCardIdx = _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattlePlayer.HandCardList, _receivedData.CardInfo.Index); + RegisterSequentialVfx(ReplayBattlePlayer.OpenCard(battleCardIdx)); + return; + } + BattleCardBase battleCardIdx2 = _networkReplayBattleMgr.GetBattleCardIdx(ReplayBattleEnemy.HandCardList, _receivedData.CardInfo.Index); + VfxWith vfxWith = _networkReplayBattleMgr.ReplaceReceivedCard(battleCardIdx2, _receivedData.CardInfo, ReplayBattleEnemy, isFusion: false); + battleCardIdx2 = vfxWith.Value; + RegisterSequentialVfx(vfxWith.Vfx); + RegisterSequentialVfx(ReplayBattleEnemy.OpenCard(battleCardIdx2, _receivedData.CardInfo.Cost, _receivedData.IsLastDrawOpenCard)); + } + + public void ShowSkillEffectOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.ShowSkillEffect(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.EffectInfo)); + } + + public void ShowSkillInductionEffect() + { + RegisterSequentialVfx(_networkReplayBattleMgr.ShowSkillInductionEffect(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.SkillVoice, _receivedData.IsIgnoreVoice, _receivedData.CardInfo)); + } + + public void ShowIndependentEffect() + { + RegisterSequentialVfx(_networkReplayBattleMgr.ShowIndependentEffect(GetCardListFromCardNameList(_receivedData.CardNameList))); + } + + public void ChangeAffiliationOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.ShowChangeAffiliation(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.Clan, _receivedData.Tribe, _receivedData.EffectInfo)); + } + + public void ShowChangeUnionBurstAndSkyboundArtEffect() + { + RegisterSequentialVfx(_networkReplayBattleMgr.ShowChangeUnionBurstAndSkyboundArtEffect(GetCardListFromCardNameList(_receivedData.CardNameList))); + } + + public void ShowRepeatSkillEffect() + { + RegisterSequentialVfx(_networkReplayBattleMgr.ShowRepeatSkillEffect(_receivedData.isSelf)); + } + + public void GiveCantActivateFanfareOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.GiveCantActivateFanfare(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.EffectInfo)); + } + + public void DepriveCantActivateFanfareOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.DepriveCantActivateFanfare(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList))); + } + + public void LoseSkillOperation() + { + RegisterSequentialVfx(_networkReplayBattleMgr.LoseSkill(GetOwnerCard(_receivedData.OwnerCardName), GetCardListFromCardNameList(_receivedData.CardNameList), _receivedData.EffectInfo)); + } + + public void UpdateHandInfo() + { + RegisterSequentialVfx(_networkReplayBattleMgr.UpdateHandInfo(ReplayBattlePlayer.HandCardList, ReplayBattleEnemy.HandCardList, _receivedData.CardInfoList, ReplayBattlePlayer.AllCardsWithSkillIngredient, ReplayBattleEnemy.AllCardsWithSkillIngredient, _receivedData.IsImmediate)); + } + + public void UpdateChoiceBraveButtonEffet() + { + RegisterSequentialVfx(_networkReplayBattleMgr.UpdateChoiceBraveButtonEffet(_receivedData.IsActive, _receivedData.IsImmediate)); + } + + public void UpdateInplayInfo() + { + RegisterSequentialVfx(_networkReplayBattleMgr.UpdateInplayInfo(ReplayBattlePlayer.ClassAndInPlayCardList, ReplayBattleEnemy.ClassAndInPlayCardList, _receivedData.CardInfoList, ReplayBattlePlayer.AllCardsWithSkillIngredient, ReplayBattleEnemy.AllCardsWithSkillIngredient, ReplayBattlePlayer.IsSelfTurn, isInitialize: false, _receivedData.OnlyEffect, _receivedData.OnlyAttackEffect, _receivedData.UpdateAttackEffect, _receivedData.UseRecordAttackEffect)); + } + + public void UpdateDeckInfo() + { + RegisterSequentialVfx(_networkReplayBattleMgr.UpdateDeckOrReservedInfo(ReplayBattlePlayer.DeckCardList, ReplayBattleEnemy.DeckCardList, _receivedData.CardInfoList)); + } + + public void UpdateAttachedCardInfo() + { + _networkReplayBattleMgr.UpdateAttachedCardInfo(ReplayBattlePlayer.AllCardsWithSkillIngredient, ReplayBattleEnemy.AllCardsWithSkillIngredient, _receivedData.CardInfoList); + } + + public void UpdateFusionCardInfo() + { + for (int i = 0; i < _receivedData.CardInfoList.Count; i++) + { + _networkReplayBattleMgr.UpdateFusionCardInfo(_receivedData.CardInfoList[i]); + } + } + + public void UpdateStatusPanel() + { + _networkReplayBattleMgr.UpdateStatusPanel(_receivedData.PlayerStatusPanelInfo, _receivedData.EnemyStatusPanelInfo); + } + + public void UpdateBattleLog() + { + RegisterSequentialVfx(_networkReplayBattleMgr.UpdateBattleLog(ReplayBattlePlayer.AllCardsWithSkillIngredient, ReplayBattleEnemy.AllCardsWithSkillIngredient, _receivedData.BattleLogIndex, new List())); + } + + public void UpdateClassInfoUi() + { + _networkReplayBattleMgr.UpdateClassInfoUi(_receivedData.PlayerClassInfo, _receivedData.EnemyClassInfo); + } + + public void UpdateMyRotationBonus() + { + _networkReplayBattleMgr.UpdateMyRotationBonus(_receivedData.MyRotationBonusInfoList); + } + + public void UpdateAvatarBattleDescValueList() + { + _networkReplayBattleMgr.UpdateAvatarBattleDescValueList(_receivedData.PlayerAvatarBattleDescInfo, _receivedData.EnemyAvatarBattleDescInfo); + } + + public void UpdateAttackableEffect() + { + RegisterSequentialVfx(_networkReplayBattleMgr.UpdateAttackableEffect(ReplayBattlePlayer.ClassAndInPlayCardList, ReplayBattleEnemy.ClassAndInPlayCardList, _receivedData.CardInfoList, ReplayBattlePlayer.IsSelfTurn)); + } + + public void SkillProcessStart() + { + RegisterSequentialVfx(_networkReplayBattleMgr.CreateSkillSideLog(_receivedData.SideLogSkillInfoList)); + } + + public void SkillVfxStart() + { + _networkReplayBattleMgr.IsDuringSkillProcess = true; + _networkReplayBattleMgr.SkillVfxStack.Push(VfxWithLoadingSequential.Create()); + } + + public void SkillVfxEnd() + { + VfxWithLoadingSequential vfxWithLoadingSequential = _networkReplayBattleMgr.SkillVfxStack.Pop(); + if (_networkReplayBattleMgr.SkillVfxStack.Count > 0) + { + _networkReplayBattleMgr.SkillVfxStack.Peek().RegisterToMainVfx(vfxWithLoadingSequential); + return; + } + _networkReplayBattleMgr.IsDuringSkillProcess = false; + RegisterSequentialVfx(vfxWithLoadingSequential); + } + + public void ClearSideLog() + { + SideLogControl sideLogControl = (_receivedData.isSelf ? ReplayBattlePlayer.BattleView.GetSideLogControl(isSkillTargetSelect: false) : ReplayBattleEnemy.BattleView.GetSideLogControl(isSkillTargetSelect: false)); + RegisterSequentialVfx(sideLogControl.ClearLastShowLogCard()); + } + + public void ClearDestroyedCardList() + { + _networkReplayBattleMgr.OperateMgr.BattleLogManager.ClearDestroyedCardList(_receivedData.isSelf); + } + + public void PlayEmotion() + { + if (_receivedData.isSelf) + { + RegisterSequentialVfx(ReplayBattlePlayer.PlayEmotion(_receivedData.EmoteType)); + } + else + { + RegisterSequentialVfx(ReplayBattleEnemy.PlayEmotion(_receivedData.EmoteType)); + } + } + + public void AttachShortageDeckWin() + { + RegisterSequentialVfx(_networkReplayBattleMgr.AttachShortageDeckWin(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.EffectInfo)); + } + + public void ShortageDeckWin() + { + if (_receivedData.isSelf) + { + RegisterSequentialVfx(_networkReplayBattleMgr.ShortageDeckWin(ReplayBattlePlayer)); + } + else + { + RegisterSequentialVfx(_networkReplayBattleMgr.ShortageDeckWin(ReplayBattleEnemy)); + } + } + + public void ShortageDeckLose() + { + RegisterSequentialVfx(_networkReplayBattleMgr.ShortageDeckLose(_receivedData.isSelf)); + } + + public void SpecialWin() + { + RegisterSequentialVfx(_networkReplayBattleMgr.SpecialWin(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.EffectInfo)); + } + + public void SpecialLose() + { + RegisterSequentialVfx(_networkReplayBattleMgr.SpecialLose(GetOwnerCard(_receivedData.OwnerCardName), _receivedData.EffectInfo)); + } + + public void BattleFinish() + { + RegisterSequentialVfx(_networkReplayBattleMgr.BattleFinish(_receivedData.isWin, _receivedData.IsPlayerDead, _receivedData.IsEnemyDead, _receivedData.FinishType, _receivedData.ResultCode)); + } +} diff --git a/SVSim.BattleEngine/Engine/NtDataTranslateInfo.cs b/SVSim.BattleEngine/Engine/NtDataTranslateInfo.cs new file mode 100644 index 0000000..bb1bdc5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NtDataTranslateInfo.cs @@ -0,0 +1,212 @@ +using System.Collections; +using Cute; +using LitJson; +using Wizard; + +public class NtDataTranslateInfo +{ + public const string TITLESTATEMENT = "titleStatement"; + + public const string CONTAINSTATEMENT = "containStatement"; + + public const string TITLEEMAIL = "titleEmail"; + + public const string EMAILADDRESS1 = "emailAddress1"; + + public const string EMAILADDRESS2 = "emailAddress2"; + + public const string EMAILADDRESSTIP1 = "emailAddressTip1"; + + public const string EMAILADDRESSTIP2 = "emailAddressTip2"; + + public const string TITLESUCCESS = "titleSuccess"; + + public const string CONTAINSUCCESS = "containSuccess"; + + public const string TITLETIP = "titleTip"; + + public const string CONTAINTIP = "containTip"; + + public const string TITLEREBIND = "titleRebind"; + + public const string CONTAINREBIND = "containRebind"; + + public const string ERRORID = "ERROR_ID"; + + public const string ERRORTITLE = "ERROR_TITLE"; + + public const string ERRORCONTAIN1 = "ERROR_CONTAIN1"; + + public const string ERRORCONTAIN2 = "ERROR_CONTAIN2"; + + public const string ERRORCONTAIN3 = "ERROR_CONTAIN3"; + + public const string ERRORCONTAIN4 = "ERROR_CONTAIN4"; + + public const string ERRORCONTAIN5 = "ERROR_CONTAIN5"; + + public const string ERRORCONTAIN6 = "ERROR_CONTAIN6"; + + public const string ERRORCONTAIN7 = "ERROR_CONTAIN7"; + + public const string SERVERURL = "serverUrl"; + + public const string BUTTONTEXT = "buttonTitle"; + + public const string BUTTONTEXT_ID1 = "buttonText_ID1"; + + public const string BUTTONTEXT_ID2 = "buttonText_ID2"; + + public const string BUTTONTEXT_ID3 = "buttonText_ID3"; + + public const string BUTTONTEXT_ID4 = "buttonText_ID4"; + + public const string BUTTONTEXT_ID5 = "buttonText_ID5"; + + public const string BUTTONTEXT_ID6 = "buttonText_ID6"; + + public const string BUTTONTEXT_ID7 = "buttonText_ID7"; + + public string titleStatement = ""; + + public string containStatement = ""; + + public string titleEmail = ""; + + public string emailAddress1 = ""; + + public string emailAddress2 = ""; + + public string emailAddressTip1 = ""; + + public string emailAddressTip2 = ""; + + public string titleSuccess = ""; + + public string containSuccess = ""; + + public string titleTip = ""; + + public string containTip = ""; + + public string titleRebind = ""; + + public string containRebind = ""; + + public string ERROR_TITLE = ""; + + public string ERROR_CONTAIN1 = ""; + + public string ERROR_CONTAIN2 = ""; + + public string ERROR_CONTAIN3 = ""; + + public string ERROR_CONTAIN4 = ""; + + public string ERROR_CONTAIN5 = ""; + + public string ERROR_CONTAIN6 = ""; + + public string ERROR_CONTAIN7 = ""; + + public string serverUrl = ""; + + public string buttonTitle = ""; + + public string button_id1 = ""; + + public string button_id2 = ""; + + public string button_id3 = ""; + + public string button_id4 = ""; + + public string button_id5 = ""; + + public string button_id6 = ""; + + public string button_id7 = ""; + + public static NtDataTranslateInfo Init() + { + SystemText systemText = Data.SystemText; + return new NtDataTranslateInfo + { + titleStatement = systemText.Get("Account_0113"), + containStatement = systemText.Get("Account_0114"), + titleEmail = systemText.Get("Account_0115"), + emailAddress1 = systemText.Get("Account_0116"), + emailAddress2 = systemText.Get("Account_0117"), + emailAddressTip1 = systemText.Get("Account_0118"), + emailAddressTip2 = systemText.Get("Account_0119"), + titleSuccess = systemText.Get("Account_0120"), + containSuccess = systemText.Get("Account_0121"), + titleTip = systemText.Get("Account_0122"), + containTip = systemText.Get("Account_0123"), + titleRebind = systemText.Get("Account_0124"), + containRebind = systemText.Get("Account_0125"), + ERROR_TITLE = systemText.Get("Account_0126"), + ERROR_CONTAIN1 = systemText.Get("Account_0127"), + ERROR_CONTAIN2 = systemText.Get("Account_0128"), + ERROR_CONTAIN4 = systemText.Get("Account_0130"), + ERROR_CONTAIN5 = systemText.Get("Account_0131"), + ERROR_CONTAIN6 = systemText.Get("Account_0132"), + ERROR_CONTAIN7 = systemText.Get("Account_0133"), + serverUrl = CustomPreference.GetApplicationServerURL(), + buttonTitle = systemText.Get("Account_0137"), + button_id1 = systemText.Get("Account_0134"), + button_id2 = systemText.Get("Account_0135"), + button_id3 = systemText.Get("Account_0136"), + button_id4 = systemText.Get("Account_0136"), + button_id5 = systemText.Get("Account_0134"), + button_id6 = systemText.Get("Account_0135"), + button_id7 = systemText.Get("Account_0136") + }; + } + + public static bool ContainsKey(JsonData json, string key) + { + if (((IDictionary)json).Contains((object)key)) + { + return true; + } + return false; + } + + public JsonData toJsonData() + { + return new JsonData + { + ["titleStatement"] = titleStatement, + ["containStatement"] = containStatement, + ["titleEmail"] = titleEmail, + ["emailAddress1"] = emailAddress1, + ["emailAddress2"] = emailAddress2, + ["emailAddressTip1"] = emailAddressTip1, + ["emailAddressTip2"] = emailAddressTip2, + ["titleSuccess"] = titleSuccess, + ["containSuccess"] = containSuccess, + ["titleTip"] = titleTip, + ["containTip"] = containTip, + ["titleRebind"] = titleRebind, + ["containRebind"] = containRebind, + ["ERROR_TITLE"] = ERROR_TITLE, + ["ERROR_CONTAIN1"] = ERROR_CONTAIN1, + ["ERROR_CONTAIN2"] = ERROR_CONTAIN2, + ["ERROR_CONTAIN3"] = ERROR_CONTAIN3, + ["ERROR_CONTAIN4"] = ERROR_CONTAIN4, + ["ERROR_CONTAIN5"] = ERROR_CONTAIN5, + ["ERROR_CONTAIN6"] = ERROR_CONTAIN6, + ["ERROR_CONTAIN7"] = ERROR_CONTAIN7, + ["serverUrl"] = serverUrl, + ["buttonTitle"] = buttonTitle, + ["buttonText_ID1"] = button_id1, + ["buttonText_ID2"] = button_id2, + ["buttonText_ID3"] = button_id3, + ["buttonText_ID4"] = button_id4, + ["buttonText_ID5"] = button_id5, + ["buttonText_ID6"] = button_id6, + ["buttonText_ID7"] = button_id7 + }; + } +} diff --git a/SVSim.BattleEngine/Engine/NtDataTranslateManager.cs b/SVSim.BattleEngine/Engine/NtDataTranslateManager.cs new file mode 100644 index 0000000..c55e9ea --- /dev/null +++ b/SVSim.BattleEngine/Engine/NtDataTranslateManager.cs @@ -0,0 +1,248 @@ +using System; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.ErrorDialog; + +public class NtDataTranslateManager +{ + private static NtDataTranslateManager instance; + + public NtDataTranslateInfo TranslateInfo; + + public bool isTranslate; + + public string curBindEmail = ""; + + public const string FIRST_LOOK = "FIRST_LOOK"; + + public const int RC_NETEASE_DATA_TRANSACTION_SAME_EMAIL = 99401; + + public const int RC_NETEASE_DATA_TRANSACTION_RESPONE_ERROR = 99402; + + public const int RC_NETEASE_DATA_TRANSACTION_MAIL_ERROR = 99403; + + public const int RC_NETEASE_DATA_TRANSACTION_FREQUENTCY = 99404; + + public const int RC_NETEASE_DATA_TRANSACTION_DAILY_MAX = 99405; + + public const int RC_NETEASE_DATA_TRANSACTION_SYS_ERROR = 99406; + + public const int RC_NETEASE_DATA_TRANSACTION_CURL_ERROR = 99407; + + public const int RC_NETEASE_DATA_TRANSACTION_UNKNOWN_ERROR = 99408; + + private NtDataTranslateManager() + { + TranslateInfo = NtDataTranslateInfo.Init(); + } + + public static NtDataTranslateManager GetInstance() + { + if (instance == null) + { + instance = new NtDataTranslateManager(); + } + return instance; + } + + public string GetTranslateInfoUrl() + { + return string.Format("{0}{1}", TranslateInfo.serverUrl, "netease_data_transaction/get_email_address"); + } + + public string GetSetTranslateInfoUrl() + { + return string.Format("{0}{1}", TranslateInfo.serverUrl, "netease_data_transaction/set_email_address"); + } + + public bool CheckViewCanShow() + { + return false; + } + + public void GetTranslateInfo(Action callBack = null) + { + TranslateInfo = NtDataTranslateInfo.Init(); + NtDataTranslate.Instance.TxtTranslate.text = TranslateInfo.buttonTitle; + if (GetInstance().CheckViewCanShow()) + { + NtDataTranslate.Instance.BtnTranslate.SetActive(value: true); + } + else + { + NtDataTranslate.Instance.BtnTranslate.SetActive(value: false); + } + callBack.Call(); + } + + public void ShowStatement() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(TranslateInfo.titleStatement); + dialogBase.SetText(TranslateInfo.containStatement); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetButtonText(TranslateInfo.button_id1, TranslateInfo.button_id2); + dialogBase.onPushButton1 = delegate + { + ShowAddress(); + }; + } + + public void HongKongMacaoUserConfirm() + { + SystemText systemText = Wizard.Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Account_0142")); + dialogBase.SetText(systemText.Get("Account_0143")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetButtonText(systemText.Get("Common_0001"), systemText.Get("Common_0002")); + dialogBase.onPushButton1 = delegate + { + ConfirmAgreement(); + }; + } + + public void ConfirmAgreement() + { + SystemText systemText = Wizard.Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Account_0138")); + dialogBase.SetText(systemText.Get("Account_0139")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetButtonText(systemText.Get("Common_0001"), systemText.Get("Common_0002")); + dialogBase.onPushButton1 = delegate + { + TraditionalChineseOnlyAgreement(); + }; + } + + public void TraditionalChineseOnlyAgreement() + { + SystemText systemText = Wizard.Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Account_0140")); + dialogBase.SetText(systemText.Get("Account_0141")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetButtonText(systemText.Get("Common_0001"), systemText.Get("Common_0002")); + dialogBase.onPushButton1 = delegate + { + ShowStatement(); + }; + } + + public void ShowAddress() + { + NtDataTranslateInput dataInput = UnityEngine.Object.Instantiate(NtDataTranslate.Instance.InputObj); + DialogBase dialog = UIManager.GetInstance().CreateDialogClose(); + dialog.SetTitleLabel(TranslateInfo.titleEmail); + dialog.SetText(string.Empty); + dialog.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn); + dialog.isNotCloseWindowButton1 = true; + dialog.SetSize(DialogBase.Size.XL); + dialog.SetButtonText(TranslateInfo.button_id3); + dialog.onPushButton1 = delegate + { + dataInput.UpLoadEmail(delegate + { + SetDataTranslateTask setDataTranslateTask = new SetDataTranslateTask(); + setDataTranslateTask.SetParameter(dataInput.EmailAddress); + Toolbox.NetworkManager.StartCoroutine(Toolbox.NetworkManager.Connect(setDataTranslateTask, delegate + { + ShowSuccess(); + dialog.Close(); + })); + }); + }; + dialog.SetObj(dataInput.gameObject); + } + + public void ShowSuccess() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(TranslateInfo.titleSuccess); + dialogBase.SetText(TranslateInfo.containSuccess); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetButtonText(TranslateInfo.button_id4); + } + + public void ShowRebind() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(TranslateInfo.titleRebind); + dialogBase.SetText(string.Format(TranslateInfo.containRebind, curBindEmail)); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetButtonText(TranslateInfo.button_id5, TranslateInfo.button_id6); + dialogBase.onPushButton1 = delegate + { + ShowAddress(); + }; + } + + public void ShowRejectLogin(Action callback = null) + { + DialogBase dialogBase = Dialog.Create(330); + dialogBase.SetTitleLabel(TranslateInfo.titleTip); + dialogBase.SetText(string.Format(TranslateInfo.containTip, curBindEmail)); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetButtonText(TranslateInfo.button_id7); + dialogBase.SetVisibleContactButton(isVisible: false, 330.ToString()); + dialogBase.onPushButton1 = delegate + { + callback.Call(); + }; + } + + public void ShowCygamesStatement(Action callback, bool fromTitle = false) + { + if (CheckViewCanShow()) + { + NtDataTranslate.Instance.BtnTranslate.SetActive(value: true); + if (string.IsNullOrEmpty(Toolbox.SavedataManager.GetString("FIRST_LOOK"))) + { + ShowMainNotice(callback, fromTitle); + } + else + { + callback.Call(); + } + } + else + { + NtDataTranslate.Instance.BtnTranslate.SetActive(value: false); + callback.Call(); + } + } + + public void ShowMainNotice(Action callback, bool fromTitle = false) + { + if (fromTitle) + { + string text = Toolbox.SavedataManager.GetString("LANG_SETTING"); + if (!GameStartCheckTask.IsTutorialClear || (text != "Eng" && text != "Cht")) + { + callback.Call(); + return; + } + } + SystemText systemText = Wizard.Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Account_0111")); + dialogBase.SetText(systemText.Get("Account_0112")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.onPushButton1 = delegate + { + callback.Call(); + }; + dialogBase.SetOnClickUrl(); + Toolbox.SavedataManager.SetString("FIRST_LOOK", "1"); + } +} diff --git a/SVSim.BattleEngine/Engine/NullBattleCard.cs b/SVSim.BattleEngine/Engine/NullBattleCard.cs new file mode 100644 index 0000000..53de095 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullBattleCard.cs @@ -0,0 +1,94 @@ +using System.Collections.Generic; +using Wizard.Battle; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class NullBattleCard : BattleCardBase +{ + private static BuildInfo _dummyBuildInfo; + + private static NullSkillApplyInformation _dummySkillApplyInfo; + + private static BattleCardView.BuildInfo _dummyViewBuildInfo; + + private static NullBattleCardView _dummyView; + + public override int Index => -1; + + public override List Tribe => CardBasePrm.DefaultType; + + public override bool IsInHand => false; + + public override bool IsInplay => false; + + public override bool IsInDeck => false; + + public override bool IsInCemetery => true; + + public static void ReleaseSharedDummy() + { + _dummyBuildInfo = null; + _dummySkillApplyInfo = null; + _dummyViewBuildInfo = null; + _dummyView = null; + } + + public static NullBattleCard Create() + { + if (_dummyBuildInfo == null) + { + _dummyBuildInfo = new BuildInfo(null, -1, null, null, null, null, null, _isPlayer: true, 0, NullInnerOptionsBuilder.GetInstance().CreateCardOptions(), null, null); + } + NullBattleCard nullBattleCard = new NullBattleCard(_dummyBuildInfo); + nullBattleCard.Setup(createNullView: true); + return nullBattleCard; + } + + protected override void InitSkillCollection() + { + _normalSkillCollection = null; + _evolveSkillCollection = null; + } + + private NullBattleCard(BuildInfo buildInfo) + : base(buildInfo) + { + } + + protected override ICardVfxCreator CreateVfxCreator(bool isPlayer, IBattleCardView battleCardView, bool isNullView) + { + return NullCardVfxCreator.GetInstance(); + } + + public override BattleCardBase VirtualClone(BattlePlayerBase selfBattlePlayer, BattlePlayerBase opponentBattlePlayer) + { + return this; + } + + protected override BattleCardView.BuildInfo CreateViewBuildInfo(BuildInfo baseBuildInfo) + { + if (_dummyViewBuildInfo == null) + { + _dummyViewBuildInfo = new BattleCardView.BuildInfo(this, null, null, null, null, null, null, null, null, null, null, null, null, null); + } + return _dummyViewBuildInfo; + } + + protected override IBattleCardView CreateView(BattleCardView.BuildInfo buildInfo, bool isNullView) + { + if (_dummyView == null) + { + _dummyView = new NullBattleCardView(buildInfo); + } + return _dummyView; + } + + protected override ISkillApplyInformation CreateSkillApplyInformation(BattleCardBase card, ICardVfxCreator vfxCreator) + { + if (_dummySkillApplyInfo == null) + { + _dummySkillApplyInfo = new NullSkillApplyInformation(); + } + return _dummySkillApplyInfo; + } +} diff --git a/SVSim.BattleEngine/Engine/NullBattlePlayerFilter.cs b/SVSim.BattleEngine/Engine/NullBattlePlayerFilter.cs new file mode 100644 index 0000000..35c10a5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullBattlePlayerFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; + +public class NullBattlePlayerFilter : ISkillBattlePlayerFilter +{ + public IEnumerable Filtering(BattlePlayerReadOnlyInfoPair playerInfoPair) + { + return Enumerable.Empty(); + } +} diff --git a/SVSim.BattleEngine/Engine/NullDetailPanelControl.cs b/SVSim.BattleEngine/Engine/NullDetailPanelControl.cs new file mode 100644 index 0000000..0bf7855 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullDetailPanelControl.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class NullDetailPanelControl : IDetailPanelControl +{ + public bool IsShow => false; + + public BattleCardBase _card => null; + + public bool forceEvolutionConfirm { get; set; } + + public UIButton EvolveButton => null; + + public DetailPanelControl.ShowRequest CurrentShowRequest { get; } + + public GameObject EvoTargetPanelColliderGameObject => null; + + public EvolutionConfirmation _evolutionConfirmation => null; + + public event Action OnHideOneTime + { + add + { + } + remove + { + } + } + + public void UpdateCardDescriptionOnEvent() + { + } + + public void UpdateCardDescriptionOnEvolutionEvent() + { + } + + public void Show(BattleManagerBase battleMgrBase, OperateMgr operateMgr, BattleCardBase card, DetailPanelControl.ShowRequest showRequest) + { + } + + public void ShowList(BattleManagerBase battleMgrBase, OperateMgr operateMgr, List cards, DetailPanelControl.ShowRequest showRequest, BuffInfo buff, BattleLogItem.CardTextureOption textureOption = BattleLogItem.CardTextureOption.Null, string divergenceId = "", int logTextureId = 0) + { + } + + public void Hide() + { + } + + public void SetSize(float percent) + { + } + + public void UpdateBuffInfo(BattleCardBase targetCard, List myRotationBonusList) + { + } + + public void UpdateLogItemBuffInfo(BattleCardBase targetCard) + { + } + + public void SetScreenPosition(bool right) + { + } + + public VfxBase ShowEvolutionButton(BattleCardBase card) + { + return NullVfx.GetInstance(); + } + + public void CreateNextPanel() + { + } + + public void SetKeyBtnActive(List hasKeyword) + { + } + + public void ShowKeySubPanel(int page) + { + } + + public void HideKeySubPanel() + { + } + + public bool IsDisplayedRight() + { + return false; + } + + public List GetDistinctBuffList(List buffInfoList) + { + return new List(); + } + + public List GetBuffDetailLabel(BattleCardBase targetCard) + { + return new List(); + } +} diff --git a/SVSim.BattleEngine/Engine/NullNextSceneSelector.cs b/SVSim.BattleEngine/Engine/NullNextSceneSelector.cs new file mode 100644 index 0000000..c653a42 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullNextSceneSelector.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +public class NullNextSceneSelector : INextSceneSelector +{ + public NullNextSceneSelector(BattleResultUIController battleResultControl) + { + } + + public void Setup(bool isWin, GameObject gameObject) + { + } + + public void Show() + { + } +} diff --git a/SVSim.BattleEngine/Engine/NullOperationCollection.cs b/SVSim.BattleEngine/Engine/NullOperationCollection.cs new file mode 100644 index 0000000..8fb6c98 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullOperationCollection.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using Wizard.Battle.View.Vfx; + +public class NullOperationCollection : NetworkOperationCollectionBase +{ + public NullOperationCollection() + : base(null, null, null, null, isPlayer: false) + { + } + + public override void RetryOperation() + { + } + + public override void DealOperation() + { + } + + public override void SwapOperation(Func, VfxBase> OnReceiveOpponentMulligan, Func, VfxBase> OnReceivePlayerMulligan) + { + } + + public override void SecondMulliganOperation(Func, VfxBase> OnReceiveOpponentMulligan, Func, VfxBase> OnReceivePlayerMulligan, Func OnEndMulligan) + { + } + + public override void TurnStartOperation(NetworkBattleDefine.NetworkBattleURI lastReceivedUri, int lastReceivedTime) + { + } + + public override void TurnEndOperation(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction) + { + } + + public override void TurnEndFinalOperation() + { + } + + public override void TurnEndWithSkillActivationOperation(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction) + { + } + + public override void JudgeOperation() + { + } + + public override void PlayHandCardOperation(PlayHandCardReflection networkPlayCardAction, List choiceIdList = null, bool isChoice = false) + { + } + + public override void PlaySkillSelectHandCardOperation(PlayHandCardReflection networkPlayCardAction, List choiceIdList = null) + { + } + + public override void InPlayActionOperation(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction) + { + } + + public override void RetireOperation() + { + } + + public override void ChatStampOperation() + { + } + + public override void DataInconsistencyBattleEndOperation() + { + } + + public override void TouchOperation() + { + } + + public override void SelectSkillOperation(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction) + { + } + + public override void SelectObjectOperation() + { + } + + public override void TurnEndReady() + { + } + + public override void SlideObject() + { + } + + public override void BattleFinishOperation() + { + } + + public override void MaintenanceOperation() + { + } + + public override void JudgeResultOperation() + { + } +} diff --git a/SVSim.BattleEngine/Engine/NullSkillApplyInformation.cs b/SVSim.BattleEngine/Engine/NullSkillApplyInformation.cs new file mode 100644 index 0000000..264eacd --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullSkillApplyInformation.cs @@ -0,0 +1,1462 @@ +using System.Collections.Generic; +using Wizard.Battle; +using Wizard.Battle.Resource; +using Wizard.Battle.View.Vfx; + +public class NullSkillApplyInformation : ISkillApplyInformation +{ + public List CantPlayFilterList { get; protected set; } + + public int BuffCount => 0; + + public int BuffLifeCount => 0; + + public List TurnBuffCountList => null; + + public bool IsBuff => false; + + public int DebuffCount => 0; + + public bool IsDebuff => false; + + public List GuardInfo => null; + + public bool IsGuard => false; + + public int DrainCount => 0; + + public bool IsDrain => false; + + public int KillerCount => 0; + + public bool IsKiller => false; + + public List ShieldInfos => null; + + public bool IsShieldAll => false; + + public bool IsShieldSkill => false; + + public bool IsShieldSpell => false; + + public bool IsShieldAttack => false; + + public int QuickCount => 0; + + public bool IsQuick => false; + + public List RushInfo => null; + + public bool IsRush => false; + + public int SneakCount => 0; + + public bool IsSneak => false; + + public int DamageCutCount => 0; + + public bool IsDamageCut => false; + + public int NotBeAttackedCount => 0; + + public int UntouchableCount => 0; + + public bool IsUntouchable => false; + + public int UntouchableBySpellCount => 0; + + public bool IsUntouchableBySpell => false; + + public int IgnoreGuardCount => 0; + + public bool IsIgnoreGuard => false; + + public int AttackByLifeTypeBeAttackedCount => 0; + + public bool IsAttackByLifeTypeBeAttacked => false; + + public int AttackByLifeTypeAttackCount => 0; + + public bool IsAttackByLifeTypeAttack => false; + + public int SkillCantAtkClassCount => 0; + + public bool IsSkillCantAtkClass => false; + + public int SkillCantAtkUnitCount => 0; + + public bool IsSkillCantAtkUnit => false; + + public int SkillCantAtkUnitNotHasGuardCount => 0; + + public bool IsSkillCantAtkUnitNotHasGuard => false; + + public int SkillCantAtkUnitBaseCardIdCount => 0; + + public bool IsSkillCantAtkUnitBaseCardId => false; + + public List CantAtkUnitBaseCardIdList => null; + + public bool IsSkillCantAtkAll => false; + + public int ReflectionClassCount => 0; + + public bool IsReflectionClass => false; + + public int ReflectionDamageOwnerCount => 0; + + public bool IsReflectionDamageOwner => false; + + public int InfiniteAttackCount => 0; + + public bool IsInfiniteAttack => false; + + public int IndestructibleCount => 0; + + public bool IsIndestructible => false; + + public int ForceBerserkCount => 0; + + public bool IsForceBerserk => false; + + public int ForceAvariceCount => 0; + + public bool IsForceAvarice => false; + + public int ForceWrathCount => 0; + + public bool IsForceWrath => false; + + public int CantActivateFanfareUnitCount => 0; + + public bool IsCantActivateFanfareUnit => false; + + public int CantActivateFanfareFieldCount => 0; + + public bool IsCantActivateFanfareField => false; + + public int CantActivateShortageDeckWinCount => 0; + + public bool IsCantActivateShortageDeckWin => false; + + public int ForceSkillTargetCount => 0; + + public bool IsForceSkillTarget => false; + + public int AttractSkillTargetCount => 0; + + public bool IsAttractSkillTarget => false; + + public int IndependentCount => 0; + + public bool IsIndependent => false; + + public int NotBeDebuffedCount => 0; + + public bool IsNotBeDebuffed => false; + + public int ForceAttackUnitCount => 0; + + public bool IsForceAttackUnit => false; + + public int SkillRandomCount => 0; + + public int[] SkillRandomArray => null; + + public List DamageCutList => null; + + public List ReflectionInfoList => null; + + public int TurnStartFixedPPCount => 0; + + public bool IsTurnStartFixedPP => false; + + public int TriggerCount => 0; + + public bool IsTrigger => false; + + public int NotConsumeEpCount => 0; + + public bool IsNotConsumeEp => false; + + public int ShortageDeckWinCount => 0; + + public bool IsShortageDeckWin => false; + + public int ReturnByBanishCount => 0; + + public bool IsReturnByBanish => false; + + public int DestroyByBanishCount => 0; + + public bool IsDestroyByBanish => false; + + public int BanishByDestroyCount => 0; + + public bool IsBanishByDestroy => false; + + public bool CantBeFocusedSkill => false; + + public bool CantBeFocusedSpell => false; + + public int[] SkillGenericValueArray => null; + + public int NotDecreasePPCounter + { + get + { + return 0; + } + set + { + } + } + + public Dictionary SkillGenericKeyAndValue => null; + + public int UnionBurstCount => 0; + + public int SkyboundArtCount => 0; + + public int SuperSkyboundArtCount => 0; + + public int WhiteRitualCount => 0; + + public int RandomAttackCount => 0; + + public bool IsLifeZeroActivateLeonSkill => false; + + public List DamageMaxClippingInfo => null; + + public List ClanSkinInfo => null; + + public List TribeSkinInfo => null; + + public List OffenseModifierList => null; + + public List LifeModifierList => null; + + public List ChantCountModifierList => null; + + public List DamageList => null; + + public List HealList => null; + + public List SkillHealList => null; + + public List LifeChangeList => null; + + public List EpModifierList => null; + + public List NotBeAttackedInfoList => null; + + public bool IsNotBeAttacked => false; + + public List NotConsumeEpModifierInfoList => null; + + public AttachedSkillInformation AttachedSkillsInfo => null; + + public List RepeatSkillTimingList => null; + + public List AddDamageList => null; + + public List HealModifierList => null; + + public List AddTargetList => null; + + public List DecreaseTurnStartPPList => null; + + public List CantEvolutionList => null; + + public List CantSummonList => null; + + public bool IsDamageCutProtection => false; + + public List RandomSelectedCardList => null; + + public List SkillDrewCardList => null; + + public List LastBurialRiteCardList => null; + + public List TokenDrawModifiers => null; + + public List FusionIngredients => null; + + public List GetOnCards { get; } + + public TokenDrawModifier GetTokenDrawModifier(int cardId) + { + return null; + } + + public void InitializeInformation(bool isReturnCard = false) + { + } + + public void InitializeInformationWithoutLifeOffenseModifier(bool isReturnCard = false) + { + } + + public void ReSetupVfxCreator(ICardVfxCreator vfxCreator) + { + } + + public SkillBase CloneAttachSkill(SkillApplyInformation cloneTarget, SkillBase skill) + { + return null; + } + + public SkillApplyInformation Clone(BattleCardBase card) + { + return null; + } + + public bool IsCantPlay(BattleCardBase card, BattleCardBase.CHECK_CONDITION_MUTATIONSKILL_TYPE type = BattleCardBase.CHECK_CONDITION_MUTATIONSKILL_TYPE.NONE) + { + return false; + } + + public bool HasCantPlaySpellFilter() + { + return false; + } + + public bool HasCantPlayFieldFilter() + { + return false; + } + + public bool CantPlayTransformId(BattleCardBase originalCard) + { + return false; + } + + public SkillBase AttachSkill(SkillCreator.SkillBuildInfo skillBuildInfo, IBattleResourceMgr resourceMgr, string ownerName, int ownerId, long duplicateBanNum, SkillBase originSkill, bool isAttachEvolveSkill) + { + return null; + } + + public void RemoveSkill(SkillBase skill, BattleCardBase skillOwnerCard, long duplicateBanNum, SkillBase originSkill, int createSkillIndex) + { + } + + public VfxBase GiveCombatValueModifier(ICardOffenseModifier offenseModifier, ICardLifeModifier lifeModifier, SkillProcessor skillProcessor) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveCombatValueModifire(ICardOffenseModifier offenseModifier, ICardLifeModifier lifeModifier) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveCombatValueModifire() + { + return NullVfx.GetInstance(); + } + + public void AddOffenseModifier(ICardOffenseModifier modifier) + { + } + + public void AddLifeModifier(ICardLifeModifier modifier) + { + } + + public void ClearParameterModifier() + { + } + + public void ClearUnionBurstAndSkyboundArtModifier() + { + } + + public void AddEpModifier(ICardEpModifier modifier) + { + } + + public void RemoveEpModifier(ICardEpModifier modifier) + { + } + + public int GetEp() + { + return 0; + } + + public int GetAtk(bool ignoreLowerLimit = false) + { + return 0; + } + + public int GetLife() + { + return 0; + } + + public bool HasMoreDamageThan(ISkillApplyInformation other) + { + return false; + } + + public int GetMaxLife() + { + return 0; + } + + public int GetLastLife() + { + return 0; + } + + public int GetChangeMaxLifeCount() + { + return 0; + } + + public int GetInitialWhiteRitualStack() + { + return 0; + } + + public void DamageLife(int damage, int turn, bool isSelfTurn) + { + } + + public void CausedDamageLife(int damage, int turn, bool isSelfTurn) + { + } + + public int GetSpecificTurnDamageValue(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return 0; + } + + public int GetSpecificTurnCausedDamageValue(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return 0; + } + + public List GetSpecificTurnDamageValueList(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return new List(); + } + + public List GetSpecificTurnCausedDamageValueList(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return new List(); + } + + public int GetSpecificTurnDamageCount(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return 0; + } + + public int GetSpecificTurnHealValue(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return 0; + } + + public List GetSpecificTurnHealValueList(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return new List(); + } + + public int GetSpecificTurnHealCount(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return 0; + } + + public int GetSpecificTurnHealCountOnlySelf(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return 0; + } + + public int GetSpecificTurnBuffCount(TurnPlayerInfo turnPlayerInfo) + { + return 0; + } + + public int GetSpecificTurnPpAddCount(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return 0; + } + + public int GetSpecificTurnAcceleratedCardCount(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return 0; + } + + public int GetSpecificTurnAcceleratedCardCountOnlySelf(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return 0; + } + + public List GetSpecificTurnStartLifeList(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return new List(); + } + + public int GetSpecificTurnFusionCount(IReadOnlyBattleCardInfo cardInfo, TurnPlayerInfo turnPlayerInfo) + { + return 0; + } + + public void SetSkillGenericArray(int[] array) + { + } + + public void SetSkillGenericKeyAndValue(string key, int value) + { + } + + public bool IsContainGenericValueKey(string key) + { + return false; + } + + public void AddSkillGenericValue(int value, int index) + { + } + + public void GiveUnionBurstCount(ICardUnionBurstCountModifier unionBurstCountModifier) + { + } + + public void DepriveUnionBurstCount(ICardUnionBurstCountModifier unionBurstCountModifier) + { + } + + public void FourceDepriveUnionBurstCount() + { + } + + public void GiveSkyboundArtCount(ICardSkyboundArtCountModifier skyboundArtCountModifier) + { + } + + public void GiveSuperSkyboundArtCount(ICardSuperSkyboundArtCountModifier superSkyboundArtCountModifier) + { + } + + public void GiveWhiteRitualCount(int value) + { + } + + public void DepriveWhiteRitualCount(int value) + { + } + + public void FourceDepriveWhiteRitualCount() + { + } + + public void HealLife(int healAmount, int turn, bool isSelfTurn) + { + } + + public void AddPp(int addPp, int currentTurn, bool isSelfTurn) + { + } + + public void GiveBuff(bool isReplace = false) + { + } + + public void DepriveBuff() + { + } + + public void FourceDepriveBuff() + { + } + + public void GiveDebuff() + { + } + + public void DepriveDebuff() + { + } + + public void FourceDepriveDebuff() + { + } + + public void GiveBuffLife() + { + } + + public void DepriveBuffLife() + { + } + + public void ForceDepriveBuffLife() + { + } + + public void Combine(ISkillApplyInformation info) + { + } + + public VfxBase GiveGuard(GuardInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveGuard(GuardInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveGuard() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveDrain() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveDrain() + { + return NullVfx.GetInstance(); + } + + public VfxBase FourceDepriveDrain() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveKiller() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveKiller() + { + return NullVfx.GetInstance(); + } + + public VfxBase FourceDepriveKiller() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveShield(ShieldInfo shield) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveShield(ShieldInfo shield) + { + return NullVfx.GetInstance(); + } + + public VfxBase FourceDepriveShield(ShieldInfo.ShieldType type) + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveQuick() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveQuick() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveQuick() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveRush(RushInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveRush(RushInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveRush() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveSneak() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveSneak() + { + return NullVfx.GetInstance(); + } + + public VfxBase FourceDepriveSneak() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveNotBeAttacked(NotBeAttackedInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveNotBeAttacked(NotBeAttackedInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase FourceDepriveNotBeAttacked() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveUntouchable(string cardType) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveUntouchable(string cardType) + { + return NullVfx.GetInstance(); + } + + public VfxBase FourceDepriveUntouchable(string cardType) + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveAttackByLife(string type) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveAttackByLife(string type) + { + return NullVfx.GetInstance(); + } + + public VfxBase FourceDepriveAttackByLife(string type) + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveCantAttack(int bit_flag, int baseCardId) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveCantAttack(int bit_flag, int baseCardId) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveCantAttack() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveCantAttackAll() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveCantPlay(CantPlayCardFilterInfo cantPlayCardFilter) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveCantPlay(CantPlayCardFilterInfo cantPlayCardFilter) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveCantPlay() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveCantSummon(Skill_cant_summon.CantSummonInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveCantSummon(Skill_cant_summon.CantSummonInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveCantSummon() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveIgnoreGuard() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveIgnoreGuard() + { + return NullVfx.GetInstance(); + } + + public VfxBase FourceDepriveIgnoreGuard() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveAttackCount(Skill_attack_count skill, int count) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveAttackCount(Skill_attack_count skill) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveAttackCount() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveInfiniteAttackCount() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveInfiniteAttackCount() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveInfiniteAttackCount() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveReflection(ReflectionInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveReflection(ReflectionInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveReflection() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveIndestructible() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveIndestructible() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveIndestructible() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveForceBerserk(SkillProcessor skillprocessor) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveForceBerserk(SkillProcessor skillprocessor) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveForceBerserk(SkillProcessor skillprocessor) + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveForceAvarice(SkillProcessor skillprocessor) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveForceAvarice() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveForceAvarice() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveForceWrath(SkillProcessor skillprocessor) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveForceWrath() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveForceWrath() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveCantActivateFanfare(string type) + { + return NullVfx.GetInstance(); + } + + public VfxBase SetCantActivateFanfareCount(int count) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveCantActivateFanfare(string type) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveCantActivateFanfare(string type) + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveCantActivateShortageDeckWin() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveCantActivateShortageDeckWin() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveCantActivateShortageDeckWin() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveForceSkillTarget() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveForceSkillTarget() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveForceSkillTarget() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveAttractSkillTarget() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveAttractSkillTarget() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveAttractSkillTarget() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveIndependent() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveIndependent() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveIndependent() + { + return NullVfx.GetInstance(); + } + + public void GiveNotBeDebuffed() + { + } + + public void DepriveNotBeDebuffed() + { + } + + public void ForceDepriveNotBeDebuffed() + { + } + + public VfxBase GiveForceAttack(string target, string type) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveForceAttack(string target, string type) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveForceAttack(string target, string type) + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveExtraTurn(int addTurn) + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveSkillRandomCount(int randomCount) + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveSkillRandomArray(int[] array) + { + return NullVfx.GetInstance(); + } + + public int GetDamageCutAmount(DamageCutInfo.DamageType type) + { + return 0; + } + + public VfxBase GiveDamageCut(DamageCutInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveDamageCut(DamageCutInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase FourceDepriveDamageCut() + { + return NullVfx.GetInstance(); + } + + public int GetClippingDamage(int damage, ParallelVfxPlayer lifeLowerLimitEffectVfx) + { + return 0; + } + + public VfxBase GiveDamageMaxClipping(DamageClippingInfo clipping) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveDamageMaxClipping(DamageClippingInfo clipping) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveDamageMaxClipping() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveTurnStartFixedPP() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveTurnStartFixedPP() + { + return NullVfx.GetInstance(); + } + + public VfxBase FourceDepriveTurnStartFixedPP() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveChangeAffiliation(CardBasePrm.ClanType clan, CardBasePrm.TribeInfo tribeInfo, bool showEffect) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveChangeAffiliation(CardBasePrm.ClanType clan, CardBasePrm.TribeInfo tribeInfo) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveChangeAffiliation() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveNotConsumeEpModifier(NotConsumeEpModifierInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveNotConsumeEpModifier(NotConsumeEpModifierInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveNotConsumeEpModifier() + { + return NullVfx.GetInstance(); + } + + public bool CheckNotConsumeEpCard(BattleCardBase card) + { + return false; + } + + public VfxBase GiveShortageDeckWin() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveShortageDeckWin() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveShortageDeckWin() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveRemoveByBanish() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveRemoveByBanish() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveRemoveByBanish() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveRemoveByDestroy() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveRemoveByDestroy() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveRemoveByDestroy() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveRepeatSkill(string repeatTiming, string repeatTarget, SkillBase skill) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveRepeatSkill(string repeatTiming, string repeatTarget, bool reservation, bool isProcess, SkillProcessor skillProcessor) + { + return NullVfx.GetInstance(); + } + + public VfxBase ReservationAllDepriveRepeatSkill() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveRepeatSkill() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveAddDamage(DamageModifier info) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveAddDamage(DamageModifier info) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveAddDamage() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveHealModifier(HealModifier info) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveHealModifier(HealModifier info) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveHealModifier() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveTriggerCount(SkillProcessor skillProcessor) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveTriggerCount() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveTriggerCount() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveAddTarget(AddTargetInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveAddTarget(AddTargetInfo info) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveAddTarget() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveDecreaseTurnStartPP(int value) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveDecreaseTurnStartPP(int value) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveDecreaseTurnStartPP() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveRandomAttack() + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveRandomAttack() + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveRandomAttack() + { + return NullVfx.GetInstance(); + } + + public VfxBase GiveCantEvolution(int type) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveCantEvolution(int type) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveCantEvolution() + { + return NullVfx.GetInstance(); + } + + public VfxBase AddRandomSelectedCard(BattleCardBase card) + { + return NullVfx.GetInstance(); + } + + public VfxBase RemoveRandomSelectedCard(BattleCardBase card) + { + return NullVfx.GetInstance(); + } + + public VfxBase ClearRandomSelectedCard() + { + return NullVfx.GetInstance(); + } + + public VfxBase AddSkillDrewCard(BattleCardBase card) + { + return NullVfx.GetInstance(); + } + + public VfxBase RemoveSkillDrewCard(BattleCardBase card) + { + return NullVfx.GetInstance(); + } + + public VfxBase ClearSkillDrewCard() + { + return NullVfx.GetInstance(); + } + + public void AddTokenDrawModifier(TokenDrawModifier modifier) + { + } + + public void RemoveTokenDrawModifier(TokenDrawModifier modifier) + { + } + + public void SaveTargetList(List targetList) + { + } + + public List LoadTargetList() + { + return null; + } + + public void SaveTargetCardId(long id, List targetIdList) + { + } + + public List LoadTargetCardId(long id) + { + return null; + } + + public void SaveBurialRiteTargetList(List targetList) + { + } + + public List LoadBurialRiteTargetList() + { + return null; + } + + public VfxBase GiveChantCount(ICardChantCountModifier chantCountModifier) + { + return NullVfx.GetInstance(); + } + + public VfxBase DepriveChantCount(ICardChantCountModifier chantCountModifier) + { + return NullVfx.GetInstance(); + } + + public VfxBase ForceDepriveChantCount() + { + return NullVfx.GetInstance(); + } + + public int GetChantCount(int baseChantCount) + { + return 0; + } + + public VfxBase AllSkillEffectStop(bool isEvolve = false, bool isReturn = false, bool isBuffed = false, bool isDebuffed = false) + { + return NullVfx.GetInstance(); + } + + public VfxBase AllSkillEffectRestart() + { + return NullVfx.GetInstance(); + } + + public VfxBase AllSkillEffectStartOnSummon() + { + return NullVfx.GetInstance(); + } + + public VfxBase CreateVfxSkillProtection(bool isForceStop = false) + { + return NullVfx.GetInstance(); + } + + public void AddFusionIngredientCard(BattleCardBase card) + { + } + + public void AddFusionIngredients(List fusionIngredients) + { + } + + public int GetFusionCount() + { + return 0; + } + + public void AddGetOnCard(BattleCardBase card) + { + } + + public void ClearGetOnCards() + { + } + + public void AddLastBurialRiteCardList(List cards) + { + } + + public void ClearLastBurialRiteCardList() + { + } + + public void GiveNotDecreasePP() + { + } + + public void DepriveNotDecreasePP() + { + } + + public void GiveLifeZeroActivateLeonSkill() + { + } + + public void DepriveLifeZeroActivateLeonSkill() + { + } + + public void AddSkillHealValue(int healValue) + { + } + + public VfxBase UpdateAllSkillEffectInReplay(List inplaySkillEffectList, int inductionNumber, bool isInitialize, bool isOnlyCantAtk = false) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/NullStatusPanelControl.cs b/SVSim.BattleEngine/Engine/NullStatusPanelControl.cs new file mode 100644 index 0000000..3648896 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullStatusPanelControl.cs @@ -0,0 +1,89 @@ +using UnityEngine; +using Wizard.Battle.View.Vfx; + +public class NullStatusPanelControl : IStatusPanelControl +{ + public Vector3 EpPanelOffScreenPosition { get; } + + public void SetUp(BattleManagerBase battleMgr) + { + } + + public void ShowStatus(bool isNewReplayMoveTurn) + { + } + + public void ShowPpEp(bool isNotEPMax3, bool fixDirection = false, bool isNewReplay = false, bool isBanmenkun = false) + { + } + + public void HideUI() + { + } + + public void SetDeck(int num) + { + } + + public void SetGrave(int num) + { + } + + public void SetHandCount(int num) + { + } + + public void ShowStatusPanelAlways() + { + } + + public void HideStatusPanelAlways() + { + } + + public void ShowStatusPanelOnBattle() + { + } + + public void SetPp(int num, int max, bool isNewReplayMoveTurn = false) + { + } + + public void PlayIncreasePpAnimation(int oldPp, int newPp) + { + } + + public void SetEp(int evo, int cnt) + { + } + + public VfxBase PlayIncreaseMaxEpAnimation(int oldMaxEp, int newEp) + { + return NullVfx.GetInstance(); + } + + public VfxBase PlayIncreaseUsableEpAnimation(int oldUsableEpAmount, int amountOfUsableEpGained, int maxEp) + { + return NullVfx.GetInstance(); + } + + public VfxBase PlayDecreaseUsableEpAnimation(int oldUsableEpAmount, int usedEp) + { + return NullVfx.GetInstance(); + } + + public GameObject GetPPPanel() + { + return null; + } + + public GameObject GetEPIcon() + { + return null; + } + + public Transform GetClassInfoAnchor() + { + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/NullTurnPanelControl.cs b/SVSim.BattleEngine/Engine/NullTurnPanelControl.cs new file mode 100644 index 0000000..da6c46e --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullTurnPanelControl.cs @@ -0,0 +1,20 @@ +using UnityEngine; +using Wizard.Battle.View.Vfx; + +public class NullTurnPanelControl : ITurnPanelControl +{ + public GameObject GameObject => null; + + public void Initialize(bool isEvoEnableP = true, bool isEvoEnableE = true) + { + } + + public void StartUI(int turn, int evo, bool isP) + { + } + + public VfxBase LoadResource() + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/OffenseAddModifier.cs b/SVSim.BattleEngine/Engine/OffenseAddModifier.cs new file mode 100644 index 0000000..7d84b3e --- /dev/null +++ b/SVSim.BattleEngine/Engine/OffenseAddModifier.cs @@ -0,0 +1,16 @@ +public class OffenseAddModifier : ICardOffenseModifier +{ + public readonly int Offense; + + public bool IsClearBeforeModifier => false; + + public OffenseAddModifier(int offense) + { + Offense = offense; + } + + public int CalcOffense(int offense) + { + return offense + Offense; + } +} diff --git a/SVSim.BattleEngine/Engine/OffenseMultiplyModifier.cs b/SVSim.BattleEngine/Engine/OffenseMultiplyModifier.cs new file mode 100644 index 0000000..6bc5fc0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/OffenseMultiplyModifier.cs @@ -0,0 +1,16 @@ +public class OffenseMultiplyModifier : ICardOffenseModifier +{ + public readonly int Multipli; + + public bool IsClearBeforeModifier => false; + + public OffenseMultiplyModifier(int multipli) + { + Multipli = multipli; + } + + public int CalcOffense(int offense) + { + return offense * Multipli; + } +} diff --git a/SVSim.BattleEngine/Engine/OffenseSetModifier.cs b/SVSim.BattleEngine/Engine/OffenseSetModifier.cs new file mode 100644 index 0000000..a1246c6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/OffenseSetModifier.cs @@ -0,0 +1,16 @@ +public class OffenseSetModifier : ICardOffenseModifier +{ + public readonly int Offense; + + public bool IsClearBeforeModifier => true; + + public OffenseSetModifier(int offense) + { + Offense = offense; + } + + public int CalcOffense(int offense) + { + return Offense; + } +} diff --git a/SVSim.BattleEngine/Engine/OpenURLOnClick.cs b/SVSim.BattleEngine/Engine/OpenURLOnClick.cs new file mode 100644 index 0000000..5adb7b1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/OpenURLOnClick.cs @@ -0,0 +1,15 @@ +using UnityEngine; + +public class OpenURLOnClick : MonoBehaviour +{ + public UILabel ClickedUrlLabel { private get; set; } + + private void OnClick() + { + string urlAtPosition = ClickedUrlLabel.GetUrlAtPosition(UICamera.lastHit.point); + if (!string.IsNullOrEmpty(urlAtPosition)) + { + UIManager.GetInstance().WebViewHelper.OpenUrl(urlAtPosition); + } + } +} diff --git a/SVSim.BattleEngine/Engine/OpponentBattlePlayerFilter.cs b/SVSim.BattleEngine/Engine/OpponentBattlePlayerFilter.cs new file mode 100644 index 0000000..78806ab --- /dev/null +++ b/SVSim.BattleEngine/Engine/OpponentBattlePlayerFilter.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using Wizard; + +public class OpponentBattlePlayerFilter : ISkillBattlePlayerFilter +{ + public IEnumerable Filtering(BattlePlayerReadOnlyInfoPair playerInfoPair) + { + yield return playerInfoPair.ReadOnlyOpponent; + } +} diff --git a/SVSim.BattleEngine/Engine/PackOpen.cs b/SVSim.BattleEngine/Engine/PackOpen.cs new file mode 100644 index 0000000..2164e19 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PackOpen.cs @@ -0,0 +1,4 @@ +public class PackOpen : HeaderData +{ + public PackOpenDetail data; +} diff --git a/SVSim.BattleEngine/Engine/PlayQueueViewBase.cs b/SVSim.BattleEngine/Engine/PlayQueueViewBase.cs new file mode 100644 index 0000000..432f53e --- /dev/null +++ b/SVSim.BattleEngine/Engine/PlayQueueViewBase.cs @@ -0,0 +1,204 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public abstract class PlayQueueViewBase +{ + protected const float REARRANGE_TIME = 0.5f; + + protected const float ACCELERATE_REARRANGE_TIME = 0.2f; + + private const float queueUpdateSpeed = 10f; + + private const float aspectRatio_4_3 = 1.333f; + + private const float SMOOTHING_AMOUNT = 0.01f; + + private const float DECAY_MULTIPLIER = 5f; + + private Action _computeCorners; + + private List queuedCards = new List(); + + public Vector3 worldTopCornerPosition { get; private set; } + + public Vector3 worldBottomCornerPosition { get; private set; } + + protected abstract BattlePlayerBase BattlePlayerBase { get; } + + protected abstract float RotationAmount { get; } + + protected abstract Vector3 ScreenTopCornerPosition { get; } + + protected abstract Vector3 ScreenBottomCornerPosition { get; } + + public PlayQueueViewBase() + { + } + + public PlayQueueViewBase(BattleCamera battleCamera) + { + PlayQueueViewBase playQueueViewBase = this; + Camera cutInCamera = battleCamera.m_CutInCamera.GetComponent(); + _computeCorners = delegate + { + float aspect = cutInCamera.aspect; + playQueueViewBase.worldTopCornerPosition = cutInCamera.ScreenToWorldPoint(playQueueViewBase.ScreenTopCornerPosition); + playQueueViewBase.worldTopCornerPosition = playQueueViewBase.BattlePlayerBase.HandControl.Transform.InverseTransformPoint(playQueueViewBase.worldTopCornerPosition); + playQueueViewBase.worldTopCornerPosition += playQueueViewBase.GetScreenTopCornerOffset(aspect); + playQueueViewBase.worldTopCornerPosition = playQueueViewBase.BattlePlayerBase.HandControl.Transform.TransformPoint(playQueueViewBase.worldTopCornerPosition); + playQueueViewBase.worldBottomCornerPosition = cutInCamera.ScreenToWorldPoint(playQueueViewBase.ScreenBottomCornerPosition); + playQueueViewBase.worldBottomCornerPosition = playQueueViewBase.BattlePlayerBase.HandControl.Transform.InverseTransformPoint(playQueueViewBase.worldBottomCornerPosition); + playQueueViewBase.worldBottomCornerPosition += playQueueViewBase.GetScreenBottomCornerOffset(aspect); + playQueueViewBase.worldBottomCornerPosition = playQueueViewBase.BattlePlayerBase.HandControl.Transform.TransformPoint(playQueueViewBase.worldBottomCornerPosition); + }; + _computeCorners(); + } + + public virtual void ForceClearPlayQueue() + { + queuedCards.Clear(); + } + + public int QueueCount() + { + return queuedCards.Count; + } + + public virtual void RemoveCardFromView(IBattleCardView cardViewToRemove, bool keepLayer = false) + { + cardViewToRemove.ResetPlayQueueFlags(); + if (queuedCards.Count > 0 && queuedCards[0] == cardViewToRemove) + { + queuedCards.RemoveAt(0); + } + } + + public virtual void InsertCardFromView(IBattleCardView originalView, IBattleCardView insertView) + { + if (queuedCards.Count > 0 && queuedCards[0] == originalView && queuedCards.Any((IBattleCardView c) => c == originalView)) + { + queuedCards.Insert(queuedCards.IndexOf(originalView), insertView); + } + } + + public virtual void ReplaceCard(IBattleCardView cardViewToAdd, IBattleCardView cardViewToRemove) + { + cardViewToAdd._hasCardEnteredPlayQueue = true; + cardViewToAdd._waitUntilCardIsInQueueCoroutine = BattleCoroutine.GetInstance().StartCoroutine(WaitUntilCardIsInQueue(cardViewToAdd)); + cardViewToRemove.ResetPlayQueueFlags(); + if (queuedCards.Count > 0 && queuedCards[0] == cardViewToRemove) + { + queuedCards.RemoveAt(0); + queuedCards.Insert(0, cardViewToAdd); + } + } + + public virtual void ForceRemoveCardFromView(IBattleCardView cardViewToRemove) + { + cardViewToRemove.ResetPlayQueueFlags(); + queuedCards.Remove(cardViewToRemove); + iTween.Stop(cardViewToRemove.GameObject); + } + + protected virtual bool IsCardPlayedInstantly(bool forceCardIntoPlayQueue) + { + return !forceCardIntoPlayQueue; + } + + public bool IsCardInQueue(IBattleCardView battleCardView) + { + return queuedCards.Contains(battleCardView); + } + + public void UpdatePlayQueuePositions(float deltaTime) + { + if (_computeCorners != null) + { + _computeCorners(); + } + Vector3 delta = worldBottomCornerPosition - worldTopCornerPosition; + for (int i = 0; i < queuedCards.Count; i++) + { + float t = (float)i / (float)queuedCards.Count; + if (queuedCards[i].GameObject.activeSelf) + { + Vector3 b = CalculatePositionInQueue(t, delta, worldTopCornerPosition); + queuedCards[i].Transform.position = Vector3.Lerp(queuedCards[i].Transform.position, b, MotionUtils.CalculateFrameRateIndependantDampingConstant(0.01f, 5f)); + } + } + } + + private Vector3 CalculatePositionInQueue(float t, Vector3 delta, Vector3 queueTopPosition) + { + return new Vector3(delta.x * MotionUtils.GetEase(t, MotionUtils.EaseType.easeOutQuad), delta.y * MotionUtils.GetEase(t, MotionUtils.EaseType.linear), delta.z * MotionUtils.GetEase(t, MotionUtils.EaseType.linear)) + queueTopPosition; + } + + protected float CalculateAspectRatioMultiplier(float aspectRatio) + { + if (aspectRatio <= 1.333f) + { + aspectRatio = 1.333f; + } + return aspectRatio - 1f; + } + + protected float CalculateInverseAspectRatioMultiplier(float aspectRatio) + { + if (aspectRatio <= 1.333f) + { + aspectRatio = 1.333f; + } + return 1f / (aspectRatio - 1f); + } + + protected void AddCardToQueue(IBattleCardView playedCardView) + { + queuedCards.Add(playedCardView); + if (!BattleManagerBase.GetIns().IsRecovery) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_HAND_MOVE_CENTER); + iTween.Stop(playedCardView.GameObject); + if (playedCardView.GameObject.activeSelf) + { + iTween.RotateAdd(playedCardView.GameObject, iTween.Hash("y", RotationAmount, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(playedCardView.GameObject, iTween.Hash("scale", Global.CARD_BATTLE_SCALE, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + } + } + + protected VfxBase WaitUntilCardIsInQueueVfx(IBattleCardView playedCardView) + { + if (!BattleManagerBase.GetIns().IsRecovery) + { + playedCardView._hasCardEnteredPlayQueue = true; + } + return InstantVfx.Create(delegate + { + playedCardView._waitUntilCardIsInQueueCoroutine = BattleCoroutine.GetInstance().StartCoroutine(WaitUntilCardIsInQueue(playedCardView)); + }); + } + + private IEnumerator WaitUntilCardIsInQueue(IBattleCardView playedCardView) + { + yield return new WaitForSeconds(0.5f); + playedCardView._isCardQueuedToBePlayed = true; + } + + public abstract VfxBase AddCardToViewVfx(IBattleCardView playedCardView, bool forceCardIntoPlayQueue, bool isSelectTarget, bool isChoice, bool isChoiceBrave = false); + + public abstract VfxBase InstantAddCardToViewVfx(IBattleCardView playedCardView, bool forceCardIntoPlayQueue, bool isChoice); + + protected abstract Vector3 GetScreenTopCornerOffset(float aspectRatio); + + protected abstract Vector3 GetScreenBottomCornerOffset(float aspectRatio); + + protected void PlayPlayedCardEffect(IBattleCardView playedCardView) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_CARD_SET_1, playedCardView.GameObject.transform.position, playedCardView.GameObject.transform.rotation); + } +} diff --git a/SVSim.BattleEngine/Engine/PlayerClassBattleCard.cs b/SVSim.BattleEngine/Engine/PlayerClassBattleCard.cs new file mode 100644 index 0000000..f8c4d83 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PlayerClassBattleCard.cs @@ -0,0 +1,28 @@ +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class PlayerClassBattleCard : ClassBattleCardBase +{ + public PlayerClassBattleCard(ClassBuildInfo buildInfo) + : base(buildInfo) + { + } + + protected override ICardVfxCreator CreateVfxCreator(bool isPlayer, IBattleCardView battleCardView, bool isNullView) + { + if (isNullView) + { + return NullCardVfxCreator.GetInstance(); + } + return new PlayerClassCardVfxCreator((ClassBattleCardViewBase)battleCardView, this, base.SelfBattlePlayer.BattleView, _buildInfo.ResourceMgr); + } + + protected override IBattleCardView CreateView(BattleCardView.BuildInfo buildInfo, bool isNullView) + { + if (isNullView) + { + return new NullClassBattleCardView(buildInfo); + } + return new PlayerClassBattleCardView(buildInfo); + } +} diff --git a/SVSim.BattleEngine/Engine/PlayerDrawCardToHandVfx.cs b/SVSim.BattleEngine/Engine/PlayerDrawCardToHandVfx.cs new file mode 100644 index 0000000..7d91a0d --- /dev/null +++ b/SVSim.BattleEngine/Engine/PlayerDrawCardToHandVfx.cs @@ -0,0 +1,90 @@ +using System.Linq; +using UnityEngine; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class PlayerDrawCardToHandVfx : SequentialVfxPlayer +{ + public class ChangePlayerHandCardParentVfx : VfxBase + { + private readonly IBattleCardView m_view; + + public ChangePlayerHandCardParentVfx(IBattleCardView view) + { + m_view = view; + } + + public override void Play() + { + base.Play(); + m_view.GameObject.SetActive(value: false); + m_view.GameObject.transform.parent = BattleManagerBase.GetIns().PCardPlace.transform; + MotionUtils.SetLayerAll(m_view.GameObject, 10); + m_view.GameObject.SetActive(value: true); + IsEnd = true; + } + } + + private readonly BattleCardBase _card; + + private const float ADD_CARD_TIME = 0.25f; + + public PlayerDrawCardToHandVfx(BattleCardBase drawCard) + { + _card = drawCard; + Register(Prepare()); + Register(WaitVfx.Create(0.25f)); + Register(OnHand()); + Register(InstantVfx.Create(delegate + { + _card.SetOnDraw(draw: false); + })); + } + + private VfxBase Prepare() + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + GameObject pCardPlace = BattleManagerBase.GetIns().PCardPlace; + _card.BattleCardView.GameObject.SetActive(value: false); + _card.BattleCardView.GameObject.transform.parent = pCardPlace.transform; + MotionUtils.SetLayerAll(_card.BattleCardView.GameObject, 10); + _card.BattleCardView.GameObject.SetActive(value: true); + })); + if (_card.SelfBattlePlayer.HandCardList.Any((BattleCardBase c) => c == _card)) + { + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + if (!BattleManagerBase.GetIns().IsRecovery) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SET_CARD_TO_HAND); + } + _card.SelfBattlePlayer.BattleView.HandView.AddCardToView(_card.BattleCardView, 0.25f); + _card.SelfBattlePlayer.HandControl.AttachCardView(_card.BattleCardView); + })); + } + else + { + sequentialVfxPlayer.Register(_card.DestroyInHand(null)); + } + return sequentialVfxPlayer; + } + + private VfxBase OnHand() + { + if (_card.SelfBattlePlayer.HandCardList.Any((BattleCardBase c) => c == _card)) + { + return ParallelVfxPlayer.Create(_card.BattleCardView.ShowHandCardInfo(), _card.CalcHandCost(), InstantVfx.Create(delegate + { + if (!BattleManagerBase.GetIns().IsRecovery) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_CARD_DRAW_2, _card.BattleCardView.GameObject.transform.position) + .GetGameObjIns() + .transform.rotation = _card.BattleCardView.GameObject.transform.rotation; + } + })); + } + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/PlazField.cs b/SVSim.BattleEngine/Engine/PlazField.cs new file mode 100644 index 0000000..cce7a4d --- /dev/null +++ b/SVSim.BattleEngine/Engine/PlazField.cs @@ -0,0 +1,114 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PlazField : BackGroundBase +{ + public override int FieldId => 10; + + public PlazField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_plaz_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles10").gameObject; + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("shake_1", _fieldParticles.transform.Find("shake_1").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + switch (FieldId) + { + case 10: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_10, pos); + break; + case 20: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_20, pos); + break; + } + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + switch (FieldId) + { + case 10: + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_10_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_10_2, pos); + break; + } + break; + case 20: + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_20_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_20_2, pos); + break; + } + break; + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _battleCamera.Camera.transform.localPosition = new Vector3(-510f, 140f, -55f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-11f, -113f, 95f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(15f, -95f, -150f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-21f, -87f, 90f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _gimicCntDictionary[obj.tag]++; + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(6f); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake_1"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/PlazRiotingField.cs b/SVSim.BattleEngine/Engine/PlazRiotingField.cs new file mode 100644 index 0000000..38f4b7e --- /dev/null +++ b/SVSim.BattleEngine/Engine/PlazRiotingField.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using UnityEngine; + +public class PlazRiotingField : PlazField +{ + public override int FieldId => 20; + + public override int FieldEffectId => 20; + + public PlazRiotingField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_plz2_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles20").gameObject; + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("shake_1", _fieldParticles.transform.Find("shake_1").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } +} diff --git a/SVSim.BattleEngine/Engine/PracticeFinish.cs b/SVSim.BattleEngine/Engine/PracticeFinish.cs new file mode 100644 index 0000000..a0e7ed2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PracticeFinish.cs @@ -0,0 +1,4 @@ +public class PracticeFinish : HeaderData +{ + public PracticeFinishDetail data; +} diff --git a/SVSim.BattleEngine/Engine/PracticeFinishDetail.cs b/SVSim.BattleEngine/Engine/PracticeFinishDetail.cs new file mode 100644 index 0000000..cad588a --- /dev/null +++ b/SVSim.BattleEngine/Engine/PracticeFinishDetail.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using LitJson; + +public class PracticeFinishDetail +{ + public JsonData _responseData; + + public int get_class_chara_experience; + + public int class_chara_experience; + + public int class_chara_level; + + public List achieved_mission_list => AchievedInfo._missions; + + public List achieved_achievement_list => AchievedInfo._achievements; + + public List Rewards => AchievedInfo._rewards; + + public AchievedInfo AchievedInfo { get; private set; } + + public PracticeFinishDetail() + { + AchievedInfo = new AchievedInfo(); + } +} diff --git a/SVSim.BattleEngine/Engine/PracticeNextSceneSelector.cs b/SVSim.BattleEngine/Engine/PracticeNextSceneSelector.cs new file mode 100644 index 0000000..c1097c0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PracticeNextSceneSelector.cs @@ -0,0 +1,81 @@ +using System; +using Cute; +using UnityEngine; +using Wizard; + +public class PracticeNextSceneSelector : INextSceneSelector +{ + private BattleResultUIController m_battleResultNewControl; + + private bool _movingToMyPage; + + public PracticeNextSceneSelector(BattleResultUIController battleResultControl) + { + m_battleResultNewControl = battleResultControl; + _movingToMyPage = false; + } + + public void Setup(bool isWin, GameObject gameObject) + { + m_battleResultNewControl.MissionBtnObj.labels[0].text = Data.SystemText.Get("Battle_0200"); + m_battleResultNewControl.MissionBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.MissionBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + UIManager.GetInstance().createInSceneCenterLoading(); + MissionInfoTask missionInfoTask = GameMgr.GetIns().GetMissionInfoTask(); + missionInfoTask.SetParameter(); + m_battleResultNewControl.StartCoroutine(Toolbox.NetworkManager.Connect(missionInfoTask, delegate + { + m_battleResultNewControl.CreateMissionList(); + }, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + })); + m_battleResultNewControl.HomeBtnObj.labels[0].text = Data.SystemText.Get("Battle_0202"); + m_battleResultNewControl.HomeBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.HomeBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + MoveToMyPage(); + })); + m_battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Battle_0204"); + m_battleResultNewControl.RetryBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.RetryBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + PracticeDeckInfoTask task = new PracticeDeckInfoTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + Format value = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_FORMAT); + Action onUpdateDeckUICustomize = delegate(DeckUI deckUI) + { + if (deckUI.Deck.Format == GameMgr.GetIns().GetDataMgr().GetSelectDeckFormat() && deckUI.Deck.GetDeckID() == GameMgr.GetIns().GetDataMgr().GetSelectDeckId()) + { + deckUI.SetTextAppealLabelLeft(Data.SystemText.Get("Card_0235")); + } + deckUI.SetSelectable(deckUI.Deck.IsUsable()); + }; + DeckSelectUIDialog.Create(Data.SystemText.Get("Story_0017"), task.DeckGroupListData, value, DeckSelectUIDialog.eFormatChangeUIType.UseOtherCategory, isVisibleCreateNew: false, delegate(DialogBase dialog, DeckData deck) + { + PracticeDeckSelectConfirmDialog.Create(dialog, deck, isBattleAgain: true); + }, new DeckSelectUI.InitOptions + { + OnUpdateDeckUICustomize = onUpdateDeckUICustomize + }); + })); + })); + } + + public void Show() + { + iTween.MoveTo(m_battleResultNewControl.ButtonGrid.gameObject, iTween.Hash("position", m_battleResultNewControl.DefaultPosDict["ButtonGrid"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + private void MoveToMyPage() + { + if (!_movingToMyPage) + { + _movingToMyPage = true; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL_TRANS); + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.MyPage); + } + } +} diff --git a/SVSim.BattleEngine/Engine/PracticePuzzleFinishData.cs b/SVSim.BattleEngine/Engine/PracticePuzzleFinishData.cs new file mode 100644 index 0000000..70a4cb2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PracticePuzzleFinishData.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using LitJson; + +public class PracticePuzzleFinishData +{ + public JsonData _responseData; + + public int get_class_chara_experience; + + public int class_chara_experience; + + public int class_chara_level; + + public List achieved_mission_list => AchievedInfo._missions; + + public List achieved_achievement_list => AchievedInfo._achievements; + + public List Rewards => AchievedInfo._rewards; + + public AchievedInfo AchievedInfo { get; private set; } + + public PracticePuzzleFinishData() + { + AchievedInfo = new AchievedInfo(); + } +} diff --git a/SVSim.BattleEngine/Engine/PracticePuzzleNextSceneSelector.cs b/SVSim.BattleEngine/Engine/PracticePuzzleNextSceneSelector.cs new file mode 100644 index 0000000..17e6ac4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PracticePuzzleNextSceneSelector.cs @@ -0,0 +1,87 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; + +public class PracticePuzzleNextSceneSelector : INextSceneSelector +{ + private BattleResultUIController _battleResultController; + + private bool _movingToMyPage; + + public PracticePuzzleNextSceneSelector(BattleResultUIController battleResultControl) + { + _battleResultController = battleResultControl; + _movingToMyPage = false; + } + + public void Setup(bool isWin, GameObject gameObject) + { + _battleResultController.RetryBtnObj.gameObject.SetActive(value: false); + _battleResultController.MissionBtnObj.labels[0].text = Data.SystemText.Get("Puzzle_QuestSelect_Button"); + _battleResultController.MissionBtnObj.buttons[0].onClick.Clear(); + _battleResultController.MissionBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + SelectOtherPuzzle(); + })); + _battleResultController.HomeBtnObj.labels[0].text = Data.SystemText.Get("Battle_0516"); + _battleResultController.HomeBtnObj.buttons[0].onClick.Clear(); + _battleResultController.HomeBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + MovePuzleLobby(); + })); + } + + private void SelectOtherPuzzle() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + UIManager.GetInstance().createInSceneCenterLoading(); + PracticePuzzleListTask task = new PracticePuzzleListTask(); + int practicePuzzleGroupId = GameMgr.GetIns().GetDataMgr().PracticePuzzleGroupId; + task.SetParameter(practicePuzzleGroupId); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + List loadList = PuzzleQuestSelectDialog.CollectResourcePath(task.PuzzleQuestInfo.DisplayDatas); + UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadList, delegate + { + UIManager.GetInstance().closeInSceneCenterLoading(); + PuzzleQuestSelectDialog.CreateDialog(task.PuzzleQuestInfo, delegate(PuzzleQuestData puzzleData, int difficulty) + { + ChangeSceneOtherPuzzle(puzzleData, difficulty); + }).OnClose = delegate + { + Toolbox.ResourcesManager.RemoveAssetGroup(loadList); + }; + })); + })); + } + + private void ChangeSceneOtherPuzzle(PuzzleQuestData puzzleData, int difficulty) + { + int groupId = GameMgr.GetIns().GetDataMgr().PracticePuzzleGroupId; + UIManager.GetInstance().CreatFadeClose(delegate + { + UIManager.GetInstance().StartCoroutine(BattleManagerBase.GetIns().GetBattleControl().BattleEnd(delegate + { + UIManager.GetInstance().CreatFadeOpen(); + PuzzleUtil.SetPracticePuzzleData(groupId, puzzleData, difficulty, DataMgr.BattleType.Practice); + PuzzleUtil.ChangeSceneToPracticePuzzle(puzzleData); + })); + }); + } + + public void Show() + { + iTween.MoveTo(_battleResultController.ButtonGrid.gameObject, iTween.Hash("position", _battleResultController.DefaultPosDict["ButtonGrid"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + private void MovePuzleLobby() + { + if (!_movingToMyPage) + { + _movingToMyPage = true; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL_TRANS); + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.PracticePuzzle); + } + } +} diff --git a/SVSim.BattleEngine/Engine/PracticePuzzleReportEndAgent.cs b/SVSim.BattleEngine/Engine/PracticePuzzleReportEndAgent.cs new file mode 100644 index 0000000..0387119 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PracticePuzzleReportEndAgent.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +public class PracticePuzzleReportEndAgent : MonoBehaviour +{ + public bool IsEnd { get; private set; } + + public void Finished() + { + IsEnd = true; + } +} diff --git a/SVSim.BattleEngine/Engine/PracticePuzzleResultReporter.cs b/SVSim.BattleEngine/Engine/PracticePuzzleResultReporter.cs new file mode 100644 index 0000000..823f4e6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PracticePuzzleResultReporter.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using Cute; +using LitJson; +using UnityEngine; +using Wizard; +using Wizard.Lottery; + +public class PracticePuzzleResultReporter : IBattleResultReporter +{ + private readonly GameObject _reportEndAgentObj; + + private readonly PracticePuzzleReportEndAgent _reportEndAgent; + + public bool IsEnd => _reportEndAgent.IsEnd; + + public int RankExp => GetRankExp(); + + public int AfterRankExp => GetAfterRankExp(); + + public int ClassExp => GetClassExp(); + + public int WinCount => GetWinCount(); + + public int RankExpBonus => GetRankExpBonus(); + + public List UserAchievement => GetUserAchievementList(); + + public List UserMission => GetUserMissionList(); + + public List MissionRewards => GetRewardsList(); + + public List VictoryRewards => null; + + public LotteryApplyData LotteryData => Data.PracticePuzzleFinishData.AchievedInfo._lotteryData; + + public MyPageHomeDialogData HomeDialogData => null; + + public bool IsDataExist => true; + + public PracticePuzzleResultReporter() + { + _reportEndAgentObj = new GameObject(); + _reportEndAgent = _reportEndAgentObj.AddComponent(); + } + + public void Report(bool isWin) + { + StartFinishPractice(isWin, delegate + { + _reportEndAgent.Finished(); + }); + } + + public void StartFinishPractice(bool isWin, Action callback) + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + NetworkManager networkManager = Toolbox.NetworkManager; + PracticePuzzleBattleFinish practicePuzzleBattleFinish = new PracticePuzzleBattleFinish(); + LocalLog.RecordCheckLog(LocalLog.RecordType.CERBERUS, isWin); + practicePuzzleBattleFinish.SetParameter(dataMgr.PuzzleQuestId, (BattleManagerBase.GetIns() as PuzzleBattleManager).RetryCount, isWin); + _reportEndAgent.StartCoroutine(networkManager.Connect(practicePuzzleBattleFinish, delegate + { + callback.Call(); + }, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + public void Destroy() + { + UnityEngine.Object.Destroy(_reportEndAgentObj); + } + + public JsonData GetFinishResponseData() + { + return Data.PracticePuzzleFinishData._responseData; + } + + public List GetUserAchievementList() + { + return Data.PracticePuzzleFinishData.achieved_achievement_list; + } + + public List GetUserMissionList() + { + return Data.PracticePuzzleFinishData.achieved_mission_list; + } + + public List GetRewardsList() + { + return Data.PracticePuzzleFinishData.Rewards; + } + + public int GetRankExp() + { + return 0; + } + + public int GetAfterRankExp() + { + return 0; + } + + public int GetClassExp() + { + return Data.PracticePuzzleFinishData.get_class_chara_experience; + } + + public int GetWinCount() + { + return 0; + } + + public int GetRankExpBonus() + { + return 0; + } +} diff --git a/SVSim.BattleEngine/Engine/PracticeReportEndAgent.cs b/SVSim.BattleEngine/Engine/PracticeReportEndAgent.cs new file mode 100644 index 0000000..020868e --- /dev/null +++ b/SVSim.BattleEngine/Engine/PracticeReportEndAgent.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +public class PracticeReportEndAgent : MonoBehaviour +{ + public bool IsEnd { get; private set; } + + public void Finished() + { + IsEnd = true; + } +} diff --git a/SVSim.BattleEngine/Engine/PracticeResultAnimationAgent.cs b/SVSim.BattleEngine/Engine/PracticeResultAnimationAgent.cs new file mode 100644 index 0000000..df64515 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PracticeResultAnimationAgent.cs @@ -0,0 +1,173 @@ +using System.Collections; +using UnityEngine; + +public class PracticeResultAnimationAgent : ResultAnimationAgent +{ + public override IEnumerator RunUI(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin) + { + if (battleResultControl.ResultReporter.LotteryData.IsEnable) + { + yield return LoadLotteryImage(battleResultControl.ResultReporter.LotteryData); + } + m_BattleCamera.m_CutInCamera.gameObject.SetActive(value: false); + if (battleResultControl.IsDraw) + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleDraw.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 48, 16, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + else if (isWin) + { + battleResultControl.TitleWin.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.gameObject.SetActive(value: true); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleWin.alpha = 0f; + battleResultControl.Bg.color = new Color32(32, 24, 0, 0); + battleResultControl.ResultTitle.spriteName = "result_top_win"; + } + else + { + battleResultControl.TitleLose.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleLose.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 24, 48, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + battleResultControl.MainPanel.alpha = 1f; + yield return new WaitForSeconds(0.1f); + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + else if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOUWIN); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_WIN); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + TweenAlpha.Begin(battleResultControl.Bg.gameObject, 0.5f, 0.75f); + yield return new WaitForSeconds(0.2f); + TweenAlpha.Begin(battleResultControl.ArcaneIn.gameObject, 0.5f, 1f); + TweenAlpha.Begin(battleResultControl.ArcaneOut.gameObject, 0.5f, 1f); + iTween.ScaleTo(battleResultControl.ArcaneIn.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(battleResultControl.ArcaneOut.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + if (battleResultControl.IsDraw) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_3, Vector3.zero); + battleResultControl.TitleDraw.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else if (isWin) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_1, Vector3.zero); + battleResultControl.TitleWin.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_2, Vector3.zero); + battleResultControl.TitleLose.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + HideEmotionMessage(); + if (battleResultControl.ResultMsgWindowFlag) + { + StartCoroutine(battleResultControl.ShowSpecialResultInfo()); + } + yield return new WaitForSeconds(2f); + if (BattleManagerBase.GetIns().IsPuzzleMgr && !isWin) + { + battleResultControl.SetBattlePassGauge(delegate + { + battleResultControl.FinishResult(); + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.PracticePuzzle); + }); + yield break; + } + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_3, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + if (battleResultControl.ResultReporter.LotteryData.IsEnable) + { + yield return CreateLotteryDialog(battleResultControl.ResultReporter.LotteryData); + } + if (ShowRewardDialog(battleResultControl)) + { + while (battleResultControl.IsRewardWait) + { + yield return null; + } + } + if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 0f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 3f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_1, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_2, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + } + yield return new WaitForSeconds(0.2f); + if (isWin) + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_WIN_LOOP); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_LOSE_LOOP); + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_WINDOW_APPER); + iTween.MoveTo(battleResultControl.ClassCharObj.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassCharObj"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ResultTitle.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ResultTitle"], "time", 0.5f, "delay", 0f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ClassInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassInfo"], "time", 0.5f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(1f); + if (isWin) + { + PlayWinVoice(); + } + GameMgr.GetIns().GetDataMgr().SetPlayerEmotionId(string.Empty); + GameMgr.GetIns().GetDataMgr().SetEnemyEmotionId(string.Empty); + if (battleResultControl.AddClassExp > 0) + { + battleResultControl.SettingAddClassExpTextAnimation(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP); + yield return new WaitForSeconds(0.05f); + } + yield return new WaitForSeconds(0.5f); + } + battleResultControl.SetBattlePassGauge(delegate + { + nextSceneSelector.Show(); + battleResultControl.PrepareAchievementLog(); + battleResultControl.FinishResult(); + }); + } +} diff --git a/SVSim.BattleEngine/Engine/PracticeResultAnimationHandler.cs b/SVSim.BattleEngine/Engine/PracticeResultAnimationHandler.cs new file mode 100644 index 0000000..2179d48 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PracticeResultAnimationHandler.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +public class PracticeResultAnimationHandler : IResultAnimationHandler +{ + private readonly GameObject m_resultAnimationAgentObj; + + private readonly PracticeResultAnimationAgent m_resultAnimationAgentIns; + + public ResultAnimationAgent m_resultAnimationAgent => m_resultAnimationAgentIns; + + public PracticeResultAnimationHandler(BattleCamera battleCamera) + { + m_resultAnimationAgentObj = new GameObject(); + m_resultAnimationAgentIns = m_resultAnimationAgentObj.AddComponent(); + m_resultAnimationAgentIns.GetComponent().SetBattleCamera(battleCamera); + } + + public void Destroy() + { + Object.Destroy(m_resultAnimationAgentObj); + } +} diff --git a/SVSim.BattleEngine/Engine/PracticeResultReporter.cs b/SVSim.BattleEngine/Engine/PracticeResultReporter.cs new file mode 100644 index 0000000..1a6396c --- /dev/null +++ b/SVSim.BattleEngine/Engine/PracticeResultReporter.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using Cute; +using LitJson; +using UnityEngine; +using Wizard; +using Wizard.Lottery; + +public class PracticeResultReporter : IBattleResultReporter +{ + private readonly GameObject m_reportEndAgentObj; + + private readonly PracticeReportEndAgent m_reportEndAgent; + + public bool IsEnd => m_reportEndAgent.IsEnd; + + public int ClassExp => GetClassExp(); + + public List UserAchievement => GetUserAchievementList(); + + public List UserMission => GetUserMissionList(); + + public List MissionRewards => GetRewardsList(); + + public List VictoryRewards => null; + + public LotteryApplyData LotteryData => Data.PracticeFinish.data.AchievedInfo._lotteryData; + + public MyPageHomeDialogData HomeDialogData => null; + + public bool IsDataExist => true; + + public PracticeResultReporter() + { + m_reportEndAgentObj = new GameObject(); + m_reportEndAgent = m_reportEndAgentObj.AddComponent(); + } + + public void Report(bool isWin) + { + int is_win = (isWin ? 1 : 0); + StartFinishPractice(is_win, delegate + { + m_reportEndAgent.Finished(); + }); + } + + public void StartFinishPractice(int is_win, Action callback) + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + NetworkManager networkManager = Toolbox.NetworkManager; + PracticeFinishTask practiceFinishTask = new PracticeFinishTask(); + LocalLog.RecordCheckLog(LocalLog.RecordType.CERBERUS, is_win == 1); + practiceFinishTask.SetParameter(dataMgr.GetSelectDeckId(), is_win, BattleManagerBase.GetIns().BattlePlayer._cumulativeEvolutionCount, BattleManagerBase.GetIns().BattlePlayer.Turn, dataMgr.GetEnemyClassId(), dataMgr.m_EnemyAIDifficulty, dataMgr.GetSelectDeckFormat(), dataMgr.GetPlayerClassId()); + m_reportEndAgent.StartCoroutine(networkManager.Connect(practiceFinishTask, delegate + { + callback.Call(); + }, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + public void Destroy() + { + UnityEngine.Object.Destroy(m_reportEndAgentObj); + } + + public JsonData GetFinishResponseData() + { + return Data.PracticeFinish.data._responseData; + } + + public List GetUserAchievementList() + { + return Data.PracticeFinish.data.achieved_achievement_list; + } + + public List GetUserMissionList() + { + return Data.PracticeFinish.data.achieved_mission_list; + } + + public List GetRewardsList() + { + return Data.PracticeFinish.data.Rewards; + } + + public int GetClassExp() + { + return Data.PracticeFinish.data.get_class_chara_experience; + } +} diff --git a/SVSim.BattleEngine/Engine/PrefabMgr.cs b/SVSim.BattleEngine/Engine/PrefabMgr.cs new file mode 100644 index 0000000..f553d7f --- /dev/null +++ b/SVSim.BattleEngine/Engine/PrefabMgr.cs @@ -0,0 +1,143 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PrefabMgr +{ + private Dictionary m_PrefabData; + + private IList m_AddedGameObj = new List(); + + public PrefabMgr() + { + m_PrefabData = new Dictionary(); + } + + public void Load(string str) + { + if (!m_PrefabData.ContainsKey(str) && !string.IsNullOrEmpty(str)) + { + m_PrefabData.Add(str, Resources.Load(str)); + } + } + + public IEnumerator LoadAync(string str) + { + if (!m_PrefabData.ContainsKey(str) && !string.IsNullOrEmpty(str)) + { + ResourceRequest loadRequest = Resources.LoadAsync(str); + while (!loadRequest.isDone) + { + yield return null; + } + Object asset = loadRequest.asset; + m_PrefabData.Add(str, asset); + } + } + + public void UnLoad(string str) + { + if (m_PrefabData.ContainsKey(str)) + { + m_PrefabData.Remove(str); + Resources.UnloadUnusedAssets(); + } + } + + public void AllUnLoad() + { + m_PrefabData.Clear(); + Resources.UnloadUnusedAssets(); + } + + public GameObject CreateIns(string str) + { + if (m_PrefabData.ContainsKey(str)) + { + return Object.Instantiate(m_PrefabData[str]) as GameObject; + } + return null; + } + + public GameObject Get(string str) + { + if (m_PrefabData.ContainsKey(str)) + { + return (GameObject)m_PrefabData[str]; + } + return null; + } + + public Texture GetTexture(string str) + { + if (m_PrefabData.ContainsKey(str)) + { + return (Texture)m_PrefabData[str]; + } + return null; + } + + public Sprite GetSprite(string str) + { + if (m_PrefabData.ContainsKey(str)) + { + return (Sprite)m_PrefabData[str]; + } + return null; + } + + public AudioClip GetAudio(string str) + { + if (m_PrefabData.ContainsKey(str)) + { + return (AudioClip)m_PrefabData[str]; + } + return null; + } + + public Object GetObj(string str) + { + if (m_PrefabData.ContainsKey(str)) + { + return m_PrefabData[str]; + } + return null; + } + + public void DebugDraw() + { + foreach (string key in m_PrefabData.Keys) + { + _ = key; + } + } + + public Dictionary GetPrefabData() + { + return m_PrefabData; + } + + public void DisposeAllClonedObject() + { + for (int i = 0; i < m_AddedGameObj.Count; i++) + { + Object.DestroyImmediate(m_AddedGameObj[i]); + m_AddedGameObj[i] = null; + } + m_AddedGameObj.Clear(); + } + + public GameObject CloneObjectToParent(string str, GameObject parentObject) + { + GameObject gameObject = NGUITools.AddChild(parentObject, GameMgr.GetIns().GetPrefabMgr().Get(str)); + m_AddedGameObj.Add(gameObject); + return gameObject; + } + + public GameObject CloneObjectToParent(GameObject gobj, GameObject parentObject) + { + GameObject gameObject = NGUITools.AddChild(parentObject, gobj); + m_AddedGameObj.Add(gameObject); + return gameObject; + } +} diff --git a/SVSim.BattleEngine/Engine/PriConnField.cs b/SVSim.BattleEngine/Engine/PriConnField.cs new file mode 100644 index 0000000..71179cd --- /dev/null +++ b/SVSim.BattleEngine/Engine/PriConnField.cs @@ -0,0 +1,69 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PriConnField : BackGroundBase +{ + public override int FieldId => 1003; + + public override int FieldEffectId => 1003; + + public PriConnField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_1003_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles1003").gameObject; + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1003, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1003_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + _battleCamera.Camera.transform.localPosition = new Vector3(910f, -307f, -270f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-18.5f, -80f, 87f)); + Vector3[] bezierQuad = MotionUtils.GetBezierQuad(new Vector3(910f, -307f, -270f), new Vector3(48f, -18f, -18.5f), new Vector3(-211f, 57f, -95f), 10); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierQuad, "movetopath", false, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-17.5f, -108.5f, 95.5f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/PuzzleBattleManager.cs b/SVSim.BattleEngine/Engine/PuzzleBattleManager.cs new file mode 100644 index 0000000..d808e29 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PuzzleBattleManager.cs @@ -0,0 +1,543 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Battle.Phase; +using Wizard.Battle.Recovery; +using Wizard.Battle.Replay; +using Wizard.Battle.Resource; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; +using Wizard.BattleMgr; + +public class PuzzleBattleManager : BattleManagerBase +{ + private class PuzzleBattleMgrContentsCreator : IBattleMgrContentsCreator + { + public int RandomSeed { get; private set; } + + public IRecoveryManager RecoveryManager { get; private set; } + + public IRecoveryRecordManager RecoveryRecordManager { get; private set; } + + public IReplayRecordManager ReplayRecordManager { get; private set; } + + public PuzzleBattleMgrContentsCreator() + { + RandomSeed = new System.Random().Next(); + RecoveryManager = new NullRecoveryManager(); + RecoveryRecordManager = new NullRecoveryRecordManager(); + ReplayRecordManager = new NullReplayRecordManager(); + } + + public IBattleResourceMgr CreateResourceMgr() + { + return new BattleResourceMgr(); + } + + public VfxMgr CreateVfxMgr() + { + return new VfxMgr(); + } + + public IPhaseCreator CreatePhaseCreator(BattleManagerBase battleMgr) + { + return new PuzzleBattlePhaseCreator(battleMgr); + } + } + + public class PuzzleBattlePhaseCreator : PhaseCreatorBase + { + public PuzzleBattlePhaseCreator(BattleManagerBase battleMgr) + : base(battleMgr) + { + } + + public override IPhase CreateFirstPhase() + { + return new PuzzleLoadingPhase(_battleMgr); + } + + public override IPhase CreateOpeningPhase() + { + CreateBattleLogManager(); + return new PuzzleOpeningPhase(_battleMgr); + } + + public override IPhase CreateMainPhase() + { + return new PuzzleMainPhase(_battleMgr, BattleLogManager.GetInstance()); + } + } + + public class PuzzleLoadingPhase : LoadingPhase + { + public PuzzleLoadingPhase(BattleManagerBase tutorialBattleMgr) + : base(tutorialBattleMgr) + { + } + + public override VfxBase Setup() + { + GameMgr.GetIns().GetSoundMgr().SeMute(isMute: true); + return base.Setup(); + } + + public override VfxBase Teardown() + { + return NullVfx.GetInstance(); + } + } + + public class PuzzleOpeningPhase : OpeningPhase + { + public PuzzleOpeningPhase(BattleManagerBase quizBattleMgr) + : base(quizBattleMgr) + { + } + + public override VfxBase Setup() + { + PuzzleGenerator puzzleGenerator = new PuzzleGenerator(); + PuzzleQuestData puzzleQuestData = (_battleMgr as PuzzleBattleManager).PuzzleQuestData; + return SequentialVfxPlayer.Create(new PuzzleOpeningVfx(_battleMgr.BackGround), InstantVfx.Create(delegate + { + PuzzleBattleManager puzzleBattleManager = _battleMgr as PuzzleBattleManager; + puzzleBattleManager.CreateButton(); + puzzleBattleManager.ChangeResultLogo(); + puzzleBattleManager.SetUpResetAndFailedAnimation(); + puzzleBattleManager.SetReaperCard(); + _battleMgr.VfxMgr.RegisterSequentialVfx(puzzleGenerator.Generate(puzzleQuestData)); + _battleMgr.VfxMgr.RegisterSequentialVfx(new BattleLoadingEndVfx(_battleMgr)); + _battleMgr.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + if (!PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SOUND_MUTE)) + { + GameMgr.GetIns().GetSoundMgr().SeMute(isMute: false); + } + _battleMgr.BackGround.PlayBgm(); + })); + _battleMgr.VfxMgr.RegisterSequentialVfx(WaitVfx.Create(0.3f)); + _battleMgr.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + CreateWinConditionDisplay(delegate + { + if (puzzleBattleManager.IsClearDialogWaiting) + { + puzzleBattleManager.IsClearDialogWaiting = false; + VfxBase vfx = _battleMgr.StartBattle(); + _battleMgr.VfxMgr.RegisterSequentialVfx(vfx); + } + }); + })); + })); + } + + public override VfxWith Update(float dt) + { + return new VfxWith(NullVfx.GetInstance(), null); + } + + private void CreateWinConditionDisplay(Action onComplete) + { + PuzzleBattleManager puzzleBattleManager = _battleMgr as PuzzleBattleManager; + GameObject winConditionDisplayObj = NGUITools.AddChild(puzzleBattleManager.BattleUIContainer.gameObject, LoadPrefab("Prefab/UI/PuzzleWinConditionDisplay")); + winConditionDisplayObj.GetComponent().Setup(Data.SystemText.Get(puzzleBattleManager.PuzzleQuestData.BattleData.WinConditionTextId), delegate + { + onComplete(); + UnityEngine.Object.Destroy(winConditionDisplayObj); + }); + } + } + + public class PuzzleOpeningVfx : OpeningVfx + { + public PuzzleOpeningVfx(BackGroundBase backGround) + : base(backGround) + { + } + + public override void RegisterOpeningVfx(ClassBattleCardBase playerClass, ClassBattleCardBase enemyClass) + { + Register(new OpeningShowCharacterPanelVfx()); + Register(InstantVfx.Create(delegate + { + playerClass.SelfBattlePlayer.HandControl.SetHandPosition(); + enemyClass.SelfBattlePlayer.HandControl.SetHandPosition(); + })); + string path = GameMgr.GetIns().GetDataMgr().GetPlayerSkinId() + .ToString("00"); + string path2 = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() + .ToString("00"); + Register(new WaitLoadResourceVfx(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.ClassCharaBase))); + Register(new WaitLoadResourceVfx(Toolbox.ResourcesManager.GetAssetTypePath(path2, ResourcesManager.AssetLoadPathType.ClassCharaBase))); + } + } + + public class PuzzleMainPhase : MainPhase + { + private readonly PuzzleBattleManager _puzzleBtlMgr; + + public PuzzleMainPhase(BattleManagerBase battleManager, BattleLogManager logManager) + : base(battleManager, logManager) + { + _puzzleBtlMgr = battleManager as PuzzleBattleManager; + } + + public override VfxBase Setup() + { + return SequentialVfxPlayer.Create(CreateUpdateBattlePlayersVfx(), InstantVfx.Create(delegate + { + if (!_battleManager.IsBattleEnd && _menuButton != null) + { + _menuButton.SetActive(value: true); + _puzzleBtlMgr.ShowResetAndHintButton(); + } + }), InstantVfx.Create(delegate + { + _enableTouch = true; + })); + } + + public override VfxBase Teardown() + { + _puzzleBtlMgr.HideResetAndHintButton(); + return base.Teardown(); + } + } + + private bool _isCleared; + + public bool IsClearDialogWaiting = true; + + private const string RESET_BTN_NORMAL_SPRITE = "btn_common_02_s_off"; + + private const string RESET_BTN_PRESS_SPRITE = "btn_common_02_s_on"; + + private PuzzleAnimation _puzzleResetAnimatinon; + + private PuzzleAnimation _puzzleFaledAnimatinon; + + private bool _isReseting; + + public override bool IsBattleEnd + { + get + { + if (BattlePlayer != null && BattleEnemy != null) + { + return _isCleared; + } + return true; + } + } + + public UIButton HintButton { get; private set; } + + public UIButton ResetButton { get; private set; } + + public PuzzleQuestData PuzzleQuestData { get; private set; } + + public int PuzzleDifficulty { get; private set; } + + public int RetryCount { get; private set; } + + public GameObject ReaperCard { get; private set; } + + public PuzzleBattleManager() + : base(new PuzzleBattleMgrContentsCreator()) + { + PuzzleQuestData = Data.Master.PuzzleQuestDataList.First((PuzzleQuestData data) => data.Id == GameMgr.GetIns().GetDataMgr().PuzzleQuestId); + PuzzleDifficulty = GameMgr.GetIns().GetDataMgr().PuzzleDifficulty; + } + + protected override void SetupEvent() + { + base.SetupEvent(); + BattlePlayer.OnTurnEndFinish += delegate + { + if (!BattlePlayer.IsExtraTurn) + { + BattlePlayer.PlayerBattleView.TurnEndButtonUI.HideBtn(); + base.BattleUIContainer.ForceDisableMenu(); + BattlePlayer.PlayerBattleView.HideDetailPanel(); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + CanNotTouchCardVfx canNotTouchCardVfx = new CanNotTouchCardVfx(); + base.VfxMgr.RegisterImmediateVfx(canNotTouchCardVfx); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + ForceReset(canNotTouchCardVfx); + })); + return sequentialVfxPlayer; + } + return ControlTurnStartOpponent(); + }; + BattlePlayer.OnShortageDeck += delegate + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(OnShortageDeck(BattlePlayer)); + sequentialVfxPlayer.Register(JudgeBattleResult()); + return sequentialVfxPlayer; + }; + BattleEnemy.OnShortageDeck += delegate + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(OnShortageDeck(BattleEnemy)); + sequentialVfxPlayer.Register(JudgeBattleResult()); + return sequentialVfxPlayer; + }; + } + + private void ForceReset(CanNotTouchCardVfx canNotTouchCardVfx) + { + if (_isReseting || IsBattleEnd) + { + canNotTouchCardVfx.End(); + return; + } + RetryCount++; + _isReseting = true; + PuzzleGenerator puzzleGenerator = new PuzzleGenerator(); + base.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + _puzzleFaledAnimatinon.Run(isReset: false); + })); + base.VfxMgr.RegisterSequentialVfx(WaitVfx.Create(_puzzleFaledAnimatinon.FadeOutDuration)); + base.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + GameMgr.GetIns().GetSoundMgr().SetRejectNewSound(isMute: true); + })); + base.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + base.VfxMgr.RegisterSequentialVfx(SequentialVfxPlayer.Create(puzzleGenerator.Generate(PuzzleQuestData), ControlTurnStartPlayer(), InstantVfx.Create(delegate + { + _puzzleFaledAnimatinon.End(); + }), WaitVfx.Create(_puzzleFaledAnimatinon.FadeInDuration), InstantVfx.Create(delegate + { + GameMgr.GetIns().GetSoundMgr().SetRejectNewSound(isMute: false); + canNotTouchCardVfx.End(); + MenuButtonObject.gameObject.SetActive(value: true); + base.BattleUIContainer.ForceEnableMenu(); + _isReseting = false; + if (!GameMgr.GetIns().GetSoundMgr().IsPlayBGM()) + { + base.BackGround.PlayBgm(); + } + }))); + })); + } + + private void Reset() + { + if (!CanReset()) + { + return; + } + RetryCount++; + _isReseting = true; + PuzzleGenerator puzzleGenerator = new PuzzleGenerator(); + CanNotTouchCardVfx canNotTouchCardVfx = new CanNotTouchCardVfx(); + base.VfxMgr.RegisterImmediateVfx(canNotTouchCardVfx); + base.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + _puzzleResetAnimatinon.Run(isReset: true); + })); + base.VfxMgr.RegisterSequentialVfx(WaitVfx.Create(_puzzleResetAnimatinon.FadeOutDuration)); + base.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + GameMgr.GetIns().GetSoundMgr().SetRejectNewSound(isMute: true); + })); + base.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + base.VfxMgr.RegisterSequentialVfx(SequentialVfxPlayer.Create(puzzleGenerator.Generate(PuzzleQuestData), ControlTurnStartPlayer(), InstantVfx.Create(delegate + { + _puzzleResetAnimatinon.End(); + }), WaitVfx.Create(_puzzleResetAnimatinon.FadeInDuration), InstantVfx.Create(delegate + { + GameMgr.GetIns().GetSoundMgr().SetRejectNewSound(isMute: false); + canNotTouchCardVfx.End(); + _isReseting = false; + }))); + })); + } + + private bool CanReset() + { + if (!_isReseting && !IsBattleEnd && base.VfxMgr.IsEnd) + { + return !TouchControl.HasTouchProcessor; + } + return false; + } + + private bool IsResetButtanEnable() + { + if (!_isReseting && !IsBattleEnd && !BattlePlayer.Class.IsDead && !BattleEnemy.Class.IsDead && base.VfxMgr.IsEnd) + { + return !TouchControl.HasTouchProcessor; + } + return false; + } + + public override void Update(float dt) + { + if (ResetButton != null) + { + ResetButton.enabled = IsResetButtanEnable(); + } + base.Update(dt); + } + + public override VfxBase JudgeBattleResult() + { + if (CheckWinCondition()) + { + _isCleared = true; + base.VfxMgr.RegisterImmediateVfx(InstantVfx.Create(delegate + { + BattlePlayer.PlayerBattleView.HideTurnEndButton(); + BattlePlayer.BattleMgr.MenuButtonObject.gameObject.SetActive(value: false); + HideResetAndHintButton(); + })); + return InstantVfx.Create(delegate + { + InitiateGameEndSequence(hasWon: true); + }); + } + if (!CheckWinCondition() && (BattlePlayer.Class.IsDead || BattleEnemy.Class.IsDead)) + { + SequentialVfxPlayer.Create(); + CanNotTouchCardVfx canNotTouchCardVfx = new CanNotTouchCardVfx(); + base.VfxMgr.RegisterImmediateVfx(canNotTouchCardVfx); + BattlePlayer.PlayerBattleView.TurnEndButtonUI.HideBtn(); + base.BattleUIContainer.ForceDisableMenu(); + BattlePlayer.PlayerBattleView.HideDetailPanel(); + return InstantVfx.Create(delegate + { + ForceReset(canNotTouchCardVfx); + }); + } + return NullVfx.GetInstance(); + } + + private bool CheckWinCondition() + { + string winCondition = PuzzleQuestData.BattleData.WinCondition; + if (string.IsNullOrEmpty(winCondition)) + { + return false; + } + BattlePlayerReadOnlyInfoPair battlePlayerInfoPair = GetBattlePlayerInfoPair(isPlayer: true); + BattleCardBase battleCardBase = GetBattlePlayer(isPlayer: true).Class; + List retOldInfos = new List(); + List retNewInfos = new List(); + SkillCreator.ParseCondition(winCondition, ref retOldInfos, ref retNewInfos); + ConditionSkillFilterCollection conditionSkillFilterCollection = new ConditionSkillFilterCollection(); + foreach (string item in retNewInfos) + { + SkillFilterCreator.SetupCondition(conditionSkillFilterCollection, item, battleCardBase, null); + } + SkillOptionValue skillOptionValue = new SkillOptionValue(""); + skillOptionValue.SetupFilterVariable(battlePlayerInfoPair, battleCardBase, isPrePlay: false, null); + SkillConditionCheckerOption checkerOption = new SkillConditionCheckerOption(); + return conditionSkillFilterCollection.Filtering(battlePlayerInfoPair, battleCardBase, checkerOption, skillOptionValue, isPrePlay: false, null); + } + + public override void PlayRetire() + { + HideResetAndHintButton(); + base.PlayRetire(); + } + + protected override int GetFirstAttack(int FirstAttack) + { + return 0; + } + + private void ChangeResultLogo() + { + BattleResultControl.TitleWin.spriteName = "result_text_clear"; + BattleResultControl.TitleLose.spriteName = "result_text_failed"; + } + + private void CreateButton() + { + GameObject gameObject = NGUITools.AddChild(base.BattleUIContainer.gameObject, LoadPrefab("Prefab/UI/HintBtn")); + gameObject.GetComponent().uiCamera = GameMgr.GetIns().GetGameObjMgr().GetUIContainerCam(); + UISprite componentInChildren = gameObject.GetComponentInChildren(); + componentInChildren.atlas = UIManager.GetInstance().GetAtlasList().FirstOrDefault((UIAtlas s) => s.name == "Battle"); + componentInChildren.spriteName = "battle_btn_hint_off"; + HintButton = gameObject.GetComponentInChildren(); + HintButton.normalSprite = "battle_btn_hint_off"; + HintButton.pressedSprite = "battle_btn_hint_on"; + HintButton.onClick.Clear(); + HintButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Puzzle_Hint_Title")); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueButton); + dialogBase.SetButtonText(Data.SystemText.Get("Common_0004")); + GameObject gameObject3 = UnityEngine.Object.Instantiate(LoadPrefab("Prefab/UI/PuzzleHintDialog")); + gameObject3.GetComponent().Setup(Data.SystemText.Get(PuzzleQuestData.BattleData.WinConditionTextId), Data.SystemText.Get(PuzzleQuestData.BattleData.HintTextId)); + dialogBase.SetObj(gameObject3); + })); + GameObject gameObject2 = NGUITools.AddChild(base.BattleUIContainer.gameObject, LoadPrefab("Prefab/UI/PuzzleResetBtn")); + gameObject2.GetComponent().uiCamera = GameMgr.GetIns().GetGameObjMgr().GetUIContainerCam(); + ResetButton = gameObject2.GetComponentInChildren(); + ResetButton.onClick.Clear(); + ResetButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + BattlePlayer.PlayerBattleView.TurnEndButtonUI.HideBtn(); + base.BattleUIContainer.SetEnableReset(isEnable: false); + BattlePlayer.PlayerBattleView.HideDetailPanel(); + Reset(); + })); + ResetButton.GetComponentInChildren().text = Data.SystemText.Get("Puzzle_Reset_Button"); + HideResetAndHintButton(); + } + + public void SetUpResetAndFailedAnimation() + { + GameObject gameObject = NGUITools.AddChild(base.BattleUIContainer.gameObject, LoadPrefab("Prefab/UI/PuzzleAnimation")); + _puzzleResetAnimatinon = gameObject.GetComponent(); + _puzzleResetAnimatinon.SetUp(); + GameObject gameObject2 = NGUITools.AddChild(base.BattleUIContainer.gameObject, LoadPrefab("Prefab/UI/PuzzleAnimation")); + _puzzleFaledAnimatinon = gameObject2.GetComponent(); + _puzzleFaledAnimatinon.SetUp(); + } + + public void SetReaperCard() + { + ReaperCard = CardHolder.transform.GetChild(GetMaxDeckCount(isSelf: true)).gameObject; + } + + private static GameObject LoadPrefab(string path) + { + PrefabMgr prefabMgr = GameMgr.GetIns().GetPrefabMgr(); + prefabMgr.Load(path); + return prefabMgr.Get(path); + } + + public void ShowResetAndHintButton() + { + HintButton.gameObject.SetActive(value: true); + ResetButton.gameObject.SetActive(value: true); + } + + public void HideResetAndHintButton() + { + HintButton.gameObject.SetActive(value: false); + ResetButton.gameObject.SetActive(value: false); + } + + public override void DisposeBattleGameObj() + { + GameMgr.GetIns().IsPuzzleQuest = false; + base.DisposeBattleGameObj(); + } +} diff --git a/SVSim.BattleEngine/Engine/QuestFinish.cs b/SVSim.BattleEngine/Engine/QuestFinish.cs new file mode 100644 index 0000000..982e0db --- /dev/null +++ b/SVSim.BattleEngine/Engine/QuestFinish.cs @@ -0,0 +1,4 @@ +public class QuestFinish : HeaderData +{ + public QuestFinishDetail data; +} diff --git a/SVSim.BattleEngine/Engine/QuestNextSceneSelector.cs b/SVSim.BattleEngine/Engine/QuestNextSceneSelector.cs new file mode 100644 index 0000000..ce21792 --- /dev/null +++ b/SVSim.BattleEngine/Engine/QuestNextSceneSelector.cs @@ -0,0 +1,170 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; + +public class QuestNextSceneSelector : INextSceneSelector +{ + private BattleResultUIController _battleResultNewControl; + + private bool _isMovingPage; + + private const float QUEST_RESULT_SHOW_TIME = 0.5f; + + private const int DECK_SELECT_UI_DEPTH = 40; + + public QuestNextSceneSelector(BattleResultUIController battleResultControl) + { + _battleResultNewControl = battleResultControl; + _isMovingPage = false; + } + + private void SetupSecretBoss() + { + _battleResultNewControl.QuestBattleResultObject.MyPageCamera.gameObject.SetActive(value: true); + _battleResultNewControl.MissionBtnObj.buttons[0].gameObject.SetActive(value: false); + _battleResultNewControl.gameObject.SetActive(value: true); + _battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Battle_0204"); + _battleResultNewControl.RetryBtnObj.buttons[0].onClick.Clear(); + _battleResultNewControl.RetryBtnObj.buttons[0].onClick.Add(new EventDelegate(OnClickSecretBossRetry)); + _battleResultNewControl.HomeBtnObj.labels[0].text = Data.SystemText.Get("Quest_0016"); + _battleResultNewControl.HomeBtnObj.buttons[0].onClick.Clear(); + _battleResultNewControl.HomeBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + MoveToQuestSelectionPage(); + })); + } + + private void OnClickSecretBossRetry() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + GameMgr.GetIns().GetDataMgr().QuestFirstSelectType = QuestSelectionPage.FirstSelectType.BOSS_RUSH; + BossRushClearDeckListTask task = new BossRushClearDeckListTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + Format format = Format.Hof; + DeckGroupListData deckGroupListData = new DeckGroupListData(new DeckGroup(task.DeckList, format, DeckAttributeType.QuestSecretBoss)); + DeckSelectUIDialog deckSelectUIDialog = DeckSelectUIDialog.Create(Data.SystemText.Get("BossRush_0032"), deckGroupListData, format, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: false, delegate(DialogBase dialog, DeckData deck) + { + OnSelectDeck(deck, task.AbilityDictionary[deck.GetDeckID()]); + }); + deckSelectUIDialog.Dialog.SetLayer("MyPage"); + deckSelectUIDialog.Dialog.SetPanelDepth(40); + deckSelectUIDialog.SetPanelDepth(41); + })); + } + + private void OnSelectDeck(DeckData deck, List abilityList) + { + SecretBossDeckConfirmDialog.Create(deck, abilityList, isBattleAgain: true); + } + + public void Setup(bool isWin, GameObject gameObject) + { + if (GameMgr.GetIns().GetDataMgr().m_BattleType == DataMgr.BattleType.SecretBossQuest) + { + SetupSecretBoss(); + return; + } + if (!BattleManagerBase.GetIns().IsPuzzleMgr && GameMgr.GetIns().GetDataMgr().m_BattleType != DataMgr.BattleType.BossRushQuest) + { + _battleResultNewControl.MissionBtnObj.labels[0].text = Data.SystemText.Get("Quest_0005"); + _battleResultNewControl.MissionBtnObj.buttons[0].onClick.Clear(); + _battleResultNewControl.MissionBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + _battleResultNewControl.QuestBattleResultObject.CreateQuestList(); + })); + } + else + { + _battleResultNewControl.MissionBtnObj.buttons[0].gameObject.SetActive(value: false); + } + _battleResultNewControl.HomeBtnObj.labels[0].text = Data.SystemText.Get("Quest_0016"); + _battleResultNewControl.HomeBtnObj.buttons[0].onClick.Clear(); + _battleResultNewControl.HomeBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + MoveToQuestSelectionPage(); + })); + if (BattleManagerBase.GetIns().IsPuzzleMgr) + { + _battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Puzzle_QuestSelect_Button"); + _battleResultNewControl.RetryBtnObj.buttons[0].onClick.Clear(); + _battleResultNewControl.RetryBtnObj.buttons[0].onClick.Add(new EventDelegate(OnClickPuzzleButton)); + return; + } + if (GameMgr.GetIns().GetDataMgr().m_BattleType == DataMgr.BattleType.BossRushQuest) + { + _battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Battle_0203"); + _battleResultNewControl.RetryBtnObj.buttons[0].onClick.Clear(); + _battleResultNewControl.RetryBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + MoveToBossRushLobby(); + })); + return; + } + if (isWin && GameMgr.GetIns().GetDataMgr().QuestBattleData.IsExtra) + { + _battleResultNewControl.RetryBtnObj.buttons[0].gameObject.SetActive(value: false); + return; + } + _battleResultNewControl.gameObject.SetActive(value: true); + _battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Battle_0204"); + _battleResultNewControl.RetryBtnObj.buttons[0].onClick.Clear(); + _battleResultNewControl.RetryBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + QuestDeckListTask task = new QuestDeckListTask(); + task.SetParameter(GameMgr.GetIns().GetDataMgr().QuestBattleData.QuestStageId); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + QuestSelectionPage.CreateQuestDeckDialog(task.DeckGroupListData, task.BonusFormatList, task.BonusClassList, isBattleAgain: true); + })); + })); + } + + public void Show() + { + iTween.MoveTo(_battleResultNewControl.ButtonGrid.gameObject, iTween.Hash("position", _battleResultNewControl.DefaultPosDict["ButtonGrid"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + private void MoveToQuestSelectionPage() + { + if (!_isMovingPage) + { + _isMovingPage = true; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL_TRANS); + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.QuestSelectionPage); + } + } + + private void MoveToBossRushLobby() + { + if (!_isMovingPage) + { + _isMovingPage = true; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL_TRANS); + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.BossRushLobby); + } + } + + private void OnClickPuzzleButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + UIManager.GetInstance().StartCoroutine(PuzzleUtil.OpenPuzzleSelectDialogCoroutine(OnDecidePuzzleQuest)); + } + + private void OnDecidePuzzleQuest(PuzzleQuestData data, int difficulty) + { + GameMgr.GetIns().GetSoundMgr().StopAllBGM(0.5f); + UIManager.GetInstance().CreatFadeClose(delegate + { + UIManager.GetInstance().StartCoroutine(BattleManagerBase.GetIns().GetBattleControl().BattleEnd(delegate + { + UIManager.GetInstance().CreatFadeOpen(); + PuzzleUtil.SetPuzzleQuestData(data, difficulty, DataMgr.BattleType.Quest); + PuzzleUtil.ChangeSceneToPuzzleQuest(data); + })); + }); + } +} diff --git a/SVSim.BattleEngine/Engine/QuestReportEndAgent.cs b/SVSim.BattleEngine/Engine/QuestReportEndAgent.cs new file mode 100644 index 0000000..060f168 --- /dev/null +++ b/SVSim.BattleEngine/Engine/QuestReportEndAgent.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +public class QuestReportEndAgent : MonoBehaviour +{ + public bool IsEnd { get; private set; } + + public void Finished() + { + IsEnd = true; + } +} diff --git a/SVSim.BattleEngine/Engine/QuestResultReporter.cs b/SVSim.BattleEngine/Engine/QuestResultReporter.cs new file mode 100644 index 0000000..3bba71d --- /dev/null +++ b/SVSim.BattleEngine/Engine/QuestResultReporter.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using Cute; +using LitJson; +using UnityEngine; +using Wizard; +using Wizard.Lottery; + +public class QuestResultReporter : IBattleResultReporter +{ + private readonly GameObject _reportEndAgentObj; + + private readonly QuestReportEndAgent _reportEndAgent; + + public bool IsEnd => _reportEndAgent.IsEnd; + + public int ClassExp => GetClassExp(); + + public List UserAchievement => GetUserAchievementList(); + + public List UserMission => GetUserMissionList(); + + public List MissionRewards => GetRewardsList(); + + public List VictoryRewards => null; + + public LotteryApplyData LotteryData => Data.QuestFinish.data.AchievedInfo._lotteryData; + + public MyPageHomeDialogData HomeDialogData => null; + + public bool IsDataExist => true; + + public QuestResultReporter() + { + _reportEndAgentObj = new GameObject(); + _reportEndAgent = _reportEndAgentObj.AddComponent(); + } + + public void Report(bool isWin) + { + StartFinishQuest(isWin, delegate + { + _reportEndAgent.Finished(); + }); + } + + public void StartFinishQuest(bool isWin, Action callback) + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + LocalLog.RecordCheckLog(LocalLog.RecordType.CERBERUS, isWin); + SkillOptionValue skillOptionValue = new SkillOptionValue(SkillCreator.ParseContentInfos("mission_info={me.main_place.class.turn}")); + SkillCollectionBase.SetupOptionValue(skillOptionValue, ins.GetBattlePlayerPair(isPlayer: true), ins.GetBattlePlayer(isPlayer: true).Class, null); + BaseTask baseTask = null; + if (BattleManagerBase.GetIns().IsPuzzleMgr) + { + int id = (BattleManagerBase.GetIns() as PuzzleBattleManager).PuzzleQuestData.Id; + baseTask = new QuestFinishTask(isPuzzle: true); + (baseTask as QuestFinishTask).SetParameterForPuzzle(id, isWin); + } + else if (dataMgr.m_BattleType == DataMgr.BattleType.BossRushQuest) + { + baseTask = new BossRushFinishTask(); + (baseTask as BossRushFinishTask).SetParameter(BattleManagerBase.GetIns().BattlePlayer.Class.Life, BattleManagerBase.GetIns().BattlePlayer.Class.MaxLife, dataMgr.BossRushBattleData.QuestStageId, dataMgr.GetSelectDeckId(), isWin, dataMgr.GetSelectDeckFormat(), dataMgr.IsLastSelectDeckAttributeType(DeckAttributeType.BuildDeck), dataMgr.IsLastSelectDeckAttributeType(DeckAttributeType.TrialDeck), ins.IsFirst, skillOptionValue.GetInt(SkillFilterCreator.ContentKeyword.mission_info, 0)); + } + else if (dataMgr.m_BattleType == DataMgr.BattleType.SecretBossQuest) + { + baseTask = new BossRushHiddenBattleFinishTask(); + (baseTask as BossRushHiddenBattleFinishTask).SetParameter(dataMgr.BossRushBattleData.QuestStageId, dataMgr.GetSelectDeckId(), isWin, dataMgr.GetSelectDeckFormat(), dataMgr.IsLastSelectDeckAttributeType(DeckAttributeType.BuildDeck), dataMgr.IsLastSelectDeckAttributeType(DeckAttributeType.TrialDeck), ins.IsFirst, skillOptionValue.GetInt(SkillFilterCreator.ContentKeyword.mission_info, 0)); + } + else + { + baseTask = new QuestFinishTask(); + (baseTask as QuestFinishTask).SetParameter(dataMgr.QuestBattleData.QuestStageId, dataMgr.GetSelectDeckId(), isWin, dataMgr.GetSelectDeckFormat(), dataMgr.IsLastSelectDeckAttributeType(DeckAttributeType.BuildDeck), dataMgr.IsLastSelectDeckAttributeType(DeckAttributeType.TrialDeck), ins.IsFirst, skillOptionValue.GetInt(SkillFilterCreator.ContentKeyword.mission_info, 0)); + } + _reportEndAgent.StartCoroutine(Toolbox.NetworkManager.Connect(baseTask, delegate + { + callback.Call(); + }, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + public void Destroy() + { + UnityEngine.Object.Destroy(_reportEndAgentObj); + } + + public JsonData GetFinishResponseData() + { + return Data.QuestFinish.data._responseData; + } + + public List GetUserAchievementList() + { + return Data.QuestFinish.data.achieved_achievement_list; + } + + public List GetUserMissionList() + { + return Data.QuestFinish.data.achieved_mission_list; + } + + public List GetRewardsList() + { + return Data.QuestFinish.data.Rewards; + } + + public int GetClassExp() + { + return Data.QuestFinish.data.get_class_chara_experience; + } +} diff --git a/SVSim.BattleEngine/Engine/QuestSpecialResultAnimationAgent.cs b/SVSim.BattleEngine/Engine/QuestSpecialResultAnimationAgent.cs new file mode 100644 index 0000000..7dc7db4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/QuestSpecialResultAnimationAgent.cs @@ -0,0 +1,282 @@ +using System.Collections; +using UnityEngine; +using Wizard; + +public class QuestSpecialResultAnimationAgent : ResultAnimationAgent +{ + private bool IsBossRushTotalResult(bool isWin) + { + if (GameMgr.GetIns().GetDataMgr().m_BattleType == DataMgr.BattleType.BossRushQuest) + { + BossRushBattleData bossRushBattleData = GameMgr.GetIns().GetDataMgr().BossRushBattleData; + bool flag = isWin && bossRushBattleData.CurrentWinCount + 1 >= bossRushBattleData.MaxBattleCount; + return !isWin || flag; + } + return false; + } + + public override IEnumerator RunUI(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin) + { + if (battleResultControl.ResultReporter.LotteryData.IsEnable) + { + yield return LoadLotteryImage(battleResultControl.ResultReporter.LotteryData); + } + m_BattleCamera.m_CutInCamera.gameObject.SetActive(value: false); + if (battleResultControl.IsDraw) + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleDraw.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 48, 16, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + else if (isWin) + { + battleResultControl.TitleWin.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.gameObject.SetActive(value: true); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleWin.alpha = 0f; + battleResultControl.Bg.color = new Color32(32, 24, 0, 0); + battleResultControl.ResultTitle.spriteName = "result_top_win"; + } + else + { + battleResultControl.TitleLose.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleLose.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 24, 48, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + battleResultControl.MainPanel.alpha = 1f; + yield return new WaitForSeconds(0.1f); + battleResultControl.SetBackGroundNeedBattlePoint(needBattlePoint: true); + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + else if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOUWIN); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_WIN); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + TweenAlpha.Begin(battleResultControl.Bg.gameObject, 0.5f, 0.75f); + yield return new WaitForSeconds(0.2f); + TweenAlpha.Begin(battleResultControl.ArcaneIn.gameObject, 0.5f, 1f); + TweenAlpha.Begin(battleResultControl.ArcaneOut.gameObject, 0.5f, 1f); + iTween.ScaleTo(battleResultControl.ArcaneIn.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(battleResultControl.ArcaneOut.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + if (battleResultControl.IsDraw) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_3, Vector3.zero); + battleResultControl.TitleDraw.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else if (isWin) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_1, Vector3.zero); + battleResultControl.TitleWin.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_2, Vector3.zero); + battleResultControl.TitleLose.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + HideEmotionMessage(); + if (battleResultControl.ResultMsgWindowFlag) + { + StartCoroutine(battleResultControl.ShowSpecialResultInfo()); + } + yield return new WaitForSeconds(2f); + if (battleResultControl.ResultReporter.LotteryData.IsEnable) + { + yield return CreateLotteryDialog(battleResultControl.ResultReporter.LotteryData); + } + if (BattleManagerBase.GetIns().IsPuzzleMgr && !isWin) + { + battleResultControl.SetBattlePassGauge(delegate + { + battleResultControl.FinishResult(); + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.QuestSelectionPage); + }); + yield break; + } + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_3, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + if (ShowRewardDialog(battleResultControl)) + { + while (battleResultControl.IsRewardWait) + { + yield return null; + } + } + if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 0f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 3f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_1, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_2, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + } + yield return new WaitForSeconds(0.2f); + if (isWin) + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_WIN_LOOP); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_LOSE_LOOP); + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_WINDOW_APPER); + iTween.MoveTo(battleResultControl.ClassCharObj.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassCharObj"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ResultTitle.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ResultTitle"], "time", 0.5f, "delay", 0f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ClassInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassInfo"], "time", 0.5f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.QuestBattleResultObject._questPointInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["QuestPointInfo"], "time", 0.5f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(1f); + if (isWin) + { + PlayWinVoice(); + } + if (battleResultControl.AddClassExp > 0) + { + battleResultControl.SettingAddClassExpTextAnimation(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + yield return PlayUpdateGaugeSe(); + } + yield return new WaitForSeconds(0.5f); + } + if (Data.QuestFinish.data.AddPoint != 0) + { + battleResultControl.QuestBattleResultObject.SettingAddQuestPointTextAnimation(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + yield return PlayUpdateGaugeSe(); + } + yield return new WaitForSeconds(0.5f); + } + if (Data.QuestFinish.data.WinBonusPoint > 0) + { + battleResultControl.QuestBattleResultObject.AddWinBonusQuestPoint(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + yield return PlayUpdateGaugeSe(); + } + yield return new WaitForSeconds(0.5f); + } + if (Data.QuestFinish.data.GetTotalBonusPoint() > 0) + { + battleResultControl.QuestBattleResultObject.SettingAddBounusQuestPointTextAnimation(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + yield return PlayUpdateGaugeSe(); + } + yield return new WaitForSeconds(0.5f); + } + if (Data.QuestFinish.data.CommonMissionClearInfoList.Count > 0) + { + battleResultControl.QuestBattleResultObject.SettingAddCommonMissionQuestPointTextAnimation(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + yield return PlayUpdateGaugeSe(); + } + yield return new WaitForSeconds(0.5f); + } + if (Data.QuestFinish.data.CharacterMissionClearInfoList.Count > 0) + { + battleResultControl.QuestBattleResultObject.SettingAddCharacterMissionQuestPointTextAnimation(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + yield return PlayUpdateGaugeSe(); + } + yield return new WaitForSeconds(0.5f); + } + if (IsBossRushTotalResult(isWin)) + { + StartCoroutine(battleResultControl.QuestBattleResultObject.SettingBossRushFinishResultAnimation(isWin)); + } + yield return battleResultControl.QuestBattleResultObject.PlayAnimationCoroutine(); + yield return PlayBattlePassGaugeCoroutine(battleResultControl); + yield return OpenHomeDialogCoroutine(Data.QuestFinish.data.HomeDialogData); + if (IsBossRushTotalResult(isWin)) + { + while (!battleResultControl.QuestBattleResultObject.IsBossRushTotalResultFinish) + { + yield return null; + } + } + nextSceneSelector.Show(); + battleResultControl.PrepareAchievementLog(); + battleResultControl.FinishResult(); + GameMgr.GetIns().GetDataMgr().SetPlayerEmotionId(string.Empty); + GameMgr.GetIns().GetDataMgr().SetEnemyEmotionId(string.Empty); + } + + private IEnumerator PlayUpdateGaugeSe() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP); + yield return new WaitForSeconds(0.05f); + } + + private IEnumerator PlayBattlePassGaugeCoroutine(BattleResultUIController controller) + { + bool isFinished = false; + controller.SetBattlePassGauge(delegate + { + isFinished = true; + }); + while (!isFinished) + { + yield return null; + } + } + + private IEnumerator OpenHomeDialogCoroutine(MyPageHomeDialogData dialogData) + { + if (dialogData != null && dialogData.IsEnable) + { + bool isClosed = false; + MyPageHomeDialog.Create(UIManager.GetInstance().HomeDialogPrefab, dialogData, delegate + { + isClosed = true; + }); + while (!isClosed) + { + yield return null; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/QuestSpecialResultAnimationHandler.cs b/SVSim.BattleEngine/Engine/QuestSpecialResultAnimationHandler.cs new file mode 100644 index 0000000..c694e87 --- /dev/null +++ b/SVSim.BattleEngine/Engine/QuestSpecialResultAnimationHandler.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +public class QuestSpecialResultAnimationHandler : IResultAnimationHandler +{ + private readonly GameObject _resultAnimationAgentObj; + + private readonly QuestSpecialResultAnimationAgent _resultAnimationAgentIns; + + private readonly QuestSpecialBattleResult _resultUI; + + public ResultAnimationAgent m_resultAnimationAgent => _resultAnimationAgentIns; + + public QuestSpecialResultAnimationHandler(BattleCamera battleCamera, QuestSpecialBattleResult resultUI) + { + _resultAnimationAgentObj = new GameObject(); + _resultAnimationAgentIns = _resultAnimationAgentObj.AddComponent(); + _resultAnimationAgentIns.GetComponent().SetBattleCamera(battleCamera); + _resultUI = resultUI; + UIManager.GetInstance().StartCoroutine(resultUI.LoadCoroutine()); + } + + public void Destroy() + { + _resultUI.Unload(); + Object.Destroy(_resultAnimationAgentObj); + } +} diff --git a/SVSim.BattleEngine/Engine/QuestStageIdFilter.cs b/SVSim.BattleEngine/Engine/QuestStageIdFilter.cs new file mode 100644 index 0000000..cbedc14 --- /dev/null +++ b/SVSim.BattleEngine/Engine/QuestStageIdFilter.cs @@ -0,0 +1,22 @@ +public class QuestStageIdFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + if (dataMgr.m_BattleType != DataMgr.BattleType.Quest) + { + return -1; + } + return dataMgr.QuestBattleData.QuestStageId; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + if (dataMgr.m_BattleType != DataMgr.BattleType.Quest) + { + return -1; + } + return dataMgr.QuestBattleData.QuestStageId; + } +} diff --git a/SVSim.BattleEngine/Engine/RandomValueFilter.cs b/SVSim.BattleEngine/Engine/RandomValueFilter.cs new file mode 100644 index 0000000..e318256 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RandomValueFilter.cs @@ -0,0 +1,19 @@ +public class RandomValueFilter : ISkillEnvironmentalFilter +{ + private int _range; + + public RandomValueFilter(string rangeString) + { + _range = int.Parse(rangeString); + } + + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return BattleManagerBase.GetIns().StableRandom(_range); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/RankMatchFinish.cs b/SVSim.BattleEngine/Engine/RankMatchFinish.cs new file mode 100644 index 0000000..28b06a0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RankMatchFinish.cs @@ -0,0 +1,4 @@ +public class RankMatchFinish : HeaderData +{ + public RankMatchFinishDetail data; +} diff --git a/SVSim.BattleEngine/Engine/RankMatchFinishDetail.cs b/SVSim.BattleEngine/Engine/RankMatchFinishDetail.cs new file mode 100644 index 0000000..6d13138 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RankMatchFinishDetail.cs @@ -0,0 +1,47 @@ +using System; +using Wizard; + +public class RankMatchFinishDetail : MatchFinishBase +{ + public MyPageHomeDialogData HomeDialogData; + + public int UserRank { get; set; } + + public int AfterBattlePoint { get; set; } + + public int AfterMasterPoint { get; set; } + + public int BasicBattlePoint_and_SuperiorBonus { private get; set; } + + public int BasicMasterPoint_and_SuperiorBonus { private get; set; } + + public int SuccessiveWinNumber { get; set; } + + public int SuccessiveWinBonus { get; set; } + + public int AfterExp + { + get + { + if (!PlayerStaticData.IsMasterRankCurrentFormat()) + { + return AfterBattlePoint; + } + return AfterMasterPoint; + } + } + + public int BasicExp_and_SuperiorBonus + { + get + { + if (!PlayerStaticData.IsMasterRankCurrentFormat()) + { + return BasicBattlePoint_and_SuperiorBonus; + } + return BasicMasterPoint_and_SuperiorBonus; + } + } + + public DateTime? SpeedChallengeAnnounceTime { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/RankMatchResultAnimationAgent.cs b/SVSim.BattleEngine/Engine/RankMatchResultAnimationAgent.cs new file mode 100644 index 0000000..6aa7e3b --- /dev/null +++ b/SVSim.BattleEngine/Engine/RankMatchResultAnimationAgent.cs @@ -0,0 +1,351 @@ +using System.Collections; +using UnityEngine; +using Wizard; +using Wizard.UI.Dialog; + +public class RankMatchResultAnimationAgent : ResultAnimationAgent +{ + public override IEnumerator RunUI(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin) + { + m_BattleCamera.m_CutInCamera.gameObject.SetActive(value: false); + if (battleResultControl.ResultReporter.LotteryData.IsEnable) + { + yield return LoadLotteryImage(battleResultControl.ResultReporter.LotteryData); + } + if (battleResultControl.IsDraw) + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleDraw.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 48, 16, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + else if (isWin) + { + battleResultControl.TitleWin.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.gameObject.SetActive(value: true); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleWin.alpha = 0f; + battleResultControl.Bg.color = new Color32(32, 24, 0, 0); + battleResultControl.ResultTitle.spriteName = "result_top_win"; + } + else + { + battleResultControl.TitleLose.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleLose.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 24, 48, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + battleResultControl.MainPanel.alpha = 1f; + yield return new WaitForSeconds(0.1f); + RankMatchBattleResult rankMatchBattleResult = battleResultControl.RankMatchBattleResultObject; + RankInfo matchInfo = Data.Load.data.GetRankInfo(Data.CurrentFormat, rankMatchBattleResult.BeforeRankLv); + if (!rankMatchBattleResult.IsPromoPrev) + { + battleResultControl.SetBackGroundNeedBattlePoint(needBattlePoint: true); + } + else + { + bool backGroundNeedBattlePoint = PlayerStaticData.UserPromotionWinCount >= matchInfo.necessary_win || PlayerStaticData.UserPromotionLoseCount >= matchInfo.reset_lose; + battleResultControl.SetBackGroundNeedBattlePoint(backGroundNeedBattlePoint); + } + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + else if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOUWIN); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_WIN); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + TweenAlpha.Begin(battleResultControl.Bg.gameObject, 0.5f, 0.75f); + yield return new WaitForSeconds(0.2f); + TweenAlpha.Begin(battleResultControl.ArcaneIn.gameObject, 0.5f, 1f); + TweenAlpha.Begin(battleResultControl.ArcaneOut.gameObject, 0.5f, 1f); + iTween.ScaleTo(battleResultControl.ArcaneIn.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(battleResultControl.ArcaneOut.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + if (battleResultControl.IsDraw) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_3, Vector3.zero); + battleResultControl.TitleDraw.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else if (isWin) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_1, Vector3.zero); + battleResultControl.TitleWin.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_2, Vector3.zero); + battleResultControl.TitleLose.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + HideEmotionMessage(); + if (battleResultControl.ResultMsgWindowFlag) + { + StartCoroutine(battleResultControl.ShowSpecialResultInfo()); + } + yield return new WaitForSeconds(2f); + if (battleResultControl.ResultReporter.LotteryData.IsEnable) + { + yield return CreateLotteryDialog(battleResultControl.ResultReporter.LotteryData); + } + RankWinnerReward winnerReward = GameMgr.GetIns()._rankWinnerReward; + if (winnerReward == null) + { + int value = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_GRADE); + string value2 = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_STRING); + if (value != 0 && value2 != "") + { + winnerReward = UIManager.GetInstance().createRankWinnerReward(); + GameMgr.GetIns()._rankWinnerReward = winnerReward; + winnerReward.SetInfomation(value, value2); + winnerReward.gameObject.SetActive(value: false); + } + } + if (winnerReward != null && isWin) + { + float seconds = 3f; + StartCoroutine(winnerReward.ResultWinnerReward()); + yield return new WaitForSeconds(seconds); + StartCoroutine(winnerReward.HideRewardObject()); + } + if (!battleResultControl.IsDraw && ShowRewardDialog(battleResultControl)) + { + while (battleResultControl.IsRewardWait) + { + yield return null; + } + } + if (Data.RankMatchFinish.data != null) + { + TreasureBoxCpResultInfo treasureBoxCpResultInfo = Data.RankMatchFinish.data.TreasureBoxCpResultInfo; + if (treasureBoxCpResultInfo.IsPlayGradeUpAnimation()) + { + yield return TreasureBoxCpOpenBoxAnimation(battleResultControl, treasureBoxCpResultInfo.AfterGrade); + } + if (treasureBoxCpResultInfo.IsBoxOpened()) + { + yield return CreateTreasureBoxCpRewardDialog(treasureBoxCpResultInfo); + } + } + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_3, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 0f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 3f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_1, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_2, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + if (winnerReward != null) + { + winnerReward.RemoveObject(); + GameMgr.GetIns()._rankWinnerReward = null; + } + yield return new WaitForSeconds(0.2f); + if (isWin) + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_WIN_LOOP); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_LOSE_LOOP); + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_WINDOW_APPER); + iTween.MoveTo(battleResultControl.ClassCharObj.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassCharObj"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ResultTitle.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ResultTitle"], "time", 0.5f, "delay", 0f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ClassInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassInfo"], "time", 0.5f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + if (!rankMatchBattleResult.IsPromoPrev) + { + iTween.MoveTo(rankMatchBattleResult.RankInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["RankInfo"], "time", 0.5f, "delay", 0.4f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + yield return new WaitForSeconds(1f); + if (rankMatchBattleResult.WinCount > 1) + { + TweenAlpha.Begin(rankMatchBattleResult.WinsObj.labels[0].gameObject, 0.3f, 1f); + TweenAlpha.Begin(rankMatchBattleResult.WinsObj.labels[1].gameObject, 0.3f, 1f); + iTween.MoveFrom(rankMatchBattleResult.WinsObj.gameObject, iTween.Hash("x", rankMatchBattleResult.WinsObj.transform.localPosition.x + 50f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + if (isWin) + { + PlayWinVoice(); + } + if (battleResultControl.AddClassExp > 0) + { + battleResultControl.SettingAddClassExpTextAnimation(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP); + yield return new WaitForSeconds(0.05f); + } + yield return new WaitForSeconds(0.5f); + } + if (rankMatchBattleResult.IsPromoPrev) + { + StartCoroutine(rankMatchBattleResult.RunMatchUI()); + yield return new WaitForSeconds(3.5f); + bool isEndPromo = false; + if (PlayerStaticData.UserPromotionWinCount >= matchInfo.necessary_win) + { + isEndPromo = true; + StartCoroutine(rankMatchBattleResult.RunTierUp()); + battleResultControl.RankMatchBattleResultObject.IsRunUIStop = true; + while (battleResultControl.RankMatchBattleResultObject.IsRunUIStop) + { + yield return null; + } + yield return new WaitForSeconds(0.5f); + } + else if (PlayerStaticData.UserPromotionLoseCount >= matchInfo.reset_lose) + { + isEndPromo = true; + StartCoroutine(rankMatchBattleResult.RunFailed()); + yield return new WaitForSeconds(3f); + } + if (isEndPromo) + { + PlayerStaticData.UserPromotionMatchCount = 0; + iTween.MoveTo(rankMatchBattleResult.RankInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["RankInfo"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(0.5f); + } + } + if (!rankMatchBattleResult.IsPromoPrev || !rankMatchBattleResult.IsPromoNow) + { + if (rankMatchBattleResult.BasicExp_and_SuperiorBonus != 0) + { + rankMatchBattleResult.SettingAddRankExpTextAnimation(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP); + yield return new WaitForSeconds(0.05f); + } + yield return new WaitForSeconds(0.5f); + } + if (rankMatchBattleResult.RankExpBonus > 0) + { + rankMatchBattleResult.AddRankExpBonus(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP); + yield return new WaitForSeconds(0.05f); + } + yield return new WaitForSeconds(0.5f); + } + } + if (!rankMatchBattleResult.IsPromoPrev && !rankMatchBattleResult.IsPromoNow) + { + if (PlayerStaticData.UserRankCurrentFormat() > rankMatchBattleResult.BeforeRankLv) + { + StartCoroutine(rankMatchBattleResult.RunRankUp()); + battleResultControl.RankMatchBattleResultObject.IsRunUIStop = true; + while (battleResultControl.RankMatchBattleResultObject.IsRunUIStop) + { + yield return null; + } + yield return new WaitForSeconds(0.5f); + } + else if (PlayerStaticData.UserRankCurrentFormat() < rankMatchBattleResult.BeforeRankLv) + { + StartCoroutine(rankMatchBattleResult.RunRankDown()); + battleResultControl.RankMatchBattleResultObject.IsRunUIStop = true; + while (battleResultControl.RankMatchBattleResultObject.IsRunUIStop) + { + yield return null; + } + yield return new WaitForSeconds(0.5f); + } + } + if (!rankMatchBattleResult.IsPromoPrev && rankMatchBattleResult.IsPromoNow) + { + StartCoroutine(battleResultControl.RunMatch()); + yield return new WaitForSeconds(3f); + } + if (Data.RankMatchFinish.data != null && Data.RankMatchFinish.data.SpeedChallengeAnnounceTime.HasValue) + { + SystemText systemText = Data.SystemText; + DialogBase dialog = UIManager.GetInstance().CreateDialogClose(); + dialog.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialog.SetTitleLabel(systemText.Get("SpeedChallenge_0001")); + dialog.SetSize(DialogBase.Size.M); + GameObject gameObject = Object.Instantiate(Resources.Load("UI/layoutParts/Dialog/DialogSpeedChallenge")) as GameObject; + dialog.SetObj(gameObject); + DialogSpeedChallenge component = gameObject.GetComponent(); + string text = string.Format(arg0: ConvertTime.ToLocal(Data.RankMatchFinish.data.SpeedChallengeAnnounceTime.Value, ConvertTime.FORMAT.TIME_DATE_LONG_SPECIAL), format: systemText.Get("SpeedChallenge_0002")); + component.SetText(text); + component.SetTexture("banner_000764"); + while (dialog.IsOpen()) + { + yield return null; + } + } + bool battlePathUIFinish = false; + battleResultControl.SetBattlePassGauge(delegate + { + battlePathUIFinish = true; + }); + while (!battlePathUIFinish) + { + yield return null; + } + if (Data.RedEtherCampaignResultData != null) + { + bool isFinishRedEther = false; + RedEtherCampaignPanel.Create(battleResultControl.gameObject, Data.RedEtherCampaignResultData, battleResultControl, delegate + { + isFinishRedEther = true; + }); + while (!isFinishRedEther) + { + yield return null; + } + yield return ShowRewardDialog(Data.RedEtherCampaignResultData.RewardList); + } + if (battleResultControl.ResultReporter.HomeDialogData != null && battleResultControl.ResultReporter.HomeDialogData.IsEnable) + { + bool homeDialogFinish = false; + MyPageHomeDialog.Create(UIManager.GetInstance().HomeDialogPrefab, battleResultControl.resultReporter.HomeDialogData, delegate + { + homeDialogFinish = true; + }); + while (!homeDialogFinish) + { + yield return null; + } + } + battleResultControl.GreySpriteBGVisible = false; + nextSceneSelector.Show(); + battleResultControl.PrepareAchievementLog(); + battleResultControl.FinishResult(); + } +} diff --git a/SVSim.BattleEngine/Engine/RankMatchResultAnimationHandler.cs b/SVSim.BattleEngine/Engine/RankMatchResultAnimationHandler.cs new file mode 100644 index 0000000..a5bbfba --- /dev/null +++ b/SVSim.BattleEngine/Engine/RankMatchResultAnimationHandler.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +public class RankMatchResultAnimationHandler : IResultAnimationHandler +{ + private readonly GameObject m_resultAnimationAgentObj; + + private readonly RankMatchResultAnimationAgent m_resultAnimationAgentIns; + + public ResultAnimationAgent m_resultAnimationAgent => m_resultAnimationAgentIns; + + public RankMatchResultAnimationHandler(BattleCamera battleCamera) + { + m_resultAnimationAgentObj = new GameObject(); + m_resultAnimationAgentIns = m_resultAnimationAgentObj.AddComponent(); + m_resultAnimationAgentIns.GetComponent().SetBattleCamera(battleCamera); + } + + public void Destroy() + { + Object.Destroy(m_resultAnimationAgentObj); + } +} diff --git a/SVSim.BattleEngine/Engine/RankMatchResultReporter.cs b/SVSim.BattleEngine/Engine/RankMatchResultReporter.cs new file mode 100644 index 0000000..780ccc9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RankMatchResultReporter.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using LitJson; +using Wizard; +using Wizard.Lottery; + +public class RankMatchResultReporter : IBattleResultReporter +{ + public bool IsEnd => Data.RankMatchFinish.data != null; + + public int ClassExp => GetClassExp(); + + public List UserAchievement => GetUserAchievementList(); + + public List UserMission => GetUserMissionList(); + + public List MissionRewards => Data.RankMatchFinish.data._missionRewards; + + public List VictoryRewards => Data.RankMatchFinish.data._victoryRewards; + + public LotteryApplyData LotteryData => Data.RankMatchFinish.data.AchievedInfo._lotteryData; + + public MyPageHomeDialogData HomeDialogData => Data.RankMatchFinish.data.HomeDialogData; + + public bool IsDataExist + { + get + { + if (Data.RankMatchFinish.data != null) + { + return Data.RankMatchFinish.data.IsProcessed; + } + return false; + } + } + + public void Report(bool isWin) + { + } + + public void Destroy() + { + } + + public JsonData GetFinishResponseData() + { + return Data.RankMatchFinish.data._responseData; + } + + public List GetUserAchievementList() + { + return Data.RankMatchFinish.data.achieved_achievement_list; + } + + public List GetUserMissionList() + { + return Data.RankMatchFinish.data.achieved_mission_list; + } + + public int GetClassExp() + { + return Data.RankMatchFinish.data.get_class_chara_experience; + } +} diff --git a/SVSim.BattleEngine/Engine/ReadMail.cs b/SVSim.BattleEngine/Engine/ReadMail.cs new file mode 100644 index 0000000..7161065 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReadMail.cs @@ -0,0 +1,4 @@ +public class ReadMail : HeaderData +{ + public ReadMailDetail data; +} diff --git a/SVSim.BattleEngine/Engine/ReadMailDetail.cs b/SVSim.BattleEngine/Engine/ReadMailDetail.cs new file mode 100644 index 0000000..d7679ee --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReadMailDetail.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +public class ReadMailDetail +{ + public List mail_result_list; + + public List total_recieve_count_list; + + public bool is_unreceived_present; +} diff --git a/SVSim.BattleEngine/Engine/RealTime.cs b/SVSim.BattleEngine/Engine/RealTime.cs new file mode 100644 index 0000000..647acb8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RealTime.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +public class RealTime : MonoBehaviour +{ + public static float time => Time.unscaledTime; + + public static float deltaTime => Time.unscaledDeltaTime; +} diff --git a/SVSim.BattleEngine/Engine/RealTimeNetworkAgent.cs b/SVSim.BattleEngine/Engine/RealTimeNetworkAgent.cs new file mode 100644 index 0000000..ad1d843 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RealTimeNetworkAgent.cs @@ -0,0 +1,1788 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BestHTTP.SocketIO; +using BestHTTP.SocketIO.Transports; +using Cute; +using LitJson; +using MessagePack; +using MiniJSON; +using PlatformSupport.Collections.ObjectModel; +using UnityEngine; +using Wizard; +using Wizard.Battle.Recovery; +using Wizard.ErrorDialog; +using Wizard.RoomMatch; + +public class RealTimeNetworkAgent : MonoBehaviour +{ + public enum EmitCategory + { + battle = 1, + matching = 2, + room = 3, + watch = 11, + general = 99 + } + + public enum MatchingStatus + { + OffLine = 0, + Connect = 10, + StartLoad = 30, + Loaded = 40, + Prepared = 50, + Disconnected = 80, + RoomReady = 90, + Room = 100 + } + + public enum DESTROY_OBJECT_LOG + { + BattleResult, + Maintenance, + NodeError, + ResultCode, + Room, + MatchingDisconnect, + WatchMaintenance, + Debug, + Replay, + HandleResultCode + } + + private DateTime _receiveWaitTime = DateTime.MinValue; + + private bool _isCheckReceiveWaitTime; + + private int _oldReceiveDataCount; + + private const float RECEIVE_WAIT_ERROR_LOG_TIME = 60f; + + protected NetworkBattleManagerBase _networkBattleManager; + + public Action> OnMatchingReceiveUri; + + public Action OnEmit; + + private BattleFinishSendBase _battleFinishSendBase; + + public static FinishTaskBase FinishTaskBase; + + private bool _initNetworkSuccess; + + protected bool _failedRecoveryToNotSendFinishTask; + + protected bool _isFinishResultSuccses; + + public List _serializeList = new List(); + + public List _trySerializeList = new List(); + + private int _currentTryNum; + + protected SocketManager _manager; + + private int viewerId; + + private string battleRoomId; + + protected string bid = ""; + + private Matching _matching; + + private Action _onEveryTimeFail; + + public const string SEND_SEQ_NAME = "pubSeq"; + + public const string RECEIVE_SEQ_NAME = "playSeq"; + + protected StockReceiveMgr stockReceiveMessageMgr; + + protected StockEmitMgr stockEmitMessageMgr; + + private Action _onFinishedEmit; + + protected Gungnir _gungnir; + + private bool _isAlreadyDestroyedGameObject; + + private static readonly string status_try = "try"; + + private string errorLog = ""; + + private const string EmitMsg = "msg"; + + private const string EmitHand = "hand"; + + private const string HAND_DATA_KEY = "StockHandData"; + + public const string CategoryParameter = "cat"; + + public Action OnResultCodeError; + + protected const int ERROR_MAINTENANCE = 5; + + private bool _notEmit; + + public Action> OnAck; + + public bool IsNotPlayReceivingData; + + public const string RECEIVE_URI = "uri"; + + public const string IS_RESUME = "isResume"; + + private long _battlePreparedStartTicks; + + private int _disconnectNum; + + private int _emitLogNum; + + private bool _isAddEmitLog; + + private string _emitLog = ""; + + private const int DISCONNECT_LOG_NUM = 5; + + private const int EMIT_LOG_NUM = 3; + + private int _connectNumToReconnect; + + private long _connectTicks; + + private const int CONNECT_TO_RECONNECT_MAX_NUM = 3; + + private const float CONNECT_TO_RECONNECT_TIMER = 30f; + + private long _stopPlayReceiveLogTime; + + private const float STOP_PLAY_RECEIVE_LOG_TIME = 60f; + + public bool IsRecovery { get; private set; } + + public bool IsBattleStart { get; private set; } + + public NetworkStatus OpponentNetworkStatus { get; protected set; } + + public bool IsOpponentDisconnected => !OpponentNetworkStatus.IsAlive; + + public SocketManager SocketManager => _manager; + + public int StockReceiveCount => stockReceiveMessageMgr.GetSequenceDataCount(); + + public int MaxMessageSequenceNumber => stockReceiveMessageMgr.GetMaxSequenceNumber(); + + public int StockEmitCount => stockEmitMessageMgr.GetSequenceDataCount(); + + public NetworkStatus PlayerNetworkStatus { get; private set; } + + public bool IsReceiveSelfDisconnect + { + get + { + if (_gungnir != null) + { + return _gungnir._DisconnectStatus == Gungnir.DisconnectStatus.SELF_DISCONNECT; + } + return false; + } + } + + public bool IsReceiveOpponentDisconnect + { + get + { + if (_gungnir != null) + { + return _gungnir._DisconnectStatus == Gungnir.DisconnectStatus.OPPONENT_DISCONNECT; + } + return false; + } + } + + public Action> OnReceivedEvent { get; set; } + + public MatchingStatus CurrentMatchingStatus { get; protected set; } + + public int LastEmitSeqNumber { get; private set; } + + public bool IsExistTitleReturnError { get; private set; } + + public INetworkLogger NetworkLogger { get; protected set; } + + public string NowSocketID { get; private set; } + + public void SetIsRecovery(bool flg) + { + IsRecovery = flg; + } + + public void SetIsBattleStart(bool flag) + { + IsBattleStart = flag; + } + + public int GetIsFirstPlayer() + { + return GameMgr.GetIns().GetNetworkUserInfoData().TurnState; + } + + public int GetViewId() + { + return viewerId; + } + + public long GetBattleId() + { + if (string.IsNullOrEmpty(bid)) + { + return -1L; + } + return long.Parse(bid); + } + + public void SetbattleId(string battleId) + { + bid = battleId; + } + + public int GetActionSequenceCount() + { + if (_gungnir != null) + { + return _gungnir._actionSequenceNum; + } + return -1; + } + + protected virtual void Awake() + { + UnityEngine.Object.DontDestroyOnLoad(base.gameObject); + GameMgr.GetIns().SetNetworkUserInfoData(new NetworkUserInfoData()); + stockReceiveMessageMgr = new StockReceiveMgr("playSeq"); + stockEmitMessageMgr = new StockEmitMgr("pubSeq"); + InitializeNetworkLogger(); + InitializePlayerNetworkStatus(); + InitializeGungnir(); + TaskManager.GetInstance().MyPageSend(); + } + + private void Update() + { + if (ToolboxGame.RealTimeNetworkAgent.CurrentMatchingStatus != MatchingStatus.Prepared && ToolboxGame.RealTimeNetworkAgent.CurrentMatchingStatus != MatchingStatus.Disconnected && _matching != null) + { + _matching.UpdateMatching(); + } + if (BattleManagerBase.GetIns() == null) + { + LocalLog.SubmitAccumulateLastTraceLog(); + } + if (!IsNotPlayReceivingData) + { + PlayReceiveData(); + CheckLogStopPlayReceive(); + } + } + + protected virtual void InitializeNetworkLogger() + { + NetworkLogger = new NetworkNullLogger(); + } + + protected virtual void InitializePlayerNetworkStatus() + { + PlayerNetworkStatus = new NetworkStatus(); + } + + protected virtual void InitializeGungnir() + { + _gungnir = new Gungnir(this); + Gungnir gungnir = _gungnir; + gungnir.OnAlive = (Action)Delegate.Combine(gungnir.OnAlive, new Action(PlayerNetworkStatus.ToKeepAlive)); + Gungnir gungnir2 = _gungnir; + gungnir2.OnAlive = (Action)Delegate.Combine(gungnir2.OnAlive, (Action)delegate + { + LocalLog.AddGungnirLog("GungnirOnAlived"); + }); + Gungnir gungnir3 = _gungnir; + gungnir3.OnResendEmitData = (Action)Delegate.Combine(gungnir3.OnResendEmitData, new Action(ResendPubSeqData)); + } + + public void SetCurrentMatchingStatus(MatchingStatus status) + { + if (CurrentMatchingStatus != MatchingStatus.Disconnected) + { + if (CurrentMatchingStatus >= status) + { + LocalLog.AccumulateTraceLog("SetCurrentMatchingStatus Old" + CurrentMatchingStatus.ToString() + " " + status); + return; + } + CurrentMatchingStatus = status; + LocalLog.AccumulateLastTraceLog("SetStatus:" + CurrentMatchingStatus); + } + } + + public void SetNetworkBattleMgr(NetworkBattleManagerBase mgr) + { + _networkBattleManager = mgr; + } + + public void StartPreparedStartTimer(DateTime nowTimer) + { + _battlePreparedStartTicks = nowTimer.Ticks; + } + + public int GetPreparedStartTimer() + { + return (int)NetworkUtility.GetTimeSpanMilliSecond(_battlePreparedStartTicks); + } + + private void OnApplicationPause(bool appPause) + { + if (GameMgr.GetIns() != null && !GameMgr.GetIns().IsReplayBattle && appPause && _manager != null) + { + Dictionary dictionary = CreateEmitData(NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.Kill], null); + dictionary.Add("state", "pause"); + _manager.Socket.Emit("msg", null, CreatePackEmitData(dictionary)); + } + } + + protected virtual void PlayReceiveData() + { + int sequenceDataCount = stockReceiveMessageMgr.GetSequenceDataCount(); + if (!_isCheckReceiveWaitTime) + { + _receiveWaitTime = TimeUtil.GetAbsoluteTime(); + } + _isCheckReceiveWaitTime = _oldReceiveDataCount == sequenceDataCount && sequenceDataCount != 0; + _oldReceiveDataCount = sequenceDataCount; + Dictionary dictionary = stockReceiveMessageMgr.FindData(stockReceiveMessageMgr.SequenceAlreadyNumber + 1); + string text = ""; + if (dictionary != null) + { + text = dictionary["uri"].ToString(); + } + if (!IsPlayReceiveDataOk(text)) + { + if (_isCheckReceiveWaitTime && (float)NetworkUtility.GetTimeSpanSecond(_receiveWaitTime.Ticks) >= 60f) + { + NetworkBattleGenericTool.CreateLoadAndPlayEffectVfxLastTurnLog(); + _isCheckReceiveWaitTime = false; + } + } + else if ((stockEmitMessageMgr.IsEmpty() || !(text == "BattleFinish")) && dictionary != null) + { + _stopPlayReceiveLogTime = TimeUtil.GetAbsoluteTime().Ticks; + bool flag = PlayReceiveData(dictionary); + flag |= IsFromResumeData(dictionary); + if (ToolboxGame.RealTimeNetworkAgent.CurrentMatchingStatus != MatchingStatus.Room && ToolboxGame.RealTimeNetworkAgent.CurrentMatchingStatus != MatchingStatus.RoomReady) + { + UpdateReciveSeqNumber(dictionary, flag); + } + } + } + + public static bool IsFromResumeData(Dictionary data) + { + if (data.ContainsKey("isResume")) + { + return (bool)data["isResume"]; + } + return false; + } + + private void CheckLogStopPlayReceive() + { + DateTime absoluteTime = TimeUtil.GetAbsoluteTime(); + if (stockReceiveMessageMgr.GetStockDataList().Count == 0 || GameMgr.GetIns().IsAINetwork || GameMgr.GetIns().IsWatchBattle) + { + _stopPlayReceiveLogTime = absoluteTime.Ticks; + return; + } + int timeSpanSecond = NetworkUtility.GetTimeSpanSecond(_stopPlayReceiveLogTime); + if (!((float)timeSpanSecond >= 60f)) + { + return; + } + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.AppendLine("SeqStopLog: \n"); + foreach (Dictionary stockData in stockReceiveMessageMgr.GetStockDataList()) + { + stringBuilder.AppendLine(stockData["uri"].ToString() + stockReceiveMessageMgr.GetSequenceNumber(stockData) + "|"); + } + stringBuilder.AppendLine("\n seqNum:" + stockReceiveMessageMgr.SequenceAlreadyNumber); + stringBuilder.AppendLine("\n matchingStatus:" + CurrentMatchingStatus); + stringBuilder.AppendLine("\n stopPlayReceiveTimeSpanSecond:" + timeSpanSecond); + if (_networkBattleManager != null) + { + stringBuilder.AppendLine("\n vfxEnd:" + _networkBattleManager.VfxMgr.IsEnd); + stringBuilder.AppendLine(" currentVfx:" + _networkBattleManager.VfxMgr.CurrentVfxName); + stringBuilder.AppendLine(" currentVfxTime:" + _networkBattleManager.VfxMgr.CurrentVfxTime); + stringBuilder.AppendLine("\n loadResourcePhase:" + LocalLog.GetLoadResourceLog()); + stringBuilder.AppendLine("\n isEchoWait:" + _networkBattleManager.IsEchoWait()); + } + string text = stringBuilder.ToString(); + Debug.LogError(text); + NetworkLogger.LogInfo(text); + LocalLog.AccumulateLastTraceLog("StopPlayReceive " + text); + LocalLog.RecordMemoryOnLastTurnLog(); + _stopPlayReceiveLogTime = absoluteTime.Ticks; + } + + public void UpdateReciveSeqNumber(Dictionary playData, bool isUpdateSequence = true) + { + if (playData != null) + { + LocalLog.AccumulateLastTraceLog("Front Uri " + playData["uri"]); + LocalLog.AccumulateLastTraceLog("UpdateReceiveSequenceBefore: Max " + stockReceiveMessageMgr.GetMaxSequenceNumber() + "Already" + stockReceiveMessageMgr.SequenceAlreadyNumber); + if (isUpdateSequence) + { + stockReceiveMessageMgr.UpdateSequenceAlreadyNumber(playData); + } + stockReceiveMessageMgr.RemoveSelectData(playData); + } + LocalLog.AccumulateLastTraceLog("UpdateReceiveSequence: Max " + stockReceiveMessageMgr.GetMaxSequenceNumber() + "Already" + stockReceiveMessageMgr.SequenceAlreadyNumber); + } + + public virtual bool IsPlayReceiveDataOk(string uri = null, bool isWatchCheck = false) + { + return true; + } + + public void Connect(int viewerId, string battleId, Action onEveryTimeFail, Matching matching, bool isBeforeBattleStartRetry = false) + { + SettingMatchingClass(matching); + this.viewerId = viewerId; + battleRoomId = battleId; + string value = CryptAES.encryptForNode(viewerId.ToString()); + _onEveryTimeFail = onEveryTimeFail; + SocketOptions socketOptions = new SocketOptions(); + socketOptions.ConnectWith = TransportTypes.WebSocket; + socketOptions.AutoConnect = true; + socketOptions.AdditionalQueryParams = new ObservableDictionary(); + socketOptions.AdditionalQueryParams.Add("User-Agent", SystemInfo.operatingSystem.ToString()); + socketOptions.AdditionalQueryParams.Add("BattleId", battleId); + socketOptions.AdditionalQueryParams.Add("viewerId", value); + _manager = new SocketManager(new Uri(CustomPreference.GetNodeServerURL()), socketOptions); + _manager.SettingRealtimeNetworkAgent(this); + ConnectSocket(); + if (isBeforeBattleStartRetry || (IsRecovery && matching != null)) + { + _initNetworkSuccess = true; + if (!IsRecovery) + { + StartGungnir(); + } + } + } + + public SocketManager.States Connect(int viewerId, string battleId, Action onEveryTimeFail) + { + this.viewerId = viewerId; + battleRoomId = battleId; + string value = CryptAES.encryptForNode(viewerId.ToString()); + _onEveryTimeFail = onEveryTimeFail; + SocketOptions socketOptions = new SocketOptions(); + socketOptions.ConnectWith = TransportTypes.WebSocket; + socketOptions.AutoConnect = true; + socketOptions.AdditionalQueryParams = new ObservableDictionary(); + socketOptions.AdditionalQueryParams.Add("User-Agent", SystemInfo.operatingSystem.ToString()); + socketOptions.AdditionalQueryParams.Add("BattleId", battleId); + socketOptions.AdditionalQueryParams.Add("viewerId", value); + _manager = new SocketManager(new Uri(CustomPreference.GetNodeServerURL()), socketOptions); + _manager.SettingRealtimeNetworkAgent(this); + return ConnectSocket(); + } + + public void SettingMatchingClass(Matching matching) + { + if (matching != null) + { + _matching = matching; + } + } + + public static void ReconnectSocketAndLogFlagOn() + { + ToolboxGame.RealTimeNetworkAgent.ReconnectSocket(); + if (GameMgr.GetIns().GetDataMgr().m_BattleType == DataMgr.BattleType.RankBattle && Wizard.Data.CurrentFormat == Format.Rotation) + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.SELF_DISCONNECT_OPEN_STATUS_TO_REPLACE_LOG, 1f); + } + } + + public static bool IsNormalNetworkBattle() + { + if (ToolboxGame.RealTimeNetworkAgent != null && ToolboxGame.RealTimeNetworkAgent.CurrentMatchingStatus >= MatchingStatus.Prepared && GameMgr.GetIns().IsNetworkBattle && !GameMgr.GetIns().IsWatchBattle && !GameMgr.GetIns().IsReplayBattle && !GameMgr.GetIns().IsAINetwork && BattleManagerBase.GetIns() != null) + { + return !BattleManagerBase.GetIns().IsRecovery; + } + return false; + } + + public SocketManager.States ReconnectSocket() + { + if (viewerId == 0 || _manager == null) + { + return SocketManager.States.Initial; + } + _manager.Close(); + return Connect(viewerId, battleRoomId, _onEveryTimeFail); + } + + private SocketManager.States ConnectSocket() + { + _manager.Socket.On("disconnect", OnDisconnect); + _manager.Socket.On("opponent_lost", OnOpponentLost); + _manager.Socket.On("synchronize", OnReceived); + _manager.Socket.On("hand", OnHandReceived); + _manager.Socket.On("reconnect_socket", OnReconnect); + _manager.Socket.On("alive", OnAlived); + _manager.Socket.On("connect_socket", OnConnect_Socket); + _manager.Socket.On("heartbeat_ping", OnHeartbeatPing); + _manager.Socket.On("heartbeat_pong", OnHeartbeatPong); + _manager.Socket.On("heartbeat_timeout", OnHeartbeatTimeOut); + _manager.Socket.On(SocketIOEventTypes.Error, delegate(Socket socket, Packet packet, object[] args) + { + _onEveryTimeFail.Call(); + if (args != null && args.Count() >= 1 && errorLog != args.First().ToString()) + { + errorLog = args.First().ToString(); + LocalLog.AccumulateTraceLog(errorLog); + } + }); + _manager.Open(); + return _manager.State; + } + + protected virtual void OnEmitAckCallback(Socket socket, Packet originalPacket, params object[] args) + { + if ((float)NetworkUtility.GetTimeSpanSecond(stockEmitMessageMgr.GetEmitTime()) < StockEmitMgr.WAIT_ACK_TIMEOUT) + { + int number = int.Parse(args[0].ToString()); + EmitSuccessToNextEmitData(number); + } + } + + public void EmitSuccessToNextEmitData(int number) + { + Dictionary selectData = stockEmitMessageMgr.GetSelectData(number); + OnAck.Call(selectData); + stockEmitMessageMgr.SetReceiveAck(); + if (selectData == null) + { + LocalLog.AccumulateLastTraceLog("OnAckCallback Null " + number); + return; + } + string text = ""; + bool flag = false; + if (selectData.ContainsKey("StockHandData")) + { + flag = true; + text = GetHandUri(selectData); + } + else + { + text = selectData["uri"].ToString(); + } + LocalLog.AccumulateLastTraceLog("OnAckCallback Uri " + text + " number" + number); + stockEmitMessageMgr.RemoveSelectData(selectData); + if (text == NetworkBattleDefine.NetworkBattleURI.TurnStart.ToString() && !_gungnir._actionSeqPubSeqList.Contains(number)) + { + if (text == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.TurnStart]) + { + SetGungnirSendActionSequence(isActive: false); + } + _gungnir._actionSeqPubSeqList.Add(number); + LocalLog.AccumulateLastTraceLog("uri:" + text + " ActionSeq:" + GetActionSequenceCount() + " NotRecovery"); + AddActionSequence(); + } + EmitFrontStockData(); + NetworkBattleManagerBase networkBattleManagerBase = BattleManagerBase.GetIns() as NetworkBattleManagerBase; + NetworkBattleDefine.NetworkBattleURI result = NetworkBattleDefine.NetworkBattleURI.None; + object value; + bool flag2 = selectData.TryGetValue("uri", out value); + bool flag3 = flag2 && Enum.TryParse(value.ToString(), out result); + if (networkBattleManagerBase != null && !flag && flag2 && flag3) + { + networkBattleManagerBase.SendIntervalTriggerMain.SendDataCheck(networkBattleManagerBase, result); + } + } + + public void SetGungnirSendActionSequence(bool isActive) + { + _gungnir.SetSendActionSequenceNumFlag(isActive); + } + + private void ResendPubSeqData(int resendOrderNum) + { + if ((float)NetworkUtility.GetTimeSpanSecond(stockEmitMessageMgr.GetEmitTime()) < StockEmitMgr.WAIT_ACK_TIMEOUT) + { + return; + } + List> sequenceAllData = stockEmitMessageMgr.GetSequenceAllData(); + if (sequenceAllData != null && sequenceAllData.Count > 0) + { + int num = int.Parse(sequenceAllData[0]["pubSeq"].ToString()); + if (num > resendOrderNum) + { + for (int i = 0; i < num - resendOrderNum; i++) + { + Dictionary allSelectData = stockEmitMessageMgr.GetAllSelectData(num - i); + if (allSelectData != null) + { + stockEmitMessageMgr.FirstAddSequenceDataList(allSelectData); + } + } + DateTime absoluteTime = TimeUtil.GetAbsoluteTime(); + stockEmitMessageMgr.SetEmitTime(absoluteTime.Ticks); + EmitFrontStockData(); + } + else if (num == resendOrderNum && (float)NetworkUtility.GetTimeSpanSecond(stockEmitMessageMgr.GetEmitTime()) > StockEmitMgr.WAIT_ACK_TIMEOUT) + { + DateTime absoluteTime2 = TimeUtil.GetAbsoluteTime(); + stockEmitMessageMgr.SetEmitTime(absoluteTime2.Ticks); + EmitFrontStockData(); + } + else if (num < resendOrderNum) + { + LocalLog.AccumulateTraceLog("ClinentPubSeq < NodePubSeq"); + } + } + else + { + if (sequenceAllData == null || sequenceAllData.Count != 0) + { + return; + } + int sequenceNumber = stockEmitMessageMgr.SequenceNumber; + if (sequenceNumber <= resendOrderNum) + { + return; + } + for (int j = 0; j < sequenceNumber - resendOrderNum; j++) + { + Dictionary allSelectData2 = stockEmitMessageMgr.GetAllSelectData(sequenceNumber - j); + if (allSelectData2 != null) + { + stockEmitMessageMgr.FirstAddSequenceDataList(allSelectData2); + } + } + DateTime absoluteTime3 = TimeUtil.GetAbsoluteTime(); + stockEmitMessageMgr.SetEmitTime(absoluteTime3.Ticks); + EmitFrontStockData(); + } + } + + private void EmitFrontStockData() + { + if (!_notEmit) + { + List> sequenceAllData = stockEmitMessageMgr.GetSequenceAllData(); + if (sequenceAllData == null || sequenceAllData.Count == 0) + { + Action onFinishedEmit = _onFinishedEmit; + _onFinishedEmit = null; + onFinishedEmit.Call(); + } + else + { + EmitDataToAckCallBack(sequenceAllData[0]); + } + } + } + + private void EmitDataToAckCallBack(Dictionary frontData) + { + if (_manager != null && !GameMgr.GetIns().IsWatchBattle) + { + int num = Convert.ToInt32(frontData[status_try].ToString()); + CheckAndRemoveFirstSerializeLogData(num); + _currentTryNum = num; + num++; + frontData[status_try] = num; + EmitStockData(frontData); + AddSerializeLogData(); + } + } + + private void EmitStockData(Dictionary frontData) + { + if (!_notEmit) + { + string text = ""; + byte[] array = null; + string eventName = "msg"; + if (frontData.ContainsKey("StockHandData")) + { + eventName = "hand"; + List info = frontData["StockHandData"] as List; + text = GetHandUri(frontData); + array = CreatePackEmitHandData(info); + } + else + { + text = frontData["uri"].ToString(); + array = CreatePackEmitData(frontData); + } + int result = 0; + if (int.TryParse(text, out result)) + { + string text2 = "Emit Hand " + Enum.GetName(typeof(NetworkBattleSender.HAND_URI_TYPE), result); + NetworkLogger.LogInfo(text2); + LocalLog.AccumulateLastTraceLog(text2); + } + else + { + string text3 = "Emit Uri " + text; + LocalLog.AccumulateLastTraceLog(text3); + NetworkLogger.LogInfo(text3); + } + DateTime absoluteTime = TimeUtil.GetAbsoluteTime(); + stockEmitMessageMgr.SetEmitTime(absoluteTime.Ticks); + if (text == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.InitNetwork]) + { + LocalLog.AccumulateLastTraceLog("EmitStockData_InitNetwork " + StackTraceUtility.ExtractStackTrace()); + } + _emitLog = ""; + if (isSendEmitLog()) + { + _isAddEmitLog = true; + _emitLogNum++; + LocalLog._isSendGungnirLog = true; + LocalLog._isSendSocketFrameLog = true; + } + _manager.Socket.Emit(eventName, OnEmitAckCallback, array); + if (_isAddEmitLog) + { + _isAddEmitLog = false; + LocalLog.AccumulateLastTraceLog("EmitLog:" + _emitLog); + } + } + } + + public bool isSendEmitLog() + { + if (_disconnectNum >= 5 && CurrentMatchingStatus == MatchingStatus.Prepared && _emitLogNum < 3 && (float)NetworkUtility.GetTimeSpanSecond(stockEmitMessageMgr.EmitToAckCheckTime) > StockEmitMgr.ACK_NOT_RECEIVE_LOG_TIME) + { + return (float)NetworkUtility.GetTimeSpanSecond(_gungnir.GungnirReceiveCheckTime) < 5f; + } + return false; + } + + public void AddEmitLog(string log) + { + if (_isAddEmitLog) + { + _emitLog += log; + } + } + + public byte[] CreatePackEmitData(Dictionary info) + { + byte[] array = MessagePackSerializer.Serialize(CryptAES.encryptForNode(JsonMapper.ToJson(info))); + if (BattleManagerBase.GetIns() != null) + { + KeyValuePair keyValuePair = info.SingleOrDefault((KeyValuePair s) => s.Key == "uri"); + if (!keyValuePair.Equals(default(KeyValuePair)) && keyValuePair.Value.ToString() != "Gungnir") + { + DateTime dateTime = DateTime.Now.ToUniversalTime(); + _serializeList.Add(string.Format("{0}/{1}:{2}:{3}:{4:000}:{5}", dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second, dateTime.Millisecond.ToString("000"), "\n" + keyValuePair.Value?.ToString() + " serialize data = " + Convert.ToBase64String(array))); + } + } + return array; + } + + private void AddSerializeLogData() + { + if (_currentTryNum >= 1) + { + _trySerializeList.AddRange(_serializeList); + _serializeList.Clear(); + } + } + + private void CheckAndRemoveFirstSerializeLogData(int nowTryCount) + { + if (_currentTryNum == 0 && nowTryCount == 0 && _serializeList.Count > 2) + { + _serializeList.RemoveRange(0, _serializeList.Count - 1); + } + } + + private byte[] CreatePackEmitHandData(List info) + { + return MessagePackSerializer.Serialize(JsonMapper.ToJson(info)); + } + + protected void OnReceived(Socket socket, Packet packet, params object[] args) + { + if (_notEmit) + { + LocalLog.AccumulateLastTraceLog("OnReceivedNotEmit"); + return; + } + byte[] bytes = packet.Attachments[0]; + Dictionary dictionary = null; + string text = ""; + try + { + text = MessagePackSerializer.Deserialize(bytes); + } + catch (Exception ex) + { + LocalLog.AccumulateLastTraceLog("OnReceivedUnpack Error๏ผš" + ex); + return; + } + dictionary = Json.Deserialize(CryptAES.decryptForNode(text)) as Dictionary; + string text2 = dictionary["uri"].ToString(); + if (text2 == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.InitNetwork]) + { + _initNetworkSuccess = true; + } + if (text2 == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.TurnStart]) + { + LocalLog.InitGungnirLog(); + LocalLog.InitDisconnectLog(); + LocalLog.InitSocketFrameLog(); + } + if (text2 != RoomParamKey.WatchUriNames[PlayerControllerForWatching.SEND_PARAMETER.Watch]) + { + string text3 = "OnReceived URI:" + text2; + NetworkLogger.LogInfo(text3); + LocalLog.AccumulateLastTraceLog(text3); + } + if (!HandleingNodeResultCodeIfNeeded(dictionary) && !CheckReceiveMaintenanceToDestroy(text2)) + { + if (text2 == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.Resume]) + { + ResumeToStockReceive(dictionary); + } + else if (text2 == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.Watch]) + { + PlayReceiveData(dictionary); + } + else + { + ProcessingRecivedData(dictionary); + } + } + } + + private bool CheckReceiveMaintenanceToDestroy(string uri) + { + if (uri == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.Maintenance]) + { + StopNetworkBattle(); + ShowMaintenanceError(); + DestroyObj(DESTROY_OBJECT_LOG.Maintenance); + return true; + } + return false; + } + + protected void OnHandReceived(Socket socket, Packet packet, params object[] args) + { + if (!_notEmit) + { + byte[] bytes = packet.Attachments[0]; + List list = null; + try + { + list = Json.Deserialize(MessagePackSerializer.Deserialize(bytes)) as List; + } + catch (Exception ex) + { + Debug.LogError("Unpack Error๏ผš" + ex); + return; + } + if (int.Parse(list[0].ToString()) == 99) + { + int errorCode = int.Parse(list[1].ToString()); + HandleResultCode(errorCode, isMatching: false); + } + } + } + + protected void OnAlived(Socket socket, Packet packet, params object[] args) + { + _gungnir.ReceiveGungnir(packet, args); + } + + private void OnHeartbeatPing(Socket socket, Packet packet, params object[] args) + { + string log = DateTime.UtcNow.ToString() + DateTime.UtcNow.Millisecond + " [" + socket.Id + "] Ping->"; + if (_disconnectNum >= 5) + { + LocalLog.AccumulateLastTraceLog(log); + } + LocalLog.AddGungnirLog(" Ping->"); + } + + private void OnHeartbeatPong(Socket socket, Packet packet, params object[] args) + { + string log = DateTime.UtcNow.ToString() + DateTime.UtcNow.Millisecond + " [" + socket.Id + "] <- Pong "; + if (_disconnectNum >= 5) + { + LocalLog.AccumulateLastTraceLog(log); + } + LocalLog.AddGungnirLog(" <- Pong "); + } + + private void OnHeartbeatTimeOut(Socket socket, Packet packet, params object[] args) + { + LocalLog.AccumulateLastTraceLog(DateTime.UtcNow.ToString() + DateTime.UtcNow.Millisecond + " [" + socket.Id + "]ร— TIME OUT"); + } + + public Dictionary DeserializeEncryptedPacket(Packet packet) + { + byte[] bytes = packet.Attachments[0]; + string src; + try + { + src = MessagePackSerializer.Deserialize(bytes); + } + catch (Exception ex) + { + Debug.LogError("Unpack Error๏ผš" + ex); + return new Dictionary(); + } + return (Json.Deserialize(CryptAES.decryptForNode(src)) as Dictionary) ?? new Dictionary(); + } + + private void HandleResultCode(int errorCode, bool isMatching) + { + if (!isMatching && errorCode == 30002) + { + if (BattleManagerBase.GetIns() is NetworkBattleManagerBase networkBattleManagerBase) + { + networkBattleManagerBase.NodeErrorToNocontest(); + } + return; + } + if (errorCode == 30001 || errorCode == 30213) + { + IsExistTitleReturnError = true; + } + if (!isMatching) + { + CreateNetworkBattleErrorDialog(errorCode); + } + else if (errorCode != 30212) + { + Dialog.Create(errorCode); + } + } + + public void CreateNetworkBattleErrorDialog(int errorCode) + { + StopNetworkBattle(); + Dialog.Create(errorCode); + DestroyObj(DESTROY_OBJECT_LOG.HandleResultCode); + } + + public bool HandleingNodeResultCodeIfNeeded(Dictionary receivedMessage) + { + if (!receivedMessage.Keys.Contains(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.resultCode])) + { + return false; + } + int num = Convert.ToInt32(receivedMessage[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.resultCode]]); + bool flag = false; + if (Enum.IsDefined(typeof(NetworkBattleDefine.ReceiveNodeResultCode), num)) + { + NetworkBattleDefine.ReceiveNodeResultCode receiveNodeResultCode = (NetworkBattleDefine.ReceiveNodeResultCode)num; + switch (receiveNodeResultCode) + { + case NetworkBattleDefine.ReceiveNodeResultCode.Success: + return false; + case NetworkBattleDefine.ReceiveNodeResultCode.RoomCreateError: + LocalLog.AccumulateTraceLogAddRoomCreateLog(); + break; + case NetworkBattleDefine.ReceiveNodeResultCode.SwapTimeoutError: + (BattleManagerBase.GetIns() as NetworkBattleManagerBase).NetworkSender.SendJudgeResult(NetworkBattleSender.JUDGE_RESULT_STATUS.SwapTimeoutError); + return false; + case NetworkBattleDefine.ReceiveNodeResultCode.RoomSetupLock: + return false; + case NetworkBattleDefine.ReceiveNodeResultCode.FoundRemovedUserErrorSelf: + case NetworkBattleDefine.ReceiveNodeResultCode.FoundRemovedUserErrorOppo: + case NetworkBattleDefine.ReceiveNodeResultCode.FoundRemovedUserErrorWatcher: + case NetworkBattleDefine.ReceiveNodeResultCode.RoomTimeEndError: + case NetworkBattleDefine.ReceiveNodeResultCode.WatcherInRemovedOwnerRoomError: + case NetworkBattleDefine.ReceiveNodeResultCode.RoomTornamentOwnTimeEndError: + case NetworkBattleDefine.ReceiveNodeResultCode.RoomTornamentOppoTimeEndError: + case NetworkBattleDefine.ReceiveNodeResultCode.BattleFinishTimeEnd: + OnResultCodeError.Call(num); + return false; + case NetworkBattleDefine.ReceiveNodeResultCode.Different_UUID: + case NetworkBattleDefine.ReceiveNodeResultCode.RedisReplyError: + case NetworkBattleDefine.ReceiveNodeResultCode.CurrentBattleError: + case NetworkBattleDefine.ReceiveNodeResultCode.UnexpectedPhaseError: + case NetworkBattleDefine.ReceiveNodeResultCode.WatchError: + { + bool flag2 = ToolboxGame.RealTimeNetworkAgent.CurrentMatchingStatus < MatchingStatus.Prepared && !IsRecovery; + if (!flag2 && receiveNodeResultCode == NetworkBattleDefine.ReceiveNodeResultCode.CurrentBattleError) + { + (BattleManagerBase.GetIns() as NetworkBattleManagerBase).NetworkSender.SendJudgeResult(NetworkBattleSender.JUDGE_RESULT_STATUS.RecoveryError); + return false; + } + switch (receiveNodeResultCode) + { + case NetworkBattleDefine.ReceiveNodeResultCode.RedisReplyError: + if (BattleManagerBase.GetIns() is NetworkBattleManagerBase networkBattleManagerBase) + { + networkBattleManagerBase.NodeErrorToNocontest(); + break; + } + return false; + case NetworkBattleDefine.ReceiveNodeResultCode.Different_UUID: + case NetworkBattleDefine.ReceiveNodeResultCode.UnexpectedPhaseError: + IsExistTitleReturnError = true; + break; + } + if (!flag2) + { + StopNetworkBattle(); + if (receiveNodeResultCode != NetworkBattleDefine.ReceiveNodeResultCode.RedisReplyError) + { + Dialog.Create(num.ToString()); + } + DestroyObj(DESTROY_OBJECT_LOG.NodeError); + return false; + } + if (receiveNodeResultCode != NetworkBattleDefine.ReceiveNodeResultCode.CurrentBattleError) + { + Dialog.Create(num.ToString()); + } + break; + } + case NetworkBattleDefine.ReceiveNodeResultCode.UnmatchedError: + _matching.StopMatchingAction(); + flag = true; + break; + default: + flag = true; + break; + case NetworkBattleDefine.ReceiveNodeResultCode.MatchingTimeOut: + break; + } + } + else + { + flag = true; + } + if (flag) + { + StopNetworkBattle(); + Dialog.Create(num); + } + OnResultCodeError.Call(num); + DestroyObj(DESTROY_OBJECT_LOG.ResultCode); + return true; + } + + private void OnReconnect(Socket socket, Packet packet, params object[] args) + { + NetworkLogger.LogInfo("OnReconnect"); + LocalLog.AccumulateLastTraceLog("OnReconnect Socket " + socket.Id); + ConnectToReconnect(); + } + + private void OnConnect_Socket(Socket socket, Packet packet, params object[] args) + { + Toolbox.DeviceManager.ClearIpAddress(); + LocalLog.AccumulateTraceLog("ipAddress" + Toolbox.DeviceManager.GetIpAddress()); + string text = "ConnectSocket Socket " + socket.Id; + NetworkLogger.LogInfo(text); + LocalLog.AccumulateLastTraceLog(text); + NowSocketID = socket.Id; + if (IsRecovery) + { + StartGungnir(); + } + ConnectToReconnect(); + } + + private void ConnectToReconnect() + { + DateTime absoluteTime = TimeUtil.GetAbsoluteTime(); + if (_connectNumToReconnect == 0) + { + _connectTicks = absoluteTime.Ticks; + _connectNumToReconnect++; + return; + } + long ticks = TimeUtil.GetAbsoluteTime().Ticks - _connectTicks; + if ((float)new TimeSpan(ticks).Seconds <= 30f) + { + _connectNumToReconnect++; + if (_connectNumToReconnect >= 3) + { + ReconnectSocketAndLogFlagOn(); + _connectNumToReconnect = 0; + } + } + else + { + _connectNumToReconnect = 1; + _connectTicks = absoluteTime.Ticks; + } + } + + public void StartGungnir() + { + _gungnir.Start(); + } + + protected virtual void ProcessingRecivedData(Dictionary receivedMessage) + { + if (stockReceiveMessageMgr.IsNoStockData(receivedMessage)) + { + bool num = PlayReceiveData(receivedMessage); + receivedMessage["uri"].ToString(); + if ((num | IsFromResumeData(receivedMessage)) && stockReceiveMessageMgr.IsIncludedSequenceName(receivedMessage) && stockReceiveMessageMgr.GetSequenceNumber(receivedMessage) == stockReceiveMessageMgr.SequenceAlreadyNumber + 1) + { + stockReceiveMessageMgr.UpdateSequenceAlreadyNumber(receivedMessage); + } + } + else if (stockReceiveMessageMgr.CheckStockData(receivedMessage)) + { + string text = "StockData Uri " + receivedMessage["uri"]?.ToString() + ":seqNum " + stockReceiveMessageMgr.GetSequenceNumber(receivedMessage); + NetworkLogger.LogInfo(text); + LocalLog.AccumulateLastTraceLog(text); + stockReceiveMessageMgr.StockData(receivedMessage); + } + else + { + string text2 = "NotReceiveStock " + receivedMessage["uri"]; + NetworkLogger.LogInfo(text2); + LocalLog.AccumulateLastTraceLog(text2); + } + } + + private void ResumeToStockReceive(Dictionary receivedMessage) + { + object value = null; + if (!receivedMessage.TryGetValue("resume", out value)) + { + return; + } + List list = value as List; + for (int i = 0; i < list.Count; i++) + { + Dictionary dictionary = list[i] as Dictionary; + object obj = dictionary["uri"]; + if (CheckReceiveMaintenanceToDestroy(obj.ToString())) + { + break; + } + stockReceiveMessageMgr.SettingOppoDisconnectSequenceNumber(dictionary); + if (stockReceiveMessageMgr.CheckStockData(dictionary)) + { + dictionary["isResume"] = true; + string text = "Resume StockData Uri " + dictionary["uri"]?.ToString() + ":seqNum" + stockReceiveMessageMgr.GetSequenceNumber(dictionary); + NetworkLogger.LogInfo(text); + LocalLog.AccumulateLastTraceLog(text); + stockReceiveMessageMgr.StockData(dictionary); + } + } + } + + public virtual bool PlayReceiveData(Dictionary synchronizeData) + { + OnReceivedEvent.Call(synchronizeData); + return true; + } + + private void OnOpponentLost(Socket socket, Packet packet, params object[] args) + { + LocalLog.AccumulateLastTraceLog("OnOpponentLost Socket " + socket.Id); + } + + private void OnDisconnect(Socket socket, Packet packet, params object[] args) + { + _disconnectNum++; + string text = ""; + if (NowSocketID != socket.Id) + { + text += " differID "; + } + LocalLog.AccumulateLastTraceLog("OnDisconnect socket " + socket.Id + " " + text); + PlayerNetworkStatus.ToDisconnect(); + } + + protected virtual void OnDestroy() + { + LocalLog.AccumulateLastTraceLog("OnDestroy"); + ManagerClose(); + } + + public void ManagerClose() + { + if (_manager != null) + { + _manager.Close(); + LocalLog.AccumulateTraceLog("LastSocketID " + NowSocketID); + } + _manager = null; + } + + public bool IsOpen() + { + if (_manager == null) + { + return false; + } + if (_manager.State == SocketManager.States.Open) + { + return true; + } + return false; + } + + public bool IsInitNetworkSuccess() + { + if (_manager == null) + { + return false; + } + return _initNetworkSuccess; + } + + public void EmitMsgPack(string uri, EmitCategory emitCategory, Dictionary info, Action onFinishedSend = null, bool isGetableAck = true, bool isStockData = true, int fixedSeqNumber = -1) + { + if (info == null) + { + info = new Dictionary(); + } + info.Add("cat", (int)emitCategory); + _onFinishedEmit = onFinishedSend; + info = CreateEmitData(uri, info); + EmitMsgUriPack(info, isGetableAck, isStockData, fixedSeqNumber); + } + + public void EmitMsgPack(NetworkBattleDefine.NetworkBattleURI uri, Dictionary info = null, Action onFinishedSend = null, bool isGetableAck = true, int fixedSeqNumber = -1, bool isStockData = true, bool isNotActionSeq = false) + { + if (OnEmit != null) + { + OnEmit(uri); + } + if (uri != NetworkBattleDefine.NetworkBattleURI.BattleFinish && uri != NetworkBattleDefine.NetworkBattleURI.TurnEndFinal && CurrentMatchingStatus == MatchingStatus.Disconnected) + { + LocalLog.AccumulateLastTraceLog("EmitMsgPack Disconnected " + uri); + return; + } + EmitCategory emitCategory = EmitCategory.battle; + emitCategory = ((!IsMatchingURI(uri.ToString())) ? EmitCategory.battle : ((uri != NetworkBattleDefine.NetworkBattleURI.InitNetwork) ? EmitCategory.matching : EmitCategory.general)); + if (uri == NetworkBattleDefine.NetworkBattleURI.TurnStart) + { + LocalLog.InitGungnirLog(); + LocalLog.InitDisconnectLog(); + LocalLog.InitSocketFrameLog(); + } + if (!isNotActionSeq && (uri == NetworkBattleDefine.NetworkBattleURI.PlayActions || uri == NetworkBattleDefine.NetworkBattleURI.TurnEndActions || uri == NetworkBattleDefine.NetworkBattleURI.Echo)) + { + AddActionSequence(); + LocalLog.AccumulateLastTraceLog("uri:" + uri.ToString() + " ActionSeq:" + GetActionSequenceCount() + " NotRecovery"); + } + string uri2 = uri.ToString(); + EmitCategory emitCategory2 = emitCategory; + int fixedSeqNumber2 = fixedSeqNumber; + EmitMsgPack(uri2, emitCategory2, info, onFinishedSend, isGetableAck, isStockData, fixedSeqNumber2); + } + + public void EmitHandData(List parameters, NetworkBattleSender.HAND_URI_TYPE uri, bool isSkipDuplicateCheck = false) + { + if (_notEmit || GameMgr.GetIns().IsWatchBattle) + { + return; + } + List list = CreateEmitHandData(parameters, (int)uri); + if (_manager == null) + { + return; + } + if (uri == NetworkBattleSender.HAND_URI_TYPE.SELECT_SKILL_URI || uri == NetworkBattleSender.HAND_URI_TYPE.SLIDE_OBJECT_URI) + { + if ((uri != NetworkBattleSender.HAND_URI_TYPE.SLIDE_OBJECT_URI || !IsDuplicateSlideData(list)) && (isSkipDuplicateCheck || uri != NetworkBattleSender.HAND_URI_TYPE.SELECT_SKILL_URI || !IsDuplicateSelectSkillData(list))) + { + Dictionary dictionary = new Dictionary(); + dictionary.Add("StockHandData", list); + dictionary.Add(status_try, 0); + EmitMsgUriPack(dictionary, isGetableAck: true, isStockData: true, -1, isHandData: true); + } + } + else + { + _manager.Socket.Emit("hand", CreatePackEmitHandData(list)); + } + } + + private bool IsDuplicateSelectSkillData(List parameters) + { + if (parameters.Count == 5) + { + return false; + } + try + { + List> stockDataList = stockEmitMessageMgr.GetStockDataList(); + for (int i = 0; i < stockDataList.Count; i++) + { + Dictionary dictionary = stockDataList[i]; + if (!dictionary.ContainsKey("StockHandData")) + { + continue; + } + List list = dictionary["StockHandData"] as List; + if ((int)list[0] == 2) + { + string value = parameters[4].ToString(); + string value2 = parameters[5].ToString(); + string text = list[5].ToString(); + string text2 = list[6].ToString(); + if (text.Equals(value) && text2.Equals(value2)) + { + return true; + } + } + } + } + catch (Exception message) + { + Debug.LogError(message); + return false; + } + return false; + } + + private bool IsDuplicateSlideData(List parameters) + { + try + { + List> stockDataList = stockEmitMessageMgr.GetStockDataList(); + for (int i = 0; i < stockDataList.Count; i++) + { + Dictionary dictionary = stockDataList[i]; + if (!dictionary.ContainsKey("StockHandData")) + { + continue; + } + List list = dictionary["StockHandData"] as List; + if ((int)list[0] == 5) + { + string value = parameters[3].ToString(); + string value2 = parameters[4].ToString(); + string text = list[4].ToString(); + string text2 = list[5].ToString(); + if (text.Equals(value) && text2.Equals(value2)) + { + return true; + } + } + } + } + catch (Exception message) + { + Debug.LogError(message); + return false; + } + return false; + } + + public Dictionary CreateEmitData(string uri, Dictionary sendData, bool isTrySend = true) + { + if (sendData == null) + { + sendData = new Dictionary(); + } + if (!sendData.Any((KeyValuePair s) => s.Key == "uri")) + { + sendData.Add("uri", uri); + } + int num = viewerId; + sendData.Add("viewerId", num); + sendData.Add("uuid", Certification.Udid); + if (!string.IsNullOrEmpty(bid)) + { + sendData.Add("bid", bid.ToString()); + } + if (isTrySend && !sendData.Any((KeyValuePair s) => s.Key == status_try)) + { + sendData.Add(status_try, 0); + } + return sendData; + } + + private List CreateEmitHandData(List parameters, int uri) + { + List list = new List(); + list.Add(uri); + list.Add(viewerId); + list.Add(Certification.Udid); + list.AddRange(parameters); + return list; + } + + private string GetHandUri(Dictionary data) + { + return (data["StockHandData"] as List)[0].ToString(); + } + + private void EmitMsgUriPack(Dictionary info, bool isGetableAck, bool isStockData, int fixedSeqNumber, bool isHandData = false) + { + string text = ""; + text = (isHandData ? GetHandUri(info) : info["uri"].ToString()); + if (_notEmit) + { + LocalLog.AccumulateLastTraceLog("EmitMsgUriPack _notEmit " + text); + } + else if (isGetableAck) + { + int num = stockEmitMessageMgr.SequenceNumber + 1; + if (fixedSeqNumber == -1) + { + LastEmitSeqNumber = stockEmitMessageMgr.SequenceNumber + 1; + stockEmitMessageMgr.AddSequenceNumber(); + } + else + { + num = fixedSeqNumber; + } + info.Add("pubSeq", num); + if (isHandData) + { + (info["StockHandData"] as List).Insert(3, num); + } + if (isStockData) + { + stockEmitMessageMgr.StockData(info); + List> sequenceAllData = stockEmitMessageMgr.GetSequenceAllData(); + if (sequenceAllData != null && sequenceAllData.Count == 1) + { + EmitFrontStockData(); + } + else if (isHandData) + { + LocalLog.AccumulateLastTraceLog("Emit StockHand " + Enum.GetName(typeof(NetworkBattleSender.HAND_URI_TYPE), int.Parse(text))); + } + else + { + LocalLog.AccumulateLastTraceLog("Emit Stock " + text); + } + } + else + { + EmitDataToAckCallBack(info); + } + } + else + { + if (text == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.InitNetwork]) + { + LocalLog.AccumulateLastTraceLog("EmitMsgUriPack_InitNetwork " + StackTraceUtility.ExtractStackTrace()); + } + _manager.Socket.Emit("msg", CreatePackEmitData(info)); + if (text != RoomParamKey.WatchUriNames[PlayerControllerForWatching.SEND_PARAMETER.Watch]) + { + string text2 = "Emit NotWait Uri " + info["uri"]; + NetworkLogger.LogInfo(text2); + LocalLog.AccumulateLastTraceLog(text2); + } + } + } + + public bool GetTurnState() + { + if (GameMgr.GetIns().GetNetworkUserInfoData().TurnState != 0) + { + return false; + } + return true; + } + + public void SetNetworkInfo(Dictionary synchronizeData, ref NetworkBattleDefine.NetworkBattleURI receiveUri) + { + foreach (KeyValuePair synchronizeDatum in synchronizeData) + { + switch (synchronizeDatum.Key) + { + case "uri": + { + string text = synchronizeDatum.Value.ToString(); + if (Enum.IsDefined(typeof(NetworkBattleDefine.NetworkBattleURI), text)) + { + receiveUri = (NetworkBattleDefine.NetworkBattleURI)Enum.Parse(typeof(NetworkBattleDefine.NetworkBattleURI), text); + if (text == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.Matched]) + { + GameMgr.GetIns().InitializeSelfInfo(); + } + break; + } + Enum.IsDefined(typeof(PlayerController.ROOM_URI), text); + return; + } + case "selfInfo": + { + Dictionary info2 = synchronizeDatum.Value as Dictionary; + if (receiveUri != NetworkBattleDefine.NetworkBattleURI.BattleStart) + { + IsBattleStart = true; + GameMgr.GetIns().SettingSelfInfo(info2, isWatchReplayRecovery: false); + } + else + { + GameMgr.GetIns().SettingBattleStartSelfInfo(info2); + Wizard.Data.RoomTwoPickBeforeBattleInfo.SelfInfoClasIdCopyTwoPickDraftData(); + } + break; + } + case "selfDeck": + { + GameMgr ins = GameMgr.GetIns(); + List list = synchronizeDatum.Value as List; + ins.GetDataMgr().SetDeckMaxCount(list.Count, isSelf: true); + ins.SettingSelfDeck(synchronizeDatum.Value as List); + break; + } + case "turnState": + GameMgr.GetIns().GetNetworkUserInfoData().TurnState = Convert.ToInt32(synchronizeDatum.Value); + break; + case "oppoInfo": + { + Dictionary info = synchronizeDatum.Value as Dictionary; + if (receiveUri != NetworkBattleDefine.NetworkBattleURI.BattleStart) + { + GameMgr.GetIns().SettingOpponentInfo(info, isWatchReplayRecovery: false); + } + else + { + GameMgr.GetIns().SettingBattleStartOpponentInfo(info); + } + break; + } + case "bid": + bid = synchronizeDatum.Value.ToString(); + break; + } + } + } + + public void FinishBattleTask() + { + if (_failedRecoveryToNotSendFinishTask) + { + LocalLog.AccumulateLastTraceLog("Finsish BattleTask Error"); + return; + } + if (CurrentMatchingStatus == MatchingStatus.Disconnected) + { + LocalLog.AccumulateLastTraceLog("FinishBattleTask Disconnected"); + return; + } + StopNetworkBattle(isNotCloseWindow: true); + if (_battleFinishSendBase == null) + { + _battleFinishSendBase = new BattleFinishSendBase(_networkBattleManager); + } + _battleFinishSendBase.SendMatchingFinish(FinishTaskBase, FinishResultSuccses); + FinishTaskBase = null; + } + + public void FinishBattleTask(BattleManagerBase battleMgr) + { + if (_failedRecoveryToNotSendFinishTask) + { + LocalLog.AccumulateLastTraceLog("Finsish BattleTask Error"); + return; + } + if (CurrentMatchingStatus == MatchingStatus.Disconnected) + { + LocalLog.AccumulateLastTraceLog("FinishBattleTask Disconnected"); + return; + } + StopNetworkBattle(isNotCloseWindow: true); + if (_battleFinishSendBase == null) + { + _battleFinishSendBase = new BattleFinishSendBase(battleMgr); + } + _battleFinishSendBase.SendMatchingFinish(FinishTaskBase, FinishResultSuccses); + FinishTaskBase = null; + } + + protected virtual void FinishResultSuccses(NetworkTask.ResultCode result) + { + LocalLog.AccumulateLastTraceLog("FinishResultSuccses" + result); + if (_isFinishResultSuccses) + { + return; + } + _isFinishResultSuccses = true; + LocalLog.RecordCheckLog(LocalLog.RecordType.HADES, _networkBattleManager.BattleResultType == BattleManagerBase.BATTLE_RESULT_TYPE.WIN); + _networkBattleManager.SettingNetworkBattleEnd(); + UIManager.GetInstance().dialogAllClear(); + NetworkBattleReceiver.RESULT_CODE judgeResultReceiveCode = _networkBattleManager.JudgeResultReceiveCode; + bool classDead = false; + if ((uint)(judgeResultReceiveCode - 105) <= 1u || (uint)(judgeResultReceiveCode - 201) <= 7u) + { + classDead = true; + } + _networkBattleManager.FinishBattleEffect(classDead); + if (judgeResultReceiveCode != NetworkBattleReceiver.RESULT_CODE.NoContest && judgeResultReceiveCode != NetworkBattleReceiver.RESULT_CODE.DisconnectWin && judgeResultReceiveCode != NetworkBattleReceiver.RESULT_CODE.DisconnectLose && judgeResultReceiveCode != NetworkBattleReceiver.RESULT_CODE.Invalid && judgeResultReceiveCode != NetworkBattleReceiver.RESULT_CODE.TurnendWin && judgeResultReceiveCode != NetworkBattleReceiver.RESULT_CODE.TurnendLose && judgeResultReceiveCode != NetworkBattleReceiver.RESULT_CODE.TurnstartWin && judgeResultReceiveCode != NetworkBattleReceiver.RESULT_CODE.TurnstartLose) + { + TaskManager.GetInstance().NotMyPageSend(); + } + if (judgeResultReceiveCode == NetworkBattleReceiver.RESULT_CODE.NoContest) + { + LocalLog.SendLastTraceLog(null); + } + if (_trySerializeList.Any()) + { + string text = string.Empty; + for (int i = 0; i < _trySerializeList.Count; i++) + { + text += _trySerializeList[i]; + } + LocalLog.AccumulateTraceLog(text); + _trySerializeList.Clear(); + } + DestroyObj(DESTROY_OBJECT_LOG.BattleResult); + } + + public void InitCurrentMatchingStatus() + { + CurrentMatchingStatus = MatchingStatus.OffLine; + } + + public void CallMaintenanceError() + { + ShowMaintenanceError(); + } + + protected virtual void ShowMaintenanceError() + { + Dialog.Create(5); + } + + public virtual void StopNetworkBattle(bool isNotCloseWindow = false) + { + } + + public void DestroyObj(DESTROY_OBJECT_LOG log) + { + NetworkLogger.ClearLog(); + int num = (int)log; + LocalLog.AccumulateLastTraceLog("RealtimeNetwork DestroyObj" + num); + ManagerClose(); + _onEveryTimeFail = null; + _onFinishedEmit = null; + OnReceivedEvent = null; + OnResultCodeError = null; + OnAck = null; + if (!_isAlreadyDestroyedGameObject) + { + _isAlreadyDestroyedGameObject = true; + UnityEngine.Object.Destroy(base.gameObject); + } + if (_gungnir != null) + { + _gungnir.Dispose(); + _gungnir = null; + } + } + + public virtual void StartRecovery(string battleId, int maxSequenceNumber, int currentSequenceNumber) + { + SetIsRecovery(flg: true); + bid = battleId; + stockReceiveMessageMgr.Recovery(maxSequenceNumber); + stockEmitMessageMgr.Recovery(currentSequenceNumber); + } + + public virtual void EndRecovery() + { + if (RecoveryManagerBase.failedRecoveryFlag) + { + _notEmit = true; + } + SetIsRecovery(flg: false); + } + + public virtual void GetRecoveryInfo(out string battleId, out int maxSequenceNumber, out int currentSequenceNumber, out int turnState_) + { + battleId = bid; + maxSequenceNumber = stockReceiveMessageMgr.SequenceAlreadyNumber; + currentSequenceNumber = stockEmitMessageMgr.SequenceNumber; + turnState_ = -1; + } + + public int GetCurrentSequenceNumber() + { + return stockEmitMessageMgr.SequenceNumber; + } + + protected bool IsDataHaveSequenceNumber(Dictionary data) + { + if (stockReceiveMessageMgr.IsNoStockData(data)) + { + return false; + } + return true; + } + + public void UpdateLastGungnirSuccessTime() + { + if (_gungnir != null) + { + _gungnir.Tick(); + } + } + + protected bool IsMatchingURI(string uri) + { + if (uri == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.InitBattle] || uri == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.InitRoomBattle] || uri == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.Matched] || uri == NetworkBattleDefine.NetworkURINames[NetworkBattleDefine.NetworkBattleURI.InitNetwork]) + { + return true; + } + return false; + } + + public void SetRoomWatchMode(bool isWatchRoom) + { + _gungnir._isNotEmit = isWatchRoom; + } + + public void ClearStockEmitData() + { + stockEmitMessageMgr.ClearSequenceDataList(); + } + + public virtual void StartRecoveryRecording() + { + _networkBattleManager.StartRecoveryRecording(); + } + + public void ResetDisconnectLogNum() + { + _disconnectNum = 0; + _emitLogNum = 0; + } + + public void AddActionSequence() + { + _gungnir._actionSequenceNum++; + NetworkLogger.LogInfo("ActionSeq" + _gungnir._actionSequenceNum); + } + + public void SetEnableTimeOutCallBack(bool enable) + { + _gungnir.IsEnableTimeoutCallBack = enable; + } + + public int GetTurnSequence() + { + return _gungnir._actionSequenceNum; + } +} diff --git a/SVSim.BattleEngine/Engine/ReceiveFriendApplyInfo.cs b/SVSim.BattleEngine/Engine/ReceiveFriendApplyInfo.cs new file mode 100644 index 0000000..df65cfd --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReceiveFriendApplyInfo.cs @@ -0,0 +1,9 @@ +public class ReceiveFriendApplyInfo : HeaderData +{ + public ReceiveFriendApplyInfoDetail data; + + public void Initizalize() + { + data = new ReceiveFriendApplyInfoDetail(); + } +} diff --git a/SVSim.BattleEngine/Engine/ReceiveFriendApplyInfoDetail.cs b/SVSim.BattleEngine/Engine/ReceiveFriendApplyInfoDetail.cs new file mode 100644 index 0000000..a1d872a --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReceiveFriendApplyInfoDetail.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +public class ReceiveFriendApplyInfoDetail +{ + public List applyList = new List(); + + public int approveApplyCount; +} diff --git a/SVSim.BattleEngine/Engine/RecoveryOperateMgr.cs b/SVSim.BattleEngine/Engine/RecoveryOperateMgr.cs new file mode 100644 index 0000000..e5accd8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RecoveryOperateMgr.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; +using Wizard.Battle.View.Vfx; + +public class RecoveryOperateMgr : OperateMgr +{ + public RecoveryOperateMgr(BattleManagerBase battleMgr, TouchControl touchControl) + : base(battleMgr, touchControl) + { + } + + public override VfxBase InitSetCard(BattleCardBase card, bool isPlayer, bool isSelect = false, bool isRecovery = false, bool isChoiceSelect = false, bool isInstant = false, bool registerDirectlyToVfxManager = true, bool isFusionWait = false, bool isChoiceBrave = false) + { + return NullVfx.GetInstance(); + } + + public override VfxBase PlayCard(BattleCardBase card, bool isPlayer, List selectCards, bool isRecovery = false, List selectChoiceId = null, bool isChoiceBrave = false) + { + base.PlayCard(card, isPlayer, selectCards, isRecovery, selectChoiceId, isChoiceBrave); + return NullVfx.GetInstance(); + } + + public override VfxBase Attack(BattleCardBase attackCard, BattleCardBase targetCard, bool isPlayer) + { + base.Attack(attackCard, targetCard, isPlayer); + return NullVfx.GetInstance(); + } + + public override VfxBase EvolutionCard(BattleCardBase card, bool isPlayer, List selectCards, List selectChoiceId = null) + { + base.EvolutionCard(card, isPlayer, selectCards, selectChoiceId); + return NullVfx.GetInstance(); + } + + public override VfxBase BattleCardSelect(BattleCardBase actCard, BattleCardBase Target, bool isPlayer, bool registerEffectsDirectlyToVfxMgr = true, bool isTransformSkill = false, bool isBurialRiteSkill = false, bool isComplete = true) + { + SelectCard(actCard, Target, isPlayer, registerEffectsDirectlyToVfxMgr); + return NullVfx.GetInstance(); + } + + public override VfxBase PlayerTurnEnd(bool isAuto = false) + { + TurnEndOperation(isPlayer: true); + return NullVfx.GetInstance(); + } + + public override VfxBase TurnEndOperation(bool isPlayer) + { + base.TurnEndOperation(isPlayer); + CallOnTurnEndFinish(); + return NullVfx.GetInstance(); + } + + public override VfxBase FusionCard(BattleCardBase card, bool isPlayer, List selectCards) + { + base.FusionCard(card, isPlayer, selectCards); + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/RecoveryOperateReceive.cs b/SVSim.BattleEngine/Engine/RecoveryOperateReceive.cs new file mode 100644 index 0000000..8b87a32 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RecoveryOperateReceive.cs @@ -0,0 +1,78 @@ +public class RecoveryOperateReceive : OperateReceive +{ + private NetworkBattleSender.SELECT_SKILL_OPERATION _latestSelectSkillOperation; + + private bool _latestDataIsEvolve; + + public RecoveryOperateReceive(NetworkBattleManagerBase networkBattleMgr, RegisterActionManager registerCardList, OperateMgr operateMgr, NetworkBattleData networkBattleData) + : base(networkBattleMgr, registerCardList, operateMgr, networkBattleData) + { + } + + protected override InPlayCardReflection CreateNetworkInPlayAction() + { + return new RecoveryNetworkInPlayAction(_battleMgr, _operateMgr); + } + + public override void RecordSelectSkillInRecovery(NetworkBattleReceiver.ReceiveData receiveData) + { + _latestSelectSkillOperation = receiveData._selectSkillOperation; + _latestDataIsEvolve = receiveData._isEvolveTargetSelect; + ReceivePlayActionsReflectionBase playActionsReflection = GetPlayActionsReflection(receiveData._isEvolveTargetSelect); + switch (receiveData._selectSkillOperation) + { + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartSelect: + playActionsReflection.RecordSelectStart(NetworkBattleGenericTool.GetIndexToCardBase(_battleMgr, _battleMgr.BattlePlayer, receiveData.idx)); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectCard: + playActionsReflection.RecordSelectCard(NetworkBattleGenericTool.GetIndexToCardBase(_battleMgr, _battleMgr.GetBattlePlayer(receiveData._isPlayerCard), receiveData._selectedCardIndex), receiveData._isBurialRiteSelect); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CompleteSelect: + playActionsReflection.RecordCompleteSelect(NetworkBattleGenericTool.GetIndexToCardBase(_battleMgr, _battleMgr.GetBattlePlayer(receiveData._isPlayerCard), receiveData._selectedCardIndex), receiveData._isBurialRiteSelect, receiveData.IsChoiceBraveSelect); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CancelSelect: + playActionsReflection.RecordCancelSelect(); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartChoiceSelect: + playActionsReflection.RecordStartChoiceSelect(NetworkBattleGenericTool.GetIndexToCardBase(_battleMgr, _battleMgr.BattlePlayer, receiveData.idx)); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CompleteChoiceSelect: + playActionsReflection.RecordCompleteChoiceSelect(receiveData._selectedChoiceCardIdList); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CancelChoiceSelect: + playActionsReflection.RecordCancelChoice(); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartFusionSelect: + playActionsReflection.RecordStartFusion(NetworkBattleGenericTool.GetIndexToCardBase(_battleMgr, _battleMgr.BattlePlayer, receiveData.idx)); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectFusionIngredient: + playActionsReflection.RecordSelectFusion(NetworkBattleGenericTool.GetIndexToCardBase(_battleMgr, _battleMgr.GetBattlePlayer(receiveData._isPlayerCard), receiveData._selectedCardIndex)); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CompleteFusionSelect: + playActionsReflection.ClearData(); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectChoiceCard: + break; + } + } + + public override void CheckLatestReplayInfoInRecovery() + { + ReceivePlayActionsReflectionBase playActionsReflection = GetPlayActionsReflection(_latestDataIsEvolve); + if (playActionsReflection.ActingCard != null) + { + switch (_latestSelectSkillOperation) + { + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartSelect: + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectCard: + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartFusionSelect: + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectFusionIngredient: + playActionsReflection.RecordCancelSelect(); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartChoiceSelect: + playActionsReflection.RecordCancelChoice(); + break; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/RecoveryOperationCollection.cs b/SVSim.BattleEngine/Engine/RecoveryOperationCollection.cs new file mode 100644 index 0000000..fa39ee9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RecoveryOperationCollection.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using Wizard.Battle.View.Vfx; + +public class RecoveryOperationCollection : WatchOperationCollection +{ + public RecoveryOperationCollection(NetworkBattleManagerBase networkBattleMgr, OperateMgr operateMgr, NetworkBattleReceiver.ReceiveData receivedData, NetworkBattleData networkBattleData, bool isPlayer) + : base(networkBattleMgr, operateMgr, receivedData, networkBattleData, isPlayer) + { + } + + public override void SecondMulliganOperation(Func, VfxBase> OnReceiveOpponentMulligan, Func, VfxBase> OnReceivePlayerMulligan, Func OnEndMulligan) + { + OperateMulligan(OnReceiveOpponentMulligan, OnReceivePlayerMulligan); + BattleManagerBase.GetIns().BattlePlayer.IsTurnStartEffectNotFinished = true; + _networkBattleMgr.VfxMgr.RegisterSequentialVfx(OnEndMulligan.GetAllFuncVfxResults()); + } + + public override void PlayHandCardOperation(PlayHandCardReflection networkPlayCardAction, List choiceIdList = null, bool isChoice = false) + { + List actionDictionary = (_isPlayer ? _receivedData.PlayerTargetDataList : _receivedData.OpponentTargetDataList); + BattlePlayerBase battlePlayer = _networkBattleMgr.GetBattlePlayer(_isPlayer); + CommonPlayHandCardOperation(networkPlayCardAction, battlePlayer, _isPlayer, actionDictionary, choiceIdList, isChoice); + } + + public override void PlaySkillSelectHandCardOperation(PlayHandCardReflection networkPlayCardAction, List choiceIds = null) + { + List targetDataList = (_isPlayer ? _receivedData.PlayerTargetDataList : _receivedData.OpponentTargetDataList); + SetupNetworkPlayCardAction(networkPlayCardAction, targetDataList); + _networkBattleMgr.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + networkPlayCardAction.PlayAction(_isPlayer, choiceIds); + })); + } + + public override void BattleFinishOperation() + { + ((NetworkStandardBattleMgr)_networkBattleMgr)._recoveryController.RecoveryDataHandlerInstance.OnCompleteRecovery += base.BattleFinishOperation; + } + + public override void TouchOperation() + { + } + + public override void SelectObjectOperation() + { + } + + public override void TurnEndReady() + { + } + + public override void SlideObject() + { + } + + protected override void PlayCancelSlide() + { + } + + protected override void CallCompleteEvent(ReceivePlayActionsReflectionBase networkAction) + { + } + + protected override void CheckStateAndCancel(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction, bool isPlayer) + { + } + + protected override void RegisterSequentialVfx(VfxBase operationVfx) + { + } + + public override void SendEcho() + { + if (_networkBattleMgr._specialWinVfx == null) + { + _networkBattleMgr.ClearRegisterCardList(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterAlter.cs b/SVSim.BattleEngine/Engine/RegisterAlter.cs new file mode 100644 index 0000000..94db141 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterAlter.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; +using System.Linq; + +public class RegisterAlter : RegisterActionBase +{ + public enum ChangeType + { + add, + set, + half + } + + protected List _cardList; + + protected SkillBase _skill; + + protected string _attachMsg = string.Empty; + + public RegisterAlter(List cardList, SkillBase skill) + { + _cardList = cardList; + _skill = skill; + EffectSkillPublicCount = NetworkBattleGenericTool.GetPublishSkillCount(skill); + if (_cardList != null && _skill != null) + { + _attachMsg = NetworkBattleGenericTool.MakeLogCode(_skill); + } + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.alter.ToString(); + } + + protected virtual Dictionary MakeAttachTarget(Dictionary dataList) + { + if (EffectSkillPublicCount == -1) + { + dataList.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.attachTarget], _attachMsg); + } + else + { + dataList.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.attachTarget], EffectSkillPublicCount.ToString()); + } + return dataList; + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + if (base.IndexList.Count == 0) + { + return false; + } + if (_skill != null && !_skill.IsOnceCallTiming) + { + return false; + } + if (base.IndexList.All((int x) => lot.IndexList.Contains(x)) && IsSelf == lot.IsSelf) + { + return _skill == lot.Skill; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterAttach.cs b/SVSim.BattleEngine/Engine/RegisterAttach.cs new file mode 100644 index 0000000..cf2c488 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterAttach.cs @@ -0,0 +1,208 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class RegisterAttach : RegisterAlter +{ + private int _addAtk = -1; + + private int _addLife = -1; + + private int _setAtk = -1; + + private int _setLife = -1; + + private int _clan = -1; + + private int _tribe = -1; + + private string _tribeChangeType = string.Empty; + + private string _other = string.Empty; + + private const string ON_OTHER = "o"; + + private const string ON_WHEN_DESTROY = "l"; + + private bool _isBoard; + + private bool _isDelete; + + private bool _isForHandResident; + + public RegisterAttach(List cardList, SkillBase skill, bool isDelete = false) + : base(cardList, skill) + { + RegisterAttach registerAttach = this; + base.IndexList = new List(); + cardList.ForEach(delegate(BattleCardBase x) + { + registerAttach.IndexList.Add(x.Index); + }); + if (skill is Skill_powerup) + { + Skill_powerup skill_powerup = skill as Skill_powerup; + _addAtk = skill_powerup.GetAddOffense(); + _addLife = skill_powerup.GetAddLife(); + } + else if (skill is Skill_power_down) + { + Skill_power_down skill_power_down = skill as Skill_power_down; + _setAtk = skill_power_down.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set_offense, -1); + _setLife = skill_power_down.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set_life, -1); + } + else if (skill is Skill_change_affiliation) + { + Skill_change_affiliation skill_change_affiliation = skill as Skill_change_affiliation; + if (!isDelete) + { + if (skill_change_affiliation.GetClanType() != CardBasePrm.ClanType.NONE) + { + _clan = (int)skill_change_affiliation.GetClanType(); + } + CardBasePrm.TribeChangeType tribeChangeType = skill_change_affiliation.CreateTribeChangeType(); + _tribeChangeType = ((tribeChangeType == CardBasePrm.TribeChangeType.CHANGE) ? "s" : "a"); + List list = skill_change_affiliation.CreateChangeTribeList(); + if (list != null && list.Count() > 0) + { + _tribe = (int)list[0]; + } + } + if (cardList.Any((BattleCardBase s) => s.IsInplay)) + { + _isBoard = true; + } + if (skill_change_affiliation.ApplyCardFilterList.Any((ISkillCardFilter s) => s is SkillParameterCostFilter) && skill_change_affiliation.ApplyingTargetFilter is SkillTargetHandFilter) + { + _isForHandResident = true; + } + } + else if (skill is Skill_attach_skill) + { + Skill_attach_skill skill_attach_skill = skill as Skill_attach_skill; + _other = (skill_attach_skill.AttachWhenDestroy ? "l" : "o"); + NetworkBattleManagerBase networkBattleMgr = BattleManagerBase.GetIns() as NetworkBattleManagerBase; + Func, SkillConditionCheckerOption, SkillProcessor, VfxBase> value = delegate + { + RegisterAttach data = new RegisterAttach(cardList, skill, isDelete: true); + networkBattleMgr.RegisterActionManager.Add(data); + return NullVfx.GetInstance(); + }; + _skill.OnSkillStopEnd -= value; + _skill.OnSkillStopEnd += value; + } + else + { + _other = "o"; + } + IsSelf = cardList[0].IsPlayer; + _skill = skill; + _isDelete = isDelete; + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = base.MakeSendData(); + dictionary.Add(ActionBaseParameter.type.ToString(), _isDelete ? ActionBaseParameter.del.ToString() : ActionBaseParameter.add.ToString()); + if (_addAtk >= 1) + { + dictionary.Add(ActionBaseParameter.atk.ToString(), "a+" + _addAtk); + } + if (_addLife >= 1) + { + dictionary.Add(ActionBaseParameter.life.ToString(), "a+" + _addLife); + } + if (_setAtk >= 1) + { + dictionary.Add(ActionBaseParameter.atk.ToString(), "s+" + _setAtk); + } + if (_setLife >= 1) + { + dictionary.Add(ActionBaseParameter.life.ToString(), "s+" + _setLife); + } + if (_clan >= 0) + { + dictionary.Add(ActionBaseParameter.clan.ToString(), _clan.ToString()); + } + if (_tribe != -1) + { + dictionary.Add(ActionBaseParameter.tribe.ToString(), _tribeChangeType + _tribe); + } + if (_other != string.Empty) + { + dictionary.Add(ActionBaseParameter.other.ToString(), _other); + } + if (_isBoard) + { + dictionary.Add(ActionBaseParameter.isBoard.ToString(), 1); + } + if (_isForHandResident) + { + dictionary.Add(ActionBaseParameter.forHandResident.ToString(), 1); + } + if (BattleManagerBase.GetIns() is NetworkBattleManagerBase networkBattleManagerBase && networkBattleManagerBase.RegisterActionManager.RegisterDataList.Any((RegisterActionBase r) => r is RegisterMetamorphoseData) && _skill.OnWhenDrawOtherStart != 0 && _skill.IsHaveApplicableTargetFilter()) + { + dictionary.Add(ActionBaseParameter.isForce.ToString(), 1); + } + return MakeAttachTarget(dictionary); + } + + private static bool IsPrivateBuffFilter(ISkillTargetFilter targetFilter, bool isOnWhenFusion, bool isOnWhenDraw, bool isOnWhenReturn) + { + if (!(targetFilter is SkillTargetHandFilter) && !(targetFilter is SkillTargetDeckFilter) && !(targetFilter is SkillTargetHandOtherSelfFilter) && !(targetFilter is SkillTargetLastTargetFilter) && !(targetFilter is SkillTargetSkillDrewCardFilter) && !(targetFilter is SkillTargetTokenDrawCardFilter) && !(targetFilter is SkillTargetReturnCardFilter) && !(targetFilter is SkillTargetSkillUpdateDeckCardFilter) && (!isOnWhenFusion || !(targetFilter is SkillTargetSelfFilter)) && (!isOnWhenDraw || !(targetFilter is SkillTargetHandSelfFilter))) + { + if (isOnWhenReturn) + { + return targetFilter is SkillTargetSelfFilter; + } + return false; + } + return true; + } + + public static bool IsPrivateBuffChangeCard(SkillBase skill) + { + if (!(skill is Skill_powerup) && !(skill is Skill_power_down)) + { + return false; + } + if (skill.ApplyAndFilter.Count > 0) + { + for (int i = 0; i < skill.ApplyAndFilter.Count; i++) + { + if (IsPrivateBuffFilter(skill.ApplyAndFilter[i].TargetFilter, skill.OnWhenFusion != 0, skill.OnWhenDraw != 0, skill.OnWhenReturnStart != 0)) + { + return true; + } + } + } + else if (IsPrivateBuffFilter(skill.ApplyingTargetFilter, skill.OnWhenFusion != 0, skill.OnWhenDraw != 0, skill.OnWhenReturnStart != 0)) + { + return true; + } + return false; + } + + public static bool IsAffiliationChangeCard(SkillBase skill) + { + if (!(skill is Skill_change_affiliation)) + { + return false; + } + return true; + } + + public static bool IsAttachUnapprovedCard(SkillBase skill) + { + if (!(skill is Skill_attach_skill) && !(skill is Skill_attack_by_life)) + { + return false; + } + if (!NetworkBattleGenericTool.IsUnapprovedTarget(skill) && !(skill.ApplyingTargetFilter is SkillTargetSelectedCardsFilter)) + { + return false; + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterCopyToken.cs b/SVSim.BattleEngine/Engine/RegisterCopyToken.cs new file mode 100644 index 0000000..647220a --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterCopyToken.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +public class RegisterCopyToken : RegisterToken +{ + public int CopyCardIndex { get; private set; } + + public bool IsPremium { get; private set; } + + public RegisterCopyToken(BattleCardBase card, bool isChoice, NetworkBattleDefine.NetworkCardPlaceState toPlaceState, int copyCardIndex, SkillBase skill) + : base(card, isChoice, toPlaceState, skill) + { + CopyCardIndex = copyCardIndex; + IsPremium = card.BaseParameter.IsFoil; + } + + protected override Dictionary MakeCardData() + { + Dictionary dictionary = new Dictionary(); + if (PrivateGroupIndexMsg != "") + { + dictionary.Add(ActionBaseParameter.baseIdx.ToString(), PrivateGroupIndexMsg); + } + else + { + dictionary.Add(ActionBaseParameter.baseIdx.ToString(), CopyCardIndex); + } + dictionary.Add(ActionBaseParameter.isPremium.ToString(), IsPremium ? 1 : 0); + return dictionary; + } + + public override bool IsMatchData(RegisterToken baseToken, RegisterToken checkToken) + { + if (base.IsMatchData(baseToken, checkToken) && baseToken is RegisterCopyToken && checkToken is RegisterCopyToken) + { + RegisterCopyToken registerCopyToken = baseToken as RegisterCopyToken; + RegisterCopyToken registerCopyToken2 = checkToken as RegisterCopyToken; + if (registerCopyToken.CopyCardIndex == registerCopyToken2.CopyCardIndex && registerCopyToken.IsPremium == registerCopyToken2.IsPremium) + { + return true; + } + } + return false; + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + if (lot.IndexList.Contains(CopyCardIndex) && IsSelf == lot.IsSelf) + { + return base.Skill == lot.Skill; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterDeckOut.cs b/SVSim.BattleEngine/Engine/RegisterDeckOut.cs new file mode 100644 index 0000000..2ddd0a1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterDeckOut.cs @@ -0,0 +1,19 @@ +public class RegisterDeckOut : RegisterActionBase +{ + private const string DECKOUT = "deckout"; + + public RegisterDeckOut(bool isSelf) + { + IsSelf = isSelf; + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.deckOut.ToString(); + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterEnhanceTrigger.cs b/SVSim.BattleEngine/Engine/RegisterEnhanceTrigger.cs new file mode 100644 index 0000000..1aba003 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterEnhanceTrigger.cs @@ -0,0 +1,184 @@ +using System.Collections.Generic; + +public class RegisterEnhanceTrigger : RegisterActionBase +{ + public enum OpponentEnhanceTriggerParameter + { + targetIdx, + revenge, + resonance, + avarice, + returnCard, + option, + turnEndRestore, + turnStartRestore, + turnDamageFromUnit, + useEp, + maxAtk, + canEvolve, + isUnlimited + } + + private List TurnEndStartHandList; + + private int _revenge; + + private bool _revengeFlag; + + private int _resonance; + + private bool _resonanceFlag; + + private int _avarice; + + private bool _avariceFlag; + + private bool _isTurnEndRestore; + + private bool _isTurnStartRestore; + + private bool _isTurnDamageFromUnit; + + private int _turnDamageFromUnit; + + private bool _isUseEp; + + private int _returnCard; + + private bool _returnCardFlag; + + private int _maxAtk; + + private bool _maxAtkFlag; + + private bool _canEvolve; + + private bool _isUnlimited; + + public RegisterEnhanceTrigger(BattlePlayerBase player) + { + IsSelf = player.IsPlayer; + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = base.MakeSendData(); + if (_revengeFlag) + { + dictionary.Add(OpponentEnhanceTriggerParameter.revenge.ToString(), _revenge); + } + if (_avariceFlag) + { + dictionary.Add(OpponentEnhanceTriggerParameter.avarice.ToString(), _avarice); + } + if (_resonanceFlag) + { + dictionary.Add(OpponentEnhanceTriggerParameter.resonance.ToString(), _resonance); + } + if (_returnCardFlag) + { + dictionary.Add(OpponentEnhanceTriggerParameter.returnCard.ToString(), _returnCard); + } + if (_isTurnEndRestore) + { + List list = new List(); + foreach (BattleCardBase turnEndStartHand in TurnEndStartHandList) + { + list.Add(turnEndStartHand.Index); + } + dictionary.Add(OpponentEnhanceTriggerParameter.turnEndRestore.ToString(), list); + } + if (_isTurnStartRestore) + { + dictionary.Add(OpponentEnhanceTriggerParameter.turnStartRestore.ToString(), 1); + } + if (_isTurnDamageFromUnit) + { + dictionary.Add(OpponentEnhanceTriggerParameter.turnDamageFromUnit.ToString(), _turnDamageFromUnit); + } + if (_isUseEp) + { + dictionary.Add(OpponentEnhanceTriggerParameter.useEp.ToString(), 1); + } + if (_maxAtkFlag) + { + dictionary.Add(OpponentEnhanceTriggerParameter.maxAtk.ToString(), _maxAtk); + } + if (_canEvolve) + { + dictionary.Add(OpponentEnhanceTriggerParameter.canEvolve.ToString(), 1); + } + if (_isUnlimited) + { + dictionary.Add(OpponentEnhanceTriggerParameter.isUnlimited.ToString(), 1); + } + return dictionary; + } + + public void SettingRevenge(int revengeNum) + { + _revenge = revengeNum; + _revengeFlag = true; + } + + public void SettingResonance(int resonanceNum) + { + _resonance = resonanceNum; + _resonanceFlag = true; + } + + public void SettingAvarice(int avariceNum) + { + _avarice = avariceNum; + _avariceFlag = true; + } + + public void SettingReturnCard(int returnCardNum) + { + _returnCard = returnCardNum; + _returnCardFlag = true; + } + + public void SettingTurnEndRestore(List cards) + { + _isTurnEndRestore = true; + TurnEndStartHandList = cards; + } + + public void SettingTurnStartRestore() + { + _isTurnStartRestore = true; + } + + public void SettingBeforeTurnDamageFromUnit(int turnCausedDamage) + { + _isTurnDamageFromUnit = true; + _turnDamageFromUnit = turnCausedDamage; + } + + public void SettingUseEp() + { + _isUseEp = true; + } + + public void SettingMaxAtk(int maxAtk) + { + _maxAtk = maxAtk; + _maxAtkFlag = true; + } + + public void SettingCanEvolve() + { + _canEvolve = true; + } + + public void SettingIsUnlimited() + { + _isUnlimited = true; + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.trigger.ToString(); + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterEvolution.cs b/SVSim.BattleEngine/Engine/RegisterEvolution.cs new file mode 100644 index 0000000..143a118 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterEvolution.cs @@ -0,0 +1,23 @@ +public class RegisterEvolution : RegisterActionBase +{ + public RegisterEvolution(bool isSelf, int idx) + { + IsSelf = isSelf; + base.IndexList.Add(idx); + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.evolution.ToString(); + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + return false; + } + + public void AddIndex(int idx) + { + base.IndexList.Add(idx); + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterExtract.cs b/SVSim.BattleEngine/Engine/RegisterExtract.cs new file mode 100644 index 0000000..31686ec --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterExtract.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using System.Linq; + +public class RegisterExtract : RegisterActionBase +{ + private string _param; + + private bool _isBase; + + public RegisterExtract(bool isSelf, List targetCards, string param, bool isBase) + { + targetCards.ForEach(delegate(BattleCardBase x) + { + base.IndexList.Add(x.Index); + }); + IsSelf = isSelf; + _param = param; + _isBase = isBase; + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = null; + dictionary = base.MakeSendData(); + if (_isBase) + { + dictionary.Add(ActionBaseParameter.isBase.ToString(), "1"); + } + dictionary.Add(ActionBaseParameter.var.ToString(), new List { "v1" }); + dictionary.Add(ActionBaseParameter.param.ToString(), new List { _param }); + return dictionary; + } + + public static bool IsExtract(SkillBase skill) + { + if (skill.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.CardFilterList.Any((ISkillCardFilter cf) => cf is SkillLastTargetTribeFilter))) + { + return true; + } + if (skill.ApplyingTargetFilter is SkillTargetDeckFilter) + { + return skill.ApplyCardFilterList.Any((ISkillCardFilter s) => (s is SkillParameterBaseCostFilter && (s as SkillParameterBaseCostFilter).GetParameterText().Contains("fixed_generic_value")) ? true : false); + } + return false; + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.extract.ToString(); + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterFilter.cs b/SVSim.BattleEngine/Engine/RegisterFilter.cs new file mode 100644 index 0000000..c5a78a3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterFilter.cs @@ -0,0 +1,349 @@ +using System.Collections.Generic; +using System.Linq; + +public class RegisterFilter : RegisterTargetBase +{ + private List _targetCardList; + + public List ExecOrderSkills { get; private set; } + + public bool IsSpellBoost { get; private set; } + + public RegisterFilter(RegisterActionManager registerActionManager, BattleManagerBase mgr, bool isplayer, SkillBase skill, List cardList, bool isStop, SkillConditionCheckerOption option) + : base(skill, registerActionManager, isplayer, mgr) + { + _targetCardList = cardList; + base.IndexList = new List(); + ExecOrderSkills = new List(); + if (isStop && (skill.ApplyingTargetFilter is SkillTargetHandFilter || skill.ApplyingTargetFilter is SkillTargetHandOtherSelfFilter)) + { + foreach (BattleCardBase handCard in mgr.GetBattlePlayer(isplayer).HandCardList) + { + base.IndexList.Add(handCard.Index); + } + } + if ((!isStop && (skill.ApplyingTargetFilter is SkillTargetHandFilter || skill.ApplyingTargetFilter is SkillTargetHandOtherSelfFilter)) || skill.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.TargetFilter is SkillTargetHandFilter) || skill.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.TargetFilter is SkillTargetHandOtherSelfFilter)) + { + FromPlaceState = NetworkBattleDefine.NetworkCardPlaceState.Hand; + } + else if (!isStop && (skill.ApplyingTargetFilter is SkillTargetDeckFilter || skill.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.TargetFilter is SkillTargetDeckFilter))) + { + FromPlaceState = NetworkBattleDefine.NetworkCardPlaceState.Deck; + } + else if (_targetCardList != null) + { + foreach (BattleCardBase targetCard in _targetCardList) + { + NetworkBattleDefine.NetworkCardPlaceState cardPlaceState = NetworkBattleGenericTool.GetCardPlaceState(targetCard.SelfBattlePlayer, targetCard.Index); + if (cardPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Hand || cardPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Deck) + { + base.IndexList.Add(targetCard.Index); + } + } + } + SettingTargetStatusToSearchSkill(mgr, skill, 0, null, option); + if (_conditionsList.Count > 1 && skill.ApplyAndFilter.Count > 0) + { + for (int num = 0; num < _conditionsList.Count - 1; num++) + { + AddGroupIndex(); + } + } + } + + public List AddSettingExecOrder(SkillBase skill, bool isStop) + { + ExecOrderSkills.Add(skill); + RegisterActionBase registerActionBase = null; + if (skill is Skill_metamorphose) + { + Skill_metamorphose skill_metamorphose = skill as Skill_metamorphose; + bool isFirstOnly = IsFirstOnlyMetamorphoseSkill(skill_metamorphose.ApplyFilterCollection); + registerActionBase = new RegisterMetamorphoseData(skill_metamorphose.GetMetamorphoseCardId(), -1, IsSelf, skill, isChoice: false, isFirstOnly); + } + else if (skill is Skill_cost_change) + { + if (!isStop) + { + } + } + else + { + if (skill is Skill_spell_charge) + { + Skill_spell_charge skill_spell_charge = skill as Skill_spell_charge; + RegisterSpellboost registerSpellboost = new RegisterSpellboost(_targetCardList, skill_spell_charge, skill_spell_charge.GetAddBoostCount(), skill_spell_charge.GetDiffBoostCount()); + registerSpellboost.SettingSpellBoostGrope(GroupMsgList[0]); + IsSpellBoost = true; + registerActionBase = registerSpellboost; + return new List { registerActionBase }; + } + if (skill is Skill_banish) + { + if (_targetCardList.Count() >= 1) + { + BattleCardBase battleCardBase = _targetCardList.First(); + NetworkBattleDefine.NetworkCardPlaceState cardPlaceState = NetworkBattleGenericTool.GetCardPlaceState(battleCardBase.SelfBattlePlayer, battleCardBase.Index); + List list = new List(); + for (int i = 0; i < GroupMsgList.Count; i++) + { + RegisterStateChangeCard registerStateChangeCard = new RegisterStateChangeCard(battleCardBase, cardPlaceState, NetworkBattleDefine.NetworkCardPlaceState.Banish, skill); + SettingGroupIndexMsg(registerStateChangeCard, i); + list.Add(registerStateChangeCard); + } + return list; + } + } + else if (skill is Skill_discard) + { + if (_targetCardList.Count() >= 1) + { + registerActionBase = new RegisterStateChangeCard(_targetCardList.First(), NetworkBattleDefine.NetworkCardPlaceState.Hand, NetworkBattleDefine.NetworkCardPlaceState.Cemetery, skill); + } + } + else if (skill is Skill_powerup || skill is Skill_change_affiliation || skill is Skill_attach_skill || skill is Skill_attack_by_life) + { + List list2 = _targetCardList.ToList().FindAll((BattleCardBase x) => NetworkBattleGenericTool.GetCardPlaceState(x.SelfBattlePlayer, x.Index) == NetworkBattleDefine.NetworkCardPlaceState.Hand || NetworkBattleGenericTool.GetCardPlaceState(x.SelfBattlePlayer, x.Index) == NetworkBattleDefine.NetworkCardPlaceState.Deck); + if (list2.Count() >= 1) + { + registerActionBase = new RegisterAttach(list2, skill); + } + } + } + if (registerActionBase != null) + { + SettingGroupIndexMsg(registerActionBase); + return new List { registerActionBase }; + } + return null; + } + + public void SettingExecOrder(RegisterActionBase registerData) + { + if (registerData != null) + { + SettingGroupIndexMsg(registerData); + } + } + + public static bool IsNeedFilter(BattleManagerBase mgr, bool isplayer, SkillBase skill, IEnumerable cardList, bool isStop) + { + if (!isStop && (skill.ApplyingTargetFilter is SkillTargetHandFilter || skill.ApplyingTargetFilter is SkillTargetHandOtherSelfFilter)) + { + if (mgr.GetBattlePlayer(isplayer).HandCardList.Count <= 0) + { + return false; + } + return true; + } + if (cardList == null) + { + return false; + } + foreach (BattleCardBase card in cardList) + { + NetworkBattleDefine.NetworkCardPlaceState cardPlaceState = NetworkBattleGenericTool.GetCardPlaceState(card.SelfBattlePlayer, card.Index); + if (cardPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Hand || cardPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Deck) + { + return true; + } + } + return false; + } + + public static bool IsDetailCheckSkillDrewCard(SkillBase skill) + { + if (skill.ApplyCardFilterList.Any((ISkillCardFilter s) => s is SkillParameterBaseCostFilter)) + { + return true; + } + if (IsFilterPreprocessCondition(skill)) + { + return true; + } + return false; + } + + private static bool IsPrivateFilter(ISkillTargetFilter filter) + { + if (!(filter is SkillTargetHandFilter) && !(filter is SkillTargetHandOtherSelfFilter) && !(filter is SkillTargetInHandCardFilter) && !(filter is SkillTargetDeckFilter) && !(filter is SkillTargetSkillUpdateDeckCardFilter) && !(filter is SkillTargetDeckBanishedCardListFilter)) + { + return filter is SkillTargetHandBanishedCardListFilter; + } + return true; + } + + public static bool IsFilterCard(SkillBase skill) + { + if (skill.ApplyingTargetFilter is SkillTargetSkillDrewCardFilter || (skill.ApplyingTargetFilter is SkillTargetLoadTargetFilter && skill.OnBeforeAttackStart != 0)) + { + return IsDetailCheckSkillDrewCard(skill); + } + bool flag = skill is NetworkSkill_attach_skill && skill.ApplyingTargetFilter is NetworkSkillTargetLastTargetFilter; + if (skill is NetworkSkill_attach_skill && skill.ApplyAndFilter.Count > 0) + { + for (int i = 0; i < skill.ApplyAndFilter.Count; i++) + { + flag |= skill.ApplyAndFilter[i].TargetFilter is NetworkSkillTargetLastTargetFilter; + } + } + if (flag) + { + SkillBase lastTargetSkillReferenceSkill = NetworkBattleGenericTool.GetLastTargetSkillReferenceSkill(skill); + if (lastTargetSkillReferenceSkill != null) + { + return IsFilterCard(lastTargetSkillReferenceSkill); + } + } + if (skill.ApplyAndFilter.Count > 0) + { + for (int j = 0; j < skill.ApplyAndFilter.Count; j++) + { + if (!IsPrivateFilter(skill.ApplyAndFilter[j].TargetFilter)) + { + return false; + } + if (skill is Skill_token_draw && skill.ApplyAndFilter[j].TargetFilter is SkillTargetHandOtherSelfFilter) + { + return false; + } + } + } + else if (!IsPrivateFilter(skill.ApplyingTargetFilter) && !(skill.ApplySelectFilter is SkillRandomSelectFilter)) + { + return false; + } + if (RegisterTool.IsSkillRandom(skill)) + { + return false; + } + if (skill.ApplySelectFilter is SkillUserSelectFilter || skill is Skill_select) + { + return false; + } + if (skill.ApplySelectFilter is SkillSelectIndexFilter) + { + return false; + } + if (!RegisterTool.IsSkillFilterEffect(skill)) + { + return false; + } + return true; + } + + public static bool IsFilterPreprocessCondition(SkillBase skill) + { + if (skill.PreprocessList.FirstOrDefault((SkillPreprocessBase p) => p is SkillPreprocessConditionCheck) is SkillPreprocessConditionCheck skillPreprocessConditionCheck) + { + bool num = skillPreprocessConditionCheck.Contains(SkillFilterCreator.ContentKeyword.last_target.ToString()) || skillPreprocessConditionCheck.Contains(SkillFilterCreator.ContentKeyword.load_target.ToString()); + SkillCollectionBase skills = skill.SkillPrm.ownerCard.Skills; + int num2 = skills.IndexOf(skill); + bool flag = num2 > 0 && NetworkBattleGenericTool.IsUnapprovedTarget(skills.ElementAt(num2 - 1)); + return num && flag; + } + return false; + } + + public static bool IsBothTurnFilterSkill(SkillBase skill) + { + if (skill.OnWhenDestroyStart != 0) + { + return IsFilterCard(skill); + } + return false; + } + + public static bool IsHandAllSelect(SkillBase skill) + { + if (!(skill is Skill_attach_skill) && !(skill is Skill_attack_by_life)) + { + return false; + } + if (skill.IsHaveLastTarget) + { + return false; + } + if (NetworkBattleGenericTool.IsUnapprovedTarget(skill)) + { + return true; + } + return false; + } + + public static bool IsDeckAllSelect(SkillBase skill) + { + if (!(skill is Skill_powerup)) + { + return false; + } + bool flag = skill.ApplyingTargetFilter is SkillTargetDeckFilter; + if (skill.ApplyAndFilter.Count > 0) + { + for (int i = 0; i < skill.ApplyAndFilter.Count; i++) + { + flag |= skill.ApplyAndFilter[i].TargetFilter is SkillTargetDeckFilter; + } + } + return flag; + } + + public static bool IsSkillUpdateDeckCard(SkillBase skill) + { + if (!(skill is Skill_powerup)) + { + return false; + } + bool flag = skill.ApplyingTargetFilter is SkillTargetSkillUpdateDeckCardFilter; + if (skill.ApplyAndFilter.Count > 0) + { + for (int i = 0; i < skill.ApplyAndFilter.Count; i++) + { + flag |= skill.ApplyAndFilter[i].TargetFilter is SkillTargetSkillUpdateDeckCardFilter; + } + } + return flag; + } + + public static bool IsFilterCardUnapproved(SkillBase skill) + { + if (skill.ApplyingTargetFilter is SkillTargetSkillDrewCardFilter) + { + return false; + } + bool isWatchBattle = GameMgr.GetIns().IsWatchBattle; + bool flag = GameMgr.GetIns().IsAdmin || (isWatchBattle && skill.SkillPrm.ownerCard.IsPlayer); + if (skill is Skill_spell_charge || skill is Skill_discard || skill is Skill_destroy || skill is Skill_banish || skill is Skill_powerup || skill is Skill_attach_skill || skill is Skill_update_deck || (skill is Skill_metamorphose && (!flag || !(skill.ApplyingTargetFilter is SkillTargetInHandCardFilter))) || (skill is Skill_change_affiliation && (!isWatchBattle || !skill.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.TargetFilter is SkillTargetHandOtherSelfFilter || f.TargetFilter is SkillTargetDeckFilter)))) + { + return true; + } + return false; + } + + private bool IsFirstOnlyMetamorphoseSkill(ApplySkillTargetFilterCollection targetFilterCollection) + { + List applyAndFilter = targetFilterCollection.ApplyAndFilter; + if (applyAndFilter.Count <= 0) + { + ISkillTargetFilter targetFilter = targetFilterCollection.TargetFilter; + List cardFilterList = targetFilterCollection.CardFilterList; + if (!(targetFilter is SkillTargetInHandCardFilter) && !(targetFilter is SkillTargetSummonedCardFilter) && !(targetFilter is SkillTargetPlayedCardFilter)) + { + if (targetFilter is SkillTargetSelfFilter) + { + return cardFilterList.Any((ISkillCardFilter f) => f is SkillGetOffCardListFilter); + } + return false; + } + return true; + } + for (int num = 0; num < applyAndFilter.Count; num++) + { + if (IsFirstOnlyMetamorphoseSkill(applyAndFilter[num])) + { + return true; + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterFusion.cs b/SVSim.BattleEngine/Engine/RegisterFusion.cs new file mode 100644 index 0000000..d233230 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterFusion.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.Linq; + +public class RegisterFusion : RegisterAlter +{ + public RegisterFusion(BattleCardBase fusionCard, List ingredientCards) + : base(ingredientCards, fusionCard.Skills.FirstOrDefault((SkillBase s) => s is Skill_fusion)) + { + base.IndexList.Add(fusionCard.Index); + IsSelf = fusionCard.IsPlayer; + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = base.MakeSendData(); + List value = _cardList.Select((BattleCardBase m) => m.Index).ToList(); + dictionary.Add(ActionBaseParameter.ingredients.ToString(), value); + return MakeAttachTarget(dictionary); + } + + public override string GetUriMsg() + { + return "fusion"; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterMetamorphoseData.cs b/SVSim.BattleEngine/Engine/RegisterMetamorphoseData.cs new file mode 100644 index 0000000..d2459ff --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterMetamorphoseData.cs @@ -0,0 +1,81 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; + +public class RegisterMetamorphoseData : RegisterActionBase +{ + public enum MetamorphoseListParameter + { + idx, + after, + cardId, + isSelf, + isChoice, + isFirstOnly, + isFusion + } + + protected SkillBase _skill; + + public int Index => base.IndexList[0]; + + public int AfterId { get; private set; } + + public bool IsChoice { get; private set; } + + public bool IsFirstOnly { get; private set; } + + public bool IsFusion { get; private set; } + + public RegisterMetamorphoseData(int cardId, int index, bool isSelf, SkillBase skill, bool isChoice = false, bool isFirstOnly = false, bool isFusion = false) + { + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId); + base.IndexList = new List(); + base.IndexList.Add(index); + AfterId = cardParameterFromId.CardId; + IsSelf = isSelf; + _skill = skill; + IsChoice = isChoice; + IsFirstOnly = isFirstOnly; + IsFusion = isFusion; + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = base.MakeSendData(); + Dictionary dictionary2 = new Dictionary(); + dictionary2.Add(MetamorphoseListParameter.cardId.ToString(), AfterId); + dictionary.Add(MetamorphoseListParameter.after.ToString(), dictionary2); + if (IsChoice) + { + dictionary.Add(MetamorphoseListParameter.isChoice.ToString(), 1); + } + if (IsFirstOnly) + { + dictionary.Add(MetamorphoseListParameter.isFirstOnly.ToString(), 1); + } + if (IsFusion) + { + dictionary.Add(MetamorphoseListParameter.isFusion.ToString(), 1); + } + return dictionary; + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.metamorphose.ToString(); + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + if (base.IndexList.Count == 0) + { + return false; + } + if (base.IndexList.All((int x) => lot.IndexList.Contains(x)) && IsSelf == lot.IsSelf) + { + return _skill == lot.Skill; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterOpenMyCards.cs b/SVSim.BattleEngine/Engine/RegisterOpenMyCards.cs new file mode 100644 index 0000000..7919a8a --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterOpenMyCards.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +public class RegisterOpenMyCards : RegisterActionBase +{ + private bool _notBuff; + + public RegisterOpenMyCards(List cards, bool notBuff = false) + { + for (int i = 0; i < cards.Count; i++) + { + base.IndexList.Add(cards[i].Index); + } + _notBuff = notBuff; + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = base.MakeSendData(); + if (_notBuff) + { + dictionary.Add(NetworkBattleDefine.NetworkParameter.notBuff.ToString(), 1); + } + dictionary.Remove(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.isSelf]); + return dictionary; + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.openMyCards.ToString(); + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterPlayerParameter.cs b/SVSim.BattleEngine/Engine/RegisterPlayerParameter.cs new file mode 100644 index 0000000..6446b9c --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterPlayerParameter.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; + +public class RegisterPlayerParameter : RegisterActionBase +{ + private ActionBaseParameter _param; + + private int _paramValue; + + public RegisterPlayerParameter(ActionBaseParameter param, int paramValue, bool self) + { + _param = param; + _paramValue = paramValue; + IsSelf = self; + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = base.MakeSendData(); + dictionary.Add(value: (_param == ActionBaseParameter.set || _param == ActionBaseParameter.cemetery || _param == ActionBaseParameter.maxPP) ? _paramValue : Math.Abs(_paramValue), key: _param.ToString()); + return dictionary; + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.playerParam.ToString(); + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterScan.cs b/SVSim.BattleEngine/Engine/RegisterScan.cs new file mode 100644 index 0000000..371d18a --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterScan.cs @@ -0,0 +1,505 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle; + +public class RegisterScan : RegisterValidate +{ + public enum ScanParameter + { + allow, + excludeIdxList + } + + public int AllowNum { get; private set; } + + public BattleCardBase ScanCard { get; private set; } + + public SkillBase ScanSkill { get; private set; } + + public RegisterScan(BattleCardBase card, SkillBase skill) + { + ScanCard = card; + ScanSkill = skill; + } + + public void SetScanTargetIndex(List beforeHandCard) + { + base.IndexList = new List(); + foreach (BattleCardBase item in beforeHandCard) + { + base.IndexList.Add(item.Index); + } + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.scan.ToString(); + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = base.MakeSendData(); + if (AllowNum >= 1) + { + dictionary.Add(ScanParameter.allow.ToString(), AllowNum); + } + return dictionary; + } + + public void SettingAllowCardNum(int num) + { + AllowNum = num; + } + + public bool IsSameScanData(RegisterScan checkScan) + { + List validateDataList = checkScan.GetValidateDataList(); + if (validateDataList.Count != ValidateDataList.Count) + { + return false; + } + if (checkScan.AllowNum != AllowNum) + { + return false; + } + for (int i = 0; i < validateDataList.Count; i++) + { + if (validateDataList[i].BaseCost != ValidateDataList[i].BaseCost || validateDataList[i].ChantCount != ValidateDataList[i].ChantCount || !validateDataList[i].CharaTypes.SequenceEqual(ValidateDataList[i].CharaTypes) || validateDataList[i].Clan != ValidateDataList[i].Clan || !validateDataList[i].ExcludeList.SequenceEqual(ValidateDataList[i].ExcludeList) || !validateDataList[i].IncludeList.SequenceEqual(ValidateDataList[i].IncludeList) || validateDataList[i].NowCost != ValidateDataList[i].NowCost || validateDataList[i].Tribe != ValidateDataList[i].Tribe || validateDataList[i].NowAtk != ValidateDataList[i].NowAtk || validateDataList[i].BaseAtk != ValidateDataList[i].BaseAtk) + { + return false; + } + } + return true; + } + + public static void OrganizeScanData(SkillBase scanSkill, RegisterActionManager registerActionManager, NetworkBattleManagerBase battleMgr) + { + BattleCardBase playActionCardBase = registerActionManager.PlayActionCardBase; + if (playActionCardBase == null) + { + return; + } + List beforeOpponentHandCardList = registerActionManager.BeforeOpponentHandCardList; + if (beforeOpponentHandCardList == null) + { + return; + } + beforeOpponentHandCardList.Remove(playActionCardBase); + BattleCardBase.TransformInformation transformInfo = playActionCardBase.TransformInfo; + if (transformInfo.Type != BattleCardBase.TransformType.Metamorphose && transformInfo.OriginalCard != null) + { + beforeOpponentHandCardList.Remove(transformInfo.OriginalCard); + } + List list = new List(); + NetworkBattleReceiver.ReceiveData receiveData = battleMgr.networkBattleData.GetReceiveData(); + if (scanSkill.IsNeedCheckConditionOnScan() && !scanSkill.IsScanConditionOk) + { + return; + } + int num = 0; + if (scanSkill.ApplySelectFilter is SkillUserSelectFilter) + { + num++; + } + foreach (SkillBase skill in scanSkill.SkillPrm.ownerCard.Skills) + { + if (skill.IsScanConditionOk && NetworkBattleGenericTool.IsBurialRite(skill, notCheckPrevious: true)) + { + num++; + } + } + if (scanSkill is Skill_discard && RegisterSkillConditionCheck.IsSkillConditionCheck(scanSkill) && !RegisterSkillConditionCheck.DoesSkillUsePrivateCount(scanSkill)) + { + num++; + } + if (NetworkBattleGenericTool.GetOpposingCardObjTarget(battleMgr, receiveData.OpponentTargetDataList).Count < num && !receiveData.unapprovedList.Any()) + { + if (beforeOpponentHandCardList.Count <= 0 || (((NetworkBattleGenericTool.IsBurialRite(scanSkill) && scanSkill.IsScanConditionOk) || scanSkill is Skill_summon_card) && battleMgr.BattleEnemy.ClassAndInPlayCardList.Count >= 6)) + { + return; + } + RegisterScan registerScan = new RegisterScan(playActionCardBase, scanSkill); + registerScan.SetScanTargetIndex(beforeOpponentHandCardList); + registerScan.AddValidateData(scanSkill); + if (scanSkill.PreprocessList.Find((SkillPreprocessBase x) => x is SkillPreprocessBurialRite) != null) + { + int num2 = 0; + foreach (SkillBase skill2 in playActionCardBase.Skills) + { + if (skill2.PreprocessList.Find((SkillPreprocessBase x) => x is SkillPreprocessBurialRite) != null) + { + num2++; + } + } + if (num2 >= 2) + { + registerScan.SettingAllowCardNum(num2 - 1); + } + } + if (list.Count >= 1) + { + bool flag = false; + foreach (RegisterScan item in list) + { + if (item.IsSameScanData(registerScan)) + { + flag = true; + } + } + if (flag) + { + return; + } + } + list.Add(registerScan); + } + List registerDataList = registerActionManager.RegisterDataList; + if (list.Count == 0) + { + return; + } + foreach (RegisterScan item2 in list) + { + int num3 = 0; + using (IEnumerator enumerator = item2.ScanCard.Skills.GetEnumerator()) + { + while (enumerator.MoveNext() && enumerator.Current != item2.ScanSkill) + { + num3++; + } + } + if (battleMgr.LethalPublishedActiveSkillCount != -1 && NetworkBattleGenericTool.GetPublishSkillCount(item2.ScanSkill) > battleMgr.LethalPublishedActiveSkillCount && battleMgr.LethalMovementCount == 1) + { + break; + } + int num4 = 0; + int num5 = 0; + foreach (SkillBase skill3 in item2.ScanCard.Skills) + { + if (num4 + 1 == num3) + { + bool flag2 = false; + foreach (RegisterActionBase item3 in registerDataList) + { + if (item3.EffectSkillPublicCount == NetworkBattleGenericTool.GetPublishSkillCount(skill3) && item3.EffectSkillMovement == 0) + { + flag2 = true; + } + else if (flag2) + { + break; + } + num5++; + } + break; + } + if (num4 - 1 == num3) + { + foreach (RegisterActionBase item4 in registerDataList) + { + if (item4.EffectSkillPublicCount == NetworkBattleGenericTool.GetPublishSkillCount(skill3) && item4.EffectSkillMovement == 0) + { + break; + } + num5++; + } + } + num4++; + } + registerDataList.Insert(num5, item2); + } + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + return false; + } + + public static void OrganizeScanDataOnSkillStart(SkillBase scanSkill, RegisterActionManager registerActionManager, NetworkBattleManagerBase battleMgr, List cards) + { + BattleCardBase playActionCardBase = registerActionManager.PlayActionCardBase; + if (playActionCardBase == null) + { + return; + } + NetworkBattleReceiver.ReceiveData receiveData = battleMgr.networkBattleData.GetReceiveData(); + if (!receiveData.unapprovedList.Any() || receiveData.unapprovedList.Any((CardDataModel u) => u.Index == -99) || battleMgr.GetBattlePlayer(playActionCardBase.IsPlayer).HandCardList.Count + cards.Count >= 9) + { + return; + } + if (cards == null || cards.Count == 0) + { + string empty = string.Empty; + empty = empty + "skillIdx" + scanSkill.PublishedActiveSkillCount; + empty += " uList"; + for (int num = 0; num < receiveData.unapprovedList.Count; num++) + { + empty = empty + receiveData.unapprovedList[num].Index + " "; + } + empty += " deck"; + List deckCardList = scanSkill.SkillPrm.ownerCard.SelfBattlePlayer.DeckCardList; + for (int num2 = 0; num2 < deckCardList.Count; num2++) + { + empty = empty + deckCardList[num2].Index + " "; + } + Debug.LogError(empty); + LocalLog.AccumulateTraceLog(empty); + } + else + { + RegisterScan registerScan = new RegisterScan(playActionCardBase, scanSkill); + registerScan.IndexList.Add(cards.Last().Index); + ValidateData validateData = new ValidateData(); + validateData.LibraryType.Add(1003); + registerScan.ValidateDataList.Add(validateData); + registerActionManager.RegisterDataList.Add(registerScan); + } + } + + public static void OrganizeNotSelectSkillScanData(SkillBase skill, RegisterActionManager registerActionManager, NetworkBattleManagerBase battleMgr, List cards) + { + SkillBase scanSkill = skill; + if (skill.ApplyingTargetFilter is SkillTargetLastTargetFilter) + { + scanSkill = skill.SkillPrm.ownerCard.Skills.ElementAt(skill.SkillPrm.ownerCard.Skills.IndexOf(skill) - 1); + } + BattleCardBase playActionCardBase = registerActionManager.PlayActionCardBase; + int num = scanSkill.ApplySelectFilter.CalcCount(scanSkill.OptionValue); + if ((scanSkill.ApplySelectFilter is SkillCostNoDuplicationRandomSelectFilter skillCostNoDuplicationRandomSelectFilter && skillCostNoDuplicationRandomSelectFilter.IsUpperLimit()) || (scanSkill.ApplySelectFilter is SkillIdNoDuplicationRandomSelectFilter skillIdNoDuplicationRandomSelectFilter && skillIdNoDuplicationRandomSelectFilter.IsUpperLimit())) + { + num += cards.Count; + } + if (RegisterTool.HasTargetOverCostFromFilter(scanSkill)) + { + num = scanSkill.SkillPrm.ownerCard.SelfBattlePlayer.SkillInfoLastTargets.First().Count(); + } + if (num == -1) + { + if (scanSkill.ApplyAndFilter.Count == 1) + { + num = scanSkill.ApplyAndFilter[0].SelectFilter.CalcCount(scanSkill.OptionValue); + } + else if (scanSkill.ApplyAndFilter.Count > 1) + { + for (int i = 0; i < scanSkill.ApplyFilterCollection.ApplyAndFilter.Count; i++) + { + OrganizeMultiFilterScanData(scanSkill, registerActionManager, cards, scanSkill.ApplyFilterCollection.ApplyAndFilter[i].CardFilterList); + } + return; + } + } + if (cards != null && cards.Count >= num) + { + return; + } + RegisterScan registerScan = new RegisterScan(playActionCardBase, scanSkill); + BattlePlayerBase battlePlayerBase = ((scanSkill.ApplyBattlePlayerFilter is SelfBattlePlayerFilter) ? scanSkill.SkillPrm.ownerCard.SelfBattlePlayer : scanSkill.SkillPrm.ownerCard.OpponentBattlePlayer); + if (scanSkill.ApplyingTargetFilter is SkillTargetHandFilter) + { + registerScan.IndexList.AddRange(battlePlayerBase.HandCardList.Select((BattleCardBase c) => c.Index)); + } + else + { + registerScan.IndexList.AddRange(battlePlayerBase.DeckCardList.Select((BattleCardBase c) => c.Index)); + } + if (scanSkill.ApplyFilterCollection.ApplyAndFilter.Count > 0) + { + for (int num2 = 0; num2 < scanSkill.ApplyFilterCollection.ApplyAndFilter.Count; num2++) + { + ValidateData validateData = registerScan.CreateValidateData(scanSkill.ApplyFilterCollection.ApplyAndFilter[num2].CardFilterList, scanSkill); + if (num > 1 && cards != null) + { + validateData.ExcludeIdxList.AddRange(cards.Select((BattleCardBase c) => c.Index)); + } + registerScan.OrValidateDataList.Add(validateData); + } + } + else + { + ValidateData validateData2 = registerScan.CreateValidateData(scanSkill.ApplyCardFilterList, scanSkill); + if (RegisterTool.HasTargetOverCostFromFilter(scanSkill)) + { + if (num > 0) + { + List unapprovedList = battleMgr.networkBattleData.GetReceiveData().unapprovedList; + NetworkExecutionInfoCreator networkExec = scanSkill._executionInfoCreator as NetworkExecutionInfoCreator; + CardDataModel unapprovedCard = unapprovedList.Find((CardDataModel x) => x.skillCardIndex == scanSkill.SkillPrm.ownerCard.Index && x.skillMovementNum == networkExec.GetSkillMovementNum() && x.publishedActiveSkillCount == scanSkill.PublishedActiveSkillCount); + List list = scanSkill.SkillPrm.ownerCard.SelfBattlePlayer.SkillInfoLastTargets.First().ToList(); + if (unapprovedCard != null) + { + list = list.Where((IReadOnlyBattleCardInfo c) => !unapprovedCard.skillKeyCardIdxList.Contains(c.Index)).ToList(); + } + string text = "gt"; + for (int num3 = 0; num3 < list.Count; num3++) + { + if (num3 > 0) + { + text += ","; + } + text += list[num3].Cost; + } + validateData2.NowCost = text; + } + } + else if (num > 1 && cards != null) + { + if (scanSkill.ApplySelectFilter is SkillCostNoDuplicationRandomSelectFilter) + { + string text2 = "ne"; + for (int num4 = 0; num4 < cards.Count; num4++) + { + if (num4 > 0) + { + text2 += ","; + } + text2 += cards[num4].LastCost; + } + validateData2.NowCost = text2; + } + else + { + validateData2.ExcludeIdxList.AddRange(cards.Select((BattleCardBase c) => c.Index)); + } + } + registerScan.ValidateDataList.Add(validateData2); + } + registerActionManager.RegisterDataList.Add(registerScan); + } + + public static void OrganizeSkillLastTargetTribeDrawScanData(SkillBase skill, RegisterActionManager registerActionManager, NetworkBattleManagerBase battleMgr, List cards) + { + BattleCardBase playActionCardBase = registerActionManager.PlayActionCardBase; + int num = -1; + for (int i = 0; i < skill.ApplyAndFilter.Count; i++) + { + num = skill.ApplyAndFilter[i].SelectFilter.CalcCount(skill.OptionValue); + } + if (cards == null || cards.Count < num) + { + battleMgr.networkBattleData.GetReceiveData(); + RegisterScan registerScan = new RegisterScan(playActionCardBase, skill); + BattlePlayerBase battlePlayerBase = ((skill.ApplyBattlePlayerFilter is SelfBattlePlayerFilter) ? skill.SkillPrm.ownerCard.SelfBattlePlayer : skill.SkillPrm.ownerCard.OpponentBattlePlayer); + registerScan.IndexList.AddRange(battlePlayerBase.DeckCardList.Select((BattleCardBase c) => c.Index)); + ValidateData validateData = new ValidateData(); + validateData.Tribe = "eqv1"; + registerScan.OrValidateDataList.Add(validateData); + registerActionManager.RegisterDataList.Add(registerScan); + } + } + + public static void OrganizeMultiFilterScanData(SkillBase skill, RegisterActionManager registerActionManager, List cards, List cardFilterList) + { + SkillParameterCostFilter skillParameterCostFilter = cardFilterList.First((ISkillCardFilter f) => f is SkillParameterCostFilter) as SkillParameterCostFilter; + int cost = skill.OptionValue.ParseInt(skillParameterCostFilter.GetParameterText()); + if (!cards.Any((BattleCardBase c) => c.LastCost == cost || c.LastCost == -1)) + { + RegisterScan registerScan = new RegisterScan(registerActionManager.PlayActionCardBase, skill); + BattlePlayerBase battlePlayerBase = ((skill.ApplyBattlePlayerFilter is SelfBattlePlayerFilter) ? skill.SkillPrm.ownerCard.SelfBattlePlayer : skill.SkillPrm.ownerCard.OpponentBattlePlayer); + registerScan.IndexList.AddRange(battlePlayerBase.DeckCardList.Select((BattleCardBase c) => c.Index)); + ValidateData item = registerScan.CreateValidateData(cardFilterList, skill); + registerScan.ValidateDataList.Add(item); + registerActionManager.RegisterDataList.Add(registerScan); + } + } + + public static bool IsScanSkill(SkillBase skill) + { + if (RegisterValidate.IsValidateCard(skill) && !(skill is Skill_fusion) && (!NetworkBattleGenericTool.IsTargetDeckSelf(skill) || !RegisterValidate.IsDeckParamVariable(skill)) && !RegisterValidate.IsDeckRandomEachSkill(skill) && !RegisterValidate.IsOpenMyHandSkill(skill) && !skill.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessReferencePrevious)) + { + return true; + } + if (skill is Skill_discard && RegisterSkillConditionCheck.IsSkillConditionCheck(skill) && !RegisterSkillConditionCheck.DoesSkillUsePrivateCount(skill)) + { + return true; + } + return false; + } + + public static bool IsNotSelectScanSkill(SkillBase skill) + { + if (skill.ApplyingTargetFilter is SkillTargetDeckSelfFilter) + { + return false; + } + if (skill.ApplySelectFilter is SkillUserSelectFilter) + { + return false; + } + if (skill.ApplyFilterCollection.ApplyAndFilter.Count > 0) + { + for (int i = 0; i < skill.ApplyFilterCollection.ApplyAndFilter.Count; i++) + { + if (IsScanDrawSkillFilter(skill.ApplyFilterCollection.ApplyAndFilter[i].CardFilterList)) + { + return true; + } + } + } + else if (IsScanDrawSkillFilter(skill.ApplyCardFilterList)) + { + return true; + } + return false; + } + + private static bool IsScanDrawSkillFilter(List cardFilterList) + { + for (int i = 0; i < cardFilterList.Count; i++) + { + ISkillCardFilter skillCardFilter = cardFilterList[i]; + if (skillCardFilter is SkillClanFilter) + { + return true; + } + if (skillCardFilter is SkillTribeFilter) + { + return true; + } + if (skillCardFilter is SkillParameterOffenseFilter || skillCardFilter is SkillParameterBaseOffenseFilter) + { + return true; + } + if (skillCardFilter is SkillParameterLifeFilter || skillCardFilter is SkillParameterBaseLifeFilter) + { + return true; + } + if (skillCardFilter is SkillParameterCostFilter || skillCardFilter is SkillParameterBaseCostFilter) + { + return true; + } + if (skillCardFilter is SkillParameterIdFilter) + { + return true; + } + if (skillCardFilter is SkillAbilitySpellChargeFilter || skillCardFilter is SkillAbilityDestroyWhiteRitualFilter || skillCardFilter is SkillAbilityWhenDestroyFilter || skillCardFilter is SkillAbilitySuperSkyboundArtFilter || skillCardFilter is SkillAbilityEnhanceFilter || skillCardFilter is SkillAbilityWhenPlayFilter || skillCardFilter is SkillAbilityAccelerateFilter || skillCardFilter is SkillAbilityCrystallizeFilter || skillCardFilter is SkillAbilityNecromanceFilter || skillCardFilter is SkillAbilityFusionFilter) + { + return true; + } + if (RegisterTool.GetCardTypeList(skillCardFilter).Count > 0) + { + return true; + } + } + return false; + } + + public static bool IsScanLastTargetTribeDrawSkill(SkillBase skill) + { + if (skill.ApplyFilterCollection.ApplyAndFilter.Count > 0) + { + for (int i = 0; i < skill.ApplyFilterCollection.ApplyAndFilter.Count; i++) + { + List cardFilterList = skill.ApplyFilterCollection.ApplyAndFilter[i].CardFilterList; + for (int j = 0; j < cardFilterList.Count; j++) + { + if (cardFilterList[j] is SkillLastTargetTribeFilter) + { + return true; + } + } + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterShortageDeckWin.cs b/SVSim.BattleEngine/Engine/RegisterShortageDeckWin.cs new file mode 100644 index 0000000..ca2d463 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterShortageDeckWin.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; + +public class RegisterShortageDeckWin : RegisterActionBase +{ + public int ExtraTurnNum { get; private set; } + + public RegisterShortageDeckWin(bool isSelf) + { + IsSelf = isSelf; + base.IndexList = null; + } + + public override Dictionary MakeSendData() + { + return base.MakeSendData(); + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.reverseDeckOut.ToString(); + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterSkillConditionCheck.cs b/SVSim.BattleEngine/Engine/RegisterSkillConditionCheck.cs new file mode 100644 index 0000000..36be0fe --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterSkillConditionCheck.cs @@ -0,0 +1,1466 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using Wizard.Battle; + +public class RegisterSkillConditionCheck : RegisterActionBase +{ + public enum SkillConditionType + { + NONE, + count, + count_check, + count_compare, + check_highlander, + callCount, + param, + moved_to_hand_count, + add_deck_count_check + } + + public enum SkillConditionParameter + { + target, + state, + skillTarget, + condition + } + + private class ConditionTargetDataListPair + { + public ConditionTargetDataList LhsConditionTargetDataList = new ConditionTargetDataList(); + + public ConditionTargetDataList RhsConditionTargetDataList = new ConditionTargetDataList(); + } + + private class ConditionTargetDataList + { + public List> IndexDataList = new List>(); + + public List> ClanDataList = new List>(); + + public List> TribeDataList = new List>(); + + public List> CharaTypeList = new List>(); + + public List> BaseCardIdList = new List>(); + + public List> ExcludeCardIdList = new List>(); + + public List> LibraryTypeList = new List>(); + + public List> DuplicationInfoList = new List>(); + + public List> BaseCostList = new List>(); + + public bool IsEmpty() + { + if (ClanDataList.Count == 0 && TribeDataList.Count == 0 && CharaTypeList.Count == 0 && BaseCardIdList.Count == 0 && ExcludeCardIdList.Count == 0 && LibraryTypeList.Count == 0 && DuplicationInfoList.Count == 0 && IndexDataList.Count == 0) + { + return BaseCostList.Count == 0; + } + return false; + } + } + + private int _skillIndex; + + private string _conditionVal = ""; + + private string _conditionCompare = ""; + + private int _placeState; + + private bool _containsField; + + private Dictionary _conditionList = new Dictionary(); + + private Dictionary _andFilter = new Dictionary(); + + private ConditionTargetDataListPair _conditionTargetDataListPair = new ConditionTargetDataListPair(); + + private bool _isPreprocess; + + private bool _isIncludeSelf; + + private bool _isExcludePlayIdx; + + private const string DECK_MSG = "deck"; + + private const string HAND_MSG = "hand"; + + private const string DISCARD_MSG = "discarded"; + + private const string DAMAGE_MSG = "damage"; + + private const string HEAL_MSG = "healing"; + + private const string ADD_OFFENSE_MSG = "add_offense"; + + private const string ADD_LIFE_MSG = "add_life"; + + private const string ADD_PP_MSG = "add_pp"; + + private const string REPEAT_COUNT_MG = "repeat_count"; + + private const string GAIN_COUNT_MSG = "gain_chant"; + + public const string HIGH_LANDER_MSG = "unique_base_card_id_card.count"; + + private const string UNIQUE_BASE_CARD_ID_CARD_MSG = "unique_base_card_id_card"; + + private const string EXCLUDE_TRIBE_MSG = "tribe!="; + + private static List DeckKeywordList = new List { SkillFilterCreator.ContentKeyword.deck }; + + private static List HandKeywordList = new List + { + SkillFilterCreator.ContentKeyword.hand, + SkillFilterCreator.ContentKeyword.hand_other_self, + SkillFilterCreator.ContentKeyword.hand_other_oldest + }; + + private static List PrivateKeywordList = new List + { + SkillFilterCreator.ContentKeyword.unit, + SkillFilterCreator.ContentKeyword.spell, + SkillFilterCreator.ContentKeyword.field, + SkillFilterCreator.ContentKeyword.tribe, + SkillFilterCreator.ContentKeyword.clan, + SkillFilterCreator.ContentKeyword.base_card_id, + SkillFilterCreator.ContentKeyword.ability, + SkillFilterCreator.ContentKeyword.play_card_type, + SkillFilterCreator.ContentKeyword.base_cost + }; + + private static List LastTargetKeywordList = new List { SkillFilterCreator.ContentKeyword.last_target }; + + private static List PrivateKeywordListInLastTarget = new List + { + SkillFilterCreator.ContentKeyword.tribe, + SkillFilterCreator.ContentKeyword.base_card_id, + SkillFilterCreator.ContentKeyword.clan + }; + + private static List PreprocessConditionKeywordList = new List + { + SkillFilterCreator.ContentKeyword.discarded_card, + SkillFilterCreator.ContentKeyword.hand_other_self, + SkillFilterCreator.ContentKeyword.hand_other_oldest, + SkillFilterCreator.ContentKeyword.deck + }; + + private static List PrivateKeywordListInPreprocessCondition = new List + { + SkillFilterCreator.ContentKeyword.unit, + SkillFilterCreator.ContentKeyword.spell, + SkillFilterCreator.ContentKeyword.field, + SkillFilterCreator.ContentKeyword.tribe, + SkillFilterCreator.ContentKeyword.clan, + SkillFilterCreator.ContentKeyword.base_cost + }; + + public SkillBase Skill { get; private set; } + + public int SkillPlayCardIndex { get; private set; } + + public int SkillPublishedCount { get; private set; } + + public bool IsInvoked { get; private set; } + + public SkillConditionType ConditionType { get; private set; } + + public int SkillTargetId { get; private set; } + + public List TargetCardIndexs { get; private set; } + + private RegisterSkillConditionCheck(int idx, int skillPublishedCount, SkillBase skill, bool isLastTargetDiscard = false, int skillIndex = -1, bool isLastTargetBanish = false) + { + IsSelf = skill.SkillPrm.ownerCard.IsPlayer; + Skill = skill; + SkillPlayCardIndex = idx; + SkillPublishedCount = skillPublishedCount; + IsInvoked = skill.IsInvoked; + if (IsDeckNumInvestigationSkill(skill)) + { + _placeState = 0; + } + if (IsHandNumInvestigationSkill(skill)) + { + _placeState = 10; + } + if (IsCemeteryInvestigationSkill(skill, isLastTargetDiscard)) + { + _placeState = 30; + } + if (isLastTargetBanish) + { + _placeState = 40; + } + if (IsGameDrawCardsNumInvestigationSkill(skill) || IsGameAddDeckCardsNumInvestigationSkill(skill) || IsSelectedCardSkillConditionCheck(skill)) + { + _placeState = 50; + } + _containsField = skill.IsRefVariable(SkillFilterCreator.ContentKeyword.inplay_and_hand.ToString()); + _skillIndex = skillIndex; + _isPreprocess = IsPreprocessConditionCheck(skill) || (DoesSkillUsePrivateCount(skill) && skill.OnSelfTurnEndStart == 0) || IsCemeteryInvestigationSkill(skill, isLastTargetDiscard) || isLastTargetBanish || IsInvokedCheckDeckSkill(skill); + _isIncludeSelf = skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter f) => f.Text.Contains("hand_self")); + _isExcludePlayIdx = skill.OnWhenPlayOtherStart != 0 && skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter f) => f.Text.Contains(SkillFilterCreator.ContentKeyword.hand.ToString()) && f.Text.Contains(SkillFilterCreator.ContentKeyword.base_card_id.ToString())); + } + + private void SetHighlander() + { + ConditionType = SkillConditionType.check_highlander; + int excludeCardId = GetExcludeCardId(Skill); + if (excludeCardId != -1) + { + List list = new List(); + list.Add(excludeCardId); + _conditionTargetDataListPair.LhsConditionTargetDataList.ExcludeCardIdList.Add(list); + } + List excludeTribe = GetExcludeTribe(Skill); + if (excludeTribe != null) + { + List list2 = new List(); + list2.AddRange(excludeTribe); + _conditionTargetDataListPair.LhsConditionTargetDataList.TribeDataList.Add(list2); + } + } + + private void SetPrivateCountCommon(SkillBase skill) + { + bool flag = DoesSkillCallCountUseSkillDrewCard(skill); + if (IsOptionDrew_cardTarget(skill) || flag || IsContainPreprocessLoadOrLastTarget(skill)) + { + _placeState = 50; + MakeSkillTargetId(skill); + TargetCardIndexs = new List(); + IEnumerable enumerable; + if (!IsContainPreprocessLoadTarget(skill)) + { + enumerable = skill.SkillDrewCards; + } + else + { + IEnumerable enumerable2 = skill.SkillPrm.ownerCard.SkillApplyInformation.LoadTargetList(); + enumerable = enumerable2; + } + IEnumerable enumerable3 = enumerable; + if (enumerable3 != null) + { + foreach (IReadOnlyBattleCardInfo item in enumerable3) + { + TargetCardIndexs.Add(item.Index); + } + } + } + ConditionType = SkillConditionType.count; + if (flag) + { + ConditionType = SkillConditionType.callCount; + } + } + + private void SetOther(SkillBase skill, IEnumerable targetCards, List selectCards, bool isLastTargetDiscard = false, bool isLastTargetBanish = false) + { + ConditionSkillFilterCollection conditionSkillFilterCollection = skill.ConditionFilterCollection; + if (conditionSkillFilterCollection.ConditionCheckerFilterList.Count > 0 && conditionSkillFilterCollection.ConditionCheckerFilterList.ElementAt(0) is NetworkSkillPreprocessConditionCheck) + { + conditionSkillFilterCollection = (conditionSkillFilterCollection.ConditionCheckerFilterList.ElementAt(0) as NetworkSkillPreprocessConditionCheck).GetConditionSkillFilterCollection(); + } + MakeConditionData(conditionSkillFilterCollection.VariableCompareFilter, skill); + for (int i = 0; i < conditionSkillFilterCollection.AnyConditionFilter.Count; i++) + { + SkillAnyConditionFilter skillAnyConditionFilter = conditionSkillFilterCollection.AnyConditionFilter[i]; + for (int j = 0; j < skillAnyConditionFilter.Filters.Count; j++) + { + MakeConditionData(skillAnyConditionFilter.Filters[j].VariableCompareFilter, skill); + } + } + bool flag = skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter x) => WithdrawnIncludedContentKeyword(x.Text, SkillFilterCreator.ContentKeyword.hand_other_oldest) != ""); + BattleCardBase battleCardBase = skill.SkillPrm.ownerCard.SelfBattlePlayer.HandCardList.FirstOrDefault((BattleCardBase c) => c != skill.SkillPrm.ownerCard); + if ((IsCemeteryInvestigationSkill(skill, isLastTargetDiscard) || isLastTargetBanish) && targetCards != null) + { + List list = new List(); + for (int num = 0; num < targetCards.Count(); num++) + { + BattleCardBase battleCardBase2 = targetCards.ElementAt(num); + list.Add(battleCardBase2.Index); + } + _conditionTargetDataListPair.LhsConditionTargetDataList.IndexDataList.Add(list); + } + else if (flag && battleCardBase != null) + { + List list2 = new List(); + list2.Add(battleCardBase.Index); + _conditionTargetDataListPair.LhsConditionTargetDataList.IndexDataList.Add(list2); + } + else if (IsSelectedCardSkillConditionCheck(skill) && selectCards != null) + { + List list3 = new List(); + for (int num2 = 0; num2 < selectCards.Count(); num2++) + { + SkillConditionCheckerOption.SkillAndSelectTarget skillAndSelectTarget = selectCards[num2]; + list3.Add(skillAndSelectTarget.SelectCard.Index); + } + _conditionTargetDataListPair.LhsConditionTargetDataList.IndexDataList.Add(list3); + } + } + + private void MakeConditionData(List variableCompareFilter, SkillBase skill) + { + List targetFilter = variableCompareFilter.Where((SkillVariableComareFilter f) => IsContainPrivateKeyword(f.Text) || IsContainPrivateKeywordInLastTarget(f.Text) || (IsSelectedCardSkillConditionCheck(skill) && IsContainSelectedTargetKeyword(f.Text))).ToList(); + if (skill.ConditionFilterCollection.ConditionCheckerFilterList.FirstOrDefault() is NetworkSkillPreprocessConditionCheck networkSkillPreprocessConditionCheck) + { + targetFilter.AddRange(networkSkillPreprocessConditionCheck.GetConditionSkillFilterCollection().VariableCompareFilter.Where((SkillVariableComareFilter f) => !targetFilter.Contains(f) && IsContainPrivatePreprocessConditionText(f.Text, skill))); + } + for (int num = 0; num < targetFilter.Count; num++) + { + SkillVariableComareFilter skillVariableComareFilter = targetFilter[num]; + int result = 0; + bool flag = false; + if (MakeConditionDataToReturnIsAdd(skillVariableComareFilter.Lhs, isLeft: true, skill)) + { + flag = true; + } + if (int.TryParse(skillVariableComareFilter.Rhs, out result)) + { + _conditionVal = result.ToString(); + ConditionType = SkillConditionType.count_check; + if (HasGameDrawCardsText(skillVariableComareFilter.Text)) + { + ConditionType = SkillConditionType.moved_to_hand_count; + } + if (HasGameAddDeckCardsText(skillVariableComareFilter.Text)) + { + ConditionType = SkillConditionType.add_deck_count_check; + } + } + else + { + ConditionType = SkillConditionType.count_compare; + if (MakeConditionDataToReturnIsAdd(skillVariableComareFilter.Rhs, isLeft: false, skill)) + { + flag = true; + } + } + if (flag) + { + _conditionCompare = skillVariableComareFilter.Compare; + } + } + } + + private static List CreatePrivateCountList(int idx, int skillPublishedCount, SkillBase skill) + { + if (skill is Skill_damage) + { + RegisterSkillConditionCheck registerSkillConditionCheck = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck.SetPrivateCountCommon(skill); + string option = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.damage); + registerSkillConditionCheck.RegisterFromOptionValue(option); + return new List { registerSkillConditionCheck }; + } + if (skill is Skill_powerup) + { + string option2 = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.add_offense, "NONE"); + string option3 = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.add_life, "NONE"); + List list = new List(); + if (option2 != "NONE") + { + RegisterSkillConditionCheck registerSkillConditionCheck2 = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck2.SetPrivateCountCommon(skill); + registerSkillConditionCheck2.RegisterFromOptionValue(option2); + list.Add(registerSkillConditionCheck2); + } + if (option3 != "NONE") + { + RegisterSkillConditionCheck registerSkillConditionCheck3 = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck3.SetPrivateCountCommon(skill); + registerSkillConditionCheck3.RegisterFromOptionValue(option3); + list.Add(registerSkillConditionCheck3); + } + return list; + } + if (skill is Skill_summon_token) + { + RegisterSkillConditionCheck registerSkillConditionCheck4 = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck4.SetPrivateCountCommon(skill); + string option4 = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.repeat_count); + registerSkillConditionCheck4.RegisterFromOptionValue(option4); + return new List { registerSkillConditionCheck4 }; + } + if (skill is Skill_heal) + { + RegisterSkillConditionCheck registerSkillConditionCheck5 = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck5.SetPrivateCountCommon(skill); + string option5 = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.healing); + registerSkillConditionCheck5.RegisterFromOptionValue(option5); + return new List { registerSkillConditionCheck5 }; + } + if (skill is Skill_pp_modifier) + { + RegisterSkillConditionCheck registerSkillConditionCheck6 = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck6.SetPrivateCountCommon(skill); + string option6 = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.add_pp); + registerSkillConditionCheck6.RegisterFromOptionValue(option6); + return new List { registerSkillConditionCheck6 }; + } + if (skill is Skill_chant_count_change) + { + RegisterSkillConditionCheck registerSkillConditionCheck7 = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck7.SetPrivateCountCommon(skill); + string option7 = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.gain_chant); + registerSkillConditionCheck7.RegisterFromOptionValue(option7); + return new List { registerSkillConditionCheck7 }; + } + return null; + } + + private static List CreatePreprocessPrivateCountList(int idx, int skillPublishedCount, SkillBase skill) + { + RegisterSkillConditionCheck registerSkillConditionCheck = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck.SetPrivateCountCommon(skill); + for (int i = 0; i < skill.PreprocessList.Count; i++) + { + registerSkillConditionCheck.RegisterFromOptionValue((skill.PreprocessList[i] as SkillPreprocessConditionCheck).ConditionText); + } + return new List { registerSkillConditionCheck }; + } + + private static List CreatePrivateParameterList(int idx, int skillPublishedCount, SkillBase skill, List selectCards) + { + if (skill is Skill_damage) + { + RegisterSkillConditionCheck registerSkillConditionCheck = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck.ConditionType = SkillConditionType.param; + string option = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.damage); + registerSkillConditionCheck.RegisterConditionFromOptionValue(option); + registerSkillConditionCheck.RegisterFromOptionValue(option); + return new List { registerSkillConditionCheck }; + } + if (skill is Skill_powerup) + { + List list = new List(); + string option2 = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.add_offense, "NONE"); + string option3 = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.add_life, "NONE"); + if (option2 != "NONE") + { + RegisterSkillConditionCheck registerSkillConditionCheck2 = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck2.ConditionType = SkillConditionType.param; + string option4 = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.add_offense); + registerSkillConditionCheck2.RegisterConditionFromOptionValue(option4); + registerSkillConditionCheck2.RegisterFromOptionValue(option4); + if (!registerSkillConditionCheck2.RegisterDiscardInfo(selectCards, option4) || selectCards.Count > 0) + { + list.Add(registerSkillConditionCheck2); + } + } + if (option3 != "NONE") + { + RegisterSkillConditionCheck registerSkillConditionCheck3 = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck3.ConditionType = SkillConditionType.param; + string option5 = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.add_life); + registerSkillConditionCheck3.RegisterConditionFromOptionValue(option5); + registerSkillConditionCheck3.RegisterFromOptionValue(option5); + if (!registerSkillConditionCheck3.RegisterDiscardInfo(selectCards, option5) || selectCards.Count > 0) + { + list.Add(registerSkillConditionCheck3); + } + } + return list; + } + return null; + } + + public static List CreateList(int idx, int skillPublishedCount, SkillBase skill, List selectCards, List processSkillList, List registerDataList, IEnumerable targetCards = null, bool isLastTargetDiscard = false, bool isLastTargetBanish = false) + { + if (IsHighlander(skill.ConditionFilterCollection) || IsHighlanderPreprocessConditionCheck(skill)) + { + if ((from d in registerDataList + where d is RegisterSkillConditionCheck + select d as RegisterSkillConditionCheck).Any((RegisterSkillConditionCheck c) => c.SkillPlayCardIndex == idx && c.SkillPublishedCount == skillPublishedCount && c.Skill == skill && c.ConditionType == SkillConditionType.check_highlander)) + { + return new List(); + } + RegisterSkillConditionCheck registerSkillConditionCheck = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck.SetHighlander(); + return new List { registerSkillConditionCheck }; + } + if (DoesSkillUsePrivateCount(skill) || IsOptionDrew_cardTarget(skill)) + { + bool num = DoesSkillCallCountUseSkillDrewCard(skill); + bool flag = IsNotCheckCount(skill); + if (num) + { + RegisterSkillConditionCheck registerSkillConditionCheck2 = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill); + registerSkillConditionCheck2.SetPrivateCountCommon(skill); + registerSkillConditionCheck2.RegisterFromOptionValue(skill.CallCountText); + return new List { registerSkillConditionCheck2 }; + } + if (flag) + { + return CreatePrivateParameterList(idx, skillPublishedCount, skill, selectCards); + } + return CreatePrivateCountList(idx, skillPublishedCount, skill); + } + if (IsContainPreprocessLoadOrLastTarget(skill)) + { + return CreatePreprocessPrivateCountList(idx, skillPublishedCount, skill); + } + if ((RegisterValidate.IsSendOpenMyCardsSkill(skill) && skill.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessRemoveAfterAction)) || skill.SkillPrm.ownerCard.BaseParameter.BaseCardId == 120341020) + { + int num2 = skill.SkillPrm.ownerCard.Skills.IndexOf(skill); + num2 += processSkillList.Count((SkillBase s) => RegisterValidate.IsSendOpenMyCardsSkill(s) && s.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessRemoveAfterAction) && s.SkillPrm.ownerCard == skill.SkillPrm.ownerCard); + RegisterSkillConditionCheck registerSkillConditionCheck3 = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill, isLastTargetDiscard, num2, isLastTargetBanish); + registerSkillConditionCheck3.SetOther(skill, targetCards, selectCards, isLastTargetDiscard, isLastTargetBanish); + return new List { registerSkillConditionCheck3 }; + } + RegisterSkillConditionCheck registerSkillConditionCheck4 = new RegisterSkillConditionCheck(idx, skillPublishedCount, skill, isLastTargetDiscard, -1, isLastTargetBanish); + registerSkillConditionCheck4.SetOther(skill, targetCards, selectCards, isLastTargetDiscard, isLastTargetBanish); + return new List { registerSkillConditionCheck4 }; + } + + private void RegisterFromOptionValue(string optionValueText) + { + string[] array = optionValueText.Split('.'); + _andFilter = new Dictionary(); + for (int i = 0; i < array.Length; i++) + { + string text = array[i]; + string text2 = ""; + bool flag = text.Contains("!="); + if (flag) + { + text2 = "ne"; + } + if (text.Contains(SkillFilterCreator.ContentKeyword.tribe.ToString())) + { + List list = new List(); + if (_andFilter.ContainsKey(SkillFilterCreator.ContentKeyword.tribe.ToString())) + { + List list2 = _andFilter[SkillFilterCreator.ContentKeyword.tribe.ToString()] as List; + for (int j = 0; j < list2.Count; j++) + { + list.Add(list2[j]); + } + _andFilter.Remove(SkillFilterCreator.ContentKeyword.tribe.ToString()); + } + List list3 = CardBasePrm.CreateTribeTypeList(text, isTribeCheck: true, flag); + for (int k = 0; k < list3.Count; k++) + { + int num = (int)list3[k]; + if (flag) + { + list.Add(text2 + num); + } + else + { + list.Add(num.ToString()); + } + } + _andFilter.Add(ActionBaseParameter.tribe.ToString(), list); + } + if (text.Contains(SkillFilterCreator.ContentKeyword.clan.ToString())) + { + text = text.Replace("self", ""); + int clanType = (int)CardBasePrm.GetClanType(text); + object value = ((!flag) ? ((object)clanType) : (text2 + clanType)); + _andFilter.Add(ActionBaseParameter.clan.ToString(), value); + } + if (text.Contains(SkillFilterCreator.ContentKeyword.spell_and_field.ToString())) + { + object value2 = ((!flag) ? ("ne" + 1) : ((object)1)); + _andFilter.Add(ActionBaseParameter.charType.ToString(), value2); + } + else if (text.Contains(SkillFilterCreator.ContentKeyword.unit.ToString())) + { + object obj = null; + obj = ((!flag) ? ((object)1) : (text2 + 1)); + _andFilter.Add(ActionBaseParameter.charType.ToString(), obj); + } + else if (text.Contains(SkillFilterCreator.ContentKeyword.field.ToString())) + { + List list4 = new List(); + if (flag) + { + list4.Add(text2 + 2); + list4.Add(text2 + 3); + } + else + { + list4.Add(2); + list4.Add(3); + } + _andFilter.Add(ActionBaseParameter.charType.ToString(), list4); + } + else if (text.Contains(SkillFilterCreator.ContentKeyword.spell.ToString())) + { + object obj2 = null; + obj2 = ((!flag) ? ((object)4) : (text2 + 4)); + _andFilter.Add(ActionBaseParameter.charType.ToString(), obj2); + } + if (text.Contains(SkillFilterCreator.ContentKeyword.base_card_id.ToString())) + { + int num2 = int.Parse(Regex.Match(text, "\\d+").Value); + object value3 = ((!flag) ? ((object)num2) : (text2 + num2)); + _andFilter.Add(ActionBaseParameter.baseCardId.ToString(), value3); + } + if (text.Contains(SkillFilterCreator.ContentKeyword.cost.ToString()) && !text.Contains(SkillFilterCreator.ContentKeyword.base_cost.ToString())) + { + int num3 = int.Parse(Regex.Match(text, "\\d+").Value); + if (text.Contains(">=")) + { + text2 = "ge"; + } + object value4 = text2 + num3; + _andFilter.Add(ActionBaseParameter.cost.ToString(), value4); + } + if (text.Contains(SkillFilterCreator.ContentKeyword.base_cost.ToString()) && (text.Contains(">=") || text.Contains("<="))) + { + int num4 = int.Parse(Regex.Match(text, "\\d+").Value); + bool num5 = text.Contains(">="); + bool flag2 = text.Contains("<="); + if (num5) + { + text2 = "ge"; + } + else if (flag2) + { + text2 = "le"; + } + object value5 = text2 + num4; + _andFilter.Add(ActionBaseParameter.baseCost.ToString(), value5); + } + } + } + + public bool RegisterDiscardInfo(List selectCards, string optionValueText) + { + string[] array = optionValueText.Split('.'); + if (_andFilter == null) + { + _andFilter = new Dictionary(); + } + for (int i = 0; i < array.Length; i++) + { + if (!array[i].Contains(SkillFilterCreator.ContentKeyword.discarded_card.ToString())) + { + continue; + } + for (int j = 0; j < selectCards.Count; j++) + { + if (selectCards[j].SelectSkill is Skill_discard) + { + _andFilter.Add(ActionBaseParameter.idx.ToString(), selectCards[j].SelectCard.Index); + break; + } + } + return true; + } + return false; + } + + private void RegisterConditionFromOptionValue(string optionValueText) + { + if (optionValueText.Contains(SkillFilterCreator.ContentKeyword.offense.ToString())) + { + string key = ActionBaseParameter.atk.ToString(); + if (optionValueText.Contains(SkillFilterCreator.ContentKeyword.max.ToString())) + { + _conditionList.Add(key, SkillFilterCreator.ContentKeyword.max.ToString()); + } + } + else if (optionValueText.Contains(SkillFilterCreator.ContentKeyword.base_cost.ToString())) + { + string key2 = ActionBaseParameter.baseCost.ToString(); + _conditionList.Add(key2, SkillFilterCreator.ContentKeyword.max.ToString()); + } + } + + private bool MakeConditionDataToReturnIsAdd(string data, bool isLeft, SkillBase skill) + { + ConditionTargetDataList conditionTargetDataList = (isLeft ? _conditionTargetDataListPair.LhsConditionTargetDataList : _conditionTargetDataListPair.RhsConditionTargetDataList); + bool flag = false; + string text = WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.clan, isContains: true); + if (text != "") + { + List list = new List(); + list.Add((int)CardBasePrm.GetClanType(text)); + conditionTargetDataList.ClanDataList.Add(list); + flag = true; + } + if (WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.tribe, isContains: true) != "") + { + List list2 = new List(); + bool flag2 = data.Contains(SkillFilterCreator.ContentKeyword.tribe.ToString() + "!="); + List list3 = CardBasePrm.CreateTribeTypeList(data, isTribeCheck: true, flag2); + for (int i = 0; i < list3.Count; i++) + { + int num = (int)list3[i]; + if (flag2) + { + list2.Add("ne" + num); + } + else + { + list2.Add(num); + } + } + conditionTargetDataList.TribeDataList.Add(list2); + flag = true; + } + List list4 = new List(); + if (!list4.Contains(2) && (WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.hand_other_self, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.hand_other_oldest, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.hand, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.discarded_card, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.selected_cards, isContains: true) != "") && WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.field, isContains: true) != "") + { + list4.Add(2); + list4.Add(3); + conditionTargetDataList.CharaTypeList.Add(list4); + flag = true; + } + if (!list4.Contains(1) && (WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.hand_other_self, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.hand_other_oldest, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.hand, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.deck, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.discarded_card, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.selected_cards, isContains: true) != "") && WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.unit, isContains: true) != "") + { + list4.Add(1); + conditionTargetDataList.CharaTypeList.Add(list4); + flag = true; + } + if (!list4.Contains(4)) + { + string text2 = data.Replace("spell_charge", ""); + if ((WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.hand, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.hand_other_self, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.hand_other_oldest, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.discarded_card, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.selected_cards, isContains: true) != "") && WithdrawnIncludedContentKeyword(text2, SkillFilterCreator.ContentKeyword.spell, isContains: true) != "") + { + list4.Add(4); + conditionTargetDataList.CharaTypeList.Add(list4); + flag = true; + } + } + string text3 = WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.play_card_type, isContains: true); + if ((WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.hand, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.hand_other_self, isContains: true) != "" || WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.hand_other_oldest, isContains: true) != "") && text3 != "") + { + string[] array = text3.Split('='); + string option = ((array.Length > 1) ? array[1] : ""); + IEnumerable playCardList = new SkillPlayCardTypeFilter(skill.SkillPrm.ownerCard, option).GetPlayCardList(); + bool flag3 = playCardList.Any((IReadOnlyBattleCardInfo c) => c.IsUnit); + bool flag4 = playCardList.Any((IReadOnlyBattleCardInfo c) => c.IsSpell); + bool flag5 = playCardList.Any((IReadOnlyBattleCardInfo c) => c.IsField || c.IsChantField); + if (!list4.Contains(1) && flag3) + { + list4.Add(1); + conditionTargetDataList.CharaTypeList.Add(list4); + flag = true; + } + if (!list4.Contains(4) && flag4) + { + list4.Add(4); + conditionTargetDataList.CharaTypeList.Add(list4); + flag = true; + } + if (!list4.Contains(2) && flag5) + { + list4.Add(2); + list4.Add(3); + conditionTargetDataList.CharaTypeList.Add(list4); + flag = true; + } + } + string text4 = WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.spell_charge, isContains: true); + if (text4 != "") + { + List list5 = new List(); + list5.Add(text4.Contains("!=") ? 2004 : 1003); + conditionTargetDataList.LibraryTypeList.Add(list5); + flag = true; + } + if (WithdrawnIncludedContentKeyword(data, SkillFilterCreator.ContentKeyword.unique_base_card_id_card, isContains: true) != "") + { + List list6 = new List(); + list6.Add("cardId"); + conditionTargetDataList.DuplicationInfoList.Add(list6); + flag = true; + } + string text5 = WithdrawnIncludedContentKeyword(data, new List { SkillFilterCreator.ContentKeyword.base_card_id }, isContains: true); + if (text5 != "") + { + string text6 = text5; + if (text6.Contains("!=")) + { + flag = true; + text6 = text6.Replace(SkillFilterCreator.ContentKeyword.base_card_id.ToString() + "!=", ""); + if (flag) + { + List list7 = new List(); + list7.Add(int.Parse(text6)); + conditionTargetDataList.ExcludeCardIdList.Add(list7); + } + } + else if (text6.Contains("=")) + { + flag = true; + text6 = text6.Replace(SkillFilterCreator.ContentKeyword.base_card_id.ToString() + "=", ""); + if (flag) + { + List list8 = new List(); + list8.Add(int.Parse(text6)); + conditionTargetDataList.BaseCardIdList.Add(list8); + } + } + } + string text7 = WithdrawnIncludedContentKeyword(data, new List { SkillFilterCreator.ContentKeyword.base_cost }, isContains: true); + if (text7 != string.Empty) + { + if (text7.Contains(">=")) + { + flag = true; + text7 = RegisterTool.MakeParameterOptionText(">=") + text7.Replace(SkillFilterCreator.ContentKeyword.base_cost.ToString() + ">=", ""); + conditionTargetDataList.BaseCostList.Add(new List { text7 }); + } + else if (text7.Contains("<=")) + { + flag = true; + text7 = RegisterTool.MakeParameterOptionText("<=") + text7.Replace(SkillFilterCreator.ContentKeyword.base_cost.ToString() + "<=", ""); + conditionTargetDataList.BaseCostList.Add(new List { text7 }); + } + else if (text7.Contains("=")) + { + flag = true; + text7 = text7.Replace(SkillFilterCreator.ContentKeyword.base_cost.ToString() + "=", ""); + if (conditionTargetDataList.BaseCostList.Count == 0) + { + conditionTargetDataList.BaseCostList.Add(new List { int.Parse(text7) }); + } + else + { + conditionTargetDataList.BaseCostList.LastOrDefault().Add(int.Parse(text7)); + } + } + } + return flag; + } + + private void MakeSkillTargetId(SkillBase skill) + { + BattleCardBase ownerCard = skill.SkillPrm.ownerCard; + int num = (ownerCard.IsPlayer ? 1 : 0); + int index = ownerCard.Index; + int num2 = skill.SkillPrm.ownerCard.Skills.ToList().IndexOf(skill); + NetworkExecutionInfoCreator networkExecutionInfoCreator = skill._executionInfoCreator as NetworkExecutionInfoCreator; + int num3 = 0; + if (networkExecutionInfoCreator != null) + { + num3 = networkExecutionInfoCreator.GetSkillMovementNum(); + } + SkillTargetId = num * 10000 + index * 100 + num2 * 10 + num3; + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(ActionBaseParameter.idx.ToString(), SkillPlayCardIndex); + int num = Skill.SkillPrm.ownerCard.Skills.IndexOf(Skill); + if (num == -1) + { + num = Skill.SkillPrm.ownerCard.NormalSkills.IndexOf(Skill); + } + if (_skillIndex != -1) + { + num = _skillIndex; + } + dictionary.Add(ActionBaseParameter.skillIdx.ToString(), num); + dictionary.Add(ActionBaseParameter.skillCount.ToString(), SkillPublishedCount); + dictionary.Add(ActionBaseParameter.type.ToString(), ConditionType.ToString()); + int expectCount = ((NetworkStandardBattleMgr)BattleManagerBase.GetIns()).GetExpectCount(SkillPublishedCount); + if (!IsSelf && expectCount != -1) + { + dictionary.Add(ActionBaseParameter.expect.ToString(), expectCount); + } + List> targetDataList = new List>(); + if (_andFilter.Count == 0) + { + if (!_conditionTargetDataListPair.LhsConditionTargetDataList.IsEmpty()) + { + targetDataList.Add(MakeTargetData(_conditionTargetDataListPair.LhsConditionTargetDataList)); + } + if (!_conditionTargetDataListPair.RhsConditionTargetDataList.IsEmpty()) + { + targetDataList.Add(MakeTargetData(_conditionTargetDataListPair.RhsConditionTargetDataList)); + } + if (targetDataList.Count == 0 && ConditionType == SkillConditionType.check_highlander) + { + SettingTargetStateOnCheckHighlander(ref targetDataList); + } + } + else + { + SettingAndTargetDataToList(ref targetDataList, _andFilter); + } + if (targetDataList.Count >= 1) + { + dictionary.Add(SkillConditionParameter.target.ToString(), targetDataList); + } + if (_conditionCompare != "" || _conditionVal != "") + { + dictionary.Add(SkillConditionParameter.condition.ToString(), RegisterTool.MakeParameterOptionText(_conditionCompare) + _conditionVal); + } + if (_conditionList.Count > 0) + { + dictionary.Add(SkillConditionParameter.condition.ToString(), _conditionList); + } + if (IsInvoked) + { + dictionary.Add(ActionBaseParameter.isInvoke.ToString(), 1); + } + if (_isPreprocess) + { + dictionary.Add(ActionBaseParameter.isPreprocess.ToString(), 1); + } + if (_isIncludeSelf) + { + dictionary.Add(ActionBaseParameter.isIncludeSelf.ToString(), 1); + } + if (_isExcludePlayIdx) + { + dictionary.Add(ActionBaseParameter.isExcludePlayIdx.ToString(), 1); + } + return dictionary; + } + + private Dictionary MakeTargetData(ConditionTargetDataList conditionTargetDataList) + { + List> targetDataList = new List>(); + SettingTargetDataToList(ref targetDataList, conditionTargetDataList.ClanDataList, ActionBaseParameter.clan); + SettingTargetDataToList(ref targetDataList, conditionTargetDataList.TribeDataList, ActionBaseParameter.tribe); + SettingTargetDataToList(ref targetDataList, conditionTargetDataList.CharaTypeList, ActionBaseParameter.charType); + SettingTargetDataToList(ref targetDataList, conditionTargetDataList.BaseCardIdList, ActionBaseParameter.baseCardId); + SettingTargetDataToList(ref targetDataList, conditionTargetDataList.ExcludeCardIdList, ActionBaseParameter.excludeList); + SettingTargetDataToList(ref targetDataList, conditionTargetDataList.LibraryTypeList, ActionBaseParameter.libraryType); + SettingTargetDataToList(ref targetDataList, conditionTargetDataList.DuplicationInfoList, ActionBaseParameter.duplication); + SettingTargetDataToList(ref targetDataList, conditionTargetDataList.IndexDataList, ActionBaseParameter.idx); + SettingTargetDataToList(ref targetDataList, conditionTargetDataList.BaseCostList, ActionBaseParameter.baseCost); + Dictionary dictionary = new Dictionary(); + for (int i = 0; i < targetDataList.Count; i++) + { + dictionary = (from c in dictionary.Concat(targetDataList[i]) + group c by c.Key).ToDictionary((IGrouping> c) => c.Key, (IGrouping> c) => c.FirstOrDefault().Value); + } + return dictionary; + } + + private void SettingTargetDataToList(ref List> targetDataList, List> dataList, ActionBaseParameter actionBaseParameter) + { + if (dataList.Count == 0) + { + return; + } + foreach (List data in dataList) + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(actionBaseParameter.ToString(), data); + if (_placeState != 50) + { + dictionary.Add(SkillConditionParameter.state.ToString(), _placeState); + } + if (SkillTargetId != 0) + { + dictionary.Add(SkillConditionParameter.skillTarget.ToString(), SkillTargetId.ToString()); + } + targetDataList.Add(dictionary); + } + } + + private void SettingAndTargetDataToList(ref List> targetDataList, Dictionary dataList) + { + if (dataList.Count == 0) + { + return; + } + Dictionary dictionary = new Dictionary(); + foreach (string key in dataList.Keys) + { + if (typeof(List).IsAssignableFrom(dataList[key].GetType())) + { + dictionary.Add(key, dataList[key]); + continue; + } + dictionary.Add(key, new List { dataList[key] }); + } + if (_placeState != 50) + { + if (_containsField) + { + List list = new List { _placeState }; + list.Add(20); + dictionary.Add(SkillConditionParameter.state.ToString(), list); + } + else + { + dictionary.Add(SkillConditionParameter.state.ToString(), _placeState); + } + } + if (SkillTargetId != 0) + { + dictionary.Add(SkillConditionParameter.skillTarget.ToString(), SkillTargetId.ToString()); + } + targetDataList.Add(dictionary); + } + + private void SettingTargetStateOnCheckHighlander(ref List> targetDataList) + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(SkillConditionParameter.state.ToString(), _placeState); + targetDataList.Add(dictionary); + } + + public static bool IsSkillConditionCheck(SkillBase skill, bool isNotHandCheck = false, bool isNotDeckCheck = false) + { + if (skill.IsDeckSelfSkill || RegisterValidate.IsValidateCard(skill)) + { + return false; + } + if (skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter f) => IsContainPrivateKeyword(f.Text, isNotHandCheck, isNotDeckCheck))) + { + return true; + } + if (skill.ConditionFilterCollection.AnyConditionFilter.Any((SkillAnyConditionFilter f) => IsContainPrivateKeyword(f.Text, isNotHandCheck, isNotDeckCheck))) + { + return true; + } + if (!DoesSkillUsePrivateCount(skill, isNotHandCheck, isNotDeckCheck)) + { + return false; + } + return true; + } + + public static bool IsSelectedCardSkillConditionCheck(SkillBase skill) + { + if ((skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter f) => IsContainSelectedTargetKeyword(f.Text)) || skill.ConditionFilterCollection.AnyConditionFilter.Any((SkillAnyConditionFilter f) => IsContainSelectedTargetKeyword(f.Text))) && (skill.SkillPrm.ownerCard.BaseParameter.BaseCardId == 930344070 || skill.SkillPrm.ownerCard.BaseParameter.BaseCardId == 930444050)) + { + return true; + } + return false; + } + + private static bool IsContainPrivateKeyword(string text, bool isIgnoreHand = false, bool isIgnoreDeck = false) + { + if (!isIgnoreHand && WithdrawnIncludedContentKeyword(text, HandKeywordList) != string.Empty && WithdrawnIncludedContentKeyword(text, PrivateKeywordList, isContains: true) != string.Empty) + { + return true; + } + if (!isIgnoreDeck && WithdrawnIncludedContentKeyword(text, DeckKeywordList) != string.Empty && WithdrawnIncludedContentKeyword(text, PrivateKeywordList, isContains: true) != string.Empty) + { + return true; + } + if (HasGameDrawCardsText(text)) + { + return true; + } + if (HasGameAddDeckCardsText(text)) + { + return true; + } + return false; + } + + private static bool IsContainSelectedTargetKeyword(string text) + { + if (WithdrawnIncludedContentKeyword(text, SkillFilterCreator.ContentKeyword.selected_cards) != string.Empty && WithdrawnIncludedContentKeyword(text, PrivateKeywordList, isContains: true) != string.Empty) + { + return true; + } + return false; + } + + public static bool CheckLastTargetFilter(SkillBase skill) + { + return skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter f) => IsContainPrivateKeywordInLastTarget(f.Text)); + } + + public static bool IsContainPrivateKeywordInLastTarget(string text) + { + if (WithdrawnIncludedContentKeyword(text, LastTargetKeywordList) != string.Empty) + { + return WithdrawnIncludedContentKeyword(text, PrivateKeywordListInLastTarget, isContains: true) != string.Empty; + } + return false; + } + + public static bool IsPreprocessConditionCheck(SkillBase skill) + { + ConditionSkillFilterCollection conditionFilterCollection = skill.ConditionFilterCollection; + if (conditionFilterCollection.ConditionCheckerFilterList.Count < 1 || !(conditionFilterCollection.ConditionCheckerFilterList.ElementAt(0) is NetworkSkillPreprocessConditionCheck)) + { + return false; + } + if (RegisterValidate.IsValidateCard(skill)) + { + return false; + } + if (IsPreprocessConditionCheck((conditionFilterCollection.ConditionCheckerFilterList.ElementAt(0) as NetworkSkillPreprocessConditionCheck).GetConditionSkillFilterCollection(), skill)) + { + return true; + } + return false; + } + + public static bool IsPreprocessConditionCheck(ConditionSkillFilterCollection filter, SkillBase skill) + { + return filter.VariableCompareFilter.Any((SkillVariableComareFilter f) => IsContainPrivatePreprocessConditionText(f.Text, skill)); + } + + public static bool IsContainPrivatePreprocessConditionText(string text, SkillBase skill) + { + if (WithdrawnIncludedContentKeyword(text, PreprocessConditionKeywordList) != string.Empty && WithdrawnIncludedContentKeyword(text, PrivateKeywordListInPreprocessCondition, isContains: true) != string.Empty) + { + return true; + } + if (WithdrawnIncludedContentKeyword(text, SkillFilterCreator.ContentKeyword.load_target) != string.Empty) + { + if (skill.OnBeforeAttackStart != 0) + { + return false; + } + if (skill.SkillPrm.ownerCard.Skills.Where((SkillBase x) => x.OptionValue.HasInfoByName(SkillFilterCreator.ContentKeyword.save_target)).Any((SkillBase x) => NetworkBattleGenericTool.IsUnapprovedTarget(x) || x is Skill_return_card)) + { + return true; + } + } + if (WithdrawnIncludedContentKeyword(text, SkillFilterCreator.ContentKeyword.skill_drew_card, isContains: true) != string.Empty && WithdrawnIncludedContentKeyword(text, SkillFilterCreator.ContentKeyword.base_cost, isContains: true) != string.Empty) + { + return true; + } + if (HasGameDrawCardsText(text)) + { + return true; + } + return false; + } + + private static string WithdrawnIncludedContentKeyword(string text, SkillFilterCreator.ContentKeyword keywords, bool isContains = false) + { + return WithdrawnIncludedContentKeyword(text, new List { keywords }, isContains); + } + + private static string WithdrawnIncludedContentKeyword(string text, List keywords, bool isContains = false) + { + foreach (string item in (IEnumerable)text.Split('.')) + { + foreach (SkillFilterCreator.ContentKeyword keyword in keywords) + { + if (item == keyword.ToString()) + { + return item; + } + if (isContains && item.Contains(keyword.ToString())) + { + return item; + } + } + } + return ""; + } + + private static bool IsDeckNumInvestigationSkill(SkillBase skill) + { + if (skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter x) => WithdrawnIncludedContentKeyword(x.Text, SkillFilterCreator.ContentKeyword.deck) != "") || skill.IsRefVariable(SkillFilterCreator.ContentKeyword.deck.ToString())) + { + return true; + } + return false; + } + + private static bool IsHandNumInvestigationSkill(SkillBase skill) + { + if (skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter x) => WithdrawnIncludedContentKeyword(x.Text, SkillFilterCreator.ContentKeyword.hand) != "") || skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter x) => WithdrawnIncludedContentKeyword(x.Text, SkillFilterCreator.ContentKeyword.hand_other_self) != "") || skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter x) => WithdrawnIncludedContentKeyword(x.Text, SkillFilterCreator.ContentKeyword.hand_other_oldest) != "") || skill.IsRefVariable(SkillFilterCreator.ContentKeyword.hand.ToString())) + { + return true; + } + if (skill.ConditionFilterCollection.ConditionCheckerFilterList.Count == 0) + { + return false; + } + if (!(skill.ConditionFilterCollection.ConditionCheckerFilterList.ElementAt(0) is NetworkSkillPreprocessConditionCheck networkSkillPreprocessConditionCheck)) + { + return false; + } + ConditionSkillFilterCollection conditionSkillFilterCollection = networkSkillPreprocessConditionCheck.GetConditionSkillFilterCollection(); + List keywords = new List + { + SkillFilterCreator.ContentKeyword.hand_other_self, + SkillFilterCreator.ContentKeyword.hand_other_oldest + }; + for (int num = 0; num < conditionSkillFilterCollection.VariableCompareFilter.Count(); num++) + { + if (WithdrawnIncludedContentKeyword(conditionSkillFilterCollection.VariableCompareFilter.ElementAt(num).Text, keywords) != string.Empty) + { + return true; + } + } + return false; + } + + private static bool IsCemeteryInvestigationSkill(SkillBase skill, bool isLastTargetDiscard) + { + if (isLastTargetDiscard) + { + if (skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter x) => WithdrawnIncludedContentKeyword(x.Text, SkillFilterCreator.ContentKeyword.last_target) != "") || skill.IsRefVariable(SkillFilterCreator.ContentKeyword.last_target.ToString())) + { + return true; + } + return false; + } + if (skill.IsRefVariable(SkillFilterCreator.ContentKeyword.discarded_card.ToString())) + { + return true; + } + if (skill.ConditionFilterCollection.ConditionCheckerFilterList.Count == 0) + { + return false; + } + if (!(skill.ConditionFilterCollection.ConditionCheckerFilterList.ElementAt(0) is NetworkSkillPreprocessConditionCheck networkSkillPreprocessConditionCheck)) + { + return false; + } + ConditionSkillFilterCollection conditionSkillFilterCollection = networkSkillPreprocessConditionCheck.GetConditionSkillFilterCollection(); + List keywords = new List { SkillFilterCreator.ContentKeyword.discarded_card }; + for (int num = 0; num < conditionSkillFilterCollection.VariableCompareFilter.Count(); num++) + { + if (WithdrawnIncludedContentKeyword(conditionSkillFilterCollection.VariableCompareFilter.ElementAt(num).Text, keywords) != string.Empty && WithdrawnIncludedContentKeyword(conditionSkillFilterCollection.VariableCompareFilter.ElementAt(num).Text, PrivateKeywordListInPreprocessCondition, isContains: true) != string.Empty) + { + return true; + } + } + return false; + } + + private bool IsGameDrawCardsNumInvestigationSkill(SkillBase skill) + { + if (skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter x) => HasGameDrawCardsText(x.Text))) + { + return true; + } + if (skill.ConditionFilterCollection.ConditionCheckerFilterList.Count == 0) + { + return false; + } + if (!(skill.ConditionFilterCollection.ConditionCheckerFilterList.ElementAt(0) is NetworkSkillPreprocessConditionCheck networkSkillPreprocessConditionCheck)) + { + return false; + } + ConditionSkillFilterCollection conditionSkillFilterCollection = networkSkillPreprocessConditionCheck.GetConditionSkillFilterCollection(); + for (int num = 0; num < conditionSkillFilterCollection.VariableCompareFilter.Count(); num++) + { + if (HasGameDrawCardsText(conditionSkillFilterCollection.VariableCompareFilter.ElementAt(num).Text)) + { + return true; + } + } + return false; + } + + private static bool HasGameDrawCardsText(string text) + { + if (WithdrawnIncludedContentKeyword(text, SkillFilterCreator.ContentKeyword.game_draw_cards) != string.Empty && text.Contains(SkillFilterCreator.ContentKeyword.base_card_id.ToString())) + { + return true; + } + return false; + } + + public static bool IsGameAddDeckCardsNumInvestigationSkill(SkillBase skill) + { + return skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter x) => HasGameAddDeckCardsText(x.Text)); + } + + private static bool HasGameAddDeckCardsText(string text) + { + if (WithdrawnIncludedContentKeyword(text, SkillFilterCreator.ContentKeyword.game_add_update_deck_cards) != string.Empty) + { + if (!text.Contains(SkillFilterCreator.ContentKeyword.base_card_id.ToString())) + { + return text.Contains(SkillFilterCreator.ContentKeyword.tribe.ToString()); + } + return true; + } + return false; + } + + public static bool DoesSkillUsePrivateCount(SkillBase skill, bool notHandCheck = false, bool notDeckCheck = false) + { + if (skill is Skill_attach_skill) + { + return false; + } + if (DoesSkillCallCountUseSkillDrewCard(skill) && Regex.IsMatch(skill.CallCountText, SkillFilterCreator.ContentKeyword.spell_and_field.ToString())) + { + return true; + } + string[] array = skill.Option.Split('+'); + for (int i = 0; i < array.Count(); i++) + { + bool flag = Regex.IsMatch(array[i], SkillFilterCreator.ContentKeyword.skill_drew_card.ToString()); + bool flag2 = Regex.IsMatch(array[i], "discarded"); + bool flag3 = false; + if (notDeckCheck && !notHandCheck) + { + flag3 = Regex.IsMatch(array[i], "hand"); + } + else if (notHandCheck && !notDeckCheck) + { + flag3 = Regex.IsMatch(array[i], "deck"); + } + else if (!notDeckCheck && !notHandCheck) + { + flag3 = Regex.IsMatch(array[i], "hand") || Regex.IsMatch(array[i], "deck"); + } + if (flag3 || flag || flag2) + { + bool num = Regex.IsMatch(array[i], SkillFilterCreator.ContentKeyword.clan.ToString()) || Regex.IsMatch(array[i], SkillFilterCreator.ContentKeyword.tribe.ToString()) || Regex.IsMatch(array[i], SkillFilterCreator.ContentKeyword.base_card_id.ToString()) || Regex.IsMatch(array[i], SkillFilterCreator.ContentKeyword.unit.ToString()) || Regex.IsMatch(array[i], SkillFilterCreator.ContentKeyword.spell.ToString()) || Regex.IsMatch(array[i], SkillFilterCreator.ContentKeyword.field.ToString()) || Regex.IsMatch(array[i], SkillFilterCreator.ContentKeyword.base_cost.ToString()); + bool flag4 = Regex.IsMatch(array[i], "damage") || Regex.IsMatch(array[i], "healing") || Regex.IsMatch(array[i], "add_offense") || Regex.IsMatch(array[i], "add_life") || Regex.IsMatch(array[i], "add_pp") || Regex.IsMatch(array[i], "repeat_count") || Regex.IsMatch(array[i], "gain_chant"); + if (num && flag4) + { + return true; + } + } + } + return false; + } + + public static bool IsHighlander(ConditionSkillFilterCollection conditionSkillFilterCollection) + { + if (conditionSkillFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter x) => x.Text.Contains("unique_base_card_id_card.count") && x.Rhs.Contains("{"))) + { + return true; + } + return false; + } + + public static bool IsHighlanderPreprocessConditionCheck(SkillBase skill) + { + ConditionSkillFilterCollection conditionFilterCollection = skill.ConditionFilterCollection; + if (conditionFilterCollection.ConditionCheckerFilterList.Count < 1 || !(conditionFilterCollection.ConditionCheckerFilterList.ElementAt(0) is NetworkSkillPreprocessConditionCheck)) + { + return false; + } + return IsHighlander((conditionFilterCollection.ConditionCheckerFilterList.ElementAt(0) as NetworkSkillPreprocessConditionCheck).GetConditionSkillFilterCollection()); + } + + private int GetExcludeCardId(SkillBase skill) + { + for (int i = 0; i < skill.ConditionFilterCollection.VariableCompareFilter.Count; i++) + { + if (!skill.ConditionFilterCollection.VariableCompareFilter[i].Text.Contains("unique_base_card_id_card.count")) + { + continue; + } + int num = skill.ConditionFilterCollection.VariableCompareFilter[i].Text.IndexOf("unique_base_card_id_card"); + if (num != -1 && num >= 10) + { + int result = -1; + if (int.TryParse(skill.ConditionFilterCollection.VariableCompareFilter[i].Text.Substring(num - 10, 9), out result)) + { + return result; + } + } + } + return -1; + } + + private List GetExcludeTribe(SkillBase skill) + { + for (int i = 0; i < skill.ConditionFilterCollection.VariableCompareFilter.Count; i++) + { + string text = skill.ConditionFilterCollection.VariableCompareFilter[i].Text; + if (!text.Contains("unique_base_card_id_card.count")) + { + continue; + } + bool num = text.Contains("unique_base_card_id_card"); + bool flag = text.Contains("tribe!="); + if (num && flag) + { + List list = new List(); + List list2 = CardBasePrm.CreateTribeTypeList(text, isTribeCheck: true, notEqual: true); + for (int j = 0; j < list2.Count; j++) + { + list.Add("ne" + (int)list2[j]); + } + return list; + } + } + return null; + } + + private static bool IsOptionDrew_cardTarget(SkillBase skill) + { + if (skill is Skill_attach_skill) + { + return false; + } + if (skill.IsRefVariable("skill_drew_card")) + { + return true; + } + return false; + } + + private static bool IsNotCheckCount(SkillBase skill) + { + return !skill.IsRefVariable(SkillFilterCreator.ContentKeyword.count.ToString()); + } + + public static bool DoesSkillCallCountUseSkillDrewCard(SkillBase skill) + { + return Regex.IsMatch(skill.CallCountText, "skill_drew_card"); + } + + public static bool IsContainPreprocessLoadTarget(SkillBase skill) + { + return skill.PreprocessList.Where((SkillPreprocessBase x) => x is SkillPreprocessConditionCheck).Any((SkillPreprocessBase x) => (x as SkillPreprocessConditionCheck).Contains(SkillFilterCreator.ContentKeyword.load_target.ToString())); + } + + public static bool IsContainPreprocessLoadOrLastTarget(SkillBase skill) + { + return skill.PreprocessList.Where((SkillPreprocessBase x) => x is SkillPreprocessConditionCheck).Any((SkillPreprocessBase x) => (x as SkillPreprocessConditionCheck).Contains(SkillFilterCreator.ContentKeyword.load_target.ToString()) || (x as SkillPreprocessConditionCheck).Contains(SkillFilterCreator.ContentKeyword.last_target.ToString())); + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.skillConditionCheck.ToString(); + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + return false; + } + + public static int GetMovementCount(SkillBase skill) + { + if (DoesSkillUsePrivateCount(skill) && skill is Skill_powerup) + { + int num = 0; + string option = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.add_offense, "NONE"); + string option2 = skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.add_life, "NONE"); + if (option != "NONE") + { + num++; + } + if (option2 != "NONE") + { + num++; + } + return num; + } + return 1; + } + + private bool IsInvokedCheckDeckSkill(SkillBase skill) + { + if (!skill.IsInvoked) + { + return false; + } + List tribeKeywordList = new List { SkillFilterCreator.ContentKeyword.tribe }; + List costKeywordList = new List { SkillFilterCreator.ContentKeyword.cost }; + return skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter f) => WithdrawnIncludedContentKeyword(f.Text, DeckKeywordList) != string.Empty && WithdrawnIncludedContentKeyword(f.Text, tribeKeywordList, isContains: true) != string.Empty && WithdrawnIncludedContentKeyword(f.Text, costKeywordList, isContains: true) != string.Empty); + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterSpecialWin.cs b/SVSim.BattleEngine/Engine/RegisterSpecialWin.cs new file mode 100644 index 0000000..c042fef --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterSpecialWin.cs @@ -0,0 +1,17 @@ +public class RegisterSpecialWin : RegisterActionBase +{ + public RegisterSpecialWin(bool isSelf) + { + IsSelf = isSelf; + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.specialWin.ToString(); + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterStateChangeCard.cs b/SVSim.BattleEngine/Engine/RegisterStateChangeCard.cs new file mode 100644 index 0000000..a0fba79 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterStateChangeCard.cs @@ -0,0 +1,115 @@ +using System.Collections.Generic; +using System.Linq; + +public class RegisterStateChangeCard : RegisterActionBase +{ + public List SkillTargetList = new List(); + + public BattleCardBase StateCard { get; private set; } + + public NetworkBattleDefine.NetworkCardPlaceState FromPlaceState { get; private set; } + + public NetworkBattleDefine.NetworkCardPlaceState ToPlaceState { get; private set; } + + public List OpenCardIndexList { get; private set; } + + public bool IsOpen { get; private set; } + + public bool IsWhenDraw { get; private set; } + + public bool IsFlood { get; private set; } + + public SkillBase Skill { get; private set; } + + public List HasGuardList { get; private set; } + + public RegisterStateChangeCard(BattleCardBase Card, NetworkBattleDefine.NetworkCardPlaceState from, NetworkBattleDefine.NetworkCardPlaceState to, SkillBase skill, bool isOpen = false, bool isFlood = false, bool isWhenDraw = false, bool hasGuard = false) + { + StateCard = Card; + FromPlaceState = from; + ToPlaceState = to; + Skill = skill; + IsOpen = isOpen; + IsFlood = isFlood; + base.IndexList = new List(); + OpenCardIndexList = new List(); + HasGuardList = new List(); + IsWhenDraw = isWhenDraw; + if (StateCard != null) + { + base.IndexList.Add(StateCard.Index); + IsSelf = StateCard.IsPlayer; + if (hasGuard && !IsFlood && FromPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Field && ToPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Cemetery) + { + HasGuardList.Add(StateCard.Index); + } + } + if (IsOpen) + { + OpenCardIndexList.Add(0); + } + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = base.MakeSendData(); + dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.from], (int)FromPlaceState); + dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.to], (int)ToPlaceState); + if (OpenCardIndexList.Count > 0) + { + dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.is_open], OpenCardIndexList); + } + if (SkillTargetList.Count > 0) + { + dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.skillTarget], SkillTargetList); + } + if (IsFlood) + { + dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.isFlood], 1); + } + if (HasGuardList.Count > 0) + { + dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.hasGuard], HasGuardList); + } + if (FromPlaceState == NetworkBattleDefine.NetworkCardPlaceState.None && ToPlaceState == NetworkBattleDefine.NetworkCardPlaceState.Deck && Skill is Skill_update_deck && Skill.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.player_side, SkillFilterCreator.ContentKeyword.me.ToStringCustom()) == "op") + { + dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.byOppo], 1); + } + return dictionary; + } + + public void SetOpenIfWhenDraw() + { + if (!IsOpen && IsWhenDraw && ((StateCard.FinalMetamorphoseCard == null) ? StateCard : StateCard.FinalMetamorphoseCard).Skills.Any((SkillBase s) => s.OnWhenDraw != 0 && s.IsScanConditionOk)) + { + IsOpen = true; + OpenCardIndexList.Add(0); + } + } + + public void AddOpenCardIndex(int index) + { + if (!OpenCardIndexList.Contains(index)) + { + OpenCardIndexList.Add(index); + } + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.move.ToString(); + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + if (base.IndexList.Count == 0) + { + return false; + } + if (base.IndexList.All((int x) => lot.IndexList.Contains(x)) && IsSelf == lot.IsSelf) + { + return Skill == lot.Skill; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterTool.cs b/SVSim.BattleEngine/Engine/RegisterTool.cs new file mode 100644 index 0000000..aa00a93 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterTool.cs @@ -0,0 +1,279 @@ +using System.Collections.Generic; +using System.Linq; + +public class RegisterTool +{ + public enum OrderListParameter + { + add, + move, + metamorphose, + alter, + trigger, + target, + playerParam, + exTurn, + specialWin, + deckOut, + validate, + evolution, + skillConditionCheck, + scan, + playEnhance, + reverseDeckOut, + playCount, + extract, + count, + openMyCards + } + + private const string GREATER_THAN = "gt"; + + private const string LESS_THAN = "lt"; + + public const string GREATER_THAN_OR_EQUAL = "ge"; + + public const string LESS_THAN_OR_EQUAL = "le"; + + public const string EQUAL = "eq"; + + public const string NOT_EQUAL = "ne"; + + public static string MakeCostFromSkillDestroyed(BattleManagerBase mgr, bool isPlayer, int destroyCount, CardDataModel unapprovedCard) + { + if (unapprovedCard == null || GameMgr.GetIns().IsWatchBattle) + { + return ""; + } + return "gt" + NetworkBattleGenericTool.GetIndexToCardBase(mgr, mgr.GetBattlePlayer(isPlayer), unapprovedCard.skillKeyCardIdxList[destroyCount]).Cost; + } + + public static string MakeParameterOptionText(string text) + { + switch (text) + { + case "=": + return "eq"; + case "!=": + return "ne"; + case "<=": + case "<:=": + return "le"; + case ">=": + case ">:=": + return "ge"; + case "<": + case "<:": + return "lt"; + case ">": + case ">:": + return "gt"; + default: + return string.Empty; + } + } + + public static List MakeParameterOptionTextList(string text) + { + List list = new List(); + list.Add(MakeParameterOptionText(text)); + switch (text) + { + case "<:": + case ">:": + case "<:=": + case ">:=": + list.Add("max"); + break; + } + return list; + } + + public static bool IsSkillRandom(SkillBase skill) + { + if (skill.ApplyAndFilter.Count > 0) + { + for (int i = 0; i < skill.ApplyAndFilter.Count; i++) + { + ApplySkillTargetFilterCollection applySkillTargetFilterCollection = skill.ApplyAndFilter[i]; + if (IsRandomSelectFilter(applySkillTargetFilterCollection.SelectFilter) || HasRandomCustomSelectFilter(applySkillTargetFilterCollection.ApplyCustomSelectFilterList)) + { + return true; + } + } + } + if (IsRandomSelectFilter(skill.ApplySelectFilter) || HasRandomCustomSelectFilter(skill.ApplyCustomSelectFilterList)) + { + return true; + } + return false; + } + + private static bool IsRandomSelectFilter(ISkillSelectFilter skillSelectFilter) + { + if (!(skillSelectFilter is SkillRandomSelectFilter) && !(skillSelectFilter is SkillRandomSelectUntilFilter) && !(skillSelectFilter is SkillIdNoDuplicationRandomSelectFilter) && !(skillSelectFilter is SkillCostNoDuplicationRandomSelectFilter)) + { + return skillSelectFilter is SkillRandomEachSameBaseCardIdFilter; + } + return true; + } + + private static bool HasRandomCustomSelectFilter(List customSelectFilterList) + { + for (int i = 0; i < customSelectFilterList.Count; i++) + { + if (IsRamdomCustomSelectFilter(customSelectFilterList[i])) + { + return true; + } + } + return false; + } + + private static bool IsRamdomCustomSelectFilter(ISkillCustomSelectFilter customSelectFilter) + { + return customSelectFilter is SkillTargetOverCostFromLastTargetFilter; + } + + public static bool HasTargetOverCostFromFilter(SkillBase skill) + { + if (skill.ApplyCustomSelectFilterList != null && skill.ApplyCustomSelectFilterList.Any((ISkillCustomSelectFilter x) => x is SkillTargetOverCostFromLastTargetFilter)) + { + return true; + } + return false; + } + + public static bool IsSkillFilterEffect(SkillBase skill) + { + if (skill.ApplyCardFilterList.Count == 1 && skill.ApplyCardFilterList.First() is SkillAllCardFilter) + { + return false; + } + return true; + } + + public static List GetCardTypeList(ISkillCardFilter cardFilter) + { + List list = new List(); + if (cardFilter is SkillUnitFilter) + { + list.Add(RegisterActionBase.CARD_TYPE.FOLLOWER); + } + if (cardFilter is SkillSpellFilter) + { + list.Add(RegisterActionBase.CARD_TYPE.SPELL); + } + if (cardFilter is SkillFieldFilter) + { + list.Add(RegisterActionBase.CARD_TYPE.NOT_COUNT_AMULET); + list.Add(RegisterActionBase.CARD_TYPE.COUNT_AMULET); + } + if (cardFilter is SkillChantFieldFilter) + { + list.Add(RegisterActionBase.CARD_TYPE.COUNT_AMULET); + } + if (cardFilter is SkillNotChantFieldFilter) + { + list.Add(RegisterActionBase.CARD_TYPE.NOT_COUNT_AMULET); + } + if (cardFilter is SkillUnitAndAllFieldFilter) + { + list.Add(RegisterActionBase.CARD_TYPE.FOLLOWER); + list.Add(RegisterActionBase.CARD_TYPE.NOT_COUNT_AMULET); + list.Add(RegisterActionBase.CARD_TYPE.COUNT_AMULET); + } + if (cardFilter is SkillSpellAndFieldFilter) + { + list.Add(RegisterActionBase.CARD_TYPE.SPELL); + list.Add(RegisterActionBase.CARD_TYPE.NOT_COUNT_AMULET); + list.Add(RegisterActionBase.CARD_TYPE.COUNT_AMULET); + } + return list; + } + + public static RegisterActionBase.SPECIAL_LIBRARY CalculationCardSkillType(ISkillCardFilter cardFilter, RegisterActionBase.CARD_TYPE CharaTypeList) + { + if (cardFilter is SkillAbilitySpellChargeFilter) + { + if ((cardFilter as SkillAbilitySpellChargeFilter).GetOptionParameter() != "!=") + { + if (CharaTypeList == RegisterActionBase.CARD_TYPE.SPELL) + { + return RegisterActionBase.SPECIAL_LIBRARY.SPELL_CHARGE_SPELL; + } + return RegisterActionBase.SPECIAL_LIBRARY.SPELL_CHARGE_ALL; + } + return RegisterActionBase.SPECIAL_LIBRARY.SPELL_NOT_SPELL_CHARGE; + } + if (cardFilter is SkillAbilityDestroyWhiteRitualFilter) + { + return RegisterActionBase.SPECIAL_LIBRARY.EARTH_RITUAL; + } + if (cardFilter is SkillAbilityWhiteRitualFilter) + { + return RegisterActionBase.SPECIAL_LIBRARY.EARTH_MARK; + } + if (cardFilter is SkillAbilityWhenDestroyFilter) + { + if (!(cardFilter as SkillAbilityWhenDestroyFilter).IsOperaterEqual()) + { + return RegisterActionBase.SPECIAL_LIBRARY.NOT_WHEN_DESTROY; + } + return RegisterActionBase.SPECIAL_LIBRARY.WHEN_DESTROY; + } + if (cardFilter is SkillAbilityUnionBurstFilter) + { + return RegisterActionBase.SPECIAL_LIBRARY.UNION_BURST; + } + if (cardFilter is SkillAbilitySuperSkyboundArtFilter) + { + return RegisterActionBase.SPECIAL_LIBRARY.SUPER_SKYBOUND_ART; + } + if (cardFilter is SkillAbilityWhenPlayFilter) + { + if ((cardFilter as SkillAbilityWhenPlayFilter).IsOperaterEqual()) + { + return RegisterActionBase.SPECIAL_LIBRARY.WHEN_PLAY; + } + return RegisterActionBase.SPECIAL_LIBRARY.NOT_WHEN_PLAY; + } + if (cardFilter is SkillAbilityEnhanceFilter) + { + return RegisterActionBase.SPECIAL_LIBRARY.ENHANCE; + } + if (cardFilter is SkillAbilityAccelerateFilter) + { + if (!(cardFilter as SkillAbilityAccelerateFilter).IsOperaterEqual()) + { + return RegisterActionBase.SPECIAL_LIBRARY.NOT_WHEN_ACCELERATE; + } + return RegisterActionBase.SPECIAL_LIBRARY.WHEN_ACCELERATE; + } + if (cardFilter is SkillAbilityCrystallizeFilter) + { + if (!(cardFilter as SkillAbilityCrystallizeFilter).IsOperaterEqual()) + { + return RegisterActionBase.SPECIAL_LIBRARY.NOT_WHEN_CRYSTALLIZE; + } + return RegisterActionBase.SPECIAL_LIBRARY.WHEN_CRYSTALLIZE; + } + if (cardFilter is SkillAbilityReanimateFilter) + { + return RegisterActionBase.SPECIAL_LIBRARY.REANIMATE; + } + if (cardFilter is SkillAbilityNecromanceFilter) + { + return RegisterActionBase.SPECIAL_LIBRARY.NECROMANCE; + } + if (cardFilter is SkillAbilityWhenEvolveFilter) + { + return RegisterActionBase.SPECIAL_LIBRARY.WHEN_EVOLVE; + } + if (cardFilter is SkillAbilityFusionFilter) + { + return RegisterActionBase.SPECIAL_LIBRARY.FUSION; + } + return RegisterActionBase.SPECIAL_LIBRARY.NONE; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterValidate.cs b/SVSim.BattleEngine/Engine/RegisterValidate.cs new file mode 100644 index 0000000..cf46356 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterValidate.cs @@ -0,0 +1,557 @@ +using System.Collections.Generic; +using System.Linq; + +public class RegisterValidate : RegisterActionBase +{ + public class ValidateData + { + public string NowCost; + + public string BaseCost; + + public string NowAtk; + + public string BaseAtk; + + public string NowLife; + + public string BaseLife; + + public List CharaTypes; + + public string Clan; + + public string Tribe; + + public string ChantCount; + + public List LibraryType; + + public List ExcludeList; + + public List IncludeList; + + public List State; + + public string SpellBoost; + + public List ExcludeIdxList; + + public ValidateData() + { + CharaTypes = new List(); + LibraryType = new List(); + ExcludeList = new List(); + IncludeList = new List(); + State = new List(); + ExcludeIdxList = new List(); + } + } + + public enum ValidateParamater + { + idx, + conditions, + nowCost, + baseCost, + nowAtk, + baseAtk, + nowLife, + baseLife, + clan, + tribe, + chant_count, + excludeList, + includeList, + spellboost, + state, + checkDuplicate, + checkParam + } + + protected List ValidateDataList = new List(); + + protected List OrValidateDataList = new List(); + + private bool _isCheckDuplicate; + + private bool _isCheckDeckParam; + + public void AddValidateData(SkillBase skill) + { + if (NetworkBattleGenericTool.IsBurialRite(skill)) + { + ValidateData validateData = new ValidateData(); + validateData.CharaTypes.Add(1); + ValidateDataList.Add(validateData); + } + else if (skill.ApplyFilterCollection.ApplyAndFilter.Count() > 0) + { + for (int i = 0; i < skill.ApplyFilterCollection.ApplyAndFilter.Count; i++) + { + OrValidateDataList.Add(CreateValidateData(skill.ApplyFilterCollection.ApplyAndFilter[i].CardFilterList, skill)); + } + } + else if (skill.IsRandomUntilDrawSkill) + { + ValidateData validateData2 = new ValidateData(); + validateData2.LibraryType.Add(1003); + ValidateDataList.Add(validateData2); + } + else if (NetworkBattleGenericTool.IsTargetDeckSelf(skill) && IsDeckParamVariable(skill)) + { + _isCheckDeckParam = true; + ValidateDataList.Add(CreateValidateDataForReferenceSelfStatus(skill)); + } + else + { + ValidateDataList.Add(CreateValidateData(skill.ApplyCardFilterList, skill)); + } + } + + public void SetCardIdValidateData(BattleCardBase card) + { + ValidateData validateData = new ValidateData(); + base.IndexList.Add(card.Index); + validateData.IncludeList.Add(card.BaseParameter.BaseCardId); + ValidateDataList.Add(validateData); + } + + public static bool IsDeckParamVariable(SkillBase skill) + { + return skill.PreprocessList.Where((SkillPreprocessBase x) => x is SkillPreprocessConditionCheck).Any((SkillPreprocessBase x) => (x as SkillPreprocessConditionCheck).Contains(SkillFilterCreator.ContentKeyword.deck.ToString()) && (x as SkillPreprocessConditionCheck).Contains(SkillFilterCreator.ContentKeyword.life.ToString())); + } + + protected ValidateData CreateValidateData(List cardFilterList, SkillBase skill) + { + ValidateData validateData = new ValidateData(); + List list = new List(); + foreach (ISkillCardFilter cardFilter in cardFilterList) + { + if (cardFilter is SkillParameterCostFilter skillParameterCostFilter) + { + string parameterText = skillParameterCostFilter.GetParameterText(); + if (parameterText.Contains(".max_pp") || (!parameterText.Contains(".max") && !parameterText.Contains(".min"))) + { + validateData.NowCost = RegisterTool.MakeParameterOptionTextList(skillParameterCostFilter.GetParameterOptionText())[0] + skill.OptionValue.ParseInt(parameterText); + } + } + else if (cardFilter is SkillParameterBaseCostFilter skillParameterBaseCostFilter) + { + string parameterText2 = skillParameterBaseCostFilter.GetParameterText(); + if (parameterText2.Contains(SkillFilterCreator.ContentKeyword.fixed_generic_value.ToString())) + { + validateData.BaseCost = RegisterTool.MakeParameterOptionTextList(skillParameterBaseCostFilter.GetParameterOptionText())[0] + "v1"; + } + else + { + validateData.BaseCost = RegisterTool.MakeParameterOptionTextList(skillParameterBaseCostFilter.GetParameterOptionText())[0] + skill.OptionValue.ParseInt(parameterText2); + } + } + if (cardFilter is SkillParameterOffenseFilter skillParameterOffenseFilter) + { + validateData.NowAtk = RegisterTool.MakeParameterOptionTextList(skillParameterOffenseFilter.GetParameterOptionText())[0] + skill.OptionValue.ParseInt(skillParameterOffenseFilter.GetParameterText()); + } + else if (cardFilter is SkillParameterBaseOffenseFilter skillParameterBaseOffenseFilter) + { + validateData.BaseAtk = RegisterTool.MakeParameterOptionTextList(skillParameterBaseOffenseFilter.GetParameterOptionText())[0] + skillParameterBaseOffenseFilter.GetParameterText(); + } + if (cardFilter is SkillParameterLifeFilter skillParameterLifeFilter) + { + validateData.NowLife = RegisterTool.MakeParameterOptionTextList(skillParameterLifeFilter.GetParameterOptionText())[0] + skillParameterLifeFilter.GetParameterText(); + } + else if (cardFilter is SkillParameterBaseLifeFilter skillParameterBaseLifeFilter) + { + validateData.BaseLife = RegisterTool.MakeParameterOptionTextList(skillParameterBaseLifeFilter.GetParameterOptionText())[0] + skillParameterBaseLifeFilter.GetParameterText(); + } + list.AddRange(RegisterTool.GetCardTypeList(cardFilter)); + if (cardFilter is SkillClanFilter) + { + SkillClanFilter skillClanFilter = cardFilter as SkillClanFilter; + validateData.Clan = RegisterTool.MakeParameterOptionTextList(skillClanFilter.OptionText)[0] + (int)skillClanFilter._clan; + } + if (cardFilter is SkillTribeFilter skillTribeFilter) + { + validateData.Tribe = (skillTribeFilter.IsEqual ? ((int)skillTribeFilter._type).ToString() : ("ne" + (int)skillTribeFilter._type)); + } + if (cardFilter is SkillParameterChantCountFilter) + { + SkillParameterChantCountFilter skillParameterChantCountFilter = cardFilter as SkillParameterChantCountFilter; + validateData.ChantCount = RegisterTool.MakeParameterOptionTextList(skillParameterChantCountFilter.GetParameterOptionText())[0] + skillParameterChantCountFilter.GetParameterText(); + } + SPECIAL_LIBRARY sPECIAL_LIBRARY = RegisterTool.CalculationCardSkillType(cardFilter, (list.Count >= 1) ? list[list.Count - 1] : CARD_TYPE.NON); + if (sPECIAL_LIBRARY != SPECIAL_LIBRARY.NONE) + { + validateData.LibraryType.Add((int)sPECIAL_LIBRARY); + } + if (cardFilter is SkillParameterChargeCountFilter) + { + validateData.LibraryType.Add(1003); + SkillParameterChargeCountFilter skillParameterChargeCountFilter = cardFilter as SkillParameterChargeCountFilter; + validateData.SpellBoost = RegisterTool.MakeParameterOptionTextList(skillParameterChargeCountFilter.Option)[0] + skillParameterChargeCountFilter.Parameter; + } + if (cardFilter is SkillParameterIdFilter) + { + SkillParameterIdFilter skillParameterIdFilter = cardFilter as SkillParameterIdFilter; + if (skillParameterIdFilter.GetOptionText() == "!=" || skillParameterIdFilter.GetOptionText() == "=") + { + string[] filterId = skillParameterIdFilter.GetFilterId(); + for (int i = 0; i < filterId.Length; i++) + { + int item = int.Parse(filterId[i]); + if (skillParameterIdFilter.GetOptionText() == "=") + { + validateData.IncludeList.Add(item); + } + else + { + validateData.ExcludeList.Add(item); + } + } + } + } + if (cardFilter is SkillTargetNotUniqueBaseCardIdFilter) + { + _isCheckDuplicate = true; + } + } + validateData.CharaTypes = new List(); + if (list.Count >= 1) + { + foreach (CARD_TYPE item2 in list) + { + validateData.CharaTypes.Add((int)item2); + } + } + return validateData; + } + + protected ValidateData CreateValidateDataForReferenceSelfStatus(SkillBase skill) + { + ValidateData validateData = new ValidateData(); + validateData.IncludeList.Add(skill.SkillPrm.ownerCard.BaseParameter.BaseCardId); + validateData.State.Add(0); + IEnumerable source = skill.PreprocessList.Where((SkillPreprocessBase x) => x is SkillPreprocessConditionCheck); + for (int num = 0; num < source.Count(); num++) + { + if ((source.ElementAt(num) as SkillPreprocessConditionCheck).Contains("life.max")) + { + validateData.NowLife = "max"; + } + } + return validateData; + } + + public void AddIncludeList(int baseCardId, int index) + { + ValidateData validateData = new ValidateData(); + validateData.IncludeList.Add(baseCardId); + ValidateDataList.Add(validateData); + base.IndexList.Add(index); + } + + public static bool IsIncludesValidateCard(SkillBase skill) + { + if (skill.SkillPrm.ownerCard.Skills.ToList().Find((SkillBase x) => IsValidateCard(x)) == null) + { + return false; + } + return true; + } + + public static bool IsValidateCard(SkillBase skill) + { + if (NetworkBattleGenericTool.IsTargetDeckSelf(skill)) + { + if (IsDeckParamVariable(skill)) + { + return true; + } + return false; + } + if (skill.IsRandomUntilDrawSkill) + { + return true; + } + if (IsDeckRandomEachSkill(skill)) + { + return true; + } + if (IsOpenMyHandSkill(skill)) + { + return true; + } + if (NetworkBattleGenericTool.IsBurialRite(skill)) + { + return true; + } + if (!(skill.ApplyingTargetFilter is SkillTargetHandFilter) && !(skill.ApplyingTargetFilter is SkillTargetHandOtherSelfFilter) && !skill.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.TargetFilter is SkillTargetHandFilter || f.TargetFilter is SkillTargetHandOtherSelfFilter)) + { + return false; + } + if (RegisterTool.IsSkillRandom(skill)) + { + return false; + } + if (!(skill.ApplySelectFilter is SkillUserSelectFilter) && !(skill is Skill_select)) + { + return false; + } + if (!RegisterTool.IsSkillFilterEffect(skill)) + { + return false; + } + return true; + } + + public static bool IsDeckRandomEachSkill(SkillBase skill) + { + if (skill.ApplyingTargetFilter is SkillTargetDeckFilter) + { + return skill.ApplySelectFilter is SkillRandomEachSameBaseCardIdFilter; + } + return false; + } + + public static bool IsOpenMyHandSkill(SkillBase skill) + { + if (skill is Skill_token_draw && skill.ApplyBattlePlayerFilter is OpponentBattlePlayerFilter && skill.ApplyingTargetFilter is SkillTargetHandFilter && skill.ApplySelectFilter is SkillSelectAllFilter) + { + return true; + } + return false; + } + + public static bool IsSendOpenMyCardsSkill(SkillBase skill) + { + if ((skill.OnSelfTurnEndStart == 0 || !skill.PreprocessList.Any((SkillPreprocessBase s) => s is SkillPreprocessOpenCard)) && (skill is Skill_summon_card || skill is Skill_draw || !(skill.ConditionTargetFilter is SkillTargetDeckSelfFilter))) + { + if (skill.OnWhenBanish != 0) + { + return skill.ConditionTargetFilter is SkillTargetHandSelfFilter; + } + return false; + } + return true; + } + + public static bool IsReferenceSelfStatusSkill(SkillBase skill) + { + List checkString = new List { "self.life" }; + int i; + for (i = 0; i < checkString.Count; i++) + { + if (skill.ConditionFilterCollection.VariableCompareFilter.Any((SkillVariableComareFilter f) => f.Lhs.Contains(checkString[i]))) + { + return true; + } + } + return false; + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = new Dictionary(); + if (PrivateGroupIndexMsg != string.Empty) + { + dictionary.Add(ValidateParamater.idx.ToString(), PrivateGroupIndexMsg); + } + else + { + dictionary.Add(ValidateParamater.idx.ToString(), base.IndexList); + } + List> list = CreateConditionData((OrValidateDataList.Count > 0) ? OrValidateDataList : ValidateDataList); + if (_isCheckDeckParam) + { + dictionary.Add(ValidateParamater.checkParam.ToString(), CreateDeckParamConditionData(ValidateDataList)); + } + else if (OrValidateDataList.Count > 0) + { + List>> list2 = new List>>(); + list2.Add(list); + dictionary.Add(ValidateParamater.conditions.ToString(), list2); + } + else if (list.Where((Dictionary c) => c.Keys.Count > 0).Count() > 0) + { + dictionary.Add(ValidateParamater.conditions.ToString(), list); + } + if (_isCheckDuplicate) + { + dictionary.Add(ValidateParamater.checkDuplicate.ToString(), 1); + } + return dictionary; + } + + protected List> CreateConditionData(List validateDataList) + { + List> list = new List>(); + foreach (ValidateData validateData in validateDataList) + { + Dictionary dictionary = new Dictionary(); + if (validateData.NowCost != null) + { + dictionary.Add(ValidateParamater.nowCost.ToString(), validateData.NowCost); + } + if (validateData.BaseCost != null) + { + dictionary.Add(ValidateParamater.baseCost.ToString(), validateData.BaseCost); + } + if (validateData.NowAtk != null) + { + dictionary.Add(ValidateParamater.nowAtk.ToString(), validateData.NowAtk); + } + if (validateData.BaseAtk != null) + { + dictionary.Add(ValidateParamater.baseAtk.ToString(), validateData.BaseAtk); + } + if (validateData.NowLife != null) + { + dictionary.Add(ValidateParamater.nowLife.ToString(), validateData.NowLife); + } + if (validateData.BaseLife != null) + { + dictionary.Add(ValidateParamater.baseLife.ToString(), validateData.BaseLife); + } + if (validateData.CharaTypes.Count >= 1) + { + dictionary.Add(ActionBaseParameter.charType.ToString(), validateData.CharaTypes); + } + if (validateData.Clan != null) + { + dictionary.Add(ValidateParamater.clan.ToString(), validateData.Clan); + } + if (validateData.Tribe != null) + { + dictionary.Add(ValidateParamater.tribe.ToString(), validateData.Tribe); + } + if (validateData.ChantCount != null) + { + dictionary.Add(ValidateParamater.chant_count.ToString(), validateData.ChantCount); + } + if (validateData.SpellBoost != null) + { + dictionary.Add(ValidateParamater.spellboost.ToString(), validateData.SpellBoost); + } + if (validateData.LibraryType.Count() >= 1) + { + dictionary.Add(ActionBaseParameter.libraryType.ToString(), validateData.LibraryType); + } + if (validateData.ExcludeList.Count >= 1) + { + List list2 = new List(); + foreach (int exclude in validateData.ExcludeList) + { + list2.Add(exclude); + } + dictionary.Add(ValidateParamater.excludeList.ToString(), list2); + } + if (validateData.IncludeList.Count >= 1) + { + List list3 = new List(); + foreach (int include in validateData.IncludeList) + { + list3.Add(include); + } + dictionary.Add(ValidateParamater.includeList.ToString(), list3); + } + if (validateData.ExcludeIdxList.Count >= 1) + { + dictionary.Add(RegisterScan.ScanParameter.excludeIdxList.ToString(), validateData.ExcludeIdxList); + } + list.Add(dictionary); + } + return list; + } + + protected Dictionary CreateDeckParamConditionData(List validateDataList) + { + Dictionary dictionary = new Dictionary(); + foreach (ValidateData validateData in validateDataList) + { + if (validateData.NowCost != null) + { + dictionary.Add(ValidateParamater.nowCost.ToString(), validateData.NowCost); + } + if (validateData.BaseCost != null) + { + dictionary.Add(ValidateParamater.baseCost.ToString(), validateData.BaseCost); + } + if (validateData.NowAtk != null) + { + dictionary.Add(ValidateParamater.nowAtk.ToString(), validateData.NowAtk); + } + if (validateData.BaseAtk != null) + { + dictionary.Add(ValidateParamater.baseAtk.ToString(), validateData.BaseAtk); + } + if (validateData.NowLife != null) + { + dictionary.Add(ValidateParamater.nowLife.ToString(), validateData.NowLife); + } + if (validateData.BaseLife != null) + { + dictionary.Add(ValidateParamater.baseLife.ToString(), validateData.BaseLife); + } + if (validateData.IncludeList.Count >= 1) + { + List list = new List(); + foreach (int include in validateData.IncludeList) + { + list.Add(include); + } + dictionary.Add(ValidateParamater.includeList.ToString(), list); + } + if (validateData.State.Count < 1) + { + continue; + } + List list2 = new List(); + foreach (int item in validateData.State) + { + list2.Add(item); + } + dictionary.Add(ValidateParamater.state.ToString(), list2); + } + return dictionary; + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.validate.ToString(); + } + + public List GetValidateDataList() + { + return ValidateDataList; + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + return false; + } + + public static bool IsSetValidateConditionCheckSkill(SkillBase skill) + { + if (NetworkBattleGenericTool.IsTargetDeckSelf(skill)) + { + return false; + } + if (skill.IsRandomUntilDrawSkill) + { + return false; + } + if (IsOpenMyHandSkill(skill)) + { + return false; + } + if (skill.ApplyingTargetFilter is SkillTargetDeckFilter && skill.ApplySelectFilter is SkillRandomEachSameBaseCardIdFilter) + { + return false; + } + if (skill is Skill_fusion) + { + return false; + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/RepeatSkillEffectVfx.cs b/SVSim.BattleEngine/Engine/RepeatSkillEffectVfx.cs new file mode 100644 index 0000000..d9d2f3f --- /dev/null +++ b/SVSim.BattleEngine/Engine/RepeatSkillEffectVfx.cs @@ -0,0 +1,17 @@ +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class RepeatSkillEffectVfx : SequentialVfxPlayer +{ + private const float WAIT_REPEAT_TIME = 1f; + + public RepeatSkillEffectVfx(IBattleCardView cardView, string repeatTiming, bool isSelf) + { + if (cardView != null && !(cardView.GameObject == null) && repeatTiming == "when_destroy") + { + Register(new LoadAndPlayEffectVfx("btl_unique_twilightqueen_2", "se_btl_unique_twilightqueen_2", cardView.Transform, 0f)); + Register(WaitVfx.Create(1f)); + BattleManagerBase.GetIns().OperateMgr.CallOnShowRepeatSkillEffect(isSelf); + } + } +} diff --git a/SVSim.BattleEngine/Engine/ReplayBattleEnemy.cs b/SVSim.BattleEngine/Engine/ReplayBattleEnemy.cs new file mode 100644 index 0000000..b4d3b82 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReplayBattleEnemy.cs @@ -0,0 +1,264 @@ +using System.Collections.Generic; +using Wizard; +using Wizard.Battle; +using Wizard.Battle.UI; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class ReplayBattleEnemy : BattleEnemy +{ + private NewReplayBattleMgr _replayBattleMgr; + + public ReplayBattleEnemy(BattleManagerBase battleMgr, BattleCamera battleCamera, BackGroundBase backGround, IInnerOptionsBuilder innerOptionsBuilder) + : base(battleMgr, battleCamera, backGround, innerOptionsBuilder) + { + _replayBattleMgr = battleMgr as NewReplayBattleMgr; + } + + public override VfxBase StartTurnControl(string log = "") + { + Turn++; + base.IsEpEvolveThisTurn = false; + SequentialVfxPlayer sequentialVfxPlayer = TurnEvolveControl(BattleView.EpIcon); + VfxBase vfx = TurnStart(); + sequentialVfxPlayer.Register(vfx); + return sequentialVfxPlayer; + } + + public override VfxBase TurnStart() + { + _opponentBattlePlayer.IsSelfTurn = false; + _replayBattleMgr.TurnStart(this); + base.IsAlreadyChoiceBraveInThisTurn = false; + return NullVfx.GetInstance(); + } + + public VfxBase TurnStartFinish() + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(InstantVfx.Create(SetActive)); + sequentialVfxPlayer.Register(CreateThinkingVfx(base.BattleMgr)); + return sequentialVfxPlayer; + } + + public VfxBase AddPpTotal(BattleCardBase ownerCard, int addPpTotalCount, int pp) + { + return _replayBattleMgr.AddPpTotal(ownerCard, this, addPpTotalCount, pp); + } + + public VfxBase AddPp(BattleCardBase ownerCard, int addPpCount) + { + return _replayBattleMgr.AddPp(ownerCard, this, addPpCount); + } + + public VfxBase AddBp(BattleCardBase ownerCard, int addBpCount) + { + return _replayBattleMgr.AddBp(ownerCard, this, addBpCount, isSelf: false); + } + + public VfxBase AddEp(BattleCardBase ownerCard, int addEpCount, NetworkBattleReceiver.EffectInfo effectInfo) + { + return _replayBattleMgr.EpModifier(ownerCard, this, addEpCount, isAdd: true, effectInfo); + } + + public VfxBase SetEp(BattleCardBase ownerCard, int addEpCount, NetworkBattleReceiver.EffectInfo effectInfo) + { + return _replayBattleMgr.EpModifier(ownerCard, this, addEpCount, isAdd: false, effectInfo); + } + + public VfxWithLoading DrawCard(List drawList, List cardInfoList, bool isSkipShuffle, bool isOpenDrawSkill) + { + VfxWithLoadingSequential vfxWithLoadingSequential = _replayBattleMgr.DrawCard(this, drawList, cardInfoList); + vfxWithLoadingSequential.RegisterToMainVfx(CardDrawVfx(drawList, isSkipShuffle, isOpenDrawSkill)); + return vfxWithLoadingSequential; + } + + public VfxWithLoading TokenDrawCard(BattleCardBase ownerCard, List cardInfoList, List targets, bool isOpen, bool isReserved, NetworkBattleReceiver.EffectInfo effectInfo) + { + return _replayBattleMgr.TokenDrawCard(this, ownerCard, cardInfoList, targets, isOpen, isReserved, effectInfo); + } + + public VfxWithLoading CreateReservedCard(BattleCardBase ownerCard, List cardInfoList) + { + return _replayBattleMgr.CreateReservedCard(this, ownerCard, cardInfoList); + } + + public VfxBase PlayCard(BattleCardBase playCard, int cost, int transformCardId, BattleCardBase.TransformType transformType, NetworkBattleReceiver.CardInfo cardInfo) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + playCard.BattleCardView.HideHandCardInfo(); + IBattleCardView battleCardView = playCard.BattleCardView; + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + BattleView.HandView.RemoveCardFromView(battleCardView, 0.3f); + })); + playCard.BattleCardView.UpdateParameterView(playCard.Atk, playCard.Life, cost, playCard.BaseParameter.CardName, playCard.IsInplay, isRecovery: false, useNormalCost: true); + sequentialVfxPlayer.Register(BattleView.PlayQueueView.AddCardToViewVfx(playCard.BattleCardView, playCard.IsSpell, isSelectTarget: false, isChoice: false)); + if (transformCardId != -1) + { + BattleCardBase battleCardBase = playCard; + SequentialVfxPlayer sequentialVfxPlayer2 = SequentialVfxPlayer.Create(); + bool flag = transformType == BattleCardBase.TransformType.Accelerate || transformType == BattleCardBase.TransformType.Crystallize; + playCard = _replayBattleMgr.CreateTransformCard(this, playCard, transformCardId, sequentialVfxPlayer2, flag); + if (transformType == BattleCardBase.TransformType.Choice) + { + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardInfo.Id); + BattleCardBase card = _replayBattleMgr.CreateBattleCard(cardInfo.Id, IsPlayer, null, cardParameterFromId, this, cardInfo.Index); + playCard.TransformInfo = new BattleCardBase.TransformInformation(transformType, card); + } + else + { + playCard.TransformInfo = new BattleCardBase.TransformInformation(transformType, battleCardBase); + } + if (flag) + { + sequentialVfxPlayer.Register(sequentialVfxPlayer2); + } + else + { + _replayBattleMgr.VfxMgr.RegisterImmediateVfx(sequentialVfxPlayer2); + } + base.HandCardList.Insert(base.HandCardList.IndexOf(battleCardBase), playCard); + base.HandCardList.Remove(battleCardBase); + sequentialVfxPlayer.Register(_replayBattleMgr.SetupTransformCard(playCard, battleCardBase, flag, isLoadResource: true)); + } + VfxBase vfxBase = UsePp(cost); + if (playCard is UnitBattleCard || playCard is FieldBattleCard) + { + _replayBattleMgr.HandCardToField(this, playCard); + } + if (playCard is UnitBattleCard) + { + playCard.BattleCardView.ResetTemplate(); + } + BattleLogManager.GetInstance().AddLogDestFollower(BattleLogWindow.BattleLogType.PlayCardLog, playCard); + VfxBase vfxBase2 = _replayBattleMgr.CreatePick(playCard, cardInfo); + sequentialVfxPlayer.Register(ParallelVfxPlayer.Create(vfxBase, vfxBase2)); + sequentialVfxPlayer.Register(playCard.SetUpInplay()); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + MotionUtils.SetLayerAll(playCard.BattleCardView.CardTemplate.CardNormalTemp.gameObject, 10); + })); + if (playCard is SpellBattleCard) + { + _replayBattleMgr.HandCardToCemetery(this, playCard); + } + return sequentialVfxPlayer; + } + + public VfxBase PlayChoiceBraveCard(int cost, int cardId, NetworkBattleReceiver.CardInfo cardInfo) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattleCardBase playCard = _replayBattleMgr.ReplaceChoiceBraveCard(base.Class, cardId, null); + base.IsAlreadyChoiceBraveInThisTurn = true; + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_CARD_SELECT_3, BattleManagerBase.GetIns().BattleUIContainer.EnemyChoiceBraveBtn.position); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CMN_CARD_SELECT_3); + BattleView.UpdateChoiceBraveButtonPulsateEffectAndSprite(); + })); + sequentialVfxPlayer.Register(BattleView.PlayQueueView.AddCardToViewVfx(playCard.BattleCardView, forceCardIntoPlayQueue: false, isSelectTarget: false, isChoice: true)); + sequentialVfxPlayer.Register(UseBp(cost, playCard.BaseParameter.IsVariableCost, isSelf: false)); + sequentialVfxPlayer.Register(_replayBattleMgr.CreatePick(playCard, cardInfo)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + MotionUtils.SetLayerAll(playCard.BattleCardView.CardTemplate.CardNormalTemp.gameObject, 10); + })); + base.ChoiceBraveCardList.Add(playCard); + sequentialVfxPlayer.Register(UpdateHandCardsCost()); + return sequentialVfxPlayer; + } + + public VfxWithLoading SummonToken(BattleCardBase ownerCard, List cardInfoList, NetworkBattleReceiver.EffectInfo effectInfo, bool isOwnerEffect, bool isIgnoreVoice, bool isRandomVoice, bool isEvoVoice) + { + return _replayBattleMgr.SummonToken(this, ownerCard, cardInfoList, effectInfo, isOwnerEffect, isIgnoreVoice, isRandomVoice, isEvoVoice); + } + + public VfxWithLoading SummonCard(BattleCardBase ownerCard, List targets, bool isDeckSelf, bool isBurialRite, NetworkBattleReceiver.EffectInfo effectInfo, bool isIgnoreVoice, List cardInfoList) + { + return _replayBattleMgr.SummonCard(this, ownerCard, targets, isDeckSelf, isBurialRite, effectInfo, isIgnoreVoice, cardInfoList); + } + + public VfxBase AttackStart(BattleCardBase attackCard, BattleCardBase targetCard) + { + return _replayBattleMgr.AttackStart(this, attackCard, targetCard); + } + + public VfxBase Attack(BattleCardBase attackCard, BattleCardBase targetCard, int dealDamage, int receiveDamage, List destroyList, List destroyTypeList, List banishList, int drain, NetworkBattleReceiver.CardInfo attackCardInfo, List sideLogSkillInfoList, bool isAttackerDead, bool isTargetDead) + { + return _replayBattleMgr.Attack(this, attackCard, targetCard, dealDamage, receiveDamage, destroyList, destroyTypeList, banishList, drain, attackCardInfo, sideLogSkillInfoList, isAttackerDead, isTargetDead); + } + + public VfxBase Evolve(BattleCardBase card, bool isConsumeEp, int choiceEvolutionId, NetworkBattleReceiver.CardInfo cardInfo) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (choiceEvolutionId / 1000000 == 910) + { + sequentialVfxPlayer.Register(_replayBattleMgr.ChoiceEvolve(card, choiceEvolutionId)); + } + if (isConsumeEp) + { + GainCurrentEpCount(); + } + base._cumulativeEvolutionCount++; + sequentialVfxPlayer.Register(card.SkillApplyInformation.AllSkillEffectStop(isEvolve: true)); + (card as UnitBattleCard).Evolution(); + base.IsEpEvolveThisTurn = true; + sequentialVfxPlayer.Register(new EvolveVfx(card, _replayBattleMgr.BattleResourceMgr, !isConsumeEp)); + sequentialVfxPlayer.Register(card.SkillApplyInformation.UpdateAllSkillEffectInReplay(cardInfo.InplaySkillEffectList, cardInfo.InductionNumber, isInitialize: true)); + sequentialVfxPlayer.Register(card.SkillApplyInformation.AllSkillEffectRestart()); + card.AttackableOnReplay = cardInfo.Attackable; + card.IsCantAttackClassOnReplay = cardInfo.IsCantAttackClass; + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + card.BattleCardView._inPlayFrameEffect.UpdateCanAttackEffect(); + })); + return sequentialVfxPlayer; + } + + public VfxBase CompleteFusion(BattleCardBase actCard, List ingredientCards, NetworkBattleReceiver.CardInfo cardInfo, bool isFusionMetamorphose, int fusionMetamorphoseCardId, List sideLogSkillInfoList) + { + return _replayBattleMgr.Fusion(actCard, ingredientCards, this, cardInfo, isFusionMetamorphose, fusionMetamorphoseCardId, sideLogSkillInfoList); + } + + public VfxBase UpdateDeck(BattleCardBase card, List cardInfoList, bool isChange, bool isOpen, NetworkBattleReceiver.EffectInfo effectInfo) + { + return _replayBattleMgr.UpdateDeck(this, card, cardInfoList, isChange, isOpen, effectInfo); + } + + public VfxBase Getoff(BattleCardBase ownerCard, List cardInfoList, NetworkBattleReceiver.EffectInfo effectInfo) + { + return _replayBattleMgr.Getoff(this, ownerCard, cardInfoList, effectInfo); + } + + public VfxBase Unite(BattleCardBase card, List targetCards, int uniteCardId, int uniteCardIndex, NetworkBattleReceiver.EffectInfo effectInfo) + { + return _replayBattleMgr.Unite(this, card, targetCards, uniteCardId, uniteCardIndex, effectInfo); + } + + public VfxBase OpenCard(BattleCardBase card, int cost, bool isLastDrawOpenCard) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + List costList = card.BattleCardView.GetUseCostList(cost, useNomalCost: true); + int atk = card.Atk; + int life = card.Life; + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + card.BattleCardView.UpdateCost(costList, isGenerateInHand: false, playEffect: false, isForceUpdate: true); + card.BattleCardView.UpdateOffence(atk); + card.BattleCardView.UpdateLife(life); + })); + sequentialVfxPlayer.Register(new OpenCardFromHandVfx(card.BattleCardView, card.IsLegend)); + sequentialVfxPlayer.Register(new PlayerEndDrawVfx(new List { card })); + if (isLastDrawOpenCard) + { + sequentialVfxPlayer.Register(BattleView.HandView.ShuffleHand()); + } + return sequentialVfxPlayer; + } + + public VfxBase PlayEmotion(ClassCharaPrm.EmotionType emotionType) + { + return Emotion.PlayEmotion(emotionType, 1.5f); + } +} diff --git a/SVSim.BattleEngine/Engine/ReplayBattlePlayer.cs b/SVSim.BattleEngine/Engine/ReplayBattlePlayer.cs new file mode 100644 index 0000000..6522643 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReplayBattlePlayer.cs @@ -0,0 +1,779 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard; +using Wizard.Battle; +using Wizard.Battle.Touch; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class ReplayBattlePlayer : BattlePlayer +{ + private NewReplayBattleMgr _replayBattleMgr; + + private SkillBase _dummySelectSkill; + + private bool _isSelectComplete; + + private List _choiceCards = new List(); + + private List _chosenCards = new List(); + + private BattleCardBase _transformChoiceCard; + + private bool _isTransformSelect; + + public bool CanChoiceBraveOnRecord; + + public override bool CanChoiceBrave + { + get + { + if (CanChoiceBraveThisTurn) + { + return CanChoiceBraveOnRecord; + } + return false; + } + } + + public ReplayBattlePlayer(BattleManagerBase battleMgr, BattleCamera battleCamera, BackGroundBase backGround, IInnerOptionsBuilder innerOptionsBuilder) + : base(battleMgr, battleCamera, backGround, innerOptionsBuilder) + { + _replayBattleMgr = battleMgr as NewReplayBattleMgr; + } + + public override VfxBase StartTurnControl(string log = "") + { + if (_canNotTouchCardVfx == null) + { + _canNotTouchCardVfx = new CanNotTouchCardVfx(); + base.BattleMgr.VfxMgr.RegisterImmediateVfx(_canNotTouchCardVfx); + } + base.PlayerEmotion.ResetPlayCount(); + Turn++; + _replayBattleMgr.IsRightAfterMoveTurn = false; + base.IsEpEvolveThisTurn = false; + SequentialVfxPlayer sequentialVfxPlayer = TurnEvolveControl(PlayerBattleView.EpIcon); + VfxBase vfx = TurnStart(); + sequentialVfxPlayer.Register(vfx); + return sequentialVfxPlayer; + } + + public VfxBase TurnStartFinish() + { + return InstantVfx.Create(PlayerActive); + } + + public override VfxBase TurnStart() + { + for (int i = 0; i < base.HandCardList.Count; i++) + { + base.HandCardList[i].SetOnDraw(draw: true); + } + _opponentBattlePlayer.IsSelfTurn = false; + _replayBattleMgr.TurnStart(this); + base.IsAlreadyChoiceBraveInThisTurn = false; + for (int j = 0; j < base.HandCardList.Count; j++) + { + base.HandCardList[j].SetOnDraw(draw: false); + } + return NullVfx.GetInstance(); + } + + public VfxBase AddPpTotal(BattleCardBase ownerCard, int addPpTotalCount, int pp, bool bySkill) + { + return _replayBattleMgr.AddPpTotal(ownerCard, this, addPpTotalCount, pp, bySkill); + } + + public VfxBase AddPp(BattleCardBase ownerCard, int addPpCount) + { + return _replayBattleMgr.AddPp(ownerCard, this, addPpCount); + } + + public VfxBase AddBp(BattleCardBase ownerCard, int addBpCount) + { + return _replayBattleMgr.AddBp(ownerCard, this, addBpCount, isSelf: true); + } + + public VfxBase AddEp(BattleCardBase ownerCard, int addEpCount, NetworkBattleReceiver.EffectInfo effectInfo) + { + return _replayBattleMgr.EpModifier(ownerCard, this, addEpCount, isAdd: true, effectInfo); + } + + public VfxBase SetEp(BattleCardBase ownerCard, int addEpCount, NetworkBattleReceiver.EffectInfo effectInfo) + { + return _replayBattleMgr.EpModifier(ownerCard, this, addEpCount, isAdd: false, effectInfo); + } + + public VfxWithLoading DrawCard(List drawList, List cardInfoList, bool isOpenDrawSkill) + { + VfxWithLoadingSequential vfxWithLoadingSequential = _replayBattleMgr.DrawCard(this, drawList, cardInfoList); + vfxWithLoadingSequential.RegisterToMainVfx(CardDrawVfx(drawList, skipShuffle: false, isOpenDrawSkill)); + vfxWithLoadingSequential.RegisterToMainVfx(InstantVfx.Create(delegate + { + foreach (BattleCardBase draw in drawList) + { + draw.SetOnDraw(draw: false); + } + })); + return vfxWithLoadingSequential; + } + + public VfxWithLoading TokenDrawCard(BattleCardBase ownerCard, List cardInfoList, List targets, bool isOpen, bool isReserved, NetworkBattleReceiver.EffectInfo effectInfo) + { + return _replayBattleMgr.TokenDrawCard(this, ownerCard, cardInfoList, targets, isOpen, isReserved, effectInfo); + } + + public VfxWithLoading CreateReservedCard(BattleCardBase ownerCard, List cardInfoList) + { + return _replayBattleMgr.CreateReservedCard(this, ownerCard, cardInfoList); + } + + public VfxBase PlayCard(BattleCardBase playCard, int cost, int transformCardId, BattleCardBase.TransformType transformType, NetworkBattleReceiver.CardInfo cardInfo) + { + SequentialVfxPlayer sequentialVfx = SequentialVfxPlayer.Create(); + _replayBattleMgr.VfxMgr.RegisterImmediateVfx(playCard.StopSpellCharge()); + if (playCard == PlayerBattleView.DetailOpenCard) + { + sequentialVfx.Register(InstantVfx.Create(delegate + { + PlayerBattleView.HideDetailPanel(); + })); + } + if (!_isSelectComplete) + { + sequentialVfx.Register(BattleView.PlayQueueView.AddCardToViewVfx(playCard.BattleCardView, forceCardIntoPlayQueue: false, isSelectTarget: false, isChoice: false)); + } + else + { + _isSelectComplete = false; + } + playCard.BattleCardView.HideHandCardInfo(); + playCard.BattleCardView.HideCanPlayEffect(); + if (transformCardId != -1) + { + BattleCardBase battleCardBase = playCard; + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + bool flag = transformType == BattleCardBase.TransformType.Accelerate || transformType == BattleCardBase.TransformType.Crystallize; + playCard = _replayBattleMgr.CreateTransformCard(this, playCard, transformCardId, sequentialVfxPlayer, flag); + playCard.TransformInfo = new BattleCardBase.TransformInformation(transformType, battleCardBase); + if (flag) + { + sequentialVfx.Register(sequentialVfxPlayer); + } + else + { + _replayBattleMgr.VfxMgr.RegisterImmediateVfx(sequentialVfxPlayer); + } + base.HandCardList.Insert(base.HandCardList.IndexOf(battleCardBase), playCard); + base.HandCardList.Remove(battleCardBase); + sequentialVfx.Register(_replayBattleMgr.SetupTransformCard(playCard, battleCardBase, flag)); + } + BattleView.HandView.RemoveCardFromView(playCard.BattleCardView, 0.3f); + VfxBase vfxBase = UsePp(cost); + if (playCard is UnitBattleCard || playCard is FieldBattleCard) + { + _replayBattleMgr.HandCardToField(this, playCard); + } + if (playCard is UnitBattleCard) + { + playCard.BattleCardView.ResetTemplate(); + } + BattleLogManager.GetInstance().AddLogDestFollower(BattleLogWindow.BattleLogType.PlayCardLog, playCard); + VfxBase vfxBase2 = _replayBattleMgr.CreatePick(playCard, cardInfo); + sequentialVfx.Register(ParallelVfxPlayer.Create(vfxBase, vfxBase2)); + sequentialVfx.Register(playCard.SetUpInplay()); + sequentialVfx.Register(InstantVfx.Create(delegate + { + if (base.HandCardList.Count <= 0) + { + sequentialVfx.Register(BattleView.HandUnfocus()); + } + })); + sequentialVfx.Register(InstantVfx.Create(delegate + { + MotionUtils.SetLayerAll(playCard.BattleCardView.CardTemplate.CardNormalTemp.gameObject, 10); + })); + if (playCard is SpellBattleCard) + { + _replayBattleMgr.HandCardToCemetery(this, playCard); + } + sequentialVfx.Register(UpdateHandCardsCost()); + return sequentialVfx; + } + + public VfxBase PlayChoiceBraveCard(int cost, int cardId, NetworkBattleReceiver.CardInfo cardInfo) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattleCardBase selectSkillCard = (_isSelectComplete ? _transformChoiceCard : null); + BattleCardBase playCard = _replayBattleMgr.ReplaceChoiceBraveCard(base.Class, cardId, selectSkillCard); + base.IsAlreadyChoiceBraveInThisTurn = true; + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + BattleView.UpdateChoiceBraveButtonPulsateEffectAndSprite(); + })); + _replayBattleMgr.VfxMgr.RegisterImmediateVfx(BattleView.PlayQueueView.AddCardToViewVfx(playCard.BattleCardView, forceCardIntoPlayQueue: false, isSelectTarget: false, isChoice: true, isChoiceBrave: true)); + _isSelectComplete = false; + _transformChoiceCard = null; + sequentialVfxPlayer.Register(UseBp(cost, playCard.BaseParameter.IsVariableCost, isSelf: true)); + sequentialVfxPlayer.Register(_replayBattleMgr.CreatePick(playCard, cardInfo)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + MotionUtils.SetLayerAll(playCard.BattleCardView.CardTemplate.CardNormalTemp.gameObject, 10); + })); + base.ChoiceBraveCardList.Add(playCard); + sequentialVfxPlayer.Register(UpdateHandCardsCost()); + return sequentialVfxPlayer; + } + + public VfxWithLoading SummonToken(BattleCardBase ownerCard, List cardInfoList, NetworkBattleReceiver.EffectInfo effectInfo, bool isOwnerEffect, bool isIgnoreVoice, bool isRandomVoice, bool isEvoVoice) + { + return _replayBattleMgr.SummonToken(this, ownerCard, cardInfoList, effectInfo, isOwnerEffect, isIgnoreVoice, isRandomVoice, isEvoVoice); + } + + public VfxWithLoading SummonCard(BattleCardBase ownerCard, List targets, bool isDeckSelf, bool isBurialRite, NetworkBattleReceiver.EffectInfo effectInfo, bool isIgnoreVoice, List cardInfoList) + { + return _replayBattleMgr.SummonCard(this, ownerCard, targets, isDeckSelf, isBurialRite, effectInfo, isIgnoreVoice, cardInfoList); + } + + public VfxBase AttackStart(BattleCardBase attackCard, BattleCardBase targetCard) + { + return _replayBattleMgr.AttackStart(this, attackCard, targetCard); + } + + public VfxBase Attack(BattleCardBase attackCard, BattleCardBase targetCard, int dealDamage, int receiveDamage, List destroyList, List destroyTypeList, List banishList, int drain, NetworkBattleReceiver.CardInfo attackCardInfo, List sideLogSkillInfoList, bool isAttackerDead, bool isTargetDead) + { + return _replayBattleMgr.Attack(this, attackCard, targetCard, dealDamage, receiveDamage, destroyList, destroyTypeList, banishList, drain, attackCardInfo, sideLogSkillInfoList, isAttackerDead, isTargetDead); + } + + public VfxBase Evolve(BattleCardBase card, bool isConsumeEp, int choiceEvolutionId, NetworkBattleReceiver.CardInfo cardInfo, List handCardInfoList) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (choiceEvolutionId / 1000000 == 910) + { + sequentialVfxPlayer.Register(_replayBattleMgr.ChoiceEvolve(card, choiceEvolutionId)); + } + if (isConsumeEp) + { + GainCurrentEpCount(); + } + base._cumulativeEvolutionCount++; + sequentialVfxPlayer.Register(_replayBattleMgr.UpdateHandEffect(base.HandCardList, handCardInfoList, forceHide: true)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + BattleView.HideChoiceBraveButtonPulsateEffect(); + })); + sequentialVfxPlayer.Register(card.SkillApplyInformation.AllSkillEffectStop(isEvolve: true)); + (card as UnitBattleCard).Evolution(); + base.IsEpEvolveThisTurn = true; + if (GameMgr.GetIns().GetDataMgr().Is3DSkin(isPlayer: true)) + { + sequentialVfxPlayer.Register(new Class3dEvolveVfx(card, _replayBattleMgr.BattleResourceMgr)); + } + else if (GameMgr.GetIns().GetDataMgr().IsHighRankSkinPlayer()) + { + sequentialVfxPlayer.Register(new HighRankEvolveVfx(card, _replayBattleMgr.BattleResourceMgr, !isConsumeEp)); + } + else + { + sequentialVfxPlayer.Register(new EvolveVfx(card, _replayBattleMgr.BattleResourceMgr, !isConsumeEp)); + } + sequentialVfxPlayer.Register(card.SkillApplyInformation.UpdateAllSkillEffectInReplay(cardInfo.InplaySkillEffectList, cardInfo.InductionNumber, isInitialize: true)); + sequentialVfxPlayer.Register(card.SkillApplyInformation.AllSkillEffectRestart()); + card.AttackableOnReplay = cardInfo.Attackable; + card.IsCantAttackClassOnReplay = cardInfo.IsCantAttackClass; + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + card.BattleCardView._inPlayFrameEffect.UpdateCanAttackEffect(); + })); + sequentialVfxPlayer.Register(_replayBattleMgr.UpdateHandEffect(base.HandCardList, handCardInfoList)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + BattleView.UpdateChoiceBraveButtonPulsateEffectAndSprite(); + })); + return sequentialVfxPlayer; + } + + public VfxBase StartSelect(BattleCardBase actCard, List selectableCards, bool isEvolve, NetworkBattleReceiver.CardInfo cardInfo, bool isChoiceBrave) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (isChoiceBrave) + { + actCard = _transformChoiceCard; + } + if (!isEvolve) + { + if (actCard.IsInHand && actCard == PlayerBattleView.DetailOpenCard) + { + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + PlayerBattleView.HideDetailPanel(); + })); + } + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + actCard.BattleCardView.HideHandCardInfo(); + })); + if (!_isTransformSelect) + { + sequentialVfxPlayer.Register(_replayBattleMgr.OperateMgr.InitSetCard(actCard, isPlayer: true, isSelect: true, isRecovery: false, isChoiceSelect: false, isAccelerateSelect: true)); + } + } + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + BattleView.ShowAlert(PanelMgr.BattleAlertType.SelectChoiceCard, isClass: false, Data.SystemText.Get("Battle_0501")); + base.ClassInformationUIController.SetIsSelect(isSelect: true); + })); + sequentialVfxPlayer.Register(StartShowSelect(actCard, selectableCards, isEvolve, isFusion: false, cardInfo)); + _replayBattleMgr.IsSelecting = true; + _replayBattleMgr.ActCard = actCard; + _replayBattleMgr.IsEvolve = isEvolve; + return sequentialVfxPlayer; + } + + private VfxBase StartShowSelect(BattleCardBase actCard, List selectableCards, bool isEvol, bool isFusion, NetworkBattleReceiver.CardInfo cardInfo) + { + CanNotTouchCardVfx canNotTouchCardVfx = new CanNotTouchCardVfx(); + base.BattleMgr.VfxMgr.RegisterImmediateVfx(canNotTouchCardVfx); + for (int i = 0; i < base.HandCardList.Count; i++) + { + if (!selectableCards.Contains(base.HandCardList[i])) + { + base.HandCardList[i].BattleCardView.HideCanPlayEffect(); + } + } + BattleView.HideChoiceBraveButtonPulsateEffect(); + if (actCard.IsInHand) + { + BattleView.HandView.HideCardFromView(actCard.BattleCardView); + } + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + _dummySelectSkill = CreateDummySkill(actCard); + BattleView.SetSelectCardList(selectableCards); + StartSkillSelectVfx startSkillSelectVfx = new StartSkillSelectVfx(actCard, _dummySelectSkill, selectableCards, selectableCards.First().IsInHand, isFusion); + startSkillSelectVfx.OnStart += delegate + { + canNotTouchCardVfx.End(); + canNotTouchCardVfx = null; + _replayBattleMgr.ShowSideLog(actCard, this, isEvol, 0f, isSkillTargetSelect: true, cardInfo); + }; + parallelVfxPlayer.Register(startSkillSelectVfx); + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + UpdateHandCardsPlayability(areArrowsForcedOff: true); + })); + parallelVfxPlayer.Register(BattleView.HandView.HandUnfocus()); + parallelVfxPlayer.Register(WaitVfx.Create(1f)); + return parallelVfxPlayer; + } + + private SkillBase CreateDummySkill(BattleCardBase card) + { + return new Skill_none(new SkillParameter + { + selfBattlePlayer = card.SelfBattlePlayer, + opponentBattlePlayer = card.OpponentBattlePlayer, + ownerCard = card, + buildInfo = new SkillCreator.SkillBuildInfo("none", "none", "none", "none", "none", "none"), + resourceMgr = _replayBattleMgr.BattleResourceMgr + }, string.Empty); + } + + public VfxBase Select(BattleCardBase actCard, BattleCardBase selectedCard, List selectableCards, bool isEvolve, NetworkBattleReceiver.CardInfo cardInfo, bool isBurialRiteSkill) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(_replayBattleMgr.OperateMgr.BattleCardSelect(actCard, selectedCard, isPlayer: true, registerEffectsDirectlyToVfxMgr: false, isTransformskill: false, isBurialRiteSkill)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + BattleView.ShowAlert(PanelMgr.BattleAlertType.SelectChoiceCard, isClass: false, Data.SystemText.Get("Battle_0501")); + })); + sequentialVfxPlayer.Register(StartShowSelect(actCard, selectableCards, isEvolve, isFusion: false, cardInfo)); + return sequentialVfxPlayer; + } + + public VfxBase CompleteSelect(BattleCardBase actCard, BattleCardBase selectedCard, bool isEvol, bool isBurialRiteSkill, bool isChoiceBrave) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (isChoiceBrave) + { + actCard = _transformChoiceCard; + } + if (_isTransformSelect) + { + ChoiceUtility.SetupActingChoiceCardToBePlayedFromQueue(actCard, _transformChoiceCard, this, isChoiceBrave); + } + sequentialVfxPlayer.Register(_replayBattleMgr.OperateMgr.BattleCardSelect(actCard, selectedCard, isPlayer: true, registerEffectsDirectlyToVfxMgr: false, isTransformskill: false, isBurialRiteSkill)); + _dummySelectSkill.SelectCompleteFlag = true; + if (!isEvol) + { + _isSelectComplete = true; + } + BattleView.ClearSelectCardList(); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + base.ClassInformationUIController.SetIsSelect(isSelect: false); + })); + _isTransformSelect = false; + _replayBattleMgr.IsSelecting = false; + if (!isChoiceBrave) + { + _transformChoiceCard = null; + } + return sequentialVfxPlayer; + } + + public VfxBase CancelSelect(BattleCardBase actCard, bool isEvolve, bool isChoiceBrave, bool isMoveTurn = false) + { + if (_isTransformSelect) + { + PlayerBattleView.SetCancelSkillChoiceTransformCards(actCard, _transformChoiceCard); + } + VfxBase result = CancelSelectVfx(_isTransformSelect ? _transformChoiceCard : actCard, isEvolve, isMoveTurn); + _dummySelectSkill = null; + BattleView.ClearSelectCardList(); + _isTransformSelect = false; + _transformChoiceCard = null; + _replayBattleMgr.IsSelecting = false; + _isSelectComplete = false; + return result; + } + + private VfxBase CancelSelectVfx(BattleCardBase actCard, bool isEvolve, bool isMoveTurn, bool isResetDetail = true) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattleView.CancelPlayCard(actCard, isEvolve, isMoveTurn); + for (int i = 0; i < base.HandCardList.Count(); i++) + { + base.HandCardList[i].IsSelectedDuringSelectingBurialRiteTarget = false; + } + if (base.HandCardList.Contains(actCard)) + { + base.HandControl.AttachCardView(actCard.BattleCardView); + actCard.BattleCardView.GameObject.SetActive(value: true); + } + BattleView.DisableSettingFlag(); + BattleView.AllClear(popUpClose: false, isRemoveSideLog: true, isStopDrag: false, isResetDetail); + BattleView.StopShowSelect(actCard, isAct: false, isTransformskill: false, isMoveTurn); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + if (_replayBattleMgr.ActCard != null && _replayBattleMgr.ActCard.BattleCardView != null && _replayBattleMgr.ActCard.BattleCardView.GameObject != null) + { + _replayBattleMgr.ActCard.BattleCardView.ShowFusionMetamorphoseFrameEffect(enable: false); + } + parallelVfxPlayer.Register(actCard.StartHandEffect()); + if (!isMoveTurn) + { + parallelVfxPlayer.Register(actCard.IsInHand ? actCard.BattleCardView.ShowHandCardInfo() : NullVfx.GetInstance()); + } + _replayBattleMgr.VfxMgr.RegisterImmediateVfx(parallelVfxPlayer); + if (actCard.IsInHand) + { + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + base.HandControl.RearrangeHand(0.4f, base.HandCardList.ConvertToViewList()); + })); + } + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + base.ClassInformationUIController.SetIsSelect(isSelect: false); + })); + if (!isMoveTurn) + { + sequentialVfxPlayer.Register(_replayBattleMgr.ShowHandEffect()); + } + return sequentialVfxPlayer; + } + + public VfxBase StartChoice(BattleCardBase actCard, List cardInfoList, bool isEvolve) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + List choiceCardIdList = cardInfoList.Select((NetworkBattleReceiver.CardInfo i) => i.Id).ToList(); + _choiceCards = _replayBattleMgr.CreateChoiceTokenCards(actCard, choiceCardIdList, PlayerBattleView); + for (int num = 0; num < cardInfoList.Count; num++) + { + _replayBattleMgr.UpdateSkillDescriptionValueList(_choiceCards[num], cardInfoList[num]); + } + sequentialVfxPlayer.Register(StartShowChoice(actCard, _choiceCards, isEvolve)); + CanNotTouchCardVfx canNotTouchVfx = new CanNotTouchCardVfx(); + BattleManagerBase.GetIns().VfxMgr.RegisterImmediateVfx(canNotTouchVfx); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + canNotTouchVfx.End(); + })); + _replayBattleMgr.IsChoiceSelecting = true; + _replayBattleMgr.ActCard = actCard; + _replayBattleMgr.IsEvolve = isEvolve; + return sequentialVfxPlayer; + } + + private VfxBase StartShowChoice(BattleCardBase actCard, List choiceCards, bool isEvolve) + { + BattleView.SetSelectCardList(choiceCards); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + for (int i = 0; i < base.HandCardList.Count; i++) + { + base.HandCardList[i].BattleCardView.HideCanPlayEffect(); + } + BattleView.HideChoiceBraveButtonPulsateEffect(); + if (actCard.IsInHand) + { + if (actCard == PlayerBattleView.DetailOpenCard) + { + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + PlayerBattleView.HideDetailPanel(); + })); + } + BattleView.HandView.HideCardFromView(actCard.BattleCardView); + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + BattleView.PlayQueueView.RemoveCardFromView(actCard.BattleCardView); + })); + } + _dummySelectSkill = CreateDummySkill(actCard); + parallelVfxPlayer.Register(new StartChoiceSelectVfx(actCard, choiceCards, _dummySelectSkill, null, actCard.IsInHand, isEvolve, isChoiceBrave: false)); + parallelVfxPlayer.Register(BattleView.HandView.HandUnfocus()); + return parallelVfxPlayer; + } + + public VfxBase SelectChoice(List chosenCardIndexList, bool hasSelectionSkill) + { + for (int i = 0; i < chosenCardIndexList.Count; i++) + { + _chosenCards.Add(_choiceCards[chosenCardIndexList[i]]); + if (chosenCardIndexList.Count > 1) + { + GameObject checkFromIndex = BattleView.GetCheckFromIndex(chosenCardIndexList[i]); + ChoiceUtility.ToggleChoiceButtonSprite(null, checkFromIndex, setActive: true, 0); + } + } + _isTransformSelect = hasSelectionSkill; + return WaitVfx.Create((chosenCardIndexList.Count > 1) ? 0.5f : 0f); + } + + public VfxBase CompleteChoice(BattleCardBase card, bool hasSelectionSkill, bool isEvolve, bool isChoiceBrave) + { + BattleCardBase transformCard = null; + card.BattleCardView.HideHandCardInfo(); + ChoiceUtility.StopChoiceEffects(_choiceCards); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(_replayBattleMgr.OperateMgr.BattleCardSelect(card, _chosenCards, isPlayer: true, registerEffectsDirectlyToVfxMgr: false)); + _dummySelectSkill.SelectCompleteFlag = true; + if (!isEvolve && !isChoiceBrave) + { + _isSelectComplete = true; + } + _replayBattleMgr.IsChoiceSelecting = false; + bool flag = ChoiceUtility.DoesDuplicateCardNotExistInHand(card); + ParallelVfxPlayer parallelVfxPlayer2 = ParallelVfxPlayer.Create(); + bool flag2 = card.Skills.HaveChoiceTransformSkill() || isChoiceBrave; + for (int i = 0; i < _choiceCards.Count; i++) + { + BattleCardBase choiceCard = _choiceCards[i]; + if (_chosenCards.Contains(choiceCard)) + { + if (flag2) + { + if (!hasSelectionSkill && !isChoiceBrave) + { + card.BattleCardView.Transform.position = choiceCard.BattleCardView.Transform.position; + } + } + else if (card.IsInHand) + { + parallelVfxPlayer2.Register(InstantVfx.Create(delegate + { + card.BattleCardView.Transform.position = choiceCard.BattleCardView.Transform.parent.position; + card.BattleCardView.GameObject.SetActive(value: true); + })); + parallelVfxPlayer.Register(_replayBattleMgr.OperateMgr.InitSetCard(card, base.IsSelfTurn, isSelect: true, isRecovery: false, isChoiceSelect: true, isAccelerateSelect: false, registerDirectlyToVfxManager: false)); + } + _transformChoiceCard = choiceCard; + if (flag2 && hasSelectionSkill) + { + transformCard = choiceCard; + } + } + if (transformCard != choiceCard) + { + if (flag) + { + choiceCard.UnloadResource(); + } + parallelVfxPlayer2.Register(InstantVfx.Create(delegate + { + choiceCard.BattleCardView.GameObject.SetActive(value: false); + })); + } + } + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(parallelVfxPlayer2); + if (transformCard != null) + { + ChoiceUtility.SetupChoiceCardForSkillTargetSelect(transformCard); + parallelVfxPlayer.Register(_replayBattleMgr.OperateMgr.InitSetCard(transformCard, base.IsSelfTurn, isSelect: true)); + parallelVfxPlayer.Register(ReceivePlayActionsReflectionBase.CreateHideChoiceCardsVfx(card, _choiceCards.FindAll((BattleCardBase c) => c != transformCard), dontUnloadResources: true)); + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + BattleView.SetNotCancelCollider(new List { transformCard }, isEnable: false); + })); + } + sequentialVfxPlayer.Register(parallelVfxPlayer); + _choiceCards = new List(); + _chosenCards = new List(); + BattleView.ClearSelectCardList(); + return sequentialVfxPlayer; + } + + public VfxBase CancelChoice(BattleCardBase actCard, bool isEvolve, bool isMoveTurn = false) + { + if (!isEvolve) + { + PlayerBattleView.SetCancelPlayCardWithChoice(actCard, _choiceCards); + } + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(InstantVfx.Create(delegate + { + ChoiceUtility.StopChoiceEffects(_choiceCards); + if (isEvolve) + { + bool isResetDetail = isMoveTurn || (PlayerBattleView.DetailOpenCard != null && !PlayerBattleView.DetailOpenCard.IsClass); + _replayBattleMgr.VfxMgr.RegisterImmediateVfx(CancelSelectVfx(actCard, isEvolve, isMoveTurn, isResetDetail)); + ChoiceUtility.PlayCancelEvolveChoiceAnimation(_choiceCards, _replayBattleMgr); + _replayBattleMgr.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + _choiceCards = new List(); + BattleView.ClearSelectCardList(); + })); + } + else + { + _choiceCards = new List(); + BattleView.ClearSelectCardList(); + } + })); + bool flag = isMoveTurn || (PlayerBattleView.DetailOpenCard != null && !PlayerBattleView.DetailOpenCard.IsClass); + if (!isEvolve) + { + parallelVfxPlayer.Register(CancelSelectVfx(actCard, isEvolve, isMoveTurn, flag)); + } + if (flag) + { + PlayerBattleView.HideDetailPanel(); + } + _dummySelectSkill = null; + _chosenCards = new List(); + _replayBattleMgr.IsChoiceSelecting = false; + return parallelVfxPlayer; + } + + public VfxBase StartFusion(BattleCardBase actCard, List selectableCards, NetworkBattleReceiver.CardInfo cardInfo) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + actCard.BattleCardView.HideHandCardInfo(); + actCard.BattleCardView.GameObject.transform.localEulerAngles = FusionTargetSelectTouchProcessor.INIT_LOCAL_EULAR_ANGLE; + BattleView.PlayQueueView.AddCardToViewVfx(actCard.BattleCardView, forceCardIntoPlayQueue: true, isSelectTarget: true, isChoice: false); + if (!actCard.HasNoSelectFusionSkill) + { + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + BattleView.ShowAlert(PanelMgr.BattleAlertType.SelectChoiceCard, isClass: false, Data.SystemText.Get("Battle_0501")); + })); + } + sequentialVfxPlayer.Register(StartShowSelect(actCard, selectableCards, isEvol: false, isFusion: true, cardInfo)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + BattleView.StartShowFusionUI(actCard, selectableCards, 8, new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CMN_CARD_SELECT_3); + })); + base.ClassInformationUIController.SetIsSelect(isSelect: true); + })); + _replayBattleMgr.IsFusionSelecting = true; + _replayBattleMgr.ActCard = actCard; + return sequentialVfxPlayer; + } + + public VfxBase SelectFusion(int index, bool isActive, int maxSelectCount, bool canFusionMetamorphose) + { + return InstantVfx.Create(delegate + { + BattleView.SelectedFusionIngredientCard(index, isActive, maxSelectCount); + if (_replayBattleMgr.ActCard != null && _replayBattleMgr.ActCard.BattleCardView != null) + { + _replayBattleMgr.ActCard.BattleCardView.ShowFusionMetamorphoseFrameEffect(canFusionMetamorphose); + } + }); + } + + public VfxBase CompleteFusion(BattleCardBase actCard, List ingredientCards, NetworkBattleReceiver.CardInfo cardInfo, bool isFusionMetamorphose, int fusionMetamorphoseCardId, List sideLogSkillInfoList) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + CanNotTouchCardVfx canNotTouchCardVfx = new CanNotTouchCardVfx(); + _replayBattleMgr.VfxMgr.RegisterImmediateVfx(canNotTouchCardVfx); + sequentialVfxPlayer.Register(ParallelVfxPlayer.Create(InstantVfx.Create(delegate + { + if (_replayBattleMgr.ActCard != null && _replayBattleMgr.ActCard.BattleCardView != null) + { + _replayBattleMgr.ActCard.BattleCardView.ShowFusionMetamorphoseFrameEffect(enable: false); + } + }), BattleView.RemoveFusionSelectedCardFromHand(ingredientCards), BattleView.CreateStopShowSelectVfx(actCard, isAct: true, stopChoiceSelectUiImmediately: false), _replayBattleMgr.Fusion(actCard, ingredientCards, this, cardInfo, isFusionMetamorphose, fusionMetamorphoseCardId, sideLogSkillInfoList))); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + canNotTouchCardVfx.End(); + })); + BattleView.StopFusionUI(); + BattleView.ClearSelectCardList(); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + base.ClassInformationUIController.SetIsSelect(isSelect: false); + })); + _replayBattleMgr.IsFusionSelecting = false; + return sequentialVfxPlayer; + } + + public VfxBase CancelFusion(BattleCardBase actCard, bool isMoveTurn = false) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(CancelSelectVfx(actCard, isEvolve: false, isMoveTurn)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + BattleView.StopFusionUI(); + })); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + PlayerBattleView.ForceStopShowSelect(); + })); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + base.ClassInformationUIController.SetIsSelect(isSelect: false); + })); + _replayBattleMgr.IsFusionSelecting = false; + return sequentialVfxPlayer; + } + + public VfxBase UpdateDeck(BattleCardBase card, List cardInfoList, bool isChange, bool isOpen, NetworkBattleReceiver.EffectInfo effectInfo) + { + return _replayBattleMgr.UpdateDeck(this, card, cardInfoList, isChange, isOpen, effectInfo); + } + + public VfxBase Getoff(BattleCardBase attackCard, List cardInfoList, NetworkBattleReceiver.EffectInfo effectInfo) + { + return _replayBattleMgr.Getoff(this, attackCard, cardInfoList, effectInfo); + } + + public VfxBase Unite(BattleCardBase card, List targetCards, int uniteCardId, int uniteCardIndex, NetworkBattleReceiver.EffectInfo effectInfo) + { + return _replayBattleMgr.Unite(this, card, targetCards, uniteCardId, uniteCardIndex, effectInfo); + } + + public VfxBase OpenCard(BattleCardBase card) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(new LoadAndPlayEffectVfx(SkillPreprocessOpenCard.HAND_SKILL_1_EFFECT, SkillPreprocessOpenCard.HAND_SKILL_1_SE, card.BattleCardView.GameObject.transform, 0.5f, isFollowAll: true)); + return sequentialVfxPlayer; + } + + public VfxBase PlayEmotion(ClassCharaPrm.EmotionType emotionType) + { + return Emotion.PlayEmotion(emotionType, 1.5f); + } +} diff --git a/SVSim.BattleEngine/Engine/ReplayExecutionInfoCreator.cs b/SVSim.BattleEngine/Engine/ReplayExecutionInfoCreator.cs new file mode 100644 index 0000000..8dcaa7b --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReplayExecutionInfoCreator.cs @@ -0,0 +1,20 @@ +using Wizard; + +public class ReplayExecutionInfoCreator : NetworkExecutionInfoCreator +{ + public ReplayExecutionInfoCreator(SkillBase skill) + : base(skill) + { + } + + public override bool CheckCondition(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool isPrePlay, bool isSkipTarget = false) + { + isSkipTarget = !isPrePlay && IsSkipTargetAiSelect(); + return base.CheckCondition(playerInfoPair, option, isPrePlay, isSkipTarget); + } + + public override bool IsSkipTargetAiSelect() + { + return IsSkipTargetSkill(_skill); + } +} diff --git a/SVSim.BattleEngine/Engine/ReplayMoveTurnItem.cs b/SVSim.BattleEngine/Engine/ReplayMoveTurnItem.cs new file mode 100644 index 0000000..dda1f53 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReplayMoveTurnItem.cs @@ -0,0 +1,20 @@ +using UnityEngine; + +public class ReplayMoveTurnItem : MonoBehaviour +{ + [SerializeField] + public UILabel Label; + + [SerializeField] + public UIButton Button; + + private void Awake() + { + EventDelegate.Set(Button.onClick, OnClickButton); + } + + private void OnClickButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + } +} diff --git a/SVSim.BattleEngine/Engine/ReplayMoveTurnPanel.cs b/SVSim.BattleEngine/Engine/ReplayMoveTurnPanel.cs new file mode 100644 index 0000000..22876cf --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReplayMoveTurnPanel.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +public class ReplayMoveTurnPanel : MonoBehaviour +{ + [SerializeField] + public UIScrollView ScrollView; + + [SerializeField] + public UIGrid LogGrid; +} diff --git a/SVSim.BattleEngine/Engine/ReplayOperateReceive.cs b/SVSim.BattleEngine/Engine/ReplayOperateReceive.cs new file mode 100644 index 0000000..089861d --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReplayOperateReceive.cs @@ -0,0 +1,17 @@ +public class ReplayOperateReceive : OperateReceive +{ + public ReplayOperateReceive(NetworkBattleManagerBase networkBattleMgr, RegisterActionManager registerCardList, OperateMgr operateMgr, NetworkBattleData networkBattleData) + : base(networkBattleMgr, registerCardList, operateMgr, networkBattleData) + { + } + + protected override PlayHandCardReflection CreateNetworkPlayCardAction() + { + return new ReplayPlayCardAction(_battleMgr, _operateMgr, _networkBattleData); + } + + protected override InPlayCardReflection CreateNetworkInPlayAction() + { + return new ReplayInPlayAction(_battleMgr, _operateMgr); + } +} diff --git a/SVSim.BattleEngine/Engine/ReplayOperationCollection.cs b/SVSim.BattleEngine/Engine/ReplayOperationCollection.cs new file mode 100644 index 0000000..ca8e01b --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReplayOperationCollection.cs @@ -0,0 +1,27 @@ +public class ReplayOperationCollection : WatchOperationCollection +{ + public ReplayOperationCollection(NetworkReplayBattleMgr replayBattleMgr, OperateMgr operateMgr, NetworkBattleReceiver.ReceiveData receivedData, NetworkBattleData networkBattleData, bool isPlayer) + : base(replayBattleMgr, operateMgr, receivedData, networkBattleData, isPlayer) + { + } + + public override void SelectObjectOperation() + { + } + + protected override void CheckStateAndCancel(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction, bool isPlayer) + { + if (isPlayer) + { + base.CheckStateAndCancel(networkPlayCardAction, networkInPlayAction, isPlayer); + } + } + + public override void TurnEndReady() + { + } + + public override void SlideObject() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Reward.cs b/SVSim.BattleEngine/Engine/Reward.cs new file mode 100644 index 0000000..b929954 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Reward.cs @@ -0,0 +1,12 @@ +public class Reward : HeaderData +{ + public int crystal; + + public int red_ether; + + public string create_time; + + public string update_time; + + public string delete_time; +} diff --git a/SVSim.BattleEngine/Engine/RivayleBackalleyField.cs b/SVSim.BattleEngine/Engine/RivayleBackalleyField.cs new file mode 100644 index 0000000..5bf7d8e --- /dev/null +++ b/SVSim.BattleEngine/Engine/RivayleBackalleyField.cs @@ -0,0 +1,72 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class RivayleBackalleyField : BackGroundBase +{ + public override int FieldId => 42; + + public RivayleBackalleyField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_0042_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles42").gameObject; + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_42, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_42_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _battleCamera.Camera.transform.localPosition = new Vector3(-1252f, -1507f, -155f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-78f, 60f, -60f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-394f, 340f, -273f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInSine)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-90f, 0f, 0f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInSine)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/RivayleField.cs b/SVSim.BattleEngine/Engine/RivayleField.cs new file mode 100644 index 0000000..b9479b5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RivayleField.cs @@ -0,0 +1,100 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class RivayleField : BackGroundBase +{ + public override int FieldId => 41; + + public RivayleField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_0041_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles41").gameObject; + _fieldObjDictionary.Add("gate", _fieldModel.transform.Find("md_bf_0041_01_gate").gameObject); + m_FieldAnimatorDictionary.Add("gate", _fieldObjDictionary["gate"].GetComponent()); + _fieldObjDictionary.Add("tub", _fieldModel.transform.Find("md_bf_0041_01_tub").gameObject); + m_FieldAnimatorDictionary.Add("tub", _fieldObjDictionary["tub"].GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_2", _fieldParticles.transform.Find("gimic_2").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_41, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_41_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["gate"].SetTrigger("Open"); + _battleCamera.Camera.transform.localPosition = new Vector3(1742f, -485f, 51f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-12f, -90f, 90f)); + Vector3[] bezierQuad = MotionUtils.GetBezierQuad(new Vector3(1742f, -485f, 51f), new Vector3(900f, -285f, 18f), new Vector3(184f, 81f, -14f), 10); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierQuad, "movetopath", false, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-8f, -97f, 90.5f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutSine)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + int num = Random.Range(1, 3); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_{num}", "se_field_" + _str3DFieldNo, 0f, 0L); + switch (num) + { + case 1: + m_FieldAnimatorDictionary["tub"].SetTrigger("tap"); + yield return new WaitForSeconds(3f); + break; + case 2: + m_FieldAnimatorDictionary["tub"].SetTrigger("fall"); + _fieldParticleSystemDictionary["gimic_2"].Play(); + yield return new WaitForSeconds(6f); + break; + } + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + m_FieldAnimatorDictionary["tub"].SetTrigger("tap"); + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/RoomBattleMatching.cs b/SVSim.BattleEngine/Engine/RoomBattleMatching.cs new file mode 100644 index 0000000..10f38b9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoomBattleMatching.cs @@ -0,0 +1,4 @@ +public class RoomBattleMatching : HeaderData +{ + public RoomBattleMatchingDetail data; +} diff --git a/SVSim.BattleEngine/Engine/RoomBattleMatchingDetail.cs b/SVSim.BattleEngine/Engine/RoomBattleMatchingDetail.cs new file mode 100644 index 0000000..0e9da49 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoomBattleMatchingDetail.cs @@ -0,0 +1,8 @@ +public class RoomBattleMatchingDetail +{ + public int battle_state; + + public int matching_state; + + public string battleId; +} diff --git a/SVSim.BattleEngine/Engine/RoomMatchFinish.cs b/SVSim.BattleEngine/Engine/RoomMatchFinish.cs new file mode 100644 index 0000000..a09e6de --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoomMatchFinish.cs @@ -0,0 +1,4 @@ +public class RoomMatchFinish : HeaderData +{ + public RoomMatchFinishDetail data; +} diff --git a/SVSim.BattleEngine/Engine/RoomMatchFinishDetail.cs b/SVSim.BattleEngine/Engine/RoomMatchFinishDetail.cs new file mode 100644 index 0000000..91b2c60 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoomMatchFinishDetail.cs @@ -0,0 +1,3 @@ +public class RoomMatchFinishDetail : MatchFinishBase +{ +} diff --git a/SVSim.BattleEngine/Engine/RoomMatchReportEndAgent.cs b/SVSim.BattleEngine/Engine/RoomMatchReportEndAgent.cs new file mode 100644 index 0000000..e9b9c1f --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoomMatchReportEndAgent.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +public class RoomMatchReportEndAgent : MonoBehaviour +{ + public bool IsEnd { get; private set; } + + public void Finished() + { + IsEnd = true; + } +} diff --git a/SVSim.BattleEngine/Engine/RoomMatchResultAnimationAgent.cs b/SVSim.BattleEngine/Engine/RoomMatchResultAnimationAgent.cs new file mode 100644 index 0000000..f242634 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoomMatchResultAnimationAgent.cs @@ -0,0 +1,251 @@ +using System; +using System.Collections; +using UnityEngine; +using Wizard; +using Wizard.RoomMatch; + +public class RoomMatchResultAnimationAgent : ResultAnimationAgent +{ + private const float RED_ETHER_WAIT_TIME_MAX = 5f; + + public override IEnumerator RunUI(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin) + { + bool needLottery = false; + if (!GameMgr.GetIns().IsWatchBattle) + { + needLottery = battleResultControl.ResultReporter.LotteryData.IsEnable; + } + if (needLottery) + { + yield return LoadLotteryImage(battleResultControl.ResultReporter.LotteryData); + } + m_BattleCamera.m_CutInCamera.gameObject.SetActive(value: false); + if (battleResultControl.IsDraw) + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleDraw.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 48, 16, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + else if (isWin) + { + battleResultControl.TitleWin.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.gameObject.SetActive(value: true); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleWin.alpha = 0f; + battleResultControl.Bg.color = new Color32(32, 24, 0, 0); + battleResultControl.ResultTitle.spriteName = "result_top_win"; + } + else + { + battleResultControl.TitleLose.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleLose.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 24, 48, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + battleResultControl.MainPanel.alpha = 1f; + yield return new WaitForSeconds(0.1f); + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + else + { + battleResultControl.PrepareAchievementLog(); + if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOUWIN); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_WIN); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + } + TweenAlpha.Begin(battleResultControl.Bg.gameObject, 0.5f, 0.75f); + yield return new WaitForSeconds(0.2f); + TweenAlpha.Begin(battleResultControl.ArcaneIn.gameObject, 0.5f, 1f); + TweenAlpha.Begin(battleResultControl.ArcaneOut.gameObject, 0.5f, 1f); + iTween.ScaleTo(battleResultControl.ArcaneIn.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(battleResultControl.ArcaneOut.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + if (battleResultControl.IsDraw) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_3, Vector3.zero); + battleResultControl.TitleDraw.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else if (isWin) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_1, Vector3.zero); + battleResultControl.TitleWin.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_2, Vector3.zero); + battleResultControl.TitleLose.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + HideEmotionMessage(); + if (battleResultControl.ResultMsgWindowFlag) + { + yield return StartCoroutine(battleResultControl.ShowSpecialResultInfo()); + } + else + { + yield return new WaitForSeconds(2f); + } + if (needLottery) + { + yield return CreateLotteryDialog(battleResultControl.ResultReporter.LotteryData); + } + if (ShowRewardDialog(battleResultControl)) + { + while (battleResultControl.IsRewardWait) + { + yield return null; + } + } + if (Data.RoomMatchFinish.data != null && !GameMgr.GetIns().IsReplayBattle && !GameMgr.GetIns().IsWatchBattle) + { + TreasureBoxCpResultInfo treasureBoxCpResultInfo = Data.RoomMatchFinish.data.TreasureBoxCpResultInfo; + if (treasureBoxCpResultInfo.IsPlayGradeUpAnimation()) + { + yield return TreasureBoxCpOpenBoxAnimation(battleResultControl, treasureBoxCpResultInfo.AfterGrade); + } + if (treasureBoxCpResultInfo.IsBoxOpened()) + { + yield return CreateTreasureBoxCpRewardDialog(treasureBoxCpResultInfo); + } + } + bool isFinishBattlePass = false; + battleResultControl.SetBattlePassGauge(delegate + { + battleResultControl.FinishResult(); + isFinishBattlePass = true; + }); + while (!isFinishBattlePass) + { + yield return null; + } + if (Data.RedEtherCampaignResultData != null) + { + bool isFinishRedEther = false; + RedEtherCampaignPanel.Create(battleResultControl.gameObject, Data.RedEtherCampaignResultData, battleResultControl, delegate + { + isFinishRedEther = true; + }); + float time = 0f; + while (!isFinishRedEther) + { + time += Time.deltaTime; + if (time >= 5f) + { + break; + } + yield return null; + } + yield return ShowRewardDialog(Data.RedEtherCampaignResultData.RewardList); + } + battleResultControl.GreySpriteBGVisible = false; + returnRoom(); + } + + private void returnRoom() + { + if (GameMgr.GetIns().IsWatchBattle) + { + if (GameMgr.GetIns().IsReplayBattle) + { + UIManager.GetInstance().StartCoroutine(GameMgr.GetIns().GetBattleCtrl().BattleEnd(delegate + { + UIManager.ViewScene replayEndBackScene = Data.ReplayBattleInfo.ReplayEndBackScene; + UIManager.ChangeViewSceneParam replayEndBackSceneParam = Data.ReplayBattleInfo.ReplayEndBackSceneParam; + UIManager.GetInstance().ChangeViewScene(replayEndBackScene, replayEndBackSceneParam); + })); + } + else + { + PlayerControllerForWatching playerControllerForWatching = RoomBase.ConnectController.OwnCtrl as PlayerControllerForWatching; + PlayerControllerForWatching playerControllerForWatching2 = RoomBase.ConnectController.OppoCtrl as PlayerControllerForWatching; + playerControllerForWatching.ResetWatchHandler(); + playerControllerForWatching2.ResetWatchHandler(); + StartCoroutine(StartCheckState(playerControllerForWatching, playerControllerForWatching2)); + } + return; + } + if (RoomBase.IsConnectControllerActive()) + { + RoomBase.ConnectController.TotalBattleNum++; + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.Room); + return; + } + PrepareRoom((!Data.BattleRecoveryInfo.is_owner) ? RoomConnectController.PositionMode.VISITOR : RoomConnectController.PositionMode.OWNER, Data.BattleRecoveryInfo.BattleParameterInstance, Data.BattleRecoveryInfo.roomId, PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.ROOM_MATCH_FRIEND_WATCH_PERMIT), PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.ROOM_MATCH_GUILD_WATCH_PERMIT), Data.BattleRecoveryInfo.ConventionInfo, Data.BattleRecoveryInfo.IsGatheringRoom, Data.BattleRecoveryInfo.CanUseNonPossessionCard, delegate + { + RoomBase.OnAlreadySetup(); + RoomBase.ConnectController.TotalBattleNum++; + RoomBase.ConnectController.OppoCtrl.Target.ViewerId = Data.BattleRecoveryInfo.opponent_viewer_id; + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.Room, delegate + { + RoomBase.GetInstance().IsRecoveryRoom = true; + }); + }); + } + + public void PrepareRoom(RoomConnectController.PositionMode mode, BattleParameter battleParameter, string roomId, bool isPermitFriendWatch, bool isPermitGuildWatch, ConventionInfo conventionInfo, bool isGathering, bool canUseNonPossessionCard, Action callback) + { + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true); + RoomConnectController.InitializeParameter initializeParameter = new RoomConnectController.InitializeParameter(mode, battleParameter, roomId); + initializeParameter.IsPermitFriendWatch = isPermitFriendWatch; + initializeParameter.IsPermitGuildWatch = isPermitGuildWatch; + initializeParameter.ConventionInfo = conventionInfo; + initializeParameter.IsGathering = isGathering; + if (conventionInfo != null) + { + initializeParameter.IsEnableTurnSelect = conventionInfo.IsSelectableTurn; + } + RoomConnectController roomConnectController = new RoomConnectController(initializeParameter); + roomConnectController.InitPlayerController(); + roomConnectController.IsEnableGuildInviteButton = Data.BattleRecoveryInfo.IsEnableGuildInviteButton; + if (conventionInfo != null) + { + roomConnectController.DisplayRoomID = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.ROOM_MATCH_DISPLAY_ID); + } + if (isGathering) + { + roomConnectController.DisplayRoomID = ((roomId.Length > 5) ? roomId.Substring(roomId.Length - 5, 5) : roomId); + } + roomConnectController.CanUseNonPossessionCard = canUseNonPossessionCard; + UIManager.GetInstance().closeInSceneCenterLoading(); + callback(); + } + + private IEnumerator StartCheckState(PlayerControllerForWatching pcontroller, PlayerControllerForWatching ocontroller) + { + while (RoomBase.ConnectController.TotalWatchBattleNum == RoomBase.ConnectController.TotalBattleNum && !RoomBase.ConnectController.IsRelease) + { + yield return null; + } + RoomBase.ConnectController.TotalWatchBattleNum = RoomBase.ConnectController.TotalBattleNum; + pcontroller.ResetReceiveEvent(); + ocontroller.ResetReceiveEvent(); + RoomBase.ConnectController.RemoveWatchEventDispath(isOwn: true); + RoomBase.ConnectController.RemoveWatchEventDispath(isOwn: false); + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.Room); + } +} diff --git a/SVSim.BattleEngine/Engine/RoomMatchResultAnimationHandler.cs b/SVSim.BattleEngine/Engine/RoomMatchResultAnimationHandler.cs new file mode 100644 index 0000000..dfe9f67 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoomMatchResultAnimationHandler.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +public class RoomMatchResultAnimationHandler : IResultAnimationHandler +{ + private readonly GameObject m_resultAnimationAgentObj; + + private readonly RoomMatchResultAnimationAgent m_resultAnimationAgentIns; + + public ResultAnimationAgent m_resultAnimationAgent => m_resultAnimationAgentIns; + + public RoomMatchResultAnimationHandler(BattleCamera battleCamera) + { + m_resultAnimationAgentObj = new GameObject(); + m_resultAnimationAgentIns = m_resultAnimationAgentObj.AddComponent(); + m_resultAnimationAgentIns.GetComponent().SetBattleCamera(battleCamera); + } + + public void Destroy() + { + Object.Destroy(m_resultAnimationAgentObj); + } +} diff --git a/SVSim.BattleEngine/Engine/RoomMatchResultReporter.cs b/SVSim.BattleEngine/Engine/RoomMatchResultReporter.cs new file mode 100644 index 0000000..3099092 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoomMatchResultReporter.cs @@ -0,0 +1,66 @@ +using System.Collections.Generic; +using LitJson; +using UnityEngine; +using Wizard; +using Wizard.Lottery; + +public class RoomMatchResultReporter : IBattleResultReporter +{ + private readonly GameObject m_reportEndAgentObj; + + private readonly RoomMatchReportEndAgent m_reportEndAgent; + + public bool IsEnd => m_reportEndAgent.IsEnd; + + public int ClassExp => GetClassExp(); + + public List UserAchievement => GetUserAchievementList(); + + public List UserMission => GetUserMissionList(); + + public List MissionRewards => Data.RoomMatchFinish.data._missionRewards; + + public List VictoryRewards => null; + + public bool IsDataExist => Data.RoomMatchFinish.data != null; + + public MyPageHomeDialogData HomeDialogData => null; + + public LotteryApplyData LotteryData => Data.RoomMatchFinish.data.AchievedInfo._lotteryData; + + public RoomMatchResultReporter() + { + m_reportEndAgentObj = new GameObject(); + m_reportEndAgent = m_reportEndAgentObj.AddComponent(); + } + + public void Report(bool isWin) + { + m_reportEndAgent.Finished(); + } + + public JsonData GetFinishResponseData() + { + return Data.RoomMatchFinish.data._responseData; + } + + public List GetUserAchievementList() + { + return Data.RoomMatchFinish.data.achieved_achievement_list; + } + + public List GetUserMissionList() + { + return Data.RoomMatchFinish.data.achieved_mission_list; + } + + public void Destroy() + { + Object.Destroy(m_reportEndAgentObj); + } + + public int GetClassExp() + { + return 0; + } +} diff --git a/SVSim.BattleEngine/Engine/RoomTwoPickBeforeBattleInfo.cs b/SVSim.BattleEngine/Engine/RoomTwoPickBeforeBattleInfo.cs new file mode 100644 index 0000000..c2673f1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoomTwoPickBeforeBattleInfo.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using Wizard.Scripts.Network.Data.TableData.Arena.TwoPick; + +public class RoomTwoPickBeforeBattleInfo +{ + public Deck receiveDeck { get; private set; } + + public RoomTwoPickBeforeBattleInfo() + { + receiveDeck = new Deck(); + receiveDeck.cardIds = new int[0]; + } + + public void ReceiveBackDraftCardIdList(List list) + { + receiveDeck.cardIds = list.ToArray(); + } + + public void ReceiveBackDraftCharaId(int id) + { + receiveDeck.skinId = id; + } + + public void SetClassId(int classId) + { + receiveDeck.classId = classId; + } + + public void SelfInfoClasIdCopyTwoPickDraftData() + { + SetClassId(GameMgr.GetIns().GetNetworkUserInfoData().GetSelfClassId()); + } + + public void SetSelfClassIdTwoPickDraftData(int classId) + { + SetClassId(classId); + } + + public void SelfInfoDeckCopyTwoPickDraftData() + { + List selfDeck = GameMgr.GetIns().GetNetworkUserInfoData().GetSelfDeck(); + List list = new List(selfDeck.Count); + foreach (CardDataModel item in selfDeck) + { + list.Add(item.CardId); + } + ReceiveBackDraftCardIdList(list); + ReceiveBackDraftCharaId(GameMgr.GetIns().GetNetworkUserInfoData().GetSelfCharaId()); + } +} diff --git a/SVSim.BattleEngine/Engine/RoomTwoPickInfo.cs b/SVSim.BattleEngine/Engine/RoomTwoPickInfo.cs new file mode 100644 index 0000000..5aba3f3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoomTwoPickInfo.cs @@ -0,0 +1,20 @@ +using Wizard.Scripts.Network.Data.TableData.Arena.TwoPick; +using Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick; + +public class RoomTwoPickInfo +{ + public int[] candidateClassIds; + + public CandidateCardInfo candidateCardInfo; + + public Deck deckData; + + public CandidateChaos CandidateChaos; + + public RoomTwoPickInfo() + { + deckData = new Deck(); + deckData.cardIds = new int[0]; + CandidateChaos = new CandidateChaos(); + } +} diff --git a/SVSim.BattleEngine/Engine/RoyalPalaceField.cs b/SVSim.BattleEngine/Engine/RoyalPalaceField.cs new file mode 100644 index 0000000..d87268d --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoyalPalaceField.cs @@ -0,0 +1,146 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class RoyalPalaceField : BackGroundBase +{ + public override int FieldId => 4; + + public RoyalPalaceField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_plce_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles04").gameObject; + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + _fieldObjDictionary.Add("chandelier", _fieldModel.transform.Find("md_bf_plce_01_chandelier").gameObject); + _fieldObjDictionary.Add("armor", _fieldModel.transform.Find("md_bf_plce_01_armor").gameObject); + _fieldObjDictionary.Add("tapestry_a", _fieldModel.transform.Find("md_bf_plce_01_tapestry_a").gameObject); + _fieldObjDictionary.Add("tapestry_b", _fieldModel.transform.Find("md_bf_plce_01_tapestry_b").gameObject); + m_FieldAnimatorDictionary.Add("armor", _fieldObjDictionary["armor"].GetComponent()); + m_FieldAnimatorDictionary.Add("chandelier", _fieldObjDictionary["chandelier"].GetComponent()); + m_FieldAnimatorDictionary.Add("tapestry_a", _fieldObjDictionary["tapestry_a"].GetComponent()); + m_FieldAnimatorDictionary.Add("tapestry_b", _fieldObjDictionary["tapestry_b"].GetComponent()); + _fieldParticleSystemDictionary.Add("armor_threat", _fieldParticles.transform.Find("armor_threat").GetComponent()); + _fieldParticleSystemDictionary.Add("armor_demo", _fieldParticles.transform.Find("armor_demo").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_4, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_4_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_4_2, pos); + break; + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["tapestry_a"].speed = 0.4f + Random.value * 0.2f; + m_FieldAnimatorDictionary["tapestry_b"].speed = 0.4f + Random.value * 0.2f; + m_RandomActionTime = 20f; + _battleCamera.Camera.transform.localPosition = new Vector3(-460f, 85f, -100f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-25f, -97f, 93f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(880f, -545f, -50f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-25f, -97f, 93f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(0.5f); + m_FieldAnimatorDictionary["armor"].SetTrigger("Threat"); + _fieldParticleSystemDictionary["armor_threat"].Play(); + yield return new WaitForSeconds(1.5f); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(240f, -250f, -400f), "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeInExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-5f, -5f, 40f), "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeInExpo)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 1f, "delay", 1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 1f, "delay", 1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(1f); + _fieldObjDictionary["chandelier"].SetActive(value: false); + yield return new WaitForSeconds(0.2f); + _fieldObjDictionary["chandelier"].SetActive(value: true); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + int num = Random.Range(1, 3); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_{num}", "se_field_" + _str3DFieldNo, 0f, 0L); + switch (num) + { + case 1: + m_FieldAnimatorDictionary["armor"].SetTrigger("Threat"); + _fieldParticleSystemDictionary["armor_threat"].Play(); + yield return new WaitForSeconds(1f); + break; + case 2: + m_FieldAnimatorDictionary["armor"].SetTrigger("Demo"); + _fieldParticleSystemDictionary["armor_demo"].Play(); + yield return new WaitForSeconds(7.1f); + break; + } + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + m_FieldAnimatorDictionary["armor"].SetTrigger("Shake"); + m_FieldAnimatorDictionary["chandelier"].SetTrigger("Shake"); + m_FieldAnimatorDictionary["tapestry_a"].speed = 0.8f + Random.value * 0.4f; + m_FieldAnimatorDictionary["tapestry_b"].speed = 0.8f + Random.value * 0.4f; + m_FieldAnimatorDictionary["tapestry_a"].SetTrigger("Shake"); + m_FieldAnimatorDictionary["tapestry_b"].SetTrigger("Shake"); + yield return new WaitForSeconds(3f); + m_FieldAnimatorDictionary["tapestry_a"].speed = 0.4f + Random.value * 0.2f; + m_FieldAnimatorDictionary["tapestry_b"].speed = 0.4f + Random.value * 0.2f; + yield return new WaitForSeconds(0f); + } + + public override void UpdateFieldRandom() + { + if (IsFieldRandom) + { + m_RandomActionTime -= Time.deltaTime; + if (m_RandomActionTime <= 0f) + { + m_FieldAnimatorDictionary["tapestry_a"].SetTrigger("LoopRandom"); + m_FieldAnimatorDictionary["tapestry_b"].SetTrigger("LoopRandom"); + m_RandomActionTime = Random.value * 20f + 20f; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/RoyalPalaceNightField.cs b/SVSim.BattleEngine/Engine/RoyalPalaceNightField.cs new file mode 100644 index 0000000..452776a --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoyalPalaceNightField.cs @@ -0,0 +1,11 @@ +public class RoyalPalaceNightField : RoyalPalaceField +{ + public override int FieldId => 14; + + public override int FieldEffectId => 4; + + public RoyalPalaceNightField(string bgmId = "NONE") + : base(bgmId) + { + } +} diff --git a/SVSim.BattleEngine/Engine/SearchUserInfo.cs b/SVSim.BattleEngine/Engine/SearchUserInfo.cs new file mode 100644 index 0000000..2400b02 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SearchUserInfo.cs @@ -0,0 +1,9 @@ +public class SearchUserInfo : HeaderData +{ + public SearchUserInfoDetail data; + + public void Initizalize() + { + data = new SearchUserInfoDetail(); + } +} diff --git a/SVSim.BattleEngine/Engine/SearchUserInfoDetail.cs b/SVSim.BattleEngine/Engine/SearchUserInfoDetail.cs new file mode 100644 index 0000000..97b2385 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SearchUserInfoDetail.cs @@ -0,0 +1,4 @@ +public class SearchUserInfoDetail +{ + public UserFriend user; +} diff --git a/SVSim.BattleEngine/Engine/SelfBattlePlayerFilter.cs b/SVSim.BattleEngine/Engine/SelfBattlePlayerFilter.cs new file mode 100644 index 0000000..b24fda6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SelfBattlePlayerFilter.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using Wizard; + +public class SelfBattlePlayerFilter : ISkillBattlePlayerFilter +{ + public IEnumerable Filtering(BattlePlayerReadOnlyInfoPair playerInfoPair) + { + yield return playerInfoPair.ReadOnlySelf; + } +} diff --git a/SVSim.BattleEngine/Engine/SendFriendApplyInfo.cs b/SVSim.BattleEngine/Engine/SendFriendApplyInfo.cs new file mode 100644 index 0000000..77429ce --- /dev/null +++ b/SVSim.BattleEngine/Engine/SendFriendApplyInfo.cs @@ -0,0 +1,9 @@ +public class SendFriendApplyInfo : HeaderData +{ + public SendFriendApplyInfoDetail data; + + public void Initizalize() + { + data = new SendFriendApplyInfoDetail(); + } +} diff --git a/SVSim.BattleEngine/Engine/SendFriendApplyInfoDetail.cs b/SVSim.BattleEngine/Engine/SendFriendApplyInfoDetail.cs new file mode 100644 index 0000000..ee590ac --- /dev/null +++ b/SVSim.BattleEngine/Engine/SendFriendApplyInfoDetail.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +public class SendFriendApplyInfoDetail +{ + public List applyList = new List(); + + public int remainingApplyCount; + + public int sendApplyMaxCount; +} diff --git a/SVSim.BattleEngine/Engine/ShopSupplyCardPanel.cs b/SVSim.BattleEngine/Engine/ShopSupplyCardPanel.cs new file mode 100644 index 0000000..ca6f8a5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ShopSupplyCardPanel.cs @@ -0,0 +1,29 @@ +using Cute; +using Wizard; + +internal class ShopSupplyCardPanel : MyPageCardPanel +{ + private const string SPECIAL_SUPPLY_CARD_PANEL_TEXTURE = "menu_shop_sleeve_special"; + + public bool IsLoadedDefaultCardPanelResource { get; private set; } + + public bool IsLoadedSpecialCardPanelResource { get; private set; } + + public override string GetResourcePath(bool isfetch) + { + ShopNotification shopNotification = Data.MyPageNotifications.data.ShopNotification; + if (shopNotification.AppealSleeve.IsCollaborationPanel || shopNotification.AppealLeaderSkin.IsCollaborationPanel) + { + if (!isfetch) + { + IsLoadedSpecialCardPanelResource = true; + } + return Toolbox.ResourcesManager.GetAssetTypePath("menu_shop_sleeve_special", ResourcesManager.AssetLoadPathType.UiDownLoad, isfetch); + } + if (!isfetch) + { + IsLoadedDefaultCardPanelResource = true; + } + return base.GetResourcePath(isfetch); + } +} diff --git a/SVSim.BattleEngine/Engine/SimpleCardDetail.cs b/SVSim.BattleEngine/Engine/SimpleCardDetail.cs new file mode 100644 index 0000000..6877ce3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SimpleCardDetail.cs @@ -0,0 +1,411 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Battle.View; + +public class SimpleCardDetail : CardDetailBase +{ + private const string EVO_EFFECT_PATH = "cmn_deckedit_evo_1"; + + private int _cardID; + + [SerializeField] + private Transform _offset; + + [SerializeField] + private UILabel _attackLabel; + + [SerializeField] + private UILabel _lifeLabel; + + [SerializeField] + private BoxCollider _skillCollider; + + [SerializeField] + private UISprite _evoPanel; + + [SerializeField] + private UILabel _evoAttackLabel; + + [SerializeField] + private UILabel _evoLifeLabel; + + [SerializeField] + private BoxCollider _skillColliderEvo; + + [SerializeField] + private CardCraftPanel _craftPanel; + + [SerializeField] + private UIWidget _myRotationAnchor; + + [SerializeField] + private Transform _myRotationAnchorTargetWithEvol; + + [SerializeField] + private Transform _myRotationAnchorTargetNoEvol; + + [SerializeField] + private GameObject _myRotationRoot; + + [SerializeField] + private UILabel _myRotationLabel; + + [SerializeField] + private BoxCollider _closeCollider; + + [SerializeField] + private PurchaseConfirm _purchaseConfirmPrefab; + + [SerializeField] + private UITweener[] _openTween; + + private CardMake _cardMaker; + + private List _buffList; + + private BoxCollider _craftPanelCollider; + + private DetailPanelInfo _currentPanel; + + private CardMaster.CardMasterId _cardMasterId = CardMaster.CardMasterId.Default; + + public bool IsVisible { get; set; } + + public int CardID + { + get + { + return _cardID; + } + private set + { + CardParam = CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(_cardID = value); + if (CardParam != null) + { + if (CardParam.CharType == CardBasePrm.CharaType.NORMAL) + { + _currentPanel = _followerPanel; + _followerPanel._root.SetActive(value: true); + _nonFollowerPanel._root.SetActive(value: false); + } + else + { + _currentPanel = _nonFollowerPanel; + _followerPanel._root.SetActive(value: false); + _nonFollowerPanel._root.SetActive(value: true); + } + } + } + } + + private CardParameter CardParam { get; set; } + + public bool IsDetailPanelDragging { get; private set; } + + public event Action OnClickCloseButton; + + public event Action OnClickCreateButton; + + public event Action OnClickLiquefyButton; + + private void Awake() + { + _currentPanel = _followerPanel; + } + + private void Start() + { + _cardMaker = base.gameObject.AddComponent(); + _cardMaker.OnCardBuy = delegate + { + UpdateCraftPanel(); + this.OnClickCreateButton.Call(); + }; + _cardMaker.OnCardSellId = delegate(int cardId) + { + UpdateCraftPanel(); + this.OnClickLiquefyButton.Call(cardId); + }; + if ((bool)_closeCollider) + { + UIEventListener.Get(_closeCollider.gameObject).onClick = delegate + { + this.OnClickCloseButton.Call(); + }; + } + Action onClickCreateBtn = delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OpenCraftDialog(delegate + { + _cardMaker.StartCardCraft(CardID); + }, buy: true); + }; + Action onClickDestructBtn = delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OpenCraftDialog(delegate + { + _cardMaker.StartCardDestruct(CardID); + }, buy: false); + }; + _craftPanel.Init(onClickCreateBtn, onClickDestructBtn); + UIEventListener.Get(_followerPanel.DiscCollider.gameObject).onClick = delegate + { + if (UIManager.GetInstance().IsTouchable) + { + OpenSkillInfo(_followerPanel.DiscLabel, isEvol: false); + } + }; + BattlePlayerView.SetKeyWordColor(_followerPanel.DiscCollider.gameObject, _followerPanel.DiscLabel); + UIEventListener.Get(_followerEvoPanel.DiscCollider.gameObject).onClick = delegate + { + if (UIManager.GetInstance().IsTouchable) + { + OpenSkillInfo(_followerEvoPanel.DiscLabel, isEvol: true); + } + }; + BattlePlayerView.SetKeyWordColor(_followerEvoPanel.DiscCollider.gameObject, _followerEvoPanel.DiscLabel); + UIEventListener.Get(_nonFollowerPanel.DiscCollider.gameObject).onClick = delegate + { + OpenSkillInfo(_nonFollowerPanel.DiscLabel, isEvol: false); + }; + BattlePlayerView.SetKeyWordColor(_nonFollowerPanel.DiscCollider.gameObject, _nonFollowerPanel.DiscLabel); + _followerPanel.Initialize(); + _nonFollowerPanel.Initialize(); + _followerEvoPanel.Initialize(); + _craftPanelCollider = _craftPanel.GetComponent(); + HideDetail(); + } + + public void ChangeDetail(int id, CardMaster.CardMasterId cardMasterId, MyRotationInfo myRotationInfo = null) + { + if (!IsVisible || CardID != id) + { + _cardMasterId = cardMasterId; + CardID = id; + UpdateFirstPanel(); + UpdateEvoPanel(); + UpdateCraftPanel(); + UpdateMyRotationPanel(myRotationInfo); + Load(); + } + } + + public void ShowDetail() + { + IsVisible = true; + if ((bool)_closeCollider) + { + _closeCollider.gameObject.SetActive(value: true); + } + for (int i = 0; i < _openTween.Length; i++) + { + if (_openTween[i] != null) + { + _openTween[i].PlayForward(); + } + } + ActivePanelColliders(isActive: true); + _currentPanel._root.SetActive(value: true); + } + + public void HideDetail() + { + IsVisible = false; + if ((bool)_closeCollider) + { + _closeCollider.gameObject.SetActive(value: false); + } + if (base.gameObject.activeInHierarchy) + { + for (int i = 0; i < _openTween.Length; i++) + { + if (_openTween[i] != null) + { + _openTween[i].PlayReverse(); + } + } + } + ActivePanelColliders(isActive: false); + _followerEvoPanel._root.SetActive(value: false); + _currentPanel._root.SetActive(value: false); + IsDetailPanelDragging = false; + } + + public void SetLocalOffset(Vector3 pos) + { + _offset.localPosition = pos; + } + + public void ActiveCraftPanel(bool isActive) + { + _craftPanel.gameObject.SetActive(isActive); + UpdateCraftPanel(); + } + + public void ActiveCloseCollider(bool isActive) + { + _closeCollider.enabled = isActive; + } + + private void ActivePanelColliders(bool isActive) + { + _skillColliderEvo.enabled = isActive; + _skillCollider.enabled = isActive; + _craftPanelCollider.enabled = isActive; + } + + private void Load() + { + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + _currentPanel._logImage.mainTexture = resourcesManager.LoadObject(GetIllustPath(CardID, isFetch: true)) as Texture; + ShowDetail(); + } + + private void UpdateFirstPanel() + { + if (CardParam != null) + { + bool flag = CardParam.CharType == CardBasePrm.CharaType.NORMAL; + _attackLabel.gameObject.SetActive(flag); + _lifeLabel.gameObject.SetActive(flag); + _currentPanel._nameLabel.text = CardParam.CardName; + _currentPanel._costLabel.text = CardParam.Cost.ToString(); + _attackLabel.text = CardParam.Atk.ToString(); + _lifeLabel.text = CardParam.Life.ToString(); + if (!flag) + { + SetDescLabelText(_currentPanel, CardParam.ConvertedSkillDescription); + } + _currentPanel._classLabel.text = GameMgr.GetIns().GetDataMgr().GetClanNameByKey((int)CardParam.Clan); + if (CardParam.TribeName != "ALL") + { + UILabel classLabel = _currentPanel._classLabel; + classLabel.text = classLabel.text + "/" + CardParam.TribeName; + } + _currentPanel._classBG.spriteName = string.Format("battle_card_info_{0}", ((int)CardParam.Clan).ToString("00")); + } + } + + private void UpdateEvoPanel() + { + if (CardParam != null) + { + bool flag = CardParam.CharType == CardBasePrm.CharaType.NORMAL; + _followerEvoPanel._root.gameObject.SetActive(flag); + _evoAttackLabel.text = CardParam.EvoAtk.ToString(); + _evoLifeLabel.text = CardParam.EvoLife.ToString(); + if (flag) + { + SetFollowerDetailLabel(CardParam.ConvertedSkillDescription, CardParam.ConvertedEvoSkillDescription, needEvolutionOrFusionButton: false); + } + } + } + + private void SetDragEvent(BoxCollider dragCollider) + { + UIEventListener.Get(dragCollider.gameObject).onDragStart = delegate + { + IsDetailPanelDragging = true; + }; + UIEventListener.Get(dragCollider.gameObject).onDragEnd = delegate + { + IsDetailPanelDragging = false; + }; + } + + private void UpdateCraftPanel() + { + if (CardParam != null && !(_craftPanel == null) && _craftPanel.gameObject.activeInHierarchy) + { + _craftPanel.UpdateCraftPanel(CardParam); + } + } + + private void UpdateMyRotationPanel(MyRotationInfo myRotationInfo) + { + if (CardParam == null) + { + return; + } + _myRotationRoot.SetActive(myRotationInfo != null); + if (myRotationInfo != null) + { + if (CardParam.CharType == CardBasePrm.CharaType.NORMAL) + { + _myRotationAnchor.topAnchor.target = _myRotationAnchorTargetWithEvol; + _myRotationAnchor.bottomAnchor.target = _myRotationAnchorTargetWithEvol; + } + else + { + _myRotationAnchor.topAnchor.target = _myRotationAnchorTargetNoEvol; + _myRotationAnchor.bottomAnchor.target = _myRotationAnchorTargetNoEvol; + } + _myRotationAnchor.ResetAndUpdateAnchors(); + CardParameter cardParameter = CardParam; + if (cardParameter.IsPrizeCard || cardParameter.IsCollaboCard) + { + cardParameter = CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(cardParameter.BaseCardId); + } + string cardSetId = cardParameter.CardSetId; + CardSetName cardSetName = Data.Master.CardSetNameMgr.Get(cardSetId); + string text = (int.Parse(cardSetId) - 10000).ToString(); + string id = "MyRotation_ID_09"; + if (int.Parse(cardSetId) == 10000) + { + id = "MyRotation_ID_10"; + } + _myRotationLabel.text = Data.SystemText.Get(id, cardSetName.LongName, cardSetName.ShortName, text); + } + } + + private void OpenSkillInfo(UILabel label, bool isEvol) + { + CardParameter cardParameterFromId = CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(CardID); + if (cardParameterFromId != null && (isEvol ? cardParameterFromId.EvoSkillDescription : cardParameterFromId.SkillDescription).Length > 0 && BattlePlayerView.HasKeyword(cardParameterFromId) && !UIManager.GetInstance().isOpenDialog()) + { + BattlePlayerView.CreateKeyPanel(cardParameterFromId.ConvertedSkillDescription + cardParameterFromId.ConvertedEvoSkillDescription, label, _cardMasterId); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + } + } + + private void OpenCraftDialog(Action onOk, bool buy) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + PurchaseConfirm purchaseConfirm = UnityEngine.Object.Instantiate(_purchaseConfirmPrefab); + dialogBase.SetObj(purchaseConfirm.gameObject); + int userRedEtherCount = PlayerStaticData.UserRedEtherCount; + SystemText systemText = Data.SystemText; + CardParameter cardParameterFromId = CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(CardID); + if (buy) + { + dialogBase.SetTitleLabel(systemText.Get("Card_0081")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("Dia_CardList_003_Button")); + int useRedEther = cardParameterFromId.UseRedEther; + purchaseConfirm.SetCardBuy(systemText.Get("Common_0205"), userRedEtherCount, useRedEther, cardParameterFromId); + } + else + { + dialogBase.SetTitleLabel(systemText.Get("Card_0080")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.RedBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("Dia_CardList_002_Button")); + int getRedEther = cardParameterFromId.GetRedEther; + purchaseConfirm.SetCardSell(systemText.Get("Common_0205"), userRedEtherCount, getRedEther, cardParameterFromId.CardName, cardParameterFromId.IsFoil); + } + dialogBase.onPushButton1 = onOk; + } + + private string GetIllustPath(int id, bool isFetch) + { + CardMaster instance = CardMaster.GetInstance(_cardMasterId); + CardParameter cardParameterFromId = instance.GetCardParameterFromId(id); + string path = instance.GetCardParameterFromId(cardParameterFromId.NormalCardId).ResourceCardId + "0"; + ResourcesManager.AssetLoadPathType type = ((cardParameterFromId.CharType == CardBasePrm.CharaType.NORMAL || CardMaster.IsMutationCardCheck(cardParameterFromId.BaseCardId)) ? ResourcesManager.AssetLoadPathType.UnitHeader : ResourcesManager.AssetLoadPathType.OtherHeader); + return Toolbox.ResourcesManager.GetAssetTypePath(path, type, isFetch); + } +} diff --git a/SVSim.BattleEngine/Engine/SingleBattleMgr.cs b/SVSim.BattleEngine/Engine/SingleBattleMgr.cs new file mode 100644 index 0000000..cd5849b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SingleBattleMgr.cs @@ -0,0 +1,434 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using Wizard; +using Wizard.Battle; +using Wizard.Battle.Recovery; +using Wizard.Battle.View.Vfx; +using Wizard.BattleMgr; + +public class SingleBattleMgr : BattleManagerBase +{ + private bool? _isPlayerFirstTurn; + + public IBattleMgrContentsCreator ContentsCreator => _contentsCreator; + + public AIBattleInfoReceiver BattleInfoReceiver { get; protected set; } + + public event Action OnBattleRetire; + + public SingleBattleMgr(IBattleMgrContentsCreator contentsCreator) + : base(contentsCreator) + { + } + + public override IInnerOptionsBuilder CreateEnemyInnerOptionsBuilder() + { + return new EnemyAIInnerOptionsBuilder(); + } + + protected override void SetupEvent() + { + base.SetupEvent(); + BattlePlayer.OnShortageDeck += () => OnShortageDeck(BattlePlayer); + BattleEnemy.OnShortageDeck += () => OnShortageDeck(BattleEnemy); + BattlePlayer.OnTurnEndFinish += delegate + { + base.IsTurnEnd = false; + VfxBase result = ControlTurnStartOpponent(); + base.IsTurnEnd = true; + return result; + }; + BattleEnemy.OnTurnEndFinish += delegate + { + base.IsTurnEnd = false; + VfxBase result = ControlTurnStartPlayer(); + base.IsTurnEnd = true; + return result; + }; + } + + public override void SetupBattlePlayersEvent() + { + base.SetupBattlePlayersEvent(); + if (BattlePlayer.PlayerEmotion.IsContainsEmotionType(ClassCharaPrm.EmotionType.NEGOTIATION_1)) + { + SetUpStoryNegotiationsEmote(); + } + if (BattlePlayer.PlayerEmotion.IsContainsEmotionType(ClassCharaPrm.EmotionType.PLAYER_TURN_START_1)) + { + SetUpStoryPlayerTurnStartEmote(); + } + switch (GameMgr.GetIns().GetDataMgr().m_BattleType) + { + case DataMgr.BattleType.BossRushQuest: + case DataMgr.BattleType.SecretBossQuest: + SetUpBossRushSpecialSkill(); + break; + case DataMgr.BattleType.Story: + case DataMgr.BattleType.Quest: + SetUpStorySpecialBattle(); + break; + } + } + + private void SetUpBossRushSpecialSkill() + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + DataMgr.SpecialBattleSetting specialBattleSettingInfo = dataMgr.SpecialBattleSettingInfo; + BossRushBattleData bossRushBattleData = dataMgr.BossRushBattleData; + if (specialBattleSettingInfo == null || bossRushBattleData == null) + { + return; + } + _isPlayerFirstTurn = specialBattleSettingInfo.IsPlayerFirstTurn; + BattlePlayer.PpTotal = specialBattleSettingInfo.PlayerStartPp; + BattleEnemy.PpTotal = specialBattleSettingInfo.EnemyStartPp; + BattlePlayer.SetPpTotal(BattlePlayer.PpTotal, isUpdatePp: true, null); + BattleEnemy.SetPpTotal(BattleEnemy.PpTotal, isUpdatePp: true, null); + string[] playerAttachSkills = specialBattleSettingInfo.PlayerAttachSkills; + string[] enemyAttachSkills = specialBattleSettingInfo.EnemyAttachSkills; + List list = new List(); + if (bossRushBattleData.PlayerSkillList != null) + { + list.AddRange(bossRushBattleData.PlayerSkillList); + } + if (bossRushBattleData.EnemySkill != null) + { + list.Add(bossRushBattleData.EnemySkill); + } + List list2 = new List(); + for (int i = 0; i < list.Count(); i++) + { + for (int num = 0; num < list.ElementAt(i).SkillText.Split(',').Length; num++) + { + list2.Add(list.ElementAt(i)); + } + } + List source = SetUpAttachSkill(playerAttachSkills, enemyAttachSkills); + for (int j = 0; j < source.Count(); j++) + { + AttachInfo attachInfo = source.ElementAt(j); + BossRushSpecialSkill bossRushSpecialSkill = list2.ElementAt(j); + if (attachInfo._classCard.SelfBattlePlayer.IsPlayer) + { + attachInfo._attachSkill.SkillPrm.ownerCard = CardCreatorBase.CreateSpecialSkillCard(bossRushSpecialSkill.OriginalCardId, attachInfo._classCard.SelfBattlePlayer.IsPlayer, 0, SBattleLoad, this, base.BattleResourceMgr, NullInnerOptionsBuilder.GetInstance(), list2.ElementAt(j)); + } + attachInfo._classCard.SelfBattlePlayer.BossRushSpecialSkillList.Add(bossRushSpecialSkill); + BuffInfo buffInfo = new BuffInfo(attachInfo._attachSkill.SkillPrm.ownerCard.BaseParameter.BaseCardId, attachInfo._attachSkill.SkillPrm.ownerCard.BaseParameter.BaseCardId, attachInfo._attachSkill); + buffInfo.SpecialSkillInfo = bossRushSpecialSkill; + buffInfo.SkillFrom.SkillPrm.ownerCard = attachInfo._attachSkill.SkillPrm.ownerCard; + attachInfo._classCard.AddBuffInfo(buffInfo); + } + } + + protected virtual void SetUpStoryNegotiationsEmote() + { + Func callOneTime = null; + if (BattleEnemy.Turn == 0) + { + callOneTime = delegate + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_OTHER_PLAYER_EMOTE)) + { + BattleEnemy.OnTurnStartBeforeDraw -= callOneTime; + sequentialVfxPlayer.Register(BattleEnemy.Emotion.PlayEmotion(ClassCharaPrm.EmotionType.NEGOTIATION_1, 0f)); + sequentialVfxPlayer.Register(new OpeningVfx.WaitVoiceEndVfx()); + sequentialVfxPlayer.Register(BattlePlayer.Emotion.PlayEmotion(ClassCharaPrm.EmotionType.NEGOTIATION_1, 0f)); + SetUpStoryNegotiationsEmote(); + } + return sequentialVfxPlayer; + }; + BattleEnemy.OnTurnStartBeforeDraw += callOneTime; + } + else if (BattleEnemy.Turn == 1) + { + callOneTime = delegate + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_OTHER_PLAYER_EMOTE)) + { + BattleEnemy.OnTurnStartBeforeDraw -= callOneTime; + sequentialVfxPlayer.Register(BattleEnemy.Emotion.PlayEmotion(ClassCharaPrm.EmotionType.NEGOTIATION_2, 0f)); + sequentialVfxPlayer.Register(new OpeningVfx.WaitVoiceEndVfx()); + sequentialVfxPlayer.Register(BattlePlayer.Emotion.PlayEmotion(ClassCharaPrm.EmotionType.NEGOTIATION_2, 0f)); + SetUpStoryNegotiationsEmote(); + } + return sequentialVfxPlayer; + }; + BattleEnemy.OnTurnStartBeforeDraw += callOneTime; + } + else + { + if (BattleEnemy.Turn != 2) + { + return; + } + callOneTime = delegate + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_OTHER_PLAYER_EMOTE)) + { + BattleEnemy.OnTurnStartBeforeDraw -= callOneTime; + sequentialVfxPlayer.Register(BattleEnemy.Emotion.PlayEmotion(ClassCharaPrm.EmotionType.NEGOTIATION_3, 0f)); + sequentialVfxPlayer.Register(new OpeningVfx.WaitVoiceEndVfx()); + sequentialVfxPlayer.Register(BattlePlayer.Emotion.PlayEmotion(ClassCharaPrm.EmotionType.NEGOTIATION_3, 0f)); + SetUpStoryNegotiationsEmote(); + } + return sequentialVfxPlayer; + }; + BattleEnemy.OnTurnStartBeforeDraw += callOneTime; + } + } + + private void SetUpStoryPlayerTurnStartEmote() + { + Func callOneTime = null; + if (BattlePlayer.Turn == 0) + { + callOneTime = delegate + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattlePlayer.OnTurnStartBeforeDraw -= callOneTime; + sequentialVfxPlayer.Register(BattlePlayer.Emotion.PlayEmotion(ClassCharaPrm.EmotionType.PLAYER_TURN_START_1, 0f)); + sequentialVfxPlayer.Register(new OpeningVfx.WaitVoiceEndVfx()); + return sequentialVfxPlayer; + }; + BattlePlayer.OnTurnStartBeforeDraw += callOneTime; + } + } + + private void SetUpStorySpecialBattle() + { + DataMgr.SpecialBattleSetting specialBattleSettingInfo = GameMgr.GetIns().GetDataMgr().SpecialBattleSettingInfo; + if (specialBattleSettingInfo != null) + { + _isPlayerFirstTurn = specialBattleSettingInfo.IsPlayerFirstTurn; + SetUpAttachSkill(specialBattleSettingInfo.PlayerAttachSkills, specialBattleSettingInfo.EnemyAttachSkills); + BattlePlayer.PpTotal = specialBattleSettingInfo.PlayerStartPp; + BattleEnemy.PpTotal = specialBattleSettingInfo.EnemyStartPp; + BattlePlayer.SetPpTotal(BattlePlayer.PpTotal, isUpdatePp: true, null); + BattleEnemy.SetPpTotal(BattleEnemy.PpTotal, isUpdatePp: true, null); + } + } + + private List SetUpAttachSkill(string[] playerAttachSkills, string[] enemyAttachSkills) + { + List list = new List(); + for (int i = 0; i < playerAttachSkills.Length; i++) + { + AttachInfo attachInfo = AddAttachSkillToClass(isPlayer: true, playerAttachSkills[i]); + if (attachInfo != null) + { + list.Add(attachInfo); + } + } + for (int j = 0; j < enemyAttachSkills.Length; j++) + { + AttachInfo attachInfo2 = AddAttachSkillToClass(isPlayer: false, enemyAttachSkills[j]); + if (attachInfo2 != null) + { + list.Add(attachInfo2); + } + } + for (int k = 0; k < list.Count; k++) + { + AttachInfo attachInfo3 = list[k]; + SkillBase skillBase = Skill_attach_skill.CreateAndAttachSkill(attachInfo3._classCard, attachInfo3._attachSkill, attachInfo3._targetSkillBuildInfo); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(skillBase.SkillPrm.buildInfo._effectPath, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true); + skillBase.SkillPrm.resourceMgr.LoadEffectBattle(assetTypePath, skillBase.SkillPrm.buildInfo._effectPath, skillBase.SkillPrm.buildInfo._sePath); + } + return list; + } + + public void SingleBattleFirstRecoverySetting() + { + StartRecoveryRecording(); + } + + protected override void FirstRecoverySetting() + { + EmotionDataSetting(); + } + + private void EmotionDataSetting() + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + if (dataMgr.m_BattleType != DataMgr.BattleType.Story) + { + if (dataMgr.m_BattleType == DataMgr.BattleType.Quest) + { + string playerEmotionId = ((dataMgr.QuestBattleData != null && dataMgr.QuestBattleData.PlayerEmotionOverride != 0) ? dataMgr.QuestBattleData.PlayerEmotionOverride.ToString() : string.Empty); + dataMgr.SetPlayerEmotionId(playerEmotionId); + } + else if (dataMgr.m_BattleType == DataMgr.BattleType.BossRushQuest || dataMgr.m_BattleType == DataMgr.BattleType.SecretBossQuest) + { + string playerEmotionId2 = ((dataMgr.BossRushBattleData != null && dataMgr.BossRushBattleData.PlayerEmotionOverride != 0) ? dataMgr.BossRushBattleData.PlayerEmotionOverride.ToString() : string.Empty); + dataMgr.SetPlayerEmotionId(playerEmotionId2); + } + else + { + dataMgr.SetPlayerEmotionId(""); + } + } + if (dataMgr.m_BattleType != DataMgr.BattleType.Story) + { + if (dataMgr.m_BattleType == DataMgr.BattleType.Quest) + { + string enemyEmotionId = ((dataMgr.QuestBattleData != null && dataMgr.QuestBattleData.EnemyEmotionOverride != 0) ? dataMgr.QuestBattleData.EnemyEmotionOverride.ToString() : string.Empty); + dataMgr.SetEnemyEmotionId(enemyEmotionId); + } + else if (dataMgr.m_BattleType == DataMgr.BattleType.BossRushQuest || dataMgr.m_BattleType == DataMgr.BattleType.SecretBossQuest) + { + string enemyEmotionId2 = ((dataMgr.BossRushBattleData != null && dataMgr.BossRushBattleData.EnemyEmotionOverride != 0) ? dataMgr.BossRushBattleData.EnemyEmotionOverride.ToString() : string.Empty); + dataMgr.SetEnemyEmotionId(enemyEmotionId2); + } + else + { + dataMgr.SetEnemyEmotionId(""); + } + } + } + + protected override int GetFirstAttack(int FirstAttack) + { + bool? didPlayerGoFirst = _contentsCreator.RecoveryManager.DidPlayerGoFirst; + if (didPlayerGoFirst.HasValue) + { + if (!didPlayerGoFirst.Value) + { + return 1; + } + return 0; + } + if (_isPlayerFirstTurn.HasValue) + { + if (_isPlayerFirstTurn == true) + { + return 0; + } + return 1; + } + return base.GetFirstAttack(FirstAttack); + } + + public override void SetupEnemyAI() + { + EnemyAI enemyAI = new SoloBattleEnemyAI(); + enemyAI.LoadBufferedBattleState(); + EnemyAI = enemyAI; + BattleInfoReceiver = new AIBattleInfoReceiver(EnemyAI); + EnemyAI.InitOnGame(BattleEnemy, BattlePlayer); + if (!enemyAI.IsRankMatchAI) + { + enemyAI.EmoteCtrl().SetUpEmoteEvent(BattleEnemy, BattlePlayer, OperateMgr); + } + BattleEnemy.EnableEnemyAI = true; + } + + public override void SetupInitialGameState(bool isPlayerFirstTurn, bool isRandomDraw, int playerMaxLife, int enemyMaxLife) + { + enemyMaxLife = AITestGlobal.AI_MAX_LIFE; + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + DataMgr.SpecialBattleSetting specialBattleSettingInfo = dataMgr.SpecialBattleSettingInfo; + if ((dataMgr.m_BattleType == DataMgr.BattleType.Story || dataMgr.IsQuestBattleType()) && specialBattleSettingInfo != null) + { + if (dataMgr.m_BattleType != DataMgr.BattleType.BossRushQuest && dataMgr.m_BattleType != DataMgr.BattleType.SecretBossQuest) + { + playerMaxLife = specialBattleSettingInfo.PlayerStartMaxLife; + } + else + { + (BattlePlayer.Class as ClassBattleCardBase).BossRushStartLife = specialBattleSettingInfo.PlayerStartMaxLife; + } + enemyMaxLife = specialBattleSettingInfo.EnemyStartMaxLife; + } + if (dataMgr.m_BattleType == DataMgr.BattleType.Practice && Data.CurrentFormat == Format.Avatar) + { + dataMgr.SetPlayerAvatarBattleInfo(dataMgr.GetPlayerCharaId().ToString()); + dataMgr.ClearEnemyAvatarBattleInfo(); + } + base.SetupInitialGameState(isPlayerFirstTurn, isRandomDraw, playerMaxLife, enemyMaxLife); + if ((dataMgr.m_BattleType == DataMgr.BattleType.Story || dataMgr.IsQuestBattleType()) && specialBattleSettingInfo != null) + { + if ((dataMgr.m_BattleType == DataMgr.BattleType.BossRushQuest || dataMgr.m_BattleType == DataMgr.BattleType.SecretBossQuest) && specialBattleSettingInfo.PlayerStartMaxLife > playerMaxLife) + { + BattlePlayer.Class.SkillApplyInformation.GiveCombatValueModifier(null, new MaxLifeSetModifier(specialBattleSettingInfo.PlayerStartMaxLife), null); + BattlePlayer.Class.ApplyHealing(new BattleCardBase.HealParam(specialBattleSettingInfo.PlayerStartMaxLife - BattlePlayer.Class.Life, BattlePlayer.Class, BattlePlayer.Class), null); + } + if (specialBattleSettingInfo.PlayerStartLife < specialBattleSettingInfo.PlayerStartMaxLife) + { + BattlePlayer.Class.ApplyDamage(null, new BattleCardBase.DamageParam(specialBattleSettingInfo.PlayerStartMaxLife - specialBattleSettingInfo.PlayerStartLife, BattlePlayer.Class), doesAttackerPossessKiller: false, isReflectedDamage: false, null, null); + } + } + AITestGlobal.AI_MAX_LIFE = 20; + } + + public override void FinishBattle() + { + GameMgr.GetIns().GetDataMgr().ClearSpecialBattleSettingInfo(); + EnemyAI.StopEnemyAI(); + } + + public override void DisposeBattleGameObj() + { + base.DisposeBattleGameObj(); + BattleCoroutine.GetInstance().StopAllCoroutines(); + EnemyAICoroutine.GetInstance().StopAllCoroutines(); + } + + public void RecordChangeAI(string logicName, int operationQueueCount) + { + if (_contentsCreator.RecoveryRecordManager is SingleBattleRecoveryRecordManager singleBattleRecoveryRecordManager) + { + singleBattleRecoveryRecordManager.RecordChangeAI(logicName, operationQueueCount); + } + } + + public override void PlayRetire() + { + if (RecoveryRecordManagerBase.IsExistsSingleRecoveryFile() && GameMgr.GetIns().GetDataMgr().BossRushBattleData == null) + { + GameMgr.GetIns().GetDataMgr().SetRecoveryData(RecoveryOperationInfo.ReadRecoveryFile(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json")); + RecoveryRecordManagerBase.DeleteRecoveryFile(); + } + base.PlayRetire(); + this.OnBattleRetire.Call(); + } + + public override void Update(float dt) + { + base.Update(dt); + LifeZeroActivateLeonSkillIfNeeded(); + } + + public void LifeZeroActivateLeonSkillIfNeeded() + { + if (!BattleEnemy.Class.SkillApplyInformation.IsLifeZeroActivateLeonSkill) + { + return; + } + bool flag = false; + int num = BattleEnemy.Class.BaseMaxLife; + int num2 = BattleEnemy.Class.BaseMaxLife; + int count = BattleEnemy.Class.SkillApplyInformation.LifeModifierList.Count; + for (int i = 0; i < count; i++) + { + ICardLifeModifier cardLifeModifier = BattleEnemy.Class.SkillApplyInformation.LifeModifierList[i]; + num2 = cardLifeModifier.CalcMaxLife(num2); + num = cardLifeModifier.CalcLife(num); + num = Math.Min(num, num2); + if (num <= 0) + { + flag = true; + break; + } + } + if (BattleEnemy.Class.Life <= 0 || flag) + { + base.VfxMgr.RegisterSequentialVfx(((ClassBattleCardBase)BattleEnemy.Class).LifeZeroActivateLeonSkill()); + } + } +} diff --git a/SVSim.BattleEngine/Engine/SingleExecutionInfoCreator.cs b/SVSim.BattleEngine/Engine/SingleExecutionInfoCreator.cs new file mode 100644 index 0000000..3836d1b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SingleExecutionInfoCreator.cs @@ -0,0 +1,20 @@ +using Wizard; + +public class SingleExecutionInfoCreator : ExecutionInfoCreatorBase +{ + public SingleExecutionInfoCreator(SkillBase skill) + : base(skill) + { + } + + public override bool CheckCondition(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool isPrePlay, bool isSkipTargetAiSelect = false) + { + isSkipTargetAiSelect = !isPrePlay && IsSkipTargetAiSelect(); + return base.CheckCondition(playerInfoPair, option, isPrePlay, isSkipTargetAiSelect); + } + + public override bool IsSkipTargetAiSelect() + { + return IsSkipTargetSkill(_skill); + } +} diff --git a/SVSim.BattleEngine/Engine/SingleSkill_attach_skill.cs b/SVSim.BattleEngine/Engine/SingleSkill_attach_skill.cs new file mode 100644 index 0000000..7b80d89 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SingleSkill_attach_skill.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SingleSkill_attach_skill : Skill_attach_skill +{ + public SingleSkill_attach_skill(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override bool GiveSkill(List targets, SkillCreator.SkillBuildInfo buildInfo, CallParameter parameter, long banNum, int voiceIndex, bool isAttachEvolveSkill, ref ParallelVfxPlayer parallelVfx, ref SequentialVfxPlayer iconVfx) + { + bool result = base.GiveSkill(targets, buildInfo, parameter, banNum, voiceIndex, isAttachEvolveSkill, ref parallelVfx, ref iconVfx); + if (!AIBattleInfoReceiver.CheckCreatedValidEnemyAI() || targets == null) + { + return result; + } + AIBattleInfoReceiver instance = AIBattleInfoReceiver.GetInstance(); + if (instance == null) + { + AIBattleInfoReceiver.ShowNotFoundInstanceLog(); + return result; + } + for (int i = 0; i < targets.Count; i++) + { + BattleCardBase target = targets[i]; + instance.ReceiveAttachedSkillInfo(base.SkillPrm.ownerCard, target); + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityAccelerateFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityAccelerateFilter.cs new file mode 100644 index 0000000..e4e2c8b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityAccelerateFilter.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityAccelerateFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityAccelerateFilter(string optionText) + { + _parameterOptionText = optionText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasAccelerate; + switch (_parameterOptionText) + { + default: + yield break; + case "=": + hasAccelerate = true; + break; + case "!=": + hasAccelerate = false; + break; + } + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.HasSkillAccelerate == hasAccelerate) + { + yield return card; + } + } + } + + public bool IsOperaterEqual() + { + return _parameterOptionText switch + { + "=" => true, + "!=" => false, + _ => true, + }; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityBurialRiteFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityBurialRiteFilter.cs new file mode 100644 index 0000000..e9a6ef6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityBurialRiteFilter.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAbilityBurialRiteFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityBurialRiteFilter(string optionText) + { + _parameterOptionText = optionText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool flag = _parameterOptionText == "="; + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + if (cards.ElementAt(i).HasSkillBurialRite == flag) + { + list.Add(cards.ElementAt(i)); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityCantAttackAllFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityCantAttackAllFilter.cs new file mode 100644 index 0000000..6bd9f01 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityCantAttackAllFilter.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAbilityCantAttackAllFilter : ISkillCardFilter +{ + private readonly bool _hasCantAttack; + + public SkillAbilityCantAttackAllFilter(string op) + { + _hasCantAttack = op == "="; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = cards.ElementAt(i); + if (readOnlyBattleCardInfo.SkillApplyInformation.IsSkillCantAtkAll == _hasCantAttack) + { + list.Add(readOnlyBattleCardInfo); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityCrystallizeFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityCrystallizeFilter.cs new file mode 100644 index 0000000..cf290a9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityCrystallizeFilter.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityCrystallizeFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityCrystallizeFilter(string optionText) + { + _parameterOptionText = optionText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasCrystallize; + switch (_parameterOptionText) + { + default: + yield break; + case "=": + hasCrystallize = true; + break; + case "!=": + hasCrystallize = false; + break; + } + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.HasSkillCrystallize == hasCrystallize) + { + yield return card; + } + } + } + + public bool IsOperaterEqual() + { + return _parameterOptionText switch + { + "=" => true, + "!=" => false, + _ => true, + }; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityDestroyWhiteRitualFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityDestroyWhiteRitualFilter.cs new file mode 100644 index 0000000..f891241 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityDestroyWhiteRitualFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityDestroyWhiteRitualFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.HasSkillDestroyWhiteRitual) + { + yield return card; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityDrainFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityDrainFilter.cs new file mode 100644 index 0000000..18f5d60 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityDrainFilter.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityDrainFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityDrainFilter(string op) + { + _parameterOptionText = op; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasDrain; + if (_parameterOptionText == "=") + { + hasDrain = true; + } + else + { + if (!(_parameterOptionText == "!=")) + { + yield break; + } + hasDrain = false; + } + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.SkillApplyInformation.IsDrain == hasDrain) + { + yield return card; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityEnhanceFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityEnhanceFilter.cs new file mode 100644 index 0000000..27d3e50 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityEnhanceFilter.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAbilityEnhanceFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityEnhanceFilter(string optionText) + { + _parameterOptionText = optionText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasEnhance; + if (_parameterOptionText == "=") + { + hasEnhance = true; + } + else + { + if (!(_parameterOptionText == "!=")) + { + yield break; + } + hasEnhance = false; + } + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = cards.ElementAt(i); + if (readOnlyBattleCardInfo.HasSkillEnhance == hasEnhance) + { + yield return readOnlyBattleCardInfo; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityFusionFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityFusionFilter.cs new file mode 100644 index 0000000..f7abfed --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityFusionFilter.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAbilityFusionFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityFusionFilter(string optionText) + { + _parameterOptionText = optionText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool flag = _parameterOptionText == "="; + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = cards.ElementAt(i); + if (readOnlyBattleCardInfo.HasSkillFusion == flag) + { + list.Add(readOnlyBattleCardInfo); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityGuardFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityGuardFilter.cs new file mode 100644 index 0000000..1e33fb4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityGuardFilter.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityGuardFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityGuardFilter(string optionText) + { + _parameterOptionText = optionText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasGuard; + if (_parameterOptionText == "=") + { + hasGuard = true; + } + else + { + if (!(_parameterOptionText == "!=")) + { + yield break; + } + hasGuard = false; + } + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.SkillApplyInformation.IsGuard == hasGuard) + { + yield return card; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityKillerFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityKillerFilter.cs new file mode 100644 index 0000000..31a8225 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityKillerFilter.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityKillerFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityKillerFilter(string op) + { + _parameterOptionText = op; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasKiller; + if (_parameterOptionText == "=") + { + hasKiller = true; + } + else + { + if (!(_parameterOptionText == "!=")) + { + yield break; + } + hasKiller = false; + } + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.SkillApplyInformation.IsKiller == hasKiller) + { + yield return card; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityNecromanceFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityNecromanceFilter.cs new file mode 100644 index 0000000..fa2f96b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityNecromanceFilter.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAbilityNecromanceFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityNecromanceFilter(string optionText) + { + _parameterOptionText = optionText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool flag = _parameterOptionText == "="; + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + if (cards.ElementAt(i) is BattleCardBase battleCardBase && battleCardBase.HasSkillNecromance == flag) + { + list.Add(battleCardBase); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityQuickFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityQuickFilter.cs new file mode 100644 index 0000000..defdc86 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityQuickFilter.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityQuickFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityQuickFilter(string op) + { + _parameterOptionText = op; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasQuick; + if (_parameterOptionText == "=") + { + hasQuick = true; + } + else + { + if (!(_parameterOptionText == "!=")) + { + yield break; + } + hasQuick = false; + } + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.SkillApplyInformation.IsQuick == hasQuick) + { + yield return card; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityReanimateFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityReanimateFilter.cs new file mode 100644 index 0000000..406aa4d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityReanimateFilter.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAbilityReanimateFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityReanimateFilter(string optionText) + { + _parameterOptionText = optionText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool flag = _parameterOptionText == "="; + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = cards.ElementAt(i); + if (readOnlyBattleCardInfo.HasSkillReanimate == flag) + { + list.Add(readOnlyBattleCardInfo); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityRushFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityRushFilter.cs new file mode 100644 index 0000000..0e1dc9e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityRushFilter.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityRushFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityRushFilter(string op) + { + _parameterOptionText = op; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasRush; + if (_parameterOptionText == "=") + { + hasRush = true; + } + else + { + if (!(_parameterOptionText == "!=")) + { + yield break; + } + hasRush = false; + } + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.SkillApplyInformation.IsRush == hasRush) + { + yield return card; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilitySneakFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilitySneakFilter.cs new file mode 100644 index 0000000..0168dac --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilitySneakFilter.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilitySneakFilter : ISkillCardFilter +{ + private readonly string _parameterText; + + private readonly string _parameterOptionText; + + public SkillAbilitySneakFilter(string optionText) + { + _parameterOptionText = optionText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasSneak; + if (_parameterOptionText == "=") + { + hasSneak = true; + } + else + { + if (!(_parameterOptionText == "!=")) + { + yield break; + } + hasSneak = false; + } + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.SkillApplyInformation.IsSneak == hasSneak) + { + yield return card; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilitySpellChargeFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilitySpellChargeFilter.cs new file mode 100644 index 0000000..e791a28 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilitySpellChargeFilter.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilitySpellChargeFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilitySpellChargeFilter(string optionText) + { + _parameterOptionText = optionText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasSpellCharge; + if (_parameterOptionText == "=") + { + hasSpellCharge = true; + } + else + { + if (!(_parameterOptionText == "!=")) + { + yield break; + } + hasSpellCharge = false; + } + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.HasSpellCharge == hasSpellCharge) + { + yield return card; + } + } + } + + public string GetOptionParameter() + { + return _parameterOptionText; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityStackWhiteRitualFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityStackWhiteRitualFilter.cs new file mode 100644 index 0000000..747b391 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityStackWhiteRitualFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAbilityStackWhiteRitualFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.HasSkillStackWhiteRitual); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilitySuperSkyboundArtFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilitySuperSkyboundArtFilter.cs new file mode 100644 index 0000000..2ac34c5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilitySuperSkyboundArtFilter.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAbilitySuperSkyboundArtFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilitySuperSkyboundArtFilter(string op) + { + _parameterOptionText = op; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasSuperSkyboundArt; + if (_parameterOptionText == "=") + { + hasSuperSkyboundArt = true; + } + else + { + if (!(_parameterOptionText == "!=")) + { + yield break; + } + hasSuperSkyboundArt = false; + } + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = cards.ElementAt(i); + if (readOnlyBattleCardInfo.HasSuperSkyboundArt == hasSuperSkyboundArt) + { + yield return readOnlyBattleCardInfo; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityUnionBurstFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityUnionBurstFilter.cs new file mode 100644 index 0000000..b9e0208 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityUnionBurstFilter.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAbilityUnionBurstFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityUnionBurstFilter(string op) + { + _parameterOptionText = op; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasUnionBurst; + if (_parameterOptionText == "=") + { + hasUnionBurst = true; + } + else + { + if (!(_parameterOptionText == "!=")) + { + yield break; + } + hasUnionBurst = false; + } + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = cards.ElementAt(i); + if (readOnlyBattleCardInfo.HasUnionBurst == hasUnionBurst) + { + yield return readOnlyBattleCardInfo; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityWhenAttackFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityWhenAttackFilter.cs new file mode 100644 index 0000000..5a22763 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityWhenAttackFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityWhenAttackFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.HasWhenAttack) + { + yield return card; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityWhenDestroyFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityWhenDestroyFilter.cs new file mode 100644 index 0000000..3a139db --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityWhenDestroyFilter.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityWhenDestroyFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityWhenDestroyFilter(string optionText) + { + _parameterOptionText = optionText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasWhenDestroy = IsOperaterEqual(); + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.HasSkillWhenDestroy == hasWhenDestroy) + { + yield return card; + } + } + } + + public bool IsOperaterEqual() + { + return _parameterOptionText == "="; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityWhenEvolveFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityWhenEvolveFilter.cs new file mode 100644 index 0000000..d7e2ff2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityWhenEvolveFilter.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAbilityWhenEvolveFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + public SkillAbilityWhenEvolveFilter(string optionText) + { + _parameterOptionText = optionText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool flag = _parameterOptionText == "="; + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + if (cards.ElementAt(i).HasSkillWhenEvolve == flag) + { + list.Add(cards.ElementAt(i)); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityWhenFightFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityWhenFightFilter.cs new file mode 100644 index 0000000..0c46a32 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityWhenFightFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityWhenFightFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.HasWhenFight) + { + yield return card; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityWhenPlayFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityWhenPlayFilter.cs new file mode 100644 index 0000000..79ea1d1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityWhenPlayFilter.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityWhenPlayFilter : ISkillCardFilter +{ + private readonly string _parameterOptionText; + + private readonly bool _isOnlyNoSelect; + + public SkillAbilityWhenPlayFilter(string op, bool isOnlyNoSelect) + { + _parameterOptionText = op; + _isOnlyNoSelect = isOnlyNoSelect; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + bool hasWhenPlay = (IsOperaterEqual() ? true : false); + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.HasSkillWhenPlay(_isOnlyNoSelect) == hasWhenPlay) + { + yield return card; + } + } + } + + public bool IsOperaterEqual() + { + return _parameterOptionText switch + { + "=" => true, + "!=" => false, + _ => true, + }; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityWhenPlayNoSelectAndBurialRiteFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityWhenPlayNoSelectAndBurialRiteFilter.cs new file mode 100644 index 0000000..79d0e5d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityWhenPlayNoSelectAndBurialRiteFilter.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAbilityWhenPlayNoSelectAndBurialRiteFilter : ISkillCardFilter +{ + private readonly bool _isEqual; + + public SkillAbilityWhenPlayNoSelectAndBurialRiteFilter(string optionText) + { + _isEqual = optionText == "="; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + BattleCardBase battleCardBase = cards.ElementAt(i) as BattleCardBase; + IEnumerable source = battleCardBase.Skills.Where((SkillBase s) => s.IsWhenPlaySkill); + if ((source.Any((SkillBase s) => s.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessBurialRite)) && !source.Any((SkillBase s) => s.IsUserSelectType)) == _isEqual) + { + list.Add(battleCardBase); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAbilityWhiteRitualFilter.cs b/SVSim.BattleEngine/Engine/SkillAbilityWhiteRitualFilter.cs new file mode 100644 index 0000000..dff3aa9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAbilityWhiteRitualFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAbilityWhiteRitualFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.IsTribe(CardBasePrm.TribeType.WHITE_RITUAL)) + { + yield return card; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAllCardFilter.cs b/SVSim.BattleEngine/Engine/SkillAllCardFilter.cs new file mode 100644 index 0000000..bac22a1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAllCardFilter.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAllCardFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAttachingAbilityFilter.cs b/SVSim.BattleEngine/Engine/SkillAttachingAbilityFilter.cs new file mode 100644 index 0000000..c1f778a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAttachingAbilityFilter.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillAttachingAbilityFilter : ISkillTargetFilter +{ + private SkillFilterCreator.ContentKeyword _keyword; + + public SkillAttachingAbilityFilter(SkillFilterCreator.ContentKeyword keyword) + { + _keyword = keyword; + } + + public virtual IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + switch (_keyword) + { + case SkillFilterCreator.ContentKeyword.guard: + list = ((option.AttachingAbility.Skill is Skill_guard) ? option.AttachingAbility.TargetCards : list); + break; + case SkillFilterCreator.ContentKeyword.rush: + list = ((option.AttachingAbility.Skill is Skill_rush) ? option.AttachingAbility.TargetCards : list); + break; + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAttackIsLarger.cs b/SVSim.BattleEngine/Engine/SkillAttackIsLarger.cs new file mode 100644 index 0000000..8e83585 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAttackIsLarger.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAttackIsLarger : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo s) => s.Life > s.Atk); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAttackedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillAttackedCardFilter.cs new file mode 100644 index 0000000..8f080d0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAttackedCardFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAttackedCardFilter : ISkillCardFilter +{ + private bool isAttacked; + + public SkillAttackedCardFilter(string value) + { + isAttacked = value == "true"; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c is BattleCardBase && isAttacked == ((c as BattleCardBase).AttackableCount != (c as BattleCardBase).MaxAttackableCount)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillAvariceCardFilter.cs b/SVSim.BattleEngine/Engine/SkillAvariceCardFilter.cs new file mode 100644 index 0000000..1c3ba67 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillAvariceCardFilter.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillAvariceCardFilter : ISkillCardFilter +{ + public readonly bool _isAvarice; + + public SkillAvariceCardFilter(bool isAvarice) + { + _isAvarice = isAvarice; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + for (int i = 0; i < cards.Count(); i++) + { + BattleCardBase battleCardBase = cards.ElementAt(i) as BattleCardBase; + int turnDrawCount = battleCardBase.SelfBattlePlayer.SkillInfoTurnDrawCards.Count(); + if ((battleCardBase.SelfBattlePlayer.SkillInfoClass.SkillApplyInformation.IsForceAvarice || SkillConditionAvarice.IsAvarice(turnDrawCount)) == _isAvarice) + { + yield return battleCardBase; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillBothClanFilter.cs b/SVSim.BattleEngine/Engine/SkillBothClanFilter.cs new file mode 100644 index 0000000..1c5852a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillBothClanFilter.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillBothClanFilter : ISkillCardFilter +{ + private readonly CardBasePrm.ClanType _clan; + + private readonly Func, bool> _compareFunc; + + public readonly string OptionText; + + public SkillBothClanFilter(CardBasePrm.ClanType clan, string op) + { + _clan = clan; + OptionText = op; + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.Clan); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + cards = cards.Where((IReadOnlyBattleCardInfo s) => s.IsClass); + IEnumerable enumerable = cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc((int)c.Clan, (int)_clan, c, cards)); + if (enumerable.Count() > 0) + { + return enumerable; + } + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.IsPlayer ? GameMgr.GetIns().GetDataMgr().GetPlayerSubClassId() : GameMgr.GetIns().GetDataMgr().GetEnemySubClassId(), (int)_clan, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillCalcFifthRoundDown.cs b/SVSim.BattleEngine/Engine/SkillCalcFifthRoundDown.cs new file mode 100644 index 0000000..186bb15 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillCalcFifthRoundDown.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillCalcFifthRoundDown : ISkillCalcFilter +{ + public int Filtering(IEnumerable parameters) + { + return Filtering(parameters.First()); + } + + public int Filtering(int parameter) + { + return parameter / 5; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillCalcHalfRoundDown.cs b/SVSim.BattleEngine/Engine/SkillCalcHalfRoundDown.cs new file mode 100644 index 0000000..d3cb6a3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillCalcHalfRoundDown.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillCalcHalfRoundDown : ISkillCalcFilter +{ + public int Filtering(IEnumerable parameters) + { + return Filtering(parameters.First()); + } + + public int Filtering(int parameter) + { + return parameter / 2; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillCalcHalfRoundUp.cs b/SVSim.BattleEngine/Engine/SkillCalcHalfRoundUp.cs new file mode 100644 index 0000000..61ae1e0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillCalcHalfRoundUp.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillCalcHalfRoundUp : ISkillCalcFilter +{ + public int Filtering(IEnumerable parameters) + { + int parameter = parameters.First(); + return Filtering(parameter); + } + + public int Filtering(int parameter) + { + return parameter / 2 + parameter % 2; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillCalcMaxFilter.cs b/SVSim.BattleEngine/Engine/SkillCalcMaxFilter.cs new file mode 100644 index 0000000..6e131c7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillCalcMaxFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillCalcMaxFilter : ISkillCalcFilter +{ + public int Filtering(IEnumerable parameters) + { + return parameters.Max(); + } + + public int Filtering(int parameter) + { + return parameter; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillCalcMinFilter.cs b/SVSim.BattleEngine/Engine/SkillCalcMinFilter.cs new file mode 100644 index 0000000..157e1b0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillCalcMinFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillCalcMinFilter : ISkillCalcFilter +{ + public int Filtering(IEnumerable parameters) + { + return parameters.Min(); + } + + public int Filtering(int parameter) + { + return parameter; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillCalcQuarterRoundUp.cs b/SVSim.BattleEngine/Engine/SkillCalcQuarterRoundUp.cs new file mode 100644 index 0000000..19241b0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillCalcQuarterRoundUp.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillCalcQuarterRoundUp : ISkillCalcFilter +{ + public int Filtering(IEnumerable parameters) + { + int parameter = parameters.First(); + return Filtering(parameter); + } + + public int Filtering(int parameter) + { + return parameter / 4 + ((parameter % 4 > 0) ? 1 : 0); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillCalcSumFilter.cs b/SVSim.BattleEngine/Engine/SkillCalcSumFilter.cs new file mode 100644 index 0000000..e71357d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillCalcSumFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillCalcSumFilter : ISkillCalcFilter +{ + public int Filtering(IEnumerable parameters) + { + return parameters.Sum(); + } + + public int Filtering(int parameter) + { + return parameter; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillCardFilterBase.cs b/SVSim.BattleEngine/Engine/SkillCardFilterBase.cs new file mode 100644 index 0000000..003b88e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillCardFilterBase.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillCardFilterBase : ISkillCardFilter +{ + protected readonly string _parameterText; + + protected readonly string _parameterOptionText; + + public SkillCardFilterBase(string parameterText, string op) + { + _parameterOptionText = op; + _parameterText = parameterText; + } + + public virtual IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards; + } + + public virtual string GetParameterText() + { + return _parameterText; + } + + public virtual string GetParameterOptionText() + { + return _parameterOptionText; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillCardTurnDestroyedFilter.cs b/SVSim.BattleEngine/Engine/SkillCardTurnDestroyedFilter.cs new file mode 100644 index 0000000..b19b359 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillCardTurnDestroyedFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillCardTurnDestroyedFilter : ISkillCardFilter +{ + private IReadOnlyBattleCardInfo _ownerCard; + + private readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillCardTurnDestroyedFilter(IReadOnlyBattleCardInfo card, string option) + { + _ownerCard = card; + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return BattleManagerBase.GetIns().GetBattlePlayer(_ownerCard.IsPlayer).GetSpecificTurnDestroyCards(_turnPlayerInfo); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillCemeteryFilter.cs b/SVSim.BattleEngine/Engine/SkillCemeteryFilter.cs new file mode 100644 index 0000000..b2edfa0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillCemeteryFilter.cs @@ -0,0 +1,31 @@ +using System; +using System.Linq; +using Wizard; + +public class SkillCemeteryFilter : ISkillConditionChecker +{ + private int m_count; + + private Func m_compareFunc; + + public SkillCemeteryFilter(int count, string op) + { + m_count = count; + m_compareFunc = SkillCompareFuncCreator.Create(op); + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return CheckCemetery(playerInfoPair.ReadOnlySelf.SkillInfoCemeterys.Count()); + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } + + public bool CheckCemetery(int cemeteryNum) + { + return m_compareFunc(cemeteryNum, m_count); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillChantFieldFilter.cs b/SVSim.BattleEngine/Engine/SkillChantFieldFilter.cs new file mode 100644 index 0000000..3b37fa5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillChantFieldFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillChantFieldFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsChantField); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillChoiceSelectFilter.cs b/SVSim.BattleEngine/Engine/SkillChoiceSelectFilter.cs new file mode 100644 index 0000000..5b21378 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillChoiceSelectFilter.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +public class SkillChoiceSelectFilter : ISkillSelectFilter +{ + private readonly string _context; + + private int _count = 1; + + public int Count => _count; + + public SkillChoiceSelectFilter(string countText) + { + _context = countText; + bool flag = int.TryParse(_context, out _count); + _count = ((!flag) ? 1 : _count); + } + + public int CalcCount(SkillOptionValue option) + { + return option.ParseInt(_context); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + _count = CalcCount(option); + return cards; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillClanFilter.cs b/SVSim.BattleEngine/Engine/SkillClanFilter.cs new file mode 100644 index 0000000..a46ac3c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillClanFilter.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillClanFilter : ISkillCardFilter +{ + public readonly CardBasePrm.ClanType _clan; + + private readonly Func, bool> _compareFunc; + + public readonly string OptionText; + + public SkillClanFilter(CardBasePrm.ClanType clan, string op) + { + _clan = clan; + OptionText = op; + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.Clan); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc((int)c.Clan, (int)_clan, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillClassFilter.cs b/SVSim.BattleEngine/Engine/SkillClassFilter.cs new file mode 100644 index 0000000..b32fc46 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillClassFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillClassFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsClass); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillCompareFuncCreator.cs b/SVSim.BattleEngine/Engine/SkillCompareFuncCreator.cs new file mode 100644 index 0000000..8dc8874 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillCompareFuncCreator.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Wizard.Battle; + +public static class SkillCompareFuncCreator +{ + public static readonly string Clan = "Clan"; + + public static readonly string Tribe = "Tribe"; + + public static readonly string Cost = "Cost"; + + public static readonly string BaseCost = "BaseCost"; + + public static readonly string BaseAtk = "BaseAtk"; + + public static readonly string BaseLife = "BaseLife"; + + public static readonly string Atk = "Atk"; + + public static readonly string Life = "Life"; + + public static readonly string MaxLife = "MaxLife"; + + public static readonly string ChantCount = "ChantCount"; + + public static readonly string BuffCount = "BuffCount"; + + public static readonly string BuffLifeCount = "BuffLifeCount"; + + public static readonly string AttackableCount = "AttackableCount"; + + public static readonly string MaxAttackableCount = "MaxAttackableCount"; + + public static readonly string CardId = "CardId"; + + public static readonly string LastLife = "LastLife"; + + public static readonly string GenericValue = "GenericValue"; + + public static readonly string ChangeMaxLifeCount = "ChangeMaxLifeCount"; + + public static TSource FindMin(this IEnumerable self, Func selector) + { + return self.First((TSource c) => selector(c).Equals(self.Min(selector))); + } + + public static TSource FindMax(this IEnumerable self, Func selector) + { + return self.First((TSource c) => selector(c).Equals(self.Max(selector))); + } + + public static Func Create(string op) + { + return op switch + { + "=" => (int a, int b) => a == b, + "!=" => (int a, int b) => a != b, + "<=" => (int a, int b) => a <= b, + ">=" => (int a, int b) => a >= b, + "<" => (int a, int b) => a < b, + ">" => (int a, int b) => a > b, + _ => (int a, int b) => false, + }; + } + + public static Func, bool> Create(string op, string propertyName) + { + Func compareFunc = null; + bool searchMax = false; + switch (op) + { + case "=": + return (int a, int b, IReadOnlyBattleCardInfo c, IEnumerable cards) => a == b; + case "!=": + return (int a, int b, IReadOnlyBattleCardInfo c, IEnumerable cards) => a != b; + case "<=": + return (int a, int b, IReadOnlyBattleCardInfo c, IEnumerable cards) => a <= b; + case ">=": + return (int a, int b, IReadOnlyBattleCardInfo c, IEnumerable cards) => a >= b; + case "<": + return (int a, int b, IReadOnlyBattleCardInfo c, IEnumerable cards) => a < b; + case ">": + return (int a, int b, IReadOnlyBattleCardInfo c, IEnumerable cards) => a > b; + case "<:=": + compareFunc = (int a, int b) => a <= b; + searchMax = true; + break; + case ">:=": + compareFunc = (int a, int b) => a >= b; + break; + case "<:": + compareFunc = (int a, int b) => a < b; + searchMax = true; + break; + case ">:": + compareFunc = (int a, int b) => a > b; + break; + default: + return (int a, int b, IReadOnlyBattleCardInfo c, IEnumerable cards) => false; + } + return delegate(int a, int number, IReadOnlyBattleCardInfo card, IEnumerable cards) + { + Type typeFromHandle = typeof(BattleCardBase); + PropertyInfo prop = typeFromHandle.GetProperty(propertyName); + IEnumerable enumerable = cards.Where((IReadOnlyBattleCardInfo c) => compareFunc(int.Parse(prop.GetValue(c, null).ToString()), number)); + if (enumerable.Count() > 0) + { + IReadOnlyBattleCardInfo obj = (searchMax ? enumerable.FindMax((IReadOnlyBattleCardInfo c) => int.Parse(prop.GetValue(c, null).ToString())) : enumerable.FindMin((IReadOnlyBattleCardInfo c) => int.Parse(prop.GetValue(c, null).ToString()))); + int num = int.Parse(prop.GetValue(obj, null).ToString()); + if (num == -1) + { + return false; + } + return int.Parse(prop.GetValue(card, null).ToString()) == num; + } + return false; + }; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionAttachingAbility.cs b/SVSim.BattleEngine/Engine/SkillConditionAttachingAbility.cs new file mode 100644 index 0000000..54ff189 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionAttachingAbility.cs @@ -0,0 +1,35 @@ +using Wizard; + +public class SkillConditionAttachingAbility : ISkillConditionChecker +{ + private SkillFilterCreator.ContentKeyword _keyword; + + public SkillConditionAttachingAbility(SkillFilterCreator.ContentKeyword keyword) + { + _keyword = keyword; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (option.AttachingAbility.Skill == null) + { + return false; + } + if (option.AttachingAbility.Skill.OnWhenChangeInPlay != 0 && option.AttachingAbility.Skill.IsAttachedSkill && !option.AttachingAbility.Skill.IsAttachedInplaySkill) + { + return false; + } + return _keyword switch + { + SkillFilterCreator.ContentKeyword.guard => option.AttachingAbility.Skill is Skill_guard, + SkillFilterCreator.ContentKeyword.rush => option.AttachingAbility.Skill is Skill_rush, + SkillFilterCreator.ContentKeyword.quick => option.AttachingAbility.Skill is Skill_quick, + _ => false, + }; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionAttackerIsOther.cs b/SVSim.BattleEngine/Engine/SkillConditionAttackerIsOther.cs new file mode 100644 index 0000000..261435b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionAttackerIsOther.cs @@ -0,0 +1,21 @@ +using Wizard; + +public class SkillConditionAttackerIsOther : ISkillConditionChecker +{ + private BattleCardBase m_ownerCard; + + public SkillConditionAttackerIsOther(BattleCardBase ownerCard) + { + m_ownerCard = ownerCard; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return m_ownerCard != option.AttackerCard; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionAttackerIsSelf.cs b/SVSim.BattleEngine/Engine/SkillConditionAttackerIsSelf.cs new file mode 100644 index 0000000..13ba6cc --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionAttackerIsSelf.cs @@ -0,0 +1,21 @@ +using Wizard; + +public class SkillConditionAttackerIsSelf : ISkillConditionChecker +{ + private BattleCardBase m_ownerCard; + + public SkillConditionAttackerIsSelf(BattleCardBase ownerCard) + { + m_ownerCard = ownerCard; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return m_ownerCard == option.AttackerCard; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionAvarice.cs b/SVSim.BattleEngine/Engine/SkillConditionAvarice.cs new file mode 100644 index 0000000..a1b4dab --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionAvarice.cs @@ -0,0 +1,41 @@ +using System.Linq; +using Wizard; + +public class SkillConditionAvarice : ISkillConditionChecker +{ + public bool IsTurnDrawCountGreaterThanTwo { get; private set; } + + public SkillConditionAvarice(string flag) + { + IsTurnDrawCountGreaterThanTwo = flag == "true"; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + int turnDrawCount = playerInfoPair.ReadOnlySelf.SkillInfoTurnDrawCards.Count(); + bool isForceAvarice = playerInfoPair.ReadOnlySelf.SkillInfoClass.SkillApplyInformation.IsForceAvarice; + if (IsTurnDrawCountGreaterThanTwo) + { + if (!isForceAvarice) + { + return IsAvarice(turnDrawCount); + } + return true; + } + if (!isForceAvarice) + { + return !IsAvarice(turnDrawCount); + } + return false; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } + + public static bool IsAvarice(int turnDrawCount) + { + return turnDrawCount >= 2; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionAwake.cs b/SVSim.BattleEngine/Engine/SkillConditionAwake.cs new file mode 100644 index 0000000..533a3b5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionAwake.cs @@ -0,0 +1,31 @@ +using Wizard; + +public class SkillConditionAwake : ISkillConditionChecker +{ + public bool judgeFlg { get; private set; } + + public SkillConditionAwake(string flg) + { + judgeFlg = flg == "true"; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + int ppTotal = playerInfoPair.ReadOnlySelf.PpTotal; + if (judgeFlg) + { + return IsAwake(ppTotal); + } + return !IsAwake(ppTotal); + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } + + public static bool IsAwake(int pp) + { + return pp >= 7; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionBeAttackedIsDestroy.cs b/SVSim.BattleEngine/Engine/SkillConditionBeAttackedIsDestroy.cs new file mode 100644 index 0000000..bbccaa1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionBeAttackedIsDestroy.cs @@ -0,0 +1,23 @@ +using Wizard; + +public class SkillConditionBeAttackedIsDestroy : ISkillConditionChecker +{ + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + BattleCardBase attackTargetCard = option.AttackTargetCard; + if (attackTargetCard != null) + { + if (attackTargetCard.IsDead) + { + return !attackTargetCard.DeathTypeInfo.BanishDestroy; + } + return false; + } + return false; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionBeAttackedIsOther.cs b/SVSim.BattleEngine/Engine/SkillConditionBeAttackedIsOther.cs new file mode 100644 index 0000000..b27fce8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionBeAttackedIsOther.cs @@ -0,0 +1,21 @@ +using Wizard; + +public class SkillConditionBeAttackedIsOther : ISkillConditionChecker +{ + private BattleCardBase m_ownerCard; + + public SkillConditionBeAttackedIsOther(BattleCardBase ownerCard) + { + m_ownerCard = ownerCard; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return m_ownerCard != option.AttackTargetCard; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionBeAttackedIsSelf.cs b/SVSim.BattleEngine/Engine/SkillConditionBeAttackedIsSelf.cs new file mode 100644 index 0000000..3718551 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionBeAttackedIsSelf.cs @@ -0,0 +1,21 @@ +using Wizard; + +public class SkillConditionBeAttackedIsSelf : ISkillConditionChecker +{ + private BattleCardBase m_ownerCard; + + public SkillConditionBeAttackedIsSelf(BattleCardBase ownerCard) + { + m_ownerCard = ownerCard; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return m_ownerCard == option.AttackTargetCard; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionBurialRite.cs b/SVSim.BattleEngine/Engine/SkillConditionBurialRite.cs new file mode 100644 index 0000000..f9f86d2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionBurialRite.cs @@ -0,0 +1,50 @@ +using System.Linq; +using Wizard; +using Wizard.Battle; + +public class SkillConditionBurialRite : ISkillConditionChecker +{ + private BattleCardBase _ownerCard; + + private bool _isInvoked; + + public bool judgeFlg { get; private set; } + + public SkillConditionBurialRite(BattleCardBase card, string flg) + { + judgeFlg = flg == "true"; + _ownerCard = card; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (_isInvoked) + { + return judgeFlg; + } + return IsBurialRite(playerInfoPair) == judgeFlg; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (_isInvoked) + { + return true; + } + return IsRight(playerInfoPair, option); + } + + private bool IsBurialRite(BattlePlayerReadOnlyInfoPair playerInfoPair) + { + if (playerInfoPair.ReadOnlySelf.SkillInfoInPlayCards.Count() <= ((_ownerCard.IsInplay || _ownerCard.IsSpell) ? 4 : 3)) + { + return playerInfoPair.ReadOnlySelf.SkillInfoHandCards.Any((IReadOnlyBattleCardInfo s) => s != _ownerCard && s != _ownerCard.TransformInfo.OriginalCard && s.IsUnit); + } + return false; + } + + public void SetInvoked() + { + _isInvoked = true; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionDeckSelfSummonedSelf.cs b/SVSim.BattleEngine/Engine/SkillConditionDeckSelfSummonedSelf.cs new file mode 100644 index 0000000..2e50c6f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionDeckSelfSummonedSelf.cs @@ -0,0 +1,21 @@ +using Wizard; + +public class SkillConditionDeckSelfSummonedSelf : ISkillConditionChecker +{ + private BattleCardBase _ownerCard; + + public SkillConditionDeckSelfSummonedSelf(BattleCardBase ownerCard) + { + _ownerCard = ownerCard; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return option.DeckSelfSummonedCards.Contains(_ownerCard); + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionDisplayOtherUsersMessage.cs b/SVSim.BattleEngine/Engine/SkillConditionDisplayOtherUsersMessage.cs new file mode 100644 index 0000000..2f49882 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionDisplayOtherUsersMessage.cs @@ -0,0 +1,21 @@ +using Wizard; + +public class SkillConditionDisplayOtherUsersMessage : ISkillConditionChecker +{ + private bool _judgeFlag; + + public SkillConditionDisplayOtherUsersMessage(string flag) + { + _judgeFlag = flag == "true"; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_OTHER_PLAYER_EMOTE) == _judgeFlag; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionEvolvableTurn.cs b/SVSim.BattleEngine/Engine/SkillConditionEvolvableTurn.cs new file mode 100644 index 0000000..50ad5ef --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionEvolvableTurn.cs @@ -0,0 +1,30 @@ +using Wizard; + +public class SkillConditionEvolvableTurn : ISkillConditionChecker +{ + public bool judgeFlag { get; private set; } + + public SkillConditionEvolvableTurn(string flag) + { + judgeFlag = flag == "true"; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool preExecutionCheck = false) + { + if (judgeFlag) + { + return IsEvolvableTurn(playerInfoPair.ReadOnlySelf.EvolveWaitTurnCount); + } + return !IsEvolvableTurn(playerInfoPair.ReadOnlySelf.EvolveWaitTurnCount); + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool preExecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } + + public bool IsEvolvableTurn(int evolveWaitTurnCount) + { + return evolveWaitTurnCount <= 0; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionHalfLife.cs b/SVSim.BattleEngine/Engine/SkillConditionHalfLife.cs new file mode 100644 index 0000000..f497e36 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionHalfLife.cs @@ -0,0 +1,40 @@ +using Wizard; +using Wizard.Battle; + +public class SkillConditionHalfLife : ISkillConditionChecker +{ + public bool IsConditionLesserHalfLife { get; private set; } + + public SkillConditionHalfLife(string flg) + { + IsConditionLesserHalfLife = flg == "true"; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + IReadOnlyBattleCardInfo skillInfoClass = playerInfoPair.ReadOnlySelf.SkillInfoClass; + if (IsConditionLesserHalfLife) + { + if (!skillInfoClass.SkillApplyInformation.IsForceBerserk) + { + return IsHalfLife(skillInfoClass.Life); + } + return true; + } + if (!skillInfoClass.SkillApplyInformation.IsForceBerserk) + { + return !IsHalfLife(skillInfoClass.Life); + } + return false; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } + + public static bool IsHalfLife(int life) + { + return life <= 10; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionHealingCardIsClass.cs b/SVSim.BattleEngine/Engine/SkillConditionHealingCardIsClass.cs new file mode 100644 index 0000000..9cefb13 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionHealingCardIsClass.cs @@ -0,0 +1,30 @@ +using System.Linq; +using Wizard; +using Wizard.Battle; + +public class SkillConditionHealingCardIsClass : ISkillConditionChecker +{ + private BattleCardBase _ownerCard; + + private bool _isSelf; + + public SkillConditionHealingCardIsClass(BattleCardBase ownerCard, bool isSelf) + { + _ownerCard = ownerCard; + _isSelf = isSelf; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (!_isSelf) + { + return playerInfoPair.ReadOnlyOpponent.SkillInfoHealingCards.Any((IReadOnlyBattleCardInfo c) => c == _ownerCard.OpponentBattlePlayer.Class); + } + return playerInfoPair.ReadOnlySelf.SkillInfoHealingCards.Any((IReadOnlyBattleCardInfo c) => c == _ownerCard.SelfBattlePlayer.Class); + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionInHandIsOther.cs b/SVSim.BattleEngine/Engine/SkillConditionInHandIsOther.cs new file mode 100644 index 0000000..8017426 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionInHandIsOther.cs @@ -0,0 +1,27 @@ +using System.Linq; +using Wizard; +using Wizard.Battle; + +public class SkillConditionInHandIsOther : ISkillConditionChecker +{ + private BattleCardBase m_ownerCard; + + public SkillConditionInHandIsOther(BattleCardBase ownerCard) + { + m_ownerCard = ownerCard; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (option.InHandCard == null) + { + return false; + } + return option.InHandCard.Any((IReadOnlyBattleCardInfo s) => s != m_ownerCard); + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionInHandIsSelf.cs b/SVSim.BattleEngine/Engine/SkillConditionInHandIsSelf.cs new file mode 100644 index 0000000..186eab4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionInHandIsSelf.cs @@ -0,0 +1,27 @@ +using System.Linq; +using Wizard; +using Wizard.Battle; + +public class SkillConditionInHandIsSelf : ISkillConditionChecker +{ + private BattleCardBase m_ownerCard; + + public SkillConditionInHandIsSelf(BattleCardBase ownerCard) + { + m_ownerCard = ownerCard; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (option.InHandCard == null) + { + return false; + } + return option.InHandCard.Any((IReadOnlyBattleCardInfo s) => s == m_ownerCard); + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionIsInplayCardFilter.cs b/SVSim.BattleEngine/Engine/SkillConditionIsInplayCardFilter.cs new file mode 100644 index 0000000..b4e2a69 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionIsInplayCardFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillConditionIsInplayCardFilter : ISkillCardFilter +{ + protected readonly bool _isInplay; + + public SkillConditionIsInplayCardFilter(bool isInplay) + { + _isInplay = isInplay; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsInplay == _isInplay); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionIsReanimateCardFilter.cs b/SVSim.BattleEngine/Engine/SkillConditionIsReanimateCardFilter.cs new file mode 100644 index 0000000..d08dac8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionIsReanimateCardFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillConditionIsReanimateCardFilter : ISkillCardFilter +{ + protected readonly bool _isReanimate; + + public SkillConditionIsReanimateCardFilter(bool isReanimate) + { + _isReanimate = isReanimate; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsReanimate == _isReanimate); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionMeLanguage.cs b/SVSim.BattleEngine/Engine/SkillConditionMeLanguage.cs new file mode 100644 index 0000000..edd96c1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionMeLanguage.cs @@ -0,0 +1,22 @@ +using Cute; +using Wizard; + +public class SkillConditionMeLanguage : ISkillConditionChecker +{ + private string _language; + + public SkillConditionMeLanguage(string language) + { + _language = language; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return _language == CustomPreference.GetTextLanguage(); + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionOddEvenOffense.cs b/SVSim.BattleEngine/Engine/SkillConditionOddEvenOffense.cs new file mode 100644 index 0000000..031cceb --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionOddEvenOffense.cs @@ -0,0 +1,36 @@ +using Wizard; + +public class SkillConditionOddEvenOffense : ISkillConditionChecker +{ + private BattleCardBase _ownerCard; + + private bool _judgeFlag; + + private bool _isOdd; + + public SkillConditionOddEvenOffense(BattleCardBase ownerCard, string flag, bool isOdd) + { + _ownerCard = ownerCard; + _judgeFlag = flag == "true"; + _isOdd = isOdd; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return CheckOffense(option) == _judgeFlag; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } + + private bool CheckOffense(SkillConditionCheckerOption option) + { + if (_isOdd) + { + return _ownerCard.Atk % 2 == 1; + } + return _ownerCard.Atk % 2 == 0; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionOddEvenSpellCharge.cs b/SVSim.BattleEngine/Engine/SkillConditionOddEvenSpellCharge.cs new file mode 100644 index 0000000..f5e0b4f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionOddEvenSpellCharge.cs @@ -0,0 +1,37 @@ +using Wizard; + +public class SkillConditionOddEvenSpellCharge : ISkillConditionChecker +{ + private BattleCardBase _ownerCard; + + private bool _judgeFlag; + + private bool _isOdd; + + public SkillConditionOddEvenSpellCharge(BattleCardBase ownerCard, string flag, bool isOdd) + { + _ownerCard = ownerCard; + _judgeFlag = flag == "true"; + _isOdd = isOdd; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return CheckSpellCharge(option) == _judgeFlag; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } + + private bool CheckSpellCharge(SkillConditionCheckerOption option) + { + bool flag = _ownerCard.SpellChargeCount % 2 == 0; + if (_isOdd) + { + return (flag ? option.AddChargeCount : (option.AddChargeCount - 1)) > 0; + } + return (flag ? (option.AddChargeCount - 1) : option.AddChargeCount) > 0; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionPP.cs b/SVSim.BattleEngine/Engine/SkillConditionPP.cs new file mode 100644 index 0000000..670f5a3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionPP.cs @@ -0,0 +1,46 @@ +using System; +using Wizard; + +public class SkillConditionPP : ISkillConditionChecker +{ + private BattleCardBase _ownerCard; + + private int _ppBorder; + + private Func _compareFunc; + + public int PpBorder => _ppBorder; + + public string Operator { get; private set; } + + public SkillConditionPP(BattleCardBase ownerCard, int ppBorder, string op) + { + _ownerCard = ownerCard; + _ppBorder = ppBorder; + _compareFunc = SkillCompareFuncCreator.Create(op); + Operator = op; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + int arg = playerInfoPair.ReadOnlySelf.Pp + GetCardCost(); + bool flag = _compareFunc(arg, _ppBorder); + return option.IsSkipPpCheck || flag; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + int pp = playerInfoPair.ReadOnlySelf.Pp; + bool flag = _compareFunc(pp, _ppBorder); + return option.IsSkipPpCheck || flag; + } + + private int GetCardCost() + { + if (_ownerCard.PlayedCost < 0) + { + return _ownerCard.Cost; + } + return _ownerCard.PlayedCost; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionPlayCount.cs b/SVSim.BattleEngine/Engine/SkillConditionPlayCount.cs new file mode 100644 index 0000000..08fa06d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionPlayCount.cs @@ -0,0 +1,30 @@ +using System; +using Wizard; + +public class SkillConditionPlayCount : ISkillConditionChecker +{ + private readonly int _count; + + private readonly Func _compareFunc; + + public SkillConditionPlayCount(int count, string op) + { + _count = count; + _compareFunc = SkillCompareFuncCreator.Create(op); + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return _compareFunc(playerInfoPair.ReadOnlySelf.GetCurrentTurnPlayCount(), _count); + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return _compareFunc(playerInfoPair.ReadOnlySelf.GetCurrentTurnPlayCount(), _count - 1); + } + + public int GetCount() + { + return _count; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionReanimatedSelf.cs b/SVSim.BattleEngine/Engine/SkillConditionReanimatedSelf.cs new file mode 100644 index 0000000..f58aae2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionReanimatedSelf.cs @@ -0,0 +1,21 @@ +using Wizard; + +public class SkillConditionReanimatedSelf : ISkillConditionChecker +{ + private BattleCardBase m_ownerCard; + + public SkillConditionReanimatedSelf(BattleCardBase ownerCard) + { + m_ownerCard = ownerCard; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return option.ReanimatedCards.Contains(m_ownerCard); + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionResonance.cs b/SVSim.BattleEngine/Engine/SkillConditionResonance.cs new file mode 100644 index 0000000..5cfd2c9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionResonance.cs @@ -0,0 +1,27 @@ +using System.Linq; +using Wizard; + +public class SkillConditionResonance : ISkillConditionChecker +{ + public bool judgeFlg { get; private set; } + + public SkillConditionResonance(string flg) + { + judgeFlg = flg == "true"; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsResonance(playerInfoPair.ReadOnlySelf.SkillInfoDeckCards.Count()) == judgeFlg; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } + + public static bool IsResonance(int count) + { + return count % 2 == 0; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionShortageDeckWin.cs b/SVSim.BattleEngine/Engine/SkillConditionShortageDeckWin.cs new file mode 100644 index 0000000..88c25c5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionShortageDeckWin.cs @@ -0,0 +1,21 @@ +using Wizard; + +public class SkillConditionShortageDeckWin : ISkillConditionChecker +{ + public bool IsConditionShortageDeckWin { get; private set; } + + public SkillConditionShortageDeckWin(string flg) + { + IsConditionShortageDeckWin = flg == "true"; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return playerInfoPair.ReadOnlySelf.SkillInfoClass.SkillApplyInformation.IsShortageDeckWin == IsConditionShortageDeckWin; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionTrigger.cs b/SVSim.BattleEngine/Engine/SkillConditionTrigger.cs new file mode 100644 index 0000000..9211e09 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionTrigger.cs @@ -0,0 +1,29 @@ +using System.Linq; +using Wizard; + +public class SkillConditionTrigger : ISkillConditionChecker +{ + private BattleCardBase ownerCard; + + public bool judgeFlg { get; private set; } + + public SkillConditionTrigger(BattleCardBase ownerCard, string flg) + { + judgeFlg = flg == "true"; + this.ownerCard = ownerCard; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (ownerCard.Skills.Where((SkillBase s) => s is Skill_trigger).Count() <= 0) + { + return false; + } + return ownerCard.SkillApplyInformation.IsTrigger == judgeFlg; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionTurn.cs b/SVSim.BattleEngine/Engine/SkillConditionTurn.cs new file mode 100644 index 0000000..4b7b1f9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionTurn.cs @@ -0,0 +1,29 @@ +using Wizard; + +public class SkillConditionTurn : ISkillConditionChecker +{ + private readonly BattleCardBase _ownerCard; + + public bool judgeFlg { get; private set; } + + public SkillConditionTurn(string flg, BattleCardBase ownerCard) + { + judgeFlg = flg == "self"; + _ownerCard = ownerCard; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsTurn(_ownerCard); + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } + + public bool IsTurn(BattleCardBase ownerCard) + { + return ownerCard.SelfBattlePlayer.IsSelfTurn == judgeFlg; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillConditionWrath.cs b/SVSim.BattleEngine/Engine/SkillConditionWrath.cs new file mode 100644 index 0000000..3c320b7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillConditionWrath.cs @@ -0,0 +1,40 @@ +using Wizard; + +public class SkillConditionWrath : ISkillConditionChecker +{ + public bool IsSelfDamageCountGreaterThanSeven { get; private set; } + + public SkillConditionWrath(string flag) + { + IsSelfDamageCountGreaterThanSeven = flag == "true"; + } + + public bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + int damageCount = playerInfoPair.ReadOnlySelf.SkillInfoClass.DamagedCounter.GetDamageCount(selfTurn: true); + bool isForceWrath = playerInfoPair.ReadOnlySelf.SkillInfoClass.SkillApplyInformation.IsForceWrath; + if (IsSelfDamageCountGreaterThanSeven) + { + if (!isForceWrath) + { + return IsWrath(damageCount); + } + return true; + } + if (!isForceWrath) + { + return !IsWrath(damageCount); + } + return false; + } + + public bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return IsRight(playerInfoPair, option); + } + + public static bool IsWrath(int selfDamageCount) + { + return selfDamageCount >= 7; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillCostNoDuplicationRandomSelectFilter.cs b/SVSim.BattleEngine/Engine/SkillCostNoDuplicationRandomSelectFilter.cs new file mode 100644 index 0000000..2723041 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillCostNoDuplicationRandomSelectFilter.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +public class SkillCostNoDuplicationRandomSelectFilter : ISkillSelectFilter +{ + private readonly string _contText; + + private int _count; + + public SkillCostNoDuplicationRandomSelectFilter(string randomCountText) + { + _contText = randomCountText; + } + + public int CalcCount(SkillOptionValue option) + { + return option.ParseInt(_contText); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + _count = CalcCount(option); + cards = cards.OrderBy((BattleCardBase x) => x.Index); + List cardList = cards.ToList(); + BattleManagerBase battleMgr = BattleManagerBase.GetIns(); + _count = Math.Min(_count, cardList.Count); + for (int i = 0; i < _count; i++) + { + if (cardList.Count > 0) + { + int index = (BattleManagerBase.IsRandomDraw ? battleMgr.StableRandom(cardList.Count) : 0); + BattleCardBase card = cardList[index]; + cardList = cardList.Where((BattleCardBase c) => c.Card.Cost != card.Cost).ToList(); + yield return card; + } + } + } + + public bool IsUpperLimit() + { + return _contText == "5-{me.inplay.unit_and_allfield.count}"; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalAttachedTurnFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalAttachedTurnFilter.cs new file mode 100644 index 0000000..3dfc43c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalAttachedTurnFilter.cs @@ -0,0 +1,26 @@ +using System.Linq; + +public class SkillEnvironmentalAttachedTurnFilter : ISkillEnvironmentalFilter +{ + private string _id; + + public SkillEnvironmentalAttachedTurnFilter(string option, SkillBase skill) + { + string[] array = option.Split(':'); + _id = array[0]; + if (array.Count() > 1 && array[1] == SkillFilterCreator.ContentKeyword.is_individual.ToString() && skill != null) + { + _id += skill.IndividualId; + } + } + + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.GetAttachTurnBySkillId(_id); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalBpFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalBpFilter.cs new file mode 100644 index 0000000..949bf46 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalBpFilter.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalBpFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return playerinfo.Bp; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalCemeteryCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalCemeteryCount.cs new file mode 100644 index 0000000..427a411 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalCemeteryCount.cs @@ -0,0 +1,14 @@ +using System.Linq; + +public class SkillEnvironmentalCemeteryCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.SkillInfoCemeterys.Count(); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalCharaIdFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalCharaIdFilter.cs new file mode 100644 index 0000000..21f12b8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalCharaIdFilter.cs @@ -0,0 +1,17 @@ +public class SkillEnvironmentalCharaIdFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + if (!playerInfo.IsPlayer) + { + return dataMgr.GetEnemyCharaId(); + } + return dataMgr.GetPlayerCharaId(); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalDeckBanishCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalDeckBanishCount.cs new file mode 100644 index 0000000..d0c3508 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalDeckBanishCount.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalDeckBanishCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.DeckBanishCount; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.DeckBanishCount; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalDefaultDamageFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalDefaultDamageFilter.cs new file mode 100644 index 0000000..fea57ad --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalDefaultDamageFilter.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalDefaultDamageFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return option.DefaultDamage.Damage; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalEPFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalEPFilter.cs new file mode 100644 index 0000000..583738f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalEPFilter.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalEPFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return playerinfo.CurrentEpCount; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalFirstPlayerTurnFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalFirstPlayerTurnFilter.cs new file mode 100644 index 0000000..591f657 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalFirstPlayerTurnFilter.cs @@ -0,0 +1,16 @@ +public class SkillEnvironmentalFirstPlayerTurnFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + if (!playerInfo.IsGameFirst) + { + return -1; + } + return playerInfo.Turn; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalFixedDamageFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalFixedDamageFilter.cs new file mode 100644 index 0000000..e51ccc7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalFixedDamageFilter.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalFixedDamageFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return option.FixedDamage.Damage; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGameBuffCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameBuffCount.cs new file mode 100644 index 0000000..71d0da6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameBuffCount.cs @@ -0,0 +1,17 @@ +public class SkillEnvironmentalGameBuffCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + int num = 0; + for (int i = 0; i < playerInfo.GameSkillBuffCountList.Count; i++) + { + num += playerInfo.GameSkillBuffCountList[i].Value; + } + return num; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGameConditionFulfilledTurnPlaycount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameConditionFulfilledTurnPlaycount.cs new file mode 100644 index 0000000..2e948e3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameConditionFulfilledTurnPlaycount.cs @@ -0,0 +1,25 @@ +using System; +using System.Linq; + +public class SkillEnvironmentalGameConditionFulfilledTurnPlaycount : ISkillEnvironmentalFilter +{ + private readonly int _conditionPlayCount; + + private readonly Func _compareFunc; + + public SkillEnvironmentalGameConditionFulfilledTurnPlaycount(string value, string op) + { + _compareFunc = SkillCompareFuncCreator.Create(op); + _conditionPlayCount = int.Parse(value); + } + + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.TurnPlayCardCountInfo.Where((TurnAndIntValue c) => c.IsSelfTurn == playerInfo.IsPlayer && _compareFunc(c.Value, _conditionPlayCount)).Count(); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGameDiscardSkillCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameDiscardSkillCount.cs new file mode 100644 index 0000000..73adcb7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameDiscardSkillCount.cs @@ -0,0 +1,17 @@ +public class SkillEnvironmentalGameDiscardSkillCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + int num = 0; + for (int i = 0; i < playerInfo.GameSkillDiscardCountList.Count; i++) + { + num += playerInfo.GameSkillDiscardCountList[i].Value; + } + return num; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGameFusionCountFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameFusionCountFilter.cs new file mode 100644 index 0000000..908d6fe --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameFusionCountFilter.cs @@ -0,0 +1,14 @@ +using System.Linq; + +public class SkillEnvironmentalGameFusionCountFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.TurnFusionCountInfo.Where((TurnAndIntValue c) => c.IsSelfTurn == playerInfo.IsPlayer).Sum((TurnAndIntValue c) => c.Value); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGameMetamorphoseSkillCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameMetamorphoseSkillCount.cs new file mode 100644 index 0000000..cb7294b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameMetamorphoseSkillCount.cs @@ -0,0 +1,17 @@ +public class SkillEnvironmentalGameMetamorphoseSkillCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + int num = 0; + for (int i = 0; i < playerInfo.GameSkillMetamorphoseCountList.Count; i++) + { + num += playerInfo.GameSkillMetamorphoseCountList[i].Value; + } + return num; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGameNecromanceCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameNecromanceCount.cs new file mode 100644 index 0000000..74325c9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameNecromanceCount.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalGameNecromanceCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.GameNecromanceCount; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGamePlayCountFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGamePlayCountFilter.cs new file mode 100644 index 0000000..f2a5389 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGamePlayCountFilter.cs @@ -0,0 +1,15 @@ +using System.Linq; + +public class SkillEnvironmentalGamePlayCountFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + BattleManagerBase.GetIns(); + return playerInfo.TurnPlayCardCountInfo.Where((TurnAndIntValue c) => c.IsSelfTurn == playerInfo.IsPlayer).Sum((TurnAndIntValue c) => c.Value); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGameResonanceStartCountFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameResonanceStartCountFilter.cs new file mode 100644 index 0000000..dd090da --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameResonanceStartCountFilter.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalGameResonanceStartCountFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return playerinfo.GameResonanceStartCount; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGameReturnSkillCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameReturnSkillCount.cs new file mode 100644 index 0000000..0fb0553 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameReturnSkillCount.cs @@ -0,0 +1,17 @@ +public class SkillEnvironmentalGameReturnSkillCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + int num = 0; + for (int i = 0; i < playerInfo.GameSkillReturnCardCountList.Count; i++) + { + num += playerInfo.GameSkillReturnCardCountList[i].Value; + } + return num; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGameSuperSkyboundArtCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameSuperSkyboundArtCount.cs new file mode 100644 index 0000000..44c9fa7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameSuperSkyboundArtCount.cs @@ -0,0 +1,14 @@ +using System.Linq; + +public class SkillEnvironmentalGameSuperSkyboundArtCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.SkillInfoGameSuperSkyboundArtCards.Count(); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGameUsedEpCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameUsedEpCount.cs new file mode 100644 index 0000000..e2ee819 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameUsedEpCount.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalGameUsedEpCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.GameUsedEpCount; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.GameUsedEpCount; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGameUsedPpCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameUsedPpCount.cs new file mode 100644 index 0000000..d4f0ca5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameUsedPpCount.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalGameUsedPpCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.GameUsedPpCount; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalGameUsedWhiteRitualCountFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameUsedWhiteRitualCountFilter.cs new file mode 100644 index 0000000..49193c3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalGameUsedWhiteRitualCountFilter.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalGameUsedWhiteRitualCountFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.GameUsedWhiteRitualCount; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalJatelantBanishCountFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalJatelantBanishCountFilter.cs new file mode 100644 index 0000000..38c5645 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalJatelantBanishCountFilter.cs @@ -0,0 +1,22 @@ +using System; +using System.Linq; +using Wizard.Battle; + +public class SkillEnvironmentalJatelantBanishCountFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + int num = playerInfo.SkillInfoNecromanceZoneCards.Where((IReadOnlyBattleCardInfo c) => c.IsDead && (c is FieldBattleCard || c is ChantFieldBattleCard)).Count(); + num += playerInfo.SkillInfoCemeterys.Where((IReadOnlyBattleCardInfo c) => c.IsDead && (c is FieldBattleCard || c is ChantFieldBattleCard)).Count(); + if (num < 1) + { + return 0; + } + return Math.Min((num - 1) / 3 + 1, 5); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalJatelantDamageAndHealCountFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalJatelantDamageAndHealCountFilter.cs new file mode 100644 index 0000000..7cff891 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalJatelantDamageAndHealCountFilter.cs @@ -0,0 +1,22 @@ +using System; +using System.Linq; +using Wizard.Battle; + +public class SkillEnvironmentalJatelantDamageAndHealCountFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + int num = playerInfo.SkillInfoNecromanceZoneCards.Where((IReadOnlyBattleCardInfo c) => c.IsDead && (c is FieldBattleCard || c is ChantFieldBattleCard)).Count(); + num += playerInfo.SkillInfoCemeterys.Where((IReadOnlyBattleCardInfo c) => c.IsDead && (c is FieldBattleCard || c is ChantFieldBattleCard)).Count(); + if (num < 2) + { + return 0; + } + return Math.Min((num - 2) / 3 + 1, 5) * 3; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalJatelantSummonTokenCountFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalJatelantSummonTokenCountFilter.cs new file mode 100644 index 0000000..7b97435 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalJatelantSummonTokenCountFilter.cs @@ -0,0 +1,22 @@ +using System; +using System.Linq; +using Wizard.Battle; + +public class SkillEnvironmentalJatelantSummonTokenCountFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + int num = playerInfo.SkillInfoNecromanceZoneCards.Where((IReadOnlyBattleCardInfo c) => c.IsDead && (c is FieldBattleCard || c is ChantFieldBattleCard)).Count(); + num += playerInfo.SkillInfoCemeterys.Where((IReadOnlyBattleCardInfo c) => c.IsDead && (c is FieldBattleCard || c is ChantFieldBattleCard)).Count(); + if (num < 3) + { + return 0; + } + return Math.Min((num - 3) / 3 + 1, 4); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalLastInplayWhiteRitualStackFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalLastInplayWhiteRitualStackFilter.cs new file mode 100644 index 0000000..52cf424 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalLastInplayWhiteRitualStackFilter.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalLastInplayWhiteRitualStackFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.LastInplayWhiteRitualStack; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalLastNecromanceCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalLastNecromanceCount.cs new file mode 100644 index 0000000..66b5535 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalLastNecromanceCount.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalLastNecromanceCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return option.NecromanceCount; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalLastUsedWhiteRitualStackCountFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalLastUsedWhiteRitualStackCountFilter.cs new file mode 100644 index 0000000..964d96e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalLastUsedWhiteRitualStackCountFilter.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalLastUsedWhiteRitualStackCountFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return option.LastUsedWhiteRitualStackCount; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalMaxEPFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalMaxEPFilter.cs new file mode 100644 index 0000000..3da7e25 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalMaxEPFilter.cs @@ -0,0 +1,16 @@ +public class SkillEnvironmentalMaxEPFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + if (playerinfo.EvolveWaitTurnCount <= 0) + { + return playerinfo.EpTotal; + } + return 0; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalMaxPPFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalMaxPPFilter.cs new file mode 100644 index 0000000..ac638be --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalMaxPPFilter.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalMaxPPFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return playerinfo.PpTotal; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalPPFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalPPFilter.cs new file mode 100644 index 0000000..48754f0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalPPFilter.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalPPFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return playerinfo.Pp; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalPlayCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalPlayCount.cs new file mode 100644 index 0000000..a0f2c93 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalPlayCount.cs @@ -0,0 +1,27 @@ +public class SkillEnvironmentalPlayCount : ISkillEnvironmentalFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillEnvironmentalPlayCount(string option) + { + _turnPlayerInfo = ((option == string.Empty) ? null : new TurnPlayerInfo(option)); + } + + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + if (_turnPlayerInfo == null) + { + return playerInfo.GetCurrentTurnPlayCount(); + } + return playerInfo.GetSpecificTurnPlayCount(_turnPlayerInfo); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + if (_turnPlayerInfo == null) + { + return playerInfo.GetCurrentTurnPlayCount() + 1; + } + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalRallyCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalRallyCount.cs new file mode 100644 index 0000000..7d92704 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalRallyCount.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalRallyCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.RallyCount; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.RallyCount; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalSecondPlayerTurnFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalSecondPlayerTurnFilter.cs new file mode 100644 index 0000000..14c2240 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalSecondPlayerTurnFilter.cs @@ -0,0 +1,16 @@ +public class SkillEnvironmentalSecondPlayerTurnFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + if (!playerInfo.IsGameFirst) + { + return playerInfo.Turn; + } + return -1; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalShortageDeckLose.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalShortageDeckLose.cs new file mode 100644 index 0000000..06a0fa7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalShortageDeckLose.cs @@ -0,0 +1,20 @@ +public class SkillEnvironmentalShortageDeckLose : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + if (!playerInfo.IsShortageDeckLose) + { + return 0; + } + return 1; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + if (!playerInfo.IsShortageDeckLose) + { + return 0; + } + return 1; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnDiscardSkillCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnDiscardSkillCount.cs new file mode 100644 index 0000000..a8bbe88 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnDiscardSkillCount.cs @@ -0,0 +1,19 @@ +public class SkillEnvironmentalTurnDiscardSkillCount : ISkillEnvironmentalFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillEnvironmentalTurnDiscardSkillCount(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.GetSpecificTurnSkillDiscardCount(_turnPlayerInfo); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnEnhanceCardCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnEnhanceCardCount.cs new file mode 100644 index 0000000..8fc6618 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnEnhanceCardCount.cs @@ -0,0 +1,19 @@ +public class SkillEnvironmentalTurnEnhanceCardCount : ISkillEnvironmentalFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillEnvironmentalTurnEnhanceCardCount(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.GetSpecificTurnEnhanceCardCount(_turnPlayerInfo); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnEvolveCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnEvolveCount.cs new file mode 100644 index 0000000..ed76b09 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnEvolveCount.cs @@ -0,0 +1,23 @@ +public class SkillEnvironmentalTurnEvolveCount : ISkillEnvironmentalFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillEnvironmentalTurnEvolveCount(string option) + { + _turnPlayerInfo = ((option == string.Empty) ? null : new TurnPlayerInfo(option)); + } + + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + if (_turnPlayerInfo == null) + { + return playerInfo.GetCurrentTurnEvolveCount(); + } + return playerInfo.GetSpecificTurnEvolveCount(_turnPlayerInfo); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnFilter.cs new file mode 100644 index 0000000..24dde3f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnFilter.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalTurnFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.Turn; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnResonanceStartCountFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnResonanceStartCountFilter.cs new file mode 100644 index 0000000..ff863c1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnResonanceStartCountFilter.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalTurnResonanceStartCountFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.TurnResonanceStartCount; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnReturnSkillCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnReturnSkillCount.cs new file mode 100644 index 0000000..f2b0e60 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnReturnSkillCount.cs @@ -0,0 +1,19 @@ +public class SkillEnvironmentalTurnReturnSkillCount : ISkillEnvironmentalFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillEnvironmentalTurnReturnSkillCount(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.GetSpecificTurnSkillReturnCardCount(_turnPlayerInfo); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnUsedEpCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnUsedEpCount.cs new file mode 100644 index 0000000..4f86554 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnUsedEpCount.cs @@ -0,0 +1,12 @@ +public class SkillEnvironmentalTurnUsedEpCount : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.TurnUsedEpCount; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.TurnUsedEpCount; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnWhenHealingCount.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnWhenHealingCount.cs new file mode 100644 index 0000000..10fe5ca --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalTurnWhenHealingCount.cs @@ -0,0 +1,22 @@ +public class SkillEnvironmentalTurnWhenHealingCount : ISkillEnvironmentalFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + protected readonly bool _isTextKeyword; + + public SkillEnvironmentalTurnWhenHealingCount(string option, bool isTextKeyword) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + _isTextKeyword = isTextKeyword; + } + + public int Filtering(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return playerInfo.GetSpecificTurnWhenHealingCount(_turnPlayerInfo, _isTextKeyword); + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerInfo, SkillConditionCheckerOption option) + { + return Filtering(playerInfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEnvironmentalUsableEPFilter.cs b/SVSim.BattleEngine/Engine/SkillEnvironmentalUsableEPFilter.cs new file mode 100644 index 0000000..4166a72 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEnvironmentalUsableEPFilter.cs @@ -0,0 +1,16 @@ +public class SkillEnvironmentalUsableEPFilter : ISkillEnvironmentalFilter +{ + public int Filtering(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + if (playerinfo.EvolveWaitTurnCount <= 0) + { + return playerinfo.CurrentEpCount; + } + return 0; + } + + public int FilteringPrePlay(IBattlePlayerReadOnlyInfo playerinfo, SkillConditionCheckerOption option) + { + return Filtering(playerinfo, option); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillEvolutionCardFilter.cs b/SVSim.BattleEngine/Engine/SkillEvolutionCardFilter.cs new file mode 100644 index 0000000..3c3c15b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillEvolutionCardFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillEvolutionCardFilter : ISkillCardFilter +{ + public readonly bool _isEvolution; + + public SkillEvolutionCardFilter(bool isEvolution) + { + _isEvolution = isEvolution; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsEvolution == _isEvolution); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillExclutionApplyFilter.cs b/SVSim.BattleEngine/Engine/SkillExclutionApplyFilter.cs new file mode 100644 index 0000000..ae80f17 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillExclutionApplyFilter.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle; + +public class SkillExclutionApplyFilter : ISkillExclutionFilter +{ + private ApplySkillTargetFilterCollection _filters = new ApplySkillTargetFilterCollection(); + + private BattlePlayerReadOnlyInfoPair _pair; + + public IEnumerable Targets { get; private set; } + + public bool IsExcludeSelectCard => _filters.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.TargetFilter is SkillTargetSelectedCardsFilter); + + public SkillExclutionApplyFilter(BattleCardBase ownerCard, string text, SkillBase skill) + { + if (text.First() == '{') + { + text = text.Remove(0, 1); + text = text.Remove(text.Length - 1, 1); + } + string[] array = text.Split('&'); + for (int i = 0; i < array.Length; i++) + { + SkillFilterCreator.SetupTarget(_filters, array[i], ownerCard, skill); + } + _pair = new BattlePlayerReadOnlyInfoPair(ownerCard.SelfBattlePlayer, ownerCard.OpponentBattlePlayer); + } + + public IEnumerable Filtering(IEnumerable cards, IEnumerable battlePlayerInfos, SkillConditionCheckerOption checkerOption, SkillOptionValue optionValue) + { + List list = cards.ToList(); + Targets = _filters.Filtering(_pair, checkerOption, optionValue).Cast(); + for (int i = 0; i < Targets.Count(); i++) + { + list.Remove(Targets.ElementAt(i)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillExclutionNoneFilter.cs b/SVSim.BattleEngine/Engine/SkillExclutionNoneFilter.cs new file mode 100644 index 0000000..13f0ec2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillExclutionNoneFilter.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillExclutionNoneFilter : ISkillExclutionFilter +{ + public IEnumerable Filtering(IEnumerable cards, IEnumerable battlePlayerInfos, SkillConditionCheckerOption checkerOption, SkillOptionValue optionValue) + { + return cards; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillFieldFilter.cs b/SVSim.BattleEngine/Engine/SkillFieldFilter.cs new file mode 100644 index 0000000..5091426 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillFieldFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillFieldFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsField); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillFusionIngredientCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillFusionIngredientCardListFilter.cs new file mode 100644 index 0000000..06e9069 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillFusionIngredientCardListFilter.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillFusionIngredientCardListFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + List list2 = cards.ToList(); + for (int i = 0; i < list2.Count; i++) + { + list.AddRange(list2[i].FusionIngredients); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillGetOffCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillGetOffCardListFilter.cs new file mode 100644 index 0000000..1366f91 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillGetOffCardListFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillGetOffCardListFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + foreach (IReadOnlyBattleCardInfo card in cards) + { + list.AddRange(card.GetOffCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillGetOnCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillGetOnCardListFilter.cs new file mode 100644 index 0000000..eb959f5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillGetOnCardListFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillGetOnCardListFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + foreach (IReadOnlyBattleCardInfo card in cards) + { + list.AddRange(card.GetOnCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillIdNoDuplicationRandomSelectFilter.cs b/SVSim.BattleEngine/Engine/SkillIdNoDuplicationRandomSelectFilter.cs new file mode 100644 index 0000000..5100589 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillIdNoDuplicationRandomSelectFilter.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +public class SkillIdNoDuplicationRandomSelectFilter : ISkillSelectFilter +{ + private readonly string _context; + + private int _count; + + public int Count => _count; + + public SkillIdNoDuplicationRandomSelectFilter(string randomCountText) + { + _context = randomCountText; + } + + public int CalcCount(SkillOptionValue option) + { + return option.ParseInt(_context); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + _count = CalcCount(option); + cards = cards.OrderBy((BattleCardBase x) => x.Index); + List cardList = cards.ToList(); + BattleManagerBase battleMgr = BattleManagerBase.GetIns(); + _count = Math.Min(_count, cardList.Count); + for (int i = 0; i < _count; i++) + { + if (cardList.Count > 0) + { + int index = (BattleManagerBase.IsRandomDraw ? battleMgr.StableRandom(cardList.Count) : 0); + BattleCardBase card = cardList[index]; + cardList = cardList.Where((BattleCardBase c) => c.Card.BaseParameter.BaseCardId != card.BaseParameter.BaseCardId).ToList(); + yield return card; + } + } + } + + public static IEnumerable Filtering(int selectCount, IEnumerable cards, BattleManagerBase battleMgr) + { + cards = cards.OrderBy((BattleCardBase x) => x.Index); + List list = cards.ToList(); + List list2 = new List(); + int num = Math.Min(selectCount, list.Count); + for (int num2 = 0; num2 < num; num2++) + { + if (list.Count > 0) + { + int index = battleMgr.StableRandom(list.Count); + BattleCardBase card = list[index]; + list = list.Where((BattleCardBase c) => c.Card.BaseParameter.BaseCardId != card.BaseParameter.BaseCardId).ToList(); + list2.Add(card); + } + } + return list2; + } + + public bool IsUpperLimit() + { + return _context == "5-{me.inplay.unit_and_allfield.count}"; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillInOrderFromOldestFilter.cs b/SVSim.BattleEngine/Engine/SkillInOrderFromOldestFilter.cs new file mode 100644 index 0000000..64d9586 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillInOrderFromOldestFilter.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillInOrderFromOldestFilter : ISkillCustomSelectFilter +{ + private int _count; + + public List OldTargets { get; private set; } + + public IEnumerable Filtering(IEnumerable cards, IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + OldTargets = cards.ToList(); + if (option.NextTargetCards != null && option.NextTargetCards.Count > 0) + { + list.AddRange(option.NextTargetCards); + } + else + { + List firstInOrderFromOldest = GetFirstInOrderFromOldest(OldTargets, battlePlayerInfos.Single((IBattlePlayerReadOnlyInfo p) => p.IsPlayer == OldTargets[0].IsPlayer)); + if (firstInOrderFromOldest != null) + { + list.AddRange(firstInOrderFromOldest); + } + } + return list; + } + + private List GetFirstInOrderFromOldest(IEnumerable list, IBattlePlayerReadOnlyInfo player) + { + List list2 = null; + List list3 = list.Where((IReadOnlyBattleCardInfo s) => player.SkillInfoClassAndInPlayCards.Any((IReadOnlyBattleCardInfo p) => p == s)).ToList(); + if (list3.Count > 0) + { + list2 = new List(); + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = list3.SingleOrDefault((IReadOnlyBattleCardInfo s) => player.SkillInfoClass == s); + list3.Remove(readOnlyBattleCardInfo); + if (list3.Count > 0) + { + list2.Add(list3.First()); + } + else if (readOnlyBattleCardInfo != null) + { + list2.Add(readOnlyBattleCardInfo); + } + } + return list2; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillIncludeSelfCardFilter.cs b/SVSim.BattleEngine/Engine/SkillIncludeSelfCardFilter.cs new file mode 100644 index 0000000..39b9ab6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillIncludeSelfCardFilter.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillIncludeSelfCardFilter : ISkillCardFilter +{ + private IReadOnlyBattleCardInfo _ownerCard; + + private bool _includeSelf; + + public SkillIncludeSelfCardFilter(IReadOnlyBattleCardInfo card, string value) + { + _ownerCard = card; + _includeSelf = value == "true"; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo s) => (!_includeSelf) ? (s != _ownerCard) : (s == _ownerCard)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillIsBuffDetailFilter.cs b/SVSim.BattleEngine/Engine/SkillIsBuffDetailFilter.cs new file mode 100644 index 0000000..30d181d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillIsBuffDetailFilter.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillIsBuffDetailFilter : ISkillCardFilter +{ + private bool _flag; + + public SkillIsBuffDetailFilter(bool flag) + { + _flag = flag; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + foreach (IReadOnlyBattleCardInfo card in cards) + { + BattleCardBase battleCardBase = card as BattleCardBase; + if (battleCardBase.SelfBattlePlayer.SideLogSkill != null) + { + return list; + } + if (battleCardBase != null && ((battleCardBase.IsClass && battleCardBase.SelfBattlePlayer.IsBuffDetail == _flag) || battleCardBase.IsBuffDetail == _flag)) + { + list.Add(card); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillIsFusionInfoOrIsNotSideLogFilter.cs b/SVSim.BattleEngine/Engine/SkillIsFusionInfoOrIsNotSideLogFilter.cs new file mode 100644 index 0000000..45a5a00 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillIsFusionInfoOrIsNotSideLogFilter.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillIsFusionInfoOrIsNotSideLogFilter : ISkillCardFilter +{ + private bool _flag; + + public SkillIsFusionInfoOrIsNotSideLogFilter(bool flag) + { + _flag = flag; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + BattleCardBase battleCardBase = cards.ElementAt(i) as BattleCardBase; + if (battleCardBase.SelfBattlePlayer != null) + { + IDetailPanelControl detailPanelControl = battleCardBase.SelfBattlePlayer.BattleMgr.DetailMgr.DetailPanelControl; + bool flag = ((detailPanelControl._card.EquelsID(battleCardBase) && detailPanelControl.CurrentShowRequest == DetailPanelControl.ShowRequest.FUSION_INFO_CARD_LIST) || battleCardBase.IsRecordingFusionInfo || battleCardBase.IsInHand) && battleCardBase.SelfBattlePlayer.SideLogSkill == null; + if (_flag == flag) + { + list.Add(battleCardBase); + } + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillIsInvokeSideLogorBuffDetailFilter.cs b/SVSim.BattleEngine/Engine/SkillIsInvokeSideLogorBuffDetailFilter.cs new file mode 100644 index 0000000..35fe16f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillIsInvokeSideLogorBuffDetailFilter.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillIsInvokeSideLogorBuffDetailFilter : ISkillCardFilter +{ + private IReadOnlyBattleCardInfo _owner; + + private bool _flag; + + public SkillIsInvokeSideLogorBuffDetailFilter(IReadOnlyBattleCardInfo owner, bool flag) + { + _owner = owner; + _flag = flag; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + foreach (IReadOnlyBattleCardInfo card in cards) + { + BattleCardBase battleCardBase = card as BattleCardBase; + BattlePlayerBase.SideLogInfo sideLogSkill = battleCardBase.SelfBattlePlayer.SideLogSkill; + bool flag = false; + if (sideLogSkill != null) + { + if ((sideLogSkill.Skill != null && sideLogSkill.Skill.IsInvoked) == _flag) + { + flag = true; + } + } + else if (battleCardBase != null && ((battleCardBase.IsClass && battleCardBase.SelfBattlePlayer.IsBuffDetail == _flag) || battleCardBase.IsBuffDetail == _flag)) + { + flag = true; + } + if ((!_owner.IsInplay && !_owner.IsInHand) == _flag) + { + flag = true; + } + if (flag) + { + list.Add(card); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillIsOwnerFilter.cs b/SVSim.BattleEngine/Engine/SkillIsOwnerFilter.cs new file mode 100644 index 0000000..27c9626 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillIsOwnerFilter.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillIsOwnerFilter : ISkillCardFilter +{ + private bool _isOwner; + + public SkillIsOwnerFilter(bool flag) + { + _isOwner = flag; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + bool isAdminWatch = GameMgr.GetIns().IsAdminWatch; + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (card.IsPlayer == _isOwner || isAdminWatch) + { + list.Add(card); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillIsWatchFilter.cs b/SVSim.BattleEngine/Engine/SkillIsWatchFilter.cs new file mode 100644 index 0000000..0e06206 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillIsWatchFilter.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillIsWatchFilter : ISkillCardFilter +{ + private bool _isWatchOk; + + public SkillIsWatchFilter(bool flag) + { + _isWatchOk = (GameMgr.GetIns().IsWatchBattle && !GameMgr.GetIns().IsReplayBattle) == flag; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + if (!_isWatchOk) + { + yield break; + } + foreach (IReadOnlyBattleCardInfo card in cards) + { + yield return card; + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillKeywordInfo.cs b/SVSim.BattleEngine/Engine/SkillKeywordInfo.cs new file mode 100644 index 0000000..c594522 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillKeywordInfo.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; + +public static class SkillKeywordInfo +{ + public enum SkillKeyword + { + damage_modifier, + attach_skill, + attack_by_life, + attack_count, + banish, + cant_activate_fanfare, + cant_activate_shortage_deck_win, + cant_attack, + cant_play, + cant_summon, + change_affiliation, + change_cemetery, + change_rally_count, + update_deck, + chant_count_change, + consume_ep_modifier, + cost_change, + damage, + damage_cut, + destroy, + discard, + drain, + draw, + evolve, + extra_turn, + force_berserk, + force_skill_target, + attract_skill_target, + force_avarice, + force_wrath, + guard, + heal, + ignore_guard, + independent, + not_be_debuffed, + indestructible, + killer, + lose, + metamorphose, + fusion_metamorphose, + transform, + none, + not_be_attacked, + play_count_change, + possess_ep_modifier, + power_down, + powerup, + power_modifier, + pp_fixeduse, + pp_modifier, + bp_modifier, + quick, + reflection, + remove_by_banish, + remove_by_destroy, + return_card, + rush, + select, + shield, + sneak, + special_win, + special_lose, + spell_charge, + summon_card, + summon_token, + token_draw, + special_token_draw, + trigger, + turn_start_fixed_pp, + unite, + untouchable, + repeat_skill, + choice, + shortage_deck_win, + generic_value_modifier, + change_union_burst_count, + change_skybound_art_count, + change_super_skybound_art_count, + change_white_ritual_stack, + stack_white_ritual, + rob_skill, + random_array, + no_duplication_random_array, + cant_evolution, + invoke_skill, + token_draw_modifier, + fusion, + random_attack, + clear_destroyed_and_discarded_card_list, + clear_summoned_card_list, + geton, + getoff, + not_decrease_pp, + heal_modifier, + life_zero_activate_leon_skill, + copy_skill, + loop_skill, + evolve_to_other, + not_attached_resident_chant_count_change, + invoke_emote, + invoke_voice, + can_play_self + } + + public static Dictionary Keyword2StringDictionary; + + static SkillKeywordInfo() + { + SetupStatic(); + } + + private static void SetupStatic() + { + if (Keyword2StringDictionary != null) + { + return; + } + Keyword2StringDictionary = new Dictionary(Enum.GetValues(typeof(SkillKeyword)).Length); + foreach (SkillKeyword value in Enum.GetValues(typeof(SkillKeyword))) + { + Keyword2StringDictionary.Add(value.ToString(), value); + } + } + + public static SkillKeyword GetKeyword(string info) + { + if (!Keyword2StringDictionary.TryGetValue(info, out var value)) + { + return SkillKeyword.none; + } + return value; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillLastBurialRiteCardFilter.cs b/SVSim.BattleEngine/Engine/SkillLastBurialRiteCardFilter.cs new file mode 100644 index 0000000..0a9a8e2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillLastBurialRiteCardFilter.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillLastBurialRiteCardFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + BattleCardBase battleCardBase = cards.ElementAt(i) as BattleCardBase; + list.AddRange(battleCardBase.SkillApplyInformation.LastBurialRiteCardList); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillLastFilter.cs b/SVSim.BattleEngine/Engine/SkillLastFilter.cs new file mode 100644 index 0000000..a09b108 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillLastFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillLastFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + if (cards.Count() > 0) + { + list.Add(cards.Last()); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillLastTargetTribeFilter.cs b/SVSim.BattleEngine/Engine/SkillLastTargetTribeFilter.cs new file mode 100644 index 0000000..2640f2a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillLastTargetTribeFilter.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillLastTargetTribeFilter : ISkillCardFilter +{ + private readonly bool _isEqual; + + public SkillLastTargetTribeFilter(string op) + { + _isEqual = op == "="; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + for (int i = 0; i < cards.Count(); i++) + { + if (!(cards.ElementAt(i) is BattleCardBase card)) + { + continue; + } + List lastTarget = card.SelfBattlePlayer.LastTargetCardsList.FirstOrDefault(); + for (int j = 0; j < lastTarget.Count; j++) + { + if (card.Tribe.FindAll(lastTarget[j].Tribe.Contains).Count > 0 == _isEqual) + { + yield return card; + } + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillLeaderSkinIdFilter.cs b/SVSim.BattleEngine/Engine/SkillLeaderSkinIdFilter.cs new file mode 100644 index 0000000..c1e3b6c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillLeaderSkinIdFilter.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillLeaderSkinIdFilter : ISkillCardFilter +{ + private readonly int _id; + + private readonly bool _isEqual; + + public SkillLeaderSkinIdFilter(int id, string op) + { + _id = id; + _isEqual = op == "="; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = cards.ElementAt(i); + if (readOnlyBattleCardInfo.IsPlayer) + { + if (dataMgr.GetPlayerSkinId() == _id && _isEqual) + { + list.Add(readOnlyBattleCardInfo); + } + } + else if (dataMgr.GetEnemySkinId() == _id && _isEqual) + { + list.Add(readOnlyBattleCardInfo); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillLifeIsLarger.cs b/SVSim.BattleEngine/Engine/SkillLifeIsLarger.cs new file mode 100644 index 0000000..c6fa729 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillLifeIsLarger.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillLifeIsLarger : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo s) => s.Life > s.Atk); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillLimitUpperCountFromNewestFilter.cs b/SVSim.BattleEngine/Engine/SkillLimitUpperCountFromNewestFilter.cs new file mode 100644 index 0000000..86a330d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillLimitUpperCountFromNewestFilter.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillLimitUpperCountFromNewestFilter : ISkillSelectFilter +{ + private int _limitCount; + + public SkillLimitUpperCountFromNewestFilter(int limitCount) + { + _limitCount = limitCount; + } + + public int CalcCount(SkillOptionValue option) + { + return -1; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + IEnumerable enumerable = cards.Except(checkerOption.SkillDrewCards.Cast()); + if (enumerable.Count() < _limitCount) + { + return enumerable; + } + return enumerable.Skip(enumerable.Count() - _limitCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillLimitUpperCountFromOldestFilter.cs b/SVSim.BattleEngine/Engine/SkillLimitUpperCountFromOldestFilter.cs new file mode 100644 index 0000000..a1ee772 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillLimitUpperCountFromOldestFilter.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillLimitUpperCountFromOldestFilter : ISkillSelectFilter +{ + private int _limitCount; + + public SkillLimitUpperCountFromOldestFilter(int limitCount) + { + _limitCount = limitCount; + } + + public int CalcCount(SkillOptionValue option) + { + return -1; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + if (cards.Count() < _limitCount) + { + return cards; + } + return cards.Take(_limitCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillLoadTargetFilter.cs b/SVSim.BattleEngine/Engine/SkillLoadTargetFilter.cs new file mode 100644 index 0000000..532d0b4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillLoadTargetFilter.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillLoadTargetFilter : ISkillCardFilter +{ + private IReadOnlyBattleCardInfo _ownerCard; + + public SkillLoadTargetFilter(IReadOnlyBattleCardInfo card) + { + _ownerCard = card; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return _ownerCard.SkillApplyInformation.LoadTargetList(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillMultiClanFilter.cs b/SVSim.BattleEngine/Engine/SkillMultiClanFilter.cs new file mode 100644 index 0000000..980049a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillMultiClanFilter.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillMultiClanFilter : ISkillCardFilter +{ + public readonly List ClanList; + + private readonly Func, bool> _compareFunc; + + public readonly string OptionText; + + public SkillMultiClanFilter(List clanList, string op) + { + ClanList = clanList; + OptionText = op; + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.Clan); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + int i; + for (i = 0; i < ClanList.Count; i++) + { + list.AddRange(cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc((int)c.Clan, (int)ClanList[i], c, cards))); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillNoDuplicationRandomSelectInOrderFilter.cs b/SVSim.BattleEngine/Engine/SkillNoDuplicationRandomSelectInOrderFilter.cs new file mode 100644 index 0000000..2cd41af --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillNoDuplicationRandomSelectInOrderFilter.cs @@ -0,0 +1,78 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillNoDuplicationRandomSelectInOrderFilter : ISkillSelectFilter +{ + private readonly string _randomSelectCount; + + private readonly ISkillParameterSelectFilter _sortFilter; + + private readonly ISkillParameterSelectFilter _duplicationFilter; + + private readonly ISkillCalcFilter _orderFilter; + + private string _assertionHeadMessage = "id_no_duplication_random_count_in_order="; + + public SkillNoDuplicationRandomSelectInOrderFilter(string optionText, SkillBase skill) + { + string[] array = optionText.Split(':'); + _assertionHeadMessage += optionText; + _duplicationFilter = CheckParamFilter(array[0], skill); + _sortFilter = CheckParamFilter(array[1], skill); + switch (array[2]) + { + case "descending": + _orderFilter = new SkillCalcMaxFilter(); + break; + case "ascending": + _orderFilter = new SkillCalcMinFilter(); + break; + default: + _orderFilter = new SkillCalcMaxFilter(); + break; + } + _randomSelectCount = array[3]; + } + + public int CalcCount(SkillOptionValue option) + { + return option.ParseInt(_randomSelectCount); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + int num = CalcCount(option); + List list = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + cards = cards.OrderBy((BattleCardBase x) => x.Index); + List list2 = cards.ToList(); + bool flag = list.Count < num; + while (flag && list2.Count > 0) + { + int LotteringValue = _orderFilter.Filtering(_sortFilter.Filtering(list2)); + List list3 = list2.Where((BattleCardBase card) => _sortFilter.Filtering(new BattleCardBase[1] { card }).FirstOrDefault() == LotteringValue).ToList(); + while (flag && list3.Count > 0) + { + int index = (BattleManagerBase.IsRandomDraw ? ins.StableRandom(list3.Count()) : 0); + BattleCardBase battleCardBase = list3[index]; + list.Add(battleCardBase); + int duplicationValue = _duplicationFilter.Filtering(new BattleCardBase[1] { battleCardBase }).FirstOrDefault(); + list2 = list2.Where((BattleCardBase c) => _duplicationFilter.Filtering(new BattleCardBase[1] { c.Card }).FirstOrDefault() != duplicationValue).ToList(); + list3 = list3.Where((BattleCardBase c) => _duplicationFilter.Filtering(new BattleCardBase[1] { c.Card }).FirstOrDefault() != duplicationValue).ToList(); + flag = list.Count < num; + } + } + return list; + } + + private ISkillParameterSelectFilter CheckParamFilter(string optionText, SkillBase skill) + { + SkillFilterCreator.ParseContentInfo(optionText, out var retParsedInfo); + ISkillParameterSelectFilter skillParameterSelectFilter = SkillFilterCreator.CreateParameterSelectFilter(retParsedInfo.Name, retParsedInfo, skill); + if (skillParameterSelectFilter == null) + { + skillParameterSelectFilter = new SkillParameterSelectCostFilter(); + } + return skillParameterSelectFilter; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillNotChantFieldFilter.cs b/SVSim.BattleEngine/Engine/SkillNotChantFieldFilter.cs new file mode 100644 index 0000000..daef019 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillNotChantFieldFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillNotChantFieldFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsField && !c.IsChantField); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillNullFilter.cs b/SVSim.BattleEngine/Engine/SkillNullFilter.cs new file mode 100644 index 0000000..2a60b64 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillNullFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillNullFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return Enumerable.Empty(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillOnlyOneCardFilter.cs b/SVSim.BattleEngine/Engine/SkillOnlyOneCardFilter.cs new file mode 100644 index 0000000..cab24b4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillOnlyOneCardFilter.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillOnlyOneCardFilter : ISkillCardFilter +{ + private int _index; + + public SkillOnlyOneCardFilter(int index) + { + _index = index; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = cards.ToList(); + List list2 = new List(); + if (_index < 0 || list.Count <= _index) + { + return list2; + } + if (list[_index] != null) + { + list2.Add(list[_index]); + } + return list2; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillOnlyOneFilter.cs b/SVSim.BattleEngine/Engine/SkillOnlyOneFilter.cs new file mode 100644 index 0000000..069305f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillOnlyOneFilter.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillOnlyOneFilter : ISkillSelectFilter +{ + private readonly string _parameterText; + + public SkillOnlyOneFilter(string parameterText) + { + _parameterText = parameterText; + } + + public int CalcCount(SkillOptionValue option) + { + return 1; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + int num = option.ParseInt(_parameterText); + List list = cards.ToList(); + List list2 = new List(); + if (num < 0 || list.Count <= num) + { + return list2; + } + if (list[num] != null) + { + list2.Add(list[num]); + } + return list2; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterActivatedRandomArrayFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterActivatedRandomArrayFilter.cs new file mode 100644 index 0000000..3e864d5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterActivatedRandomArrayFilter.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterActivatedRandomArrayFilter : ISkillParameterSelectFilter +{ + private int _index; + + public SkillParameterActivatedRandomArrayFilter(int index) + { + _index = index; + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select(delegate(IReadOnlyBattleCardInfo c) + { + BattleCardBase battleCardBase = c as BattleCardBase; + return (battleCardBase.Skills.FirstOrDefault((SkillBase s) => s is Skill_random_array) is Skill_random_array skill_random_array) ? (skill_random_array.GetAllSkillSelectedIndex(skill_random_array.SkillPrm.ownerCard, battleCardBase).Contains(_index) ? 1 : 0) : 0; + }); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterAttackCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterAttackCountFilter.cs new file mode 100644 index 0000000..101cf81 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterAttackCountFilter.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterAttackCountFilter : ISkillCardFilter +{ + private readonly int parameter; + + private readonly bool IsPreAction; + + private readonly Func, bool> _compareFunc; + + public SkillParameterAttackCountFilter(string value, string op) + { + if (value == "pre_action") + { + IsPreAction = true; + return; + } + parameter = int.Parse(value); + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.AttackableCount); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + if (!IsPreAction) + { + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.AttackableCount, parameter, c, cards)); + } + return cards.Where((IReadOnlyBattleCardInfo c) => c.AttackableCount < c.MaxAttackableCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterBaseCardIdFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterBaseCardIdFilter.cs new file mode 100644 index 0000000..7f7939f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterBaseCardIdFilter.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterBaseCardIdFilter : SkillParameterIdFilter +{ + public SkillParameterBaseCardIdFilter(string parameterText, string op) + : base(parameterText, op) + { + } + + public override IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + if (_isIntersection) + { + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (!_parameterTexts.Any((string p) => !_compareFunc(card.BaseParameter.BaseCardId, option.ParseInt(p), card, cards))) + { + list.Add(card); + } + } + } + else + { + for (int num = 0; num < _parameterTexts.Length; num++) + { + int value = option.ParseInt(_parameterTexts[num]); + list.AddRange(cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.BaseParameter.BaseCardId, value, c, cards))); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterBaseCostFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterBaseCostFilter.cs new file mode 100644 index 0000000..9f2f0d7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterBaseCostFilter.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterBaseCostFilter : SkillCardFilterBase +{ + private readonly Func, bool> _compareFunc; + + public SkillParameterBaseCostFilter(string parameterText, string op) + : base(parameterText, op) + { + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.BaseCost); + } + + public override IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + int value = option.ParseInt(_parameterText); + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.BaseParameter.Cost, value, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterBaseLifeFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterBaseLifeFilter.cs new file mode 100644 index 0000000..85a2bdd --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterBaseLifeFilter.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterBaseLifeFilter : SkillCardFilterBase +{ + private readonly Func, bool> _compareFunc; + + public SkillParameterBaseLifeFilter(string parameterText, string op) + : base(parameterText, op) + { + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.BaseLife); + } + + public override IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + int value = option.ParseInt(_parameterText); + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.BaseParameter.Life, value, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterBaseOffenseFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterBaseOffenseFilter.cs new file mode 100644 index 0000000..5ef1d76 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterBaseOffenseFilter.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterBaseOffenseFilter : SkillCardFilterBase +{ + private readonly Func, bool> _compareFunc; + + public SkillParameterBaseOffenseFilter(string parameterText, string op) + : base(parameterText, op) + { + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.Cost); + } + + public override IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + int value = option.ParseInt(_parameterText); + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.BaseParameter.Atk, value, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterBuffCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterBuffCountFilter.cs new file mode 100644 index 0000000..1dd9ca9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterBuffCountFilter.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterBuffCountFilter : ISkillCardFilter +{ + private readonly int parameter; + + private readonly Func, bool> _compareFunc; + + private string _optionText = ""; + + public SkillParameterBuffCountFilter(int parameter, string op) + { + this.parameter = parameter; + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.BuffCount); + _optionText = op; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.SkillApplyInformation.BuffCount, parameter, c, cards)); + } + + public int GetParameter() + { + return parameter; + } + + public string GetOptionText() + { + return _optionText; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterBuffLifeCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterBuffLifeCountFilter.cs new file mode 100644 index 0000000..6e02360 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterBuffLifeCountFilter.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterBuffLifeCountFilter : ISkillCardFilter +{ + private readonly int parameter; + + private readonly Func, bool> _compareFunc; + + private string _optionText = ""; + + public SkillParameterBuffLifeCountFilter(int parameter, string op) + { + this.parameter = parameter; + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.BuffLifeCount); + _optionText = op; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.SkillApplyInformation.BuffLifeCount, parameter, c, cards)); + } + + public int GetParameter() + { + return parameter; + } + + public string GetOptionText() + { + return _optionText; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterChangeMaxLifeCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterChangeMaxLifeCountFilter.cs new file mode 100644 index 0000000..f4c9878 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterChangeMaxLifeCountFilter.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterChangeMaxLifeCountFilter : ISkillCardFilter +{ + private readonly int _parameter; + + private readonly Func, bool> _compareFunc; + + public SkillParameterChangeMaxLifeCountFilter(int parameter, string op) + { + _parameter = parameter; + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.ChangeMaxLifeCount); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.SkillApplyInformation.GetChangeMaxLifeCount(), _parameter, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterChantCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterChantCountFilter.cs new file mode 100644 index 0000000..37cddf9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterChantCountFilter.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterChantCountFilter : SkillCardFilterBase +{ + private readonly Func, bool> _compareFunc; + + public SkillParameterChantCountFilter(string parameterText, string op) + : base(parameterText, op) + { + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.ChantCount); + } + + public override IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + int param = option.ParseInt(_parameterText); + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.ChantCount, param, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterChargeCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterChargeCountFilter.cs new file mode 100644 index 0000000..52dc116 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterChargeCountFilter.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterChargeCountFilter : ISkillCardFilter +{ + private readonly Func, bool> _compareFunc; + + public int Parameter { get; private set; } + + public string Option { get; private set; } + + public SkillParameterChargeCountFilter(int parameter, string op) + { + Parameter = parameter; + Option = op; + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.ChantCount); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.HasSpellCharge && _compareFunc(c.SpellChargeCount, Parameter, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterCostFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterCostFilter.cs new file mode 100644 index 0000000..6abd125 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterCostFilter.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterCostFilter : SkillCardFilterBase +{ + private readonly Func, bool> _compareFunc; + + public SkillParameterCostFilter(string parameterText, string op) + : base(parameterText, op) + { + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.Cost); + } + + public override IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + int value = option.ParseInt(_parameterText); + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.Cost, value, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterDestroyFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterDestroyFilter.cs new file mode 100644 index 0000000..c75f193 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterDestroyFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterDestroyFilter : ISkillCardFilter +{ + private bool isDestroy; + + public SkillParameterDestroyFilter(string value) + { + isDestroy = value == "true"; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsDead == isDestroy); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterDestroyedByAbilityFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterDestroyedByAbilityFilter.cs new file mode 100644 index 0000000..09e10cd --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterDestroyedByAbilityFilter.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterDestroyedByAbilityFilter : ISkillCardFilter +{ + private readonly BattleCardBase.DestroyedBySkillInfo.DestroyedBySkillAbility _ability; + + public SkillParameterDestroyedByAbilityFilter(SkillFilterCreator.ContentKeyword keyword) + { + switch (keyword) + { + case SkillFilterCreator.ContentKeyword.when_play: + _ability = BattleCardBase.DestroyedBySkillInfo.DestroyedBySkillAbility.WhenPlay; + break; + case SkillFilterCreator.ContentKeyword.when_accelerate: + _ability = BattleCardBase.DestroyedBySkillInfo.DestroyedBySkillAbility.Accelerate; + break; + default: + _ability = BattleCardBase.DestroyedBySkillInfo.DestroyedBySkillAbility.None; + break; + } + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo card = cards.ElementAt(i); + for (int j = 0; j < card.DestroyedBySkillList.Count; j++) + { + if (card.DestroyedBySkillList.ElementAt(j).Ability == _ability) + { + yield return card; + } + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterDestroyedByCardIdAndAbilityFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterDestroyedByCardIdAndAbilityFilter.cs new file mode 100644 index 0000000..37b6feb --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterDestroyedByCardIdAndAbilityFilter.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterDestroyedByCardIdAndAbilityFilter : ISkillCardFilter +{ + private readonly string _parameterText; + + private readonly BattleCardBase.DestroyedBySkillInfo.DestroyedBySkillAbility _ability; + + private readonly string _player = string.Empty; + + public SkillParameterDestroyedByCardIdAndAbilityFilter(string parameterText) + { + string[] array = parameterText.Split(':'); + _parameterText = array[0]; + switch (array[1]) + { + case "when_play": + _ability = BattleCardBase.DestroyedBySkillInfo.DestroyedBySkillAbility.WhenPlay; + break; + case "when_accelerate": + _ability = BattleCardBase.DestroyedBySkillInfo.DestroyedBySkillAbility.Accelerate; + break; + case "when_destroy": + _ability = BattleCardBase.DestroyedBySkillInfo.DestroyedBySkillAbility.WhenDestroy; + break; + default: + _ability = BattleCardBase.DestroyedBySkillInfo.DestroyedBySkillAbility.None; + break; + } + if (array.Length >= 3) + { + _player = array[2].ToString(); + } + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + int id = option.ParseInt(_parameterText); + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo card = cards.ElementAt(i); + for (int j = 0; j < card.DestroyedBySkillList.Count; j++) + { + BattleCardBase.DestroyedBySkillInfo destroyedBySkillInfo = card.DestroyedBySkillList.ElementAt(j); + if (destroyedBySkillInfo.BaseCardId == id && destroyedBySkillInfo.Ability == _ability && (!(_player != string.Empty) || !(destroyedBySkillInfo.Player != _player))) + { + yield return card; + } + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterDestroyedByCardIdFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterDestroyedByCardIdFilter.cs new file mode 100644 index 0000000..3d36387 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterDestroyedByCardIdFilter.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterDestroyedByCardIdFilter : ISkillCardFilter +{ + private readonly string _parameterText; + + public SkillParameterDestroyedByCardIdFilter(string parameterText) + { + _parameterText = parameterText; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + int id = option.ParseInt(_parameterText); + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo card = cards.ElementAt(i); + for (int j = 0; j < card.DestroyedBySkillList.Count; j++) + { + if (card.DestroyedBySkillList.ElementAt(j).BaseCardId == id) + { + yield return card; + } + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterDestroyedByFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterDestroyedByFilter.cs new file mode 100644 index 0000000..b0c08d6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterDestroyedByFilter.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterDestroyedByFilter : ISkillCardFilter +{ + private string _player; + + public SkillParameterDestroyedByFilter(SkillFilterCreator.ContentKeyword keyword) + { + switch (keyword) + { + case SkillFilterCreator.ContentKeyword.self_ability: + _player = "me"; + break; + case SkillFilterCreator.ContentKeyword.both_ability: + _player = "both"; + break; + default: + _player = string.Empty; + break; + } + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = cards.ElementAt(i); + if (readOnlyBattleCardInfo.DestroyedBySkillList.Any((BattleCardBase.DestroyedBySkillInfo s) => s.Player == _player || _player == "both")) + { + list.Add(readOnlyBattleCardInfo); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterDistinctRandomSelectedFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterDistinctRandomSelectedFilter.cs new file mode 100644 index 0000000..c1b0637 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterDistinctRandomSelectedFilter.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterDistinctRandomSelectedFilter : ISkillParameterSelectFilter +{ + private int _id; + + private int _index; + + public SkillParameterDistinctRandomSelectedFilter(string str) + { + string[] array = str.Split(':'); + _id = int.Parse(array[0]); + _index = int.Parse(array[1]); + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select(delegate(IReadOnlyBattleCardInfo c) + { + BattleCardBase battleCardBase = c as BattleCardBase; + for (int i = 0; i < battleCardBase.SkillApplyInformation.AttachedSkillsInfo.AttachedSkills.Count(); i++) + { + if (battleCardBase.SkillApplyInformation.AttachedSkillsInfo.AttachedSkills.ElementAt(i) is Skill_random_array { GetAttachSkill: not null } skill_random_array && skill_random_array.GetAttachSkill.SkillPrm.ownerCard.BaseParameter.BaseCardId == _id && skill_random_array.SelectedIndex.ContainsKey(battleCardBase)) + { + if (!skill_random_array.SelectedIndex[battleCardBase].Contains(_index)) + { + return 0; + } + return 1; + } + } + return 0; + }); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterFusionCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterFusionCountFilter.cs new file mode 100644 index 0000000..29e054c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterFusionCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterFusionCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetFusionCount()); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterHasSkillFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterHasSkillFilter.cs new file mode 100644 index 0000000..0c404b9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterHasSkillFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterHasSkillFilter : ISkillCardFilter +{ + private bool _hasSkill; + + public SkillParameterHasSkillFilter(string value) + { + _hasSkill = value == "true"; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.HasAnySkill == _hasSkill); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterHealCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterHealCountFilter.cs new file mode 100644 index 0000000..6282707 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterHealCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterHealCountFilter : ISkillParameterSelectFilter +{ + public virtual IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.HealList.Count); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterHealValueFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterHealValueFilter.cs new file mode 100644 index 0000000..3acc3a4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterHealValueFilter.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterHealValueFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + if (checkerOption.HealingCardAndValue == null) + { + return new List(); + } + return from h in checkerOption.HealingCardAndValue + where cardInfos.Contains(h.Card) + select h.Value; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterIdFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterIdFilter.cs new file mode 100644 index 0000000..a4686c1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterIdFilter.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterIdFilter : ISkillCardFilter +{ + protected bool _isIntersection; + + protected readonly string[] _parameterTexts; + + protected readonly Func, bool> _compareFunc; + + private string _optionText = ""; + + public SkillParameterIdFilter(string parameterText, string op) + { + if (parameterText.Contains("|")) + { + _parameterTexts = parameterText.Split('|'); + _isIntersection = true; + } + else + { + _parameterTexts = parameterText.Split(':'); + } + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.CardId); + _optionText = op; + } + + public virtual IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + if (_isIntersection) + { + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (!_parameterTexts.Any((string p) => !_compareFunc(card.BaseParameter.NormalCardId, option.ParseInt(p), card, cards))) + { + list.Add(card); + } + } + } + else + { + for (int num = 0; num < _parameterTexts.Length; num++) + { + int value = option.ParseInt(_parameterTexts[num]); + list.AddRange(cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.BaseParameter.NormalCardId, value, c, cards))); + } + } + return list; + } + + public string[] GetFilterId() + { + return _parameterTexts; + } + + public string GetOptionText() + { + return _optionText; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterIsChaosFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterIsChaosFilter.cs new file mode 100644 index 0000000..5ab3675 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterIsChaosFilter.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillParameterIsChaosFilter : ISkillCardFilter +{ + private bool _isChaos; + + private NetworkUserInfoData _userInfo; + + public SkillParameterIsChaosFilter(string value) + { + _isChaos = value == "true"; + _userInfo = GameMgr.GetIns().GetNetworkUserInfoData(); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + if ((_isChaos && _userInfo.GetSelfChaosId() != -1) || (!_isChaos && _userInfo.GetSelfChaosId() == -1)) + { + return cards; + } + return new List(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterIsTurnFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterIsTurnFilter.cs new file mode 100644 index 0000000..4423c08 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterIsTurnFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterIsTurnFilter : ISkillParameterSelectFilter +{ + private readonly bool _isSelf; + + public SkillParameterIsTurnFilter(string target) + { + _isSelf = target == SkillFilterCreator.ContentKeyword.self.ToString(); + } + + public virtual IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => (c.IsSelfTurn == _isSelf) ? 1 : 0); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterIsUnlimitedFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterIsUnlimitedFilter.cs new file mode 100644 index 0000000..32ede1d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterIsUnlimitedFilter.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using Wizard; +using Wizard.Battle; + +public class SkillParameterIsUnlimitedFilter : ISkillCardFilter +{ + private bool _isUnlimitedOk; + + public SkillParameterIsUnlimitedFilter(bool flag) + { + _isUnlimitedOk = Data.CurrentFormat == Format.Unlimited == flag; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + if (_isUnlimitedOk) + { + return cards; + } + return new List(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterLastLifeFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterLastLifeFilter.cs new file mode 100644 index 0000000..b2bd366 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterLastLifeFilter.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterLastLifeFilter : ISkillCardFilter +{ + private readonly int parameter; + + private readonly Func, bool> _compareFunc; + + private string _optionText = ""; + + public SkillParameterLastLifeFilter(int parameter, string op) + { + this.parameter = parameter; + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.LastLife); + _optionText = op; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.SkillApplyInformation.GetLastLife(), parameter, c, cards)); + } + + public int GetParameter() + { + return parameter; + } + + public string GetOptionText() + { + return _optionText; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterLifeFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterLifeFilter.cs new file mode 100644 index 0000000..db7dc94 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterLifeFilter.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterLifeFilter : SkillCardFilterBase +{ + private readonly Func, bool> _compareFunc; + + public SkillParameterLifeFilter(string parameterText, string op) + : base(parameterText, op) + { + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.Life); + } + + public override IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + int value = option.ParseInt(_parameterText); + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.Life, value, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterLoadTargetCardId.cs b/SVSim.BattleEngine/Engine/SkillParameterLoadTargetCardId.cs new file mode 100644 index 0000000..4352fde --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterLoadTargetCardId.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterLoadTargetCardId : ISkillParameterSelectFilter +{ + private long _id; + + public SkillParameterLoadTargetCardId(string option, SkillBase skill) + { + string[] array = option.Split(':'); + _id = long.Parse(array[0]); + if (array.Count() > 1 && array[1] == SkillFilterCreator.ContentKeyword.is_individual.ToString()) + { + _id += skill.IndividualId; + } + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + List list = new List(); + for (int i = 0; i < cardInfos.Count(); i++) + { + list.AddRange(cardInfos.ElementAt(i).SkillApplyInformation.LoadTargetCardId(_id)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterMaxAttackCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterMaxAttackCountFilter.cs new file mode 100644 index 0000000..f10ba2f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterMaxAttackCountFilter.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterMaxAttackCountFilter : ISkillCardFilter +{ + private readonly int parameter; + + private readonly Func, bool> _compareFunc; + + public SkillParameterMaxAttackCountFilter(string value, string op) + { + parameter = int.Parse(value); + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.MaxAttackableCount); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.MaxAttackableCount, parameter, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterMaxLifeFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterMaxLifeFilter.cs new file mode 100644 index 0000000..e983c52 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterMaxLifeFilter.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterMaxLifeFilter : ISkillCardFilter +{ + private readonly string _parameterText; + + private readonly Func, bool> _compareFunc; + + public SkillParameterMaxLifeFilter(string parameterText, string op) + { + _parameterText = parameterText; + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.MaxLife); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + int value = option.ParseInt(_parameterText); + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.MaxLife, value, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterOffenseFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterOffenseFilter.cs new file mode 100644 index 0000000..06b213a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterOffenseFilter.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterOffenseFilter : SkillCardFilterBase +{ + private readonly Func, bool> _compareFunc; + + public SkillParameterOffenseFilter(string parameterText, string op) + : base(parameterText, op) + { + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.Atk); + } + + public override IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + int value = option.ParseInt(_parameterText); + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.Atk, value, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterPreviousTurnAttackedFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterPreviousTurnAttackedFilter.cs new file mode 100644 index 0000000..52dd344 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterPreviousTurnAttackedFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterPreviousTurnAttackedFilter : ISkillCardFilter +{ + private bool isAttacked; + + public SkillParameterPreviousTurnAttackedFilter(string value) + { + isAttacked = value == "true"; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c is BattleCardBase && (c as BattleCardBase).IsPreviousTurnAttacked == isAttacked); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterRandomArrayFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterRandomArrayFilter.cs new file mode 100644 index 0000000..1f1da9e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterRandomArrayFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterRandomArrayFilter : ISkillParameterSelectFilter +{ + protected readonly int index; + + public SkillParameterRandomArrayFilter(string option) + { + int.TryParse(option, out index); + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => (c.SkillApplyInformation.SkillRandomArray == null || c.SkillApplyInformation.SkillRandomArray.Length <= index) ? (-1) : c.SkillApplyInformation.SkillRandomArray[index]); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterRarityFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterRarityFilter.cs new file mode 100644 index 0000000..91911fa --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterRarityFilter.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterRarityFilter : ISkillCardFilter +{ + private readonly int _parameter; + + private readonly Func, bool> _compareFunc; + + public SkillParameterRarityFilter(int parameter, string op) + { + _parameter = parameter; + _compareFunc = SkillCompareFuncCreator.Create(op, SkillCompareFuncCreator.ChangeMaxLifeCount); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => _compareFunc(c.BaseParameter.Rarity, _parameter, c, cards)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterReturnedByFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterReturnedByFilter.cs new file mode 100644 index 0000000..a6dbcd9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterReturnedByFilter.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterReturnedByFilter : ISkillCardFilter +{ + private BattleCardBase _ownerCard; + + private bool _isPlayer; + + public SkillParameterReturnedByFilter(IReadOnlyBattleCardInfo ownerCard, SkillFilterCreator.ContentKeyword keyword) + { + _ownerCard = ownerCard as BattleCardBase; + _isPlayer = keyword == SkillFilterCreator.ContentKeyword.self_ability; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = cards.ElementAt(i); + if (readOnlyBattleCardInfo.ReturnedSkill != null && readOnlyBattleCardInfo.ReturnedSkill.SkillPrm.ownerCard.SelfBattlePlayer.IsPlayer == _ownerCard.SelfBattlePlayer.IsPlayer == _isPlayer) + { + list.Add(readOnlyBattleCardInfo); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectAttackCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectAttackCountFilter.cs new file mode 100644 index 0000000..4f8f704 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectAttackCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectAttackCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.AttackableCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectBaseCardIdFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectBaseCardIdFilter.cs new file mode 100644 index 0000000..56072bf --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectBaseCardIdFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectBaseCardIdFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.BaseParameter.BaseCardId); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectBaseCostFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectBaseCostFilter.cs new file mode 100644 index 0000000..a4a817b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectBaseCostFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectBaseCostFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.BaseParameter.Cost); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectBaseLifeFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectBaseLifeFilter.cs new file mode 100644 index 0000000..32db2ab --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectBaseLifeFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectBaseLifeFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.BaseParameter.Life); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectBaseOffenseFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectBaseOffenseFilter.cs new file mode 100644 index 0000000..bc92910 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectBaseOffenseFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectBaseOffenseFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.BaseParameter.Atk); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectBuffCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectBuffCountFilter.cs new file mode 100644 index 0000000..7e9e6eb --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectBuffCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectBuffCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.BuffCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectChangeMaxLifeCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectChangeMaxLifeCountFilter.cs new file mode 100644 index 0000000..9c0de3c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectChangeMaxLifeCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectChangeMaxLifeCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetChangeMaxLifeCount()); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectChantCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectChantCountFilter.cs new file mode 100644 index 0000000..566faf1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectChantCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectChantCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.ChantCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectChargeCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectChargeCountFilter.cs new file mode 100644 index 0000000..98e8606 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectChargeCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectChargeCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SpellChargeCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectCostFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectCostFilter.cs new file mode 100644 index 0000000..eea06fd --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectCostFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectCostFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.Cost); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectDamageCount.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectDamageCount.cs new file mode 100644 index 0000000..51c89ae --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectDamageCount.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectDamageCount : ISkillParameterSelectFilter +{ + private readonly string _option = string.Empty; + + public SkillParameterSelectDamageCount(string option) + { + _option = option; + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.DamagedCounter.GetDamageCount(_option == SkillFilterCreator.ContentKeyword.self.ToStringCustom())); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectEvenChargeCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectEvenChargeCountFilter.cs new file mode 100644 index 0000000..4ff5048 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectEvenChargeCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectEvenChargeCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SpellChargeCount / 2); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectFixedGenericValueFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectFixedGenericValueFilter.cs new file mode 100644 index 0000000..3b5f010 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectFixedGenericValueFilter.cs @@ -0,0 +1,24 @@ +public class SkillParameterSelectFixedGenericValueFilter : SkillParameterSelectGenericValueFilter +{ + public SkillParameterSelectFixedGenericValueFilter(string index, SkillBase skill) + : base(index, skill) + { + } + + protected override int GetGenericValue(BattleCardBase card) + { + if (card.SkillApplyInformation.IsContainGenericValueKey(_key)) + { + return card.SkillApplyInformation.SkillGenericKeyAndValue[_key]; + } + if (!int.TryParse(_key, out var result)) + { + return -1; + } + if (card.SkillApplyInformation.SkillGenericValueArray != null && result >= 0 && result < card.SkillApplyInformation.SkillGenericValueArray.Length) + { + return card.SkillApplyInformation.SkillGenericValueArray[result]; + } + return -1; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectFixedGenericValueInitialFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectFixedGenericValueInitialFilter.cs new file mode 100644 index 0000000..97d614b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectFixedGenericValueInitialFilter.cs @@ -0,0 +1,20 @@ +public class SkillParameterSelectFixedGenericValueInitialFilter : SkillParameterSelectFixedGenericValueFilter +{ + private readonly int _initalValue; + + public SkillParameterSelectFixedGenericValueInitialFilter(string index, string option, SkillBase skill) + : base(index, skill) + { + int.TryParse(option, out _initalValue); + } + + protected override int GetGenericValue(BattleCardBase card) + { + int num = base.GetGenericValue(card); + if (num == -1) + { + num = _initalValue; + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectGenericValueFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectGenericValueFilter.cs new file mode 100644 index 0000000..0b7060c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectGenericValueFilter.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public abstract class SkillParameterSelectGenericValueFilter : ISkillParameterSelectFilter +{ + protected string _key = string.Empty; + + protected SkillParameterSelectGenericValueFilter(string key, SkillBase skill) + { + _key = key; + if (_key == string.Empty) + { + _key = "0"; + } + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + List list = new List(); + foreach (IReadOnlyBattleCardInfo cardInfo in cardInfos) + { + BattleCardBase card = cardInfo as BattleCardBase; + list.Add(GetGenericValue(card)); + } + return list; + } + + protected abstract int GetGenericValue(BattleCardBase card); +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectIdFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectIdFilter.cs new file mode 100644 index 0000000..2882e4f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectIdFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectIdFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => (!c.BaseParameter.IsChoiceEvolutionCard) ? c.BaseParameter.NormalCardId : c.BaseParameter.BaseCardId); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectLastCostFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectLastCostFilter.cs new file mode 100644 index 0000000..1876ef1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectLastCostFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectLastCostFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.LastCost); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectLastLifeFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectLastLifeFilter.cs new file mode 100644 index 0000000..08ed296 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectLastLifeFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectLastLifeFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetLastLife()); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectLastUsedPpCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectLastUsedPpCountFilter.cs new file mode 100644 index 0000000..887ffef --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectLastUsedPpCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectLastUsedPpCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.PlayedCost); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectLifeFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectLifeFilter.cs new file mode 100644 index 0000000..2eb0a94 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectLifeFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectLifeFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.Life); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectMaxAttackCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectMaxAttackCountFilter.cs new file mode 100644 index 0000000..ac58d8d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectMaxAttackCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectMaxAttackCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.MaxAttackableCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectMaxLifeFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectMaxLifeFilter.cs new file mode 100644 index 0000000..e10bee9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectMaxLifeFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectMaxLifeFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.MaxLife); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectOddChargeCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectOddChargeCountFilter.cs new file mode 100644 index 0000000..155e860 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectOddChargeCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectOddChargeCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => (c.SpellChargeCount + 1) / 2); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectOffenseFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectOffenseFilter.cs new file mode 100644 index 0000000..607bd23 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectOffenseFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectOffenseFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.Atk); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectRandomGenericValueFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectRandomGenericValueFilter.cs new file mode 100644 index 0000000..1b80a3b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectRandomGenericValueFilter.cs @@ -0,0 +1,18 @@ +public class SkillParameterSelectRandomGenericValueFilter : SkillParameterSelectGenericValueFilter +{ + public SkillParameterSelectRandomGenericValueFilter(string index, SkillBase skill) + : base(index, skill) + { + } + + protected override int GetGenericValue(BattleCardBase card) + { + int num = int.Parse(_key); + int num2 = card.SkillApplyInformation.SkillGenericValueArray[num]; + if (num2 <= 0) + { + return 0; + } + return card.SelfBattlePlayer.BattleMgr.StableRandom(num2 + 1); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectRemainActionCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectRemainActionCountFilter.cs new file mode 100644 index 0000000..af46eb9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectRemainActionCountFilter.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectRemainActionCountFilter : ISkillParameterSelectFilter +{ + private string _skillId; + + public SkillParameterSelectRemainActionCountFilter(string option, SkillBase skill) + { + string[] array = option.Split(':'); + long num = long.Parse(array[0]); + if (array.Count() > 1 && array[1] == SkillFilterCreator.ContentKeyword.is_individual.ToString() && skill != null) + { + num += skill.IndividualId; + } + _skillId = num.ToString(); + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + List list = new List(); + for (int i = 0; i < cardInfos.Count(); i++) + { + IEnumerable source = (cardInfos.ElementAt(i) as BattleCardBase).Skills.SelectMany((SkillBase s) => s.PreprocessList.Where((SkillPreprocessBase p) => p is SkillPreprocessRemoveAfterAction)); + for (int num = 0; num < source.Count(); num++) + { + SkillPreprocessRemoveAfterAction skillPreprocessRemoveAfterAction = source.ElementAt(num) as SkillPreprocessRemoveAfterAction; + if (skillPreprocessRemoveAfterAction.BanId == _skillId) + { + list.Add(skillPreprocessRemoveAfterAction.Count); + break; + } + } + } + if (list.Count == 0) + { + list.Add(0); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectRemainActionCountFromSelfFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectRemainActionCountFromSelfFilter.cs new file mode 100644 index 0000000..838d7b0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectRemainActionCountFromSelfFilter.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectRemainActionCountFromSelfFilter : ISkillParameterSelectFilter +{ + private IReadOnlyBattleCardInfo _originOwnerCard; + + public SkillParameterSelectRemainActionCountFromSelfFilter(IReadOnlyBattleCardInfo card) + { + _originOwnerCard = card; + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + List list = new List(); + if (_originOwnerCard != null) + { + for (int i = 0; i < cardInfos.Count(); i++) + { + BattleCardBase card = cardInfos.ElementAt(i) as BattleCardBase; + IEnumerable source = card.Skills.Where((SkillBase s) => _originOwnerCard.EquelsID((!s.IsAttachedSkill || s.GetAttachSkill == null) ? card : s.GetAttachSkill.SkillPrm.ownerCard)).SelectMany((SkillBase s) => s.PreprocessList.Where((SkillPreprocessBase p) => p is SkillPreprocessRemoveAfterAction)); + for (int num = 0; num < source.Count(); num++) + { + SkillPreprocessRemoveAfterAction skillPreprocessRemoveAfterAction = source.ElementAt(num) as SkillPreprocessRemoveAfterAction; + list.Add(skillPreprocessRemoveAfterAction.Count); + } + } + } + if (list.Count == 0) + { + list.Add(0); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectSkyboundArtCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectSkyboundArtCountFilter.cs new file mode 100644 index 0000000..591eb60 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectSkyboundArtCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectSkyboundArtCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.SkyboundArtCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectSuperSkyboundArtCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectSuperSkyboundArtCountFilter.cs new file mode 100644 index 0000000..6b3e730 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectSuperSkyboundArtCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectSuperSkyboundArtCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.SuperSkyboundArtCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectUnionBurstCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectUnionBurstCountFilter.cs new file mode 100644 index 0000000..e3f52d5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectUnionBurstCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectUnionBurstCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.UnionBurstCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSelectWhiteRitualCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSelectWhiteRitualCountFilter.cs new file mode 100644 index 0000000..058f9b4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSelectWhiteRitualCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSelectWhiteRitualCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.WhiteRitualCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSkillActivatedCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSkillActivatedCountFilter.cs new file mode 100644 index 0000000..3e49485 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSkillActivatedCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSkillActivatedCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillActivatedCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSkillHealValueFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSkillHealValueFilter.cs new file mode 100644 index 0000000..b7615ee --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSkillHealValueFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSkillHealValueFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.SkillHealList.Sum()); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterSkillIdActivatedCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterSkillIdActivatedCountFilter.cs new file mode 100644 index 0000000..ffe680b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterSkillIdActivatedCountFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterSkillIdActivatedCountFilter : ISkillParameterSelectFilter +{ + private long _skillId; + + public SkillParameterSkillIdActivatedCountFilter(long skillId) + { + _skillId = skillId; + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillActivationList.Count((BattleCardBase.SkillActivationInfo s) => s.SkillId == _skillId)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterStrictDestroyFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterStrictDestroyFilter.cs new file mode 100644 index 0000000..4da9673 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterStrictDestroyFilter.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterStrictDestroyFilter : ISkillCardFilter +{ + private bool isDestroy; + + public SkillParameterStrictDestroyFilter(string value) + { + isDestroy = value == "true"; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo card) => IsStrictDestroy(card) == isDestroy); + } + + private bool IsStrictDestroy(IReadOnlyBattleCardInfo card) + { + if (card.IsDead && !card.DeathTypeInfo.BanishDestroy && !card.DeathTypeInfo.LeaveByGetOn) + { + return card.MetamorphoseCard == null; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterThisTurnSkillActivatedCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterThisTurnSkillActivatedCountFilter.cs new file mode 100644 index 0000000..f3bb55a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterThisTurnSkillActivatedCountFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterThisTurnSkillActivatedCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.ThisTurnSkillActivatedCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnAcceleratedCardCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnAcceleratedCardCountFilter.cs new file mode 100644 index 0000000..63c35ac --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnAcceleratedCardCountFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnAcceleratedCardCountFilter : ISkillParameterSelectFilter +{ + protected readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillParameterTurnAcceleratedCardCountFilter(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public virtual IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnAcceleratedCardCount(c, _turnPlayerInfo)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnAcceleratedCardCountTextFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnAcceleratedCardCountTextFilter.cs new file mode 100644 index 0000000..4012c0d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnAcceleratedCardCountTextFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnAcceleratedCardCountTextFilter : SkillParameterTurnAcceleratedCardCountFilter +{ + public SkillParameterTurnAcceleratedCardCountTextFilter(string option) + : base(option) + { + } + + public override IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnAcceleratedCardCountOnlySelf(c, _turnPlayerInfo)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnAmountValueFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnAmountValueFilter.cs new file mode 100644 index 0000000..fdfa92b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnAmountValueFilter.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnAmountValueFilter : ISkillParameterSelectFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + private Dictionary _searchedTurnAmountDictionary; + + public SkillParameterTurnAmountValueFilter(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + if (_turnPlayerInfo.IsAllTurn) + { + _searchedTurnAmountDictionary = new Dictionary(); + } + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + IEnumerable result = null; + if (!_turnPlayerInfo.IsAllTurn) + { + return result; + } + IEnumerable> enumerable = cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnDamageValueList(c, _turnPlayerInfo)); + IEnumerable> enumerable2 = cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnHealValueList(c, _turnPlayerInfo)); + _searchedTurnAmountDictionary.Clear(); + foreach (List item in enumerable) + { + for (int num = 0; num < item.Count; num++) + { + if (_searchedTurnAmountDictionary.Keys.Contains(item[num].Turn.ToString() + item[num].IsSelfTurn)) + { + _searchedTurnAmountDictionary[item[num].Turn.ToString() + item[num].IsSelfTurn] += item[num].Damage; + } + else + { + _searchedTurnAmountDictionary.Add(item[num].Turn.ToString() + item[num].IsSelfTurn, item[num].Damage); + } + } + } + foreach (List item2 in enumerable2) + { + for (int num2 = 0; num2 < item2.Count; num2++) + { + if (_searchedTurnAmountDictionary.Keys.Contains(item2[num2].Turn.ToString() + item2[num2].IsSelfTurn)) + { + _searchedTurnAmountDictionary[item2[num2].Turn.ToString() + item2[num2].IsSelfTurn] -= item2[num2].Heal; + } + else + { + _searchedTurnAmountDictionary.Add(item2[num2].Turn.ToString() + item2[num2].IsSelfTurn, -item2[num2].Heal); + } + } + } + return _searchedTurnAmountDictionary.Values; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnBuffCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnBuffCountFilter.cs new file mode 100644 index 0000000..c057347 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnBuffCountFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnBuffCountFilter : ISkillParameterSelectFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillParameterTurnBuffCountFilter(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public virtual IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnBuffCount(_turnPlayerInfo)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnCausedDamageFromUnitFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnCausedDamageFromUnitFilter.cs new file mode 100644 index 0000000..aa766fc --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnCausedDamageFromUnitFilter.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnCausedDamageFromUnitFilter : ISkillParameterSelectFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + private Dictionary _searchedTurnDamageDictionary; + + public SkillParameterTurnCausedDamageFromUnitFilter(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + if (_turnPlayerInfo.IsAllTurn) + { + _searchedTurnDamageDictionary = new Dictionary(); + } + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + IEnumerable enumerable = null; + if (_turnPlayerInfo.IsAllTurn) + { + IEnumerable> enumerable2 = cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnCausedDamageValueList(c, _turnPlayerInfo)); + _searchedTurnDamageDictionary.Clear(); + foreach (List item in enumerable2) + { + for (int num = 0; num < item.Count; num++) + { + if (_searchedTurnDamageDictionary.Keys.Contains(item[num].Turn.ToString() + item[num].IsSelfTurn)) + { + _searchedTurnDamageDictionary[item[num].Turn.ToString() + item[num].IsSelfTurn] += item[num].Damage; + } + else + { + _searchedTurnDamageDictionary.Add(item[num].Turn.ToString() + item[num].IsSelfTurn, item[num].Damage); + } + } + } + return _searchedTurnDamageDictionary.Values; + } + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnCausedDamageValue(c, _turnPlayerInfo)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnDamageCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnDamageCountFilter.cs new file mode 100644 index 0000000..973ded3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnDamageCountFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnDamageCountFilter : ISkillParameterSelectFilter +{ + protected readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillParameterTurnDamageCountFilter(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public virtual IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption = null) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnDamageCount(c, _turnPlayerInfo)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnDamageCountTextFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnDamageCountTextFilter.cs new file mode 100644 index 0000000..4baa49b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnDamageCountTextFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnDamageCountTextFilter : SkillParameterTurnDamageCountFilter +{ + public SkillParameterTurnDamageCountTextFilter(string option) + : base(option) + { + } + + public override IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption = null) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => (c.IsPlayer == BattleManagerBase.GetIns().BattlePlayer.IsSelfTurn) ? c.SkillApplyInformation.GetSpecificTurnDamageCount(c, _turnPlayerInfo) : 0); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnDamageValueFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnDamageValueFilter.cs new file mode 100644 index 0000000..1348ea8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnDamageValueFilter.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnDamageValueFilter : ISkillParameterSelectFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + private Dictionary _searchedTurnDamageDictionary; + + public SkillParameterTurnDamageValueFilter(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + if (_turnPlayerInfo.IsAllTurn) + { + _searchedTurnDamageDictionary = new Dictionary(); + } + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + IEnumerable enumerable = null; + if (_turnPlayerInfo.IsAllTurn) + { + IEnumerable> enumerable2 = cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnDamageValueList(c, _turnPlayerInfo)); + _searchedTurnDamageDictionary.Clear(); + foreach (List item in enumerable2) + { + for (int num = 0; num < item.Count; num++) + { + if (_searchedTurnDamageDictionary.Keys.Contains(item[num].Turn.ToString() + item[num].IsSelfTurn)) + { + _searchedTurnDamageDictionary[item[num].Turn.ToString() + item[num].IsSelfTurn] += item[num].Damage; + } + else + { + _searchedTurnDamageDictionary.Add(item[num].Turn.ToString() + item[num].IsSelfTurn, item[num].Damage); + } + } + } + return _searchedTurnDamageDictionary.Values; + } + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnDamageValue(c, _turnPlayerInfo)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnFusionCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnFusionCountFilter.cs new file mode 100644 index 0000000..e648ac7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnFusionCountFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnFusionCountFilter : ISkillParameterSelectFilter +{ + protected readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillParameterTurnFusionCountFilter(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public virtual IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption = null) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnFusionCount(c, _turnPlayerInfo)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnFusionCountTextFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnFusionCountTextFilter.cs new file mode 100644 index 0000000..956dcb8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnFusionCountTextFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnFusionCountTextFilter : ISkillParameterSelectFilter +{ + protected readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillParameterTurnFusionCountTextFilter(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public virtual IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption = null) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => (c.IsPlayer == BattleManagerBase.GetIns().BattlePlayer.IsSelfTurn) ? c.SkillApplyInformation.GetSpecificTurnFusionCount(c, _turnPlayerInfo) : 0); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnHealCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnHealCountFilter.cs new file mode 100644 index 0000000..60d36dd --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnHealCountFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnHealCountFilter : ISkillParameterSelectFilter +{ + protected readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillParameterTurnHealCountFilter(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public virtual IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnHealCount(c, _turnPlayerInfo)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnHealCountTextFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnHealCountTextFilter.cs new file mode 100644 index 0000000..6ce2c69 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnHealCountTextFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnHealCountTextFilter : SkillParameterTurnHealCountFilter +{ + public SkillParameterTurnHealCountTextFilter(string option) + : base(option) + { + } + + public override IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnHealCountOnlySelf(c, _turnPlayerInfo)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnHealValueFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnHealValueFilter.cs new file mode 100644 index 0000000..ff1cd17 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnHealValueFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnHealValueFilter : ISkillParameterSelectFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillParameterTurnHealValueFilter(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnHealValue(c, _turnPlayerInfo)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnPlayOtherCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnPlayOtherCountFilter.cs new file mode 100644 index 0000000..7e50540 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnPlayOtherCountFilter.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnPlayOtherCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + List list = new List(); + for (int i = 0; i < cardInfos.Count(); i++) + { + BattleCardBase battleCardBase = cardInfos.ElementAt(i) as BattleCardBase; + int num = battleCardBase.SelfBattlePlayer.GetCurrentTurnPlayCount(); + if (checkerOption != null && checkerOption.PlayedCard == battleCardBase) + { + num--; + } + list.Add(num); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnPpAddCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnPpAddCountFilter.cs new file mode 100644 index 0000000..08c38a8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnPpAddCountFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnPpAddCountFilter : ISkillParameterSelectFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillParameterTurnPpAddCountFilter(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + return cardInfos.Select((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.GetSpecificTurnPpAddCount(c, _turnPlayerInfo)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnStartLife.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnStartLife.cs new file mode 100644 index 0000000..1e1e26b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnStartLife.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillParameterTurnStartLife : ISkillParameterSelectFilter +{ + protected readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillParameterTurnStartLife(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public virtual IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + List list = new List(); + for (int i = 0; i < cardInfos.Count(); i++) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = cardInfos.ElementAt(i); + IEnumerable collection = from t in readOnlyBattleCardInfo.SkillApplyInformation.GetSpecificTurnStartLifeList(readOnlyBattleCardInfo, _turnPlayerInfo) + select t.Value; + list.AddRange(collection); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillParameterTurnSummonCountFilter.cs b/SVSim.BattleEngine/Engine/SkillParameterTurnSummonCountFilter.cs new file mode 100644 index 0000000..274fed7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillParameterTurnSummonCountFilter.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillParameterTurnSummonCountFilter : ISkillParameterSelectFilter +{ + public IEnumerable Filtering(IEnumerable cardInfos, SkillConditionCheckerOption checkerOption) + { + IReadOnlyBattleCardInfo summonedCard = checkerOption.SummonedCard; + List list = new List(cardInfos); + return new List { list.LastIndexOf(summonedCard) + 1 }; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPlayCardTypeFilter.cs b/SVSim.BattleEngine/Engine/SkillPlayCardTypeFilter.cs new file mode 100644 index 0000000..a6618a5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPlayCardTypeFilter.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillPlayCardTypeFilter : ISkillCardFilter +{ + private IReadOnlyBattleCardInfo _ownerCard; + + private TurnPlayerInfo _turnPlayerInfo; + + public SkillPlayCardTypeFilter(IReadOnlyBattleCardInfo ownerCard, string option) + { + _ownerCard = ownerCard; + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + IEnumerable playCardList = GetPlayCardList(); + bool playUnit = playCardList.Any((IReadOnlyBattleCardInfo c) => c.IsUnit); + bool playSpell = playCardList.Any((IReadOnlyBattleCardInfo c) => c.IsSpell); + bool playField = playCardList.Any((IReadOnlyBattleCardInfo c) => c.IsField || c.IsChantField); + return cards.Where((IReadOnlyBattleCardInfo c) => (playUnit && c.IsUnit) || (playSpell && c.IsSpell) || (playField && (c.IsField || c.IsChantField))); + } + + public IEnumerable GetPlayCardList() + { + List list = new List(); + if (_ownerCard != null && _ownerCard is BattleCardBase battleCardBase) + { + BattlePlayerBase battlePlayerBase = (_turnPlayerInfo.IsSelfPlayer ? battleCardBase.SelfBattlePlayer : battleCardBase.OpponentBattlePlayer); + int turn = battlePlayerBase.Turn - _turnPlayerInfo.TurnOffset; + list.AddRange(from c in battlePlayerBase.SkillInfoGameTurnPlayCards + where c.Turn == turn + select c.Card); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPlayMomentSpellChargeFilter.cs b/SVSim.BattleEngine/Engine/SkillPlayMomentSpellChargeFilter.cs new file mode 100644 index 0000000..b9cf37d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPlayMomentSpellChargeFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillPlayMomentSpellChargeFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo card) => card.SelfBattlePlayer.GamePlayMomentSpellChargeCards.Contains(card)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPlayMomentTribeFilter.cs b/SVSim.BattleEngine/Engine/SkillPlayMomentTribeFilter.cs new file mode 100644 index 0000000..44f655e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPlayMomentTribeFilter.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillPlayMomentTribeFilter : ISkillCardFilter +{ + private readonly CardBasePrm.TribeType _type; + + private readonly bool _isEqual; + + public SkillPlayMomentTribeFilter(CardBasePrm.TribeType tribe, string op) + { + _type = tribe; + _isEqual = op == "="; + } + + private bool judgePlayMomentTribe(IReadOnlyBattleCardInfo readOnlyBattleCard, CardBasePrm.TribeType tribe) + { + BattleCardBase card = readOnlyBattleCard as BattleCardBase; + List> list = (from c in card.SelfBattlePlayer.GamePlayMomentTribe + where c.Card == card + select c.Tribes).ToList(); + for (int num = 0; num < list.Count; num++) + { + if (list[num].Contains(tribe)) + { + return true; + } + } + return false; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => judgePlayMomentTribe(c, _type) == _isEqual); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessAnyCondition.cs b/SVSim.BattleEngine/Engine/SkillPreprocessAnyCondition.cs new file mode 100644 index 0000000..50dc319 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessAnyCondition.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessAnyCondition : SkillPreprocessBase +{ + private List _preprocessList = new List(); + + public SkillPreprocessAnyCondition(List list) + { + _preprocessList = list; + } + + public SkillPreprocessBase GetRightPreprocess(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option) + { + foreach (SkillPreprocessBase preprocess in _preprocessList) + { + if (preprocess.IsRight(playerInfoPair, option)) + { + return preprocess; + } + } + return null; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return GetRightPreprocess(playerInfoPair, option) != null; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + SkillPreprocessBase rightPreprocess = GetRightPreprocess(playerPair, checkerOption); + if (rightPreprocess != null) + { + return rightPreprocess.Start(playerPair, skill, skillProcessor, optionValue, checkerOption); + } + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessBurialRite.cs b/SVSim.BattleEngine/Engine/SkillPreprocessBurialRite.cs new file mode 100644 index 0000000..9f180f0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessBurialRite.cs @@ -0,0 +1,158 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessBurialRite : SkillPreprocessBase +{ + private readonly BattleCardBase _ownerCard; + + private readonly SkillBase _skill; + + private bool _isInvoked; + + public SkillPreprocessBurialRite(SkillBase skill, BattleCardBase ownerCard) + { + _skill = skill; + _ownerCard = ownerCard; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (_isInvoked) + { + return true; + } + IBattlePlayerReadOnlyInfo readOnlySelf = playerInfoPair.ReadOnlySelf; + int num = readOnlySelf.SkillInfoInPlayCards.Count(); + BattleCardBase originalCard = ((_ownerCard.TransformInfo.Type != BattleCardBase.TransformType.Metamorphose) ? _ownerCard.TransformInfo.OriginalCard : null); + int num2 = readOnlySelf.SkillInfoHandCards.Count((IReadOnlyBattleCardInfo s) => s != _ownerCard && s != originalCard && s.IsUnit); + int burialRiteCount = _ownerCard.GetBurialRiteCount(playerInfoPair, option, isPrePlay: false); + int num3 = 5 - burialRiteCount; + if (num <= num3) + { + return num2 >= burialRiteCount; + } + return false; + } + + public override bool IsRightPrePlay(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (_isInvoked) + { + return true; + } + IBattlePlayerReadOnlyInfo readOnlySelf = playerInfoPair.ReadOnlySelf; + int num = readOnlySelf.SkillInfoInPlayCards.Count(); + BattleCardBase originalCard = ((_ownerCard.TransformInfo.Type != BattleCardBase.TransformType.Metamorphose) ? _ownerCard.TransformInfo.OriginalCard : null); + int num2 = readOnlySelf.SkillInfoHandCards.Count((IReadOnlyBattleCardInfo s) => s != _ownerCard && s != originalCard && s.IsUnit); + int burialRiteCount = _ownerCard.GetBurialRiteCount(playerInfoPair, option, isPrePlay: true); + int num3 = ((_ownerCard.IsInplay || _ownerCard.IsSpell) ? (5 - burialRiteCount) : (5 - burialRiteCount - 1)); + if (num <= num3 && num2 >= burialRiteCount) + { + if (!_ownerCard.IsSpell && _skill.OnWhenEvolveStart == 0) + { + return !_ownerCard.SelfBattlePlayer.Class.SkillApplyInformation.IsCantActivateFanfareUnit; + } + return true; + } + return false; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (skill != _ownerCard.Skills.LastOrDefault((SkillBase s) => s.CheckCondition(playerPair, checkerOption, isPrePlay: true) && s.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessBurialRite))) + { + return sequentialVfxPlayer; + } + if (_isInvoked) + { + return sequentialVfxPlayer; + } + if (skill.OptionValue.HasInfoByName(SkillFilterCreator.ContentKeyword.save_burial_rite_target)) + { + skill.SkillPrm.ownerCard.SkillApplyInformation.SaveBurialRiteTargetList(checkerOption.BurialRiteCards); + for (int num = 0; num < checkerOption.BurialRiteCards.Count; num++) + { + CardParameter baseParameter = checkerOption.BurialRiteCards.ElementAt(num).BaseParameter; + BuffInfo buffInfo = new BuffInfo(baseParameter.CardId, baseParameter.NormalCardId, skill); + buffInfo.IsSaveBurialRiteSkill = true; + buffInfo.TargetCard = checkerOption.BurialRiteCards.ElementAt(num); + _ownerCard.AddBuffInfo(buffInfo); + } + } + SkillBaseSummon.SummonedCardsList summonedCardsList = new SkillBaseSummon.SummonedCardsList(); + foreach (BattleCardBase burialRiteCard in checkerOption.BurialRiteCards) + { + summonedCardsList.AddCardToSummonedCards(burialRiteCard, overrideSummonEffect: true); + sequentialVfxPlayer.Register(burialRiteCard.LoseSkill()); + burialRiteCard.IsSelectedDuringSelectingBurialRiteTarget = false; + if (!BattleManagerBase.GetIns().IsRecovery) + { + burialRiteCard.SelfBattlePlayer.BurialRiteOrDiscardCardHandIndexList.Add(burialRiteCard.SelfBattlePlayer.HandCardList.IndexOf(burialRiteCard)); + } + } + BattlePlayerBase.SummonInfo summonInfo = new BattlePlayerBase.SummonInfo(summonedCardsList.Any((BattleCardBase c) => c.IsPlayer), summonedCardsList, SkillBaseSummon.SUMMON_TYPE.HAND); + BattlePlayerBase self = playerPair.Self; + BattlePlayerBase.SummonInfo summonInfo2 = summonInfo; + VfxWithLoadingSequential vfx = self.CardManagement(null, skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.SUMMON, isRandom: false, null, null, skill, summonInfo2) as VfxWithLoadingSequential; + sequentialVfxPlayer.Register(vfx); + foreach (BattleCardBase item in summonedCardsList) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + parallelVfxPlayer.Register(Skill_summon_card.RemoveHandCardFromViewVfx(item, playerPair.Self, isBurialRite: true)); + parallelVfxPlayer.Register(item.StopSpellCharge()); + sequentialVfxPlayer.Register(parallelVfxPlayer); + } + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + _ownerCard.SelfBattlePlayer.BurialRiteOrDiscardCardHandIndexList.Clear(); + })); + StartPickMultiCardVfx vfx2 = new StartPickMultiCardVfx(summonedCardsList, _ownerCard.ResourceMgr, _ownerCard.IsPlayer, isToken: true); + sequentialVfxPlayer.Register(vfx2); + _ownerCard.SelfBattlePlayer.CallOnSummonCards(_ownerCard, checkerOption.BurialRiteCards, _ownerCard.IsPlayer, isDeckSelf: false, isIgnoreVoice: false, isBurialRite: true); + _ownerCard.SelfBattlePlayer.CallOnSkillDestroyOrBanish(_ownerCard, isBurialRite: true); + ParallelVfxPlayer parallelVfxPlayer2 = ParallelVfxPlayer.Create(); + foreach (BattleCardBase item2 in summonedCardsList) + { + item2.SelfBattlePlayer.GameBurialRiteCards.Add(item2); + item2.SelfBattlePlayer.TurnBurialRiteCards.Add(item2); + item2.SelfBattlePlayer.StartSkillWhenBurialRiteOther(item2, skillProcessor); + SequentialVfxPlayer sequentialVfxPlayer2 = SequentialVfxPlayer.Create(); + item2.FlagCardAsDestroyedBySkill(); + item2.DeathTypeInfo.BurialRite = true; + sequentialVfxPlayer2.Register(item2.SkillApplyInformation.AllSkillEffectStop()); + sequentialVfxPlayer2.Register(item2.SelfBattlePlayer.CardManagement(item2, skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.DESTROY, isRandom: false, null, null, skill)); + parallelVfxPlayer2.Register(sequentialVfxPlayer2); + } + if (!_ownerCard.SelfBattlePlayer.BattleMgr.IsVirtualBattle) + { + BattleLogManager.GetInstance().AddLogSkillDeath(summonedCardsList.ToList(), skill); + } + sequentialVfxPlayer.Register(parallelVfxPlayer2); + return sequentialVfxPlayer; + } + + public static List GetBurialRiteTarget(BattlePlayerBase self, BattleCardBase ownerCard) + { + List list = new List(); + List handCardList = self.HandCardList; + for (int i = 0; i < handCardList.Count; i++) + { + BattleCardBase battleCardBase = handCardList[i]; + if (ownerCard.Index != battleCardBase.Index && battleCardBase.IsUnit) + { + list.Add(battleCardBase); + } + } + return list; + } + + public void SetInvoked() + { + _isInvoked = true; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessConditionCheck.cs b/SVSim.BattleEngine/Engine/SkillPreprocessConditionCheck.cs new file mode 100644 index 0000000..e2fb268 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessConditionCheck.cs @@ -0,0 +1,66 @@ +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessConditionCheck : SkillPreprocessBase +{ + protected readonly ConditionSkillFilterCollection _filter; + + protected readonly SkillBase _skill; + + public string ConditionText { get; private set; } + + public SkillPreprocessConditionCheck(SkillBase skill, string conditionString) + { + _skill = skill; + _filter = new ConditionSkillFilterCollection(); + ConditionText = conditionString; + if (conditionString.First() != '(' || conditionString.Last() != ')') + { + return; + } + conditionString = conditionString.Substring(1, conditionString.Length - 2); + string[] array = conditionString.Split('&'); + for (int i = 0; i < array.Length; i++) + { + if (array[i].First() == '{') + { + _filter.VariableCompareFilter.Add(new SkillVariableComareFilter(array[i])); + } + } + } + + public bool Contains(string text) + { + return _filter.VariableCompareFilter.Any((SkillVariableComareFilter x) => x.Text.Contains(text)); + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (PreexecutionCheck) + { + SkillCollectionBase.SetupOptionValue(_skill.OptionValue, playerInfoPair, _skill.SkillPrm.ownerCard, _skill, option); + return _filter.VariableCompareFilter.All((SkillVariableComareFilter s) => s.Filtering(_skill.OptionValue)); + } + return true; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false, bool isRegidentStop = false) + { + if (!isRegidentStop) + { + return IsRight(playerInfoPair, option, PreexecutionCheck); + } + return !IsRight(playerInfoPair, option, PreexecutionCheck); + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + return NullVfx.GetInstance(); + } + + public ConditionSkillFilterCollection GetFilter() + { + return _filter; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessDamageAfterStop.cs b/SVSim.BattleEngine/Engine/SkillPreprocessDamageAfterStop.cs new file mode 100644 index 0000000..f4b649a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessDamageAfterStop.cs @@ -0,0 +1,49 @@ +using System; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessDamageAfterStop : SkillPreprocessBase +{ + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + SetUp(skill); + return NullVfx.GetInstance(); + } + + public override void Clone(SkillPreprocessBase source, SkillBase skill) + { + SetUp(skill); + } + + private void SetUp(SkillBase skill) + { + bool isTargetClass = skill.ApplyCardFilterList.Any((ISkillCardFilter f) => f is SkillClassFilter); + Func callStopOneTime = null; + callStopOneTime = delegate(SkillProcessor skillProcessorOneTime) + { + if (isTargetClass) + { + skill.SkillPrm.ownerCard.SelfBattlePlayer.Class.OnDamageAfter -= callStopOneTime; + } + else + { + skill.SkillPrm.ownerCard.OnDamageAfter -= callStopOneTime; + } + return StopSkill(skill, skillProcessorOneTime); + }; + if (isTargetClass) + { + skill.SkillPrm.ownerCard.SelfBattlePlayer.Class.OnDamageAfter += callStopOneTime; + } + else + { + skill.SkillPrm.ownerCard.OnDamageAfter += callStopOneTime; + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessDamageGiveStop.cs b/SVSim.BattleEngine/Engine/SkillPreprocessDamageGiveStop.cs new file mode 100644 index 0000000..e4daab0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessDamageGiveStop.cs @@ -0,0 +1,33 @@ +using System; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessDamageGiveStop : SkillPreprocessBase +{ + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + SetUp(skill); + return NullVfx.GetInstance(); + } + + public override void Clone(SkillPreprocessBase source, SkillBase skill) + { + SetUp(skill); + } + + private void SetUp(SkillBase skill) + { + Func callStopOneTime = null; + callStopOneTime = delegate(SkillProcessor skillProcessorOneTime) + { + skill.SkillPrm.ownerCard.OnGiveDamage -= callStopOneTime; + return StopSkill(skill, skillProcessorOneTime); + }; + skill.SkillPrm.ownerCard.OnGiveDamage += callStopOneTime; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessDestroyTribe.cs b/SVSim.BattleEngine/Engine/SkillPreprocessDestroyTribe.cs new file mode 100644 index 0000000..f0324d6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessDestroyTribe.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using Wizard; +using Wizard.Battle; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessDestroyTribe : SkillPreprocessBase +{ + private readonly CardBasePrm.TribeType _tribe; + + private bool IsAllDestroy; + + private const string ALL_DESTROY = "_all"; + + private int _count = 1; + + private BattleCardBase _ownerCard; + + public bool IsWhiteRitual => _tribe == CardBasePrm.TribeType.WHITE_RITUAL; + + public SkillPreprocessDestroyTribe(BattleCardBase card, string tribe) + { + _ownerCard = card; + string[] array = tribe.Split(':'); + if (array.Count() > 1) + { + tribe = array[0]; + _count = int.Parse(array[1]); + } + string strEnum = tribe; + if (tribe.Contains("_all")) + { + IsAllDestroy = true; + strEnum = tribe.Replace("_all", ""); + } + _tribe = SkillFilterCreator.ParseEnum(strEnum, CardBasePrm.TribeType.MAX); + } + + public CardBasePrm.TribeType GetDestroyTribe() + { + return _tribe; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (IsAllDestroy) + { + if (IsWhiteRitual) + { + return playerInfoPair.ReadOnlySelf.SkillInfoInPlayCards.Any((IReadOnlyBattleCardInfo c) => c.IsTribe(_tribe) && (c.IsField || c.IsChantField)); + } + return playerInfoPair.ReadOnlySelf.SkillInfoInPlayCards.Any((IReadOnlyBattleCardInfo c) => c.IsTribe(_tribe)); + } + if (IsWhiteRitual) + { + return playerInfoPair.ReadOnlySelf.SkillInfoInPlayCards.Where((IReadOnlyBattleCardInfo c) => (c.IsField || c.IsChantField) && c.IsTribe(CardBasePrm.TribeType.WHITE_RITUAL)).Sum((IReadOnlyBattleCardInfo c) => c.SkillApplyInformation.WhiteRitualCount) >= _count; + } + return playerInfoPair.ReadOnlySelf.SkillInfoInPlayCards.Where((IReadOnlyBattleCardInfo c) => c.IsTribe(_tribe)).Count() >= _count; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + List list = (IsWhiteRitual ? playerPair.Self.InPlayCards.Where((BattleCardBase c) => c.IsTribe(_tribe) && (c.IsField || c.IsChantField)).ToList() : playerPair.Self.InPlayCards.Where((BattleCardBase c) => c.IsTribe(_tribe)).ToList()); + if (!list.IsNotNullOrEmpty()) + { + return NullVfx.GetInstance(); + } + playerPair.Self.LastInplayWhiteRitualStack = list.Sum((BattleCardBase c) => c.SkillApplyInformation.WhiteRitualCount); + if (IsWhiteRitual) + { + int num = (IsAllDestroy ? list[0].SkillApplyInformation.WhiteRitualCount : Math.Min(list[0].SkillApplyInformation.WhiteRitualCount, _count)); + skill.SkillPrm.selfBattlePlayer.CallOnChangeWhiteRitualStack(list[0], -num, list[0].SkillApplyInformation.WhiteRitualCount == num); + } + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + int num2 = (IsAllDestroy ? list.Count : _count); + int num3 = 0; + int num4 = 0; + for (int num5 = 0; num5 < num2; num5++) + { + BattleCardBase battleCardBase = list[num3]; + if (IsWhiteRitual && battleCardBase.IsTribe(CardBasePrm.TribeType.WHITE_RITUAL)) + { + if (IsAllDestroy) + { + battleCardBase.SelfBattlePlayer.GameUsedWhiteRitualCount += battleCardBase.SkillApplyInformation.WhiteRitualCount; + checkerOption.LastUsedWhiteRitualStackCount += battleCardBase.SkillApplyInformation.WhiteRitualCount; + battleCardBase.SkillApplyInformation.FourceDepriveWhiteRitualCount(); + } + else + { + battleCardBase.SelfBattlePlayer.GameUsedWhiteRitualCount++; + checkerOption.LastUsedWhiteRitualStackCount++; + num4++; + int value = 1; + battleCardBase.SkillApplyInformation.DepriveWhiteRitualCount(value); + } + if (battleCardBase.SkillApplyInformation.WhiteRitualCount > 0) + { + continue; + } + parallelVfxPlayer.Register(battleCardBase.BattleCardView.UpdateStackWhiteRitualIconNumber()); + battleCardBase.DeathTypeInfo.MysteriesDestroy = true; + if (skill.IsWhenDestroySkill) + { + skill.SkillPrm.ownerCard.IsExecutedEarthRite = true; + } + } + if (num3 == 0) + { + skill.SkillPrm.selfBattlePlayer.CallOnSkillDestroyOrBanish(_ownerCard); + } + battleCardBase.FlagCardAsDestroyedBySkill(); + VfxBase vfx = battleCardBase.SelfBattlePlayer.CardManagement(battleCardBase, skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.DESTROY, isRandom: false); + parallelVfxPlayer.Register(vfx); + if (!skill.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.IsVirtualBattle) + { + BattleLogManager.GetInstance().AddLogSkillDeath(new List { battleCardBase }, skill); + } + num3++; + num4 = 0; + } + if (IsWhiteRitual) + { + if (num4 != 0) + { + parallelVfxPlayer.Register(new ChangeWhiteRitualCountVfx(list[num3], -num4)); + BattleLogManager.GetInstance().AddLogDepriveWhiteRitualStack(-num4, list[num3], skill); + } + if (skill.SkillPrm.selfBattlePlayer.BattleMgr is NetworkBattleManagerBase networkBattleManagerBase) + { + networkBattleManagerBase.RegisterInplayWhiteRitualStack(skill.SkillPrm.selfBattlePlayer); + } + skill.SkillPrm.selfBattlePlayer.StartSkillWhenUseWhiteRitualStack(skillProcessor, checkerOption); + } + return parallelVfxPlayer; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessDontActivate.cs b/SVSim.BattleEngine/Engine/SkillPreprocessDontActivate.cs new file mode 100644 index 0000000..b13bd2f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessDontActivate.cs @@ -0,0 +1,30 @@ +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessDontActivate : SkillPreprocessBase +{ + private BattleCardBase _ownerCard; + + private string _timingText; + + public SkillPreprocessDontActivate(BattleCardBase ownerCard, string timingString) + { + _ownerCard = ownerCard; + _timingText = timingString; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + string timingText = _timingText; + if (timingText != null && timingText == "getoff") + { + return !option.GetOffCards.Contains(_ownerCard); + } + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessDontSelectStart.cs b/SVSim.BattleEngine/Engine/SkillPreprocessDontSelectStart.cs new file mode 100644 index 0000000..ef34a3a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessDontSelectStart.cs @@ -0,0 +1,15 @@ +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessDontSelectStart : SkillPreprocessBase +{ + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessEvolutionEndStop.cs b/SVSim.BattleEngine/Engine/SkillPreprocessEvolutionEndStop.cs new file mode 100644 index 0000000..4f2ab1e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessEvolutionEndStop.cs @@ -0,0 +1,34 @@ +using System; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessEvolutionEndStop : SkillPreprocessBase +{ + private BattleCardBase _ownerCard; + + public SkillPreprocessEvolutionEndStop(BattleCardBase card) + { + _ownerCard = card; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return !_ownerCard.IsEvolution; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + Func callStopOneTime = null; + callStopOneTime = delegate(SkillProcessor skillProcessorOneTime) + { + skill.SkillPrm.ownerCard.OnBeforeEvolve -= callStopOneTime; + if (skill is Skill_attach_skill skill_attach_skill) + { + skill_attach_skill.IsEvolutionEndStop = true; + } + return StopSkill(skill, skillProcessorOneTime); + }; + skill.SkillPrm.ownerCard.OnBeforeEvolve += callStopOneTime; + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessFixedGenericValue.cs b/SVSim.BattleEngine/Engine/SkillPreprocessFixedGenericValue.cs new file mode 100644 index 0000000..681c389 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessFixedGenericValue.cs @@ -0,0 +1,54 @@ +using Wizard; +using Wizard.Battle; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessFixedGenericValue : SkillPreprocessBase +{ + private readonly int _value; + + private readonly string _operator; + + private readonly IReadOnlyBattleCardInfo _card; + + public SkillPreprocessFixedGenericValue(IReadOnlyBattleCardInfo card, string operatorStr, int value) + { + _card = card; + _operator = operatorStr; + _value = value; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (_card.SkillApplyInformation.SkillGenericValueArray == null) + { + return false; + } + int num = _card.SkillApplyInformation.SkillGenericValueArray[0]; + if (_operator == ">=") + { + return num >= _value; + } + if (_operator == ">") + { + return num > _value; + } + if (_operator == "<") + { + return num < _value; + } + if (_operator == "<=") + { + return num <= _value; + } + if (_operator == "!=") + { + return num != _value; + } + return num == _value; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessInPlayPeriodOfTime.cs b/SVSim.BattleEngine/Engine/SkillPreprocessInPlayPeriodOfTime.cs new file mode 100644 index 0000000..298eb9a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessInPlayPeriodOfTime.cs @@ -0,0 +1,29 @@ +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessInPlayPeriodOfTime : SkillPreprocessPeriodBase +{ + public SkillPreprocessInPlayPeriodOfTime(BattleCardBase ownerCard, string period) + : base(ownerCard, period) + { + ownerCard.OnTurnStart += delegate + { + ReducePeriodCount(); + }; + ownerCard.OnRemoveFromInPlayAfterOneTime += delegate + { + ResetPeriodCount(); + return NullVfx.GetInstance(); + }; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return _effectiveRange == base.PeriodCount; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessIsActivateSummonCard.cs b/SVSim.BattleEngine/Engine/SkillPreprocessIsActivateSummonCard.cs new file mode 100644 index 0000000..c381e80 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessIsActivateSummonCard.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessIsActivateSummonCard : SkillPreprocessBase +{ + private readonly bool _flag; + + private SkillBase _skill; + + public SkillPreprocessIsActivateSummonCard(SkillBase skill, string flag) + { + _skill = skill; + _flag = flag == "true"; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + int num = 5 - playerInfoPair.ReadOnlySelf.SkillInfoInPlayCards.Count(); + bool flag = !PreexecutionCheck || num > 0; + List cantSummonList = _skill.SkillPrm.ownerCard.SelfBattlePlayer.Class.SkillApplyInformation.CantSummonList; + for (int i = 0; i < cantSummonList.Count; i++) + { + if (cantSummonList[i] == Skill_cant_summon.CantSummonInfo.DeckSelf) + { + flag = false; + } + } + return flag == _flag; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessNecromance.cs b/SVSim.BattleEngine/Engine/SkillPreprocessNecromance.cs new file mode 100644 index 0000000..7894d9a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessNecromance.cs @@ -0,0 +1,77 @@ +using System; +using System.Linq; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessNecromance : SkillPreprocessBase +{ + private readonly int _necromanceCount; + + private readonly string _operator; + + private string _countText = string.Empty; + + private SkillBase _skill; + + public bool IsApproximate => _operator == "<:="; + + public SkillPreprocessNecromance(SkillBase skill, string countText, string op) + { + if (SkillOptionValue.IsVariableValue(countText)) + { + _countText = countText; + } + else + { + _necromanceCount = int.Parse(countText); + } + _operator = op; + _skill = skill; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return playerInfoPair.ReadOnlySelf.SkillInfoCemeterys.Count() >= NecromanceCount(playerInfoPair.ReadOnlySelf.SkillInfoCemeterys.Count(), playerInfoPair, option); + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + BattleLogManager.GetInstance().AddNecromanceIcon(skill, skill.SkillPrm.ownerCard, skill.SkillPrm.ownerCard.IsSpell); + bool num = skill.SkillPrm.ownerCard.GetSelectTypeSkill().Any((SkillBase s) => s.IsChoiceType); + bool flag = skill.SkillPrm.ownerCard.Skills.Any((SkillBase s) => s is Skill_transform); + if (num && flag) + { + return NullVfx.GetInstance(); + } + int num2 = NecromanceCount(playerPair.Self.CemeteryList.Count, playerPair, checkerOption); + playerPair.Self.CemeteryConsumption(num2, skill.SkillPrm.ownerCard, skillProcessor, skill.OnWhenFusion != 0); + if (!skill.SkillPrm.ownerCard.IsSpell && (skill.OnWhenFusion == 0 || skill.SkillPrm.ownerCard.IsPlayer || GameMgr.GetIns().IsAdminWatch)) + { + return new NecromanceSkillActivationVfx(skill.SkillPrm.ownerCard.BattleCardView); + } + return NullVfx.GetInstance(); + } + + public int NecromanceCount(int cemeteryCount, BattlePlayerReadOnlyInfoPair pair = null, SkillConditionCheckerOption checkerOption = null) + { + if (IsApproximate) + { + return Math.Max(0, Math.Min(_necromanceCount, cemeteryCount)); + } + if (_countText != string.Empty) + { + if (pair == null) + { + pair = new BattlePlayerReadOnlyInfoPair(_skill.SkillPrm.selfBattlePlayer, _skill.SkillPrm.opponentBattlePlayer); + } + if (checkerOption == null) + { + checkerOption = new SkillConditionCheckerOption(); + } + SkillCollectionBase.SetupOptionValue(_skill.OptionValue, pair, _skill.SkillPrm.ownerCard, _skill, checkerOption); + return _skill.OptionValue.ParseInt(_countText); + } + return _necromanceCount; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessOncePerAction.cs b/SVSim.BattleEngine/Engine/SkillPreprocessOncePerAction.cs new file mode 100644 index 0000000..ea81460 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessOncePerAction.cs @@ -0,0 +1,23 @@ +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessOncePerAction : SkillPreprocessBase +{ + private readonly SkillBase _skill; + + public SkillPreprocessOncePerAction(SkillBase skill) + { + _skill = skill; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return !option.ProcessSkillList.Any((SkillBase s) => s == _skill); + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessOpenCard.cs b/SVSim.BattleEngine/Engine/SkillPreprocessOpenCard.cs new file mode 100644 index 0000000..b996fe6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessOpenCard.cs @@ -0,0 +1,90 @@ +using System.Collections.Generic; +using UnityEngine; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessOpenCard : SkillPreprocessBase +{ + private readonly BattleCardBase _ownerCard; + + public const float WAIT_TIME = 0.5f; + + public static readonly string HAND_SKILL_1_EFFECT = "stt_act_handskill_1"; + + public static readonly string HAND_SKILL_1_SE = "se_stt_act_handskill_1"; + + public SkillPreprocessOpenCard(BattleCardBase ownerCard) + { + _ownerCard = ownerCard; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + skill.SetAndAddPublishedActiveSkillCount(); + if (IsOpenCardAfterSkill(skill)) + { + return NullVfx.GetInstance(); + } + return CreateOpenCardVfx(skill); + } + + private bool IsOpenCardAfterSkill(SkillBase skill) + { + if (skill.ApplyingTargetFilter is SkillTargetHandSelfFilter) + { + if (!(skill is Skill_cost_change) && !(skill is Skill_powerup) && !(skill is Skill_power_down)) + { + return skill is Skill_power_modifier; + } + return true; + } + return false; + } + + public VfxBase CreateOpenCardVfx(SkillBase skill) + { + BattleCardBase ownerCard = _ownerCard; + if (!_ownerCard.SelfBattlePlayer.BattleMgr.IsVirtualBattle) + { + BattleLogManager.GetInstance().AddLogOpenCard(_ownerCard); + } + List list = new List(); + list.Add(ownerCard); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (ownerCard.SelfBattlePlayer.IsPlayer) + { + if (!IsOpenCardAfterSkill(skill)) + { + _ownerCard.SelfBattlePlayer.CallOnOpenCard(_ownerCard); + } + Transform transform = ownerCard.BattleCardView.GameObject.transform; + sequentialVfxPlayer.Register(new LoadAndPlayEffectVfx(HAND_SKILL_1_EFFECT, HAND_SKILL_1_SE, transform, 0.5f, isFollowAll: true)); + } + else + { + _ownerCard.SelfBattlePlayer.CallOnOpenCard(_ownerCard); + if (ownerCard.BattleCardView != null) + { + List costList = ownerCard.BattleCardView.GetUseCostList(ownerCard.Cost, useNomalCost: true); + bool isInHand = ownerCard.IsInHand; + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + ownerCard.BattleCardView.UpdateCost(costList, isGenerateInHand: true, playEffect: true, isInHand); + })); + } + sequentialVfxPlayer.Register(new OpenCardFromHandVfx(ownerCard.BattleCardView, ownerCard.IsLegend)); + sequentialVfxPlayer.Register(new PlayerEndDrawVfx(list)); + if (ownerCard == ownerCard.LastDrawOpenCard) + { + sequentialVfxPlayer.Register(ownerCard.SelfBattlePlayer.BattleView.HandView.ShuffleHand()); + } + } + return sequentialVfxPlayer; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessPeriodBase.cs b/SVSim.BattleEngine/Engine/SkillPreprocessPeriodBase.cs new file mode 100644 index 0000000..a3a59b9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessPeriodBase.cs @@ -0,0 +1,29 @@ +public abstract class SkillPreprocessPeriodBase : SkillPreprocessBase +{ + protected int _effectiveRange; + + protected int _defPeriodCount; + + public int PeriodCount { get; protected set; } + + protected SkillPreprocessPeriodBase(BattleCardBase ownerCard, string period) + { + string[] array = period.Split(':'); + _defPeriodCount = int.Parse(array[0]); + _effectiveRange = int.Parse(array[1]); + PeriodCount = _defPeriodCount; + } + + public void ReducePeriodCount() + { + if (PeriodCount >= 0) + { + PeriodCount--; + } + } + + public void ResetPeriodCount() + { + PeriodCount = _defPeriodCount; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessRandomArrayIndex.cs b/SVSim.BattleEngine/Engine/SkillPreprocessRandomArrayIndex.cs new file mode 100644 index 0000000..8fb1b4c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessRandomArrayIndex.cs @@ -0,0 +1,41 @@ +using Wizard; +using Wizard.Battle; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessRandomArrayIndex : SkillPreprocessBase +{ + private readonly IReadOnlyBattleCardInfo _card; + + public int[] RandomIndexes { get; private set; } + + public SkillPreprocessRandomArrayIndex(IReadOnlyBattleCardInfo card, int[] randomIndexes) + { + _card = card; + RandomIndexes = randomIndexes; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + int[] skillRandomArray = _card.SkillApplyInformation.SkillRandomArray; + if (skillRandomArray != null) + { + bool flag = false; + for (int i = 0; i < RandomIndexes.Length; i++) + { + if (RandomIndexes[i] >= 0 && RandomIndexes[i] < skillRandomArray.Length) + { + flag = flag || skillRandomArray[RandomIndexes[i]] > 0; + continue; + } + return false; + } + return flag; + } + return false; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessRandomCount.cs b/SVSim.BattleEngine/Engine/SkillPreprocessRandomCount.cs new file mode 100644 index 0000000..9a14fe0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessRandomCount.cs @@ -0,0 +1,28 @@ +using Wizard; +using Wizard.Battle; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessRandomCount : SkillPreprocessBase +{ + private readonly int _randomCount; + + private readonly IReadOnlyBattleCardInfo _card; + + public int RandomCount => _randomCount; + + public SkillPreprocessRandomCount(IReadOnlyBattleCardInfo card, int randomCount) + { + _card = card; + _randomCount = randomCount; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return _card.SkillApplyInformation.SkillRandomCount == _randomCount; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessReferencePrevious.cs b/SVSim.BattleEngine/Engine/SkillPreprocessReferencePrevious.cs new file mode 100644 index 0000000..b9ca25e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessReferencePrevious.cs @@ -0,0 +1,31 @@ +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessReferencePrevious : SkillPreprocessBase +{ + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return option.IsRefPrev; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + return NullVfx.GetInstance(); + } + + public static SkillBase GetPreviousSkill(SkillCollectionBase skills, SkillBase skill) + { + int num = skills.IndexOf(skill) - 1; + while (num >= 0 && num < skills.Count()) + { + SkillBase skillBase = skills.Get(num); + if (!skillBase.PreprocessList.Any((SkillPreprocessBase s) => s is SkillPreprocessReferencePrevious)) + { + return skillBase; + } + num--; + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessReflectionAfterStop.cs b/SVSim.BattleEngine/Engine/SkillPreprocessReflectionAfterStop.cs new file mode 100644 index 0000000..e88513f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessReflectionAfterStop.cs @@ -0,0 +1,33 @@ +using System; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessReflectionAfterStop : SkillPreprocessBase +{ + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + SetUp(skill); + return NullVfx.GetInstance(); + } + + public override void Clone(SkillPreprocessBase source, SkillBase skill) + { + SetUp(skill); + } + + private void SetUp(SkillBase skill) + { + Func callStopOneTime = null; + callStopOneTime = delegate(SkillProcessor skillProcessorOneTime) + { + skill.SkillPrm.ownerCard.OnReflectionAfter -= callStopOneTime; + return StopSkill(skill, skillProcessorOneTime); + }; + skill.SkillPrm.ownerCard.OnReflectionAfter += callStopOneTime; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessRemoveAfterAction.cs b/SVSim.BattleEngine/Engine/SkillPreprocessRemoveAfterAction.cs new file mode 100644 index 0000000..7b026a8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessRemoveAfterAction.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.Card; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessRemoveAfterAction : SkillPreprocessBase +{ + public int Count { get; private set; } = 1; + + public SkillPreprocessRemoveAfterAction(string args, SkillBase skill) + { + if (args.Length < 2 || args.First() != '(' || args.Last() != ')') + { + return; + } + args = args.Substring(1, args.Length - 2); + string[] array = args.Split(':'); + for (int i = 0; i < array.Length; i++) + { + string[] array2 = array[i].Split('='); + switch (array2[0]) + { + case "skill_id": + base.BanId = array2[1]; + break; + case "count": + Count = int.Parse(array2[1]); + break; + case "is_individual": + base.BanId = (long.Parse(base.BanId) + skill.IndividualId).ToString(); + break; + } + } + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + SetUp(skill); + return NullVfx.GetInstance(); + } + + public override void Clone(SkillPreprocessBase source, SkillBase skill) + { + SetUp(skill); + } + + private void SetUp(SkillBase skill) + { + BattleCardBase card = skill.SkillPrm.ownerCard; + List sameBanIdSkills = new List(); + if (base.BanId != string.Empty) + { + sameBanIdSkills = card.NormalSkills.Where((SkillBase s) => skill != s && s.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessRemoveAfterAction && p.BanId == base.BanId)).ToList(); + sameBanIdSkills.AddRange(card.EvolutionSkills.Where((SkillBase s) => skill != s && s.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessRemoveAfterAction && p.BanId == base.BanId)).ToList()); + IEnumerable source = sameBanIdSkills.SelectMany((SkillBase s) => s.PreprocessList.Where((SkillPreprocessBase p) => p is SkillPreprocessRemoveAfterAction && p.BanId == base.BanId)); + for (int num = 0; num < source.Count(); num++) + { + (source.ElementAt(num) as SkillPreprocessRemoveAfterAction).DecrementCount(); + } + } + SkillBase skillBase = card.NormalSkills.FirstOrDefault((SkillBase s) => skill != s && s.SkillPrm.buildInfo._previousSkillOwner != null && skill.SkillPrm.buildInfo == s.SkillPrm.buildInfo); + if (skillBase != null) + { + sameBanIdSkills.Add(skillBase); + } + SkillBase skillBase2 = card.EvolutionSkills.FirstOrDefault((SkillBase s) => skill != s && s.SkillPrm.buildInfo._previousSkillOwner != null && skill.SkillPrm.buildInfo == s.SkillPrm.buildInfo); + if (skillBase2 != null) + { + sameBanIdSkills.Add(skillBase2); + } + Func, SkillConditionCheckerOption, SkillProcessor, VfxBase> callStopOneTime = null; + callStopOneTime = delegate(SkillBase _skill, List cards, SkillConditionCheckerOption _checkerOption, SkillProcessor skillProcessorOneTime) + { + DecrementCount(); + skill.OnSkillEnd -= callStopOneTime; + if (IsEnd()) + { + card.NormalSkills.Remove(skill); + card.EvolutionSkills.Remove(skill); + for (int i = 0; i < sameBanIdSkills.Count(); i++) + { + SkillBase removeSkill = sameBanIdSkills.ElementAt(i); + card.NormalSkills.Remove(removeSkill); + card.EvolutionSkills.Remove(removeSkill); + if (removeSkill.GetAttachSkill != null && !(card is IVirtualBattleCard)) + { + StopSkill(removeSkill.GetAttachSkill, skillProcessorOneTime); + } + card.RemoveBuffInfo((BuffInfo b) => b.IsCopied && b.IsBuffGaveSkill(removeSkill)); + } + SkillBase originSkill = skill.GetAttachSkill; + if (originSkill != null && !(card is IVirtualBattleCard) && !card.Skills.Any((SkillBase s) => s.GetAttachSkill != null && s.GetAttachSkill.IsSameSkill(originSkill))) + { + StopSkill(skill.GetAttachSkill, skillProcessorOneTime); + } + card.RemoveBuffInfo((BuffInfo b) => b.IsCopied && b.IsBuffGaveSkill(skill)); + } + return card.BattleCardView.InitializeBattleCardIcon(card, card.Skills); + }; + skill.OnSkillEnd += callStopOneTime; + } + + public void DecrementCount() + { + Count--; + } + + public bool IsEnd() + { + return Count <= 0; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessRemoveFromInPlayStop.cs b/SVSim.BattleEngine/Engine/SkillPreprocessRemoveFromInPlayStop.cs new file mode 100644 index 0000000..a5350ed --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessRemoveFromInPlayStop.cs @@ -0,0 +1,44 @@ +using System; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessRemoveFromInPlayStop : SkillPreprocessBase +{ + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + SetUp(skill); + return NullVfx.GetInstance(); + } + + public override void Clone(SkillPreprocessBase source, SkillBase skill) + { + SetUp(skill); + } + + private void SetUp(SkillBase skill) + { + Func callStopOneTime = null; + callStopOneTime = delegate(bool flag, SkillProcessor skillProcessorOneTime) + { + skill.SkillPrm.ownerCard.OnRemoveFromInPlayAfterOneTime -= callStopOneTime; + return StopSkill(skill, skillProcessorOneTime); + }; + skill.SkillPrm.ownerCard.OnRemoveFromInPlayAfterOneTime += callStopOneTime; + if (skill.GetAttachSkill != null) + { + Func callStopOneTimeAttach = null; + BattleCardBase attachOwner = skill.GetAttachSkill.SkillPrm.ownerCard; + callStopOneTimeAttach = delegate(bool flag, SkillProcessor skillProcessorOneTime) + { + attachOwner.OnRemoveFromInPlayAfterOneTime -= callStopOneTimeAttach; + return StopSkill(skill, skillProcessorOneTime); + }; + attachOwner.OnRemoveFromInPlayAfterOneTime += callStopOneTimeAttach; + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessSelfTurnEndRemove.cs b/SVSim.BattleEngine/Engine/SkillPreprocessSelfTurnEndRemove.cs new file mode 100644 index 0000000..dd489be --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessSelfTurnEndRemove.cs @@ -0,0 +1,58 @@ +using System; +using System.Linq; +using Wizard; +using Wizard.Battle.Card; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessSelfTurnEndRemove : SkillPreprocessBase +{ + private int _turnEndCount = 1; + + private Func _removeTurnEndCount; + + public SkillPreprocessSelfTurnEndRemove(SkillBase skill, string args) + { + SkillPreprocessSelfTurnEndRemove skillPreprocessSelfTurnEndRemove = this; + BattleCardBase ownerCard = skill.SkillPrm.ownerCard; + BattlePlayerBase battlePlayer = ownerCard.SelfBattlePlayer; + if (args.Length >= 2 && args.First() == '(' && args.Last() == ')') + { + args = args.Substring(1, args.Length - 2); + string[] array = args.Split('='); + if (array[0] == "count") + { + _turnEndCount = int.Parse(array[1]); + } + } + _removeTurnEndCount = delegate(SkillProcessor _) + { + skillPreprocessSelfTurnEndRemove._turnEndCount--; + if (skillPreprocessSelfTurnEndRemove.IsEnd()) + { + ownerCard.Skills.Remove(skill); + if (skill.GetAttachSkill != null && !(ownerCard is IVirtualBattleCard)) + { + skillPreprocessSelfTurnEndRemove.StopSkill(skill.GetAttachSkill, _); + } + battlePlayer.OnTurnEnd -= skillPreprocessSelfTurnEndRemove._removeTurnEndCount; + } + return NullVfx.GetInstance(); + }; + battlePlayer.OnTurnEnd += _removeTurnEndCount; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + return NullVfx.GetInstance(); + } + + private bool IsEnd() + { + return _turnEndCount <= 0; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessSkillActivateCountBySimultaneousBuffingCards.cs b/SVSim.BattleEngine/Engine/SkillPreprocessSkillActivateCountBySimultaneousBuffingCards.cs new file mode 100644 index 0000000..be7d58e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessSkillActivateCountBySimultaneousBuffingCards.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessSkillActivateCountBySimultaneousBuffingCards : SkillPreprocessBase +{ + private BattleCardBase _ownerCard; + + private bool _isPlayer; + + private bool _isInplaySelf; + + public SkillPreprocessSkillActivateCountBySimultaneousBuffingCards(BattleCardBase ownerCard, string option) + { + _ownerCard = ownerCard; + string[] array = option.Split(':'); + _isPlayer = array[0] == "me"; + _isInplaySelf = array[1] == "inplay_self"; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (!_ownerCard.AlreadyInactiveSkillActivateCountBySimultaneousBuffingCards) + { + if (option.InplayBuffingCards == null) + { + _ownerCard.ActiveSkillActivateCountBySimultaneousBuffingCards = false; + return false; + } + IEnumerable source = option.InplayBuffingCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == _ownerCard.IsPlayer == _isPlayer); + if (_isInplaySelf) + { + _ownerCard.ActiveSkillActivateCountBySimultaneousBuffingCards = source.Contains(_ownerCard); + } + } + return _ownerCard.ActiveSkillActivateCountBySimultaneousBuffingCards; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + _ownerCard.InactiveSkillActivateCountBySimultaneousBuffingCards(); + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessSkillActivateCountBySimultaneousDestroyedCardList.cs b/SVSim.BattleEngine/Engine/SkillPreprocessSkillActivateCountBySimultaneousDestroyedCardList.cs new file mode 100644 index 0000000..7356f62 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessSkillActivateCountBySimultaneousDestroyedCardList.cs @@ -0,0 +1,44 @@ +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessSkillActivateCountBySimultaneousDestroyedCardList : SkillPreprocessBase +{ + private BattleCardBase _ownerCard; + + private bool _isPlayer; + + private string _cardType; + + public SkillPreprocessSkillActivateCountBySimultaneousDestroyedCardList(BattleCardBase ownerCard, string option) + { + _ownerCard = ownerCard; + string[] array = option.Split(':'); + _isPlayer = array[0] == "me"; + _cardType = array[1]; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (!_ownerCard.AlreadyInactiveSkillActivateCountBySimultaneousDestroyedCardList) + { + if (option.DestroyedCard == null) + { + _ownerCard.ActiveSkillActivateCountBySimultaneousDestroyedCardList = false; + return false; + } + _ownerCard.ActiveSkillActivateCountBySimultaneousDestroyedCardList = option.DestroyedCard.IsPlayer == _ownerCard.IsPlayer == _isPlayer; + string cardType = _cardType; + if (cardType != null && cardType == "unit") + { + _ownerCard.ActiveSkillActivateCountBySimultaneousDestroyedCardList &= option.DestroyedCard.IsUnit; + } + } + return _ownerCard.ActiveSkillActivateCountBySimultaneousDestroyedCardList; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + _ownerCard.InactiveSkillActivateCountBySimultaneousDestroyedCardList(); + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessSkillActivateCountBySimultaneousSummonedCard.cs b/SVSim.BattleEngine/Engine/SkillPreprocessSkillActivateCountBySimultaneousSummonedCard.cs new file mode 100644 index 0000000..9092cc6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessSkillActivateCountBySimultaneousSummonedCard.cs @@ -0,0 +1,48 @@ +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessSkillActivateCountBySimultaneousSummonedCard : SkillPreprocessBase +{ + private BattleCardBase _ownerCard; + + private bool _isPlayer; + + private string _cardType; + + private string _tribeName; + + public SkillPreprocessSkillActivateCountBySimultaneousSummonedCard(BattleCardBase ownerCard, string option) + { + _ownerCard = ownerCard; + string[] array = option.Split(':'); + _isPlayer = array[0] == "me"; + _cardType = array[1]; + _tribeName = array[2]; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (!_ownerCard.AlreadyInactiveSkillActivateCountBySimultaneousSummonedCard) + { + if (option.SummonedCard == null) + { + _ownerCard.ActiveSkillActivateCountBySimultaneousSummonedCard = false; + return false; + } + _ownerCard.ActiveSkillActivateCountBySimultaneousSummonedCard = option.SummonedCard.IsPlayer == _ownerCard.IsPlayer == _isPlayer; + string cardType = _cardType; + if (cardType != null && cardType == "unit") + { + _ownerCard.ActiveSkillActivateCountBySimultaneousSummonedCard &= option.SummonedCard.IsUnit; + } + _ownerCard.ActiveSkillActivateCountBySimultaneousSummonedCard &= option.SummonedCard.IsTribe(SkillFilterCreator.ParseEnum(_tribeName, CardBasePrm.TribeType.MAX)); + } + return _ownerCard.ActiveSkillActivateCountBySimultaneousSummonedCard; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + _ownerCard.InactiveSkillActivateCountBySimultaneousSummonedCard(); + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessSkillAfterStopBase.cs b/SVSim.BattleEngine/Engine/SkillPreprocessSkillAfterStopBase.cs new file mode 100644 index 0000000..4e026a9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessSkillAfterStopBase.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public abstract class SkillPreprocessSkillAfterStopBase : SkillPreprocessBase +{ + protected readonly string _target; + + protected int _callCount; + + protected int _turnEndCallCount; + + protected List> _conditionFuncList = new List>(); + + protected List optionList = new List(); + + protected SkillPreprocessSkillAfterStopBase(string target) + { + optionList = DisassemblySpecialString(target).ToList(); + _target = optionList[0]; + _callCount = 0; + _turnEndCallCount = 0; + foreach (string option in optionList) + { + _conditionFuncList.Add(GetConditionJudgeFunc((option != "me") ? option : string.Empty)); + } + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + BattlePlayerBase battlePlayer = ((_target == "me") ? playerPair.Self : playerPair.Opponent); + BattlePlayerBase battleEnemy = ((_target == "me") ? playerPair.Opponent : playerPair.Self); + Func func = delegate + { + if (battlePlayer.IsSelfTurn) + { + _turnEndCallCount++; + return NullVfx.GetInstance(); + } + return NullVfx.GetInstance(); + }; + Func func2 = delegate + { + if (battleEnemy.IsSelfTurn) + { + _turnEndCallCount++; + return NullVfx.GetInstance(); + } + return NullVfx.GetInstance(); + }; + if (optionList.Any((string s) => s.Contains("me_or_op_turn_end_count"))) + { + battlePlayer.OnTurnEnd += func; + battleEnemy.OnTurnEnd += func2; + } + else if (optionList.Any((string s) => s.Contains("op_turn_end_count"))) + { + battleEnemy.OnTurnEnd += func2; + } + else if (optionList.Any((string s) => s.Contains("turn_end_count"))) + { + battlePlayer.OnTurnEnd += func; + } + return OnStart(playerPair, skill, battlePlayer, battleEnemy, func, func2); + } + + protected abstract VfxBase OnStart(BattlePlayerPair playerPair, SkillBase skill, BattlePlayerBase battlePlayer, BattlePlayerBase battleEnemy, Func addTurnEndCallCountOnPlayerTurn, Func addTurnEndCallCountOnEnemyTurn); +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessSkillId.cs b/SVSim.BattleEngine/Engine/SkillPreprocessSkillId.cs new file mode 100644 index 0000000..0f154c7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessSkillId.cs @@ -0,0 +1,24 @@ +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessSkillId : SkillPreprocessBase +{ + private long _skillId; + + public SkillPreprocessSkillId(long skillId) + { + _skillId = skillId; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + BattleCardBase.SkillActivationInfo item = new BattleCardBase.SkillActivationInfo(_skillId, skill); + skill.SkillPrm.selfBattlePlayer.Class.SkillActivationList.Add(item); + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessSkillStopAndRemoveByWhenSummonOther.cs b/SVSim.BattleEngine/Engine/SkillPreprocessSkillStopAndRemoveByWhenSummonOther.cs new file mode 100644 index 0000000..5b6cf91 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessSkillStopAndRemoveByWhenSummonOther.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessSkillStopAndRemoveByWhenSummonOther : SkillPreprocessBase +{ + private readonly string _value; + + private readonly string _key; + + private const string ME_SUMMONED_CARD_UNIT_CLAN = "me_summoned_card_unit_clan"; + + public SkillPreprocessSkillStopAndRemoveByWhenSummonOther(string info) + { + if (info.Length < 2 || info.First() != '(' || info.Last() != ')') + { + return; + } + info = info.Substring(1, info.Length - 2); + string[] array = info.Split(':'); + for (int i = 0; i < array.Length; i++) + { + string[] array2 = array[i].Split('='); + string text = array2[0]; + if (text != null && text == "me_summoned_card_unit_clan") + { + _key = array2[0]; + _value = array2[1]; + } + } + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + SetUp(skill); + return NullVfx.GetInstance(); + } + + public override void Clone(SkillPreprocessBase source, SkillBase skill) + { + SetUp(skill); + } + + private void SetUp(SkillBase skill) + { + Func, VfxBase> callStopOneTime = null; + callStopOneTime = delegate(SkillProcessor skillProcessor, List summonedList) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (_key == "me_summoned_card_unit_clan" && _value == SkillFilterCreator.ContentKeyword.all.ToStringCustom()) + { + for (int i = 0; i < summonedList.Count; i++) + { + if (summonedList[i] != skill.SkillPrm.ownerCard && summonedList[i].IsPlayer == skill.SkillPrm.ownerCard.IsPlayer && summonedList[i].Clan == CardBasePrm.ClanType.ALL && summonedList[i].IsUnit) + { + skill.SkillPrm.ownerCard.SelfBattlePlayer.OnAfterSummonCardEvent -= callStopOneTime; + skill.SkillPrm.ownerCard.OpponentBattlePlayer.OnAfterSummonCardEvent -= callStopOneTime; + sequentialVfxPlayer.Register(StopSkill(skill, skillProcessor)); + skill.SkillPrm.ownerCard.Skills.Remove(skill); + } + } + } + sequentialVfxPlayer.Register(skill.SkillPrm.ownerCard.BattleCardView.InitializeBattleCardIcon(skill.SkillPrm.ownerCard, skill.SkillPrm.ownerCard.Skills)); + return sequentialVfxPlayer; + }; + if (_key == "me_summoned_card_unit_clan" && _value == SkillFilterCreator.ContentKeyword.all.ToStringCustom()) + { + skill.SkillPrm.ownerCard.SelfBattlePlayer.OnAfterSummonCardEvent += callStopOneTime; + skill.SkillPrm.ownerCard.OpponentBattlePlayer.OnAfterSummonCardEvent += callStopOneTime; + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessTimesPerBase.cs b/SVSim.BattleEngine/Engine/SkillPreprocessTimesPerBase.cs new file mode 100644 index 0000000..2d432d7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessTimesPerBase.cs @@ -0,0 +1,34 @@ +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessTimesPerBase : SkillPreprocessBase +{ + protected int _invokeCount; + + protected int _limitCount; + + public SkillPreprocessTimesPerBase(int limit) + { + _limitCount = limit; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return _invokeCount < _limitCount; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + _invokeCount++; + return NullVfx.GetInstance(); + } + + public override void Clone(SkillPreprocessBase source, SkillBase skill) + { + if (source is SkillPreprocessTimesPerBase skillPreprocessTimesPerBase) + { + _limitCount = skillPreprocessTimesPerBase._limitCount; + _invokeCount = skillPreprocessTimesPerBase._invokeCount; + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessTimesPerGame.cs b/SVSim.BattleEngine/Engine/SkillPreprocessTimesPerGame.cs new file mode 100644 index 0000000..62088d7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessTimesPerGame.cs @@ -0,0 +1,7 @@ +public class SkillPreprocessTimesPerGame : SkillPreprocessTimesPerBase +{ + public SkillPreprocessTimesPerGame(int limit) + : base(limit) + { + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessTimesPerTurn.cs b/SVSim.BattleEngine/Engine/SkillPreprocessTimesPerTurn.cs new file mode 100644 index 0000000..ba76614 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessTimesPerTurn.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessTimesPerTurn : SkillPreprocessTimesPerBase +{ + private const string SAME_BASE_CARD_ID_TEXT = "same_base_card_id"; + + private BattleCardBase _owner; + + public bool IsSameBaseCardId { get; private set; } + + public SkillPreprocessTimesPerTurn(BattleCardBase card, string option) + : base(int.Parse(option.Split(':')[0])) + { + _owner = card; + string[] array = option.Split(':'); + IsSameBaseCardId = array.Any((string o) => o == "same_base_card_id"); + if (!IsSameBaseCardId && array.Count() > 1) + { + base.BanId = array[1]; + } + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (!base.IsRight(playerInfoPair, option, PreexecutionCheck)) + { + return false; + } + if (base.BanId != string.Empty) + { + return GetSkillNumInvokeCount(_owner, base.BanId) < _limitCount; + } + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + base.Start(playerPair, skill, skillProcessor, optionValue, checkerOption); + if (_invokeCount == 1) + { + BattlePlayerBase onTurnPlayer = (playerPair.Self.IsSelfTurn ? playerPair.Self : playerPair.Opponent); + Func callStopOneTime = null; + callStopOneTime = delegate + { + _invokeCount = 0; + onTurnPlayer.OnTurnEnd -= callStopOneTime; + return NullVfx.GetInstance(); + }; + onTurnPlayer.OnTurnEnd += callStopOneTime; + } + return NullVfx.GetInstance(); + } + + public override void Clone(SkillPreprocessBase source, SkillBase skill) + { + base.Clone(source, skill); + if (source is SkillPreprocessTimesPerTurn skillPreprocessTimesPerTurn) + { + _owner = skillPreprocessTimesPerTurn._owner; + base.BanId = skillPreprocessTimesPerTurn.BanId; + } + } + + public int GetLimitCount() + { + return _limitCount; + } + + public int GetInvokeCount() + { + return _invokeCount; + } + + public void ResetInvokeCount() + { + _invokeCount = 0; + } + + private int GetSkillNumInvokeCount(BattleCardBase card, string banId) + { + return GetSkillNumInvokeCount(card.NormalSkills, banId) + GetSkillNumInvokeCount(card.EvolutionSkills, banId); + } + + private int GetSkillNumInvokeCount(SkillCollectionBase skills, string banId) + { + int num = 0; + for (int i = 0; i < skills.Count(); i++) + { + List preprocessList = skills.ElementAt(i).PreprocessList; + for (int j = 0; j < preprocessList.Count(); j++) + { + if (preprocessList[j] is SkillPreprocessTimesPerTurn && preprocessList[j].BanId == banId) + { + num += (preprocessList[j] as SkillPreprocessTimesPerTurn).GetInvokeCount(); + } + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndPeriodOfStopTime.cs b/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndPeriodOfStopTime.cs new file mode 100644 index 0000000..af59844 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndPeriodOfStopTime.cs @@ -0,0 +1,45 @@ +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessTurnEndPeriodOfStopTime : SkillPreprocessPeriodBase +{ + private SkillBase _skill; + + private BattleCardBase _ownerCard; + + public SkillPreprocessTurnEndPeriodOfStopTime(SkillBase skill, BattleCardBase ownerCard, string period) + : base(ownerCard, period) + { + _skill = skill; + _ownerCard = ownerCard; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + _ownerCard.SelfBattlePlayer.OnTurnStartBeforeDraw -= TurnStartFunction; + _ownerCard.SelfBattlePlayer.OnTurnStartBeforeDraw += TurnStartFunction; + _ownerCard.SelfBattlePlayer.OnTurnEnd -= TurnEndFunction; + _ownerCard.SelfBattlePlayer.OnTurnEnd += TurnEndFunction; + return NullVfx.GetInstance(); + } + + private VfxBase TurnStartFunction(SkillProcessor skillProcessor) + { + ReducePeriodCount(); + return NullVfx.GetInstance(); + } + + private VfxBase TurnEndFunction(SkillProcessor skillProcessor) + { + if (_effectiveRange == base.PeriodCount) + { + return StopSkill(_skill, skillProcessor); + } + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndRemove.cs b/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndRemove.cs new file mode 100644 index 0000000..d95bd1e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndRemove.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessTurnEndRemove : SkillPreprocessBase +{ + private readonly string _target; + + public SkillPreprocessTurnEndRemove(string target) + { + _target = target; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + BattlePlayerBase battlePlayer = ((_target == "me") ? playerPair.Self : playerPair.Opponent); + Func callStopOneTime = null; + callStopOneTime = delegate + { + battlePlayer.OnTurnEnd -= callStopOneTime; + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + BattleCardBase ownerCard = skill.SkillPrm.ownerCard; + parallelVfxPlayer.Register(skill.RemoveAfter()); + ownerCard.Skills.Remove(skill); + List list = playerPair.Self.InPlayCards.ToList(); + list.AddRange(playerPair.Opponent.InPlayCards); + SkillIconInitialize(parallelVfxPlayer, list); + return parallelVfxPlayer; + }; + battlePlayer.OnTurnEnd += callStopOneTime; + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndSkillAfterStop.cs b/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndSkillAfterStop.cs new file mode 100644 index 0000000..aa560c9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndSkillAfterStop.cs @@ -0,0 +1,37 @@ +using System; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessTurnEndSkillAfterStop : SkillPreprocessSkillAfterStopBase +{ + public SkillPreprocessTurnEndSkillAfterStop(string target) + : base(target) + { + } + + protected override VfxBase OnStart(BattlePlayerPair playerPair, SkillBase skill, BattlePlayerBase battlePlayer, BattlePlayerBase battleEnemy, Func addTurnEndCallCountOnPlayerTurn, Func addTurnEndCallCountOnEnemyTurn) + { + Func callStopOnTurnEndSkillAfter = null; + callStopOnTurnEndSkillAfter = delegate(SkillProcessor _) + { + if (!battleEnemy.IsSelfTurn) + { + return NullVfx.GetInstance(); + } + _callCount++; + if ((_conditionFuncList.Count > 0 && _conditionFuncList.All((Func s) => s(playerPair, _callCount, _turnEndCallCount))) || _conditionFuncList.Count == 0) + { + BattlePlayerBase battlePlayerBase2 = battlePlayer; + battlePlayerBase2.OnTurnEndSkillAfter = (Func)Delegate.Remove(battlePlayerBase2.OnTurnEndSkillAfter, callStopOnTurnEndSkillAfter); + battlePlayer.OnTurnEnd -= addTurnEndCallCountOnPlayerTurn; + battleEnemy.OnTurnEnd -= addTurnEndCallCountOnEnemyTurn; + return StopSkill(skill, _); + } + return NullVfx.GetInstance(); + }; + BattlePlayerBase battlePlayerBase = battleEnemy; + battlePlayerBase.OnTurnEndSkillAfter = (Func)Delegate.Combine(battlePlayerBase.OnTurnEndSkillAfter, callStopOnTurnEndSkillAfter); + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndStop.cs b/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndStop.cs new file mode 100644 index 0000000..2aa47f0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndStop.cs @@ -0,0 +1,43 @@ +using System; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessTurnEndStop : SkillPreprocessBase +{ + private readonly string _target; + + private int _callCount; + + private Func _conditionFunc; + + public SkillPreprocessTurnEndStop(string target) + { + string[] array = DisassemblySpecialString(target); + _target = array[0]; + _callCount = 0; + _conditionFunc = GetConditionJudgeFunc((array.Length > 1) ? array[1] : string.Empty); + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + BattlePlayerBase battlePlayer = ((_target == "me") ? playerPair.Self : playerPair.Opponent); + Func callStopOneTime = null; + callStopOneTime = delegate(SkillProcessor skillProcessorOneTime) + { + _callCount++; + if (_conditionFunc == null || _conditionFunc(playerPair, _callCount, 0)) + { + battlePlayer.OnTurnEnd -= callStopOneTime; + return StopSkill(skill, skillProcessorOneTime); + } + return NullVfx.GetInstance(); + }; + battlePlayer.OnTurnEnd += callStopOneTime; + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndStopAndRemove.cs b/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndStopAndRemove.cs new file mode 100644 index 0000000..c93b299 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessTurnEndStopAndRemove.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessTurnEndStopAndRemove : SkillPreprocessBase +{ + private readonly string _target; + + private int _callCount; + + private Func _conditionFunc; + + public SkillPreprocessTurnEndStopAndRemove(string target) + { + string[] array = DisassemblySpecialString(target); + _target = array[0]; + _callCount = 0; + _conditionFunc = GetConditionJudgeFunc((array.Length > 1) ? array[1] : string.Empty); + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + BattlePlayerBase battlePlayer = ((_target == "me") ? playerPair.Self : playerPair.Opponent); + Func callStopOneTime = null; + callStopOneTime = delegate(SkillProcessor skillProcessorOneTime) + { + _callCount++; + if (_conditionFunc == null || _conditionFunc(playerPair, _callCount, 0)) + { + battlePlayer.OnTurnEnd -= callStopOneTime; + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + parallelVfxPlayer.Register(StopSkill(skill, skillProcessorOneTime)); + skill.SkillPrm.ownerCard.Skills.Remove(skill); + List list = playerPair.Self.InPlayCards.ToList(); + list.AddRange(playerPair.Opponent.InPlayCards); + SkillIconInitialize(parallelVfxPlayer, list); + return parallelVfxPlayer; + } + return NullVfx.GetInstance(); + }; + battlePlayer.OnTurnEnd += callStopOneTime; + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessTurnStartSkill.cs b/SVSim.BattleEngine/Engine/SkillPreprocessTurnStartSkill.cs new file mode 100644 index 0000000..fda6690 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessTurnStartSkill.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessTurnStartSkill : SkillPreprocessBase +{ + private string _target; + + private string _timingText; + + private int _turnCount; + + private int _turnStartCallCount; + + private Func _addTurnStartCallCountOnPlayerTurn; + + public SkillPreprocessTurnStartSkill(BattleCardBase ownerCard, string target) + { + SkillPreprocessTurnStartSkill skillPreprocessTurnStartSkill = this; + _turnStartCallCount = 0; + List list = DisassemblySpecialString(target).ToList(); + _target = list[0]; + BattlePlayerBase battlePlayer = ((_target == "me") ? ownerCard.SelfBattlePlayer : ownerCard.OpponentBattlePlayer); + string[] array = list[1].Split('='); + _timingText = array[0]; + _turnCount = int.Parse(array[1]); + _addTurnStartCallCountOnPlayerTurn = delegate + { + if (battlePlayer.IsSelfTurn) + { + skillPreprocessTurnStartSkill._turnStartCallCount++; + return NullVfx.GetInstance(); + } + return NullVfx.GetInstance(); + }; + string timingText = _timingText; + if (timingText != null && timingText == "me_turn_start_count") + { + battlePlayer.OnTurnStartBeforeDraw += _addTurnStartCallCountOnPlayerTurn; + } + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return _turnStartCallCount >= _turnCount; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + BattlePlayerBase battlePlayerBase = ((_target == "me") ? playerPair.Self : playerPair.Opponent); + string timingText = _timingText; + if (timingText != null && timingText == "me_turn_start_count") + { + battlePlayerBase.OnTurnStartBeforeDraw -= _addTurnStartCallCountOnPlayerTurn; + } + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessTurnStartSkillAfterPeriodOfStopTime.cs b/SVSim.BattleEngine/Engine/SkillPreprocessTurnStartSkillAfterPeriodOfStopTime.cs new file mode 100644 index 0000000..2faebce --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessTurnStartSkillAfterPeriodOfStopTime.cs @@ -0,0 +1,39 @@ +using System; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessTurnStartSkillAfterPeriodOfStopTime : SkillPreprocessPeriodBase +{ + private SkillBase _skill; + + private BattleCardBase _ownerCard; + + public SkillPreprocessTurnStartSkillAfterPeriodOfStopTime(SkillBase skill, BattleCardBase ownerCard, string period) + : base(ownerCard, period) + { + _skill = skill; + _ownerCard = ownerCard; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + _ownerCard.SelfBattlePlayer.OnTurnEnd += delegate + { + ReducePeriodCount(); + return NullVfx.GetInstance(); + }; + BattlePlayerBase selfBattlePlayer = _ownerCard.SelfBattlePlayer; + selfBattlePlayer.OnTurnStartSkillAfter = (Func)Delegate.Combine(selfBattlePlayer.OnTurnStartSkillAfter, (Func)((SkillProcessor _) => (_effectiveRange == base.PeriodCount) ? StopSkill(_skill, _) : NullVfxWithLoading.GetInstance())); + _ownerCard.OnRemoveFromInPlayAfterOneTime += delegate(bool flg, SkillProcessor skillProcessorOneTime) + { + ResetPeriodCount(); + return StopSkill(_skill, skillProcessorOneTime); + }; + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessTurnStartSkillAfterStop.cs b/SVSim.BattleEngine/Engine/SkillPreprocessTurnStartSkillAfterStop.cs new file mode 100644 index 0000000..0633294 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessTurnStartSkillAfterStop.cs @@ -0,0 +1,33 @@ +using System; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessTurnStartSkillAfterStop : SkillPreprocessSkillAfterStopBase +{ + public SkillPreprocessTurnStartSkillAfterStop(string target) + : base(target) + { + } + + protected override VfxBase OnStart(BattlePlayerPair playerPair, SkillBase skill, BattlePlayerBase battlePlayer, BattlePlayerBase battleEnemy, Func addTurnEndCallCountOnPlayerTurn, Func addTurnEndCallCountOnEnemyTurn) + { + Func callStopOnTurnStartSkillAfter = null; + callStopOnTurnStartSkillAfter = delegate(SkillProcessor _) + { + _callCount++; + if ((_conditionFuncList.Count > 0 && _conditionFuncList.All((Func s) => s(playerPair, _callCount, _turnEndCallCount))) || _conditionFuncList.Count == 0) + { + BattlePlayerBase battlePlayerBase2 = battlePlayer; + battlePlayerBase2.OnTurnStartSkillAfter = (Func)Delegate.Remove(battlePlayerBase2.OnTurnStartSkillAfter, callStopOnTurnStartSkillAfter); + battlePlayer.OnTurnEnd -= addTurnEndCallCountOnPlayerTurn; + battleEnemy.OnTurnEnd -= addTurnEndCallCountOnEnemyTurn; + return StopSkill(skill, _); + } + return NullVfx.GetInstance(); + }; + BattlePlayerBase battlePlayerBase = battlePlayer; + battlePlayerBase.OnTurnStartSkillAfter = (Func)Delegate.Combine(battlePlayerBase.OnTurnStartSkillAfter, callStopOnTurnStartSkillAfter); + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessTurnStartStop.cs b/SVSim.BattleEngine/Engine/SkillPreprocessTurnStartStop.cs new file mode 100644 index 0000000..a55551c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessTurnStartStop.cs @@ -0,0 +1,45 @@ +using System; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessTurnStartStop : SkillPreprocessBase +{ + private readonly string _target; + + private int _callCount; + + private Func _conditionFunc; + + public string Target => _target; + + public SkillPreprocessTurnStartStop(string target) + { + string[] array = DisassemblySpecialString(target); + _target = array[0]; + _callCount = 0; + _conditionFunc = GetConditionJudgeFunc((array.Length > 1) ? array[1] : string.Empty); + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + BattlePlayerBase battlePlayer = ((_target == "me") ? playerPair.Self : playerPair.Opponent); + Func callStopOneTime = null; + callStopOneTime = delegate(SkillProcessor skillProcessorOneTime) + { + _callCount++; + if (_conditionFunc == null || _conditionFunc(playerPair, _callCount, 0)) + { + battlePlayer.OnTurnStartBeforeDraw -= callStopOneTime; + return StopSkill(skill, skillProcessorOneTime); + } + return NullVfx.GetInstance(); + }; + battlePlayer.OnTurnStartBeforeDraw += callStopOneTime; + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessUnitAttackStop.cs b/SVSim.BattleEngine/Engine/SkillPreprocessUnitAttackStop.cs new file mode 100644 index 0000000..302e2c8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessUnitAttackStop.cs @@ -0,0 +1,43 @@ +using System; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessUnitAttackStop : SkillPreprocessBase +{ + private const string REMOVE_TARGET_SELF = "me"; + + private readonly string _target = ""; + + public SkillPreprocessUnitAttackStop(string target) + { + _target = target; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + BattlePlayerBase battlePlayer = ((_target == "me") ? playerPair.Self : playerPair.Opponent); + Func callStopOneTime = null; + callStopOneTime = delegate(BattleCardBase attackCard, BattleCardBase target, SkillProcessor skillProcessorOneTime) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (attackCard.SelfBattlePlayer == battlePlayer) + { + sequentialVfxPlayer.Register(StopSkill(skill, skillProcessorOneTime)); + battlePlayer.BattleMgr.OperateMgr.OnBeforeAttack -= callStopOneTime; + } + return sequentialVfxPlayer; + }; + battlePlayer.BattleMgr.OperateMgr.OnBeforeAttack += callStopOneTime; + skill.SkillPrm.ownerCard.OnRemoveFromInPlayAfterOneTime += delegate + { + battlePlayer.BattleMgr.OperateMgr.OnBeforeAttack -= callStopOneTime; + return NullVfx.GetInstance(); + }; + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessUseEvolutionPoint.cs b/SVSim.BattleEngine/Engine/SkillPreprocessUseEvolutionPoint.cs new file mode 100644 index 0000000..178f6d0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessUseEvolutionPoint.cs @@ -0,0 +1,46 @@ +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessUseEvolutionPoint : SkillPreprocessBase +{ + private readonly int _consumeValue; + + private readonly BattleCardBase _ownerCard; + + public SkillPreprocessUseEvolutionPoint(int count, BattleCardBase ownerCard) + { + _consumeValue = count; + _ownerCard = ownerCard; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + if (playerInfoPair.ReadOnlySelf.EvolveWaitTurnCount <= 0) + { + return playerInfoPair.ReadOnlySelf.CurrentEpCount >= _consumeValue; + } + return false; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + int currentEpCount = playerPair.ReadOnlySelf.CurrentEpCount; + int num = currentEpCount - _consumeValue; + int epTotal = playerPair.Self.EpTotal; + playerPair.Self.UseEpCount(_consumeValue); + playerPair.Self.StartSkillWhenUseEpSelfAndOther(skillProcessor); + playerPair.Self.CallOnEpModifier(_ownerCard, _consumeValue * -1, isAdd: true); + if (playerPair.Self.BattleMgr is NetworkStandardBattleMgr networkStandardBattleMgr) + { + networkStandardBattleMgr.RegisterUseEpTrigger(playerPair.Self); + } + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + parallelVfxPlayer.Register(new EpChangeVfx(playerPair.Self, currentEpCount, num, epTotal)); + if (!playerPair.Self.BattleMgr.IsVirtualBattle) + { + BattleLogManager.GetInstance().AddLogSkillSetEP(num, playerPair.Self.Class, skill); + } + return parallelVfxPlayer; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessUsePp.cs b/SVSim.BattleEngine/Engine/SkillPreprocessUsePp.cs new file mode 100644 index 0000000..e86dd3c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessUsePp.cs @@ -0,0 +1,32 @@ +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessUsePp : SkillPreprocessBase +{ + private readonly int _consumeValue; + + public int ConsumeValue => _consumeValue; + + public SkillPreprocessUsePp(int count) + { + _consumeValue = count; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return playerInfoPair.ReadOnlySelf.Pp >= _consumeValue; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + playerPair.Self.Pp -= _consumeValue; + playerPair.Self.AddGameUsedPp(_consumeValue); + if (!skill.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.IsVirtualBattle) + { + BattleLogManager.GetInstance().AddLogSkillUsePp(skill, skill.SkillPrm.ownerCard.SelfBattlePlayer.Class, -_consumeValue); + } + playerPair.Self.CallOnAddPp(_consumeValue * -1, skill.SkillPrm.ownerCard); + return new PpChangeVfx(skill.SkillPrm.ownerCard.SelfBattlePlayer); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessWhenEvolveEndRemove.cs b/SVSim.BattleEngine/Engine/SkillPreprocessWhenEvolveEndRemove.cs new file mode 100644 index 0000000..4b456d7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessWhenEvolveEndRemove.cs @@ -0,0 +1,44 @@ +using System; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessWhenEvolveEndRemove : SkillPreprocessBase +{ + public SkillPreprocessWhenEvolveEndRemove(SkillBase skill) + { + SetUp(skill); + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + return NullVfx.GetInstance(); + } + + public override void Clone(SkillPreprocessBase source, SkillBase skill) + { + SetUp(skill); + } + + private void SetUp(SkillBase skill) + { + Func callStopOneTime = null; + callStopOneTime = delegate(SkillProcessor skillProcessorOneTime) + { + skill.SkillPrm.ownerCard.OnBeforeEvolve -= callStopOneTime; + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(StopSkill(skill, skillProcessorOneTime)); + skill.SkillPrm.ownerCard.Skills.Remove(skill); + if (skill.GetAttachSkill is Skill_attach_skill skill_attach_skill && !BattleManagerBase.IsForecast) + { + sequentialVfxPlayer.Register(skill_attach_skill.StopSpecificCard(skill.SkillPrm.ownerCard)); + } + return sequentialVfxPlayer; + }; + skill.SkillPrm.ownerCard.OnBeforeEvolve += callStopOneTime; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillPreprocessWrappingAndAddingSkillActivatedCount.cs b/SVSim.BattleEngine/Engine/SkillPreprocessWrappingAndAddingSkillActivatedCount.cs new file mode 100644 index 0000000..85f157d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillPreprocessWrappingAndAddingSkillActivatedCount.cs @@ -0,0 +1,27 @@ +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillPreprocessWrappingAndAddingSkillActivatedCount : SkillPreprocessBase +{ + private BattleCardBase _ownerCard; + + public SkillPreprocessWrappingAndAddingSkillActivatedCount(BattleCardBase ownerCard, string wrapping) + { + _ownerCard = ownerCard; + if (wrapping != string.Empty) + { + _ownerCard.SetSkillActivatedCountWrapValue(int.Parse(wrapping)); + } + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + _ownerCard.IncrementSkillActivatedCount(); + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillRandomEachSameBaseCardIdFilter.cs b/SVSim.BattleEngine/Engine/SkillRandomEachSameBaseCardIdFilter.cs new file mode 100644 index 0000000..84a7cc7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillRandomEachSameBaseCardIdFilter.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillRandomEachSameBaseCardIdFilter : ISkillSelectFilter +{ + protected int _restCount; + + protected int _count; + + protected BattlePlayerBase _player; + + public int CalcCount(SkillOptionValue option) + { + return _count; + } + + public SkillRandomEachSameBaseCardIdFilter(int randomCount, BattlePlayerBase player) + { + _restCount = randomCount; + _player = player; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + if (cards.Count() == 0) + { + return Enumerable.Empty(); + } + List list = new List(); + IEnumerable ids = cards.Select((BattleCardBase c) => c.BaseParameter.BaseCardId).Distinct(); + int i; + for (i = 0; i < ids.Count(); i++) + { + List list2 = cards.Where((BattleCardBase c) => c.BaseParameter.BaseCardId == ids.ElementAt(i)).ToList(); + int num = list2.Count() - _restCount; + for (int num2 = 0; num2 < num; num2++) + { + BattleCardBase item = list2[BattleManagerBase.GetIns().StableRandom(list2.Count)]; + list.Add(item); + list2.Remove(item); + _count++; + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillRandomSelectFilter.cs b/SVSim.BattleEngine/Engine/SkillRandomSelectFilter.cs new file mode 100644 index 0000000..6b9c946 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillRandomSelectFilter.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; + +public class SkillRandomSelectFilter : ISkillSelectFilter +{ + private readonly string _context; + + private int _count; + + public string Context => _context; + + public int Count => _count; + + public SkillRandomSelectFilter(string randomCountText) + { + _context = randomCountText; + } + + public int CalcCount(SkillOptionValue option) + { + return option.ParseInt(_context); + } + + public bool IsContainVariableValue() + { + return SkillOptionValue.IsContainVariableValue(_context); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + _count = CalcCount(option); + cards = cards.OrderBy((BattleCardBase x) => x.Index); + List attractSkillCardList = cards.Where((BattleCardBase c) => c.SkillApplyInformation.IsAttractSkillTarget).ToList(); + List nonAttractSkillCardList = cards.Where((BattleCardBase c) => !c.SkillApplyInformation.IsAttractSkillTarget).ToList(); + BattleManagerBase battleMgr = BattleManagerBase.GetIns(); + _count = Math.Min(_count, attractSkillCardList.Count + nonAttractSkillCardList.Count); + for (int i = 0; i < _count; i++) + { + List list = ((attractSkillCardList.Count > 0) ? attractSkillCardList : nonAttractSkillCardList); + int index = (BattleManagerBase.IsRandomDraw ? battleMgr.StableRandom(list.Count) : 0); + BattleCardBase battleCardBase = list[index]; + list.Remove(battleCardBase); + yield return battleCardBase; + } + } + + public static IEnumerable Filtering(int selectCount, IEnumerable cards, BattleManagerBase battleMgr) + { + cards = cards.OrderBy((BattleCardBase x) => x.Index); + List list = cards.ToList(); + List list2 = new List(); + int num = Math.Min(selectCount, list.Count); + LocalLog.AccumulateLastTraceLog("drawDeck " + list.Count); + for (int num2 = 0; num2 < num; num2++) + { + int index = battleMgr.StableRandom(list.Count); + BattleCardBase item = list[index]; + list.Remove(item); + list2.Add(item); + } + return list2; + } + + public static IEnumerable Filtering(int selectCount, IEnumerable targets, BattleManagerBase battleMgr, bool isDistinct = false) + { + List list = targets.ToList(); + List list2 = new List(); + int num = selectCount; + if (isDistinct) + { + num = Math.Min(selectCount, list.Count); + } + for (int i = 0; i < num; i++) + { + if (list.Count > 0) + { + int index = battleMgr.StableRandom(list.Count); + T item = list[index]; + list2.Add(item); + if (isDistinct) + { + list.Remove(item); + } + } + } + return list2; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillRandomSelectUntilFilter.cs b/SVSim.BattleEngine/Engine/SkillRandomSelectUntilFilter.cs new file mode 100644 index 0000000..84224b9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillRandomSelectUntilFilter.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; + +public class SkillRandomSelectUntilFilter : ISkillSelectFilter +{ + protected string _randomCountText; + + protected BattlePlayerBase _player; + + protected int _count; + + public int CalcCount(SkillOptionValue option) + { + return _count; + } + + public SkillRandomSelectUntilFilter(string randomCountText, BattlePlayerBase player) + { + _randomCountText = randomCountText; + _player = player; + } + + public IEnumerable Filtering(IEnumerable targetCards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + _count = 1; + if (targetCards.Count() == 0) + { + return Enumerable.Empty(); + } + BattleManagerBase ins = BattleManagerBase.GetIns(); + ApplySkillTargetFilterCollection applySkillTargetFilterCollection = new ApplySkillTargetFilterCollection(); + SkillFilterCreator.SetupTarget(applySkillTargetFilterCollection, _randomCountText, _player.Class, null); + ApplySkillTargetFilterCollection applySkillTargetFilterCollection2 = applySkillTargetFilterCollection.ApplyAndFilter[0]; + BattlePlayerReadOnlyInfoPair battlePlayerInfoPair = ins.GetBattlePlayerInfoPair(_player.IsPlayer); + List list = targetCards.OrderBy((BattleCardBase x) => x.Index).ToList(); + List list2 = new List(); + while (!IsHandMaxAfterDraw(list2)) + { + int index = (BattleManagerBase.IsRandomDraw ? ins.StableRandom(list.Count) : 0); + BattleCardBase battleCardBase = list[index]; + list.Remove(battleCardBase); + list2.Add(battleCardBase); + if (!applySkillTargetFilterCollection2.SimpleFiltering(battleCardBase, battlePlayerInfoPair, checkerOption, option) || IsHandMaxAfterDraw(list2)) + { + break; + } + _count++; + if (list.Count <= 0) + { + break; + } + } + return list2; + } + + private bool IsHandMaxAfterDraw(List drawCards) + { + return _player.HandCardList.Count + drawCards.Count >= 9; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillResidentPreprocessReturnHandActiveReset.cs b/SVSim.BattleEngine/Engine/SkillResidentPreprocessReturnHandActiveReset.cs new file mode 100644 index 0000000..2e4d810 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillResidentPreprocessReturnHandActiveReset.cs @@ -0,0 +1,41 @@ +using System; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SkillResidentPreprocessReturnHandActiveReset : SkillPreprocessBase +{ + private SkillBase _skill; + + public SkillResidentPreprocessReturnHandActiveReset(SkillBase skill) + { + _skill = skill; + } + + public override bool IsRight(BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option, bool PreexecutionCheck = false) + { + return true; + } + + public override VfxBase Start(BattlePlayerPair playerPair, SkillBase skill, SkillProcessor skillProcessor, SkillOptionValue optionValue, SkillConditionCheckerOption checkerOption) + { + SetUp(skill); + return NullVfx.GetInstance(); + } + + public override void Clone(SkillPreprocessBase source, SkillBase skill) + { + SetUp(skill); + } + + private void SetUp(SkillBase skill) + { + Func callStopOneTime = null; + callStopOneTime = delegate + { + skill.SkillPrm.ownerCard.OnReturnCard -= callStopOneTime; + skill.SetIsResidentSkillStartFlag(flg: false); + return NullVfx.GetInstance(); + }; + skill.SkillPrm.ownerCard.OnReturnCard += callStopOneTime; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillSelectAllFilter.cs b/SVSim.BattleEngine/Engine/SkillSelectAllFilter.cs new file mode 100644 index 0000000..1a360ed --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillSelectAllFilter.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +public class SkillSelectAllFilter : ISkillSelectFilter +{ + public int CalcCount(SkillOptionValue option) + { + return -1; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + return cards; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillSelectIndexFilter.cs b/SVSim.BattleEngine/Engine/SkillSelectIndexFilter.cs new file mode 100644 index 0000000..bc29c2f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillSelectIndexFilter.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillSelectIndexFilter : ISkillSelectFilter +{ + private readonly int _index; + + public SkillSelectIndexFilter(int index) + { + _index = index; + } + + public int CalcCount(SkillOptionValue option) + { + return 1; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + IEnumerable result = new BattleCardBase[0]; + if (checkerOption.SelectedCards == null || checkerOption.SelectedCards.Count == 0) + { + return result; + } + BattleCardBase selectCard = checkerOption.SelectedCards[_index].SelectCard; + if (cards.Contains(selectCard)) + { + result = new BattleCardBase[1] { selectCard }; + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillSelectNullFilter.cs b/SVSim.BattleEngine/Engine/SkillSelectNullFilter.cs new file mode 100644 index 0000000..9e4e029 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillSelectNullFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Linq; + +public class SkillSelectNullFilter : ISkillSelectFilter +{ + public int CalcCount(SkillOptionValue option) + { + return -1; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + return Enumerable.Empty(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillSelectableCardFilter.cs b/SVSim.BattleEngine/Engine/SkillSelectableCardFilter.cs new file mode 100644 index 0000000..0a538b4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillSelectableCardFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillSelectableCardFilter : ISkillCardFilter +{ + protected IReadOnlyBattleCardInfo _card; + + public SkillSelectableCardFilter(IReadOnlyBattleCardInfo card) + { + _card = card; + } + + public virtual IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => _card.IsPlayer == c.IsPlayer || !c.SkillApplyInformation.CantBeFocusedSkill); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillSpellAndFieldFilter.cs b/SVSim.BattleEngine/Engine/SkillSpellAndFieldFilter.cs new file mode 100644 index 0000000..7116207 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillSpellAndFieldFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillSpellAndFieldFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsSpell || c.IsField); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillSpellFilter.cs b/SVSim.BattleEngine/Engine/SkillSpellFilter.cs new file mode 100644 index 0000000..27f257a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillSpellFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillSpellFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsSpell); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillSummonMomentTribeFilter.cs b/SVSim.BattleEngine/Engine/SkillSummonMomentTribeFilter.cs new file mode 100644 index 0000000..39fd6df --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillSummonMomentTribeFilter.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillSummonMomentTribeFilter : ISkillCardFilter +{ + private readonly CardBasePrm.TribeType _type; + + private readonly bool _isEqual; + + public SkillSummonMomentTribeFilter(CardBasePrm.TribeType tribe, string op) + { + _type = tribe; + _isEqual = op == "="; + } + + private bool judgeSummonMomentTribe(IReadOnlyBattleCardInfo readOnlyBattleCard, CardBasePrm.TribeType tribe) + { + BattleCardBase card = readOnlyBattleCard as BattleCardBase; + List> list = (from c in card.SelfBattlePlayer.GameSummonMomentTribe + where c.Card == card + select c.Tribes).ToList(); + for (int num = 0; num < list.Count; num++) + { + if (list[num].Contains(tribe)) + { + return true; + } + } + return false; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => judgeSummonMomentTribe(c, _type) == _isEqual); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetAcceleratedCardfilter.cs b/SVSim.BattleEngine/Engine/SkillTargetAcceleratedCardfilter.cs new file mode 100644 index 0000000..0ef8db6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetAcceleratedCardfilter.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetAcceleratedCardfilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.AcceleratedCard == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + if (battlePlayerInfo.IsPlayer == option.AcceleratedCard.IsPlayer) + { + list.Add(option.AcceleratedCard); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetAttackerFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetAttackerFilter.cs new file mode 100644 index 0000000..d929fe2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetAttackerFilter.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetAttackerFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.AttackerCard == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + if (option.AttackerCard.IsPlayer == battlePlayerInfo.IsPlayer) + { + list.Add(option.AttackerCard); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetBanishedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetBanishedCardFilter.cs new file mode 100644 index 0000000..ba9e3a1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetBanishedCardFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetBanishedCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + if (option.BanishedCard == null) + { + yield break; + } + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + if (battlePlayerInfo.IsPlayer == option.BanishedCard.IsPlayer) + { + yield return option.BanishedCard; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetBanishedLastTargetFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetBanishedLastTargetFilter.cs new file mode 100644 index 0000000..24225be --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetBanishedLastTargetFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetBanishedLastTargetFilter : SkillTargetLastTargetFilter +{ + public SkillTargetBanishedLastTargetFilter(string option) + : base(option) + { + } + + public override IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoBanishCards.Where((IReadOnlyBattleCardInfo pp) => pp is SpellBattleCard || (pp.IsDead && !(pp is NullBattleCard))))); + return list.Intersect(base.Filtering(battlePlayerInfos, option)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetBattleStartDeckFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetBattleStartDeckFilter.cs new file mode 100644 index 0000000..f66423b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetBattleStartDeckFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetBattleStartDeckFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoBattleStartDeckCards); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetBeAttackedFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetBeAttackedFilter.cs new file mode 100644 index 0000000..f33ba39 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetBeAttackedFilter.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetBeAttackedFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.AttackTargetCard == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + if (option.AttackTargetCard.IsPlayer == battlePlayerInfo.IsPlayer) + { + list.Add(option.AttackTargetCard); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetBeforeTransformCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetBeforeTransformCardFilter.cs new file mode 100644 index 0000000..3e1b798 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetBeforeTransformCardFilter.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetBeforeTransformCardFilter : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetBeforeTransformCardFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + BattleCardBase.TransformInformation transformInfo = _ownerCard.TransformInfo; + if (transformInfo.Type != BattleCardBase.TransformType.Metamorphose && transformInfo.OriginalCard != null) + { + list.Add(transformInfo.OriginalCard); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetBurialRiteCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetBurialRiteCardFilter.cs new file mode 100644 index 0000000..04195db --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetBurialRiteCardFilter.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetBurialRiteCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + if (option.BurialRiteCards == null) + { + yield break; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + foreach (BattleCardBase burialRiteCard in option.BurialRiteCards) + { + if (info.IsPlayer == burialRiteCard.IsPlayer) + { + yield return burialRiteCard; + } + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetBurialRiteCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetBurialRiteCardListFilter.cs new file mode 100644 index 0000000..91f40c8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetBurialRiteCardListFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetBurialRiteCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoGameBurialRiteCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetBurialRiteThisTurnCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetBurialRiteThisTurnCardListFilter.cs new file mode 100644 index 0000000..5df5de3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetBurialRiteThisTurnCardListFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetBurialRiteThisTurnCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoTurnBurialRiteCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetCantAttackAllLastTargetFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetCantAttackAllLastTargetFilter.cs new file mode 100644 index 0000000..69a0477 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetCantAttackAllLastTargetFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetCantAttackAllLastTargetFilter : SkillTargetLastTargetFilter +{ + public SkillTargetCantAttackAllLastTargetFilter(string option) + : base(option) + { + } + + public override IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return from c in base.Filtering(battlePlayerInfos, option) + where c.SkillApplyInformation.IsSkillCantAtkAll + select c; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetCantAttackAllReturnCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetCantAttackAllReturnCardFilter.cs new file mode 100644 index 0000000..c3e0fe7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetCantAttackAllReturnCardFilter.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetCantAttackAllReturnCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.CantAttackAllReturnCards == null) + { + return list; + } + int i; + for (i = 0; i < battlePlayerInfos.Count(); i++) + { + list.AddRange(option.CantAttackAllReturnCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == battlePlayerInfos.ElementAt(i).IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetCemeteryFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetCemeteryFilter.cs new file mode 100644 index 0000000..2cfd225 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetCemeteryFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetCemeteryFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoCemeterys); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetChantCountChangeCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetChantCountChangeCardsFilter.cs new file mode 100644 index 0000000..f3becc4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetChantCountChangeCardsFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetChantCountChangeCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.ChantCountChangeCard == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.ChantCountChangeCard.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetChosenCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetChosenCardsFilter.cs new file mode 100644 index 0000000..6379659 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetChosenCardsFilter.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using Wizard; +using Wizard.Battle; + +public class SkillTargetChosenCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.ChosenCards == null) + { + return list; + } + foreach (int chosenCard in option.ChosenCards) + { + if (CardMaster.GetInstanceForBattle().CardExists(chosenCard)) + { + BattleCardBase item = BattleManagerBase.GetIns().CreateTransformCardRegisterVfx(option.PlayedCard, chosenCard, option.PlayedCard.IsPlayer, null, isRecoveryFinish: false, isChoice: true); + list.Add(item); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetCrystallizedCardfilter.cs b/SVSim.BattleEngine/Engine/SkillTargetCrystallizedCardfilter.cs new file mode 100644 index 0000000..56d5150 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetCrystallizedCardfilter.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetCrystallizedCardfilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.CrystallizedCard == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + if (battlePlayerInfo.IsPlayer == option.CrystallizedCard.IsPlayer) + { + list.Add(option.CrystallizedCard); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDamagedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDamagedCardFilter.cs new file mode 100644 index 0000000..0fcd3e1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDamagedCardFilter.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDamagedCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return from p in battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoClassAndInPlayCards) + where p.MaxLife > p.Life + select p; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDeckBanishedCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDeckBanishedCardListFilter.cs new file mode 100644 index 0000000..c4eea25 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDeckBanishedCardListFilter.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDeckBanishedCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoBanishCards.Where((IReadOnlyBattleCardInfo pp) => !(pp is NullBattleCard) && pp.BanishedInfo.Place == BattleCardBase.BanishInfo.BanishPlace.Deck))); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDeckDrawCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDeckDrawCardFilter.cs new file mode 100644 index 0000000..fee2202 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDeckDrawCardFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDeckDrawCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.DeckDrewCards == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.DeckDrewCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDeckFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDeckFilter.cs new file mode 100644 index 0000000..0208783 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDeckFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDeckFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoDeckCards); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDeckSelfFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDeckSelfFilter.cs new file mode 100644 index 0000000..91aa9e0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDeckSelfFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDeckSelfFilter : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetDeckSelfFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return from c in battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoDeckCards) + where c == _ownerCard + select c; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDestroyedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDestroyedCardFilter.cs new file mode 100644 index 0000000..5d112d3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDestroyedCardFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetDestroyedCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + if (option.DestroyedCard == null) + { + yield break; + } + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + if (battlePlayerInfo.IsPlayer == option.DestroyedCard.IsPlayer) + { + yield return option.DestroyedCard; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDestroyedCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDestroyedCardListFilter.cs new file mode 100644 index 0000000..295d141 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDestroyedCardListFilter.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDestroyedCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoNecromanceZoneCards.Where((IReadOnlyBattleCardInfo pp) => pp.IsDead && !(pp is NullBattleCard)))); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoCemeterys.Where((IReadOnlyBattleCardInfo pp) => pp.IsDead && !(pp is NullBattleCard)))); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDestroyedLastTargetFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDestroyedLastTargetFilter.cs new file mode 100644 index 0000000..a66ed7d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDestroyedLastTargetFilter.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDestroyedLastTargetFilter : SkillTargetLastTargetFilter +{ + public SkillTargetDestroyedLastTargetFilter(string option) + : base(option) + { + } + + public override IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoNecromanceZoneCards.Where((IReadOnlyBattleCardInfo pp) => pp.IsDead && !(pp is NullBattleCard)))); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoCemeterys.Where((IReadOnlyBattleCardInfo pp) => pp.IsDead && !(pp is NullBattleCard)))); + return list.Intersect(base.Filtering(battlePlayerInfos, option)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDestroyedThisTurnCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDestroyedThisTurnCardListFilter.cs new file mode 100644 index 0000000..228b341 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDestroyedThisTurnCardListFilter.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDestroyedThisTurnCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + int turn = ins.CurrentTurn; + bool isSelfTurn = ins.BattlePlayer.IsSelfTurn; + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoNecromanceZoneCards.Where((IReadOnlyBattleCardInfo pp) => pp.IsDead && !(pp is NullBattleCard) && pp.DestroyedTurn == turn && pp.IsDestroySelfTurn == isSelfTurn))); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoCemeterys.Where((IReadOnlyBattleCardInfo pp) => pp.IsDead && !(pp is NullBattleCard) && pp.DestroyedTurn == turn && pp.IsDestroySelfTurn == isSelfTurn))); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDestroyedWhenDestroyCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDestroyedWhenDestroyCardListFilter.cs new file mode 100644 index 0000000..5471d76 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDestroyedWhenDestroyCardListFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDestroyedWhenDestroyCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoDestroyedWhenDestroyCards); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDiscardCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDiscardCardListFilter.cs new file mode 100644 index 0000000..810e019 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDiscardCardListFilter.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDiscardCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoDiscardedCards)); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDiscardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDiscardFilter.cs new file mode 100644 index 0000000..43cf5a5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDiscardFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDiscardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.Discards == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.Discards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDiscardThisTurnCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDiscardThisTurnCardListFilter.cs new file mode 100644 index 0000000..5edb278 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDiscardThisTurnCardListFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDiscardThisTurnCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + int turn = ins.CurrentTurn; + bool isSelfTurn = ins.BattlePlayer.IsSelfTurn; + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoDiscardedCards.Where((IReadOnlyBattleCardInfo pp) => !(pp is NullBattleCard) && pp.DestroyedTurn == turn && pp.IsDestroySelfTurn == isSelfTurn))); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDiscardedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDiscardedCardFilter.cs new file mode 100644 index 0000000..462ef9a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDiscardedCardFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDiscardedCardFilter : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetDiscardedCardFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoDiscards.Where((IReadOnlyBattleCardInfo pp) => pp.DiscardedSkill.SkillPrm.ownerCard == _ownerCard))); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDrewOverHandLimitFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDrewOverHandLimitFilter.cs new file mode 100644 index 0000000..0245d7b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDrewOverHandLimitFilter.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetDrewOverHandLimitFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.DrewOverHandLimitCards == null) + { + return list; + } + int i; + for (i = 0; i < battlePlayerInfos.Count(); i++) + { + list.AddRange(option.DrewOverHandLimitCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == battlePlayerInfos.ElementAt(i).IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetDrewSkillFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetDrewSkillFilter.cs new file mode 100644 index 0000000..eec9793 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetDrewSkillFilter.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetDrewSkillFilter : ISkillCardFilter +{ + private BattleCardBase _ownerCard; + + private bool _isSelf; + + public SkillTargetDrewSkillFilter(IReadOnlyBattleCardInfo ownerCard, string option) + { + _ownerCard = ownerCard as BattleCardBase; + _isSelf = option == "self"; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (_isSelf && _ownerCard.SelfBattlePlayer.DrewSkillCard == card) + { + list.Add(card); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetEnhanceCardfilter.cs b/SVSim.BattleEngine/Engine/SkillTargetEnhanceCardfilter.cs new file mode 100644 index 0000000..a803893 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetEnhanceCardfilter.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetEnhanceCardfilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.EnhanceCard == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + if (option.EnhanceCard.IsPlayer == battlePlayerInfo.IsPlayer) + { + list.Add(option.EnhanceCard); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetEqualOrLessCostFromLastTarget.cs b/SVSim.BattleEngine/Engine/SkillTargetEqualOrLessCostFromLastTarget.cs new file mode 100644 index 0000000..5695953 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetEqualOrLessCostFromLastTarget.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetEqualOrLessCostFromLastTarget : ISkillCustomSelectFilter +{ + private string _strLastTargetIndex = "0"; + + public List KeyCards { get; private set; } + + public SkillTargetEqualOrLessCostFromLastTarget(string customValue) + { + _strLastTargetIndex = customValue; + } + + public IEnumerable Filtering(IEnumerable cards, IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + KeyCards = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + List list = new List(); + List selectKeyCards = new SkillTargetLastTargetFilter(_strLastTargetIndex).Filtering(battlePlayerInfos, option).ToList(); + List list2 = cards.OrderBy((IReadOnlyBattleCardInfo x) => x.Index).ToList(); + int i; + for (i = 0; i < selectKeyCards.Count; i++) + { + IEnumerable source = list2.Where((IReadOnlyBattleCardInfo c) => c.Cost <= selectKeyCards[i].Cost); + if (source.Count() > 0) + { + KeyCards.Add(selectKeyCards[i]); + int index = (BattleManagerBase.IsRandomDraw ? ins.StableRandom(source.Count()) : 0); + IReadOnlyBattleCardInfo item = source.ElementAtOrDefault(index); + list.Add(item); + list2.Remove(item); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetEvolutionCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetEvolutionCardFilter.cs new file mode 100644 index 0000000..aa2a420 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetEvolutionCardFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetEvolutionCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.EvolutionCards == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.EvolutionCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetEvolvedCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetEvolvedCardListFilter.cs new file mode 100644 index 0000000..409e831 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetEvolvedCardListFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetEvolvedCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoEvolvedCards); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetFightTargetFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetFightTargetFilter.cs new file mode 100644 index 0000000..12a0987 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetFightTargetFilter.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetFightTargetFilter : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetFightTargetFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.AttackTargetCard == null && option.AttackerCard == null) + { + return list; + } + list.Add((_ownerCard == option.AttackerCard) ? option.AttackTargetCard : option.AttackerCard); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetFusionIngredientCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetFusionIngredientCardsFilter.cs new file mode 100644 index 0000000..59cc682 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetFusionIngredientCardsFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetFusionIngredientCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.FusionIngredientCards == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.FusionIngredientCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetFusionIngredientedCardListIncludeThisFusion.cs b/SVSim.BattleEngine/Engine/SkillTargetFusionIngredientedCardListIncludeThisFusion.cs new file mode 100644 index 0000000..c9237e6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetFusionIngredientedCardListIncludeThisFusion.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetFusionIngredientedCardListIncludeThisFusion : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetFusionIngredientedCardListIncludeThisFusion(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.FusionIngredientCards == null) + { + return list; + } + list.AddRange(_ownerCard.FusionIngredients); + int i; + for (i = 0; i < battlePlayerInfos.Count(); i++) + { + list.AddRange(option.FusionIngredientCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == battlePlayerInfos.ElementAt(i).IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetFusionIngredientedThisTurnCardList.cs b/SVSim.BattleEngine/Engine/SkillTargetFusionIngredientedThisTurnCardList.cs new file mode 100644 index 0000000..e69dea1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetFusionIngredientedThisTurnCardList.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetFusionIngredientedThisTurnCardList : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + int turn = ins.CurrentTurn; + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoFusionIngredientList.Where((IReadOnlyBattleCardInfo pp) => pp.FusionedTurn == turn))); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetFusionThisTurnCardList.cs b/SVSim.BattleEngine/Engine/SkillTargetFusionThisTurnCardList.cs new file mode 100644 index 0000000..895f16d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetFusionThisTurnCardList.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetFusionThisTurnCardList : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoTurnFusionCards); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameAcceleratedCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGameAcceleratedCardsFilter.cs new file mode 100644 index 0000000..c81d382 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameAcceleratedCardsFilter.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetGameAcceleratedCardsFilter : ISkillTargetFilter +{ + public virtual IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + foreach (IReadOnlyBattleCardInfo skillInfoGamePlayCard in battlePlayerInfo.SkillInfoGamePlayCards) + { + if (skillInfoGamePlayCard.TransformInfo.Type == BattleCardBase.TransformType.Accelerate) + { + list.Add(skillInfoGamePlayCard.TransformInfo.OriginalCard); + } + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameAcceleratedCardsOtherSelfFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGameAcceleratedCardsOtherSelfFilter.cs new file mode 100644 index 0000000..8a787d1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameAcceleratedCardsOtherSelfFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetGameAcceleratedCardsOtherSelfFilter : SkillTargetGameAcceleratedCardsFilter +{ + private IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetGameAcceleratedCardsOtherSelfFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public override IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return from c in base.Filtering(battlePlayerInfos, option) + where c != _ownerCard.TransformInfo.OriginalCard + select c; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameAddUpdateDeckCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGameAddUpdateDeckCardsFilter.cs new file mode 100644 index 0000000..59b19c8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameAddUpdateDeckCardsFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetGameAddUpdateDeckCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + for (int i = 0; i < battlePlayerInfos.Count(); i++) + { + list.AddRange(battlePlayerInfos.ElementAt(i).SkillInfoGameAddUpdateDeckCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameCrystallizedCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGameCrystallizedCardsFilter.cs new file mode 100644 index 0000000..fe9c41f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameCrystallizedCardsFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetGameCrystallizedCardsFilter : ISkillTargetFilter +{ + public virtual IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + for (int i = 0; i < battlePlayerInfos.Count(); i++) + { + list.AddRange(battlePlayerInfos.ElementAt(i).SkillInfoGameCrystallizedPlayCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameDeckDrawCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGameDeckDrawCardsFilter.cs new file mode 100644 index 0000000..b8828a0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameDeckDrawCardsFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetGameDeckDrawCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoGameDrawCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameDrawCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGameDrawCardsFilter.cs new file mode 100644 index 0000000..fdb80f3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameDrawCardsFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetGameDrawCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoGameDrawCards); + list.AddRange(battlePlayerInfo.SkillInfoGameDrawTokenCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameFusionIngredientedAndDiscardCards.cs b/SVSim.BattleEngine/Engine/SkillTargetGameFusionIngredientedAndDiscardCards.cs new file mode 100644 index 0000000..6ca9765 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameFusionIngredientedAndDiscardCards.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetGameFusionIngredientedAndDiscardCards : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoFusionIngredientAndDiscardedCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameFusionIngredientedCards.cs b/SVSim.BattleEngine/Engine/SkillTargetGameFusionIngredientedCards.cs new file mode 100644 index 0000000..d50d1f7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameFusionIngredientedCards.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetGameFusionIngredientedCards : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoFusionIngredientList); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameLeftCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGameLeftCardsFilter.cs new file mode 100644 index 0000000..432fa18 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameLeftCardsFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetGameLeftCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoGameLeftCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGamePlayCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGamePlayCardsFilter.cs new file mode 100644 index 0000000..5199843 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGamePlayCardsFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetGamePlayCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoGamePlayCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGamePlayCardsOtherSelfFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGamePlayCardsOtherSelfFilter.cs new file mode 100644 index 0000000..2f1a3d5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGamePlayCardsOtherSelfFilter.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetGamePlayCardsOtherSelfFilter : ISkillTargetFilter +{ + private IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetGamePlayCardsOtherSelfFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoGamePlayCards); + } + if (!_ownerCard.IsInHand || _ownerCard.IsSpell) + { + list.Remove(_ownerCard); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameQuickAttackCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGameQuickAttackCardsFilter.cs new file mode 100644 index 0000000..bc82956 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameQuickAttackCardsFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetGameQuickAttackCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoGameQuickAttackCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameSkillActivatedFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGameSkillActivatedFilter.cs new file mode 100644 index 0000000..836db49 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameSkillActivatedFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetGameSkillActivatedFilter : ISkillTargetFilter +{ + public virtual IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + for (int i = 0; i < battlePlayerInfos.Count(); i++) + { + list.AddRange(battlePlayerInfos.ElementAt(i).SkillInfoGameSkillActivated); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameSummonCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGameSummonCardsFilter.cs new file mode 100644 index 0000000..a16975b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameSummonCardsFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetGameSummonCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoGameSummonCards.Select((BattlePlayerBase.TurnAndCard c) => c.Card)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGameSummonCardsOtherFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGameSummonCardsOtherFilter.cs new file mode 100644 index 0000000..01204ef --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGameSummonCardsOtherFilter.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetGameSummonCardsOtherFilter : ISkillTargetFilter +{ + private IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetGameSummonCardsOtherFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoGameSummonCards.Select((BattlePlayerBase.TurnAndCard c) => c.Card)); + } + if (option.PlayedCard == _ownerCard) + { + list.Remove(_ownerCard); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetGiveDamageCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetGiveDamageCardFilter.cs new file mode 100644 index 0000000..eb60698 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetGiveDamageCardFilter.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetGiveDamageCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + if (option.FixedDamage.Skill == null) + { + return new IReadOnlyBattleCardInfo[0]; + } + BattleCardBase ownerCard = option.FixedDamage.Skill.SkillPrm.ownerCard; + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + if (ownerCard.IsPlayer == battlePlayerInfo.IsPlayer) + { + return new IReadOnlyBattleCardInfo[1] { ownerCard }; + } + } + return new IReadOnlyBattleCardInfo[0]; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetHandBanishedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetHandBanishedCardFilter.cs new file mode 100644 index 0000000..ac7662f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetHandBanishedCardFilter.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetHandBanishedCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.BanishedCard == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + if (battlePlayerInfo.IsPlayer == option.BanishedCard.IsPlayer && option.BanishedCard.BanishedInfo.Place == BattleCardBase.BanishInfo.BanishPlace.Hand) + { + list.Add(option.BanishedCard); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetHandBanishedCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetHandBanishedCardListFilter.cs new file mode 100644 index 0000000..34ed769 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetHandBanishedCardListFilter.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetHandBanishedCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoBanishCards.Where((IReadOnlyBattleCardInfo pp) => !(pp is NullBattleCard) && pp.BanishedInfo.Place == BattleCardBase.BanishInfo.BanishPlace.Hand))); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetHandBanishedThisTurnCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetHandBanishedThisTurnCardListFilter.cs new file mode 100644 index 0000000..c4608bc --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetHandBanishedThisTurnCardListFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetHandBanishedThisTurnCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + int turn = ins.CurrentTurn; + bool isSelfTurn = ins.BattlePlayer.IsSelfTurn; + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoBanishCards.Where((IReadOnlyBattleCardInfo pp) => !(pp is NullBattleCard) && pp.BanishedInfo.Turn == turn && pp.BanishedInfo.IsSelfTurn == isSelfTurn && pp.BanishedInfo.Place == BattleCardBase.BanishInfo.BanishPlace.Hand))); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetHandFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetHandFilter.cs new file mode 100644 index 0000000..aa2a568 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetHandFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetHandFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoHandCards); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetHandOtherOldestFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetHandOtherOldestFilter.cs new file mode 100644 index 0000000..870f560 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetHandOtherOldestFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetHandOtherOldestFilter : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetHandOtherOldestFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return (from c in battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoHandCards) + where c != _ownerCard + select c).Take(1); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetHandOtherSelfFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetHandOtherSelfFilter.cs new file mode 100644 index 0000000..d508245 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetHandOtherSelfFilter.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetHandOtherSelfFilter : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetHandOtherSelfFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + BattleCardBase originalCard = ((_ownerCard.TransformInfo.Type != BattleCardBase.TransformType.Metamorphose) ? _ownerCard.TransformInfo.OriginalCard : null); + return from c in battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoHandCards) + where c != _ownerCard && c != originalCard + select c; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetHandSelfFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetHandSelfFilter.cs new file mode 100644 index 0000000..c14fa6e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetHandSelfFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetHandSelfFilter : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetHandSelfFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return from c in battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoHandCards) + where c == _ownerCard + select c; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetHealingCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetHealingCardFilter.cs new file mode 100644 index 0000000..a33e911 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetHealingCardFilter.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetHealingCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + IEnumerable result = new IReadOnlyBattleCardInfo[0]; + if (option.HealingCardAndValue == null) + { + return result; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + result = from h in option.HealingCardAndValue + select h.Card into c + where c.IsPlayer == info.IsPlayer + select c; + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInHandCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInHandCardFilter.cs new file mode 100644 index 0000000..d8e0a28 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInHandCardFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetInHandCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.InHandCard == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.InHandCard.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInPlayFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInPlayFilter.cs new file mode 100644 index 0000000..7b562e9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInPlayFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetInPlayFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoClassAndInPlayCards); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInPlayOtherSelfFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInPlayOtherSelfFilter.cs new file mode 100644 index 0000000..f2dc942 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInPlayOtherSelfFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetInPlayOtherSelfFilter : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo m_ownerCard; + + public SkillTargetInPlayOtherSelfFilter(IReadOnlyBattleCardInfo ownerCard) + { + m_ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return from c in battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoClassAndInPlayCards) + where c != m_ownerCard + select c; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInPlaySelfFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInPlaySelfFilter.cs new file mode 100644 index 0000000..2447ddd --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInPlaySelfFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetInPlaySelfFilter : ISkillTargetFilter +{ + private IReadOnlyBattleCardInfo m_ownerCard; + + public SkillTargetInPlaySelfFilter(IReadOnlyBattleCardInfo ownerCard) + { + m_ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return from c in battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoClassAndInPlayCards) + where c == m_ownerCard + select c; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInplayAndHandFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInplayAndHandFilter.cs new file mode 100644 index 0000000..d16a574 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInplayAndHandFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetInplayAndHandFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + for (int i = 0; i < battlePlayerInfos.Count(); i++) + { + IBattlePlayerReadOnlyInfo battlePlayerReadOnlyInfo = battlePlayerInfos.ElementAt(i); + list.AddRange(battlePlayerReadOnlyInfo.SkillInfoClassAndInPlayCards); + list.AddRange(battlePlayerReadOnlyInfo.SkillInfoHandCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInplayBanishedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInplayBanishedCardFilter.cs new file mode 100644 index 0000000..475472f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInplayBanishedCardFilter.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetInplayBanishedCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.BanishedCard == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + if (battlePlayerInfo.IsPlayer == option.BanishedCard.IsPlayer && option.BanishedCard.BanishedInfo.Place == BattleCardBase.BanishInfo.BanishPlace.Field) + { + list.Add(option.BanishedCard); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInplayBanishedCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInplayBanishedCardListFilter.cs new file mode 100644 index 0000000..3396294 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInplayBanishedCardListFilter.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetInplayBanishedCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoBanishCards.Where((IReadOnlyBattleCardInfo pp) => !(pp is NullBattleCard) && pp.BanishedInfo.Place == BattleCardBase.BanishInfo.BanishPlace.Field))); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInplayBanishedThisTurnCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInplayBanishedThisTurnCardListFilter.cs new file mode 100644 index 0000000..a5a5d9c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInplayBanishedThisTurnCardListFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetInplayBanishedThisTurnCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + int turn = ins.CurrentTurn; + bool isSelfTurn = ins.BattlePlayer.IsSelfTurn; + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoBanishCards.Where((IReadOnlyBattleCardInfo pp) => !(pp is NullBattleCard) && pp.BanishedInfo.Turn == turn && pp.BanishedInfo.IsSelfTurn == isSelfTurn && pp.BanishedInfo.Place == BattleCardBase.BanishInfo.BanishPlace.Field))); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInplayBuffingCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInplayBuffingCardsFilter.cs new file mode 100644 index 0000000..bcda753 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInplayBuffingCardsFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetInplayBuffingCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.InplayBuffingCards == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.InplayBuffingCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInplayDebuffingCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInplayDebuffingCardsFilter.cs new file mode 100644 index 0000000..8f028c7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInplayDebuffingCardsFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetInplayDebuffingCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.InplayDebuffingCards == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.InplayDebuffingCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInplayLastTargetFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInplayLastTargetFilter.cs new file mode 100644 index 0000000..0763a90 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInplayLastTargetFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetInplayLastTargetFilter : SkillTargetLastTargetFilter +{ + private readonly int _option; + + public SkillTargetInplayLastTargetFilter(string option) + : base(option) + { + } + + public override IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoClassAndInPlayCards).Intersect(base.Filtering(battlePlayerInfos, option)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInplayMetamorphosedCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInplayMetamorphosedCardsFilter.cs new file mode 100644 index 0000000..c2e5feb --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInplayMetamorphosedCardsFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetInplayMetamorphosedCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoInplayMetamorphosedCards); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetInplaySelfAndClassFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetInplaySelfAndClassFilter.cs new file mode 100644 index 0000000..94ccd31 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetInplaySelfAndClassFilter.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetInplaySelfAndClassFilter : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetInplaySelfAndClassFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.Add(battlePlayerInfo.SkillInfoClass); + } + list.Add(_ownerCard); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetLastTargetFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetLastTargetFilter.cs new file mode 100644 index 0000000..9cf78ef --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetLastTargetFilter.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetLastTargetFilter : ISkillTargetFilter +{ + private readonly int _lastTargetIndex; + + public int LastTargetIndex => _lastTargetIndex; + + public SkillTargetLastTargetFilter(string option) + { + int.TryParse(option, out _lastTargetIndex); + } + + public virtual IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + List list2 = new List(); + list2.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoClassAndInPlayCards)); + list2.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoHandCards)); + list2.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoDeckCards)); + list2.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoCemeterys)); + list2.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoBanishCards)); + List> list3 = new List>(); + if (battlePlayerInfos.Count() > 1) + { + List> list4 = battlePlayerInfos.ToList()[0].SkillInfoLastTargets.ToList().ConvertAll((IEnumerable c) => c.ToList()); + List> list5 = battlePlayerInfos.ToList()[1].SkillInfoLastTargets.ToList().ConvertAll((IEnumerable c) => c.ToList()); + for (int num = 0; num < list4.Count(); num++) + { + list4[num].AddRange(list5[num]); + } + list3 = list4; + } + else + { + list3 = battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoLastTargets.ToList().ConvertAll((IEnumerable c) => c.ToList())).ToList(); + } + foreach (IReadOnlyBattleCardInfo card in (list3.Count > _lastTargetIndex) ? list3[_lastTargetIndex] : new List()) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = list2.FirstOrDefault((IReadOnlyBattleCardInfo c) => c.EquelsID(card)); + if (readOnlyBattleCardInfo != null) + { + list.Add(readOnlyBattleCardInfo); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetLeftCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetLeftCardsFilter.cs new file mode 100644 index 0000000..37aaf57 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetLeftCardsFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetLeftCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.LeftCards == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.LeftCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetLeftThisTurnCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetLeftThisTurnCardListFilter.cs new file mode 100644 index 0000000..f56e54d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetLeftThisTurnCardListFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetLeftThisTurnCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + int turn = ins.CurrentTurn; + bool isSelfTurn = ins.BattlePlayer.IsSelfTurn; + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => from t in p.SkillInfoGameTurnLeftCards + where t.Turn == turn && t.IsSelfTurn == isSelfTurn + select t.Card)); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetLoadBurialRiteTargetFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetLoadBurialRiteTargetFilter.cs new file mode 100644 index 0000000..9e769a1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetLoadBurialRiteTargetFilter.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetLoadBurialRiteTargetFilter : ISkillTargetFilter +{ + private IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetLoadBurialRiteTargetFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return _ownerCard.SkillApplyInformation.LoadBurialRiteTargetList(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetLoadTargetFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetLoadTargetFilter.cs new file mode 100644 index 0000000..83e04e2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetLoadTargetFilter.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetLoadTargetFilter : ISkillTargetFilter +{ + private IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetLoadTargetFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return _ownerCard.SkillApplyInformation.LoadTargetList(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetMainPlaceFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetMainPlaceFilter.cs new file mode 100644 index 0000000..54f795a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetMainPlaceFilter.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetMainPlaceFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoDeckCards)); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoHandCards)); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoClassAndInPlayCards)); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoCemeterys)); + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoBanishCards)); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetNecromanceFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetNecromanceFilter.cs new file mode 100644 index 0000000..1d64864 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetNecromanceFilter.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetNecromanceFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + if (option.NecromanceCard != null) + { + yield return option.NecromanceCard; + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetNewerInPlayOtherSelfFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetNewerInPlayOtherSelfFilter.cs new file mode 100644 index 0000000..afb1be4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetNewerInPlayOtherSelfFilter.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetNewerInPlayOtherSelfFilter : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetNewerInPlayOtherSelfFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoClassAndInPlayCards).ToList(); + return list.Skip(list.IndexOf(_ownerCard) + 1); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetNotDamagedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetNotDamagedCardFilter.cs new file mode 100644 index 0000000..46b3d4b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetNotDamagedCardFilter.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetNotDamagedCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return from p in battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoClassAndInPlayCards) + where p.MaxLife <= p.Life + select p; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetNotUniqueBaseCardIdFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetNotUniqueBaseCardIdFilter.cs new file mode 100644 index 0000000..f469b62 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetNotUniqueBaseCardIdFilter.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetNotUniqueBaseCardIdFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + foreach (IReadOnlyBattleCardInfo card in cards) + { + if (cards.Where((IReadOnlyBattleCardInfo c) => c.BaseParameter.BaseCardId == card.BaseParameter.BaseCardId).Count() >= 2) + { + list.Add(card); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetNullFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetNullFilter.cs new file mode 100644 index 0000000..47c8e6a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetNullFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetNullFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return Enumerable.Empty(); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetOtherThanBeAttackedFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetOtherThanBeAttackedFilter.cs new file mode 100644 index 0000000..d408cb3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetOtherThanBeAttackedFilter.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetOtherThanBeAttackedFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + foreach (IReadOnlyBattleCardInfo skillInfoInPlayCard in battlePlayerInfo.SkillInfoInPlayCards) + { + if (skillInfoInPlayCard != option.AttackTargetCard) + { + list.Add(skillInfoInPlayCard); + } + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetOverCostFromLastTargetFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetOverCostFromLastTargetFilter.cs new file mode 100644 index 0000000..6f40387 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetOverCostFromLastTargetFilter.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetOverCostFromLastTargetFilter : ISkillCustomSelectFilter +{ + public List KeyDestroyedCard { get; private set; } + + public IEnumerable Filtering(IEnumerable cards, IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + KeyDestroyedCard = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + List list = new List(); + List selectKeyCards = battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo s) => s.SkillInfoLastTargets.First()).ToList(); + List list2 = cards.OrderBy((IReadOnlyBattleCardInfo x) => x.Index).ToList(); + int i = 0; + int count = selectKeyCards.Count; + while (i < count) + { + IEnumerable source = list2.Where((IReadOnlyBattleCardInfo c) => c.Cost > selectKeyCards[i].Cost); + if (source.Count() > 0) + { + KeyDestroyedCard.Add(selectKeyCards[i]); + int index = (BattleManagerBase.IsRandomDraw ? ins.StableRandom(source.Count()) : 0); + IReadOnlyBattleCardInfo item = source.ElementAtOrDefault(index); + list.Add(item); + list2.Remove(item); + } + int num = i + 1; + i = num; + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetPastSummonCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetPastSummonCardsFilter.cs new file mode 100644 index 0000000..94fc12d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetPastSummonCardsFilter.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetPastSummonCardsFilter : ISkillTargetFilter +{ + private IReadOnlyBattleCardInfo _ownerCard; + + private bool _isTurnEndUpdate; + + public SkillTargetPastSummonCardsFilter(IReadOnlyBattleCardInfo ownerCard, string option) + { + _ownerCard = ownerCard; + _isTurnEndUpdate = option == "turn_end_update"; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + int turn = ins.CurrentTurn; + bool isTurnEnd = ins.IsTurnEnd; + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(from c in battlePlayerInfo.SkillInfoGameSummonCards + where (!_isTurnEndUpdate || !c.IsTurnEnd) && c.Turn >= _ownerCard.DrawTurn && c.IsSelfTurn == _ownerCard.IsPlayer && (!_isTurnEndUpdate || isTurnEnd || !_ownerCard.IsSelfTurn || c.Turn < turn) + select c.Card); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetPlayedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetPlayedCardFilter.cs new file mode 100644 index 0000000..e299579 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetPlayedCardFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetPlayedCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + if (option.PlayedCard == null) + { + yield break; + } + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + if (option.PlayedCard.IsPlayer == battlePlayerInfo.IsPlayer) + { + yield return option.PlayedCard; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetReanimatedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetReanimatedCardFilter.cs new file mode 100644 index 0000000..bf2d60e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetReanimatedCardFilter.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetReanimatedCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.ReanimatedCards != null) + { + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.ReanimatedCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetReanimatedThisTurnCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetReanimatedThisTurnCardListFilter.cs new file mode 100644 index 0000000..353852c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetReanimatedThisTurnCardListFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetReanimatedThisTurnCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + int turn = ins.CurrentTurn; + bool isSelfTurn = ins.BattlePlayer.IsSelfTurn; + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => from t in p.SkillInfoGameReanimatedCards + where t.Turn == turn && t.IsSelfTurn == isSelfTurn + select t.Card)); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetReceivedDamageCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetReceivedDamageCardFilter.cs new file mode 100644 index 0000000..3867115 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetReceivedDamageCardFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetReceivedDamageCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + IEnumerable result = new IReadOnlyBattleCardInfo[0]; + if (option.DamageCards == null) + { + return result; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + result = option.DamageCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer); + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetReturnCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetReturnCardFilter.cs new file mode 100644 index 0000000..03896f2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetReturnCardFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetReturnCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.ReturnCards == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.ReturnCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetReturnSkillFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetReturnSkillFilter.cs new file mode 100644 index 0000000..75f7b75 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetReturnSkillFilter.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetReturnSkillFilter : ISkillCardFilter +{ + private BattleCardBase _ownerCard; + + private bool _isSelf; + + public SkillTargetReturnSkillFilter(IReadOnlyBattleCardInfo ownerCard, string option) + { + _ownerCard = ownerCard as BattleCardBase; + _isSelf = option == "self"; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + SkillBase returnedSkill = _ownerCard.ReturnedSkill; + if (_isSelf && !returnedSkill.IsAttachedSkill && returnedSkill.SkillPrm.ownerCard == cards.ElementAt(i)) + { + list.Add(cards.ElementAt(i)); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetReturnThisTurnCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetReturnThisTurnCardListFilter.cs new file mode 100644 index 0000000..6fc3842 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetReturnThisTurnCardListFilter.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetReturnThisTurnCardListFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + int turn = ins.CurrentTurn; + bool isSelfTurn = ins.BattlePlayer.IsSelfTurn; + list.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => from pp in p.SkillInfoReturnedCards + where pp.Turn == turn && pp.IsSelfTurn == isSelfTurn + select pp.Card)); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetSelectedCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetSelectedCardsFilter.cs new file mode 100644 index 0000000..6728216 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetSelectedCardsFilter.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetSelectedCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.SelectedCards == null) + { + return list; + } + List list2 = new List(); + list2.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoClassAndInPlayCards)); + list2.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoHandCards)); + list2.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoDeckCards)); + list2.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoCemeterys)); + list2.AddRange(battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoBanishCards)); + foreach (SkillConditionCheckerOption.SkillAndSelectTarget card in option.SelectedCards) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = list2.FirstOrDefault((IReadOnlyBattleCardInfo c) => c.EquelsID(card.SelectCard)); + if (readOnlyBattleCardInfo != null) + { + list.Add(readOnlyBattleCardInfo); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetSelfFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetSelfFilter.cs new file mode 100644 index 0000000..b808f3d --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetSelfFilter.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetSelfFilter : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo _ownerCard; + + public SkillTargetSelfFilter(IReadOnlyBattleCardInfo ownerCard) + { + _ownerCard = ownerCard; + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + yield return _ownerCard; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetShortageDeckWinCards.cs b/SVSim.BattleEngine/Engine/SkillTargetShortageDeckWinCards.cs new file mode 100644 index 0000000..75509b5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetShortageDeckWinCards.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetShortageDeckWinCards : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.ShortageDeckWinCards == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.ShortageDeckWinCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetSkillDrawCardListFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetSkillDrawCardListFilter.cs new file mode 100644 index 0000000..136ade4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetSkillDrawCardListFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetSkillDrawCardListFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + list.AddRange(cards.ElementAt(i).SkillApplyInformation.SkillDrewCardList); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetSkillDrewCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetSkillDrewCardFilter.cs new file mode 100644 index 0000000..6ee2f90 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetSkillDrewCardFilter.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetSkillDrewCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + if (option.SkillDrewCards == null) + { + return new IReadOnlyBattleCardInfo[0]; + } + return option.SkillDrewCards; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetSkillSummonedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetSkillSummonedCardFilter.cs new file mode 100644 index 0000000..698761f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetSkillSummonedCardFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetSkillSummonedCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoSkillSummonedCards); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetSkillSummonedCardIdFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetSkillSummonedCardIdFilter.cs new file mode 100644 index 0000000..a774c54 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetSkillSummonedCardIdFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetSkillSummonedCardIdFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + List list = new List(); + foreach (IReadOnlyBattleCardInfo card in cards) + { + list.AddRange(card.SkillApplyInformation.RandomSelectedCardList); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetSkillUpdateDeckCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetSkillUpdateDeckCardFilter.cs new file mode 100644 index 0000000..5ea609e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetSkillUpdateDeckCardFilter.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetSkillUpdateDeckCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + if (option.SkillUpdatedDeckCards == null) + { + return new IReadOnlyBattleCardInfo[0]; + } + return option.SkillUpdatedDeckCards; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetSummonedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetSummonedCardFilter.cs new file mode 100644 index 0000000..3c301aa --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetSummonedCardFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetSummonedCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + BattleCardBase summonedCard = option.SummonedCard; + if (option.SummonedCard != null && battlePlayerInfos.Any((IBattlePlayerReadOnlyInfo c) => c.IsPlayer == summonedCard.IsPlayer)) + { + yield return option.SummonedCard; + } + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetThroughFusionIngredientedCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetThroughFusionIngredientedCardFilter.cs new file mode 100644 index 0000000..3e8b85b --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetThroughFusionIngredientedCardFilter.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetThroughFusionIngredientedCardFilter : ISkillTargetFilter +{ + private readonly IReadOnlyBattleCardInfo _ownerCard; + + private int _index; + + public SkillTargetThroughFusionIngredientedCardFilter(IReadOnlyBattleCardInfo ownerCard, string index) + { + _ownerCard = ownerCard; + _index = int.Parse(index); + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.FusionIngredientCards == null) + { + return list; + } + List list2 = new List(); + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list2.AddRange(option.FusionIngredientCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + if (_ownerCard.FusionIngredients.Count >= _index && _ownerCard.FusionIngredients.Count - list2.Count < _index) + { + list.Add(_ownerCard.FusionIngredients[_index - 1]); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetTokenDrawCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetTokenDrawCardFilter.cs new file mode 100644 index 0000000..3bb2ea0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetTokenDrawCardFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetTokenDrawCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + if (option.TokenDrewCards == null) + { + return list; + } + foreach (IBattlePlayerReadOnlyInfo info in battlePlayerInfos) + { + list.AddRange(option.TokenDrewCards.Where((IReadOnlyBattleCardInfo c) => c.IsPlayer == info.IsPlayer)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetTurnDrawCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetTurnDrawCardsFilter.cs new file mode 100644 index 0000000..0d0679a --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetTurnDrawCardsFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetTurnDrawCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoTurnDrawCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetTurnPlayCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetTurnPlayCardsFilter.cs new file mode 100644 index 0000000..2e9837c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetTurnPlayCardsFilter.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTargetTurnPlayCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(battlePlayerInfo.SkillInfoTurnPlayCards); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetTurnPlayCardsOtherSelfFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetTurnPlayCardsOtherSelfFilter.cs new file mode 100644 index 0000000..fff1cdf --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetTurnPlayCardsOtherSelfFilter.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetTurnPlayCardsOtherSelfFilter : ISkillTargetFilter +{ + private IReadOnlyBattleCardInfo _ownerCard; + + private readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillTargetTurnPlayCardsOtherSelfFilter(IReadOnlyBattleCardInfo ownerCard, string option) + { + _ownerCard = ownerCard; + _turnPlayerInfo = ((option == "") ? null : new TurnPlayerInfo(option)); + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + if (_turnPlayerInfo == null) + { + list.AddRange(battlePlayerInfo.SkillInfoTurnPlayCards); + continue; + } + int turn = battlePlayerInfo.Turn; + turn -= _turnPlayerInfo.TurnOffset; + list.AddRange(from c in battlePlayerInfo.SkillInfoGameTurnPlayCards + where c.Turn == turn + select c.Card); + } + if ((!_ownerCard.IsInHand || _ownerCard.IsSpell) && (_turnPlayerInfo == null || _turnPlayerInfo.TurnOffset == 0)) + { + list.Remove(_ownerCard); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetTurnSummonCardsFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetTurnSummonCardsFilter.cs new file mode 100644 index 0000000..27ccd21 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetTurnSummonCardsFilter.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetTurnSummonCardsFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + int turn = ins.CurrentTurn; + bool isSelfTurn = ins.BattlePlayer.IsSelfTurn; + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(from c in battlePlayerInfo.SkillInfoGameSummonCards + where c.Turn == turn && c.IsSelfTurn == isSelfTurn + select c.Card); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetTurnTokenDrawSkillIdFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetTurnTokenDrawSkillIdFilter.cs new file mode 100644 index 0000000..11538ed --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetTurnTokenDrawSkillIdFilter.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetTurnTokenDrawSkillIdFilter : ISkillTargetFilter +{ + private int _id; + + public SkillTargetTurnTokenDrawSkillIdFilter(string id) + { + _id = int.Parse(id); + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo battlePlayerInfo in battlePlayerInfos) + { + list.AddRange(from c in battlePlayerInfo.SkillInfoTurnDrawTokenCardsWithId + where c.Id == _id + select c.Card); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTargetUniqueBaseCardIDCardFilter.cs b/SVSim.BattleEngine/Engine/SkillTargetUniqueBaseCardIDCardFilter.cs new file mode 100644 index 0000000..1f2e526 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTargetUniqueBaseCardIDCardFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTargetUniqueBaseCardIDCardFilter : ISkillTargetFilter +{ + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return battlePlayerInfos.SelectMany((IBattlePlayerReadOnlyInfo p) => p.SkillInfoClassAndInPlayCards.Distinct(new BaseCardIDComp())); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTextVariableComareFilter.cs b/SVSim.BattleEngine/Engine/SkillTextVariableComareFilter.cs new file mode 100644 index 0000000..b05cbe9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTextVariableComareFilter.cs @@ -0,0 +1,26 @@ +public class SkillTextVariableComareFilter : SkillVariableComareFilter +{ + public int LhsFilteringResult { get; set; } + + public int RhsFilteringResult { get; set; } + + public SkillTextVariableComareFilter(string text) + : base(text) + { + } + + public int FilteringLhs(SkillOptionValue optionValue) + { + return LhsFilteringResult = optionValue.ParseInt(base.Lhs); + } + + public int FilteringRhs(SkillOptionValue optionValue) + { + return RhsFilteringResult = optionValue.ParseInt(base.Rhs); + } + + public override bool Filtering(SkillOptionValue optionValue) + { + return _compareFunc(LhsFilteringResult, RhsFilteringResult); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTribeFilter.cs b/SVSim.BattleEngine/Engine/SkillTribeFilter.cs new file mode 100644 index 0000000..e411f1c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTribeFilter.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillTribeFilter : ISkillCardFilter +{ + public readonly CardBasePrm.TribeType _type; + + public readonly string OptionText; + + public readonly bool IsEqual; + + public SkillTribeFilter(CardBasePrm.TribeType tribe, string op) + { + _type = tribe; + OptionText = op; + IsEqual = op == "="; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsTribe(_type) == IsEqual); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillTurnDestroyedFilter.cs b/SVSim.BattleEngine/Engine/SkillTurnDestroyedFilter.cs new file mode 100644 index 0000000..333b6dd --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillTurnDestroyedFilter.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using Wizard.Battle; + +public class SkillTurnDestroyedFilter : ISkillTargetFilter +{ + private readonly TurnPlayerInfo _turnPlayerInfo; + + public SkillTurnDestroyedFilter(string option) + { + _turnPlayerInfo = new TurnPlayerInfo(option); + } + + public IEnumerable Filtering(IEnumerable battlePlayerInfos, SkillConditionCheckerOption option) + { + return GetTurnCard(battlePlayerInfos); + } + + private IEnumerable GetTurnCard(IEnumerable playerInfo) + { + List list = new List(); + foreach (IBattlePlayerReadOnlyInfo item in playerInfo) + { + foreach (IReadOnlyBattleCardInfo specificTurnDestroyCard in item.GetSpecificTurnDestroyCards(_turnPlayerInfo)) + { + list.Add(specificTurnDestroyCard); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillUniqueBaseCardIDCardFilter.cs b/SVSim.BattleEngine/Engine/SkillUniqueBaseCardIDCardFilter.cs new file mode 100644 index 0000000..81246d0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillUniqueBaseCardIDCardFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillUniqueBaseCardIDCardFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Distinct(new BaseCardIDComp()); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillUniqueBaseCostCountFilter.cs b/SVSim.BattleEngine/Engine/SkillUniqueBaseCostCountFilter.cs new file mode 100644 index 0000000..6b0e8fd --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillUniqueBaseCostCountFilter.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillUniqueBaseCostCountFilter : SkillCardCountFilter +{ + public override int Filtering(IEnumerable cards) + { + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + IReadOnlyBattleCardInfo readOnlyBattleCardInfo = cards.ElementAt(i); + if (!list.Contains(readOnlyBattleCardInfo.BaseCost)) + { + list.Add(readOnlyBattleCardInfo.BaseCost); + } + } + return list.Count; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillUniqueTribeCountFilter.cs b/SVSim.BattleEngine/Engine/SkillUniqueTribeCountFilter.cs new file mode 100644 index 0000000..59a36ee --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillUniqueTribeCountFilter.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillUniqueTribeCountFilter : SkillCardCountFilter +{ + public override int Filtering(IEnumerable cards) + { + List list = new List(); + for (int i = 0; i < cards.Count(); i++) + { + List tribe = cards.ElementAt(i).Tribe; + for (int j = 0; j < tribe.Count(); j++) + { + CardBasePrm.TribeType tribeType = tribe[j]; + if (tribeType != CardBasePrm.TribeType.ALL && !list.Contains(tribeType)) + { + list.Add(tribeType); + } + } + } + return list.Count; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillUnitAndAllFieldFilter.cs b/SVSim.BattleEngine/Engine/SkillUnitAndAllFieldFilter.cs new file mode 100644 index 0000000..3614e22 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillUnitAndAllFieldFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillUnitAndAllFieldFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsUnit || c.IsField); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillUnitAndChantFieldFilter.cs b/SVSim.BattleEngine/Engine/SkillUnitAndChantFieldFilter.cs new file mode 100644 index 0000000..f6ea5f3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillUnitAndChantFieldFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillUnitAndChantFieldFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsUnit || c.IsChantField); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillUnitAndClassFilter.cs b/SVSim.BattleEngine/Engine/SkillUnitAndClassFilter.cs new file mode 100644 index 0000000..234d96c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillUnitAndClassFilter.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillUnitAndClassFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsUnit || c.IsClass); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillUnitAndNotChantField.cs b/SVSim.BattleEngine/Engine/SkillUnitAndNotChantField.cs new file mode 100644 index 0000000..fa53cab --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillUnitAndNotChantField.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillUnitAndNotChantField : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => c.IsUnit || (c.IsField && !c.IsChantField)); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillUnitFilter.cs b/SVSim.BattleEngine/Engine/SkillUnitFilter.cs new file mode 100644 index 0000000..3d89b2e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillUnitFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillUnitFilter : ISkillCardFilter +{ + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where(IsUnit); + } + + public static bool IsUnit(IReadOnlyBattleCardInfo card) + { + return card.IsUnit; + } +} diff --git a/SVSim.BattleEngine/Engine/SkillUpdateDeckMomentTribeFilter.cs b/SVSim.BattleEngine/Engine/SkillUpdateDeckMomentTribeFilter.cs new file mode 100644 index 0000000..0380ec9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillUpdateDeckMomentTribeFilter.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SkillUpdateDeckMomentTribeFilter : ISkillCardFilter +{ + private readonly CardBasePrm.TribeType _type; + + private readonly bool _isEqual; + + public SkillUpdateDeckMomentTribeFilter(CardBasePrm.TribeType tribe, string op) + { + _type = tribe; + _isEqual = op == "="; + } + + private bool JudgeUpdateDeckMomentTribe(IReadOnlyBattleCardInfo readOnlyBattleCard, CardBasePrm.TribeType tribe) + { + BattleCardBase card = readOnlyBattleCard as BattleCardBase; + List> list = (from c in card.SelfBattlePlayer.GameUpdateDeckMomentTribe + where c.Card == card + select c.Tribes).ToList(); + for (int num = 0; num < list.Count; num++) + { + if (list[num].Contains(tribe)) + { + return true; + } + } + return false; + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => JudgeUpdateDeckMomentTribe(c, _type) == _isEqual); + } +} diff --git a/SVSim.BattleEngine/Engine/SkillUserSelectFilter.cs b/SVSim.BattleEngine/Engine/SkillUserSelectFilter.cs new file mode 100644 index 0000000..55f6d88 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkillUserSelectFilter.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; + +public class SkillUserSelectFilter : ISkillSelectFilter +{ + public bool IsEmptyHanded; + + private readonly string EMPTY_HANDED = "empty_handed"; + + private string _context = ""; + + public SkillUserSelectFilter(string value) + { + IsEmptyHanded = value == EMPTY_HANDED; + _context = value; + if (IsEmptyHanded) + { + _context = "1"; + } + } + + public int CalcCount(SkillOptionValue option) + { + return option.ParseInt(_context); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + return cards; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_attack_by_life.cs b/SVSim.BattleEngine/Engine/Skill_attack_by_life.cs new file mode 100644 index 0000000..dba60a1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_attack_by_life.cs @@ -0,0 +1,67 @@ +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_attack_by_life : SkillBase +{ + public const string OPTION_ATTACK = "attack"; + + public const string OPTION_BE_ATTACKED = "be_attacked"; + + public string type => base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "_OPT_NULL_"); + + public Skill_attack_by_life(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveAttackByLife(type); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + base.IsActivity = true; + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.AttackByLife); + } + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "_OPT_NULL_"); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveAttackByLife(text); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "_OPT_NULL_"); + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.FourceDepriveAttackByLife(text); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_attract_skill_target.cs b/SVSim.BattleEngine/Engine/Skill_attract_skill_target.cs new file mode 100644 index 0000000..ec1130b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_attract_skill_target.cs @@ -0,0 +1,58 @@ +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_attract_skill_target : SkillBase +{ + public Skill_attract_skill_target(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveAttractSkillTarget(); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.AttractSkillTarget); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveAttractSkillTarget(); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveAttractSkillTarget(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_banish.cs b/SVSim.BattleEngine/Engine/Skill_banish.cs new file mode 100644 index 0000000..35ca0fd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_banish.cs @@ -0,0 +1,77 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_banish : SkillBase +{ + public override bool IsTargetIndicate => false; + + public Skill_banish(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + bool flag = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.is_open, SkillFilterCreator.ContentKeyword._false.ToStringCustom()) == SkillFilterCreator.ContentKeyword._true.ToStringCustom() || (OnWhenDraw != 0 && base.ApplyingTargetFilter is SkillTargetSelfFilter); + List list = parameter.targetCards.ToList(); + List list2 = ((!BattleManagerBase.IsForecast) ? list.Where((BattleCardBase c) => c.IsInplay && (!c.SkillApplyInformation.IsBanishByDestroy || !c.SkillApplyInformation.IsIndestructible)).ToList() : null); + List list3 = ((!BattleManagerBase.IsForecast) ? list.Where((BattleCardBase c) => c.IsInHand).ToList() : null); + List list4 = ((!BattleManagerBase.IsForecast) ? list.Where((BattleCardBase c) => c.IsInDeck).ToList() : null); + int count = base.SkillPrm.selfBattlePlayer.DeckCardList.Count; + int count2 = base.SkillPrm.opponentBattlePlayer.DeckCardList.Count; + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase item in list) + { + item.FlagCardAsDestroyedBySkill(); + parallelVfxPlayer.Register(item.SelfBattlePlayer.CardManagement(item, parameter.skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.BANISH, base.UsedRandom, null, null, this, null, flag)); + } + if (IsBattleLog) + { + if (list2 != null) + { + BattleLogManager.GetInstance().AddLogSkillDeath(list2, this); + } + if (list3 != null) + { + BattleLogManager.GetInstance().AddLogSkillBanishHand(list3.Where((BattleCardBase c) => c.IsPlayer).ToList(), isPlayer: true, this); + BattleLogManager.GetInstance().AddLogSkillBanishHand(list3.Where((BattleCardBase c) => !c.IsPlayer).ToList(), isPlayer: false, this); + } + if (list4 != null) + { + if (flag) + { + foreach (BattleCardBase card in list4) + { + if (card.BattleCardView != null) + { + List costList = card.BattleCardView.GetUseCostList(card.Cost); + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + card.BattleCardView.UpdateCost(costList, isGenerateInHand: false, playEffect: false, isForceUpdate: true); + card.BattleCardView.UpdateOffence(card.Atk); + card.BattleCardView.UpdateLife(card.Life); + })); + } + parallelVfxPlayer.Register(new BanishDeckCardVfx(card.BattleCardView)); + } + } + BattleLogManager.GetInstance().AddLogSkillBanishDeck(list4.Where((BattleCardBase c) => c.IsPlayer).ToList(), this, flag); + BattleLogManager.GetInstance().AddLogSkillBanishDeck(list4.Where((BattleCardBase c) => !c.IsPlayer).ToList(), this, flag); + if (list4.Any((BattleCardBase c) => c.SelfBattlePlayer == base.SkillPrm.selfBattlePlayer)) + { + base.SkillPrm.selfBattlePlayer.CallOnChangeDeckAfterEvent(count, parameter.skillProcessor, new List()); + } + if (list4.Any((BattleCardBase c) => c.SelfBattlePlayer == base.SkillPrm.opponentBattlePlayer)) + { + base.SkillPrm.opponentBattlePlayer.CallOnChangeDeckAfterEvent(count2, parameter.skillProcessor, new List()); + } + } + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, list, isFollowInHand: false, addToLastOperation: true)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_bp_modifier.cs b/SVSim.BattleEngine/Engine/Skill_bp_modifier.cs new file mode 100644 index 0000000..fc24cae --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_bp_modifier.cs @@ -0,0 +1,54 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class Skill_bp_modifier : SkillBase +{ + public static readonly int BP_NONE = -1; + + public const string BP_MINUS_EFFECT = "cmn_ui_hbp_1"; + + public const string BP_PLUS_EFFECT = "cmn_ui_hbp_2"; + + public Skill_bp_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_bp, 0); + int num2 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_bp, BP_NONE); + _ = IsBattleLog; + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + for (int i = 0; i < parameter.targetCards.Count(); i++) + { + BattlePlayerBase targetClass = parameter.targetCards.ElementAt(i).SelfBattlePlayer; + if (num != 0) + { + parallelVfxPlayer.Register(new LoadAndPlayEffectVfx("cmn_ui_hbp_2", null, () => targetClass.BattleView.GetBPLabelPosition(), 0f, BattleManagerBase.GetIns().Battle3DContainer.layer)); + parallelVfxPlayer.Register(AddBp(targetClass, num)); + if (targetClass is BattlePlayer) + { + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_HBP_UP); + })); + } + } + else if (num2 > BP_NONE) + { + parallelVfxPlayer.Register(new LoadAndPlayEffectVfx("cmn_ui_hbp_1", null, () => targetClass.BattleView.GetBPLabelPosition(), 0f, BattleManagerBase.GetIns().Battle3DContainer.layer)); + parallelVfxPlayer.Register(AddBp(targetClass, -num2)); + } + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + protected virtual VfxBase AddBp(BattlePlayerBase target, int value) + { + return target.AddBp(value); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_can_play_self.cs b/SVSim.BattleEngine/Engine/Skill_can_play_self.cs new file mode 100644 index 0000000..409227d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_can_play_self.cs @@ -0,0 +1,14 @@ +using Wizard.Battle.View.Vfx; + +public class Skill_can_play_self : SkillBase +{ + public Skill_can_play_self(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + return VfxWithLoadingSequential.Create(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_cant_activate_fanfare.cs b/SVSim.BattleEngine/Engine/Skill_cant_activate_fanfare.cs new file mode 100644 index 0000000..7211278 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_cant_activate_fanfare.cs @@ -0,0 +1,77 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_cant_activate_fanfare : SkillBase +{ + public Skill_cant_activate_fanfare(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "all"); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveCantActivateFanfare(text); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + if (targetCard.IsClass) + { + UpdateClassBuffIfActive(targetCard); + } + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, text, null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + })); + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.CantActivateFanfare); + } + VfxWithLoading vfxWithLoading = CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(vfxWithLoading.MainVfx, parallelVfxPlayer, base.SkillPrm.selfBattlePlayer.UpdateHandCardsCost(), base.SkillPrm.opponentBattlePlayer.UpdateHandCardsCost()); + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxWithLoading.LoadingVfx); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + for (int i = 0; i < buffInfoContainer.Count; i++) + { + VfxBase vfx = buffInfoContainer[i]._targetCard.SkillApplyInformation.DepriveCantActivateFanfare(buffInfoContainer[i]._stringValue); + list.Add(buffInfoContainer[i]._targetCard); + buffInfoContainer[i]._targetCard.RemoveBuffInfo(buffInfoContainer[i]._buffInfo); + if (buffInfoContainer[i]._targetCard.IsClass) + { + UpdateClassBuffIfActive(buffInfoContainer[i]._targetCard); + } + parallelVfxPlayer.Register(vfx); + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + parallelVfxPlayer.Register(base.SkillPrm.selfBattlePlayer.UpdateHandCardsCost()); + parallelVfxPlayer.Register(base.SkillPrm.opponentBattlePlayer.UpdateHandCardsCost()); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + string option_type = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "all"); + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveCantActivateFanfare(option_type); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_cant_activate_shortage_deck_win.cs b/SVSim.BattleEngine/Engine/Skill_cant_activate_shortage_deck_win.cs new file mode 100644 index 0000000..11060d6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_cant_activate_shortage_deck_win.cs @@ -0,0 +1,70 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_cant_activate_shortage_deck_win : SkillBase +{ + public Skill_cant_activate_shortage_deck_win(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveCantActivateShortageDeckWin(); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + if (targetCard.IsClass) + { + UpdateClassBuffIfActive(targetCard); + } + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.CantActivateShortageDeckWin); + } + VfxWithLoading vfxWithLoading = CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(vfxWithLoading.MainVfx, parallelVfxPlayer); + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxWithLoading.LoadingVfx); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + for (int i = 0; i < buffInfoContainer.Count; i++) + { + VfxBase vfx = buffInfoContainer[i]._targetCard.SkillApplyInformation.ForceDepriveCantActivateShortageDeckWin(); + list.Add(buffInfoContainer[i]._targetCard); + buffInfoContainer[i]._targetCard.RemoveBuffInfo(buffInfoContainer[i]._buffInfo); + if (buffInfoContainer[i]._targetCard.IsClass) + { + UpdateClassBuffIfActive(buffInfoContainer[i]._targetCard); + } + parallelVfxPlayer.Register(vfx); + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveCantActivateShortageDeckWin(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_cant_attack.cs b/SVSim.BattleEngine/Engine/Skill_cant_attack.cs new file mode 100644 index 0000000..30b600b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_cant_attack.cs @@ -0,0 +1,120 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_cant_attack : SkillBase +{ + private class CantAttack + { + public BattleCardBase _target { get; set; } + + public int _cantClass { get; set; } + + public int _cantUnit { get; set; } + + public int _cantUnitNotHasGuard { get; set; } + + public BuffInfo _buffInfo { get; set; } + + public CantAttack(BattleCardBase target, int cantClass, int cantUnit, int cantUnitNotHasGuard, BuffInfo buffInfo) + { + _target = target; + _cantClass = cantClass; + _cantUnit = cantUnit; + _cantUnitNotHasGuard = cantUnitNotHasGuard; + _buffInfo = buffInfo; + } + } + + public static readonly int BIT_FLAG_NULL = 0; + + public static readonly int BIT_FLAG_CLASS = 1; + + public static readonly int BIT_FLAG_UNIT = 2; + + public static readonly int BIT_FLAG_UNIT_AND_CLASS = 3; + + public static readonly int BIT_FLAG_ALL = 4; + + public static readonly int BIT_UNIT_NOT_HAS_GUARD = 8; + + private int _baseCardId; + + public Skill_cant_attack(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + int num = BIT_FLAG_NULL; + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.cant_attack); + _baseCardId = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.base_card_id, -1); + CantAttackType type = CantAttackType.Null; + switch (text) + { + case "class": + num = BIT_FLAG_CLASS; + type = CantAttackType.Class; + break; + case "unit": + num = BIT_FLAG_UNIT; + type = CantAttackType.Unit; + break; + case "all": + num = BIT_FLAG_UNIT_AND_CLASS; + type = CantAttackType.All; + break; + case "unit_not_has_guard": + num = BIT_UNIT_NOT_HAS_GUARD; + type = CantAttackType.NotHasGuard; + break; + } + foreach (BattleCardBase targetCard in parameter.targetCards) + { + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, num, "", null, 0L); + parallelVfxPlayer.Register(targetCard.SkillApplyInformation.GiveCantAttack(num, _baseCardId)); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillCantAttack(parameter.targetCards.ToList(), this, type); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + parallelVfxPlayer.Register(base.Stop(skillProcessor)); + List list = new List(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + parallelVfxPlayer.Register(item._targetCard.SkillApplyInformation.DepriveCantAttack(item._intValue, _baseCardId)); + list.Add(item._targetCard); + item._targetCard.RemoveBuffInfo(item._buffInfo); + } + CallOnUpdateSkillEffect(list, updateAttackEffect: true); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + VfxBase result = card.SkillApplyInformation.ForceDepriveCantAttack(); + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return result; + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_cant_evolution.cs b/SVSim.BattleEngine/Engine/Skill_cant_evolution.cs new file mode 100644 index 0000000..ec59446 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_cant_evolution.cs @@ -0,0 +1,74 @@ +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_cant_evolution : SkillBase +{ + public static readonly int BIT_FLAG_NULL = 0; + + public static readonly int BIT_FLAG_EPUSE = 1; + + public static readonly int BIT_FLAG_SKILL = 2; + + public Skill_cant_evolution(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int num = BIT_FLAG_NULL; + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type); + if (text == "ep_use") + { + num = BIT_FLAG_EPUSE; + } + else if (text == "skill") + { + num = BIT_FLAG_SKILL; + } + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveCantEvolution(num); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, num, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.Guard); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveCantEvolution(item._intValue); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveCantEvolution(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_cant_play.cs b/SVSim.BattleEngine/Engine/Skill_cant_play.cs new file mode 100644 index 0000000..2aec247 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_cant_play.cs @@ -0,0 +1,97 @@ +using System.Collections.Generic; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_cant_play : SkillBase +{ + private class CantPlayBuffInfoContainer : BuffInfoContainer + { + public BattleCardBase Card { get; private set; } + + public CantPlayCardFilterInfo SkillInfo { get; private set; } + + public CantPlayBuffInfoContainer(BattleCardBase card, BuffInfo info, CantPlayCardFilterInfo skillInfo) + : base(card, info, -1, "", null, 0L) + { + Card = card; + SkillInfo = skillInfo; + } + } + + public override bool IsTargetIndicate => false; + + protected override bool IsBattleLog + { + get + { + if (base.IsBattleLog) + { + return !base.SkillPrm.selfBattlePlayer.Class.IsDead; + } + return false; + } + } + + public Skill_cant_play(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + CantPlayCardFilterInfo cantPlayCardFilterInfo = new CantPlayCardFilterInfo(targetCard, this); + VfxBase vfx = targetCard.SkillApplyInformation.GiveCantPlay(cantPlayCardFilterInfo); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + if (targetCard.IsClass) + { + UpdateClassBuffIfActive(targetCard); + } + CantPlayBuffInfoContainer cantPlayBuffInfoContainer = new CantPlayBuffInfoContainer(battleCardBase, buffInfo, cantPlayCardFilterInfo); + buffInfoContainer.Add(cantPlayBuffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, cantPlayBuffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog) + { + List list = new List(); + list.Add(base.SkillPrm.selfBattlePlayer.Class); + BattleLogManager.GetInstance().AddLogSkillGain(list, this, SkillGainType.CantPlayUnit); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (CantPlayBuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item.Card.SkillApplyInformation.DepriveCantPlay(item.SkillInfo); + item.Card.RemoveBuffInfo(item._buffInfo); + if (item._targetCard.IsClass) + { + UpdateClassBuffIfActive(item._targetCard); + } + parallelVfxPlayer.Register(vfx); + } + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveCantPlay(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_change_affiliation.cs b/SVSim.BattleEngine/Engine/Skill_change_affiliation.cs new file mode 100644 index 0000000..de17b28 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_change_affiliation.cs @@ -0,0 +1,144 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_change_affiliation : SkillBase +{ + public class BuffInfoAffiliationContainer : BuffInfoContainer + { + public string _clanType; + + public List Tribe; + + public BuffInfoAffiliationContainer(BattleCardBase targetCard, BuffInfo buffInfo, string clanType, List tribeType) + : base(targetCard, buffInfo, -1, "", null, 0L) + { + _clanType = clanType; + Tribe = tribeType; + } + } + + protected CardBasePrm.TribeInfo _tribeInfo; + + protected CardBasePrm.ClanType _clan; + + public override bool IsTargetIndicate + { + get + { + bool num = base.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.TargetFilter is SkillTargetDeckFilter) || base.ApplyingTargetFilter is SkillTargetDeckFilter; + bool flag = base.SkillPrm.ownerCard.SelfBattlePlayer.DeckCardList.Count == 0; + if (num && flag) + { + return true; + } + return false; + } + } + + public Skill_change_affiliation(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.clan); + _clan = CardBasePrm.GetClanType(text); + List list = CreateChangeTribeList(); + CardBasePrm.TribeChangeType type = CreateTribeChangeType(); + _tribeInfo = new CardBasePrm.TribeInfo(list, type); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + parallelVfxPlayer.Register(targetCard.SkillApplyInformation.GiveChangeAffiliation(_clan, _tribeInfo, showEffect: true)); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoAffiliationContainer buffInfoAffiliationContainer = new BuffInfoAffiliationContainer(battleCardBase, buffInfo, text, list); + buffInfoContainer.Add(buffInfoAffiliationContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoAffiliationContainer); + } + if (!BattleManagerBase.IsForecast) + { + AddBattleLog(parameter.targetCards, _clan, list); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(targetCards: parameter.targetCards.Where((BattleCardBase s) => s.IsPlayer || s.IsInplay), resourceMgr: base.SkillPrm.resourceMgr)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BuffInfoAffiliationContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveChangeAffiliation(CardBasePrm.GetClanType(item._clanType), _tribeInfo); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public List CreateChangeTribeList() + { + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.tribe, string.Empty); + if (text == string.Empty) + { + return null; + } + return CardBasePrm.CreateTribeTypeList(text); + } + + public CardBasePrm.TribeChangeType CreateTribeChangeType() + { + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type); + if (text == SkillFilterCreator.ContentKeyword.change.ToString()) + { + return CardBasePrm.TribeChangeType.CHANGE; + } + if (text == SkillFilterCreator.ContentKeyword.add.ToString()) + { + return CardBasePrm.TribeChangeType.ADD; + } + return CardBasePrm.TribeChangeType.CHANGE; + } + + public CardBasePrm.ClanType GetClanType() + { + return CardBasePrm.GetClanType(base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.clan)); + } + + private void AddBattleLog(IEnumerable targetCards, CardBasePrm.ClanType newClan, List newTribe) + { + bool isAdminWatch = GameMgr.GetIns().IsAdminWatch; + List cards = targetCards.Where((BattleCardBase c) => c.IsInplay || (c.IsInHand && (c.IsPlayer || isAdminWatch))).ToList(); + bool isTargetInOpponentHand = IsTargetInOpponentHand(); + if (CardBasePrm.ClanType.NONE != newClan) + { + BattleLogManager.GetInstance().AddLogSkillChangeClan(cards, newClan, this, isTargetInOpponentHand); + } + if (newTribe != null && newTribe.Count > 0) + { + BattleLogManager.GetInstance().AddLogSkillChangeTribe(cards, newTribe, this, isTargetInOpponentHand); + } + } + + public virtual void RegisterStop(BattleCardBase card) + { + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + RegisterStop(card); + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveChangeAffiliation(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_change_cemetery.cs b/SVSim.BattleEngine/Engine/Skill_change_cemetery.cs new file mode 100644 index 0000000..a563eb0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_change_cemetery.cs @@ -0,0 +1,47 @@ +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_change_cemetery : SkillBase +{ + public override bool IsTargetIndicate => false; + + protected int AddCemeteryCount { get; private set; } + + protected int GainCemeteryCount { get; private set; } + + public Skill_change_cemetery(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + AddCemeteryCount = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_count, 0); + GainCemeteryCount = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_count, 0); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + for (int i = 0; i < AddCemeteryCount; i++) + { + VfxBase vfx = base.SkillPrm.selfBattlePlayer.DummyCardToCemetery(CardCreatorBase.GetDummyInstance(), this); + parallelVfxPlayer.Register(vfx); + } + if (GainCemeteryCount > 0) + { + parallelVfxPlayer.Register(base.SkillPrm.selfBattlePlayer.GainCemetery(GainCemeteryCount)); + } + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + })); + if (IsBattleLog) + { + if (AddCemeteryCount != 0) + { + BattleLogManager.GetInstance().AddLogSkillChangeCemetery(AddCemeteryCount, this); + } + else if (GainCemeteryCount != 0) + { + BattleLogManager.GetInstance().AddLogSkillChangeCemetery(-GainCemeteryCount, this); + } + } + return VfxWithLoading.Create(parallelVfxPlayer); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_change_rally_count.cs b/SVSim.BattleEngine/Engine/Skill_change_rally_count.cs new file mode 100644 index 0000000..611f28f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_change_rally_count.cs @@ -0,0 +1,21 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class Skill_change_rally_count : SkillBase +{ + public Skill_change_rally_count(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int addCount = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_rally_count, 0); + BattleCardBase[] array = parameter.targetCards.ToArray(); + for (int i = 0; i < array.Length; i++) + { + array[i].SelfBattlePlayer.AddRallyCount(addCount); + } + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_change_skybound_art_count.cs b/SVSim.BattleEngine/Engine/Skill_change_skybound_art_count.cs new file mode 100644 index 0000000..7a1767b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_change_skybound_art_count.cs @@ -0,0 +1,34 @@ +using Wizard.Battle.View.Vfx; + +public class Skill_change_skybound_art_count : SkillBase +{ + private const string EFFECT_FILE_NAME = "stt_act_costdown_1"; + + private const string SE_FILE_NAME = "se_stt_act_costdown_1"; + + public const int DEFAULT_SKYBOUND_ART_COUNT = 10; + + public Skill_change_skybound_art_count(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_skybound_art_count, -1); + VfxWithLoadingSequential result = VfxWithLoadingSequential.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + if (!BattleManagerBase.GetIns().IsVirtualBattle) + { + targetCard.SkillApplyInformation.GiveSkyboundArtCount(new SkyboundArtCountAddModifier(-num)); + } + } + return result; + } + + public int GetGainSkyboundArtCount() + { + return base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_skybound_art_count, 0); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_change_super_skybound_art_count.cs b/SVSim.BattleEngine/Engine/Skill_change_super_skybound_art_count.cs new file mode 100644 index 0000000..c1a0918 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_change_super_skybound_art_count.cs @@ -0,0 +1,44 @@ +using UnityEngine; +using Wizard.Battle.View.Vfx; + +public class Skill_change_super_skybound_art_count : SkillBase +{ + private const string EFFECT_FILE_NAME = "stt_act_costdown_1"; + + private const string SE_FILE_NAME = "se_stt_act_costdown_1"; + + public const int DEFAULT_SUPER_SKYBOUND_ART_COUNT = 15; + + public Skill_change_super_skybound_art_count(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_super_skybound_art_count, -1); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + if (!BattleManagerBase.GetIns().IsVirtualBattle) + { + targetCard.SkillApplyInformation.GiveSuperSkyboundArtCount(new SuperSkyboundArtCountAddModifier(-num)); + } + if (targetCard.HasSuperSkyboundArt && (targetCard.IsPlayer || GameMgr.GetIns().IsAdminWatch)) + { + GameObject effectGameObject = null; + vfxWithLoadingSequential.RegisterToLoadingVfx(new WaitLoadEffectAndSetSeVfx("stt_act_costdown_1", "se_stt_act_costdown_1", delegate(GameObject e) + { + effectGameObject = e; + })); + vfxWithLoadingSequential.RegisterToMainVfx(new PlayEffectAndSeVfx(() => effectGameObject, targetCard.BattleCardView.Transform, isFollow: false, isFollowPosition: false, isFollowAll: true)); + } + } + return vfxWithLoadingSequential; + } + + public int GetGainSkyboundArtCount() + { + return base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_super_skybound_art_count, 0); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_change_union_burst_count.cs b/SVSim.BattleEngine/Engine/Skill_change_union_burst_count.cs new file mode 100644 index 0000000..84695bc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_change_union_burst_count.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using Wizard.Battle.View.Vfx; + +public class Skill_change_union_burst_count : SkillBase +{ + private const string EFFECT_FILE_NAME = "stt_act_costdown_1"; + + private const string SE_FILE_NAME = "se_stt_act_costdown_1"; + + public const int DEFAULT_UNION_BURST_COUNT = 10; + + public Skill_change_union_burst_count(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_union_burst_count, -1); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + targetCard.SkillApplyInformation.GiveUnionBurstCount(new UnionBurstCountAddModifier(-num)); + if (targetCard.HasUnionBurst && (targetCard.IsPlayer || GameMgr.GetIns().IsAdminWatch)) + { + GameObject effectGameObject = null; + vfxWithLoadingSequential.RegisterToLoadingVfx(new WaitLoadEffectAndSetSeVfx("stt_act_costdown_1", "se_stt_act_costdown_1", delegate(GameObject e) + { + effectGameObject = e; + })); + vfxWithLoadingSequential.RegisterToMainVfx(new PlayEffectAndSeVfx(() => effectGameObject, targetCard.BattleCardView.Transform, isFollow: false, isFollowPosition: false, isFollowAll: true)); + } + } + return vfxWithLoadingSequential; + } + + public int GetGainUnionBurstCount() + { + return base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_union_burst_count, 0); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_change_white_ritual_stack.cs b/SVSim.BattleEngine/Engine/Skill_change_white_ritual_stack.cs new file mode 100644 index 0000000..443384a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_change_white_ritual_stack.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_change_white_ritual_stack : SkillBase +{ + public Skill_change_white_ritual_stack(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add, -1); + BattleCardBase newestInplayStack = base.SkillPrm.selfBattlePlayer.InPlayCards.Where((BattleCardBase c) => c.IsTribe(CardBasePrm.TribeType.WHITE_RITUAL) && c.HasSkillStackWhiteRitual).LastOrDefault(); + if (newestInplayStack != null) + { + newestInplayStack.SkillApplyInformation.GiveWhiteRitualCount(num); + sequentialVfxPlayer.Register(new ChangeWhiteRitualCountVfx(newestInplayStack, num)); + CallOnChangeWhiteRitualStack(newestInplayStack, num); + if (newestInplayStack.SkillApplyInformation.WhiteRitualCount <= 0) + { + CallOnSkillDestroy(); + newestInplayStack.FlagCardAsDestroyedBySkill(); + sequentialVfxPlayer.Register(newestInplayStack.SelfBattlePlayer.CardManagement(newestInplayStack, parameter.skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.DESTROY, isRandom: false, null, null, this)); + } + if (IsBattleLog) + { + if (base.SkillPrm.selfBattlePlayer.SkillInfoCemeterys.Any((IReadOnlyBattleCardInfo c) => c == newestInplayStack)) + { + BattleLogManager.GetInstance().AddLogSkillDeath(new List { newestInplayStack }, this); + } + else if (num >= 0) + { + BattleLogManager.GetInstance().AddLogGiveWhiteRitualStack(num, newestInplayStack, this); + } + else + { + BattleLogManager.GetInstance().AddLogDepriveWhiteRitualStack(num, newestInplayStack, this); + } + } + } + vfxWithLoadingSequential.RegisterToMainVfx(sequentialVfxPlayer); + return vfxWithLoadingSequential; + } + + protected virtual void CallOnChangeWhiteRitualStack(BattleCardBase target, int changeCount) + { + } + + protected virtual void CallOnSkillDestroy() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_chant_count_change.cs b/SVSim.BattleEngine/Engine/Skill_chant_count_change.cs new file mode 100644 index 0000000..effa825 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_chant_count_change.cs @@ -0,0 +1,127 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_chant_count_change : SkillBase +{ + public static readonly int CHANT_NONE = -1; + + private int setChant; + + protected int gainChant; + + protected int addChant; + + public bool IsSelfChantSkill; + + public Skill_chant_count_change(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + setChant = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set_chant, CHANT_NONE); + gainChant = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_chant, 0); + addChant = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_chant, 0); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards, isFollowInHand: false, addToLastOperation: true)); + int num = 0; + int num2 = 0; + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + CallOnChantCountChange(parameter.targetCards.ToList()); + foreach (BattleCardBase targetCard2 in parameter.targetCards) + { + BattleCardBase targetCard = targetCard2; + targetCard.OnRemoveFromInPlayAfterOneTime += (bool flg, SkillProcessor skillProcessor) => new RemoveChantCountVfx(targetCard.BattleCardView); + num = targetCard.ChantCount; + if (setChant != CHANT_NONE) + { + ChantCountSet(targetCard, setChant); + vfxWithLoadingSequential.RegisterToMainVfx(new ShowChantCountVfx(targetCard, targetCard.ChantCount, base.SkillPrm.resourceMgr)); + } + else if (gainChant > 0) + { + ChantCountGain(targetCard, gainChant); + vfxWithLoadingSequential.RegisterVfxWithLoading(new ChangeChantCountVfx(targetCard, targetCard.ChantCount, base.SkillPrm.resourceMgr)); + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(targetCard2.SelfBattlePlayer, targetCard2.OpponentBattlePlayer); + if (!IsSelfChantSkill && base.SkillPrm.ownerCard.IsPlayer == targetCard.IsPlayer) + { + parameter.skillProcessor.Register(targetCard2.Skills.CreateWhenChantCountChangeInfo(parameter.skillProcessor, playerInfoPair)); + } + parameter.skillProcessor.Register(targetCard2.Skills.CreateWhenChantCountGainInfo(parameter.skillProcessor, playerInfoPair)); + } + else if (addChant > 0) + { + ChantCountAdd(targetCard, addChant); + vfxWithLoadingSequential.RegisterVfxWithLoading(new ChangeChantCountVfx(targetCard, targetCard.ChantCount, base.SkillPrm.resourceMgr)); + } + parallelVfxPlayer.Register(CheckChantCountDestroy(targetCard, parameter.skillProcessor)); + num2 = targetCard.ChantCount; + if (IsBattleLog) + { + if (num > 0) + { + BattleLogManager.GetInstance().AddLogSkillChangeChantCount(num2 - num, targetCard, this); + } + if (num2 <= 0) + { + BattleLogManager.GetInstance().AddLogDeath(targetCard); + } + } + } + if (gainChant > 0) + { + RegisterChantCountChangeTriggerSkill(parameter.skillProcessor, parameter.targetCards); + } + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + private void ChantCountGain(BattleCardBase card, int gain) + { + if (gain > 0) + { + card.SkillApplyInformation.GiveChantCount(new ChantCountAddModifier(-gain)); + } + } + + private void ChantCountAdd(BattleCardBase card, int add) + { + card.SkillApplyInformation.GiveChantCount(new ChantCountAddModifier(add)); + } + + private void ChantCountSet(BattleCardBase card, int set) + { + card.SkillApplyInformation.GiveChantCount(new ChantCountSetModifier(set)); + } + + protected virtual VfxBase CheckChantCountDestroy(BattleCardBase card, SkillProcessor skillProcessor) + { + if (card.ChantCount > 0) + { + return NullVfx.GetInstance(); + } + card.FlagCardAsDestroyedBySkill(); + return card.SelfBattlePlayer.CardManagement(card, skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.DESTROY, base.UsedRandom, null, null, this); + } + + private void RegisterChantCountChangeTriggerSkill(SkillProcessor skillProcessor, IEnumerable targets) + { + List list = base.SkillPrm.selfBattlePlayer.ClassAndInPlayCardList.Where((BattleCardBase c) => c.Skills.Any((SkillBase s) => s.OnWhenChantCountGainSelfAndOther != 0)).ToList(); + list.AddRange(base.SkillPrm.opponentBattlePlayer.ClassAndInPlayCardList.Where((BattleCardBase c) => c.Skills.Any((SkillBase s) => s.OnWhenChantCountGainSelfAndOther != 0))); + for (int num = 0; num < list.Count; num++) + { + if (list[num].Skills.Any((SkillBase s) => s.OnWhenChantCountGainSelfAndOther != 0)) + { + skillProcessor.Register(list[num].Skills.CreateWhenChantCountGainSelfAndOtherInfo(targets.ToList(), skillProcessor, new BattlePlayerReadOnlyInfoPair(list[num].SelfBattlePlayer, list[num].OpponentBattlePlayer))); + } + } + } + + protected virtual void CallOnChantCountChange(List targetCards) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_choice.cs b/SVSim.BattleEngine/Engine/Skill_choice.cs new file mode 100644 index 0000000..e2be799 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_choice.cs @@ -0,0 +1,16 @@ +using Wizard.Battle.View.Vfx; + +public class Skill_choice : SkillBase +{ + public override bool IsChoiceType => true; + + public Skill_choice(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_clear_destroyed_and_discarded_card_list.cs b/SVSim.BattleEngine/Engine/Skill_clear_destroyed_and_discarded_card_list.cs new file mode 100644 index 0000000..1f33f94 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_clear_destroyed_and_discarded_card_list.cs @@ -0,0 +1,26 @@ +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_clear_destroyed_and_discarded_card_list : SkillBase +{ + public Skill_clear_destroyed_and_discarded_card_list(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + BattlePlayerBase selfBattlePlayer = targetCard.SelfBattlePlayer; + parallelVfxPlayer.Register(selfBattlePlayer.ClearDestroyedAndDiscardedCardList(this)); + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillClearDestroyedCardList(this, selfBattlePlayer); + BattleLogManager.GetInstance().ClearDestroyedCardList(selfBattlePlayer.IsPlayer); + } + } + return VfxWithLoading.Create(parallelVfxPlayer); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_clear_summoned_card_list.cs b/SVSim.BattleEngine/Engine/Skill_clear_summoned_card_list.cs new file mode 100644 index 0000000..bd3475b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_clear_summoned_card_list.cs @@ -0,0 +1,27 @@ +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_clear_summoned_card_list : SkillBase +{ + public Skill_clear_summoned_card_list(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int id = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.card_id, -1); + ParallelVfxPlayer mainVfx = ParallelVfxPlayer.Create(); + for (int i = 0; i < parameter.targetCards.Count(); i++) + { + BattlePlayerBase selfBattlePlayer = parameter.targetCards.ElementAt(i).SelfBattlePlayer; + selfBattlePlayer.GameSummonCards.RemoveAll((BattlePlayerBase.TurnAndCard c) => c.Card.BaseParameter.BaseCardId == id); + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillClearSummonedCardList(this, selfBattlePlayer); + } + } + return VfxWithLoading.Create(mainVfx); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_consume_ep_modifier.cs b/SVSim.BattleEngine/Engine/Skill_consume_ep_modifier.cs new file mode 100644 index 0000000..085ca48 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_consume_ep_modifier.cs @@ -0,0 +1,82 @@ +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_consume_ep_modifier : SkillBase +{ + private string _tribe = string.Empty; + + private string _option = string.Empty; + + public Skill_consume_ep_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + _option = option; + } + + public override VfxWithLoading Start(CallParameter parameter) + { + if (_option == "none") + { + foreach (BattleCardBase targetCard in parameter.targetCards) + { + SetupNotConsumeTarget(targetCard, targetCard, null); + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.DontConsumeEp); + } + } + else + { + _tribe = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.tribe, "ALL"); + ValueWithOperator valueWithOperator = base.OptionValue.GetValueWithOperator(SkillFilterCreator.ContentKeyword.base_card_id); + foreach (BattleCardBase targetCard2 in parameter.targetCards) + { + SetupNotConsumeTarget(targetCard2, null, valueWithOperator); + } + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + return vfxWithLoadingSequential; + } + + private void SetupNotConsumeTarget(BattleCardBase targetCard, BattleCardBase notConsumeCard, ValueWithOperator cardId) + { + NotConsumeEpModifierInfo notConsumeEpModifierInfo = new NotConsumeEpModifierInfo(_tribe, targetCard, this, notConsumeCard, cardId); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(targetCard, null, -1, "", null, 0L, notConsumeEpModifierInfo); + base.buffInfoContainer.Add(buffInfoContainer); + targetCard.SkillApplyInformation.GiveNotConsumeEpModifier(notConsumeEpModifierInfo); + SetOnLoseEvent(targetCard, null, buffInfoContainer); + if (!targetCard.IsClass && IsBattleLog) + { + AddBuffInfoIfNeeded(targetCard); + } + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + foreach (BuffInfoContainer item in buffInfoContainer) + { + item._targetCard.SkillApplyInformation.DepriveNotConsumeEpModifier(item._notConsumeEpModifierInfo); + } + buffInfoContainer.Clear(); + return NullVfxWithLoading.GetInstance(); + } + + private void ClearParameterModifier(BuffInfoContainer info) + { + info._targetCard.SkillApplyInformation.ForceDepriveNotConsumeEpModifier(); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate + { + ClearParameterModifier(container); + buffInfoContainer.Remove(container); + return NullVfx.GetInstance(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_copy_skill.cs b/SVSim.BattleEngine/Engine/Skill_copy_skill.cs new file mode 100644 index 0000000..ebfc429 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_copy_skill.cs @@ -0,0 +1,12 @@ +public class Skill_copy_skill : SkillBaseCopy +{ + public Skill_copy_skill(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override bool IsRemain() + { + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_cost_change.cs b/SVSim.BattleEngine/Engine/Skill_cost_change.cs new file mode 100644 index 0000000..fdcd208 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_cost_change.cs @@ -0,0 +1,372 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_cost_change : SkillBase +{ + private class CostModifierContainer + { + public BattleCardBase _targetCard; + + public ICardCostModifier _costModifier; + + public CostModifierContainer(BattleCardBase targetCard, ICardCostModifier costModifier) + { + _targetCard = targetCard; + _costModifier = costModifier; + } + } + + private const string EACH_TARGET_OPTION = "each_target"; + + public const string HALF_COST_PARAMETER_ROUND_UP = "half"; + + public const string HALF_COST_PARAMETER_ROUND_DOWN = "half_round_down"; + + public const int SET_COST_DEFAULT_INT = int.MinValue; + + public const int ADD_COST_DEFAULT_INT = int.MinValue; + + protected int _addValue = int.MinValue; + + protected int _setValue = int.MinValue; + + protected Action, ICardCostModifier> OnAccumulationCostChange; + + private List _targetList = new List(); + + protected List _targets; + + protected List _isCostUpList; + + public override bool IsTargetIndicate + { + get + { + BattlePlayerBase battlePlayerBase = ((base.ApplyBattlePlayerFilter is SelfBattlePlayerFilter) ? base.SkillPrm.ownerCard.SelfBattlePlayer : base.SkillPrm.ownerCard.OpponentBattlePlayer); + if (base.ApplyingTargetFilter is SkillTargetDeckFilter && battlePlayerBase.DeckCardList.Count == 0) + { + return true; + } + if (IsTargetInHand() && battlePlayerBase.HandCardList.Count == 0) + { + return true; + } + return false; + } + } + + public List CostModifierTypeList { get; private set; } = new List(); + + protected override bool IsBattleLog + { + get + { + bool flag = !base.IsContainSelfFilter || IsOpen(); + return base.IsBattleLog && OnWhenSpellChargeStart == 0 && flag; + } + } + + public Skill_cost_change(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + bool flag = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.show_battle_log, "true") == "true"; + bool flag2 = IsHalfRoundUpCostSkill(SkillFilterCreator.ContentKeyword.add); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + if (!HasEachTargetOption()) + { + SettingCostChangeData(); + CostModifierTypeList.Add(CreateCostModifier()); + } + List list = new List(); + _isCostUpList = new List(); + _targets = new List(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + if (HasEachTargetOption()) + { + SettingCostChangeData(); + CostModifierTypeList.Add(CreateCostModifier()); + } + if (CostModifierTypeList.LastOrDefault() == null) + { + break; + } + if ((!targetCard.IsInHand && !targetCard.IsInDeck) || IsUnconditionalCostChange()) + { + continue; + } + if (targetCard.IsInHand && _setValue != int.MinValue) + { + list.Add(_setValue - targetCard.Cost); + } + if (targetCard.IsInHand && flag2) + { + list.Add(targetCard.Cost / 2 * -1); + } + int cost = targetCard.Cost; + ICardCostModifier cardCostModifier = CostModifierTypeList.LastOrDefault(); + targetCard.AddCostModifier(cardCostModifier, this); + buffInfoContainer.Add(new BuffInfoContainer(targetCard, null, -1, "", null, 0L, null, CostModifierTypeList.LastOrDefault())); + _targets.Add(targetCard); + _isCostUpList.Add(((_addValue != int.MinValue && _addValue > 0) || (_setValue != int.MinValue && _setValue > cost)) && base.SkillPrm.ownerCard.BaseParameter.BaseCardId != 123841020 && base.SkillPrm.ownerCard.BaseParameter.BaseCardId != 130241030); + _ = string.Empty; + BuffInfo buffInfo = null; + if (_addValue != int.MinValue || _setValue != int.MinValue || cardCostModifier is CostHalfModifier) + { + buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoContainer value = new BuffInfoContainer(targetCard, buffInfo, -1, "", null, 0L); + _targetList.Add(value); + SetOnLoseEvent(value._targetCard, buffInfo, value); + targetCard.OnResetCardParameter += delegate + { + value._targetCard.RemoveBuffInfo(value._buffInfo); + buffInfoContainer.Remove(value); + }; + if (OnAccumulationCostChange != null && HasEachTargetOption()) + { + OnAccumulationCostChange(base.SkillPrm.ownerCard, new List { targetCard }, CostModifierTypeList.LastOrDefault()); + } + } + } + CostChangeVfx costChangeVfx = new CostChangeVfx(_targets, OnWhenSpellChargeStart != 0, _isCostUpList, isStop: false); + parallelVfxPlayer.Register(costChangeVfx.MainVfx); + if (OnAccumulationCostChange != null && !HasEachTargetOption()) + { + OnAccumulationCostChange(base.SkillPrm.ownerCard, parameter.targetCards.Where((BattleCardBase c) => !c.IsInplay).ToList(), CostModifierTypeList.LastOrDefault()); + } + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + base.SkillPrm.selfBattlePlayer.UpdateHandCardsPlayability(); + })); + List list2 = new List(); + _ = base.SkillPrm.ownerCard.BaseParameter.BaseCardId; + if ((base.SkillPrm.ownerCard.IsPlayer && base.SkillPrm.buildInfo._effectMoveType == EffectMgr.MoveType.DIRECT_HAND) || base.SkillPrm.buildInfo._effectMoveType == EffectMgr.MoveType.CENTER) + { + list2.Add(base.SkillPrm.ownerCard.OpponentBattlePlayer.Class); + } + else if (base.SkillPrm.buildInfo._effectMoveType != EffectMgr.MoveType.DIRECT_HAND) + { + list2.AddRange(parameter.targetCards); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, list2)); + vfxWithLoadingSequential.RegisterToLoadingVfx(costChangeVfx.LoadingVfx); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + if (IsBattleLog && flag) + { + AddBattleLog(parameter.targetCards.Where((BattleCardBase c) => c.IsInHand), list, flag2); + } + SkillPreprocessBase skillPreprocessBase = base.PreprocessList.FirstOrDefault((SkillPreprocessBase p) => p is SkillPreprocessOpenCard); + if (skillPreprocessBase != null && base.ApplyingTargetFilter is SkillTargetHandSelfFilter) + { + vfxWithLoadingSequential.RegisterToMainVfx((skillPreprocessBase as SkillPreprocessOpenCard).CreateOpenCardVfx(this)); + } + return vfxWithLoadingSequential; + } + + protected virtual bool IsUnconditionalCostChange() + { + return false; + } + + protected void SettingCostChangeData() + { + bool num = IsHalfRoundUpCostSkill(SkillFilterCreator.ContentKeyword.set); + bool flag = IsHalfRoundUpCostSkill(SkillFilterCreator.ContentKeyword.add); + bool flag2 = IsHalfRoundDownCostSkill(SkillFilterCreator.ContentKeyword.set); + bool flag3 = IsHalfRoundDownCostSkill(SkillFilterCreator.ContentKeyword.add); + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.random_set_range); + if (num || flag2) + { + _setValue = int.MinValue; + } + else if (string.IsNullOrEmpty(text)) + { + _setValue = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set, int.MinValue); + } + else + { + _setValue = GetRandomCost(text); + } + _addValue = ((flag || flag3) ? int.MinValue : base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add, int.MinValue)); + } + + private int GetRandomCost(string costRange) + { + IEnumerable source = from x in costRange.Split(':').ToList() + select base.OptionValue.ParseInt(x); + List list = CreateSequentialCostList(source.Min(), source.Max()); + int index = base.SkillPrm.selfBattlePlayer.BattleMgr.StableRandom(list.Count); + return list[index]; + } + + private List CreateSequentialCostList(int min, int max) + { + List list = new List(); + for (int i = min; i <= max; i++) + { + list.Add(i); + } + return list; + } + + protected ICardCostModifier CreateCostModifier() + { + if (_addValue != int.MinValue) + { + return new CostAddModifier(_addValue, base.IsHandResident); + } + if (_setValue != int.MinValue) + { + return new CostSetModifier(_setValue, base.IsHandResident); + } + if (IsHalfRoundUpCostSkill(SkillFilterCreator.ContentKeyword.add)) + { + return new CostHalfRoundUpModifier(base.IsHandResident); + } + if (IsHalfRoundDownCostSkill(SkillFilterCreator.ContentKeyword.add)) + { + return new CostHalfRoundDownModifier(base.IsHandResident); + } + return null; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + foreach (BuffInfoContainer target in _targetList) + { + target._targetCard.RemoveBuffInfo(target._buffInfo); + } + List list = new List(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + item._targetCard.RemoveCostModifier(this, item.CostModifier); + list.Add(item._targetCard); + } + buffInfoContainer.Clear(); + StopEnd(skillProcessor); + return VfxWithLoading.Create(new CostChangeVfx(list, OnWhenSpellChargeStart != 0, new List(), isStop: true).MainVfx); + } + + protected bool IsHalfRoundUpCostSkill(SkillFilterCreator.ContentKeyword nameType) + { + if (base.OptionValue.GetString(nameType, "NONE") == "half") + { + return true; + } + return false; + } + + protected bool IsHalfRoundDownCostSkill(SkillFilterCreator.ContentKeyword nameType) + { + if (base.OptionValue.GetString(nameType, "NONE") == "half_round_down") + { + return true; + } + return false; + } + + public bool IsHalfCostSkill() + { + bool num = IsHalfRoundUpCostSkill(SkillFilterCreator.ContentKeyword.set); + bool flag = IsHalfRoundUpCostSkill(SkillFilterCreator.ContentKeyword.add); + return num || flag; + } + + protected bool HasEachTargetOption() + { + return base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "NONE") == "each_target"; + } + + protected bool IsOpen() + { + bool flag = base.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessOpenCard); + int num = base.SkillPrm.ownerCard.Skills.IndexOf(this); + if (num > 0 && OnWhenDraw != 0) + { + SkillBase skillBase = base.SkillPrm.ownerCard.Skills.ElementAt(num - 1); + if (skillBase.OnWhenDraw != 0) + { + flag |= skillBase.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessOpenCard); + } + } + return flag; + } + + private void AddBattleLog(IEnumerable targetCards, List setCostDifferenceList, bool isOptionAddHalfRoundUp) + { + int cost = 0; + bool flag = false; + if (_addValue != int.MinValue) + { + cost = _addValue; + } + else if (_setValue != int.MinValue) + { + flag = true; + cost = _setValue; + } + bool isTargetInOpponentHand = IsTargetInOpponentHand(); + BattleLogManager.GetInstance().AddLogCostChange(targetCards.ToList(), this, cost, flag || isOptionAddHalfRoundUp, isTargetInOpponentHand, setCostDifferenceList); + } + + protected override bool CheckShowSideLogCondition(IEnumerable targets, bool isTargetsAvailable, SkillProcessor.ProcessCallType type) + { + if (base.IsBeforAttackSkill) + { + return true; + } + switch (type) + { + case SkillProcessor.ProcessCallType.Start: + { + if ((!GameMgr.GetIns().IsAdminWatch && !base.SkillPrm.ownerCard.IsPlayer && !(base.ApplyingTargetFilter is SkillTargetSelfFilter) && !(base.ApplyingTargetFilter is SkillTargetHandSelfFilter) && base.SkillPrm.ownerCard.SelfBattlePlayer.HandCardList.Count > 0) || base.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessOpenCard)) + { + return true; + } + if (!base.SkillPrm.ownerCard.IsPlayer && !GameMgr.GetIns().IsAdminWatch) + { + break; + } + bool num = !IsHalfRoundUpCostSkill(SkillFilterCreator.ContentKeyword.set) && !IsHalfRoundDownCostSkill(SkillFilterCreator.ContentKeyword.set) && (base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set, int.MinValue) != int.MinValue || base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.random_set_range, "NONE") != "NONE"); + bool flag = IsHalfRoundUpCostSkill(SkillFilterCreator.ContentKeyword.add) || IsHalfRoundDownCostSkill(SkillFilterCreator.ContentKeyword.add) || base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add, int.MinValue) != int.MinValue; + if ((num || flag) && isTargetsAvailable) + { + return targets.Any((BattleCardBase t) => t.IsInHand || t.IsInDeck); + } + return false; + } + case SkillProcessor.ProcessCallType.ResidentStop: + if (!base.SkillPrm.ownerCard.IsPlayer && base.SkillPrm.ownerCard.IsInHand && !GameMgr.GetIns().IsAdminWatch) + { + return false; + } + if (base.SkillPrm.ownerCard.IsPlayer || GameMgr.GetIns().IsAdminWatch) + { + return true; + } + break; + default: + return false; + } + return false; + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return NullVfx.GetInstance(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_damage.cs b/SVSim.BattleEngine/Engine/Skill_damage.cs new file mode 100644 index 0000000..9645874 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_damage.cs @@ -0,0 +1,465 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_damage : SkillBase +{ + private struct BattleLogInfo + { + public int _damage; + + public BattleCardBase _damageBefore; + + public BattleCardBase _damageAfter; + + public BattleCardBase _refrectionDamageBefore; + + public BattleCardBase _refrectionDamageAfter; + } + + public class PerTargetDamageInfo + { + public int Damage { get; private set; } + + public ApplySkillTargetFilterCollection Filter { get; private set; } + + public List ApplyCards { get; private set; } + + private PerTargetDamageInfo(BattleCardBase owner, int damage, string filterString, SkillBase skill) + { + Damage = damage; + Filter = new ApplySkillTargetFilterCollection(); + SkillFilterCreator.SetupTarget(Filter, filterString, owner, skill); + } + + public void SetResult(BattlePlayerReadOnlyInfoPair pair, SkillConditionCheckerOption checker, SkillOptionValue optionValue) + { + ApplyCards = Filter.Filtering(pair, checker, optionValue).Cast().ToList(); + } + + protected static string KeyBracketValue(string text, string key) + { + int num = text.IndexOf(key); + if (num == -1) + { + return string.Empty; + } + text = text.Substring(num); + num = text.IndexOf(")"); + if (num == -1) + { + return string.Empty; + } + return text.Substring(key.Length, num - key.Length); + } + + public static List MakeList(BattleCardBase owner, string text, SkillBase skill) + { + List list = new List(); + string text2 = string.Empty; + int num = 0; + while (text.Length > 0) + { + switch (text[0]) + { + case ':': + if (num == 0) + { + list.Add(text2); + text2 = string.Empty; + } + else + { + text2 += text[0]; + } + break; + case '(': + num++; + text2 += text[0]; + break; + case ')': + num--; + text2 += text[0]; + break; + default: + text2 += text[0]; + break; + } + text = text.Substring(1, text.Length - 1); + } + if (text2 != string.Empty) + { + list.Add(text2); + } + List list2 = new List(); + for (int i = 0; i < list.Count; i++) + { + list2.Add(new PerTargetDamageInfo(owner, int.Parse(KeyBracketValue(list[i], "damage:")), KeyBracketValue(list[i], "target:"), skill)); + } + return list2; + } + } + + private const string OPTION_OLDEST = "oldest"; + + private const string OPTION_EACH_TARGET = "each_target"; + + private const string OPTION_OLDEST_EACH_TARGET = "oldest_each_target"; + + public override bool IsTargetIndicate => false; + + public Skill_damage(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter callParameter) + { + List targets = callParameter.targetCards.Where((BattleCardBase t) => !t.IsDead).ToList(); + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "_OPT_NULL_"); + string text2 = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.per_target_damage, string.Empty); + if (text2 != string.Empty) + { + return TakeDamagePerTarget(targets, callParameter.skillProcessor, text2); + } + if (text == "each_target") + { + return TakeRandomDamageToEachTarget(targets, callParameter.skillProcessor); + } + if (text == "oldest_each_target") + { + return TakeDamageToOldestEachTarget(targets, callParameter.skillProcessor); + } + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.damage, -1); + if (num == -1) + { + if (base.SkillPrm.selfBattlePlayer.AddDamageByClassUseCard(GetCardType()) == 0) + { + return NullVfxWithLoading.GetInstance(); + } + num = 0; + } + if (text == "oldest") + { + return TakeUnfixedDamage(num, targets, callParameter.skillProcessor); + } + return TakeFixedDamage(num, targets, callParameter.skillProcessor); + } + + private VfxWithLoading MakeSkillVfx(List targets, List damageResultList, SkillProcessor skillProcessor) + { + VfxWithLoading vfxWithLoading = CreateSkillEffect(base.SkillPrm.resourceMgr, targets); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + ParallelVfxPlayer parallelVfxPlayer2 = ParallelVfxPlayer.Create(); + ParallelVfxPlayer parallelVfxPlayer3 = ParallelVfxPlayer.Create(); + ParallelVfxPlayer parallelVfxPlayer4 = ParallelVfxPlayer.Create(); + parallelVfxPlayer4.Register(base.SkillPrm.ownerCard.SkillApplyInformation.IsSneak ? base.SkillPrm.ownerCard.AfterAddDamage() : NullVfx.GetInstance()); + for (int i = 0; i < damageResultList.Count; i++) + { + parallelVfxPlayer.Register(damageResultList[i].PreDamageVfx); + parallelVfxPlayer2.Register(damageResultList[i].Vfx); + parallelVfxPlayer3.Register(damageResultList[i].PostDamageVfx); + } + ParallelVfxPlayer parallelVfxPlayer5 = ParallelVfxPlayer.Create(); + foreach (BattleCardBase target in targets) + { + BattleCardBase damageReflectionTarget = target.GetDamageReflectionTarget(isSkillDamage: true); + if (damageReflectionTarget.IsDead) + { + parallelVfxPlayer5.Register(damageReflectionTarget.SelfBattlePlayer.CardManagement(damageReflectionTarget, skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.DESTROY, base.UsedRandom, null, null, this)); + } + else if (base.UsedRandom) + { + damageReflectionTarget.SelfBattlePlayer.PredictionDamageRandomCards.Add(damageReflectionTarget); + } + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(parallelVfxPlayer, vfxWithLoading.MainVfx, parallelVfxPlayer4, parallelVfxPlayer2, parallelVfxPlayer3, parallelVfxPlayer5); + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxWithLoading.LoadingVfx); + return vfxWithLoadingSequential; + } + + private void LoggingDamageResult(List battleLogInfo) + { + if (!IsBattleLog) + { + return; + } + int i = 0; + for (int count = battleLogInfo.Count; i < count; i++) + { + if (battleLogInfo[i]._damageAfter != null) + { + BattleLogManager.GetInstance().AddLogSkillDamage(battleLogInfo[i]._damageBefore, battleLogInfo[i]._damageAfter, battleLogInfo[i]._refrectionDamageBefore, battleLogInfo[i]._refrectionDamageAfter, this); + } + } + } + + private void TakeDamageSingle(BattleCardBase.DamageParam damageParam, BattleCardBase target, List damageTargets, List battleLogInfo, List damageResultList, SkillProcessor skillProcessor) + { + BattleCardBase refrectionDamageBefore = null; + BattleCardBase battleCardBase = null; + BattleCardBase battleCardBase2 = null; + BattleCardBase battleCardBase3 = null; + BattleCardBase damageReflectionTarget = target.GetDamageReflectionTarget(isSkillDamage: true); + if (damageReflectionTarget != target) + { + damageTargets.Add(damageReflectionTarget); + refrectionDamageBefore = damageReflectionTarget.VirtualClone(damageReflectionTarget.SelfBattlePlayer, damageReflectionTarget.OpponentBattlePlayer); + } + else + { + damageTargets.Add(target); + } + battleCardBase = target.VirtualClone(target.SelfBattlePlayer, target.OpponentBattlePlayer); + BattleCardBase.DamageResult damageResult = target.ApplyDamage(this, damageParam, doesAttackerPossessKiller: false, isReflectedDamage: false, skillProcessor, (damageReflectionTarget != target) ? target : null); + if (base.SkillPrm.ownerCard.IsUnit) + { + BattleManagerBase ins = BattleManagerBase.GetIns(); + base.SkillPrm.ownerCard.SelfBattlePlayer.Class.SkillApplyInformation.CausedDamageLife(damageResult.DamageApplied, ins.CurrentTurn, ins.BattlePlayer.IsSelfTurn); + } + damageResultList.Add(damageResult); + battleCardBase3 = target.VirtualClone(target.SelfBattlePlayer, target.OpponentBattlePlayer); + battleCardBase2 = ((damageReflectionTarget == target) ? battleCardBase3 : damageReflectionTarget.VirtualClone(target.SelfBattlePlayer, target.OpponentBattlePlayer)); + if (IsBattleLog) + { + battleLogInfo.Add(new BattleLogInfo + { + _damageBefore = battleCardBase, + _damageAfter = battleCardBase3, + _refrectionDamageBefore = refrectionDamageBefore, + _refrectionDamageAfter = battleCardBase2, + _damage = damageParam.Damage + }); + } + } + + public string GetCardType() + { + if (base.SkillPrm.ownerCard is UnitBattleCard) + { + return SkillFilterCreator.ContentKeyword.unit.ToString(); + } + if (base.SkillPrm.ownerCard is SpellBattleCard) + { + return SkillFilterCreator.ContentKeyword.spell.ToString(); + } + if (base.SkillPrm.ownerCard is FieldBattleCard) + { + return SkillFilterCreator.ContentKeyword.field.ToString(); + } + if (base.SkillPrm.ownerCard.IsClass) + { + return SkillFilterCreator.ContentKeyword._class.ToStringCustom(); + } + return ""; + } + + private VfxWithLoading TakeFixedDamage(int damage, List targets, SkillProcessor skillProcessor) + { + BattleCardBase.DamageParam damageParam = new BattleCardBase.DamageParam(damage, base.SkillPrm.ownerCard, GetCardType(), base.SkillPrm.ownerCard.Clan); + int damage2 = damageParam.Damage; + List list = new List(); + List battleLogInfo = new List(); + List list2 = new List(); + for (int i = 0; i < targets.Count(); i++) + { + TakeDamageSingle(damageParam, targets[i], list, battleLogInfo, list2, skillProcessor); + } + for (int j = 0; j < targets.Count(); j++) + { + RegisterDamageTriggerSkill(skillProcessor, new List { list[j] }, damage2, list2[j]); + } + VfxWithLoading result = MakeSkillVfx(targets, list2, skillProcessor); + LoggingDamageResult(battleLogInfo); + return result; + } + + private VfxWithLoading TakeUnfixedDamage(int damage, List targets, SkillProcessor skillProcessor) + { + BattleCardBase.DamageParam damageParam = new BattleCardBase.DamageParam(damage, base.SkillPrm.ownerCard, GetCardType(), base.SkillPrm.ownerCard.Clan); + List battleLogInfo = new List(); + List list = new List(); + int num = damageParam.Damage; + if (targets.Count >= 2 && targets[0].IsClass) + { + BattleCardBase item = targets[0]; + targets.RemoveAt(0); + targets.Add(item); + } + List list2 = new List(); + for (int i = 0; i < targets.Count(); i++) + { + List list3 = new List(); + int num2 = ((i == targets.Count - 1) ? num : Math.Min(num, targets[i].Life)); + num -= num2; + damageParam.Damage = num2; + TakeDamageSingle(damageParam, targets[i], list3, battleLogInfo, list, skillProcessor); + RegisterDamageTriggerSkill(skillProcessor, list3, num2, list[i]); + list2.Add(targets[i]); + if (num <= 0) + { + break; + } + } + VfxWithLoading result = MakeSkillVfx(list2, list, skillProcessor); + LoggingDamageResult(battleLogInfo); + return result; + } + + public virtual void RegisterDamageTriggerSkill(SkillProcessor skillProcessor, IEnumerable target, int defDamage, BattleCardBase.DamageResult damageResult) + { + base.SkillPrm.selfBattlePlayer.StartSkillWhenDamageSelfAndOther(this, target.ToList(), skillProcessor, defDamage, damageResult.DamageApplied); + } + + private bool IsOnceTakeUnfixedDamageEffect() + { + return base.SkillPrm.buildInfo._effectTargetType == EffectMgr.TargetType.AREA_OPPONENT; + } + + private VfxWithLoading TakeDamagePerTarget(List targets, SkillProcessor skillProcessor, string perTargetDamageText) + { + List battleLogInfo = new List(); + List list = new List(); + List list2 = PerTargetDamageInfo.MakeList(base.SkillPrm.ownerCard, perTargetDamageText, this); + BattlePlayerReadOnlyInfoPair pair = new BattlePlayerReadOnlyInfoPair(base.SkillPrm.selfBattlePlayer, base.SkillPrm.opponentBattlePlayer); + SkillConditionCheckerOption checker = new SkillConditionCheckerOption(); + for (int i = 0; i < list2.Count; i++) + { + list2[i].SetResult(pair, checker, base.OptionValue); + } + int num = base.SkillPrm.selfBattlePlayer.AddDamageByClassUseCard(GetCardType()); + bool flag = false; + int j; + for (j = 0; j < targets.Count; j++) + { + PerTargetDamageInfo perTargetDamageInfo = list2.FirstOrDefault((PerTargetDamageInfo d) => d.ApplyCards.Contains(targets[j])); + if (perTargetDamageInfo == null) + { + continue; + } + List list3 = new List(); + int num2 = perTargetDamageInfo.Damage; + if (num2 == -1) + { + if (num <= 0) + { + continue; + } + num2 = 0; + } + BattleCardBase.DamageParam damageParam = new BattleCardBase.DamageParam(num2, base.SkillPrm.ownerCard, GetCardType(), base.SkillPrm.ownerCard.Clan); + TakeDamageSingle(damageParam, targets[j], list3, battleLogInfo, list, skillProcessor); + int damage = damageParam.Damage; + RegisterDamageTriggerSkill(skillProcessor, list3, damage, list[j]); + flag = true; + } + if (!flag) + { + return NullVfxWithLoading.GetInstance(); + } + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + parallelVfxPlayer.Register(MakeSkillVfx(targets, list, skillProcessor)); + LoggingDamageResult(battleLogInfo); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + private List GetDamageList(SkillFilterCreator.ContentKeyword damageType) + { + string stringAllParse = base.OptionValue.GetStringAllParse(damageType, ':'); + if (string.IsNullOrEmpty(stringAllParse)) + { + return null; + } + string[] array = stringAllParse.Split(':'); + List list = new List(array.Length); + for (int i = 0; i < array.Length; i++) + { + int item; + try + { + item = base.OptionValue.ParseInt(array[i]); + } + catch + { + item = -1; + } + list.Add(item); + } + return list; + } + + private VfxWithLoading TakeRandomDamageToEachTarget(List targets, SkillProcessor skillProcessor) + { + List damageList = GetDamageList(SkillFilterCreator.ContentKeyword.random_damage); + if (damageList == null) + { + return NullVfxWithLoading.GetInstance(); + } + List list = new List(); + for (int i = 0; i < targets.Count; i++) + { + int index = base.SkillPrm.selfBattlePlayer.BattleMgr.StableRandom(damageList.Count); + list.Add(damageList[index]); + } + return TakeDamageToEachTarget(targets, skillProcessor, list); + } + + private VfxWithLoading TakeDamageToOldestEachTarget(List targets, SkillProcessor skillProcessor) + { + List damageList = GetDamageList(SkillFilterCreator.ContentKeyword.damage); + if (damageList == null) + { + return NullVfxWithLoading.GetInstance(); + } + List list = targets; + if (targets.Count > damageList.Count) + { + list = list.GetRange(0, damageList.Count); + } + return TakeDamageToEachTarget(list, skillProcessor, damageList); + } + + private VfxWithLoading TakeDamageToEachTarget(List targets, SkillProcessor skillProcessor, List damageList) + { + List battleLogInfo = new List(); + List list = new List(); + string cardType = GetCardType(); + int num = base.SkillPrm.selfBattlePlayer.AddDamageByClassUseCard(cardType); + List list2 = new List(); + for (int i = 0; i < targets.Count; i++) + { + if (damageList[i] == -1) + { + if (num <= 0) + { + list2.Add(null); + continue; + } + damageList[i] = 0; + } + list2.Add(new BattleCardBase.DamageParam(damageList[i], base.SkillPrm.ownerCard, GetCardType(), base.SkillPrm.ownerCard.Clan)); + } + for (int j = 0; j < targets.Count; j++) + { + if (list2[j].HasValue) + { + BattleCardBase.DamageParam value = list2[j].Value; + List list3 = new List(); + TakeDamageSingle(value, targets[j], list3, battleLogInfo, list, skillProcessor); + int damage = value.Damage; + RegisterDamageTriggerSkill(skillProcessor, list3, damage, list[j]); + } + } + if (list2.Any((BattleCardBase.DamageParam? d) => d.HasValue)) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + parallelVfxPlayer.Register(MakeSkillVfx(targets, list, skillProcessor)); + LoggingDamageResult(battleLogInfo); + return VfxWithLoading.Create(parallelVfxPlayer); + } + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_damage_cut.cs b/SVSim.BattleEngine/Engine/Skill_damage_cut.cs new file mode 100644 index 0000000..5d4291c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_damage_cut.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_damage_cut : SkillBase +{ + private class DamageCutBuffContainer : BuffInfoContainer + { + public DamageCutInfo DamageCutInfo { get; private set; } + + public DamageClippingInfo DamageClipping { get; private set; } + + public DamageCutBuffContainer(BattleCardBase card, BuffInfo info, DamageCutInfo damageCut, DamageClippingInfo damageClipping) + : base(card, info, -1, "", null, 0L) + { + DamageCutInfo = damageCut; + DamageClipping = damageClipping; + } + } + + private string _maxParameter; + + private string _minParameter; + + protected List _targetCards; + + private DamageCutInfo.DamageType _type; + + public int CutAmount { get; private set; } + + public int ClippingMax { get; private set; } + + public int LifeLowerLimit { get; private set; } + + public bool IsAllDamageCut + { + get + { + if (CutAmount > 0 && _type == DamageCutInfo.DamageType.ALL) + { + return !base.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessDamageAfterStop); + } + return false; + } + } + + public bool IsNextDamageCut + { + get + { + if (CutAmount > 0 && _type == DamageCutInfo.DamageType.ALL) + { + return base.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessDamageAfterStop); + } + return false; + } + } + + public bool IsSkillDamageCut + { + get + { + if (CutAmount > 0 && _type == DamageCutInfo.DamageType.SKILL) + { + return !base.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessDamageAfterStop); + } + return false; + } + } + + public bool IsDamageClipping + { + get + { + if (ClippingMax == int.MaxValue) + { + return LifeLowerLimit != -1; + } + return true; + } + } + + public Skill_damage_cut(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + SetDuplicateBanSkillNum(); + } + + public override VfxWithLoading Start(CallParameter parameter) + { + CutAmount = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.cut_amount, 0); + LifeLowerLimit = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.life_lower_limit, -1); + ClippingMax = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.cut_clipping, int.MaxValue); + _maxParameter = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.cut_clipping_range_max, string.Empty); + _minParameter = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.cut_clipping_range_min, string.Empty); + _type = base.OptionValue.GetDamageCutGainType(); + _targetCards = parameter.targetCards.ToList(); + if (base.DuplicateBanSkillNum != string.Empty) + { + _targetCards = _targetCards.Where((BattleCardBase c) => !c.SkillApplyInformation.DamageCutList.Any((DamageCutInfo d) => (!base.IsDuplicateBanSelfSkill || d.OwnerCard == base.SkillPrm.ownerCard) && d.DuplicateBanSkillNum == base.DuplicateBanSkillNum)).ToList(); + } + VfxBase vfxToRegister = NullVfx.GetInstance(); + if (CutAmount > 0) + { + DamageCutInfo damageCutInfo = new DamageCutInfo(CutAmount, _type, base.SkillPrm.ownerCard, base.DuplicateBanSkillNum); + vfxToRegister = ProcessGiveAndDeprive(_targetCards, (BattleCardBase c) => c.SkillApplyInformation.GiveDamageCut(damageCutInfo), damageCutInfo, null); + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillGain(_targetCards, this, SkillGainType.DamageCut, CutAmount); + } + } + else if (ClippingMax != int.MaxValue || LifeLowerLimit > 0) + { + DamageClippingInfo clipping = new DamageClippingInfo(ClippingMax, _maxParameter, _minParameter, LifeLowerLimit); + vfxToRegister = ProcessGiveAndDeprive(_targetCards, (BattleCardBase c) => c.SkillApplyInformation.GiveDamageMaxClipping(clipping), null, clipping); + if (IsBattleLog) + { + if (ClippingMax != int.MaxValue) + { + BattleLogManager.GetInstance().AddLogSkillGain(_targetCards, this, SkillGainType.DamageMaxClipping, ClippingMax); + } + else + { + BattleLogManager.GetInstance().AddLogSkillGain(_targetCards, this, SkillGainType.LifeLowerLimit, LifeLowerLimit); + } + } + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, _targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(vfxToRegister); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + foreach (DamageCutBuffContainer item in buffInfoContainer) + { + if (item.DamageCutInfo != null) + { + parallelVfxPlayer.Register(item._targetCard.SkillApplyInformation.DepriveDamageCut(item.DamageCutInfo)); + } + else if (item.DamageClipping != null) + { + parallelVfxPlayer.Register(item._targetCard.SkillApplyInformation.DepriveDamageMaxClipping(item.DamageClipping)); + } + list.Add(item._targetCard); + item._targetCard.RemoveBuffInfo(item._buffInfo); + if (item._targetCard.IsClass) + { + UpdateClassBuffIfActive(item._targetCard); + } + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + private VfxBase ProcessGiveAndDeprive(IEnumerable targets, Func giveFunc, DamageCutInfo damageCut, DamageClippingInfo damageClipping) + { + BuffInfo buffInfo = null; + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase target in targets) + { + BattleCardBase battleCardBase = target; + VfxBase vfx = giveFunc(battleCardBase); + if (IsBattleLog) + { + buffInfo = AddBuffInfoIfNeeded(battleCardBase); + } + if (buffInfo != null && base.SkillPrm.ownerCard.IsClass && base.SkillPrm.ownerCard == target) + { + buffInfo.IsHiddenClassLogSkill = true; + } + if (target.IsClass) + { + UpdateClassBuffIfActive(target); + } + DamageCutBuffContainer damageCutBuffContainer = new DamageCutBuffContainer(battleCardBase, buffInfo, damageCut, damageClipping); + buffInfoContainer.Add(damageCutBuffContainer); + SetOnLoseEvent(battleCardBase, buffInfo, damageCutBuffContainer); + parallelVfxPlayer.Register(vfx); + } + return parallelVfxPlayer; + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return (CutAmount > 0) ? card.SkillApplyInformation.FourceDepriveDamageCut() : card.SkillApplyInformation.ForceDepriveDamageMaxClipping(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_damage_modifier.cs b/SVSim.BattleEngine/Engine/Skill_damage_modifier.cs new file mode 100644 index 0000000..b6618a3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_damage_modifier.cs @@ -0,0 +1,65 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_damage_modifier : SkillBase +{ + private DamageModifier _info; + + public const string AND_TEXT = "_and_"; + + public Skill_damage_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_damage, 0); + int num2 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set_damage, -1); + string damageType = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.card_type, "_OPT_NULL_"); + bool isUseClass = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.owner, "all") == "all"; + CardBasePrm.ClanType clanType = CardBasePrm.GetClanType(base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.clan)); + List list = parameter.targetCards.ToList(); + if (num != 0) + { + _info = new AddDamageInfo(num, damageType, clanType, isUseClass, base.SkillPrm.selfBattlePlayer.BattleMgr.AllPublishedDamageModifierCount++); + } + else if (num2 != -1) + { + _info = new SetDamageInfo(num2, damageType, clanType, isUseClass, base.SkillPrm.selfBattlePlayer.BattleMgr.AllPublishedDamageModifierCount++); + } + for (int i = 0; i < parameter.targetCards.Count(); i++) + { + list[i].SkillApplyInformation.GiveAddDamage(_info); + BuffInfo buffInfo = ((num != 0 || num2 != -1) ? AddBuffInfoIfNeeded(list[i]) : null); + buffInfoContainer.Add(new BuffInfoContainer(list[i], buffInfo, -1, "", null, 0L)); + base.IsActivity = true; + SetOnLoseEvent(list[i], null, null); + } + VfxWithLoading result = CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards); + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillGain(list, this, SkillGainType.AddDamage, num); + } + return result; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + for (int i = 0; i < buffInfoContainer.Count; i++) + { + BattleCardBase targetCard = buffInfoContainer[i]._targetCard; + targetCard.RemoveBuffInfo(buffInfoContainer[i]._buffInfo); + targetCard.SkillApplyInformation.DepriveAddDamage(_info); + } + buffInfoContainer.Clear(); + return base.Stop(skillProcessor); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += (SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) => card.IsDead ? ((VfxBase)NullVfx.GetInstance()) : ((VfxBase)Stop(skillProcessor)); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_destroy.cs b/SVSim.BattleEngine/Engine/Skill_destroy.cs new file mode 100644 index 0000000..0c8a31b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_destroy.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_destroy : SkillBase +{ + protected List TargetList; + + public override bool IsTargetIndicate => false; + + public Skill_destroy(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + TargetList = parameter.targetCards.Where((BattleCardBase s) => !s.IsInDeck).ToList(); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase target in TargetList) + { + target.FlagCardAsDestroyedBySkill(); + parallelVfxPlayer.Register(target.SelfBattlePlayer.CardManagement(target, parameter.skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.DESTROY, base.UsedRandom, null, null, this)); + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillDeath(TargetList.Where((BattleCardBase c) => c.IsDead).ToList(), this); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, TargetList, isFollowInHand: false, addToLastOperation: true)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_discard.cs b/SVSim.BattleEngine/Engine/Skill_discard.cs new file mode 100644 index 0000000..dc44c91 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_discard.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_discard : SkillBase +{ + public override bool ShowSideLog + { + get + { + if (base.ShowSideLog) + { + if (!GameMgr.GetIns().IsAdmin && !base.SkillPrm.ownerCard.IsPlayer) + { + return !base.SkillPrm.ownerCard.IsInCemetery; + } + return true; + } + return false; + } + } + + public Skill_discard(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + List list = parameter.targetCards.Where((BattleCardBase c) => c.IsPlayer == base.SkillPrm.selfBattlePlayer.IsPlayer).ToList(); + List list2 = parameter.targetCards.Where((BattleCardBase c) => c.IsPlayer == base.SkillPrm.opponentBattlePlayer.IsPlayer).ToList(); + base.SkillPrm.selfBattlePlayer.SkillDiscards.AddRange(list); + base.SkillPrm.opponentBattlePlayer.SkillDiscards.AddRange(list2); + base.SkillPrm.selfBattlePlayer.DiscardedCardList.AddRange(list); + base.SkillPrm.selfBattlePlayer.FusionIngredientAndDiscardedCardList.AddRange(list); + if (list.Count > 0) + { + BattlePlayerBase battlePlayer = base.SkillPrm.ownerCard.SelfBattlePlayer; + TurnAndIntValue turnAndIntValue = battlePlayer.GameSkillDiscardCountList.FirstOrDefault((TurnAndIntValue t) => t.IsSelfTurn == battlePlayer.IsSelfTurn && t.Turn == battlePlayer.Turn); + if (turnAndIntValue != null) + { + turnAndIntValue.Increment(); + } + else + { + battlePlayer.GameSkillDiscardCountList.Add(new TurnAndIntValue(1, battlePlayer.Turn, battlePlayer.IsSelfTurn)); + } + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillDiscard(list, base.SkillPrm.selfBattlePlayer.IsPlayer, this); + BattleLogManager.GetInstance().AddLogSkillDiscard(list2, base.SkillPrm.opponentBattlePlayer.IsPlayer, this); + } + base.SkillPrm.selfBattlePlayer.SelfDiscardList.Add(list.SingleOrDefault((BattleCardBase s) => s == base.SkillPrm.ownerCard)); + return VfxWithLoading.Create(base.SkillPrm.selfBattlePlayer.CardManagement(list, parameter.skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.DESTROY, base.UsedRandom, this)); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_drain.cs b/SVSim.BattleEngine/Engine/Skill_drain.cs new file mode 100644 index 0000000..30bafdc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_drain.cs @@ -0,0 +1,70 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_drain : SkillBase +{ + public Skill_drain(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase target in parameter.targetCards) + { + ISkillApplyInformation skillApplyInformation = target.SkillApplyInformation; + if (!skillApplyInformation.IsDrain) + { + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + target.BattleCardView.BattleCardIconAnimations.AddSkillIcon("drain", "battle_notice_status_07"); + })); + } + VfxBase vfx = skillApplyInformation.GiveDrain(); + BattleCardBase battleCardBase = target; + BuffInfo buffInfo = AddBuffInfoIfNeeded(target); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.Drain); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveDrain(); + list.Add(item._targetCard); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.FourceDepriveDrain(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_draw.cs b/SVSim.BattleEngine/Engine/Skill_draw.cs new file mode 100644 index 0000000..191572b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_draw.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_draw : SkillBase +{ + private const string CARD_OPEN_TRUE = "true"; + + private bool _isActiveChangeShortageDeck; + + public override bool IsAllowDestroyTarget => true; + + public override bool IsVisibleTarget { get; protected set; } + + public bool IsActiveChangeShortageDeck => _isActiveChangeShortageDeck; + + public Skill_draw(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + _isActiveChangeShortageDeck = false; + List list = parameter.targetCards.ToList(); + IsVisibleTarget = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.is_open, string.Empty) == "true"; + BattlePlayerBase battlePlayerBase = ((!(base.ApplyBattlePlayerFilter is SelfBattlePlayerFilter)) ? base.SkillPrm.opponentBattlePlayer : base.SkillPrm.selfBattlePlayer); + bool isPlayer = battlePlayerBase.IsPlayer; + bool flag = false; + flag = base.ApplyCardFilterList.Where((ISkillCardFilter f) => f.GetType() != typeof(SkillNullFilter) && f.GetType() != typeof(SkillAllCardFilter)).Count() < 1 && battlePlayerBase.CheckShortageDeck(base.ApplySelectFilter.CalcCount(base.OptionValue), parameter.skillProcessor, out _isActiveChangeShortageDeck); + SkillProcessor skillProcessor = parameter.skillProcessor; + bool isVisibleTarget = IsVisibleTarget; + SkillResultInfo calledSkillResultInfo = parameter.calledSkillResultInfo; + VfxWith> vfxWith = battlePlayerBase.DrawManagement(list, skillProcessor, isVisibleTarget, flag, calledSkillResultInfo, this); + if (vfxWith.Value.Count() <= 0 && !flag) + { + return NullVfxWithLoading.GetInstance(); + } + List list2 = list.Where((BattleCardBase s) => s.IsInHand).ToList(); + for (int num = 0; num < list2.Count(); num++) + { + base.SkillPrm.ownerCard.SkillApplyInformation.AddSkillDrewCard(list2.ElementAt(num)); + BattleLogManager.GetInstance().UpdateFusionedCardSkillDrewCard(base.SkillPrm.ownerCard); + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillDrawCard(list2, this, IsVisibleTarget, isPlayer, isOverDraw: false); + BattleLogManager.GetInstance().AddLogSkillDrawCard(list.Where((BattleCardBase s) => !s.IsInHand).ToList(), this, IsVisibleTarget, isPlayer, isOverDraw: true); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterToMainVfx(vfxWith.Vfx); + return vfxWithLoadingSequential; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_evolve.cs b/SVSim.BattleEngine/Engine/Skill_evolve.cs new file mode 100644 index 0000000..1a4c8a3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_evolve.cs @@ -0,0 +1,134 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Battle.Resource; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_evolve : SkillBase +{ + public const float EVOLVE_STAGGER_TIME_AMOUNT = 0.05f; + + protected List _evolvedBySkill = new List(); + + public Skill_evolve(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + if (parameter.targetCards.Where((BattleCardBase c) => !c.IsEvolution).Count() == 0) + { + return NullVfxWithLoading.GetInstance(); + } + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + ParallelVfxPlayer parallelVfxPlayer2 = ParallelVfxPlayer.Create(); + ParallelVfxPlayer parallelVfxPlayer3 = ParallelVfxPlayer.Create(); + ParallelVfxPlayer parallelVfxPlayer4 = ParallelVfxPlayer.Create(); + _evolvedBySkill = parameter.targetCards.Where((BattleCardBase battleCardBase2) => battleCardBase2.CanEvolution(isSkill: true, isSelfBattlePlayer: true) && battleCardBase2.IsInplay).ToList(); + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillEvolution(_evolvedBySkill, this); + } + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnBeforeSkillEvolve(base.SkillPrm.ownerCard, _evolvedBySkill); + float num = 0f; + int num2 = 0; + foreach (BattleCardBase card in parameter.targetCards) + { + if (!card.CanEvolution(isSkill: true, isSelfBattlePlayer: true) || !card.IsInplay) + { + continue; + } + Action enableAttackControlAction = null; + Action enableAttackTargettingMovementAction = null; + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.VfxMgr.RegisterImmediateVfx(InstantVfx.Create(delegate + { + if (card.IsPlayer) + { + enableAttackControlAction = card.ForceAttackOff(); + } + else + { + enableAttackTargettingMovementAction = card.BattleCardView._attackTargetSelectInfo.DisableAttackTargettingMovement(); + } + })); + VfxWith> loadResourcesVfxWithEffect = SkillEvolveVfx.LoadCardEvolveResources(card, base.SkillPrm.resourceMgr); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(WaitVfx.Create(num)); + BattleCardBase battleCardBase = card; + VfxWithLoading vfxWithLoading = CreateSkillEffect(base.SkillPrm.resourceMgr, battleCardBase.AsIEnumerable(), isFollowInHand: false, addToLastOperation: true, num2 > 0); + parallelVfxPlayer.Register(vfxWithLoading.LoadingVfx); + sequentialVfxPlayer.Register(vfxWithLoading.MainVfx); + bool evolveMeWhenAttack = (base.IsBeforAttackSkill && battleCardBase == base.SkillPrm.ownerCard) || (base.IsBeforeAttackSelfAndOtherSkill && battleCardBase != base.SkillPrm.ownerCard); + if (evolveMeWhenAttack) + { + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnEvolveMeWhenAttack(battleCardBase); + } + sequentialVfxPlayer.Register(card.Evolution(isSkill: true, parameter.skillProcessor, new SkillConditionCheckerOption(), (BattleCardBase evolvedCard, IBattleResourceMgr resourceMgr) => new SkillEvolveVfx(evolvedCard, resourceMgr, loadResourcesVfxWithEffect.Value, base.SkillPrm.ownerCard, evolveMeWhenAttack))); + parallelVfxPlayer3.Register(sequentialVfxPlayer); + parallelVfxPlayer2.Register(TurnOffAttackFrameVfx(card)); + parallelVfxPlayer.Register(loadResourcesVfxWithEffect.Vfx); + parallelVfxPlayer4.Register(ToggleOffCantAttackVfx(card, enableAttackControlAction, enableAttackTargettingMovementAction)); + num += 0.05f; + num2++; + } + RegisterEvolveTriggerSkill(parameter.skillProcessor, parameter.targetCards); + VfxBase vfxToRegister = UIManager.GetInstance().CreateNowLoadingVfx(parallelVfxPlayer); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(parallelVfxPlayer2, parallelVfxPlayer3, parallelVfxPlayer4); + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxToRegister); + return vfxWithLoadingSequential; + } + + private VfxBase TurnOffAttackFrameVfx(BattleCardBase evolvedCard) + { + return InstantVfx.Create(delegate + { + evolvedCard.BattleCardView._inPlayFrameEffect.HideFrameEffect(); + }); + } + + private VfxBase ToggleOffCantAttackVfx(BattleCardBase evolvedCard, Action enableAttackControlAction, Action enableAttackTargettingMovementAction) + { + return InstantVfx.Create(delegate + { + enableAttackControlAction.Call(); + enableAttackTargettingMovementAction.Call(); + }); + } + + private void RegisterEvolveTriggerSkill(SkillProcessor skillProcessor, IEnumerable targets) + { + List list = base.SkillPrm.selfBattlePlayer.HandCardList.Where((BattleCardBase c) => c.Skills.Any((SkillBase s) => s.OnWhenEvolveOtherStart != 0 || s.OnWhenEvolveSelfAndOtherStart != 0)).ToList(); + list.AddRange(base.SkillPrm.opponentBattlePlayer.HandCardList.Where((BattleCardBase c) => c.Skills.Any((SkillBase s) => s.OnWhenEvolveOtherStart != 0 || s.OnWhenEvolveSelfAndOtherStart != 0))); + list.AddRange(base.SkillPrm.selfBattlePlayer.ClassAndInPlayCardList.Where((BattleCardBase c) => c.Skills.Any((SkillBase s) => s.OnWhenEvolveOtherStart != 0 || s.OnWhenEvolveSelfAndOtherStart != 0))); + list.AddRange(base.SkillPrm.opponentBattlePlayer.ClassAndInPlayCardList.Where((BattleCardBase c) => c.Skills.Any((SkillBase s) => s.OnWhenEvolveOtherStart != 0 || s.OnWhenEvolveSelfAndOtherStart != 0))); + int i; + for (i = 0; i < list.Count; i++) + { + if (targets.Any((BattleCardBase t) => t != list[i]) && list[i].Skills.Any((SkillBase s) => s.OnWhenEvolveOtherStart != 0)) + { + skillProcessor.Register(list[i].Skills.CreateWhenEvolveOtherInfo(targets.ToList(), skillProcessor, new BattlePlayerReadOnlyInfoPair(list[i].SelfBattlePlayer, list[i].OpponentBattlePlayer))); + } + if (list[i].Skills.Any((SkillBase s) => s.OnWhenEvolveSelfAndOtherStart != 0)) + { + skillProcessor.Register(list[i].Skills.CreateWhenEvolveSelfAndOtherInfo(targets.ToList(), skillProcessor, new BattlePlayerReadOnlyInfoPair(list[i].SelfBattlePlayer, list[i].OpponentBattlePlayer))); + } + } + } + + protected override bool IsSkipInduction(SkillProcessor.ProcessCallType callType) + { + if (!base.IsSkipInduction(callType)) + { + if (base.ApplyingTargetFilter is SkillTargetSelfFilter && base.ApplyAndFilter.All((ApplySkillTargetFilterCollection f) => f.TargetFilter is SkillTargetSelfFilter)) + { + return base.SkillPrm.ownerCard.IsEvolution; + } + return false; + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_evolve_to_other.cs b/SVSim.BattleEngine/Engine/Skill_evolve_to_other.cs new file mode 100644 index 0000000..0b49a59 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_evolve_to_other.cs @@ -0,0 +1,14 @@ +using Wizard.Battle.View.Vfx; + +public class Skill_evolve_to_other : SkillBase +{ + public Skill_evolve_to_other(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_extra_turn.cs b/SVSim.BattleEngine/Engine/Skill_extra_turn.cs new file mode 100644 index 0000000..fefdc62 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_extra_turn.cs @@ -0,0 +1,38 @@ +using Wizard.Battle.View.Vfx; + +public class Skill_extra_turn : SkillBase +{ + public Skill_extra_turn(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + if (BattleManagerBase.IsForecast) + { + return NullVfxWithLoading.GetInstance(); + } + int addTurn = GetAddTurn(); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveExtraTurn(addTurn); + parallelVfxPlayer.Register(vfx); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public int GetAddTurn() + { + return base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add, 0); + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + return base.Stop(skillProcessor); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_force_avarice.cs b/SVSim.BattleEngine/Engine/Skill_force_avarice.cs new file mode 100644 index 0000000..2327d10 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_force_avarice.cs @@ -0,0 +1,62 @@ +using Wizard; +using Wizard.Battle.View.Vfx; + +public class Skill_force_avarice : SkillBase +{ + public Skill_force_avarice(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveForceAvarice(parameter.skillProcessor); + BattleCardBase battleCardBase = targetCard; + CardParameter baseParameter = base.SkillPrm.ownerCard.BaseParameter; + BuffInfo buffInfo = new BuffInfo(baseParameter.BaseCardId, baseParameter.NormalCardId, this); + targetCard.AddBuffInfo(buffInfo); + if (targetCard.IsClass) + { + UpdateClassBuffIfActive(targetCard); + } + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveForceAvarice(); + parallelVfxPlayer.Register(vfx); + item._targetCard.RemoveBuffInfo(item._buffInfo); + if (item._targetCard.IsClass) + { + UpdateClassBuffIfActive(item._targetCard); + } + } + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveForceAvarice(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_force_berserk.cs b/SVSim.BattleEngine/Engine/Skill_force_berserk.cs new file mode 100644 index 0000000..92ec7d3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_force_berserk.cs @@ -0,0 +1,67 @@ +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_force_berserk : SkillBase +{ + public Skill_force_berserk(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveForceBerserk(parameter.skillProcessor); + BattleCardBase battleCardBase = targetCard; + CardParameter baseParameter = base.SkillPrm.ownerCard.BaseParameter; + BuffInfo buffInfo = new BuffInfo(baseParameter.BaseCardId, baseParameter.NormalCardId, this); + targetCard.AddBuffInfo(buffInfo); + if (targetCard.IsClass) + { + UpdateClassBuffIfActive(targetCard); + } + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillForceBerserk(battleCardBase, this); + } + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveForceBerserk(skillProcessor); + parallelVfxPlayer.Register(vfx); + item._targetCard.RemoveBuffInfo(item._buffInfo); + if (item._targetCard.IsClass) + { + UpdateClassBuffIfActive(item._targetCard); + } + } + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveForceBerserk(skillProcessor); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_force_skill_target.cs b/SVSim.BattleEngine/Engine/Skill_force_skill_target.cs new file mode 100644 index 0000000..2e9a90f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_force_skill_target.cs @@ -0,0 +1,58 @@ +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_force_skill_target : SkillBase +{ + public Skill_force_skill_target(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveForceSkillTarget(); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.ForceSkillTarget); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveForceSkillTarget(); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveForceSkillTarget(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_force_wrath.cs b/SVSim.BattleEngine/Engine/Skill_force_wrath.cs new file mode 100644 index 0000000..f4b8782 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_force_wrath.cs @@ -0,0 +1,62 @@ +using Wizard; +using Wizard.Battle.View.Vfx; + +public class Skill_force_wrath : SkillBase +{ + public Skill_force_wrath(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveForceWrath(parameter.skillProcessor); + BattleCardBase battleCardBase = targetCard; + CardParameter baseParameter = base.SkillPrm.ownerCard.BaseParameter; + BuffInfo buffInfo = new BuffInfo(baseParameter.BaseCardId, baseParameter.NormalCardId, this); + targetCard.AddBuffInfo(buffInfo); + if (targetCard.IsClass) + { + UpdateClassBuffIfActive(targetCard); + } + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveForceWrath(); + parallelVfxPlayer.Register(vfx); + item._targetCard.RemoveBuffInfo(item._buffInfo); + if (item._targetCard.IsClass) + { + UpdateClassBuffIfActive(item._targetCard); + } + } + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveForceWrath(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_fusion.cs b/SVSim.BattleEngine/Engine/Skill_fusion.cs new file mode 100644 index 0000000..138d644 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_fusion.cs @@ -0,0 +1,14 @@ +using Wizard.Battle.View.Vfx; + +public class Skill_fusion : SkillBase +{ + public Skill_fusion(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + return VfxWithLoadingSequential.Create(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_generic_value_modifier.cs b/SVSim.BattleEngine/Engine/Skill_generic_value_modifier.cs new file mode 100644 index 0000000..b6ddefc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_generic_value_modifier.cs @@ -0,0 +1,64 @@ +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class Skill_generic_value_modifier : SkillBase +{ + protected string _setOptionText = "_OPT_NULL_"; + + public override bool ShowSideLog => false; + + public Skill_generic_value_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + _setOptionText = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.set, "_OPT_NULL_"); + } + + protected int[] GetGenericArray(string text) + { + string[] array = text.Split(':'); + int[] array2 = new int[array.Length]; + for (int i = 0; i < array2.Length; i++) + { + array2[i] = base.OptionValue.ParseInt(array[i]); + } + return array2; + } + + public virtual void InsertTargetInfo(CallParameter parameter) + { + int[] skillGenericArray = parameter.calledSkillResultInfo.SelfLastTargetCards[0].Select((BattleCardBase v) => v.CardId).ToArray(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + targetCard.SkillApplyInformation.SetSkillGenericArray(skillGenericArray); + } + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer vfxToRegister = ParallelVfxPlayer.Create(); + string option = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.id, "_OPT_NULL_"); + if (_setOptionText != "_OPT_NULL_") + { + if (option != "_OPT_NULL_") + { + int value = GetGenericArray(_setOptionText)[0]; + foreach (BattleCardBase targetCard in parameter.targetCards) + { + targetCard.SkillApplyInformation.SetSkillGenericKeyAndValue(option, value); + } + } + else + { + int[] genericArray = GetGenericArray(_setOptionText); + foreach (BattleCardBase targetCard2 in parameter.targetCards) + { + targetCard2.SkillApplyInformation.SetSkillGenericArray(genericArray); + } + } + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(vfxToRegister); + return vfxWithLoadingSequential; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_getoff.cs b/SVSim.BattleEngine/Engine/Skill_getoff.cs new file mode 100644 index 0000000..ca973d4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_getoff.cs @@ -0,0 +1,82 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.Resource; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_getoff : SkillBaseSummon +{ + public override bool IsTargetIndicate => false; + + public Skill_getoff(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + InitSummonParameter(); + IEnumerable targetId = GetTargetId(base.SkillPrm.ownerCard.GetOnCards, IsMakeFoil); + if (targetId == null || targetId.Count() == 0) + { + return NullVfxWithLoading.GetInstance(); + } + SummonedCardsList summonedCardsList = CreateSummonedCardsList(base.SkillPrm.ownerCard.GetOnCards, targetId, base.SkillPrm.selfBattlePlayer, "null", isGetoff: true); + List list = summonedCardsList.summonedCards.ToList(); + if (IsBattleLog && list.Count > 0) + { + BattleLogManager.GetInstance().AddLogSkillGetOff(this, list); + } + BattlePlayerBase.SummonInfo summonInfo = new BattlePlayerBase.SummonInfo(base.SkillPrm.ownerCard.IsPlayer, summonedCardsList, SUMMON_TYPE.TOKEN); + VfxWithLoading vfxWithLoadingToRegister = (VfxWithLoading)base.SkillPrm.selfBattlePlayer.CardManagement(null, parameter.skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.GETOFF, isRandom: false, null, base.SkillPrm.ownerCard, this, summonInfo); + AddLastTarget(parameter, summonedCardsList.ToList()); + base.SkillPrm.selfBattlePlayer.UpdateHandCardsPlayability(); + VfxWithLoading vfxWithLoadingToRegister2 = CreateSummonCardAnimation(base.SkillPrm.ownerCard.IsPlayer, summonedCardsList, isOwnerEffect: true); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(vfxWithLoadingToRegister2); + vfxWithLoadingSequential.RegisterVfxWithLoading(vfxWithLoadingToRegister); + return vfxWithLoadingSequential; + } + + protected override VfxWithLoading CreateSummonCardAnimation(bool isPlayer, SummonedCardsList summonedCardsList, bool isOwnerEffect = false) + { + VfxWithLoading vfxWithLoadingToRegister = CreateSummonSkillEffect(base.SkillPrm, summonedCardsList, isOwnerEffect); + StartPickMultiCardVfx vfxToRegister = new StartPickMultiCardVfx(summonedCardsList, base.SkillPrm.resourceMgr, isPlayer, isToken: true, _isIgnoreVoice, _isRandomVoice, isGetoff: true); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(vfxWithLoadingToRegister); + vfxWithLoadingSequential.RegisterToMainVfx(vfxToRegister); + return vfxWithLoadingSequential; + } + + protected VfxWithLoading CreateSummonSkillEffect(SkillParameter skillPrm, SummonedCardsList summonedCardsList, bool isOwnerEffect) + { + if (!isOwnerEffect) + { + return CreateSkillEffect(skillPrm.resourceMgr, summonedCardsList, isFollowInHand: false, addToLastOperation: true); + } + return CreateOwnerSummonSkillEffect(skillPrm.resourceMgr, summonedCardsList); + } + + private VfxWithLoading CreateOwnerSummonSkillEffect(IBattleResourceMgr resourceMgr, SummonedCardsList summonedCardsList) + { + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + foreach (SummonedCardsList.CardEffectPair cardEffectPair in summonedCardsList.cardEffectPairList) + { + BattleCardBase targetCard = cardEffectPair.card; + VfxWithLoading vfxWithLoading = CreateSingleVfx(resourceMgr, () => targetCard.BattleCardView.CardWrapObject.transform.position, targetCard.AsIEnumerable(), addToLastOperation: true); + cardEffectPair.summonEffect = vfxWithLoading.MainVfx; + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxWithLoading.LoadingVfx); + } + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnEffect(base.SkillPrm.buildInfo, isFollowInHand: false, isTargetPosition: true, addToLastOperation: true); + return vfxWithLoadingSequential; + } + + private IEnumerable GetTargetId(IEnumerable targetCards, bool isFoil) + { + if (isFoil) + { + return targetCards.Select((BattleCardBase card) => card.BaseParameter.FoilCardId); + } + return targetCards.Select((BattleCardBase card) => card.BaseParameter.NormalCardId); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_geton.cs b/SVSim.BattleEngine/Engine/Skill_geton.cs new file mode 100644 index 0000000..799888f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_geton.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_geton : SkillBase +{ + public Skill_geton(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + List list = parameter.targetCards.Where((BattleCardBase t) => !t.IsDead).ToList(); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase item in list) + { + item.FlagCardAsDestroyedBySkill(); + parallelVfxPlayer.Register(item.SelfBattlePlayer.CardManagement(item, parameter.skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.GETON, base.UsedRandom, null, base.SkillPrm.ownerCard, this)); + CardParameter baseParameter = item.BaseParameter; + BuffInfo buffInfo = new BuffInfo(baseParameter.CardId, baseParameter.NormalCardId, this); + buffInfo.IsGetonSkill = true; + buffInfo.TargetCard = item; + base.SkillPrm.ownerCard.AddBuffInfo(buffInfo); + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillGetOn(base.SkillPrm.ownerCard, list.Where((BattleCardBase c) => c.IsDead).ToList()); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, list, isFollowInHand: false, addToLastOperation: true)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_guard.cs b/SVSim.BattleEngine/Engine/Skill_guard.cs new file mode 100644 index 0000000..f2c4702 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_guard.cs @@ -0,0 +1,87 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_guard : SkillBase +{ + private class GuardInfoContainer : BuffInfoContainer + { + public GuardInfo GuardInfo { get; private set; } + + public GuardInfoContainer(BattleCardBase card, BuffInfo info, GuardInfo guardInfo) + : base(card, info, -1, "", null, 0L) + { + GuardInfo = guardInfo; + } + } + + protected List _targetCards; + + public Skill_guard(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + SetDuplicateBanSkillNum(); + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + _targetCards = parameter.targetCards.ToList(); + if (base.DuplicateBanSkillNum != string.Empty) + { + _targetCards = _targetCards.Where((BattleCardBase c) => !c.SkillApplyInformation.GuardInfo.Any((GuardInfo g) => (!base.IsDuplicateBanSelfSkill || g.OwnerCard == base.SkillPrm.ownerCard) && g.DuplicateBanSkillNum == base.DuplicateBanSkillNum)).ToList(); + } + foreach (BattleCardBase targetCard in _targetCards) + { + GuardInfo guardInfo = new GuardInfo(base.SkillPrm.ownerCard, base.DuplicateBanSkillNum); + VfxBase vfx = targetCard.SkillApplyInformation.GiveGuard(guardInfo); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + GuardInfoContainer guardInfoContainer = new GuardInfoContainer(battleCardBase, buffInfo, guardInfo); + buffInfoContainer.Add(guardInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, guardInfoContainer); + List list = new List(); + list.Add(targetCard); + BattlePlayerPair playerInfoPair = new BattlePlayerPair(battleCardBase.SelfBattlePlayer, battleCardBase.OpponentBattlePlayer); + parameter.skillProcessor.Register(battleCardBase.Skills.CreateWhenAttachAbilityInfo(parameter.skillProcessor, playerInfoPair, this, BattlePlayerBase.ConvertToSkillInfoCollection(list))); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog && _targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(_targetCards.ToList(), this, SkillGainType.Guard); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, _targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + foreach (GuardInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveGuard(item.GuardInfo); + list.Add(item._targetCard); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveGuard(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_heal.cs b/SVSim.BattleEngine/Engine/Skill_heal.cs new file mode 100644 index 0000000..b32d6a8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_heal.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_heal : SkillBase +{ + private const int NONE_AMOUNT = -1; + + protected List HealResultList = new List(); + + public Skill_heal(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.healing, 0); + List list = new List(); + List list2 = new List(); + if (num == -1) + { + return NullVfxWithLoading.GetInstance(); + } + for (int i = 0; i < parameter.targetCards.Count(); i++) + { + BattleCardBase battleCardBase = parameter.targetCards.ElementAt(i); + battleCardBase.SelfBattlePlayer.HealingCards.Add(battleCardBase); + list2.Add(battleCardBase.VirtualClone(battleCardBase.SelfBattlePlayer, battleCardBase.OpponentBattlePlayer)); + BattleCardBase.HealParam healParam = new BattleCardBase.HealParam(num, base.SkillPrm.ownerCard, battleCardBase); + BattleCardBase.HealResult item = battleCardBase.ApplyHealing(healParam, parameter.skillProcessor); + list.Add(item); + } + RegisterHealTriggerSkill(parameter.skillProcessor, parameter.targetCards, list); + HealResultList = list; + VfxWithLoading vfxWithLoading = CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + ParallelVfxPlayer parallelVfxPlayer2 = ParallelVfxPlayer.Create(); + ParallelVfxPlayer parallelVfxPlayer3 = ParallelVfxPlayer.Create(); + foreach (BattleCardBase.HealResult item2 in list) + { + parallelVfxPlayer.Register(item2.PrehealVfxVfx); + parallelVfxPlayer2.Register(item2.HealVfx); + parallelVfxPlayer3.Register(item2.PosthealVfxVfx); + base.SkillPrm.ownerCard.SkillApplyInformation.AddSkillHealValue(item2.HealAmount); + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillHeal(list2, list, this); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(parallelVfxPlayer, vfxWithLoading.MainVfx, parallelVfxPlayer2, parallelVfxPlayer3); + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxWithLoading.LoadingVfx); + return vfxWithLoadingSequential; + } + + private void RegisterHealTriggerSkill(SkillProcessor skillProcessor, IEnumerable target, List healResult) + { + for (int i = 0; i < target.Count(); i++) + { + BattleCardBase battleCardBase = target.ElementAt(i); + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(battleCardBase.SelfBattlePlayer, battleCardBase.OpponentBattlePlayer); + skillProcessor.Register(battleCardBase.Skills.CreateWhenHealing(battleCardBase, skillProcessor, playerInfoPair, healResult[i].HealAmount)); + } + base.SkillPrm.selfBattlePlayer.StartSkillWhenHealingSelfAndOther(target.ToList(), skillProcessor, healResult.Select((BattleCardBase.HealResult h) => h.HealAmount).ToList()); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_heal_modifier.cs b/SVSim.BattleEngine/Engine/Skill_heal_modifier.cs new file mode 100644 index 0000000..8943b0e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_heal_modifier.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_heal_modifier : SkillBase +{ + private HealModifier _healModifier; + + private const string HEALED_TEXT = "be_healed"; + + public Skill_heal_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_healing, 0); + int num2 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set_healing, -1); + bool isTargetSelfClass = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, string.Empty) == "be_healed"; + List list = parameter.targetCards.ToList(); + for (int i = 0; i < list.Count; i++) + { + if (num != 0) + { + _healModifier = new AddHealModifierInfo(num, base.SkillPrm.selfBattlePlayer.BattleMgr.AllPublishedHealModifierCount++, list[i]); + } + else if (num2 != -1) + { + _healModifier = new SetHealModifierInfo(num2, base.SkillPrm.selfBattlePlayer.BattleMgr.AllPublishedHealModifierCount++, list[i], isTargetSelfClass); + } + list[i].SkillApplyInformation.GiveHealModifier(_healModifier); + BuffInfo buffInfo = ((num != 0 || num2 != -1) ? AddBuffInfoIfNeeded(list[i]) : null); + buffInfoContainer.Add(new BuffInfoContainer(list[i], buffInfo, -1, "", null, 0L)); + base.IsActivity = true; + SetOnLoseEvent(list[i], null, null); + } + VfxWithLoading result = CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards); + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillGain(list, this, SkillGainType.HealModifier); + } + return result; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + for (int i = 0; i < buffInfoContainer.Count; i++) + { + BattleCardBase targetCard = buffInfoContainer[i]._targetCard; + targetCard.RemoveBuffInfo(buffInfoContainer[i]._buffInfo); + targetCard.SkillApplyInformation.DepriveHealModifier(_healModifier); + } + buffInfoContainer.Clear(); + return base.Stop(skillProcessor); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += (SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) => card.IsDead ? ((VfxBase)NullVfx.GetInstance()) : ((VfxBase)Stop(skillProcessor)); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_ignore_guard.cs b/SVSim.BattleEngine/Engine/Skill_ignore_guard.cs new file mode 100644 index 0000000..ac1db7c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_ignore_guard.cs @@ -0,0 +1,58 @@ +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_ignore_guard : SkillBase +{ + public Skill_ignore_guard(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveIgnoreGuard(); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.IgnoreGuard); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveIgnoreGuard(); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.FourceDepriveIgnoreGuard(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_independent.cs b/SVSim.BattleEngine/Engine/Skill_independent.cs new file mode 100644 index 0000000..c595ae6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_independent.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_independent : SkillBase +{ + public Skill_independent(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveIndependent(); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.Independent); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveIndependent(); + list.Add(item._targetCard); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveIndependent(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_indestructible.cs b/SVSim.BattleEngine/Engine/Skill_indestructible.cs new file mode 100644 index 0000000..b05f453 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_indestructible.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_indestructible : SkillBase +{ + public Skill_indestructible(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveIndestructible(); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.Indestructible); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveIndestructible(); + list.Add(item._targetCard); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveIndestructible(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_invoke_emote.cs b/SVSim.BattleEngine/Engine/Skill_invoke_emote.cs new file mode 100644 index 0000000..3745289 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_invoke_emote.cs @@ -0,0 +1,21 @@ +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class Skill_invoke_emote : SkillBase +{ + public Skill_invoke_emote(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + string[] array = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.invoke_emote, "_OPT_NULL_").Split(':'); + if (array.Length < 4) + { + return NullVfxWithLoading.GetInstance(); + } + return VfxWithLoading.Create(parameter.targetCards.First().SelfBattlePlayer.Emotion.PlayEmotion((ClassCharaPrm.MotionType)int.Parse(array[1]), (ClassCharaPrm.FaceType)int.Parse(array[0]), array[2], Data.Master.GetEmoteWordText(array[3]))); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_invoke_skill.cs b/SVSim.BattleEngine/Engine/Skill_invoke_skill.cs new file mode 100644 index 0000000..e1b7bb0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_invoke_skill.cs @@ -0,0 +1,135 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +internal class Skill_invoke_skill : SkillBase +{ + public enum SkillTiming + { + when_play, + when_destroy + } + + private bool _isAllowDestroyTarget; + + public List InsertSkillList { get; private set; } + + public List NotInsertSkillList { get; private set; } + + public override bool IsAllowDestroyTarget => _isAllowDestroyTarget; + + public Skill_invoke_skill(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + InsertSkillList = new List(); + NotInsertSkillList = new List(); + if (BattleManagerBase.GetIns() is SingleBattleMgr) + { + _isAllowDestroyTarget = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.is_allow_destroy_target) == "true"; + } + } + + public bool IsInvokableSkill(SkillBase skill, string timing) + { + bool num = !skill.IsEnhance(); + bool flag = false; + if (timing == SkillTiming.when_play.ToString()) + { + flag = skill.IsWhenPlaySkill; + } + else if (timing == SkillTiming.when_destroy.ToString()) + { + flag = skill.IsWhenDestroySkill; + } + return num && !skill.IsBurialRite && flag; + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoadingSequential result = VfxWithLoadingSequential.Create(); + string invokeType = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.invoke_type); + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(base.SkillPrm.ownerCard.SelfBattlePlayer, base.SkillPrm.ownerCard.OpponentBattlePlayer); + SkillConditionCheckerOption skillConditionCheckerOption = new SkillConditionCheckerOption(); + skillConditionCheckerOption.IsSkipPpCheck = true; + foreach (BattleCardBase targetCard in parameter.targetCards) + { + List list = new List(); + List list2 = new List(); + List list3 = new List(); + bool flag = false; + if (invokeType == SkillTiming.when_play.ToString()) + { + list = targetCard.NormalSkills.Where((SkillBase s) => IsInvokableSkill(s, invokeType)).ToList(); + } + else if (invokeType == SkillFilterCreator.ContentKeyword.when_play_except_burial_rite.ToString()) + { + for (int num = 0; num < targetCard.Skills.Count(); num++) + { + SkillBase skillBase = targetCard.Skills.ElementAt(num); + if (!skillBase.IsWhenPlaySkill || skillBase.IsUserSelectType || !skillBase.Used) + { + continue; + } + for (int num2 = 0; num2 < skillBase.PreprocessList.Count; num2++) + { + if (skillBase.PreprocessList[num2] is SkillPreprocessBurialRite skillPreprocessBurialRite) + { + skillPreprocessBurialRite.SetInvoked(); + } + } + for (int num3 = 0; num3 < skillBase.ConditionFilterCollection.ConditionCheckerFilterList.Count; num3++) + { + if (skillBase.ConditionFilterCollection.ConditionCheckerFilterList[num3] is SkillConditionBurialRite skillConditionBurialRite) + { + skillConditionBurialRite.SetInvoked(); + } + } + list.Add(skillBase); + } + } + else + { + list = targetCard.Skills.Where((SkillBase s) => IsInvokableSkill(s, invokeType)).ToList(); + } + foreach (SkillBase item in list) + { + if (item.PreprocessList.FirstOrDefault((SkillPreprocessBase p) => p is SkillPreprocessTimesPerTurn) is SkillPreprocessTimesPerTurn skillPreprocessTimesPerTurn) + { + skillPreprocessTimesPerTurn.ResetInvokeCount(); + } + bool flag2 = item.CheckCondition(playerInfoPair, skillConditionCheckerOption, isPrePlay: false); + if (item.IsCheckLastTarget()) + { + flag2 = flag2 && flag; + } + else + { + flag = flag2; + } + if (flag2) + { + list2.Add(item); + } + else + { + list3.Add(item); + } + } + if (invokeType == SkillTiming.when_play.ToString()) + { + list2 = BattleUtility.GetRepeatableWhenPlaySkill(targetCard, list2, isInvokeCheck: true); + } + if (list2 != null) + { + InsertSkillList.AddRange(list2); + foreach (SkillBase item2 in list2) + { + item2.SetInvoked(flag: true); + } + } + NotInsertSkillList.AddRange(list3); + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_invoke_voice.cs b/SVSim.BattleEngine/Engine/Skill_invoke_voice.cs new file mode 100644 index 0000000..cb01258 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_invoke_voice.cs @@ -0,0 +1,18 @@ +using Wizard.Battle.View.Vfx; + +public class Skill_invoke_voice : SkillBase +{ + public Skill_invoke_voice(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.invoke_voice, "_OPT_NULL_"); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterToLoadingVfx(new WaitLoadVoiceResourceVfx(base.SkillPrm.ownerCard.BattleCardView, text.Split('_')[0])); + vfxWithLoadingSequential.RegisterToMainVfx(new PlayCRISoundVfx(base.SkillPrm.ownerCard.BattleCardView, text)); + return vfxWithLoadingSequential; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_killer.cs b/SVSim.BattleEngine/Engine/Skill_killer.cs new file mode 100644 index 0000000..6428437 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_killer.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_killer : SkillBase +{ + public Skill_killer(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveKiller(); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.Killer); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveKiller(); + list.Add(item._targetCard); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + parallelVfxPlayer.Register(item._targetCard.BattleCardView.InitializeBattleCardIcon(item._targetCard, item._targetCard.Skills)); + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.FourceDepriveKiller(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_life_zero_activate_leon_skill.cs b/SVSim.BattleEngine/Engine/Skill_life_zero_activate_leon_skill.cs new file mode 100644 index 0000000..56eb0c6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_life_zero_activate_leon_skill.cs @@ -0,0 +1,18 @@ +using Wizard.Battle.View.Vfx; + +public class Skill_life_zero_activate_leon_skill : SkillBase +{ + public Skill_life_zero_activate_leon_skill(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + foreach (BattleCardBase targetCard in parameter.targetCards) + { + targetCard.SkillApplyInformation.GiveLifeZeroActivateLeonSkill(); + } + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_loop_skill.cs b/SVSim.BattleEngine/Engine/Skill_loop_skill.cs new file mode 100644 index 0000000..2996f78 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_loop_skill.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +internal class Skill_loop_skill : SkillBase +{ + public List LoopSkillList { get; private set; } + + public Skill_loop_skill(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + LoopSkillList = new List(); + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoadingSequential result = VfxWithLoadingSequential.Create(); + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(base.SkillPrm.ownerCard.SelfBattlePlayer, base.SkillPrm.ownerCard.OpponentBattlePlayer); + SkillConditionCheckerOption skillConditionCheckerOption = new SkillConditionCheckerOption(); + skillConditionCheckerOption.IsSkipPpCheck = true; + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.loop_range_before_this_skill); + int count = base.SkillPrm.ownerCard.Skills.IndexOf(this) - num; + num++; + for (int i = 0; i < parameter.targetCards.Count(); i++) + { + IEnumerable source = parameter.targetCards.ElementAt(i).Skills.Skip(count).Take(num); + bool flag = false; + for (int j = 0; j < source.Count(); j++) + { + SkillBase skillBase = source.ElementAt(j); + bool flag2 = skillBase.CheckCondition(playerInfoPair, skillConditionCheckerOption, isPrePlay: false); + if (skillBase.IsCheckLastTarget()) + { + flag2 = flag2 && flag; + } + else + { + flag = flag2; + } + if (flag2) + { + LoopSkillList.Add(skillBase); + } + } + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_lose.cs b/SVSim.BattleEngine/Engine/Skill_lose.cs new file mode 100644 index 0000000..7783615 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_lose.cs @@ -0,0 +1,126 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_lose : SkillBase +{ + protected string _ability = string.Empty; + + public Skill_lose(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + GetBuffText(); + BuffInfo buffInfo = null; + _ability = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.ability, string.Empty); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + BattleCardBase battleCardBase = targetCard; + if (_ability == SkillFilterCreator.ContentKeyword.guard.ToString()) + { + if (!battleCardBase.IsEvolution) + { + SkillBase selfGuardSkill = targetCard.Card.NormalSkills.FirstOrDefault((SkillBase s) => s is Skill_guard && s.ApplyingTargetFilter is SkillTargetSelfFilter); + if (selfGuardSkill != null) + { + SkillBase skillBase = targetCard.Card.EvolutionSkills.FirstOrDefault((SkillBase s) => s.IsSameSkill(selfGuardSkill)); + if (skillBase != null) + { + targetCard.Card.EvolutionSkills.Remove(skillBase); + } + } + } + parallelVfxPlayer.Register(battleCardBase.SkillApplyInformation.ForceDepriveGuard()); + buffInfo = AddBuffInfoIfNeeded(battleCardBase); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + } + else if (_ability == SkillFilterCreator.ContentKeyword.cant_attack_all.ToString()) + { + if (!battleCardBase.SkillApplyInformation.IsSkillCantAtkAll) + { + continue; + } + if (!battleCardBase.IsEvolution) + { + SkillBase selfCantAttackSkill = targetCard.Card.NormalSkills.FirstOrDefault((SkillBase s) => s is Skill_cant_attack && s.ApplyingTargetFilter is SkillTargetSelfFilter && s.Option == "cant_attack=all"); + if (selfCantAttackSkill != null) + { + SkillBase skillBase2 = targetCard.Card.EvolutionSkills.FirstOrDefault((SkillBase s) => s.IsSameSkill(selfCantAttackSkill)); + if (skillBase2 != null) + { + targetCard.Card.EvolutionSkills.Remove(skillBase2); + } + } + } + parallelVfxPlayer.Register(battleCardBase.SkillApplyInformation.ForceDepriveCantAttackAll()); + buffInfo = AddBuffInfoIfNeeded(battleCardBase); + BuffInfoContainer buffInfoContainer2 = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer2); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer2); + } + else + { + bool isEvolutionSkill = base.SkillPrm.ownerCard.EvolutionSkills != null && base.SkillPrm.ownerCard.EvolutionSkills.Any((SkillBase skill) => skill == this); + parallelVfxPlayer.Register(battleCardBase.LoseSkill(this)); + buffInfo = AddBuffInfoIfNeeded(battleCardBase); + buffInfo.IsEvolutionSkill = isEvolutionSkill; + BuffInfoContainer buffInfoContainer3 = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer3); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer3); + } + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogLose(parameter.targetCards.ToList(), this); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + ParallelVfxPlayer mainVfx = ParallelVfxPlayer.Create(base.Stop(skillProcessor)); + List list = new List(); + int i = 0; + for (int count = base.buffInfoContainer.Count; i < count; i++) + { + BuffInfoContainer buffInfoContainer = base.buffInfoContainer[i]; + list.Add(base.buffInfoContainer[i]._targetCard); + buffInfoContainer._targetCard.RemoveBuffInfo(buffInfoContainer._buffInfo); + } + CallOnUpdateSkillEffect(list); + base.buffInfoContainer.Clear(); + return VfxWithLoading.Create(mainVfx); + } + + private string GetBuffText() + { + if (!IsBattleLog) + { + return ""; + } + return BattleLogUtility.BuildTextLose(); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + if (!(loseSkill is Skill_lose)) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + } + return NullVfx.GetInstance(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_no_duplication_random_array.cs b/SVSim.BattleEngine/Engine/Skill_no_duplication_random_array.cs new file mode 100644 index 0000000..54427fe --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_no_duplication_random_array.cs @@ -0,0 +1,77 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_no_duplication_random_array : SkillBase +{ + protected Dictionary> _selectedIndex = new Dictionary>(); + + public override bool IsAllowDestroyTarget => true; + + public Skill_no_duplication_random_array(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.random_range, -1); + int num2 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.sum, -1); + bool flag = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.show_battle_log) == "true"; + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + if (!_selectedIndex.ContainsKey(targetCard)) + { + _selectedIndex[targetCard] = new List(); + } + int[] array = ((targetCard.SkillApplyInformation.SkillRandomArray == null) ? new int[num] : targetCard.SkillApplyInformation.SkillRandomArray); + for (int i = 0; i < num2; i++) + { + List list = new List(); + for (int j = 0; j < num; j++) + { + if (array[j] == 0 && !_selectedIndex[targetCard].Contains(j)) + { + list.Add(j); + } + } + if (list.Count() == 0) + { + break; + } + int randomCount = GetRandomCount(list.Count); + _selectedIndex[targetCard].Add(list[randomCount]); + array[list[randomCount]]++; + } + sequentialVfxPlayer.Register(targetCard.SkillApplyInformation.GiveSkillRandomArray(array)); + SetOnLoseEvent(targetCard, null, null); + if (IsBattleLog && flag) + { + BattleLogManager.GetInstance().AddLogSkillRandomArray(parameter.targetCards.ToList(), array, this); + } + } + return VfxWithLoading.Create(sequentialVfxPlayer); + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + _selectedIndex.Clear(); + return base.Stop(skillProcessor); + } + + private int GetRandomCount(int range) + { + return base.SkillPrm.selfBattlePlayer.BattleMgr.StableRandom(range); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + _selectedIndex.Remove(card); + return NullVfx.GetInstance(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_none.cs b/SVSim.BattleEngine/Engine/Skill_none.cs new file mode 100644 index 0000000..90d286d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_none.cs @@ -0,0 +1,16 @@ +using Wizard.Battle.View.Vfx; + +public class Skill_none : SkillBase +{ + public override bool IsShowSideLogSkillType => false; + + public Skill_none(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_not_attached_resident_chant_count_change.cs b/SVSim.BattleEngine/Engine/Skill_not_attached_resident_chant_count_change.cs new file mode 100644 index 0000000..ca06613 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_not_attached_resident_chant_count_change.cs @@ -0,0 +1,14 @@ +using Wizard.Battle.View.Vfx; + +public class Skill_not_attached_resident_chant_count_change : SkillBase +{ + public Skill_not_attached_resident_chant_count_change(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_not_be_attacked.cs b/SVSim.BattleEngine/Engine/Skill_not_be_attacked.cs new file mode 100644 index 0000000..8c9743e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_not_be_attacked.cs @@ -0,0 +1,78 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_not_be_attacked : SkillBase +{ + private class NotBeAttackedBuffInfoContainer : BuffInfoContainer + { + public BattleCardBase Card { get; private set; } + + public NotBeAttackedInfo SkillInfo { get; private set; } + + public NotBeAttackedBuffInfoContainer(BattleCardBase card, BuffInfo info, NotBeAttackedInfo skillInfo) + : base(card, info, -1, "", null, 0L) + { + Card = card; + SkillInfo = skillInfo; + } + } + + public Skill_not_be_attacked(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + string info = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + NotBeAttackedInfo notBeAttackedInfo = new NotBeAttackedInfo(info, targetCard, this); + VfxBase vfx = targetCard.SkillApplyInformation.GiveNotBeAttacked(notBeAttackedInfo); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + NotBeAttackedBuffInfoContainer notBeAttackedBuffInfoContainer = new NotBeAttackedBuffInfoContainer(battleCardBase, buffInfo, notBeAttackedInfo); + buffInfoContainer.Add(notBeAttackedBuffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, notBeAttackedBuffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.NotBeAttacked); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + foreach (NotBeAttackedBuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item.Card.SkillApplyInformation.DepriveNotBeAttacked(item.SkillInfo); + list.Add(item._targetCard); + item.Card.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.FourceDepriveNotBeAttacked(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_not_be_debuffed.cs b/SVSim.BattleEngine/Engine/Skill_not_be_debuffed.cs new file mode 100644 index 0000000..c76ae66 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_not_be_debuffed.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_not_be_debuffed : SkillBase +{ + public Skill_not_be_debuffed(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + for (int i = 0; i < parameter.targetCards.Count(); i++) + { + BattleCardBase battleCardBase = parameter.targetCards.ElementAt(i); + battleCardBase.SkillApplyInformation.GiveNotBeDebuffed(); + BattleCardBase battleCardBase2 = battleCardBase; + BuffInfo buffInfo = AddBuffInfoIfNeeded(battleCardBase); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase2, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase2, buffInfo, buffInfoContainer); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.NotBeDebuffed); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + List list = new List(); + for (int i = 0; i < base.buffInfoContainer.Count; i++) + { + BuffInfoContainer buffInfoContainer = base.buffInfoContainer[i]; + buffInfoContainer._targetCard.SkillApplyInformation.DepriveNotBeDebuffed(); + list.Add(buffInfoContainer._targetCard); + buffInfoContainer._targetCard.RemoveBuffInfo(buffInfoContainer._buffInfo); + } + CallOnUpdateSkillEffect(list); + base.buffInfoContainer.Clear(); + return VfxWithLoading.Create(NullVfx.GetInstance()); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + card.SkillApplyInformation.ForceDepriveNotBeDebuffed(); + return NullVfx.GetInstance(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_not_decrease_pp.cs b/SVSim.BattleEngine/Engine/Skill_not_decrease_pp.cs new file mode 100644 index 0000000..78bea82 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_not_decrease_pp.cs @@ -0,0 +1,45 @@ +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_not_decrease_pp : SkillBase +{ + public Skill_not_decrease_pp(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + foreach (BattleCardBase targetCard in parameter.targetCards) + { + targetCard.SkillApplyInformation.GiveNotDecreasePP(); + BuffInfo buffInfo = (IsBattleLog ? AddBuffInfoIfNeeded(targetCard) : null); + buffInfoContainer.Add(new BuffInfoContainer(targetCard, buffInfo, -1, "", null, 0L)); + if (targetCard.IsClass) + { + UpdateClassBuffIfActive(targetCard); + } + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.NotDecreasePP); + } + return NullVfxWithLoading.GetInstance(); + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + foreach (BuffInfoContainer item in buffInfoContainer) + { + item._targetCard.SkillApplyInformation.DepriveNotDecreasePP(); + item._targetCard.RemoveBuffInfo(item._buffInfo); + if (item._targetCard.IsClass) + { + UpdateClassBuffIfActive(item._targetCard); + } + } + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_play_count_change.cs b/SVSim.BattleEngine/Engine/Skill_play_count_change.cs new file mode 100644 index 0000000..f2a015c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_play_count_change.cs @@ -0,0 +1,42 @@ +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_play_count_change : SkillBase +{ + public Skill_play_count_change(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int addCount = GetAddCount(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + BattlePlayerBase selfBattlePlayer = targetCard.SelfBattlePlayer; + selfBattlePlayer.AddCurrentTrunPlayCount(addCount); + if (selfBattlePlayer.ClassInformationUIController != null && IsBattleLog) + { + SkillBase getAttachSkill = base.GetAttachSkill; + if (getAttachSkill != null && getAttachSkill.SkillPrm.ownerCard.IsSpecialSkill) + { + selfBattlePlayer.ClassInformationUIController.UpdateInfomation(); + } + else + { + selfBattlePlayer.ClassInformationUIController.ShowInfomation(); + } + } + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillChangePlayCount(base.SkillPrm.ownerCard.SelfBattlePlayer.Class, addCount, this); + } + return NullVfxWithLoading.GetInstance(); + } + + public int GetAddCount() + { + return base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_count, 0); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_possess_ep_modifier.cs b/SVSim.BattleEngine/Engine/Skill_possess_ep_modifier.cs new file mode 100644 index 0000000..c599fbd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_possess_ep_modifier.cs @@ -0,0 +1,112 @@ +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_possess_ep_modifier : SkillBase +{ + public static readonly int EP_NONE = -1; + + public Skill_possess_ep_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + if (BattleManagerBase.IsForecast) + { + return NullVfxWithLoading.GetInstance(); + } + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_eptotal, 0); + int num2 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_ep, 0); + int num3 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set_ep, EP_NONE); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + int currentEpCount = targetCard.SelfBattlePlayer.CurrentEpCount; + if (num2 != 0) + { + parallelVfxPlayer.Register(AddEp(parameter.skillProcessor, num2, targetCard.SelfBattlePlayer)); + } + else if (num != 0) + { + parallelVfxPlayer.Register(AddEpTotal(parameter.skillProcessor, num, targetCard.SelfBattlePlayer)); + } + else if (num3 != EP_NONE) + { + parallelVfxPlayer.Register(SetEp(num3, targetCard.SelfBattlePlayer)); + } + int currentEpCount2 = targetCard.SelfBattlePlayer.CurrentEpCount; + int epTotal = targetCard.SelfBattlePlayer.EpTotal; + parallelVfxPlayer.Register(new EpChangeVfx(targetCard.SelfBattlePlayer, currentEpCount, currentEpCount2, epTotal)); + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillSetEP(currentEpCount2, targetCard.SelfBattlePlayer.Class, this); + } + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards, isFollowInHand: false, addToLastOperation: true)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + protected virtual VfxBase AddEp(SkillProcessor skillProcessor, int add, BattlePlayerBase battlePlayer) + { + AddToEpWithFloor(skillProcessor, add, battlePlayer); + if (battlePlayer.CurrentEpCount > battlePlayer.EpTotal) + { + battlePlayer.SetCurrentEpCount(battlePlayer.EpTotal); + } + return NullVfx.GetInstance(); + } + + private VfxBase AddEpTotal(SkillProcessor skillProcessor, int add, BattlePlayerBase battlePlayer) + { + AddToEpWithFloor(skillProcessor, add, battlePlayer); + int currentEpCount = battlePlayer.CurrentEpCount; + return UpdateUsableAndMaxEp(battlePlayer, currentEpCount); + } + + protected virtual VfxBase SetEp(int set, BattlePlayerBase battlePlayer) + { + if (set < 0) + { + return NullVfx.GetInstance(); + } + int currentEpCount = battlePlayer.CurrentEpCount; + battlePlayer.SetCurrentEpCount(set); + return UpdateUsableAndMaxEp(battlePlayer, currentEpCount); + } + + private void AddToEpWithFloor(SkillProcessor skillProcessor, int amountToAdd, BattlePlayerBase battlePlayer) + { + if (amountToAdd < 0) + { + amountToAdd *= -1; + if (battlePlayer.CurrentEpCount < amountToAdd) + { + amountToAdd = battlePlayer.CurrentEpCount; + } + battlePlayer.UseEpCount(amountToAdd); + battlePlayer.StartSkillWhenUseEpSelfAndOther(skillProcessor); + } + else + { + battlePlayer.AddCurrentEpCount(amountToAdd); + } + } + + private VfxBase UpdateUsableAndMaxEp(BattlePlayerBase battlePlayer, int oldMaxEpAmount) + { + if (battlePlayer.CurrentEpCount > battlePlayer.EpTotal) + { + if (battlePlayer.EpTotal == BattleManagerBase.FIRST_PLAYER_EP_NUM) + { + battlePlayer.EpTotal = BattleManagerBase.SECOND_PLAYER_EP_NUM; + battlePlayer.SetCurrentEpCount(BattleManagerBase.SECOND_PLAYER_EP_NUM); + return battlePlayer.StatusPanelControl.PlayIncreaseMaxEpAnimation(oldMaxEpAmount, battlePlayer.CurrentEpCount); + } + battlePlayer.SetCurrentEpCount(battlePlayer.EpTotal); + } + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_power_down.cs b/SVSim.BattleEngine/Engine/Skill_power_down.cs new file mode 100644 index 0000000..1555b02 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_power_down.cs @@ -0,0 +1,276 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_power_down : SkillBase +{ + public static int SETPRM_NONE = -1; + + protected int _gainOffense; + + protected int _gainLife; + + protected int _gainMaxLife; + + protected int _setOffense; + + protected int _setLife; + + protected int _setMaxLife; + + public static readonly int BIT_FLAG_BUFF_EFFECT = 1; + + public static readonly int BIT_FLAG_NOT_BUFF_EFFECT = 0; + + public static readonly string MINUS_ZERO = "-0"; + + public const string NOT_BE_DEBUFFED_EFFECT_PATH = "btl_nerva_2"; + + public Skill_power_down(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + _gainOffense = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_offense, 0); + _gainLife = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_life, 0); + _gainMaxLife = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_max_life, 0); + _setOffense = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set_offense, SETPRM_NONE); + _setLife = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set_life, SETPRM_NONE); + _setMaxLife = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set_max_life, SETPRM_NONE); + bool isMinusZeroAttack = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.gain_offense, "0") == MINUS_ZERO; + bool isMinusZeroLife = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.gain_life, "0") == MINUS_ZERO; + OffenseAddModifier offenseAddModifier = null; + LifeAddModifier lifeAddModifier = null; + OffenseSetModifier offenseSetModifier = null; + LifeSetModifier lifeSetModifier = null; + if (_setOffense != SETPRM_NONE) + { + offenseSetModifier = new OffenseSetModifier(_setOffense); + } + if (_gainOffense > 0) + { + offenseAddModifier = new OffenseAddModifier(_gainOffense * -1); + } + if (_setLife != SETPRM_NONE) + { + lifeSetModifier = new LifeSetModifier(_setLife); + } + else if (_setMaxLife != SETPRM_NONE) + { + lifeSetModifier = new MaxLifeSetModifier(_setMaxLife); + } + if (_gainMaxLife > 0) + { + lifeAddModifier = new MaxLifeAddModifier(_gainMaxLife * -1); + } + if (_gainLife > 0) + { + lifeAddModifier = new LifeAddModifier(_gainLife * -1); + } + if (offenseAddModifier == null && lifeAddModifier == null && offenseSetModifier == null && lifeSetModifier == null) + { + return NullVfxWithLoading.GetInstance(); + } + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + BattlePlayerBase selfBattlePlayer = base.SkillPrm.ownerCard.SelfBattlePlayer; + BattlePlayerBase battlePlayerBase = (selfBattlePlayer.IsSelfTurn ? selfBattlePlayer : base.SkillPrm.ownerCard.OpponentBattlePlayer); + BattlePlayerBase battlePlayerBase2 = (selfBattlePlayer.IsSelfTurn ? base.SkillPrm.ownerCard.OpponentBattlePlayer : selfBattlePlayer); + if (offenseAddModifier != null || lifeAddModifier != null) + { + battlePlayerBase.StartSkillWhenDebuffSelfAndOther(parameter.targetCards, parameter.targetCards.Where((BattleCardBase c) => c.IsInplay), parameter.skillProcessor); + battlePlayerBase2.StartSkillWhenDebuffSelfAndOther(parameter.targetCards, parameter.targetCards.Where((BattleCardBase c) => c.IsInplay), parameter.skillProcessor); + } + List list = new List(); + List list2 = new List(); + List list3 = new List(); + ParallelVfxPlayer parallelVfxPlayer2 = ParallelVfxPlayer.Create(); + foreach (BattleCardBase target in parameter.targetCards) + { + if (offenseAddModifier != null || lifeAddModifier != null || offenseSetModifier == null || lifeSetModifier == null) + { + battlePlayerBase.StartSkillWhenDebuffIncludeSetMaxLife(target, parameter.targetCards.Where((BattleCardBase c) => c.IsInplay), parameter.skillProcessor); + battlePlayerBase2.StartSkillWhenDebuffIncludeSetMaxLife(target, parameter.targetCards.Where((BattleCardBase c) => c.IsInplay), parameter.skillProcessor); + } + if (target.SkillApplyInformation.IsNotBeDebuffed) + { + if (!BattleManagerBase.GetIns().IsRecovery) + { + parallelVfxPlayer2.Register(SkillBase.CreateSingleVfx(base.SkillPrm.resourceMgr, () => target.BattleCardView.GameObject.transform.position, new List { target }, target.IsPlayer, target.BattleCardView, "btl_nerva_2", EffectMgr.EngineType.SHURIKEN, "se_btl_nerva_2", EffectMgr.MoveType.DIRECT_LEADER, EffectMgr.TargetType.SINGLE, 0f)); + } + continue; + } + int isBuffEffect = BIT_FLAG_NOT_BUFF_EFFECT; + BattleCardBase targetCard = target; + ICardOffenseModifier offenseModifire = null; + ICardLifeModifier lifeModifire = null; + list.Add(target.Atk); + list2.Add(target.Life); + list3.Add(target.MaxLife); + if (offenseSetModifier != null && lifeSetModifier != null) + { + parallelVfxPlayer.Register(targetCard.SkillApplyInformation.GiveCombatValueModifier(offenseSetModifier, lifeSetModifier, parameter.skillProcessor)); + } + if (offenseAddModifier != null && lifeAddModifier != null) + { + parallelVfxPlayer.Register(targetCard.SkillApplyInformation.GiveCombatValueModifier(offenseAddModifier, lifeAddModifier, parameter.skillProcessor)); + } + if (offenseSetModifier != null) + { + int atk = targetCard.Atk; + if (lifeSetModifier == null) + { + parallelVfxPlayer.Register(targetCard.SkillApplyInformation.GiveCombatValueModifier(offenseSetModifier, null, parameter.skillProcessor)); + } + offenseModifire = offenseSetModifier; + if (targetCard.Atk > atk) + { + isBuffEffect = BIT_FLAG_BUFF_EFFECT; + } + else if (targetCard.Atk == atk) + { + isBuffEffect = BIT_FLAG_NOT_BUFF_EFFECT; + } + } + if (offenseAddModifier != null) + { + if (lifeAddModifier == null) + { + parallelVfxPlayer.Register(targetCard.SkillApplyInformation.GiveCombatValueModifier(offenseAddModifier, null, parameter.skillProcessor)); + } + offenseModifire = offenseAddModifier; + } + if (lifeSetModifier != null) + { + int life = targetCard.Life; + if (offenseSetModifier == null) + { + parallelVfxPlayer.Register(targetCard.SkillApplyInformation.GiveCombatValueModifier(null, lifeSetModifier, parameter.skillProcessor)); + } + if (targetCard.IsDead) + { + parallelVfxPlayer.Register(targetCard.SelfBattlePlayer.CardManagement(targetCard, parameter.skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.DESTROY, base.UsedRandom, null, null, this)); + } + lifeModifire = lifeSetModifier; + if (targetCard.Life > life) + { + isBuffEffect = BIT_FLAG_BUFF_EFFECT; + } + else if (targetCard.Life == life) + { + isBuffEffect = BIT_FLAG_NOT_BUFF_EFFECT; + } + } + if (lifeAddModifier != null) + { + if (offenseAddModifier == null) + { + parallelVfxPlayer.Register(targetCard.SkillApplyInformation.GiveCombatValueModifier(null, lifeAddModifier, parameter.skillProcessor)); + } + if (targetCard.IsDead) + { + parallelVfxPlayer.Register(targetCard.SelfBattlePlayer.CardManagement(targetCard, parameter.skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.DESTROY, base.UsedRandom, null, null, this)); + } + lifeModifire = lifeAddModifier; + } + if (offenseAddModifier != null || lifeAddModifier != null || offenseSetModifier != null || lifeSetModifier != null) + { + BuffInfo buff = AddBuffInfoIfNeeded(target); + BuffInfoContainer powerDown = new BuffInfoContainer(target, buff, isBuffEffect, "", null, 0L, null, null, offenseModifire, lifeModifire); + buffInfoContainer.Add(powerDown); + targetCard.OnRemoveFromInPlayAfterOneTime += delegate + { + buffInfoContainer.Remove(powerDown); + targetCard.RemoveBuffInfo(buff); + if ((isBuffEffect & BIT_FLAG_BUFF_EFFECT) != 0) + { + targetCard.SkillApplyInformation.FourceDepriveBuff(); + } + else + { + targetCard.SkillApplyInformation.FourceDepriveDebuff(); + } + return targetCard.SkillApplyInformation.ForceDepriveCombatValueModifire(); + }; + } + if (offenseAddModifier != null && lifeAddModifier != null) + { + if ((isBuffEffect & BIT_FLAG_BUFF_EFFECT) != 0) + { + targetCard.SkillApplyInformation.GiveBuff(); + } + else + { + targetCard.SkillApplyInformation.GiveDebuff(); + } + } + } + if (IsBattleLog && parameter.targetCards.Count((BattleCardBase t) => !t.SkillApplyInformation.IsNotBeDebuffed) > 0) + { + List buffCards = parameter.targetCards.Where((BattleCardBase t) => !t.SkillApplyInformation.IsNotBeDebuffed).ToList(); + bool isTargetInOpponentHand = IsTargetInOpponentHand() && (!base.IsContainSelfFilter || !base.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessOpenCard)); + if (_setOffense != SETPRM_NONE || _setLife != SETPRM_NONE) + { + BattleLogManager.GetInstance().AddLogSkillBuffSet(buffCards, _setOffense, _setLife, this, isTargetInOpponentHand, list, list2); + } + if (_setMaxLife != SETPRM_NONE) + { + BattleLogManager.GetInstance().AddLogSkillBuffSetMaxLife(buffCards, _setMaxLife, this, list3); + } + if (_gainMaxLife > 0) + { + BattleLogManager.GetInstance().AddLogSkillBuffAddMaxLife(buffCards, -_gainMaxLife, this); + } + if (_gainOffense > 0 || _gainLife > 0) + { + BattleLogManager.GetInstance().AddLogSkillBuffAdd(buffCards, -_gainOffense, -_gainLife, this, isMinusZeroAttack, isMinusZeroLife); + } + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer2); + SkillPreprocessBase skillPreprocessBase = base.PreprocessList.FirstOrDefault((SkillPreprocessBase p) => p is SkillPreprocessOpenCard); + if (skillPreprocessBase != null && base.ApplyingTargetFilter is SkillTargetHandSelfFilter) + { + vfxWithLoadingSequential.RegisterToMainVfx((skillPreprocessBase as SkillPreprocessOpenCard).CreateOpenCardVfx(this)); + } + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + BattleCardBase targetCard = item._targetCard; + parallelVfxPlayer.Register(targetCard.SkillApplyInformation.DepriveCombatValueModifire(item.OffenseModifier, item.LifeModifier)); + targetCard.RemoveBuffInfo(item._buffInfo); + if ((item._intValue & BIT_FLAG_BUFF_EFFECT) != 0) + { + targetCard.SkillApplyInformation.DepriveBuff(); + } + else + { + targetCard.SkillApplyInformation.DepriveDebuff(); + } + } + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + private int SetOffensetSub(BattleCardBase card, int setOffense) + { + int atk = card.Atk; + return setOffense - atk; + } + + private int SetLifeSub(BattleCardBase card, int setLife) + { + int num = (card.IsEvolution ? card.BaseParameter.EvoLife : card.BaseParameter.Life); + return setLife - num; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_power_modifier.cs b/SVSim.BattleEngine/Engine/Skill_power_modifier.cs new file mode 100644 index 0000000..92f1ce1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_power_modifier.cs @@ -0,0 +1,44 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_power_modifier : Skill_powerup +{ + public override bool IsTargetIndicate => false; + + public Skill_power_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + protected override void RegisterWhenBuffInfo(BattleCardBase card, CallParameter parameter) + { + if (_addOffense > 0 || _addLife > 0) + { + BattlePlayerPair playerInfoPair = new BattlePlayerPair(card.SelfBattlePlayer, card.OpponentBattlePlayer); + parameter.skillProcessor.Register(card.Skills.CreateWhenBuffInfo(parameter.skillProcessor, playerInfoPair, card)); + } + } + + protected override VfxBase DeadCheck(BattleCardBase targetCard, SkillProcessor skillProcessor) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (targetCard.IsDead) + { + sequentialVfxPlayer.Register(targetCard.SelfBattlePlayer.CardManagement(targetCard, skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.DESTROY, base.UsedRandom, null, null, this)); + } + return sequentialVfxPlayer; + } + + protected override void AddBattleLog(IEnumerable targetCards) + { + base.AddBattleLog(targetCards); + List list = targetCards.Where((BattleCardBase c) => c.IsLifeZeroDead).ToList(); + if (list.Count > 0) + { + BattleLogManager.GetInstance().AddLogSkillBuffAdd(list, -_gainOffense, -_gainLife, this, isMinusZeroAttack: false, isMinusZeroLife: false); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_pp_modifier.cs b/SVSim.BattleEngine/Engine/Skill_pp_modifier.cs new file mode 100644 index 0000000..1156797 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_pp_modifier.cs @@ -0,0 +1,147 @@ +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_pp_modifier : SkillBase +{ + public static readonly int PP_NONE = -1; + + protected int _decreaseTurnPp = PP_NONE; + + public Skill_pp_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_pptotal, 0); + int num2 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set_pptotal, PP_NONE); + int num3 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_pp, 0); + int num4 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.gain_pp, PP_NONE); + int num5 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.set_pp, PP_NONE); + _decreaseTurnPp = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.decrease_turn_pp, PP_NONE); + bool isBattleLog = IsBattleLog; + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + BattleCardBase battleCardBase = targetCard; + BattlePlayerBase selfBattlePlayer = battleCardBase.SelfBattlePlayer; + int ppTotal = battleCardBase.SelfBattlePlayer.PpTotal; + int pp = battleCardBase.SelfBattlePlayer.Pp; + if (num != 0) + { + selfBattlePlayer.AddPpTotal(num, isUpdatePp: false, parameter.skillProcessor, base.SkillPrm.ownerCard, bySkill: true); + parallelVfxPlayer.Register(new PpIncreaseVfx(selfBattlePlayer, ppTotal, selfBattlePlayer.PpTotal)); + } + else if (num2 != PP_NONE) + { + base.SkillPrm.selfBattlePlayer.SetPpTotal(num2, isUpdatePp: false, parameter.skillProcessor); + parallelVfxPlayer.Register(new PpIncreaseVfx(selfBattlePlayer, pp, selfBattlePlayer.Pp)); + } + if (num3 != 0) + { + AddPp(selfBattlePlayer, num3); + targetCard.SkillApplyInformation.AddPp(num3, ins.CurrentTurn, ins.BattlePlayer.IsSelfTurn); + selfBattlePlayer.StartSkillWhenPpHealing(parameter.skillProcessor); + } + else if (num4 > PP_NONE) + { + AddPp(selfBattlePlayer, -num4); + selfBattlePlayer.AddGameUsedPp(num4); + } + else if (num5 != PP_NONE) + { + SetPp(selfBattlePlayer, num5); + } + if (_decreaseTurnPp != PP_NONE) + { + BuffInfo buffInfo = AddBuffInfoIfNeeded(battleCardBase); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, _decreaseTurnPp, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + battleCardBase.SkillApplyInformation.GiveDecreaseTurnStartPP(_decreaseTurnPp); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + } + parallelVfxPlayer.Register(new PpChangeVfx(selfBattlePlayer)); + int ppTotal2 = selfBattlePlayer.PpTotal; + int pp2 = selfBattlePlayer.Pp; + selfBattlePlayer.UpdateHandCardsPlayability(); + if (isBattleLog) + { + if (ppTotal2 - ppTotal != 0 || num3 != 0) + { + bool flag = ppTotal2 - ppTotal != 0; + int changePP = (flag ? (ppTotal2 - ppTotal) : (pp2 - pp)); + BattleLogManager.GetInstance().AddLogSkillChangePP(battleCardBase, changePP, ppTotal, flag, this); + } + else if (num4 > 0) + { + BattleLogManager.GetInstance().AddLogSkillChangePP(battleCardBase, -num4, ppTotal, isTotal: false, this); + } + } + } + if (isBattleLog && _decreaseTurnPp != PP_NONE) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.DecreaseTurnPP, _decreaseTurnPp); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveDecreaseTurnStartPP(item._intValue); + item._targetCard.RemoveBuffInfo(item._buffInfo); + if (item._targetCard.IsClass) + { + UpdateClassBuffIfActive(item._targetCard); + } + parallelVfxPlayer.Register(vfx); + } + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + protected virtual void AddPp(BattlePlayerBase player, int add) + { + player.Pp += add; + if (player.Pp < 0) + { + player.Pp = 0; + } + else if (player.Pp > 10) + { + player.Pp = 10; + } + if (player.PpTotal < player.Pp) + { + player.Pp = player.PpTotal; + } + } + + private void SetPp(BattlePlayerBase player, int set) + { + player.Pp = set; + if (player.PpTotal < player.Pp) + { + player.Pp = player.PpTotal; + } + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveDecreaseTurnStartPP(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_quick.cs b/SVSim.BattleEngine/Engine/Skill_quick.cs new file mode 100644 index 0000000..c66d800 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_quick.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_quick : SkillBase +{ + public Skill_quick(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfxToRegister = targetCard.SkillApplyInformation.GiveQuick(); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + List list = new List(); + list.Add(targetCard); + BattlePlayerPair playerInfoPair = new BattlePlayerPair(battleCardBase.SelfBattlePlayer, battleCardBase.OpponentBattlePlayer); + parameter.skillProcessor.Register(battleCardBase.Skills.CreateWhenAttachAbilityInfo(parameter.skillProcessor, playerInfoPair, this, BattlePlayerBase.ConvertToSkillInfoCollection(list))); + vfxWithLoadingSequential.RegisterToMainVfx(vfxToRegister); + } + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.Quick); + } + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + parallelVfxPlayer.Register(item._targetCard.SkillApplyInformation.DepriveQuick()); + list.Add(item._targetCard); + item._targetCard.RemoveBuffInfo(item._buffInfo); + } + CallOnUpdateSkillEffect(list, updateAttackEffect: true); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveQuick(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_random_array.cs b/SVSim.BattleEngine/Engine/Skill_random_array.cs new file mode 100644 index 0000000..17bda7c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_random_array.cs @@ -0,0 +1,126 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_random_array : SkillBase +{ + public override bool IsAllowDestroyTarget => true; + + public override bool IsShowSideLogSkillType => false; + + public Dictionary> SelectedIndex { get; protected set; } = new Dictionary>(); + + public string RandomDistinctSkill { get; protected set; } + + public Skill_random_array(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + string[] array = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.is_random_distinct, "NONE").Split(':'); + RandomDistinctSkill = ((array.Length > 1) ? array[1] : "NONE"); + } + + public override VfxWithLoading Start(CallParameter parameter) + { + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.random_range, -1); + int num2 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.max, -1); + int num3 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.sum, -1); + bool flag = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.show_battle_log) == "true"; + bool flag2 = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.is_random_distinct, "NONE").Split(':')[0] == "true"; + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + if (!SelectedIndex.ContainsKey(targetCard)) + { + SelectedIndex[targetCard] = new List(); + } + int[] array = new int[num]; + for (int i = 0; i < num3; i++) + { + if (num2 != -1) + { + List list = new List(); + for (int j = 0; j < num; j++) + { + List allSkillSelectedIndex = GetAllSkillSelectedIndex(base.SkillPrm.ownerCard, targetCard); + if (array[j] < num2 && (!flag2 || !allSkillSelectedIndex.Contains(j))) + { + list.Add(j); + } + } + if (list.Count() == 0) + { + break; + } + int randomCount = GetRandomCount(list.Count); + SelectedIndex[targetCard].Add(list[randomCount]); + array[list[randomCount]]++; + } + else + { + int randomCount2 = GetRandomCount(num); + array[randomCount2]++; + } + } + sequentialVfxPlayer.Register(targetCard.SkillApplyInformation.GiveSkillRandomArray(array)); + BattleCardBase target = targetCard; + SetOnLoseEvent(target, null, null); + if (IsBattleLog && flag) + { + BattleLogManager.GetInstance().AddLogSkillRandomArray(parameter.targetCards.ToList(), array, this); + } + } + return VfxWithLoading.Create(sequentialVfxPlayer); + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + SelectedIndex.Clear(); + return base.Stop(skillProcessor); + } + + private int GetRandomCount(int range) + { + return base.SkillPrm.selfBattlePlayer.BattleMgr.StableRandom(range); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + SelectedIndex.Remove(card); + return NullVfx.GetInstance(); + }; + } + + public List GetAllSkillSelectedIndex(BattleCardBase card, BattleCardBase targetCard) + { + List list = new List(); + if (RandomDistinctSkill == "NONE") + { + if (SelectedIndex.ContainsKey(targetCard)) + { + list.AddRange(SelectedIndex[targetCard]); + } + } + else + { + list.AddRange(GetSkillSelectedIndex(card.NormalSkills, targetCard)); + list.AddRange(GetSkillSelectedIndex(card.EvolutionSkills, targetCard)); + } + return list; + } + + private List GetSkillSelectedIndex(SkillCollectionBase skills, BattleCardBase targetCard) + { + List list = new List(); + for (int i = 0; i < skills.Count(); i++) + { + if (skills.ElementAt(i) is Skill_random_array skill_random_array && skill_random_array.RandomDistinctSkill == RandomDistinctSkill && skill_random_array.SelectedIndex.ContainsKey(targetCard)) + { + list.AddRange(skill_random_array.SelectedIndex[targetCard]); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_random_attack.cs b/SVSim.BattleEngine/Engine/Skill_random_attack.cs new file mode 100644 index 0000000..90f0a07 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_random_attack.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class Skill_random_attack : SkillBase +{ + public Skill_random_attack(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + List list = parameter.targetCards.ToList(); + for (int i = 0; i < list.Count; i++) + { + BattleCardBase battleCardBase = list[i]; + buffInfoContainer.Add(new BuffInfoContainer(battleCardBase, null, -1, "", null, 0L)); + battleCardBase.SkillApplyInformation.GiveRandomAttack(); + } + return NullVfxWithLoading.GetInstance(); + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + for (int i = 0; i < buffInfoContainer.Count; i++) + { + buffInfoContainer[i]._targetCard.SkillApplyInformation.DepriveRandomAttack(); + } + buffInfoContainer.Clear(); + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_reflection.cs b/SVSim.BattleEngine/Engine/Skill_reflection.cs new file mode 100644 index 0000000..b3a90cb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_reflection.cs @@ -0,0 +1,84 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class Skill_reflection : SkillBase +{ + private class ReflectionBuffContainer : BuffInfoContainer + { + public ReflectionInfo ReflectionInfo { get; private set; } + + public ReflectionBuffContainer(BattleCardBase card, BuffInfo info, ReflectionInfo reflectionInfo) + : base(card, info, -1, "", null, 0L) + { + ReflectionInfo = reflectionInfo; + } + } + + public Skill_reflection(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter callParameter) + { + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.target, string.Empty); + string type = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, string.Empty); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + if (text == "") + { + return NullVfxWithLoading.GetInstance(); + } + ReflectionInfo reflectionInfo = new ReflectionInfo(text, type); + for (int i = 0; i < callParameter.targetCards.Count(); i++) + { + BattleCardBase battleCardBase = callParameter.targetCards.ElementAt(i); + VfxBase vfx = battleCardBase.SkillApplyInformation.GiveReflection(reflectionInfo); + parallelVfxPlayer.Register(vfx); + BuffInfo buffInfo = AddBuffInfoIfNeeded(battleCardBase); + if (battleCardBase.IsClass) + { + UpdateClassBuffIfActive(battleCardBase); + } + ReflectionBuffContainer reflectionBuffContainer = new ReflectionBuffContainer(battleCardBase, buffInfo, reflectionInfo); + buffInfoContainer.Add(reflectionBuffContainer); + SetOnLoseEvent(battleCardBase, buffInfo, reflectionBuffContainer); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, callParameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + for (int i = 0; i < buffInfoContainer.Count; i++) + { + ReflectionBuffContainer reflectionBuffContainer = buffInfoContainer[i] as ReflectionBuffContainer; + VfxBase vfx = reflectionBuffContainer._targetCard.SkillApplyInformation.DepriveReflection(reflectionBuffContainer.ReflectionInfo); + list.Add(reflectionBuffContainer._targetCard); + reflectionBuffContainer._targetCard.RemoveBuffInfo(reflectionBuffContainer._buffInfo); + if (reflectionBuffContainer._targetCard.IsClass) + { + UpdateClassBuffIfActive(reflectionBuffContainer._targetCard); + } + parallelVfxPlayer.Register(vfx); + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveReflection(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_remove_by_banish.cs b/SVSim.BattleEngine/Engine/Skill_remove_by_banish.cs new file mode 100644 index 0000000..f6aed45 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_remove_by_banish.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class Skill_remove_by_banish : SkillBase +{ + public Skill_remove_by_banish(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + List list = parameter.targetCards.ToList(); + for (int i = 0; i < list.Count; i++) + { + BattleCardBase battleCardBase = list[i]; + buffInfoContainer.Add(new BuffInfoContainer(battleCardBase, null, -1, "", null, 0L)); + battleCardBase.SkillApplyInformation.GiveRemoveByBanish(); + } + return NullVfxWithLoading.GetInstance(); + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + for (int i = 0; i < buffInfoContainer.Count; i++) + { + buffInfoContainer[i]._targetCard.SkillApplyInformation.DepriveRemoveByBanish(); + } + buffInfoContainer.Clear(); + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_remove_by_destroy.cs b/SVSim.BattleEngine/Engine/Skill_remove_by_destroy.cs new file mode 100644 index 0000000..668d1af --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_remove_by_destroy.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_remove_by_destroy : SkillBase +{ + public Skill_remove_by_destroy(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + List list = parameter.targetCards.ToList(); + for (int i = 0; i < list.Count; i++) + { + BattleCardBase battleCardBase = list[i]; + battleCardBase.SkillApplyInformation.GiveRemoveByDestroy(); + BuffInfo buffInfo = AddBuffInfoIfNeeded(battleCardBase); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.RemoveByDestroy); + } + return CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards); + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + for (int i = 0; i < buffInfoContainer.Count; i++) + { + BuffInfo buffInfo = buffInfoContainer[i]._buffInfo; + BattleCardBase targetCard = buffInfoContainer[i]._targetCard; + targetCard.SkillApplyInformation.DepriveRemoveByDestroy(); + targetCard.RemoveBuffInfo(buffInfo); + } + buffInfoContainer.Clear(); + return NullVfxWithLoading.GetInstance(); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.SkillApplyInformation.ForceDepriveRemoveByDestroy(); + buffInfoContainer.Remove(container); + card.RemoveBuffInfo(buff); + return NullVfx.GetInstance(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_repeat_skill.cs b/SVSim.BattleEngine/Engine/Skill_repeat_skill.cs new file mode 100644 index 0000000..20a8b07 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_repeat_skill.cs @@ -0,0 +1,70 @@ +using System.Linq; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +internal class Skill_repeat_skill : SkillBase +{ + public Skill_repeat_skill(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + string option = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.repeat_type); + string targetOption = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.target, "unit"); + SkillGainType gainType = SkillGainType.Null; + if (IsBattleLog) + { + string option2 = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.repeat_type, "_OPT_NULL_"); + gainType = ((option2 != null && option2 == "when_destroy") ? SkillGainType.RepeatLastWord : SkillGainType.Null); + } + foreach (BattleCardBase targetCard in parameter.targetCards) + { + if (targetCard is ClassBattleCardBase && !targetCard.SkillApplyInformation.RepeatSkillTimingList.Any((RepeatSkillInfo s) => s.Timing == option && s.Target == targetOption)) + { + vfxWithLoadingSequential.RegisterToMainVfx(targetCard.SkillApplyInformation.GiveRepeatSkill(option, targetOption, this)); + CardParameter baseParameter = base.SkillPrm.ownerCard.BaseParameter; + BuffInfo buffInfo = new BuffInfo(baseParameter.BaseCardId, baseParameter.NormalCardId, this); + targetCard.AddBuffInfo(buffInfo); + if (targetCard.IsClass) + { + UpdateClassBuffIfActive(targetCard); + } + BuffInfoContainer item = new BuffInfoContainer(targetCard, buffInfo, -1, "", null, 0L); + buffInfoContainer.Add(item); + } + } + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + if (IsBattleLog && !base.SkillPrm.selfBattlePlayer.Class.IsDead && base.SkillPrm.ownerCard.SelfBattlePlayer.Class.SkillApplyInformation.RepeatSkillTimingList.Where((RepeatSkillInfo s) => s.Timing == option).Count() <= 1) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, gainType); + } + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + foreach (BuffInfoContainer item in buffInfoContainer) + { + item._targetCard.RemoveBuffInfo(item._buffInfo); + if (item._targetCard.IsClass) + { + UpdateClassBuffIfActive(item._targetCard); + } + } + return NullVfxWithLoading.GetInstance(); + } + + public static bool CheckCardType(string cardType, BattleCardBase card) + { + if ((cardType == "unit" && card.IsUnit) || (cardType == "field" && card.IsField)) + { + return true; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_return_card.cs b/SVSim.BattleEngine/Engine/Skill_return_card.cs new file mode 100644 index 0000000..533b03b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_return_card.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_return_card : SkillBase +{ + public Skill_return_card(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + List list = parameter.targetCards.Where((BattleCardBase c) => c.IsPlayer == base.SkillPrm.ownerCard.IsPlayer).ToList(); + List list2 = parameter.targetCards.Where((BattleCardBase c) => c.IsPlayer != base.SkillPrm.ownerCard.IsPlayer).ToList(); + base.SkillPrm.ownerCard.SelfBattlePlayer.ReturnList = list; + base.SkillPrm.ownerCard.OpponentBattlePlayer.ReturnList = list2; + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List returnCards = new List(list.Count + list2.Count); + returnCards.AddRange(list); + returnCards.AddRange(list2); + for (int num = 0; num < returnCards.Count(); num++) + { + parallelVfxPlayer.Register(returnCards[num].SelfBattlePlayer.CardManagement(returnCards[num], parameter.skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.RETURN, base.UsedRandom, null, null, this)); + } + RegisterReturnOtherTriggerSkill(parameter.skillProcessor, returnCards); + increaseSkillReturnCardCount(); + List source = (base.SkillPrm.selfBattlePlayer.IsPlayer ? list : list2); + List source2 = (base.SkillPrm.selfBattlePlayer.IsPlayer ? list2 : list); + List playerCardsToReturn = source.Where((BattleCardBase c) => !c.IsDestroyedBySkill).ToList(); + List enemyCardsToReturn = source2.Where((BattleCardBase c) => !c.IsDestroyedBySkill).ToList(); + ReturnCardVfx returnCardVfx = new ReturnCardVfx(playerCardsToReturn, enemyCardsToReturn, base.SkillPrm.resourceMgr); + if (IsBattleLog) + { + BattleLogManager instance = BattleLogManager.GetInstance(); + List list3 = parameter.targetCards.Where((BattleCardBase s) => s.IsInHand).ToList(); + instance.AddLogSkillReturnCard(list3, this); + IEnumerable source3 = parameter.targetCards.Where((BattleCardBase s) => !s.IsInHand); + instance.AddLogSkillDeath(source3.Where((BattleCardBase s) => s.DeathTypeInfo.BanishDestroy || s.IsDead).ToList(), this); + instance.AddLogSkillDrawToken(source3.Where((BattleCardBase s) => !s.DeathTypeInfo.BanishDestroy && !s.IsDead).ToList(), this, isOpen: true, isOverDraw: true); + for (int num2 = 0; num2 < list3.Count(); num2++) + { + instance.UpdateFusionedCardSkillDrewCard(list3.ElementAt(num2)); + } + } + SkillProcessor skillProcessor = parameter.skillProcessor; + skillProcessor.OnSkillProcedureEnd = (Func)Delegate.Combine(skillProcessor.OnSkillProcedureEnd, (Func)delegate + { + ClearGetOnCards(returnCards); + return NullVfx.GetInstance(); + }); + return VfxWithLoading.Create(base.SkillPrm.selfBattlePlayer.BattleMgr.LoadCardResources(returnCards), SequentialVfxPlayer.Create(parallelVfxPlayer, returnCardVfx)); + } + + private void ClearGetOnCards(List cards) + { + foreach (BattleCardBase card in cards) + { + card.SkillApplyInformation.ClearGetOnCards(); + } + } + + protected virtual void RegisterReturnOtherTriggerSkill(SkillProcessor skillProcessor, List targets) + { + (base.SkillPrm.selfBattlePlayer.IsSelfTurn ? base.SkillPrm.selfBattlePlayer : base.SkillPrm.opponentBattlePlayer).StartSkillWhenReturnSkillActivate(targets, skillProcessor); + } + + private void increaseSkillReturnCardCount() + { + BattlePlayerBase battlePlayer = base.SkillPrm.ownerCard.SelfBattlePlayer; + TurnAndIntValue turnAndIntValue = battlePlayer.GameSkillReturnCardCountList.FirstOrDefault((TurnAndIntValue t) => t.IsSelfTurn == battlePlayer.IsSelfTurn && t.Turn == battlePlayer.Turn); + if (turnAndIntValue != null) + { + turnAndIntValue.Increment(); + } + else + { + battlePlayer.GameSkillReturnCardCountList.Add(new TurnAndIntValue(1, battlePlayer.Turn, battlePlayer.IsSelfTurn)); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_rob_skill.cs b/SVSim.BattleEngine/Engine/Skill_rob_skill.cs new file mode 100644 index 0000000..ff4d324 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_rob_skill.cs @@ -0,0 +1,12 @@ +public class Skill_rob_skill : SkillBaseCopy +{ + public Skill_rob_skill(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override bool IsRemain() + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_rush.cs b/SVSim.BattleEngine/Engine/Skill_rush.cs new file mode 100644 index 0000000..b82f3af --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_rush.cs @@ -0,0 +1,84 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_rush : SkillBase +{ + private class RushInfoContainer : BuffInfoContainer + { + public RushInfo RushInfo { get; private set; } + + public RushInfoContainer(BattleCardBase card, BuffInfo info, RushInfo rushInfo) + : base(card, info, -1, "", null, 0L) + { + RushInfo = rushInfo; + } + } + + protected List _targetCards; + + public Skill_rush(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + SetDuplicateBanSkillNum(); + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + _targetCards = parameter.targetCards.ToList(); + if (base.DuplicateBanSkillNum != string.Empty) + { + _targetCards = _targetCards.Where((BattleCardBase c) => !c.SkillApplyInformation.RushInfo.Any((RushInfo g) => (!base.IsDuplicateBanSelfSkill || g.OwnerCard == base.SkillPrm.ownerCard) && g.DuplicateBanSkillNum == base.DuplicateBanSkillNum)).ToList(); + } + foreach (BattleCardBase targetCard in _targetCards) + { + RushInfo rushInfo = new RushInfo(base.SkillPrm.ownerCard, base.DuplicateBanSkillNum); + VfxBase vfxToRegister = targetCard.SkillApplyInformation.GiveRush(rushInfo); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + RushInfoContainer rushInfoContainer = new RushInfoContainer(battleCardBase, buffInfo, rushInfo); + buffInfoContainer.Add(rushInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, rushInfoContainer); + List list = new List(); + list.Add(targetCard); + BattlePlayerPair playerInfoPair = new BattlePlayerPair(battleCardBase.SelfBattlePlayer, battleCardBase.OpponentBattlePlayer); + parameter.skillProcessor.Register(battleCardBase.Skills.CreateWhenAttachAbilityInfo(parameter.skillProcessor, playerInfoPair, this, BattlePlayerBase.ConvertToSkillInfoCollection(list))); + vfxWithLoadingSequential.RegisterToMainVfx(vfxToRegister); + } + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, _targetCards)); + if (IsBattleLog && _targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(_targetCards.ToList(), this, SkillGainType.Rush); + } + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + foreach (RushInfoContainer item in buffInfoContainer) + { + parallelVfxPlayer.Register(item._targetCard.SkillApplyInformation.DepriveRush(item.RushInfo)); + list.Add(item._targetCard); + item._targetCard.RemoveBuffInfo(item._buffInfo); + } + CallOnUpdateSkillEffect(list, updateAttackEffect: true); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveRush(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_select.cs b/SVSim.BattleEngine/Engine/Skill_select.cs new file mode 100644 index 0000000..089456f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_select.cs @@ -0,0 +1,14 @@ +using Wizard.Battle.View.Vfx; + +public class Skill_select : SkillBase +{ + public Skill_select(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_shield.cs b/SVSim.BattleEngine/Engine/Skill_shield.cs new file mode 100644 index 0000000..571c162 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_shield.cs @@ -0,0 +1,120 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_shield : SkillBase +{ + private class ShieldInfoContainer : BuffInfoContainer + { + public ShieldInfo ShieldInfo { get; private set; } + + public ShieldInfoContainer(BattleCardBase card, BuffInfo info, string shieldType, ShieldInfo shieldInfo) + : base(card, info, -1, shieldType, null, 0L) + { + ShieldInfo = shieldInfo; + } + } + + public const string SHIELD_TYPE_ALL = "all"; + + private SkillGainType _gainType; + + public bool IsAllDamageShield + { + get + { + if (_gainType == SkillGainType.Null || _gainType == SkillGainType.ShieldAll) + { + return !base.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessDamageAfterStop); + } + return false; + } + } + + public bool IsNextDamageShield + { + get + { + if (_gainType == SkillGainType.Null || _gainType == SkillGainType.ShieldAll) + { + return base.PreprocessList.Any((SkillPreprocessBase p) => p is SkillPreprocessDamageAfterStop); + } + return false; + } + } + + public bool IsSkillDamageShield => _gainType == SkillGainType.ShieldSkill; + + public bool IsSpellDamageShield => _gainType == SkillGainType.ShieldSpell; + + public Skill_shield(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "all"); + _gainType = base.OptionValue.GetShieldSkillGainType(SkillFilterCreator.ContentKeyword.type); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + BattleCardBase battleCardBase = targetCard; + ShieldInfo shieldInfo = new ShieldInfo(base.SkillPrm.ownerCard, text); + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + if (buffInfo != null && base.SkillPrm.ownerCard.IsClass && base.SkillPrm.ownerCard == targetCard) + { + buffInfo.IsHiddenClassLogSkill = true; + } + ShieldInfoContainer shieldInfoContainer = new ShieldInfoContainer(battleCardBase, buffInfo, text, shieldInfo); + VfxBase vfx = targetCard.SkillApplyInformation.GiveShield(shieldInfoContainer.ShieldInfo); + if (targetCard.IsClass) + { + UpdateClassBuffIfActive(targetCard); + } + buffInfoContainer.Add(shieldInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, shieldInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, _gainType); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + foreach (ShieldInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveShield(item.ShieldInfo); + list.Add(item._targetCard); + item._targetCard.RemoveBuffInfo(item._buffInfo); + if (item._targetCard.IsClass) + { + UpdateClassBuffIfActive(item._targetCard); + } + parallelVfxPlayer.Register(vfx); + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return (container is ShieldInfoContainer shieldInfoContainer) ? card.SkillApplyInformation.FourceDepriveShield(shieldInfoContainer.ShieldInfo.Type) : NullVfx.GetInstance(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_shortage_deck_win.cs b/SVSim.BattleEngine/Engine/Skill_shortage_deck_win.cs new file mode 100644 index 0000000..0753787 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_shortage_deck_win.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_shortage_deck_win : SkillBase +{ + private const string CANT_ACTIVATE_EFFECT_PATH = "btl_nerva_4"; + + public Skill_shortage_deck_win(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + List list = new List(); + foreach (BattleCardBase target in parameter.targetCards) + { + if (target.SkillApplyInformation.IsCantActivateShortageDeckWin) + { + vfxWithLoadingSequential.RegisterVfxWithLoading(SkillBase.CreateAreaVfx(base.SkillPrm.resourceMgr, () => target.BattleCardView.GameObject.transform.position, base.SkillPrm.selfBattlePlayer.GetFieldCenterPosition(), base.SkillPrm.ownerCard.IsPlayer, base.SkillPrm.ownerCard.BattleCardView, "btl_nerva_4", EffectMgr.EngineType.SHURIKEN, "se_btl_nerva_4", EffectMgr.MoveType.DIRECT_DECK, EffectMgr.TargetType.AREA_SELF, 0f)); + continue; + } + list.Add(target); + target.SkillApplyInformation.GiveShortageDeckWin(); + BuffInfo buffInfo = AddBuffInfoIfNeeded(target); + BattleCardBase battleCardBase = target; + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + } + base.SkillPrm.selfBattlePlayer.StartSkillWhenShortageDeckWinSkillActivate(parameter.targetCards.ToList(), parameter.skillProcessor); + if (list.Count <= 0) + { + return vfxWithLoadingSequential; + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillShortageDeckWin(list.ToList(), this); + } + vfxWithLoadingSequential.RegisterToMainVfx(CreateSingleVfx(BattleManagerBase.GetIns().BattleResourceMgr, () => Vector3.zero, list)); + vfxWithLoadingSequential.RegisterToMainVfx(new SetShortageDeckWinVfx(base.SkillPrm.ownerCard.SelfBattlePlayer.IsPlayer)); + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnEffect(base.SkillPrm.buildInfo, isFollowInHand: false, isTargetPosition: true); + return vfxWithLoadingSequential; + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.ForceDepriveShortageDeckWin(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_sneak.cs b/SVSim.BattleEngine/Engine/Skill_sneak.cs new file mode 100644 index 0000000..49e649c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_sneak.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_sneak : SkillBase +{ + public Skill_sneak(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard2 in parameter.targetCards) + { + VfxBase vfx = targetCard2.SkillApplyInformation.GiveSneak(); + BattleCardBase targetCard = targetCard2; + BuffInfo buff = AddBuffInfoIfNeeded(targetCard2); + BuffInfoContainer container = new BuffInfoContainer(targetCard, buff, -1, "", null, 0L); + buffInfoContainer.Add(container); + SetOnLoseEvent(targetCard, buff, container); + targetCard.OnAfterAddDamage += delegate + { + targetCard.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return targetCard.SkillApplyInformation.FourceDepriveSneak(); + }; + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.Sneak); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveSneak(); + list.Add(item._targetCard); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.FourceDepriveSneak(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_special_lose.cs b/SVSim.BattleEngine/Engine/Skill_special_lose.cs new file mode 100644 index 0000000..ecaa598 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_special_lose.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class Skill_special_lose : SkillBase +{ + protected const string OPTION_TRUE = "true"; + + private const string OPTION_WHEN_SPECIAL_LOSE = "when_special_lose"; + + public Skill_special_lose(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + if (BattleManagerBase.IsForecast) + { + return NullVfxWithLoading.GetInstance(); + } + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + IEnumerable targetCards = parameter.targetCards; + bool flag = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.ignore_vibration, "_OPT_NULL_") == "true"; + bool flag2 = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.invalid_ability, "_OPT_NULL_") == "when_special_lose"; + foreach (BattleCardBase targetCard in parameter.targetCards) + { + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(targetCard.SelfBattlePlayer, targetCard.OpponentBattlePlayer); + SkillProcessor.ProcessInfo processInfo = targetCard.SelfBattlePlayer.Class.Skills.CreateWhenSpecialLose(parameter.skillProcessor, playerInfoPair); + if (processInfo != null && !flag2) + { + parameter.skillProcessor.Register(processInfo); + continue; + } + targetCard.SelfBattlePlayer.Class.FlagCardAsDestroyedBySkill(); + sequentialVfxPlayer.Register(targetCard.OpponentBattlePlayer.BattleMgr.PlaySpecialWin(targetCard.OpponentBattlePlayer)); + } + List list = new List(); + foreach (BattleCardBase item in targetCards) + { + list.Add(item.SelfBattlePlayer.Class); + } + VfxWithLoading vfxWithLoading = CreateSkillEffect(base.SkillPrm.resourceMgr, list); + VfxBase vfx = SequentialVfxPlayer.Create(WaitVfx.Create(base.SkillPrm.buildInfo._effectTime), InstantVfx.Create(delegate + { + Skill_special_win.ShakeScreen(); + })); + SetInductionVoiceIndex(isSpecialWin: true); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(vfxWithLoading.MainVfx, CreateSkillActivationVoiceVfx()); + if (!flag) + { + parallelVfxPlayer.Register(vfx); + } + VfxBase mainVfx = SequentialVfxPlayer.Create(parallelVfxPlayer, sequentialVfxPlayer); + return VfxWithLoading.Create(vfxWithLoading.LoadingVfx, mainVfx); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_special_token_draw.cs b/SVSim.BattleEngine/Engine/Skill_special_token_draw.cs new file mode 100644 index 0000000..14d0397 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_special_token_draw.cs @@ -0,0 +1,186 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard; +using Wizard.Battle; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_special_token_draw : SkillBase +{ + private const string TOKEN_EFFECT_PATH = "cmn_token_draw_1"; + + public const float BEFORE_TRANSFORM_WAIT_TIME = 0f; + + public const float AFTER_TRANSFORM_WAIT_TIME = 0.2f; + + protected IEnumerable _beforeTransformTokenId; + + protected IEnumerable _afterTransformTokenId; + + protected float _beforeChangeWaitTime; + + protected float _afterChangeWaitTime; + + protected string _transformEffectPath; + + protected BattlePlayerBase _playerSide; + + protected BattlePlayerBase _selfBattlePlayer; + + public override bool IsTargetIndicate => false; + + public override bool IsAllowDestroyTarget => true; + + public Skill_special_token_draw(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + if (!CreateTokenInfo(parameter.targetCards)) + { + parameter.calledSkillResultInfo.drawCards = new List(); + return NullVfxWithLoading.GetInstance(); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + int cardTotalNum = _playerSide.cardTotalNum; + _playerSide.cardTotalNum++; + VfxWith> vfxWith = CreateTokenObjectAndView(cardTotalNum, isBeforeTransform: true); + VfxWith> vfxWith2 = CreateTokenObjectAndView(cardTotalNum, isBeforeTransform: false); + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxWith.Vfx); + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxWith2.Vfx); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateTokenDrawVfx(parameter, vfxWith.Value, vfxWith2.Value, _playerSide)); + return vfxWithLoadingSequential; + } + + private VfxWith> CreateTokenObjectAndView(int index, bool isBeforeTransform) + { + List list = new List(); + IEnumerable source = (isBeforeTransform ? _beforeTransformTokenId : _afterTransformTokenId); + for (int i = 0; i < source.Count(); i++) + { + int num = source.ElementAt(i); + int id = num; + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(num); + if (IsMakeFoil) + { + id = cardParameterFromId.FoilCardId; + } + BattleCardBase battleCardBase = CreateTokenCard(_playerSide, id, index); + battleCardBase.SetOnDraw(draw: true); + list.Add(battleCardBase); + } + return new VfxWith>(base.SkillPrm.selfBattlePlayer.BattleMgr.LoadCardResources(list), list); + } + + protected bool CreateTokenInfo(IEnumerable targetCards) + { + _selfBattlePlayer = base.SkillPrm.selfBattlePlayer; + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.before_transform_token_draw, "_OPT_NULL_"); + string text2 = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.after_transform_token_draw, "_OPT_NULL_"); + _playerSide = base.SkillPrm.ownerCard.SelfBattlePlayer; + bool flag = false; + if (text != "_OPT_NULL_" && text2 != "_OPT_NULL_") + { + _beforeTransformTokenId = SkillOptionValue.ParseOptionTokenID(text); + _afterTransformTokenId = SkillOptionValue.ParseOptionTokenID(text2); + flag = true; + } + if (!flag) + { + return false; + } + if (_beforeTransformTokenId.Count() == 0 || _afterTransformTokenId.Count() == 0) + { + return false; + } + return true; + } + + protected VfxWithLoading CreateTokenDrawVfx(CallParameter parameter, List beforeTransformDrawList, List afterTransformDrawList, BattlePlayerBase playerSide) + { + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + afterTransformDrawList = playerSide.DrawCards(afterTransformDrawList, parameter.skillProcessor, isOpen: false, isMulligan: false, isToken: true, isSkillDraw: true, this, isReservation: false, parameter.calledSkillResultInfo, base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.turn_token_draw_skill_id, -1)).Value.ToList(); + AddLastTarget(parameter, afterTransformDrawList); + parameter.calledSkillResultInfo.drawCards = BattlePlayerBase.ConvertToSkillInfoCollection(afterTransformDrawList); + if (!PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_BATTLE_EFFECT) && !string.IsNullOrEmpty(base.SkillPrm.buildInfo._effectPath)) + { + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + } + VfxWithLoading vfxWithLoading = CreateTokenSpawnVfx(this, beforeTransformDrawList.First()); + _transformEffectPath = "cmn_token_draw_1"; + _beforeChangeWaitTime = 0f; + _afterChangeWaitTime = 0.2f; + DataMgr.SpecialBattleSetting specialBattleSettingInfo = GameMgr.GetIns().GetDataMgr().SpecialBattleSettingInfo; + if (specialBattleSettingInfo != null && specialBattleSettingInfo.SpecialTokenDrawOverrideEffectPair.ContainsKey(afterTransformDrawList.First().CardId)) + { + _transformEffectPath = specialBattleSettingInfo.SpecialTokenDrawOverrideEffectPair[afterTransformDrawList.First().CardId]; + if (_transformEffectPath.Contains(":")) + { + string[] array = _transformEffectPath.Split(':'); + _transformEffectPath = array[0]; + _beforeChangeWaitTime = float.Parse(array[1]); + if (array.Count() >= 2) + { + _afterChangeWaitTime = float.Parse(array[2]); + } + } + } + vfxWithLoadingSequential.RegisterToMainVfx(new DrawSpecialTokenVfx(beforeTransformDrawList, afterTransformDrawList, vfxWithLoading.MainVfx, playerSide, this, _beforeChangeWaitTime, _afterChangeWaitTime, _transformEffectPath)); + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxWithLoading.LoadingVfx); + vfxWithLoadingSequential.RegisterToMainVfx(InstantVfx.Create(delegate + { + base.SkillPrm.selfBattlePlayer.UpdateHandCardsPlayability(); + })); + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillDrawToken(afterTransformDrawList.Where((BattleCardBase s) => s.IsInHand).ToList(), this, isOpen: true); + BattleLogManager.GetInstance().AddLogSkillDrawToken(afterTransformDrawList.Where((BattleCardBase s) => !s.IsInHand).ToList(), this, isOpen: true, isOverDraw: true); + } + return vfxWithLoadingSequential; + } + + protected virtual BattleCardBase CreateTokenCard(BattlePlayerBase player, int id, int index) + { + return player.CreateCard(id, index); + } + + public static VfxWithLoading CreateTokenSpawnVfx(SkillBase skill, BattleCardBase firstToken) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + return NullVfxWithLoading.GetInstance(); + } + float animationTime = 0f; + Color color = firstToken.Clan switch + { + CardBasePrm.ClanType.MIN => Global.EFFECT_COLOR_ELF, + CardBasePrm.ClanType.ROYAL => Global.EFFECT_COLOR_ROYAL, + CardBasePrm.ClanType.WITCH => Global.EFFECT_COLOR_WITCH_1, + CardBasePrm.ClanType.DRAGON => Global.EFFECT_COLOR_DRAGON, + CardBasePrm.ClanType.NECRO => Global.EFFECT_COLOR_NECROMANCER, + CardBasePrm.ClanType.VAMPIRE => Global.EFFECT_COLOR_VANPIRE, + CardBasePrm.ClanType.BISHOP => Global.EFFECT_COLOR_BISHOP, + CardBasePrm.ClanType.NEMESIS => Global.EFFECT_COLOR_NEMESIS, + _ => Color.clear, + }; + string text = "cmn_token_draw_1"; + DataMgr.SpecialBattleSetting specialBattleSettingInfo = GameMgr.GetIns().GetDataMgr().SpecialBattleSettingInfo; + if (specialBattleSettingInfo != null && specialBattleSettingInfo.TokenDrawOverrideEffectPair.ContainsKey(firstToken.CardId)) + { + text = specialBattleSettingInfo.TokenDrawOverrideEffectPair[firstToken.CardId]; + if (text.Contains(":")) + { + string[] array = text.Split(':'); + text = array[0]; + animationTime = float.Parse(array[1]); + } + color = Color.clear; + } + Func func = () => firstToken.BattleCardView.GameObject.transform.position; + return skill.CreateSkillEffectFromPath(text, "se_" + text, skill.SkillPrm.resourceMgr, EffectMgr.EngineType.SHURIKEN, EffectMgr.MoveType.DIRECT, func, func, animationTime, color); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_special_win.cs b/SVSim.BattleEngine/Engine/Skill_special_win.cs new file mode 100644 index 0000000..b7f0711 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_special_win.cs @@ -0,0 +1,75 @@ +using System.Collections.Generic; +using UnityEngine; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class Skill_special_win : SkillBase +{ + private const int SHAKE_SCREEN_MAX_VALUE = 10; + + private const float SHAKE_CAMERA_VECTOR_VALUE = 0.02f; + + private const float SHAKE_CAMERA_TIME_COEFFICIENT = 0.05f; + + private const float SHAKE_CAMERA_TIME_OFFSET = 0.2f; + + private const string OPTION_WHEN_SPECIAL_LOSE = "when_special_lose"; + + public Skill_special_win(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + if (BattleManagerBase.IsForecast) + { + return NullVfxWithLoading.GetInstance(); + } + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + IEnumerable targetCards = parameter.targetCards; + bool flag = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.invalid_ability, "_OPT_NULL_") == "when_special_lose"; + foreach (BattleCardBase targetCard in parameter.targetCards) + { + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(targetCard.OpponentBattlePlayer, targetCard.SelfBattlePlayer); + SkillProcessor.ProcessInfo processInfo = targetCard.OpponentBattlePlayer.Class.Skills.CreateWhenSpecialLose(parameter.skillProcessor, playerInfoPair); + if (processInfo != null && !flag) + { + parameter.skillProcessor.Register(processInfo); + if (!BattleManagerBase.GetIns().IsRecovery) + { + BattleCardBase targetClass = targetCard.OpponentBattlePlayer.Class; + sequentialVfxPlayer.Register(SkillBase.CreateSingleVfx(base.SkillPrm.resourceMgr, () => targetClass.BattleCardView.GameObject.transform.position, new List { targetClass }, targetClass.IsPlayer, targetClass.BattleCardView, "btl_nerva_2", EffectMgr.EngineType.SHURIKEN, "se_btl_nerva_2", EffectMgr.MoveType.DIRECT_LEADER, EffectMgr.TargetType.SINGLE, 0f)); + } + } + else + { + targetCard.OpponentBattlePlayer.Class.FlagCardAsDestroyedBySkill(); + sequentialVfxPlayer.Register(targetCard.SelfBattlePlayer.BattleMgr.PlaySpecialWin(targetCard.SelfBattlePlayer)); + } + } + List list = new List(); + foreach (BattleCardBase item in targetCards) + { + list.Add(item.OpponentBattlePlayer.Class); + } + VfxWithLoading vfxWithLoading = CreateSkillEffect(base.SkillPrm.resourceMgr, list); + VfxBase vfxBase = SequentialVfxPlayer.Create(WaitVfx.Create(base.SkillPrm.buildInfo._effectTime), InstantVfx.Create(delegate + { + ShakeScreen(); + })); + SetInductionVoiceIndex(isSpecialWin: true); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(vfxWithLoading.MainVfx, CreateSkillActivationVoiceVfx(), vfxBase); + VfxBase mainVfx = SequentialVfxPlayer.Create(parallelVfxPlayer, sequentialVfxPlayer); + return VfxWithLoading.Create(vfxWithLoading.LoadingVfx, mainVfx); + } + + public static void ShakeScreen(int shakeScreenMinValue = 10) + { + BattleManagerBase ins = BattleManagerBase.GetIns(); + float num = Mathf.Min(10, shakeScreenMinValue); + BattleCamera camera = ins.Camera; + ins.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(camera.ShakeCamera(Vector3.one * (num * 0.02f), num * 0.05f + 0.2f, 0f), WaitVfx.Create(num * 0.05f + 0.2f), camera.ShakeComplete())); + ins.BackGround.StartFieldShake(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_spell_charge.cs b/SVSim.BattleEngine/Engine/Skill_spell_charge.cs new file mode 100644 index 0000000..71e367a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_spell_charge.cs @@ -0,0 +1,85 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class Skill_spell_charge : SkillBase +{ + public static int SPELL_CHARGE_SUMMARY_COUNT = 10; + + public static readonly float SPELL_CHARGE_INTERVAL = 0.3f; + + public static readonly float SPELL_CHARGE_SUMMARY_INTERVAL = 0.4f; + + protected List _targetCards; + + protected List _addList; + + public override bool IsTargetIndicate => false; + + public int AddCount { get; private set; } + + public int DiffAddCount { get; private set; } + + public Skill_spell_charge(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + _targetCards = new List(); + _addList = new List(); + AddCount = GetAddBoostCount(); + DiffAddCount = GetDiffBoostCount(); + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(base.SkillPrm.selfBattlePlayer, base.SkillPrm.opponentBattlePlayer); + IEnumerable enumerable = parameter.targetCards.Where((BattleCardBase s) => s.IsInHand || s.IsInDeck); + if (enumerable.Count() == 0 || (AddCount == 0 && DiffAddCount == 0)) + { + return NullVfxWithLoading.GetInstance(); + } + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase item in enumerable) + { + if (DiffAddCount > 0) + { + AddCount = DiffAddCount - item.SpellChargeCount; + if (AddCount <= 0) + { + continue; + } + } + if (item.HasSpellCharge) + { + _targetCards.Add(item); + _addList.Add(AddCount); + parameter.skillProcessor.Register(item.Skills.CreateWhenSpellChargeInfo(parameter.skillProcessor, playerInfoPair, AddCount)); + if ((item.IsPlayer || GameMgr.GetIns().IsAdminWatch) && !item.IsInDeck) + { + parallelVfxPlayer.Register(item.GetSpellChargeLoopEffect(AddCount)); + } + } + else + { + item.AddSpellChargeCount(AddCount); + } + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, enumerable)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + VfxWithLoadingSequential vfxWithLoadingSequential2 = base.SkillPrm.selfBattlePlayer.AddSpellChargeCountVfx(_targetCards, _addList); + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxWithLoadingSequential2.LoadingVfx); + vfxWithLoadingSequential.RegisterToMainVfx(vfxWithLoadingSequential2.MainVfx); + return vfxWithLoadingSequential; + } + + public int GetAddBoostCount() + { + return base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.add_charge, 0); + } + + public int GetDiffBoostCount() + { + return base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.diff_charge, 0); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_stack_white_ritual.cs b/SVSim.BattleEngine/Engine/Skill_stack_white_ritual.cs new file mode 100644 index 0000000..f240d42 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_stack_white_ritual.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_stack_white_ritual : SkillBase +{ + public const int DEFAULT_WHITE_RITUAL_COUNT = 1; + + protected int _addCount; + + public int InitialWhiteRitualStack { get; private set; } + + public Skill_stack_white_ritual(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + InitialWhiteRitualStack = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.white_ritual_stack, 1); + } + + protected List GetStackTarget() + { + return base.SkillPrm.selfBattlePlayer.InPlayCards.Where((BattleCardBase c) => c != base.SkillPrm.ownerCard && c.IsTribe(CardBasePrm.TribeType.WHITE_RITUAL) && (c.IsField || c.IsChantField)).ToList(); + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + _addCount = 0; + List stackTarget = GetStackTarget(); + for (int i = 0; i < stackTarget.Count(); i++) + { + BattleCardBase target = stackTarget[i]; + parallelVfxPlayer.Register(target.SelfBattlePlayer.CardManagement(target, parameter.skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.BANISH, base.UsedRandom)); + if (base.SkillPrm.selfBattlePlayer.BanishList.Any((BattleCardBase c) => c == target)) + { + _addCount += target.SkillApplyInformation.WhiteRitualCount; + list.Add(target); + } + } + base.SkillPrm.ownerCard.SkillApplyInformation.GiveWhiteRitualCount(_addCount); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + vfxWithLoadingSequential.RegisterToMainVfx(new ChangeWhiteRitualCountVfx(base.SkillPrm.ownerCard, _addCount)); + if (base.SkillPrm.ownerCard.HasStackWhiteRitualAndOtherIconSkill()) + { + vfxWithLoadingSequential.RegisterToMainVfx(base.SkillPrm.ownerCard.BattleCardView.InitializeBattleCardIcon(base.SkillPrm.ownerCard, base.SkillPrm.ownerCard.Skills, _addCount != 0)); + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillDeath(list, this); + BattleLogManager.GetInstance().AddLogGiveWhiteRitualStack(_addCount, base.SkillPrm.ownerCard, this); + } + return vfxWithLoadingSequential; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_summon_card.cs b/SVSim.BattleEngine/Engine/Skill_summon_card.cs new file mode 100644 index 0000000..f1e4598 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_summon_card.cs @@ -0,0 +1,181 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.Resource; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_summon_card : SkillBaseSummon +{ + protected SummonedCardsList _summonedCardsList; + + public bool IsDeckSelfSummon => base.IsDeckSelfSkill; + + public Skill_summon_card(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + InitSummonParameter(); + base.SkillPrm.ownerCard.SelfBattlePlayer.SkillSummonedCards = new List(); + int count = base.SkillPrm.selfBattlePlayer.DeckCardList.Count; + SUMMON_TYPE sUMMON_TYPE = SUMMON_TYPE.DESTROYED; + foreach (BattleCardBase card in parameter.targetCards) + { + if (base.SkillPrm.selfBattlePlayer.DeckCardList.Any((BattleCardBase p) => p == card)) + { + sUMMON_TYPE = SUMMON_TYPE.DECK; + break; + } + if (base.SkillPrm.selfBattlePlayer.HandCardList.Any((BattleCardBase p) => p == card)) + { + sUMMON_TYPE = SUMMON_TYPE.HAND; + break; + } + } + if (sUMMON_TYPE == SUMMON_TYPE.DESTROYED && !parameter.targetCards.Any((BattleCardBase c) => c.IsDead)) + { + return NullVfxWithLoading.GetInstance(); + } + _summonedCardsList = CreateSummonedCardsList(parameter.targetCards); + if (!_summonedCardsList.Any()) + { + return NullVfxWithLoading.GetInstance(); + } + if (IsCantSummon()) + { + return NullVfxWithLoading.GetInstance(); + } + CallOnSummonCards(); + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillSummon(_summonedCardsList.summonedCards.ToList(), this); + } + BattlePlayerBase.SummonInfo summonInfo = new BattlePlayerBase.SummonInfo(base.SkillPrm.ownerCard.IsPlayer, _summonedCardsList, sUMMON_TYPE, isReanimate: false, base.IsDeckSelfSkill); + BattlePlayerBase selfBattlePlayer = base.SkillPrm.selfBattlePlayer; + SkillProcessor skillProcessor = parameter.skillProcessor; + BattlePlayerBase.SummonInfo summonInfo2 = summonInfo; + VfxWithLoadingSequential vfxWithLoadingSequential = selfBattlePlayer.CardManagement(null, skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.SUMMON, isRandom: false, null, null, this, summonInfo2) as VfxWithLoadingSequential; + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + switch (sUMMON_TYPE) + { + case SUMMON_TYPE.HAND: + foreach (BattleCardBase summonedCards in _summonedCardsList) + { + parallelVfxPlayer.Register(RemoveHandCardFromViewVfx(summonedCards, base.SkillPrm.selfBattlePlayer, isBurialRite: false)); + parallelVfxPlayer.Register(summonedCards.StopSpellCharge()); + summonedCards.BattleCardView.SetNormalLabelEnable(isEnable: true); + } + break; + case SUMMON_TYPE.DECK: + if (GameMgr.GetIns().IsReplayBattle || !GameMgr.GetIns().IsNetworkBattle) + { + for (int num = 0; num < _summonedCardsList.summonedCards.Count(); num++) + { + _summonedCardsList.summonedCards.ElementAt(num).BattleCardView.SetNormalLabelEnable(isEnable: true); + } + } + base.SkillPrm.selfBattlePlayer.CallOnChangeDeckAfterEvent(count, parameter.skillProcessor, _summonedCardsList.summonedCards.ToList()); + break; + } + VfxWithLoading vfxWithLoading = CreateSummonCardAnimation(base.SkillPrm.ownerCard.IsPlayer, _summonedCardsList); + ParallelVfxPlayer parallelVfxPlayer2 = ParallelVfxPlayer.Create(vfxWithLoading.MainVfx); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (IsDeckSelfSummon) + { + BattleCardBase battleCardBase = _summonedCardsList.summonedCards.First(); + sequentialVfxPlayer.Register(new DeckSelfSummonVfx(battleCardBase, base.SkillPrm.resourceMgr)); + parallelVfxPlayer2.Register(new SummonCardShakeCameraVfx(battleCardBase)); + } + VfxWithLoadingSequential vfxWithLoadingSequential2 = VfxWithLoadingSequential.Create(vfxWithLoadingSequential.LoadingVfx, parallelVfxPlayer, sequentialVfxPlayer, parallelVfxPlayer2, vfxWithLoadingSequential.MainVfx); + vfxWithLoadingSequential2.RegisterToLoadingVfx(vfxWithLoading.LoadingVfx); + return vfxWithLoadingSequential2; + } + + private SummonedCardsList CreateSummonedCardsList(IEnumerable summonedCards) + { + int num = base.SkillPrm.selfBattlePlayer.ClassAndInPlayCardList.Count; + SummonedCardsList summonedCardsList = new SummonedCardsList(); + foreach (BattleCardBase summonedCard in summonedCards) + { + if (num < 6) + { + summonedCardsList.AddCardToSummonedCards(summonedCard, !IsDeckSelfSummon); + num++; + } + } + return summonedCardsList; + } + + protected override VfxWithLoading CreateSummonCardAnimation(bool isPlayer, SummonedCardsList summonedCardsList, bool isOwnerEffect = false) + { + VfxWithLoading vfxWithLoadingToRegister = CreateSummonSkillEffect(base.SkillPrm, summonedCardsList); + StartPickMultiCardVfx vfxToRegister = new StartPickMultiCardVfx(summonedCardsList, base.SkillPrm.resourceMgr, isPlayer, isToken: true, _isIgnoreVoice, _isRandomVoice, isGetoff: false, _isEvoVoice, _voiceWaitTime); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(vfxWithLoadingToRegister); + vfxWithLoadingSequential.RegisterToMainVfx(vfxToRegister); + return vfxWithLoadingSequential; + } + + protected VfxWithLoading CreateSummonSkillEffect(SkillParameter skillPrm, SummonedCardsList summonedCardsList) + { + IBattleResourceMgr resourceMgr = skillPrm.resourceMgr; + if (skillPrm.buildInfo._effectTargetType == EffectMgr.TargetType.SINGLE) + { + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + foreach (SummonedCardsList.CardEffectPair cardEffectPair in summonedCardsList.cardEffectPairList) + { + BattleCardBase targetCard = cardEffectPair.card; + VfxWithLoading vfxWithLoading = CreateSingleVfx(resourceMgr, () => targetCard.BattleCardView.CardWrapObject.transform.position, targetCard.AsIEnumerable(), addToLastOperation: true); + cardEffectPair.summonEffect = vfxWithLoading.MainVfx; + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxWithLoading.LoadingVfx); + } + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnEffect(base.SkillPrm.buildInfo, isFollowInHand: false, isTargetPosition: true, addToLastOperation: true); + return vfxWithLoadingSequential; + } + return CreateSkillEffect(resourceMgr, summonedCardsList, isFollowInHand: false, addToLastOperation: true); + } + + public static VfxBase RemoveHandCardFromViewVfx(BattleCardBase targetHandCard, BattlePlayerBase self, bool isBurialRite) + { + return InstantVfx.Create(delegate + { + self.BattleView.HandView.RemoveCardFromView(targetHandCard.BattleCardView, 0.1f); + iTween.Stop(targetHandCard.BattleCardView.GameObject); + targetHandCard.BattleCardView.GameObject.SetActive(value: false); + targetHandCard.BattleCardView.HideCanPlayEffect(); + targetHandCard.BattleCardView.ResetCardView(targetHandCard.BaseParameter); + List burialRiteOrDiscardCardHandIndexList = targetHandCard.SelfBattlePlayer.BurialRiteOrDiscardCardHandIndexList; + if (isBurialRite && burialRiteOrDiscardCardHandIndexList.Count > 0) + { + int num = burialRiteOrDiscardCardHandIndexList[0]; + burialRiteOrDiscardCardHandIndexList.RemoveAt(0); + for (int i = 0; i < burialRiteOrDiscardCardHandIndexList.Count; i++) + { + if (num < burialRiteOrDiscardCardHandIndexList[i]) + { + burialRiteOrDiscardCardHandIndexList[i]--; + } + } + } + }); + } + + public bool IsCantSummon() + { + List cantSummonList = base.SkillPrm.ownerCard.SelfBattlePlayer.Class.SkillApplyInformation.CantSummonList; + for (int i = 0; i < cantSummonList.Count; i++) + { + if (cantSummonList[i] == Skill_cant_summon.CantSummonInfo.DeckSelf && base.IsDeckSelfSkill) + { + return true; + } + } + return false; + } + + protected virtual void CallOnSummonCards() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_summon_token.cs b/SVSim.BattleEngine/Engine/Skill_summon_token.cs new file mode 100644 index 0000000..2037e0e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_summon_token.cs @@ -0,0 +1,259 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.Resource; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_summon_token : SkillBaseSummon +{ + private const string SELF_TURN_END = "self_turn_end"; + + private ApplySkillTargetFilterCollection _filters; + + protected SummonedCardsList _summonedCardsList; + + protected BattlePlayerBase _summonPlayer; + + public override bool IsTargetIndicate => false; + + public bool IsReanimate + { + get + { + if (base.ApplyCardFilterList.FirstOrDefault((ISkillCardFilter f) => f is SkillParameterCostFilter) is SkillParameterCostFilter skillParameterCostFilter && skillParameterCostFilter.GetParameterOptionText() == "<:=") + { + return base.ApplyingTargetFilter is SkillTargetDestroyedCardListFilter; + } + return false; + } + } + + public Skill_summon_token(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + ValueWithOperator valueWithOperator = base.OptionValue.GetValueWithOperator(SkillFilterCreator.ContentKeyword.base_card_id); + if (valueWithOperator != null && valueWithOperator.Operator == "!=") + { + string text = valueWithOperator.Value; + _filters = new ApplySkillTargetFilterCollection(); + if (text.First() == '{') + { + text = text.Remove(0, 1); + text = text.Remove(text.Length - 1, 1); + } + string[] array = text.Split('&'); + for (int i = 0; i < array.Length; i++) + { + SkillFilterCreator.SetupTarget(_filters, array[i], skillPrm.ownerCard, this); + } + } + } + + public override VfxWithLoading Start(CallParameter parameter) + { + _summonedCardsList = null; + InitSummonParameter(); + base.SkillPrm.ownerCard.SelfBattlePlayer.SkillSummonedCards = new List(); + IEnumerable enumerable = null; + List excludeIds = null; + if (_filters != null) + { + excludeIds = (from BattleCardBase c in _filters.Filtering(new BattlePlayerReadOnlyInfoPair(base.SkillPrm.ownerCard.SelfBattlePlayer, base.SkillPrm.ownerCard.OpponentBattlePlayer), new SkillConditionCheckerOption(), base.OptionValue) + select c.BaseParameter.BaseCardId).ToList(); + if (IsMakeFoil) + { + excludeIds = CardID2Foil(excludeIds).ToList(); + } + } + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.random_count, -1); + int num2; + if (base.OptionValue.HasInfoByName(SkillFilterCreator.ContentKeyword.repeat_count)) + { + num2 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.repeat_count); + if (num2 == -1) + { + return NullVfxWithLoading.GetInstance(); + } + } + else + { + num2 = -1; + } + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.summon_token, "_OPT_NULL_"); + string option = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.summon_side, "null"); + string option2 = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.effect, "NONE"); + bool flag = num >= 0 && !BattleManagerBase.IsForecast; + if (parameter.targetCards.Count() > 0) + { + enumerable = GetTargetId(parameter.targetCards, IsMakeFoil); + } + else if ("_OPT_NULL_" != text) + { + enumerable = SkillOptionValue.ParseOptionTokenID(text); + if (IsMakeFoil) + { + enumerable = CardID2Foil(enumerable); + } + } + if (excludeIds != null) + { + enumerable = enumerable.Where((int id) => !excludeIds.Contains(id)); + } + if (flag) + { + bool flag2 = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.is_random_distinct, "null") == "true"; + if (flag2) + { + enumerable = enumerable.Where((int id) => !base.SkillPrm.ownerCard.SkillApplyInformation.RandomSelectedCardList.Any((BattleCardBase c) => c.CardId == id)); + if (enumerable.Count() == 0) + { + return NullVfxWithLoading.GetInstance(); + } + if (base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.reset_random_distinct_by, "NONE") == "self_turn_end") + { + SetOnLoseEvent(base.SkillPrm.ownerCard, null, null); + } + } + enumerable = SkillRandomSelectFilter.Filtering(num, enumerable, base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr, flag2); + } + if (enumerable == null || enumerable.Count() == 0 || enumerable.FirstOrDefault() == 0 || num2 == 0) + { + return NullVfxWithLoading.GetInstance(); + } + if (num2 > 0) + { + List list = new List(); + for (int num3 = 0; num3 < enumerable.Count(); num3++) + { + for (int num4 = 0; num4 < num2; num4++) + { + list.Add(enumerable.ElementAt(num3)); + } + } + enumerable = list; + } + _summonPlayer = ((option == SkillFilterCreator.ContentKeyword.me.ToStringCustom() || option == "null") ? base.SkillPrm.selfBattlePlayer : base.SkillPrm.opponentBattlePlayer); + _summonedCardsList = CreateSummonedCardsList(parameter.targetCards, enumerable, _summonPlayer, option); + CallOnSummonTokenCards(option2 != "NONE"); + List list2 = _summonedCardsList.summonedCards.ToList(); + if (IsBattleLog && list2.Count > 0) + { + BattleLogManager.GetInstance().AddLogSkillSummon(list2, this); + } + BattlePlayerBase.SummonInfo summonInfo = new BattlePlayerBase.SummonInfo(_summonPlayer.IsPlayer, _summonedCardsList, SUMMON_TYPE.TOKEN, IsReanimate); + BattlePlayerBase selfBattlePlayer = base.SkillPrm.selfBattlePlayer; + SkillProcessor skillProcessor = parameter.skillProcessor; + BattlePlayerBase.SummonInfo summonInfo2 = summonInfo; + VfxWithLoadingSequential vfxWithLoadingToRegister = selfBattlePlayer.CardManagement(null, skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.SUMMON, isRandom: false, null, null, this, summonInfo2) as VfxWithLoadingSequential; + AddLastTarget(parameter, _summonedCardsList.ToList()); + base.SkillPrm.selfBattlePlayer.UpdateHandCardsPlayability(); + VfxWithLoading vfxWithLoadingToRegister2 = CreateSummonCardAnimation(base.SkillPrm.ownerCard.IsPlayer, _summonedCardsList, option2 != "NONE"); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(vfxWithLoadingToRegister2); + vfxWithLoadingSequential.RegisterVfxWithLoading(vfxWithLoadingToRegister); + if (flag) + { + foreach (BattleCardBase summonedCards in _summonedCardsList) + { + base.SkillPrm.ownerCard.SkillApplyInformation.AddRandomSelectedCard(summonedCards); + } + } + return vfxWithLoadingSequential; + } + + protected override VfxWithLoading CreateSummonCardAnimation(bool isPlayer, SummonedCardsList summonedCardsList, bool isOwnerEffect = false) + { + VfxWithLoading vfxWithLoadingToRegister = CreateSummonSkillEffect(base.SkillPrm, summonedCardsList, isOwnerEffect); + bool isSeSysSummonLandingDuplicateCheck = Global.SeSysSummonLandingDuplicateCheckId.Contains(base.SkillPrm.ownerCard.BaseParameter.BaseCardId); + StartPickMultiCardVfx vfxToRegister = new StartPickMultiCardVfx(summonedCardsList, base.SkillPrm.resourceMgr, isPlayer, isToken: true, _isIgnoreVoice, _isRandomVoice, isGetoff: false, _isEvoVoice, _voiceWaitTime, null, isSeSysSummonLandingDuplicateCheck); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(vfxWithLoadingToRegister); + vfxWithLoadingSequential.RegisterToMainVfx(vfxToRegister); + return vfxWithLoadingSequential; + } + + protected VfxWithLoading CreateSummonSkillEffect(SkillParameter skillPrm, SummonedCardsList summonedCardsList, bool isOwnerEffect) + { + if (!isOwnerEffect) + { + return CreateSkillEffect(skillPrm.resourceMgr, summonedCardsList, isFollowInHand: false, addToLastOperation: true); + } + return CreateOwnerSummonSkillEffect(skillPrm.resourceMgr, summonedCardsList); + } + + private VfxWithLoading CreateOwnerSummonSkillEffect(IBattleResourceMgr resourceMgr, SummonedCardsList summonedCardsList) + { + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + foreach (SummonedCardsList.CardEffectPair cardEffectPair in summonedCardsList.cardEffectPairList) + { + BattleCardBase targetCard = cardEffectPair.card; + VfxWithLoading vfxWithLoading = CreateSingleVfx(resourceMgr, () => targetCard.BattleCardView.CardWrapObject.transform.position, targetCard.AsIEnumerable(), addToLastOperation: true); + cardEffectPair.summonEffect = vfxWithLoading.MainVfx; + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxWithLoading.LoadingVfx); + } + base.SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr.OperateMgr.CallOnEffect(base.SkillPrm.buildInfo, isFollowInHand: false, isTargetPosition: true, addToLastOperation: true); + return vfxWithLoadingSequential; + } + + private IEnumerable CardID2Foil(IEnumerable cardIDs) + { + CardMaster cardMaster = CardMaster.GetInstanceForBattle(); + return from id in cardIDs + select cardMaster.GetCardParameterFromId(id) into param + select param.FoilCardId; + } + + private IEnumerable GetTargetId(IEnumerable targetCards, bool isFoil) + { + if (isFoil) + { + return targetCards.Select((BattleCardBase card) => (!card.IsChoiceEvolutionCard) ? card.BaseParameter.FoilCardId : (card.BaseParameter.BaseCardId + 1)); + } + return targetCards.Select((BattleCardBase card) => (!card.IsChoiceEvolutionCard) ? card.BaseParameter.NormalCardId : card.BaseParameter.BaseCardId); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + Func resetFunction = null; + resetFunction = delegate + { + targetCard.SkillApplyInformation.RandomSelectedCardList.Clear(); + BattlePlayerBase selfBattlePlayer2 = targetCard.SelfBattlePlayer; + selfBattlePlayer2.OnTurnEndSkillAfter = (Func)Delegate.Remove(selfBattlePlayer2.OnTurnEndSkillAfter, resetFunction); + return NullVfx.GetInstance(); + }; + BattlePlayerBase selfBattlePlayer = targetCard.SelfBattlePlayer; + selfBattlePlayer.OnTurnEndSkillAfter = (Func)Delegate.Combine(selfBattlePlayer.OnTurnEndSkillAfter, resetFunction); + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + BattlePlayerBase selfBattlePlayer2 = card.SelfBattlePlayer; + selfBattlePlayer2.OnTurnEndSkillAfter = (Func)Delegate.Remove(selfBattlePlayer2.OnTurnEndSkillAfter, resetFunction); + card.SkillApplyInformation.RandomSelectedCardList.Clear(); + return NullVfx.GetInstance(); + }; + } + + public override void AddIndividualIdSkillBuffLog(Skill_attach_skill attachSkill, BattleCardBase target) + { + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(base.SkillPrm.selfBattlePlayer, base.SkillPrm.opponentBattlePlayer); + SkillCollectionBase.SetupOptionValue(base.OptionValue, playerInfoPair, base.SkillPrm.ownerCard, this); + int num = SkillOptionValue.ParseOptionTokenID(base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.summon_token, "_OPT_NULL_")).FirstOrDefault(); + BuffInfo buffInfo = new BuffInfo(num, num, this); + buffInfo.IsReserveTokenDrawSkill = true; + target.AddBuffInfo(buffInfo); + attachSkill.OnIndividualIdSkillStop = (Action)Delegate.Combine(attachSkill.OnIndividualIdSkillStop, (Action)delegate + { + target.RemoveBuffInfo(buffInfo); + if (target.IsClass) + { + UpdateClassBuffIfActive(target); + } + }); + } + + protected virtual void CallOnSummonTokenCards(bool isOwnerEffect) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_token_draw.cs b/SVSim.BattleEngine/Engine/Skill_token_draw.cs new file mode 100644 index 0000000..ef5ad1b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_token_draw.cs @@ -0,0 +1,462 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard; +using Wizard.Battle; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_token_draw : SkillBase +{ + protected const string OPTION_DUPLICATION_FALSE = "false"; + + public const string OPTION_DUPLICATION_TRUE = "true"; + + private const string TOKEN_EFFECT_PATH = "cmn_token_draw_1"; + + private const string OPTION_OLDEST = "oldest"; + + private const string OPTION_EXCEPT_FUSION_CARD_ID_TRUE = "true"; + + private const string OPTION_EXCEPT_GAME_PLAY_CARD_ID_TRUE = "true"; + + protected IEnumerable _tokenIds; + + protected BattlePlayerBase _playerSide; + + protected bool _isPlayerSideBoth; + + protected BattlePlayerBase _selfBattlePlayer; + + protected int _randomCount = -1; + + private const string GLEAMING_GEM = "Gleaming_Gem_"; + + private const string RADIANT_CRYSTAL = "Radiant_Crystal_"; + + private const string GLEAMING_GEM_V2 = "Gleaming_Gem_v2_"; + + private const string RADIANT_CRYSTAL_V2 = "Radiant_Crystal_v2_"; + + public override bool IsTargetIndicate => false; + + public override bool IsAllowDestroyTarget => true; + + public override bool IsVisibleTarget { get; protected set; } + + public List TokenModifierList { get; protected set; } + + private List _tokenModifierIndexList { get; set; } + + private List _targetCardsIndexList { get; set; } + + public string IsOpen { get; private set; } + + protected bool IsOpponentHandCopy + { + get + { + if (base.ApplyingTargetFilter is SkillTargetHandFilter) + { + return base.ApplyBattlePlayerFilter is OpponentBattlePlayerFilter; + } + return false; + } + } + + public Skill_token_draw(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + TokenModifierList = new List(); + _tokenModifierIndexList = new List(); + _targetCardsIndexList = ((parameter.targetCards.Count() > 0) ? parameter.targetCards.Select((BattleCardBase c) => c.Index).ToList() : new List { -1 }); + if (!CreateTokenInfo(parameter.targetCards)) + { + parameter.calledSkillResultInfo.drawCards = new List(); + return NullVfxWithLoading.GetInstance(); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + bool isCopy = parameter.targetCards.Count() > 0 && !(base.ApplyBattlePlayerFilter is OpponentBattlePlayerFilter) && (base.ApplyingTargetFilter is SkillTargetHandOtherSelfFilter || base.ApplyingTargetFilter is SkillTargetHandFilter || base.ApplyingTargetFilter is SkillTargetDeckFilter || base.ApplyingTargetFilter is SkillTargetLastTargetFilter || base.ApplyingTargetFilter is SkillTargetDiscardThisTurnCardListFilter || IsTargetHandOtherSelfFilter() || IsHaveApplicableTargetFilter() || IsHaveApplicableTargetFilter()); + List drawList = CreateTokenObjectAndView(_playerSide, vfxWithLoadingSequential, isCopy); + CreateTokenDrawVfx(parameter, drawList, vfxWithLoadingSequential, _playerSide); + if (_isPlayerSideBoth) + { + drawList = CreateTokenObjectAndView(base.SkillPrm.ownerCard.OpponentBattlePlayer, vfxWithLoadingSequential, isCopy); + return CreateTokenDrawVfx(parameter, drawList, vfxWithLoadingSequential, base.SkillPrm.ownerCard.OpponentBattlePlayer); + } + return vfxWithLoadingSequential; + } + + private List CreateTokenObjectAndView(BattlePlayerBase playerSide, VfxWithLoadingSequential vfxWithLoading, bool isCopy) + { + List list = new List(); + for (int i = 0; i < _tokenIds.Count(); i++) + { + int num = _tokenIds.ElementAt(i); + int id = num; + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(num); + if (IsMakeFoil) + { + id = cardParameterFromId.FoilCardId; + } + int index = ((_targetCardsIndexList.Count() < _tokenIds.Count()) ? _targetCardsIndexList.First() : _targetCardsIndexList[i]); + BattleCardBase battleCardBase = CreateTokenCard(playerSide, id, index, NetworkBattleDefine.NetworkCardPlaceState.Hand, !_tokenModifierIndexList.Contains(i) && isCopy); + battleCardBase.SetOnDraw(draw: true); + list.Add(battleCardBase); + } + vfxWithLoading.RegisterToLoadingVfx(base.SkillPrm.selfBattlePlayer.BattleMgr.LoadCardResources(list)); + return list; + } + + protected bool CreateTokenInfo(IEnumerable targetCards, bool isReserve = false) + { + _selfBattlePlayer = base.SkillPrm.selfBattlePlayer; + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.repeat_count, -1); + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.token_draw, "_OPT_NULL_"); + bool allowDuplication = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.duplication, "false") == "true"; + string option = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.player_side, SkillFilterCreator.ContentKeyword.me.ToStringCustom()); + IsOpen = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.is_open, "_OPT_NULL_"); + bool flag = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "_OPT_NULL_") == "oldest"; + bool flag2 = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.except_fusion_card_id) == "true"; + bool flag3 = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.except_game_play_card_id) == "true"; + int tokenCardBaseCost = -1; + if (option == SkillFilterCreator.ContentKeyword.both.ToStringCustom()) + { + _isPlayerSideBoth = true; + _playerSide = base.SkillPrm.ownerCard.SelfBattlePlayer; + } + else + { + _playerSide = ((option == SkillFilterCreator.ContentKeyword.me.ToStringCustom()) ? base.SkillPrm.ownerCard.SelfBattlePlayer : base.SkillPrm.ownerCard.OpponentBattlePlayer); + } + bool flag4 = false; + if ("_OPT_NULL_" != text && text.Contains("Gleaming_Gem_v2_")) + { + string[] array = text.Replace("Gleaming_Gem_v2_", "").Split('?', ':'); + int classId = int.Parse(array[0]); + _tokenIds = Data.Master.GetGleamingGemListV2Master(classId); + _randomCount = base.OptionValue.ParseInt(array[1]); + if (array.Length > 2) + { + tokenCardBaseCost = base.OptionValue.ParseInt(array[2]); + } + } + else if ("_OPT_NULL_" != text && text.Contains("Radiant_Crystal_v2_")) + { + string[] array2 = text.Replace("Radiant_Crystal_v2_", "").Split('?'); + int classId2 = int.Parse(array2[0]); + _tokenIds = Data.Master.GetRadiantCrystalListV2Master(classId2); + _randomCount = base.OptionValue.ParseInt(array2[1]); + if (array2.Length > 2) + { + tokenCardBaseCost = base.OptionValue.ParseInt(array2[2]); + } + } + else if ("_OPT_NULL_" != text && text.Contains("Gleaming_Gem_")) + { + string[] array3 = text.Replace("Gleaming_Gem_", "").Split('?'); + int classId3 = int.Parse(array3[0]); + _tokenIds = Data.Master.GetGleamingGemList(classId3); + _randomCount = int.Parse(array3[1]); + } + else if ("_OPT_NULL_" != text && text.Contains("Radiant_Crystal_")) + { + string[] array4 = text.Replace("Radiant_Crystal_", "").Split('?'); + int classId4 = int.Parse(array4[0]); + _tokenIds = Data.Master.GetRadiantCrystalList(classId4); + _randomCount = int.Parse(array4[1]); + } + else if ("_OPT_NULL_" != text && text.Contains("basic_card")) + { + string[] source = text.Replace(")", "").Replace("(", "").Split(':'); + int classType = 0; + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + foreach (BattleCardBase targetCard in targetCards) + { + classType = (targetCard.IsPlayer ? dataMgr.GetPlayerClassId() : dataMgr.GetEnemyClassId()); + } + _tokenIds = ClassBasicCardList.GetRandomBasicCardId((CardBasePrm.ClanType)classType).AsEnumerable(); + _randomCount = int.Parse(source.Last()); + flag4 = true; + } + else if (targetCards.Count() > 0) + { + _tokenIds = GetTargetId(targetCards); + flag4 = true; + } + else if ("_OPT_NULL_" != text) + { + _tokenIds = SkillOptionValue.ParseOptionTokenID(text); + string[] source2 = text.Replace(")", "").Replace("(", "").Split('?'); + _randomCount = ((source2.Count() >= 2) ? base.OptionValue.ParseInt(source2.Last()) : (-1)); + flag4 = true; + } + if (tokenCardBaseCost != -1) + { + _tokenIds = _tokenIds.Where((int id) => CardMaster.GetInstanceForBattle().GetCardParameterFromId(id).Cost == tokenCardBaseCost); + } + if (flag2) + { + List second = base.SkillPrm.ownerCard.FusionIngredients.Select((BattleCardBase card) => card.CardId).ToList(); + _tokenIds = _tokenIds.Except(second); + } + if (flag3) + { + List list = base.SkillPrm.ownerCard.SelfBattlePlayer.GamePlayCards.Select((BattleCardBase card) => card.BaseParameter.BaseCardId).ToList(); + list.AddRange(base.SkillPrm.ownerCard.SelfBattlePlayer.GamePlayCards.Select((BattleCardBase card) => card.BaseParameter.FoilCardId).ToList()); + _tokenIds = _tokenIds.Except(list); + } + if (_randomCount != -1) + { + bool isRandomDistinct = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.is_random_distinct, "null") == "true"; + _tokenIds = GetRandomSelect(_tokenIds, _randomCount, allowDuplication, isRandomDistinct); + flag4 = true; + } + if (flag && _tokenIds != null) + { + int num2 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.limit_upper_count, -1); + if (num2 != -1) + { + int count = Mathf.Min(num2, _tokenIds.Count()); + _tokenIds = _tokenIds.Take(count); + } + } + if (num != -1 && _tokenIds != null) + { + if (num == 0) + { + return false; + } + List collection = _tokenIds.ToList(); + List list2 = _tokenIds.ToList(); + for (int num3 = 1; num3 < num; num3++) + { + list2.AddRange(collection); + } + _tokenIds = list2; + flag4 = true; + } + if (!flag4) + { + return false; + } + if (!isReserve) + { + List list3 = new List(); + List list4 = new List(); + for (int num4 = 0; num4 < _tokenIds.Count(); num4++) + { + int num5 = _tokenIds.ElementAt(num4); + list3.Add(num5); + list4.Add((_targetCardsIndexList.Count() < _tokenIds.Count()) ? _targetCardsIndexList.First() : _targetCardsIndexList[num4]); + TokenDrawModifier tokenDrawModifier = _selfBattlePlayer.Class.SkillApplyInformation.GetTokenDrawModifier(num5); + if (tokenDrawModifier != null) + { + TokenModifierList.Add(num5); + _tokenModifierIndexList.AddRange(Enumerable.Range(list3.Count, tokenDrawModifier.MultiplyCount - 1)); + list3.AddRange(Enumerable.Repeat(num5, tokenDrawModifier.MultiplyCount - 1)); + list4.AddRange(Enumerable.Repeat(-1, tokenDrawModifier.MultiplyCount - 1)); + } + } + if (list3.Count > 0) + { + _tokenIds = list3; + _targetCardsIndexList = list4; + } + } + if (_tokenIds.Count() == 0) + { + return false; + } + return true; + } + + protected virtual VfxWithLoading CreateTokenDrawVfx(CallParameter parameter, List drawList, VfxWithLoadingSequential vfxWithLoading, BattlePlayerBase playerSide, bool isReservation = false) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + VfxWith> vfxWith = playerSide.DrawCards(drawList, parameter.skillProcessor, !isReservation, isMulligan: false, isToken: true, isSkillDraw: true, this, isReservation, parameter.calledSkillResultInfo, base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.turn_token_draw_skill_id, -1)); + drawList = vfxWith.Value.ToList(); + parallelVfxPlayer.Register(vfxWith.Vfx); + if (parameter.targetCards.Count() == 0) + { + AddLastTarget(parameter, drawList); + } + parameter.calledSkillResultInfo.drawCards = BattlePlayerBase.ConvertToSkillInfoCollection(drawList); + if (!PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_BATTLE_EFFECT) && !string.IsNullOrEmpty(base.SkillPrm.buildInfo._effectPath)) + { + vfxWithLoading.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + } + VfxWithLoading vfxWithLoading2 = CreateTokenSpawnVfx(this, drawList.First()); + IsVisibleTarget = IsVisibleDrawSkillTarget(_selfBattlePlayer, parameter); + if (IsVisibleTarget && IsOpen == "false" && !drawList.First().IsPlayer) + { + IsVisibleTarget = false; + } + if (IsOpponentHandCopy || IsOpen == "true") + { + IsVisibleTarget = true; + } + vfxWithLoading.RegisterToMainVfx(new DrawTokenVfx(drawList, vfxWithLoading2.MainVfx, playerSide, IsVisibleTarget)); + vfxWithLoading.RegisterToLoadingVfx(vfxWithLoading2.LoadingVfx); + vfxWithLoading.RegisterToMainVfx(InstantVfx.Create(delegate + { + base.SkillPrm.selfBattlePlayer.UpdateHandCardsPlayability(); + })); + List list = drawList.Where((BattleCardBase s) => s.IsInHand).ToList(); + for (int num = 0; num < list.Count(); num++) + { + base.SkillPrm.ownerCard.SkillApplyInformation.AddSkillDrewCard(list.ElementAt(num)); + BattleLogManager.GetInstance().UpdateFusionedCardSkillDrewCard(base.SkillPrm.ownerCard); + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillDrawToken(list, this, IsVisibleTarget); + BattleLogManager.GetInstance().AddLogSkillDrawToken(drawList.Where((BattleCardBase s) => !s.IsInHand).ToList(), this, IsVisibleTarget, isOverDraw: true); + } + if (_randomCount > 0) + { + for (int num2 = 0; num2 < drawList.Count; num2++) + { + base.SkillPrm.ownerCard.SkillApplyInformation.AddRandomSelectedCard(drawList[num2]); + } + } + return vfxWithLoading; + } + + protected virtual BattleCardBase CreateTokenCard(BattlePlayerBase player, int id, int index, NetworkBattleDefine.NetworkCardPlaceState toState, bool isCopy = false) + { + return player.CreateNextIndexCard(id); + } + + public virtual bool IsInvisibleTarget() + { + if (!(base.ApplyingTargetFilter is SkillTargetHandOtherSelfFilter) && !(base.ApplyingTargetFilter is SkillTargetHandFilter) && !(base.ApplyingTargetFilter is SkillTargetDeckFilter) && !(base.ApplyingTargetFilter is SkillTargetChosenCardsFilter) && !(base.ApplyingTargetFilter is SkillTargetDiscardThisTurnCardListFilter) && !IsHaveApplicableTargetFilter()) + { + return IsTargetHandOtherSelfFilter(); + } + return true; + } + + public virtual bool IsVisibleDrawSkillTarget(BattlePlayerBase selfBattlePlayer, CallParameter parameter) + { + if (!selfBattlePlayer.IsPlayer && !GameMgr.GetIns().IsAdminWatch) + { + if (parameter.targetCards.Count() > 0) + { + if (!(base.ApplyingTargetFilter is SkillTargetHandOtherSelfFilter) && !(base.ApplyingTargetFilter is SkillTargetHandFilter) && !(base.ApplyingTargetFilter is SkillTargetDeckFilter) && !(base.ApplyingTargetFilter is SkillTargetChosenCardsFilter) && !(base.ApplyingTargetFilter is SkillTargetDiscardThisTurnCardListFilter) && !IsTargetHandOtherSelfFilter()) + { + return !IsHaveApplicableTargetFilter(); + } + return false; + } + return true; + } + return true; + } + + protected bool IsTargetHandOtherSelfFilter() + { + for (int i = 0; i < base.ApplyAndFilter.Count; i++) + { + if (base.ApplyAndFilter[i].TargetFilter is SkillTargetHandOtherSelfFilter) + { + return true; + } + } + return false; + } + + private IEnumerable GetTargetId(IEnumerable targetCards) + { + return targetCards.Select((BattleCardBase card) => (!card.IsChoiceEvolutionCard) ? card.BaseParameter.NormalCardId : card.BaseParameter.BaseCardId); + } + + private IEnumerable GetRandomSelect(IEnumerable ids, int randomCount, bool allowDuplication, bool isRandomDistinct) + { + List list = ids.ToList(); + List list2 = new List(); + int num = (allowDuplication ? randomCount : Math.Min(randomCount, list.Count)); + if (isRandomDistinct) + { + list = list.Where((int num3) => !base.SkillPrm.ownerCard.SkillApplyInformation.RandomSelectedCardList.Any((BattleCardBase c) => c.BaseParameter.BaseCardId == num3)).ToList(); + if (list.Count() == 0) + { + return list; + } + } + for (int num2 = 0; num2 < num; num2++) + { + if (list.Count <= 0) + { + continue; + } + int index = (BattleManagerBase.IsRandomDraw ? base.SkillPrm.selfBattlePlayer.BattleMgr.StableRandom(list.Count) : num2); + int id = list[index]; + if (!allowDuplication) + { + list = list.Where((int c) => c != id).ToList(); + } + list2.Add(id); + } + return list2; + } + + public static VfxWithLoading CreateTokenSpawnVfx(SkillBase skill, BattleCardBase firstToken) + { + if (BattleManagerBase.GetIns().IsRecovery) + { + return NullVfxWithLoading.GetInstance(); + } + float animationTime = 0f; + Color color = firstToken.Clan switch + { + CardBasePrm.ClanType.MIN => Global.EFFECT_COLOR_ELF, + CardBasePrm.ClanType.ROYAL => Global.EFFECT_COLOR_ROYAL, + CardBasePrm.ClanType.WITCH => Global.EFFECT_COLOR_WITCH_1, + CardBasePrm.ClanType.DRAGON => Global.EFFECT_COLOR_DRAGON, + CardBasePrm.ClanType.NECRO => Global.EFFECT_COLOR_NECROMANCER, + CardBasePrm.ClanType.VAMPIRE => Global.EFFECT_COLOR_VANPIRE, + CardBasePrm.ClanType.BISHOP => Global.EFFECT_COLOR_BISHOP, + CardBasePrm.ClanType.NEMESIS => Global.EFFECT_COLOR_NEMESIS, + _ => Color.clear, + }; + string text = "cmn_token_draw_1"; + DataMgr.SpecialBattleSetting specialBattleSettingInfo = GameMgr.GetIns().GetDataMgr().SpecialBattleSettingInfo; + if (specialBattleSettingInfo != null && specialBattleSettingInfo.TokenDrawOverrideEffectPair.ContainsKey(firstToken.CardId)) + { + text = specialBattleSettingInfo.TokenDrawOverrideEffectPair[firstToken.CardId]; + if (text.Contains(":")) + { + string[] array = text.Split(':'); + text = array[0]; + animationTime = float.Parse(array[1]); + } + color = Color.clear; + } + Func func = () => firstToken.BattleCardView.GameObject.transform.position; + return skill.CreateSkillEffectFromPath(text, "se_" + text, skill.SkillPrm.resourceMgr, EffectMgr.EngineType.SHURIKEN, EffectMgr.MoveType.DIRECT, func, func, animationTime, color); + } + + public override void AddIndividualIdSkillBuffLog(Skill_attach_skill attachSkill, BattleCardBase target) + { + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(base.SkillPrm.selfBattlePlayer, base.SkillPrm.opponentBattlePlayer); + SkillCollectionBase.SetupOptionValue(base.OptionValue, playerInfoPair, base.SkillPrm.ownerCard, this); + int num = SkillOptionValue.ParseOptionTokenID(base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.token_draw, "_OPT_NULL_")).FirstOrDefault(); + BuffInfo buffInfo = new BuffInfo(num, num, this); + buffInfo.IsReserveTokenDrawSkill = true; + target.AddBuffInfo(buffInfo); + attachSkill.OnIndividualIdSkillStop = (Action)Delegate.Combine(attachSkill.OnIndividualIdSkillStop, (Action)delegate + { + target.RemoveBuffInfo(buffInfo); + if (target.IsClass) + { + UpdateClassBuffIfActive(target); + } + }); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_token_draw_modifier.cs b/SVSim.BattleEngine/Engine/Skill_token_draw_modifier.cs new file mode 100644 index 0000000..db1e4fe --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_token_draw_modifier.cs @@ -0,0 +1,67 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_token_draw_modifier : SkillBase +{ + private List _tokenDrawModifierList; + + public Skill_token_draw_modifier(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + _tokenDrawModifierList = CreateTokenDrawModifierList(); + List list = parameter.targetCards.ToList(); + for (int i = 0; i < parameter.targetCards.Count(); i++) + { + BuffInfo buffInfo = AddBuffInfoIfNeeded(list[i]); + for (int j = 0; j < _tokenDrawModifierList.Count; j++) + { + list[i].SkillApplyInformation.AddTokenDrawModifier(_tokenDrawModifierList[j]); + } + buffInfoContainer.Add(new BuffInfoContainer(list[i], buffInfo, -1, "", null, 0L)); + } + VfxWithLoading result = CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards); + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddTokenDrawModifier(list, this); + } + SetOnLoseEvent(base.SkillPrm.ownerCard, null, null); + return result; + } + + private List CreateTokenDrawModifierList() + { + string[] array = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.card_id).Split(':'); + int multiplyCount = int.Parse(base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.multiply_count)); + List list = new List(); + for (int i = 0; i < array.Count(); i++) + { + list.Add(new TokenDrawModifier(int.Parse(array[i]), multiplyCount)); + } + return list; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + for (int i = 0; i < buffInfoContainer.Count; i++) + { + for (int j = 0; j < _tokenDrawModifierList.Count; j++) + { + buffInfoContainer[i]._targetCard.SkillApplyInformation.RemoveTokenDrawModifier(_tokenDrawModifierList[j]); + buffInfoContainer[i]._targetCard.RemoveBuffInfo(buffInfoContainer[i]._buffInfo); + } + } + buffInfoContainer.Clear(); + return base.Stop(skillProcessor); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += (SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) => Stop(skillProcessor); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_trigger.cs b/SVSim.BattleEngine/Engine/Skill_trigger.cs new file mode 100644 index 0000000..cbc2278 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_trigger.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using Wizard.Battle.View.Vfx; + +public class Skill_trigger : SkillBase +{ + private readonly List _targetList = new List(); + + public override bool IsTargetIndicate => false; + + public override bool IsInductionSkill => false; + + public Skill_trigger(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + foreach (BattleCardBase targetCard in parameter.targetCards) + { + targetCard.SkillApplyInformation.GiveTriggerCount(parameter.skillProcessor); + _targetList.Add(targetCard); + SetOnLoseEvent(targetCard, null, null); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(base.SkillPrm.ownerCard.BattleCardView.InitializeBattleCardIcon(base.SkillPrm.ownerCard, base.SkillPrm.ownerCard.Skills)); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + foreach (BattleCardBase target in _targetList) + { + target.SkillApplyInformation.DepriveTriggerCount(); + } + _targetList.Clear(); + return VfxWithLoading.Create(base.SkillPrm.ownerCard.BattleCardView.InitializeBattleCardIcon(base.SkillPrm.ownerCard, base.SkillPrm.ownerCard.Skills)); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.SkillApplyInformation.ForceDepriveTriggerCount(); + _targetList.Remove(card); + return (base.SkillPrm.ownerCard.BaseParameter.BaseCardId == 132141010) ? NullVfx.GetInstance() : base.SkillPrm.ownerCard.BattleCardView.InitializeBattleCardIcon(base.SkillPrm.ownerCard, base.SkillPrm.ownerCard.Skills); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_turn_start_fixed_pp.cs b/SVSim.BattleEngine/Engine/Skill_turn_start_fixed_pp.cs new file mode 100644 index 0000000..edda46f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_turn_start_fixed_pp.cs @@ -0,0 +1,48 @@ +using System.Linq; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_turn_start_fixed_pp : SkillBase +{ + public Skill_turn_start_fixed_pp(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + foreach (BattleCardBase targetCard in parameter.targetCards) + { + targetCard.SkillApplyInformation.GiveTurnStartFixedPP(); + CardParameter baseParameter = base.SkillPrm.ownerCard.BaseParameter; + BuffInfo buffInfo = new BuffInfo(baseParameter.BaseCardId, baseParameter.NormalCardId, this); + targetCard.AddBuffInfo(buffInfo); + buffInfoContainer.Add(new BuffInfoContainer(targetCard, buffInfo, -1, "", null, 0L)); + if (targetCard.IsClass) + { + UpdateClassBuffIfActive(targetCard); + } + } + if (IsBattleLog && parameter.targetCards.Count() > 0) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.TurnStartFixedPP); + } + return NullVfxWithLoading.GetInstance(); + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + foreach (BuffInfoContainer item in buffInfoContainer) + { + item._targetCard.SkillApplyInformation.DepriveTurnStartFixedPP(); + item._targetCard.RemoveBuffInfo(item._buffInfo); + if (item._targetCard.IsClass) + { + UpdateClassBuffIfActive(item._targetCard); + } + } + return NullVfxWithLoading.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_unite.cs b/SVSim.BattleEngine/Engine/Skill_unite.cs new file mode 100644 index 0000000..23e00a2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_unite.cs @@ -0,0 +1,106 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_unite : SkillBaseSummon +{ + public class UniteCardPair + { + public List _materialCards; + + public List _uniteCards; + + public UniteCardPair(List materialCards, List uniteCards) + { + _materialCards = materialCards; + _uniteCards = uniteCards; + } + } + + private const string OPTION_UNITE_COMBINE = "combine"; + + private const string OPTION_UNITE_MIX = "mix"; + + protected UniteCardPair _uniteCardPair; + + public Skill_unite(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + bool flag = false; + _uniteCardPair = null; + List list = new List(); + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "combine"); + string option = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.summon_token, "_OPT_NULL_"); + string option2 = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.base_card_id, "_OPT_NULL_"); + IEnumerable enumerable = SkillOptionValue.ParseOptionTokenID(option); + IEnumerable source = SkillOptionValue.ParseOptionTokenID(option2); + if (parameter.targetCards.Where((BattleCardBase c) => !c.IsDead).Count() < source.Count()) + { + return NullVfxWithLoading.GetInstance(); + } + for (int num = 0; num < parameter.targetCards.Count(); num++) + { + BattleCardBase card = parameter.targetCards.ElementAt(num); + int num2 = source.Where((int x) => x == card.BaseParameter.BaseCardId).Count(); + int num3 = list.Where((BattleCardBase x) => x.BaseParameter.BaseCardId == card.BaseParameter.BaseCardId).Count(); + if (num2 - num3 > 0 && !card.IsDead) + { + list.Add(card); + } + } + if (text == "combine" && !base.SkillPrm.ownerCard.IsDead) + { + list.Add(base.SkillPrm.ownerCard); + } + if ((text == "combine" && list.Count == source.Count() + 1) || (text == "mix" && list.Count == source.Count())) + { + for (int num4 = 0; num4 < list.Count; num4++) + { + parallelVfxPlayer.Register(list[num4].UniteInPlay(parameter.skillProcessor, this)); + } + flag = true; + } + if (IsMakeFoil) + { + CardMaster cardMaster = CardMaster.GetInstanceForBattle(); + enumerable = from id in enumerable + select cardMaster.GetCardParameterFromId(id) into param + select param.FoilCardId; + } + if (flag) + { + VfxWithLoading vfxWithLoading = CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards); + SummonedCardsList summonedCardsList = CreateSummonedCardsList(parameter.targetCards, enumerable, base.SkillPrm.selfBattlePlayer); + _uniteCardPair = new UniteCardPair(list, summonedCardsList.ToList()); + CallOnUnite(); + BattlePlayerBase.SummonInfo summonInfo = new BattlePlayerBase.SummonInfo(base.SkillPrm.ownerCard.IsPlayer, summonedCardsList, SUMMON_TYPE.TOKEN); + BattlePlayerBase selfBattlePlayer = base.SkillPrm.selfBattlePlayer; + SkillProcessor skillProcessor = parameter.skillProcessor; + BattlePlayerBase.SummonInfo summonInfo2 = summonInfo; + VfxWithLoadingSequential vfxWithLoadingSequential = selfBattlePlayer.CardManagement(null, skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.SUMMON, isRandom: false, null, null, this, summonInfo2) as VfxWithLoadingSequential; + base.SkillPrm.selfBattlePlayer.UpdateHandCardsPlayability(); + VfxWithLoading vfxWithLoading2 = CreateSummonCardAnimation(base.SkillPrm.ownerCard.IsPlayer, summonedCardsList); + if (IsBattleLog && _uniteCardPair != null) + { + BattleLogManager.GetInstance().AddLogSkillUnite(_uniteCardPair, this); + } + VfxWithLoadingSequential vfxWithLoadingSequential2 = VfxWithLoadingSequential.Create(vfxWithLoading.MainVfx, parallelVfxPlayer, vfxWithLoading2.MainVfx, vfxWithLoadingSequential); + vfxWithLoadingSequential2.RegisterToLoadingVfx(vfxWithLoading.LoadingVfx); + vfxWithLoadingSequential2.RegisterToLoadingVfx(vfxWithLoading2.LoadingVfx); + vfxWithLoadingSequential2.RegisterToLoadingVfx(vfxWithLoadingSequential.LoadingVfx); + return vfxWithLoadingSequential2; + } + return NullVfxWithLoading.GetInstance(); + } + + protected virtual void CallOnUnite() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_untouchable.cs b/SVSim.BattleEngine/Engine/Skill_untouchable.cs new file mode 100644 index 0000000..9366f82 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_untouchable.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_untouchable : SkillBase +{ + public const string UNTOUCHBLE_TYPE_ALL = "all"; + + public const string UNTOUCHBLE_TYPE_SPELL = "spell"; + + private string _cardType; + + public Skill_untouchable(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + } + + public override VfxWithLoading Start(CallParameter parameter) + { + _cardType = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "all"); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase targetCard in parameter.targetCards) + { + VfxBase vfx = targetCard.SkillApplyInformation.GiveUntouchable(_cardType); + BattleCardBase battleCardBase = targetCard; + BuffInfo buffInfo = AddBuffInfoIfNeeded(targetCard); + BuffInfoContainer buffInfoContainer = new BuffInfoContainer(battleCardBase, buffInfo, -1, "", null, 0L); + base.buffInfoContainer.Add(buffInfoContainer); + SetOnLoseEvent(battleCardBase, buffInfo, buffInfoContainer); + parallelVfxPlayer.Register(vfx); + } + if (IsBattleLog) + { + BattleLogManager.GetInstance().AddLogSkillGain(parameter.targetCards.ToList(), this, SkillGainType.Untouchable); + } + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(); + vfxWithLoadingSequential.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards)); + vfxWithLoadingSequential.RegisterToMainVfx(parallelVfxPlayer); + return vfxWithLoadingSequential; + } + + public override VfxWithLoading Stop(SkillProcessor skillProcessor) + { + base.Stop(skillProcessor); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + List list = new List(); + foreach (BuffInfoContainer item in buffInfoContainer) + { + VfxBase vfx = item._targetCard.SkillApplyInformation.DepriveUntouchable(_cardType); + list.Add(item._targetCard); + item._targetCard.RemoveBuffInfo(item._buffInfo); + parallelVfxPlayer.Register(vfx); + } + CallOnUpdateSkillEffect(list); + buffInfoContainer.Clear(); + return VfxWithLoading.Create(parallelVfxPlayer); + } + + public override void SetOnLoseEvent(BattleCardBase targetCard, BuffInfo buff, BuffInfoContainer container) + { + targetCard.OnLoseSkillOneTime += delegate(SkillBase loseSkill, SkillProcessor skillProcessor, BattleCardBase card) + { + card.RemoveBuffInfo(buff); + buffInfoContainer.Remove(container); + return card.SkillApplyInformation.FourceDepriveUntouchable(_cardType); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Skill_update_deck.cs b/SVSim.BattleEngine/Engine/Skill_update_deck.cs new file mode 100644 index 0000000..52a13a5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Skill_update_deck.cs @@ -0,0 +1,298 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using UnityEngine; +using Wizard; +using Wizard.Battle; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class Skill_update_deck : SkillBase +{ + private class OptionResult + { + public List _tokenIds; + + public int _repeatCount; + + public OptionResult(List tokenIds, int repeatCount) + { + _tokenIds = tokenIds; + _repeatCount = repeatCount; + } + } + + public const string OPTION_UPDATE_CHANGE = "change"; + + private const string OPTION_FALSE = "false"; + + private const string OPTION_TRUE = "true"; + + protected string _updateType = "change"; + + protected bool _isReferenceOpponentCard; + + protected bool _isReferenceFusionedCard; + + private List _addCards; + + private VfxWithLoadingSequential _vfxWithLoading; + + protected bool _isUsingTargetCards; + + public override bool IsTargetIndicate => false; + + public override bool IsAllowDestroyTarget => true; + + public bool IsOpen { get; protected set; } = true; + + public Skill_update_deck(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + IsOpen = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.is_open, "false") == "true"; + } + + private OptionResult ParseOption(CallParameter parameter) + { + _updateType = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.type, "change"); + string stringAllParse = base.OptionValue.GetStringAllParse(SkillFilterCreator.ContentKeyword.token_draw, ':', "_OPT_NULL_"); + bool allowDuplication = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.duplication, "false") == "true"; + int num = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.repeat_count, -1); + int num2 = base.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.limit_upper_count, -1); + _isReferenceOpponentCard = base.ApplyFilterCollection.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.BattlePlayerFilter is OpponentBattlePlayerFilter); + _isReferenceFusionedCard = base.ApplyFilterCollection.ApplyAndFilter.Any((ApplySkillTargetFilterCollection f) => f.TargetFilter is SkillTargetFusionIngredientCardsFilter); + int num3 = -1; + List list = null; + if (parameter.targetCards.Any()) + { + list = GetTargetId(parameter.targetCards).ToList(); + _isUsingTargetCards = true; + } + else if ("_OPT_NULL_" != stringAllParse) + { + list = SkillOptionValue.ParseOptionTokenID(stringAllParse).ToList(); + num3 = SkillOptionValue.ParseTokenOption(stringAllParse); + } + if (num3 != -1) + { + bool isRandomDistinct = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.is_random_distinct, "null") == "true"; + list = GetRandomSelect(list, num3, allowDuplication, isRandomDistinct).ToList(); + } + if (list == null || list.Count == 0) + { + return null; + } + if (IsMakeFoil) + { + CardMaster instanceForBattle = CardMaster.GetInstanceForBattle(); + for (int num4 = 0; num4 < list.Count; num4++) + { + if (list[num4] != -1) + { + list[num4] = instanceForBattle.GetCardParameterFromId(list[num4]).FoilCardId; + } + } + } + switch (num) + { + case 0: + return null; + default: + { + List list2 = new List(); + for (int num5 = 0; num5 < list.Count; num5++) + { + for (int num6 = 0; num6 < num; num6++) + { + list2.Add(list[num5]); + } + } + list = list2; + break; + } + case -1: + break; + } + if (num2 != -1) + { + int count = Mathf.Min(num2, list.Count()); + list = list.Take(count).ToList(); + } + return new OptionResult(list, num); + } + + private void AddCardAndVfx(CallParameter parameter, List tokenIds, int repeatCount, BattlePlayerBase targetPlayer) + { + for (int i = 0; i < tokenIds.Count(); i++) + { + if (tokenIds[i] != -1) + { + BattleCardBase item = CreateTokenCard(parameter, tokenIds[i], repeatCount, i, targetPlayer); + _addCards.Add(item); + } + } + if (_updateType != "change") + { + _vfxWithLoading.RegisterToLoadingVfx(base.SkillPrm.selfBattlePlayer.BattleMgr.LoadCardResources(_addCards)); + } + } + + protected virtual BattleCardBase CreateTokenCard(CallParameter parameter, int tokenId, int repeatCount, int tokenIdIndex, BattlePlayerBase targetPlayer) + { + return targetPlayer.CreateNextIndexCard(tokenId); + } + + public override VfxWithLoading Start(CallParameter parameter) + { + bool flag = base.OptionValue.GetOption(SkillFilterCreator.ContentKeyword.player_side, SkillFilterCreator.ContentKeyword.me.ToStringCustom()) == "me"; + BattlePlayerBase battlePlayerBase = (flag ? base.SkillPrm.selfBattlePlayer : base.SkillPrm.opponentBattlePlayer); + _addCards = new List(); + _vfxWithLoading = VfxWithLoadingSequential.Create(); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + int num = 0; + string text = base.OptionValue.GetString(SkillFilterCreator.ContentKeyword.option, string.Empty); + if (!string.IsNullOrEmpty(text)) + { + string pattern = "\\(.*?\\)"; + foreach (Match item in Regex.Matches(text, pattern)) + { + string text2 = item.Value.Substring(1, item.Value.Length - 2); + base.OptionValue.SetText(text2); + OptionResult optionResult = ParseOption(parameter); + if (optionResult != null) + { + AddCardAndVfx(parameter, optionResult._tokenIds, optionResult._repeatCount, battlePlayerBase); + num += optionResult._tokenIds.Count; + } + } + base.OptionValue.SetText(base.SkillPrm.buildInfo._option); + } + else + { + OptionResult optionResult2 = ParseOption(parameter); + if (optionResult2 != null) + { + AddCardAndVfx(parameter, optionResult2._tokenIds, optionResult2._repeatCount, battlePlayerBase); + num = optionResult2._tokenIds.Count; + } + } + int count = battlePlayerBase.DeckCardList.Count; + if (_addCards.Count == 0) + { + parameter.calledSkillResultInfo.UpdatedDeckCards = new List(); + if (_updateType == "change") + { + _vfxWithLoading.RegisterToMainVfx(new DummyDeckChangeCardVfx(battlePlayerBase.IsPlayer, battlePlayerBase.DeckCardList.Count)); + } + return _vfxWithLoading; + } + bool flag2 = battlePlayerBase.IsPlayer || _isReferenceOpponentCard || _isReferenceFusionedCard || !_isUsingTargetCards || IsOpen; + parallelVfxPlayer.Register(battlePlayerBase.AddDeckTokenCards(_addCards, parameter.skillProcessor, _updateType, this, flag2)); + parameter.calledSkillResultInfo.UpdatedDeckCards = BattlePlayerBase.ConvertToSkillInfoCollection(_addCards); + if (flag && _updateType != "change") + { + base.SkillPrm.selfBattlePlayer.GameAddUpdateDeckCards.AddRange(_addCards); + for (int i = 0; i < _addCards.Count(); i++) + { + base.SkillPrm.selfBattlePlayer.GameUpdateDeckMomentTribe.Add(new BattlePlayerBase.CardAndTribe(_addCards[i], _addCards[i].Tribe)); + } + } + battlePlayerBase.CallOnChangeDeckAfterEvent(count, parameter.skillProcessor, new List()); + if (!_isUsingTargetCards) + { + AddLastTarget(parameter, _addCards); + } + if (!PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_BATTLE_EFFECT) && !string.IsNullOrEmpty(base.SkillPrm.buildInfo._effectPath)) + { + _vfxWithLoading.RegisterVfxWithLoading(CreateSkillEffect(base.SkillPrm.resourceMgr, parameter.targetCards, isFollowInHand: false, addToLastOperation: true)); + } + if (_updateType != "change") + { + VfxWithLoading vfxWithLoading = Skill_token_draw.CreateTokenSpawnVfx(this, _addCards.First()); + _vfxWithLoading.RegisterToMainVfx(new AddTokenDeckVfx(_addCards, vfxWithLoading.MainVfx, battlePlayerBase, parallelVfxPlayer, flag2)); + _vfxWithLoading.RegisterToLoadingVfx(vfxWithLoading.LoadingVfx); + } + if (_updateType != "change" && (_isUsingTargetCards || num > 0)) + { + CreateWhenAddToDeckInfo(parameter, battlePlayerBase, flag ? base.SkillPrm.opponentBattlePlayer : base.SkillPrm.selfBattlePlayer); + } + _vfxWithLoading.RegisterToMainVfx(new DummyDeckChangeCardVfx(battlePlayerBase.IsPlayer, battlePlayerBase.DeckCardList.Count)); + _vfxWithLoading.RegisterToMainVfx(new DeckChangeVfx(battlePlayerBase)); + if (IsBattleLog) + { + bool isAdminWatch = GameMgr.GetIns().IsAdminWatch; + if ((!_isUsingTargetCards || base.SkillPrm.ownerCard.IsPlayer || _isReferenceOpponentCard || _isReferenceFusionedCard || isAdminWatch || IsOpen) && _updateType != "change") + { + BattleLogManager.GetInstance().AddLogSkillAddDeck(_addCards, this); + } + else + { + BattleLogManager.GetInstance().AddLogSkillChangeDeck(battlePlayerBase.Class, this); + } + } + return _vfxWithLoading; + } + + private IEnumerable GetTargetId(IEnumerable targetCards) + { + return targetCards.Select((BattleCardBase card) => (!card.IsChoiceEvolutionCard) ? card.BaseParameter.NormalCardId : card.BaseParameter.BaseCardId); + } + + public static IEnumerable ParseOptionTokenID(string option) + { + return from str in (from s in option.Replace(")", "").Replace("(", "").Split(':') + where !s.Contains("?") + select s).ToArray() + select int.Parse(str); + } + + protected virtual void CreateWhenAddToDeckInfo(CallParameter parameter, BattlePlayerBase self, BattlePlayerBase opp) + { + List list = new List(); + list.AddRange(self.HandCardList); + if (BattleManagerBase.GetIns() is SingleBattleMgr) + { + list.AddRange(self.ClassAndInPlayCardList); + } + else + { + list.AddRange(self.InPlayCards); + } + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(self, opp); + for (int i = 0; i < list.Count(); i++) + { + parameter.skillProcessor.Register(list[i].Skills.CreateWhenAddToDeck(parameter.skillProcessor, playerInfoPair)); + } + } + + private IEnumerable GetRandomSelect(IEnumerable ids, int randomCount, bool allowDuplication, bool isRandomDistinct) + { + List list = ids.ToList(); + List list2 = new List(); + int num = Math.Min(randomCount, list.Count); + if (isRandomDistinct) + { + list = list.Where((int num3) => !base.SkillPrm.ownerCard.SkillApplyInformation.RandomSelectedCardList.Any((BattleCardBase c) => c.CardId == num3)).ToList(); + if (list.Count() == 0) + { + return list; + } + } + for (int num2 = 0; num2 < num; num2++) + { + if (list.Count <= 0) + { + continue; + } + int index = (BattleManagerBase.IsRandomDraw ? base.SkillPrm.selfBattlePlayer.BattleMgr.StableRandom(list.Count) : num2); + int id = list[index]; + if (!allowDuplication) + { + list = list.Where((int c) => c != id).ToList(); + } + list2.Add(id); + } + return list2; + } +} diff --git a/SVSim.BattleEngine/Engine/SkyboundArtCountAddModifier.cs b/SVSim.BattleEngine/Engine/SkyboundArtCountAddModifier.cs new file mode 100644 index 0000000..9b120f5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SkyboundArtCountAddModifier.cs @@ -0,0 +1,21 @@ +public class SkyboundArtCountAddModifier : ICardSkyboundArtCountModifier +{ + public readonly int SkyboundArtCount; + + public bool IsClearBeforeModifier => true; + + public SkyboundArtCountAddModifier(int count) + { + SkyboundArtCount = count; + } + + public int CalcSkyboundArtCount(int skyboundArtCount) + { + return skyboundArtCount += SkyboundArtCount; + } + + public ICardSkyboundArtCountModifier Clone() + { + return new SkyboundArtCountAddModifier(SkyboundArtCount); + } +} diff --git a/SVSim.BattleEngine/Engine/SpecialArenaField.cs b/SVSim.BattleEngine/Engine/SpecialArenaField.cs new file mode 100644 index 0000000..858a9fb --- /dev/null +++ b/SVSim.BattleEngine/Engine/SpecialArenaField.cs @@ -0,0 +1,100 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +public class SpecialArenaField : BackGroundBase +{ + private const string TAPESTRY_OBJECT_PATH = "md_bf_arn2_01_tapestry/tapestry_big"; + + private const string TAPESTRY_TEXTURE_NAME = "tx_bf_arn2_01_tapestry_d"; + + private const string CANDLE_ROAD_EFFECT_NAME = "candle_road"; + + public override int FieldId => 1001; + + public SpecialArenaField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override List CollectAdditionalAssets() + { + return new List { Toolbox.ResourcesManager.GetAssetTypePath("tx_bf_arn2_01_tapestry_d", ResourcesManager.AssetLoadPathType.Uilang3DField) }; + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_arn2_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles09").gameObject; + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + ParticleSystem component = _fieldParticles.transform.Find("candle_road").GetComponent(); + component.gameObject.SetActive(value: false); + _fieldParticleSystemDictionary.Add("candle_road", component); + SkinnedMeshRenderer skinnedMeshRenderer = _fieldModel.transform.Find("md_bf_arn2_01_tapestry/tapestry_big")?.GetComponent(); + if (skinnedMeshRenderer != null) + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("tx_bf_arn2_01_tapestry_d", ResourcesManager.AssetLoadPathType.Uilang3DField, isfetch: true); + Texture texture = Toolbox.ResourcesManager.LoadObject(assetTypePath) as Texture; + if (texture != null) + { + skinnedMeshRenderer.material.SetTexture("_MainTex", texture); + } + } + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1001, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1001_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + GameObject candleRoadEffectObj = _fieldParticleSystemDictionary["candle_road"].gameObject; + candleRoadEffectObj.SetActive(value: true); + _battleCamera.Camera.transform.localPosition = new Vector3(3300f, -1070f, 50f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-15f, -56f, 80f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(20f, -10f, -70f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-18f, -105f, 95f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + candleRoadEffectObj.SetActive(value: false); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/SpecialCrystalInfo.cs b/SVSim.BattleEngine/Engine/SpecialCrystalInfo.cs new file mode 100644 index 0000000..9a63828 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SpecialCrystalInfo.cs @@ -0,0 +1,53 @@ +using LitJson; +using Wizard; + +public class SpecialCrystalInfo +{ + public string ProductId { get; private set; } + + public int AvailablePurchaseCount { get; private set; } + + public RemainTime RemainTime { get; private set; } + + public string DialogTitle { get; private set; } + + public string DialogBGImageFileName { get; private set; } + + public bool EnableExtraResult { get; private set; } + + public int ExtraResultPurchaseCount { get; private set; } + + public string ExtraResultDialogBGImageFileName { get; private set; } + + public string ResultDialogNextSceneClick { get; private set; } + + public string ResultDialogNextSceneStatus { get; private set; } + + public string Status { get; private set; } + + public SpecialCrystalInfo(JsonData json, JsonData responseData) + { + ProductId = json["product_id"].ToString(); + AvailablePurchaseCount = json["available_purchase_num"].ToInt(); + RemainTime = new RemainTime(json["end_time"].ToString(), responseData["data_headers"]["servertime"].ToDouble()); + DialogTitle = json["dialog_top_title"].ToString(); + DialogBGImageFileName = json["dialog_top_img"].ToString(); + Status = json["status_id"].ToString(); + if (json.Keys.Contains("ex_dialog_img")) + { + EnableExtraResult = true; + ExtraResultPurchaseCount = json["ex_dialog_condtion_available_purchase_num"].ToInt(); + ExtraResultDialogBGImageFileName = json["ex_dialog_img"].ToString(); + ResultDialogNextSceneClick = json["ex_dialog_click"].ToString(); + ResultDialogNextSceneStatus = json["ex_dialog_status"].ToString(); + } + else + { + EnableExtraResult = false; + ExtraResultPurchaseCount = -1; + ExtraResultDialogBGImageFileName = string.Empty; + ResultDialogNextSceneClick = string.Empty; + ResultDialogNextSceneStatus = string.Empty; + } + } +} diff --git a/SVSim.BattleEngine/Engine/SpellBattleCard.cs b/SVSim.BattleEngine/Engine/SpellBattleCard.cs new file mode 100644 index 0000000..eadd374 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SpellBattleCard.cs @@ -0,0 +1,135 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.Card; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class SpellBattleCard : BattleCardBase +{ + private bool _isActionCard; + + private static SkillCreator.SkillBuildInfo _sharedSpellChargeBuildInfo; + + public override bool IsActionCard => _isActionCard; + + public override bool IsEvolution => false; + + public override bool IsInplay => false; + + public override bool IsSpell => true; + + public override bool IsDead => false; + + public override bool Movable(bool isCheckOnDraw = true, bool isSkipSelecting = false, CHECK_CONDITION_MUTATIONSKILL_TYPE type = CHECK_CONDITION_MUTATIONSKILL_TYPE.NONE, bool isRecording = false) + { + if (!base.Movable(isCheckOnDraw, isSkipSelecting, CHECK_CONDITION_MUTATIONSKILL_TYPE.NONE, isRecording)) + { + return false; + } + return IsSelectableSkillTarget(); + } + + public bool IsSelectableSkillTarget() + { + bool flag = false; + IEnumerable source = base.Skills.Skip(1); + IEnumerable source2 = source.Where((SkillBase s) => s.IsWhenPlaySkill && s.IsUserSelectType && !s.IsEmptyHandedUserSelectType); + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(base.SelfBattlePlayer, base.OpponentBattlePlayer); + List source3 = new List(); + SkillConditionCheckerOption checkerOption = new SkillConditionCheckerOption(); + if (source2.Any()) + { + source3 = source2.Where((SkillBase s) => s.CheckCondition(playerInfoPair, checkerOption, isPrePlay: true)).ToList(); + if (source3.Count() <= 0) + { + flag = false; + } + } + bool flag2 = base.Skills.CheckWhenPlayCondition(playerInfoPair, isPrePlay: true); + if (flag2) + { + if (source3.Any()) + { + int targetCount = 0; + flag = source3.All((SkillBase s) => s.CalcApplyTargets(s.SkillPrm.CreateInfoPair(), checkerOption, ref targetCount, isCheckInHand: true).Any()); + } + } + else if (!flag2 && source2.Any()) + { + flag = false; + } + if (!flag && source.Any((SkillBase s) => !s.IsUserSelectType && s.CheckCondition(playerInfoPair, checkerOption, isPrePlay: true) && s.ConditionCheckerList.Any((ISkillConditionChecker c) => c is SkillPreprocessDontSelectStart))) + { + return true; + } + if (source.Any((SkillBase s) => s.IsUserSelectType && !s.IsEmptyHandedUserSelectType && !(s is Skill_fusion))) + { + return flag; + } + return true; + } + + public SpellBattleCard(BuildInfo buildInfo, bool isChoiceBrave) + : base(buildInfo) + { + if (!isChoiceBrave) + { + SkillBase skill = CreateSkillCreator(buildInfo.SelfBattlePlayer, buildInfo.OpponentBattlePlayer, buildInfo.ResourceMgr).Create(SpellSkillInfoCreate()); + _normalSkillCollection.FirstAdd(skill); + } + _isActionCard = false; + } + + public static SkillCreator.SkillBuildInfo SpellSkillInfoCreate() + { + if (_sharedSpellChargeBuildInfo == null) + { + _sharedSpellChargeBuildInfo = new SkillCreator.SkillBuildInfo("spell_charge", "when_play", "card_type=spell", "character=me&target=hand_other_self&card_type=all", "add_charge=1", "none"); + } + return _sharedSpellChargeBuildInfo; + } + + public override void UpdateSkillCollection() + { + } + + protected override SkillCollectionBase CreateSkillCollection() + { + return new SpellSkillCollection(this); + } + + protected override VfxBase StartPlayCard() + { + VfxBase vfxBase = base.StartPlayCard(); + base.BattleCardView.HideCanPlayEffect(); + _isActionCard = true; + return SequentialVfxPlayer.Create(vfxBase, base.VfxCreator.CreatePick()); + } + + protected override ICardVfxCreator CreateVfxCreator(bool isPlayer, IBattleCardView battleCardView, bool isNullView) + { + if (isNullView) + { + return NullCardVfxCreator.GetInstance(); + } + return new SpellCardVfxCreator(isPlayer, this, battleCardView, _buildInfo.ResourceMgr, () => IsActionCard); + } + + protected override IBattleCardView CreateView(BattleCardView.BuildInfo buildInfo, bool isNullView) + { + if (isNullView) + { + return new NullBattleCardView(buildInfo); + } + return new SpellBattleCardView(buildInfo); + } + + public override BattleCardBase VirtualClone(BattlePlayerBase virtualSelfBattlePlayer, BattlePlayerBase virtualOpponentBattlePlayer) + { + VirtualSpellBattleCard virtualSpellBattleCard = new VirtualSpellBattleCard(_buildInfo.VirtualClone(virtualSelfBattlePlayer, virtualOpponentBattlePlayer), isChoiceBrave: false); + virtualSpellBattleCard._isActionCard = _isActionCard; + CopyToVirtualCardBase(virtualSpellBattleCard); + return virtualSpellBattleCard; + } +} diff --git a/SVSim.BattleEngine/Engine/SpellSelectableCardFilter.cs b/SVSim.BattleEngine/Engine/SpellSelectableCardFilter.cs new file mode 100644 index 0000000..311996c --- /dev/null +++ b/SVSim.BattleEngine/Engine/SpellSelectableCardFilter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle; + +public class SpellSelectableCardFilter : SkillSelectableCardFilter +{ + public SpellSelectableCardFilter(IReadOnlyBattleCardInfo card) + : base(card) + { + } + + public override IEnumerable Filtering(IEnumerable cards, SkillOptionValue option) + { + return cards.Where((IReadOnlyBattleCardInfo c) => _card.IsPlayer == c.IsPlayer || (!c.SkillApplyInformation.CantBeFocusedSkill && !c.SkillApplyInformation.CantBeFocusedSpell)); + } +} diff --git a/SVSim.BattleEngine/Engine/SpringPosition.cs b/SVSim.BattleEngine/Engine/SpringPosition.cs new file mode 100644 index 0000000..7aa783f --- /dev/null +++ b/SVSim.BattleEngine/Engine/SpringPosition.cs @@ -0,0 +1,113 @@ +using UnityEngine; + +[AddComponentMenu("NGUI/Tween/Spring Position")] +public class SpringPosition : MonoBehaviour +{ + public delegate void OnFinished(); + + public static SpringPosition current; + + public Vector3 target = Vector3.zero; + + public float strength = 10f; + + public bool worldSpace; + + public bool ignoreTimeScale; + + public bool updateScrollView; + + public OnFinished onFinished; + + [SerializeField] + [HideInInspector] + private GameObject eventReceiver; + + [SerializeField] + [HideInInspector] + public string callWhenFinished; + + private Transform mTrans; + + private float mThreshold; + + private UIScrollView mSv; + + private void Start() + { + mTrans = base.transform; + if (updateScrollView) + { + mSv = NGUITools.FindInParents(base.gameObject); + } + } + + private void Update() + { + float deltaTime = (ignoreTimeScale ? RealTime.deltaTime : Time.deltaTime); + if (worldSpace) + { + if (mThreshold == 0f) + { + mThreshold = (target - mTrans.position).sqrMagnitude * 0.001f; + } + mTrans.position = NGUIMath.SpringLerp(mTrans.position, target, strength, deltaTime); + if (mThreshold >= (target - mTrans.position).sqrMagnitude) + { + mTrans.position = target; + NotifyListeners(); + base.enabled = false; + } + } + else + { + if (mThreshold == 0f) + { + mThreshold = (target - mTrans.localPosition).sqrMagnitude * 1E-05f; + } + mTrans.localPosition = NGUIMath.SpringLerp(mTrans.localPosition, target, strength, deltaTime); + if (mThreshold >= (target - mTrans.localPosition).sqrMagnitude) + { + mTrans.localPosition = target; + NotifyListeners(); + base.enabled = false; + } + } + if (mSv != null) + { + mSv.UpdateScrollbars(recalculateBounds: true); + } + } + + private void NotifyListeners() + { + current = this; + if (onFinished != null) + { + onFinished(); + } + if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished)) + { + eventReceiver.SendMessage(callWhenFinished, this, SendMessageOptions.DontRequireReceiver); + } + current = null; + } + + public static SpringPosition Begin(GameObject go, Vector3 pos, float strength) + { + SpringPosition springPosition = go.GetComponent(); + if (springPosition == null) + { + springPosition = go.AddComponent(); + } + springPosition.target = pos; + springPosition.strength = strength; + springPosition.onFinished = null; + if (!springPosition.enabled) + { + springPosition.mThreshold = 0f; + springPosition.enabled = true; + } + return springPosition; + } +} diff --git a/SVSim.BattleEngine/Engine/Sqlite3Plugin/DBProxy.cs b/SVSim.BattleEngine/Engine/Sqlite3Plugin/DBProxy.cs new file mode 100644 index 0000000..d9394aa --- /dev/null +++ b/SVSim.BattleEngine/Engine/Sqlite3Plugin/DBProxy.cs @@ -0,0 +1,152 @@ +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace Sqlite3Plugin; + +public class DBProxy : IDisposable +{ + public IntPtr DBHandle { get; private set; } + + public string dbPath { get; private set; } + + ~DBProxy() + { + CloseDB(); + } + + public DBProxy() + { + dbPath = null; + DBHandle = IntPtr.Zero; + } + + public bool Open(string fileName, string vfsName = null) + { + dbPath = fileName; + IntPtr ppDB = IntPtr.Zero; + byte[] bytes = Encoding.UTF8.GetBytes(fileName + "\0"); + byte[] zVfs = null; + if (!string.IsNullOrEmpty(vfsName)) + { + zVfs = Encoding.UTF8.GetBytes(vfsName + "\0"); + } + int num = Sqlite3LibImport.sqlite3_open_v2(bytes, out ppDB, 1, zVfs); + DBHandle = ppDB; + bool num2 = num == 0; + if (num2) + { + Exec("pragma journal_mode=OFF"); + Exec("pragma synchronous=0"); + Exec("pragma locking_mode=EXCLUSIVE"); + return num2; + } + Debug.LogError("sqlite3_open failed: code " + num); + return num2; + } + + public bool OpenWritable(string fileName) + { + dbPath = fileName; + IntPtr ppDB = IntPtr.Zero; + bool flag = true; + try + { + int num = Sqlite3LibImport.sqlite3_open(Encoding.UTF8.GetBytes(fileName + "\0"), out ppDB); + DBHandle = ppDB; + flag = num == 0; + if (flag) + { + Exec("pragma journal_mode=MEMORY"); + Exec("pragma synchronous=1"); + Exec("pragma locking_mode=EXCLUSIVE"); + } + else + { + Debug.LogError("sqlite3_open failed: " + num); + } + } + catch (Exception ex) + { + if (ppDB != IntPtr.Zero) + { + Sqlite3LibImport.sqlite3_close(ppDB); + DBHandle = IntPtr.Zero; + } + throw ex; + } + return flag; + } + + public bool Begin() + { + return Exec("BEGIN;"); + } + + public bool Commit() + { + return Exec("COMMIT;"); + } + + public bool Rollback() + { + return Exec("ROLLBACK;"); + } + + public bool Vacuum() + { + return Exec("VACUUM;"); + } + + public virtual void Dispose() + { + CloseDB(); + } + + protected virtual void Dispose(bool disposing) + { + CloseDB(); + } + + private void Terminate() + { + CloseDB(); + } + + public virtual void CloseDB() + { + if (DBHandle != IntPtr.Zero) + { + int num = Sqlite3LibImport.sqlite3_close(DBHandle); + if (num != 0) + { + Debug.LogError("failed to close db at " + dbPath + ": " + num); + } + DBHandle = IntPtr.Zero; + } + } + + public bool Exec(string sql) + { + byte[] bytes = Encoding.UTF8.GetBytes(sql + "\0"); + IntPtr pzErrMsg; + int num = Sqlite3LibImport.sqlite3_exec(DBHandle, bytes, IntPtr.Zero, IntPtr.Zero, out pzErrMsg); + if (num != 0) + { + string text = ((pzErrMsg == IntPtr.Zero) ? "" : Marshal.PtrToStringAnsi(pzErrMsg)); + Debug.LogError($"sqlite3_exec failed (code {num}: {text}) with sql: {sql}"); + ResultCode.CheckCorruption(num, text); + } + return num == 0; + } + + public Query Query(string sql) + { + return new Query(this, sql); + } + + public PreparedQuery PreparedQuery(string sql) + { + return new PreparedQuery(this, sql); + } +} diff --git a/SVSim.BattleEngine/Engine/Sqlite3Plugin/PreparedQuery.cs b/SVSim.BattleEngine/Engine/Sqlite3Plugin/PreparedQuery.cs new file mode 100644 index 0000000..cdb39c3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Sqlite3Plugin/PreparedQuery.cs @@ -0,0 +1,57 @@ +using System; +using System.Text; + +namespace Sqlite3Plugin; + +public class PreparedQuery : Query +{ + public PreparedQuery(DBProxy proxy, string sql) + : base(proxy, sql) + { + } + + public bool BindText(int idx, string text) + { + byte[] bytes = Encoding.UTF8.GetBytes(text); + int num = Sqlite3LibImport.sqlite3_bind_text(_stmt, idx, bytes, bytes.Length, IntPtr.Zero); + if (num != 0) + { + Debug.LogError($"sqlite3_bind_text error at idx {idx}: code {num}"); + ResultCode.CheckCorruption(num); + } + return num == 0; + } + + public bool BindInt(int idx, int iValue) + { + int num = Sqlite3LibImport.sqlite3_bind_int(_stmt, idx, iValue); + if (num != 0) + { + Debug.LogError($"sqlite3_bind_int error at idx {idx}: code {num}"); + ResultCode.CheckCorruption(num); + } + return num == 0; + } + + public bool BindDouble(int idx, double rValue) + { + int num = Sqlite3LibImport.sqlite3_bind_double(_stmt, idx, rValue); + if (num != 0) + { + Debug.LogError($"sqlite3_bind_double error at idx {idx}: code {num}"); + ResultCode.CheckCorruption(num); + } + return num == 0; + } + + public bool Reset() + { + int num = Sqlite3LibImport.sqlite3_reset(_stmt); + if (num != 0) + { + Debug.LogError($"sqlite3_reset error: code {num}"); + ResultCode.CheckCorruption(num); + } + return num == 0; + } +} diff --git a/SVSim.BattleEngine/Engine/Sqlite3Plugin/Query.cs b/SVSim.BattleEngine/Engine/Sqlite3Plugin/Query.cs new file mode 100644 index 0000000..a7b146f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Sqlite3Plugin/Query.cs @@ -0,0 +1,90 @@ +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace Sqlite3Plugin; + +public class Query : IDisposable +{ + protected DBProxy _proxy; + + protected IntPtr _stmt = IntPtr.Zero; + + public Query(DBProxy proxy, string sql) + { + _Setup(proxy, sql); + } + + protected void _Setup(DBProxy proxy, string sql) + { + _proxy = proxy; + byte[] bytes = Encoding.UTF8.GetBytes(sql); + IntPtr ppStmt; + int num = Sqlite3LibImport.sqlite3_prepare_v2(proxy.DBHandle, bytes, bytes.Length, out ppStmt, IntPtr.Zero); + if (num != 0) + { + ResultCode.CheckCorruption(num); + throw new Exception($"sqlite3_prepare_v2 failed(code {num}) with sql: {sql}"); + } + _stmt = ppStmt; + } + + public virtual void Dispose() + { + if (_stmt != IntPtr.Zero) + { + int num = Sqlite3LibImport.sqlite3_finalize(_stmt); + _stmt = IntPtr.Zero; + if (num != 0) + { + Debug.LogError("sqlite3_finalize error: " + num); + ResultCode.CheckCorruption(num); + } + } + } + + public bool Step() + { + int num = Sqlite3LibImport.sqlite3_step(_stmt); + bool num2 = num == 100; + if (!num2) + { + ResultCode.CheckCorruption(num); + } + return num2; + } + + public int GetInt(int idx) + { + return Sqlite3LibImport.sqlite3_column_int(_stmt, idx); + } + + public double GetDouble(int idx) + { + return Sqlite3LibImport.sqlite3_column_double(_stmt, idx); + } + + public string GetText(int idx) + { + return Marshal.PtrToStringAnsi(Sqlite3LibImport.sqlite3_column_text(_stmt, idx)); + } + + public byte[] GetBlob(int idx) + { + int num = Sqlite3LibImport.sqlite3_column_bytes(_stmt, idx); + if (num == 0) + { + Debug.LogError("null blob at idx: " + idx); + return null; + } + IntPtr source = Sqlite3LibImport.sqlite3_column_blob(_stmt, idx); + byte[] array = new byte[num]; + Marshal.Copy(source, array, 0, num); + return array; + } + + public bool IsNull(int idx) + { + return Sqlite3LibImport.sqlite3_column_type(_stmt, idx) == 5; + } +} diff --git a/SVSim.BattleEngine/Engine/StageField.cs b/SVSim.BattleEngine/Engine/StageField.cs new file mode 100644 index 0000000..de2c551 --- /dev/null +++ b/SVSim.BattleEngine/Engine/StageField.cs @@ -0,0 +1,277 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class StageField : BackGroundBase +{ + private static Dictionary specialSkinIdAndColor = new Dictionary + { + { + 2001, + new Color32(125, 229, 72, byte.MaxValue) + }, + { + 2002, + new Color32(248, 116, 171, byte.MaxValue) + }, + { + 2003, + new Color32(96, 110, 178, byte.MaxValue) + }, + { + 2004, + new Color32(238, 185, 39, byte.MaxValue) + }, + { + 2005, + new Color32(171, 202, 233, byte.MaxValue) + }, + { + 2006, + new Color32(218, 25, 132, byte.MaxValue) + }, + { + 2007, + new Color32(239, 75, 129, byte.MaxValue) + }, + { + 2008, + new Color32(byte.MaxValue, 209, 0, byte.MaxValue) + }, + { + 2018, + new Color32(64, 234, byte.MaxValue, byte.MaxValue) + }, + { + 3101, + new Color32(156, 219, 217, byte.MaxValue) + }, + { + 3102, + new Color32(246, 117, 153, byte.MaxValue) + }, + { + 3103, + new Color32(225, 6, 0, byte.MaxValue) + }, + { + 3104, + new Color32(byte.MaxValue, 184, 28, byte.MaxValue) + }, + { + 3105, + new Color32(200, 0, 161, byte.MaxValue) + }, + { + 3106, + new Color32(166, 10, 61, byte.MaxValue) + }, + { + 3107, + new Color32(229, 155, 220, byte.MaxValue) + }, + { + 3108, + new Color32(126, 147, 167, byte.MaxValue) + }, + { + 3111, + new Color32(0, 156, 222, byte.MaxValue) + } + }; + + public override int FieldId => 1004; + + public override int FieldEffectId => 1004; + + public StageField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_1004_root").gameObject; + _fieldObjDictionary.Add("clock", _fieldModel.transform.Find("md_bf_1004_01_clock").gameObject); + _fieldObjDictionary.Add("screen_01", _fieldModel.transform.Find("md_bf_1004_01_screen_01").gameObject); + _fieldObjDictionary.Add("screen_02", _fieldModel.transform.Find("md_bf_1004_01_screen_02").gameObject); + _fieldObjDictionary.Add("screen_03", _fieldModel.transform.Find("md_bf_1004_01_screen_03").gameObject); + _fieldObjDictionary.Add("screen_04", _fieldModel.transform.Find("md_bf_1004_01_screen_04").gameObject); + _fieldObjDictionary.Add("symbol", _fieldModel.transform.Find("md_bf_1004_01_symbol").gameObject); + m_FieldAnimatorDictionary.Add("clock", _fieldObjDictionary["clock"].GetComponent()); + m_FieldAnimatorDictionary.Add("symbol", _fieldObjDictionary["symbol"].GetComponent()); + _fieldParticles = _fieldModel.transform.Find("Particles1004").gameObject; + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("base", _fieldParticles.transform.Find("base").GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_2", _fieldParticles.transform.Find("gimic_2").GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_3", _fieldParticles.transform.Find("gimic_3").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + Color color = Global.EFFECT_COLOR_ELF; + if (specialSkinIdAndColor.ContainsKey(GameMgr.GetIns().GetDataMgr().GetPlayerSkinId())) + { + color = specialSkinIdAndColor[GameMgr.GetIns().GetDataMgr().GetPlayerSkinId()]; + } + else + { + switch (GameMgr.GetIns().GetDataMgr().GetPlayerClassId()) + { + case 1: + color = Global.EFFECT_COLOR_ELF; + break; + case 2: + color = Global.EFFECT_COLOR_ROYAL; + break; + case 3: + color = Global.EFFECT_COLOR_WITCH_2; + break; + case 4: + color = Global.EFFECT_COLOR_DRAGON; + break; + case 5: + color = Global.EFFECT_COLOR_NECROMANCER; + break; + case 6: + color = Global.EFFECT_COLOR_VANPIRE; + break; + case 7: + color = Global.EFFECT_COLOR_BISHOP; + break; + case 8: + color = Global.EFFECT_COLOR_NEMESIS; + break; + } + } + for (int i = 0; i < _fieldParticleSystemDictionary["base"].gameObject.transform.childCount; i++) + { + _fieldParticleSystemDictionary["base"].gameObject.transform.GetChild(i).GetComponent().material.color = color; + } + _fieldParticleSystemDictionary["base"].Play(); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int j = 0; j < _fieldObjDictionary.Count; j++) + { + list2.Add(_fieldObjDictionary[list[j]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: true); + _fieldObjDictionary["screen_02"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_03"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_04"].gameObject.SetActive(value: false); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1004, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1004_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: true); + _fieldObjDictionary["screen_02"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_03"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_04"].gameObject.SetActive(value: false); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + m_FieldAnimatorDictionary["clock"].SetTrigger("opening"); + _battleCamera.Camera.transform.localPosition = new Vector3(-403f, -21f, -570f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-18f, -90f, 95f)); + Vector3[] bezierQuad = MotionUtils.GetBezierQuad(new Vector3(-403f, -21f, -570f), new Vector3(245f, -195f, -175f), new Vector3(758f, -334f, -101f), 10); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierQuad, "movetopath", false, "time", 1.8f, "delay", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuart)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-18f, -90f, 95.5f), "time", 1.8f, "delay", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuart)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + _fieldParticleSystemDictionary["opening"].Clear(); + _fieldParticleSystemDictionary["opening"].Stop(); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: true); + _fieldObjDictionary["screen_02"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_03"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_04"].gameObject.SetActive(value: false); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + m_FieldAnimatorDictionary["symbol"].SetTrigger("tap"); + _fieldParticleSystemDictionary["base"].Clear(); + _fieldParticleSystemDictionary["base"].Stop(); + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(3f); + _fieldParticleSystemDictionary["base"].Play(); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + int num = Random.Range(0, 3); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_field_1004_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + switch (num) + { + case 0: + m_FieldAnimatorDictionary["symbol"].SetTrigger("tap"); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_04"].gameObject.SetActive(value: true); + _fieldParticleSystemDictionary["base"].Clear(); + _fieldParticleSystemDictionary["base"].Stop(); + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(3f); + _fieldObjDictionary["screen_04"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: true); + _fieldParticleSystemDictionary["base"].Play(); + yield return new WaitForSeconds(0f); + _gimicCntDictionary[obj.tag]--; + break; + case 1: + m_FieldAnimatorDictionary["symbol"].SetTrigger("tap"); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_03"].gameObject.SetActive(value: true); + _fieldParticleSystemDictionary["base"].Clear(); + _fieldParticleSystemDictionary["base"].Stop(); + _fieldParticleSystemDictionary["gimic_2"].Play(); + yield return new WaitForSeconds(3f); + _fieldObjDictionary["screen_03"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: true); + _fieldParticleSystemDictionary["base"].Play(); + yield return new WaitForSeconds(0f); + _gimicCntDictionary[obj.tag]--; + break; + case 2: + m_FieldAnimatorDictionary["symbol"].SetTrigger("tap"); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_02"].gameObject.SetActive(value: true); + _fieldParticleSystemDictionary["base"].Clear(); + _fieldParticleSystemDictionary["base"].Stop(); + _fieldParticleSystemDictionary["gimic_3"].Play(); + yield return new WaitForSeconds(3f); + _fieldObjDictionary["screen_02"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: true); + _fieldParticleSystemDictionary["base"].Play(); + yield return new WaitForSeconds(0f); + _gimicCntDictionary[obj.tag]--; + break; + } + } + yield return null; + } +} diff --git a/SVSim.BattleEngine/Engine/StartPickMultiCardVfx.cs b/SVSim.BattleEngine/Engine/StartPickMultiCardVfx.cs new file mode 100644 index 0000000..a194c1b --- /dev/null +++ b/SVSim.BattleEngine/Engine/StartPickMultiCardVfx.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using UnityEngine; +using Wizard.Battle.Resource; +using Wizard.Battle.View.Vfx; + +public class StartPickMultiCardVfx : SequentialVfxPlayer +{ + private readonly IBattleResourceMgr _resourceMgr; + + public StartPickMultiCardVfx(SkillBaseSummon.SummonedCardsList summonedCardsList, IBattleResourceMgr resourceMgr, bool isPlayer = true, bool isToken = false, bool isIgnoreVoice = false, bool isRandomVoice = false, bool isGetoff = false, bool isEvoVoice = false, float voiceWaitTime = -1f, List cardInfoList = null, bool isSeSysSummonLandingDuplicateCheck = false) + { + _resourceMgr = resourceMgr; + Register(InstantVfx.Create(delegate + { + foreach (BattleCardBase summonedCards in summonedCardsList) + { + summonedCards.BattleCardView.Collider.center = new Vector3(0f, 0f, -0.1f); + } + })); + Register(CreateSummonCardHandToInPlayVfx(summonedCardsList, isPlayer, isToken, isIgnoreVoice, isRandomVoice, cardInfoList, isSeSysSummonLandingDuplicateCheck, isGetoff, isEvoVoice, voiceWaitTime)); + } + + private VfxBase CreateSummonCardHandToInPlayVfx(SkillBaseSummon.SummonedCardsList summonedCardsList, bool isPlayer, bool isToken, bool isIgnoreVoice, bool isRandomVoice, List cardInfoList, bool isSeSysSummonLandingDuplicateCheck, bool isGetoff = false, bool isEvoVoice = false, float voiceWaitTime = -1f) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + ReadOnlyCollection summonedCardEffectPairList = summonedCardsList.summonedCardEffectPairList; + ReadOnlyCollection overflowCardEffectPairList = summonedCardsList.overflowCardEffectPairList; + sequentialVfxPlayer.Register(new SummonCardPreperationVfx(summonedCardsList.summonedCards, summonedCardsList.overflowCards)); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + SkillBaseSummon.SummonedCardsList.CardEffectPair cardEffectPair = summonedCardEffectPairList.FirstOrDefault(); + int num = (isRandomVoice ? new System.Random().Next(summonedCardsList.summonedCards.Count()) : (-1)); + for (int i = 0; i < summonedCardEffectPairList.Count; i++) + { + SkillBaseSummon.SummonedCardsList.CardEffectPair cardEffectPair2 = summonedCardEffectPairList[i]; + bool playVoice = !isIgnoreVoice && isToken && cardEffectPair2 == cardEffectPair; + if (!isIgnoreVoice && num != -1 && num == i) + { + playVoice = true; + } + else if (num != -1) + { + playVoice = false; + } + if (isGetoff) + { + DestroyVfx.FileNamePair fileNamePair = new DestroyVfx.FileNamePair("stt_act_getoff_1"); + LoadAndPlayEffectVfx summonEffect = new LoadAndPlayEffectVfx(fileNamePair.ObjectFileName, fileNamePair.SeFileName, cardEffectPair2.card.BattleCardView.Transform, 0f); + parallelVfxPlayer.Register(new SummonUnitVfx(cardEffectPair2.card, isToken, playVoice, _resourceMgr, summonEffect, isEvoVoice)); + } + else + { + parallelVfxPlayer.Register(new SummonUnitVfx(cardEffectPair2.card, isToken, playVoice, _resourceMgr, cardEffectPair2.summonEffect, isEvoVoice, voiceWaitTime, isSeSysSummonLandingDuplicateCheck)); + } + } + for (int j = 0; j < overflowCardEffectPairList.Count; j++) + { + SkillBaseSummon.SummonedCardsList.CardEffectPair cardEffectPair3 = overflowCardEffectPairList[j]; + parallelVfxPlayer.Register(new SummonUnitOverflowVfx(cardEffectPair3.card, j, isToken, _resourceMgr, cardEffectPair3.summonEffect)); + } + for (int k = 0; k < summonedCardsList.summonedCards.Count(); k++) + { + BattleCardBase battleCardBase = summonedCardsList.summonedCards.ElementAt(k); + if (cardInfoList != null) + { + if (battleCardBase.HasStackWhiteRitualAndOtherIconSkill()) + { + parallelVfxPlayer.Register(battleCardBase.BattleCardView.InitializeBattleCardStackIcon(battleCardBase, battleCardBase.Skills)); + } + else + { + parallelVfxPlayer.Register(battleCardBase.BattleCardView.BattleCardIconAnimations.UpdateSkillIconInReplay(cardInfoList[k].InplaySkillEffectList, cardInfoList[k].InductionNumber, isInitialize: true)); + } + } + else if (battleCardBase.HasStackWhiteRitualAndOtherIconSkill()) + { + parallelVfxPlayer.Register(battleCardBase.BattleCardView.InitializeBattleCardStackIcon(battleCardBase, battleCardBase.Skills)); + } + else + { + parallelVfxPlayer.Register(battleCardBase.BattleCardView.InitializeBattleCardIcon(battleCardBase, battleCardBase.Skills)); + } + } + sequentialVfxPlayer.Register(parallelVfxPlayer); + return sequentialVfxPlayer; + } +} diff --git a/SVSim.BattleEngine/Engine/StockEmitMgr.cs b/SVSim.BattleEngine/Engine/StockEmitMgr.cs new file mode 100644 index 0000000..7e94d47 --- /dev/null +++ b/SVSim.BattleEngine/Engine/StockEmitMgr.cs @@ -0,0 +1,116 @@ +using System.Collections.Generic; +using System.Linq; + +public class StockEmitMgr : StockSequenceMgr +{ + private List> _pubSequenceSendAllData = new List>(); + + public static float WAIT_ACK_TIMEOUT = 3f; + + private long _emitTime; + + public static float ACK_NOT_RECEIVE_LOG_TIME = 15f; + + public int SequenceNumber { get; private set; } + + public long EmitToAckCheckTime { get; private set; } + + public bool IsReceiveAck { get; private set; } + + public StockEmitMgr(string name) + : base(name) + { + SequenceNumber = 1; + } + + public override void StockData(Dictionary data) + { + base.StockData(data); + bool flag = false; + if (_pubSequenceSendAllData.Count > 0) + { + for (int i = 0; i < _pubSequenceSendAllData.Count; i++) + { + if (_pubSequenceSendAllData[i].ContainsKey("pubSeq") && data.ContainsKey("pubSeq") && _pubSequenceSendAllData[i]["pubSeq"] == data["pubSeq"]) + { + flag = true; + break; + } + } + } + if (!flag) + { + _pubSequenceSendAllData.Add(data); + } + } + + public void AddSequenceNumber() + { + SequenceNumber++; + } + + public void ResetSequence() + { + SequenceNumber = 1; + _pubSequenceSendAllData.Clear(); + } + + public Dictionary GetSelectData(int num) + { + Dictionary dictionary = sequenceDataList.FirstOrDefault((Dictionary d) => GetSequenceNumber(d) == num); + if (dictionary == null) + { + dictionary = _pubSequenceSendAllData.FirstOrDefault((Dictionary d) => GetSequenceNumber(d) == num); + } + return dictionary; + } + + public Dictionary GetAllSelectData(int num) + { + return _pubSequenceSendAllData.FirstOrDefault((Dictionary d) => GetSequenceNumber(d) == num); + } + + public void FirstAddSequenceDataList(Dictionary info) + { + lock (sequenceDataList) + { + sequenceDataList.Insert(0, info); + } + } + + public List> GetSequenceAllData() + { + return sequenceDataList; + } + + public void Recovery(int sequenceNumber) + { + SequenceNumber = sequenceNumber; + ClearSequenceDataList(); + } + + public void SetEmitTime(long emitTime) + { + _emitTime = emitTime; + if (IsReceiveAck) + { + SetEmitToAckCheckTime(emitTime); + } + IsReceiveAck = false; + } + + public void SetEmitToAckCheckTime(long time) + { + EmitToAckCheckTime = time; + } + + public void SetReceiveAck() + { + IsReceiveAck = true; + } + + public long GetEmitTime() + { + return _emitTime; + } +} diff --git a/SVSim.BattleEngine/Engine/StoryCardPanel.cs b/SVSim.BattleEngine/Engine/StoryCardPanel.cs new file mode 100644 index 0000000..1131c49 --- /dev/null +++ b/SVSim.BattleEngine/Engine/StoryCardPanel.cs @@ -0,0 +1,20 @@ +using UnityEngine; + +public class StoryCardPanel : MyPageCardPanel +{ + [SerializeField] + private GameObject _appealRibbon; + + [SerializeField] + private GameObject _appealBadge; + + public void DispAppealRibbon(bool inDisp) + { + _appealRibbon.SetActive(inDisp); + } + + public void DispAppealBadge(bool inDisp) + { + _appealBadge.SetActive(inDisp); + } +} diff --git a/SVSim.BattleEngine/Engine/StoryChapterData.cs b/SVSim.BattleEngine/Engine/StoryChapterData.cs new file mode 100644 index 0000000..6a9ea9f --- /dev/null +++ b/SVSim.BattleEngine/Engine/StoryChapterData.cs @@ -0,0 +1,404 @@ +using System.Collections.Generic; +using System.Linq; +using LitJson; +using UnityEngine; +using Wizard; + +public class StoryChapterData : HeaderData +{ + public enum ChapterClearStatus + { + NotCleared, + AlreadyRead, + Cleared + } + + public class StoryReward + { + public int RewardType { get; } + + public long RewardUserGoodsId { get; } + + public int RewardNumber { get; } + + public StoryReward(JsonData data) + { + RewardType = data["reward_type"].ToInt(); + RewardUserGoodsId = data["reward_detail_id"].ToLong(); + RewardNumber = data["reward_number"].ToInt(); + } + } + + public class SubChapterData + { + public int StoryId { get; private set; } + + public int SubChapterId { get; private set; } + + public ChapterClearStatus ClearStatus { get; private set; } + + public string BtnLoadPath { get; set; } + + public bool IsMaintenanceChapter { get; private set; } + + public SubChapterData(JsonData jsonData) + { + StoryId = jsonData["story_id"].ToInt(); + SubChapterId = jsonData["sub_chapter_id"].ToInt(); + ClearStatus = (jsonData["is_finish"].ToBoolean() ? ChapterClearStatus.Cleared : ChapterClearStatus.NotCleared); + IsMaintenanceChapter = jsonData.GetValueOrDefault("is_maintenance_chapter", defaultValue: false); + } + } + + public static readonly int SUB_CHAPTER_ALL = int.MaxValue; + + public int StoryId { get; } + + public int SectionId { get; } + + public int CharaId { get; } + + public string ChapterId { get; } + + public string NextChapterId { get; } + + public List SubChapterDatas { get; } + + public bool ExistsSecondHalfStory { get; } + + public bool ExistsStoryMovie { get; } + + public bool IsMaintenanceChapter { get; set; } + + public bool IsReleased { get; } + + public bool IsLocked { get; } + + public string UnlockConditionText { get; } + + public ChapterClearStatus ClearStatus { get; } + + public StoryReward[] Rewards { get; } + + public string LastChapterClearTextId { get; } + + public int ChapterRowNum { get; } + + public string SelectionDisplayPosition { get; } + + public string SelectionTextId { get; } + + public string RequiredChapterId { get; } + + public int RequiredChapterRowNum { get; } + + public int NextChapterRowNum { get; } + + public string[] NextChapterSplitted { get; } + + public string RouteName { get; } + + public bool ExistsBattle { get; } + + public bool IsEnableBattleSkip { get; } + + public bool IsSkipBattle + { + get + { + if (IsEnableBattleSkip) + { + return PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SKIP_CLEARED_STORY_BATTLE); + } + return false; + } + } + + public bool IsDoBattle + { + get + { + if (ExistsBattle) + { + return !IsSkipBattle; + } + return false; + } + } + + public bool IsFixedDeck + { + get + { + if (SectionId != StorySection.TUTORIAL_SECTION_ID) + { + return IsClassTutorial; + } + return true; + } + } + + public int EnemyAiId { get; } + + public List BattleSettingDatas { get; } + + public Vector2 MapIconPos { get; } + + public bool IsDisplayMapIcon { get; } + + public bool IsEnableDragMapBG { get; } + + public int ChapterButtonBgId { get; } + + public string ChapterEffectPath { get; } + + public bool IsReleasedAnotherEnding { get; } + + public bool IsPlayAnotherEndingAppearanceAnimation { get; } + + public int TutorialStep { get; } + + public bool IsClassTutorial + { + get + { + if (SectionId == 1) + { + return ChapterId == "1"; + } + return false; + } + } + + public bool IsAlreadyRead => ClearStatus == ChapterClearStatus.AlreadyRead; + + public bool IsCleared => ClearStatus == ChapterClearStatus.Cleared; + + public bool IsPlayedChapter + { + get + { + if (!IsAlreadyRead) + { + return IsCleared; + } + return true; + } + } + + public List AvailableDeckClassList => BattleSettingDatas.Select((BattleSettingData bd) => bd.DeckClassId).Distinct().ToList(); + + public List CharaIdList => BattleSettingDatas.Select((BattleSettingData bd) => bd.PlayerCharaId).Distinct().ToList(); + + public bool IsBranchChapter => !string.IsNullOrEmpty(UIUtil.ExtractStringAlphabet(ChapterId)); + + public bool IsDuplicateDeckClass => (from bd in BattleSettingDatas + select bd.DeckClassId into x + group x by x).Any((IGrouping x) => x.Count() > 1); + + public bool IsExistNextChapter => NextChapterId != "0"; + + public string AllReadButtonPath { get; set; } + + public bool IsNotReleasedDisplayChapter { get; set; } + + public int[] AllSubStoryIds => SubChapterDatas.Select((SubChapterData x) => x.StoryId).ToArray(); + + public bool ExistsSubChapter => SubChapterDatas.Count > 0; + + public BattleSettingData FindBattleSettingDataByDeckSkinId(int deckSkinId) + { + return BattleSettingDatas.Find((BattleSettingData x) => x.DeckSkinId == deckSkinId); + } + + public BattleSettingData FindBattleSettingDataByDeckClassId(int deckClassId) + { + return BattleSettingDatas.Find((BattleSettingData x) => x.DeckClassId == deckClassId); + } + + public BattleSettingData FindBattleSettingDataByPlayerCharaId(int playerCharaId) + { + return BattleSettingDatas.Find((BattleSettingData x) => x.PlayerCharaId == playerCharaId); + } + + private ChapterClearStatus GetClearStatusUsingSubChapter() + { + if (!ExistsSubChapter) + { + return ChapterClearStatus.Cleared; + } + int num = SubChapterDatas.Where((SubChapterData item) => item.ClearStatus == ChapterClearStatus.Cleared).Count(); + if (num == SubChapterDatas.Count()) + { + return ChapterClearStatus.Cleared; + } + if (num == 0) + { + return ChapterClearStatus.NotCleared; + } + return ChapterClearStatus.AlreadyRead; + } + + public StoryChapterData(JsonData data) + { + StoryId = data["story_id"].ToInt(); + SectionId = data["section_id"].ToInt(); + CharaId = data["chara_id"].ToInt(); + ChapterId = data["chapter_id"].ToString(); + NextChapterId = data["next_chapter_id"].ToString(); + SubChapterDatas = GetSubChapterDatas(data); + ExistsSecondHalfStory = data["battle_exists"].ToBoolean(); + ExistsStoryMovie = data["show_subtitles"].ToInt() == 1; + IsMaintenanceChapter = data["is_maintenance_chapter"].ToBoolean(); + IsReleased = data["is_released"].ToBoolean(); + IsLocked = data["is_lock"].ToBoolean(); + string text = data["unlock_text"].ToString(); + UnlockConditionText = (string.IsNullOrEmpty(text) ? null : text.Replace("\\n", "\n")); + ClearStatus = GetChapterClearStatus(data); + Rewards = GetRewards(data); + string text2 = data["chapter_clear_text_id"].ToString(); + LastChapterClearTextId = (string.IsNullOrEmpty(text2) ? null : text2); + ExistsBattle = data["battle_exists"].ToBoolean(); + IsEnableBattleSkip = data["battle_exists"].ToBoolean() && data["is_skip_enabled"].ToBoolean(); + EnemyAiId = data["enemy_ai_id"].ToInt(); + BattleSettingDatas = GetBattleSettingDatas(data, new BattleSettingBaseData(data)); + float x = float.Parse(data["x_coordinate"].ToString()); + float y = float.Parse(data["y_coordinate"].ToString()); + MapIconPos = new Vector2(x, y); + IsDisplayMapIcon = data["show_coordinate"].ToInt() == 1; + IsEnableDragMapBG = data["is_camera_ movable"].ToInt() == 1; + ChapterButtonBgId = int.Parse(data["bg_file_name"].ToString()); + ChapterEffectPath = data["chapter_effect_path"].ToString(); + SelectionDisplayPosition = data.GetValueOrDefault("selection_display_position", ""); + SelectionTextId = data.GetValueOrDefault("selection_text_id", ""); + RequiredChapterId = data.GetValueOrDefault("required_chapter_id", ""); + ChapterRowNum = ((!string.IsNullOrEmpty(ChapterId)) ? UIUtil.ExtractStringNumber(ChapterId) : 0); + RequiredChapterRowNum = ((!string.IsNullOrEmpty(RequiredChapterId)) ? UIUtil.ExtractStringNumber(RequiredChapterId) : 0); + int[] array = (from s in NextChapterId.Split(' ') + select UIUtil.ExtractStringNumber(s)).Distinct().ToArray(); + NextChapterRowNum = array[0]; + NextChapterSplitted = NextChapterId.Split(' '); + RouteName = GetRouteName(SectionId, CharaId, ChapterId); + IsReleasedAnotherEnding = data["is_released_another_end"].ToBoolean(); + IsPlayAnotherEndingAppearanceAnimation = data["is_play_another_end_appearance_animation"].ToBoolean(); + } + + public StoryChapterData(TutorialAreaSelect data) + { + int tutorial_step = Data.Load.data._userTutorial.tutorial_step; + bool flag = tutorial_step == 100; + SectionId = 0; + CharaId = 500008; + ChapterId = data.ChapterId; + SubChapterDatas = new List(); + ExistsSecondHalfStory = false; + ExistsStoryMovie = data.ExistsStoryMovie; + IsMaintenanceChapter = false; + IsReleased = tutorial_step >= data.TutorialStep; + ClearStatus = ((tutorial_step > data.TutorialStep) ? ChapterClearStatus.Cleared : ChapterClearStatus.NotCleared); + Rewards = new StoryReward[0]; + ExistsBattle = true; + IsEnableBattleSkip = flag; + BattleSettingDatas = new List(); + MapIconPos = data.MapIconPos; + IsDisplayMapIcon = true; + IsEnableDragMapBG = true; + ChapterButtonBgId = data.ChapterButtonBgId; + ChapterEffectPath = string.Empty; + TutorialStep = data.TutorialStep; + } + + private static List GetSubChapterDatas(JsonData jsonData) + { + List list = new List(); + if (jsonData.TryGetValue("sub_chapters", out var value)) + { + for (int i = 0; i < value.Count; i++) + { + list.Add(new SubChapterData(value[i])); + } + } + return list; + } + + private static StoryReward[] GetRewards(JsonData jsonData) + { + JsonData jsonData2 = jsonData["story_reward"]; + StoryReward[] array = new StoryReward[jsonData2.Count]; + for (int i = 0; i < array.Length; i++) + { + array[i] = new StoryReward(jsonData2[i]); + } + return array; + } + + private static List GetBattleSettingDatas(JsonData jsonData, BattleSettingBaseData baseData) + { + JsonData jsonData2 = jsonData["battle_settings"]; + List list = new List(); + for (int i = 0; i < jsonData2.Count; i++) + { + JsonData jsonData3 = jsonData2[i]; + if (jsonData3["deck_class_id"].ToInt() != 0) + { + list.Add(new BattleSettingData(jsonData3, baseData)); + } + } + return list; + } + + private ChapterClearStatus GetChapterClearStatus(JsonData jsonData) + { + if (ExistsSubChapter) + { + return GetClearStatusUsingSubChapter(); + } + if (jsonData["is_finish"].ToBoolean()) + { + return ChapterClearStatus.Cleared; + } + if (jsonData["is_skipped"].ToBoolean()) + { + return ChapterClearStatus.AlreadyRead; + } + return ChapterClearStatus.NotCleared; + } + + private SubChapterData FindSubChapterData(int subChapterId) + { + return SubChapterDatas.Find((SubChapterData data) => data.SubChapterId == subChapterId); + } + + public int[] GetStartStoryIds(int? subChapterId) + { + if (!subChapterId.HasValue) + { + return new int[1] { StoryId }; + } + if (subChapterId == SUB_CHAPTER_ALL) + { + return AllSubStoryIds; + } + return new int[1] { FindSubChapterData(subChapterId.Value).StoryId }; + } + + public int GetFinishStoryId(int? subChapterId) + { + if (!subChapterId.HasValue) + { + return StoryId; + } + return FindSubChapterData(subChapterId.Value).StoryId; + } + + private static string GetRouteName(int sectionId, int charaId, string chapterId) + { + string text = UIUtil.ExtractStringAlphabet(chapterId); + if (string.IsNullOrEmpty(text)) + { + return null; + } + string key = $"Route_{sectionId}_{charaId}_{text}"; + return Data.SystemText.Get(key); + } +} diff --git a/SVSim.BattleEngine/Engine/StoryFinish.cs b/SVSim.BattleEngine/Engine/StoryFinish.cs new file mode 100644 index 0000000..9add9b2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/StoryFinish.cs @@ -0,0 +1,4 @@ +public class StoryFinish : HeaderData +{ + public StoryFinishDetail data; +} diff --git a/SVSim.BattleEngine/Engine/StoryFinishDetail.cs b/SVSim.BattleEngine/Engine/StoryFinishDetail.cs new file mode 100644 index 0000000..c712084 --- /dev/null +++ b/SVSim.BattleEngine/Engine/StoryFinishDetail.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using LitJson; + +public class StoryFinishDetail +{ + public JsonData _responseData; + + public int get_class_chara_experience; + + public int class_chara_experience; + + public int class_chara_level; + + public List achieved_mission_list => AchievedInfo._missions; + + public List achieved_achievement_list => AchievedInfo._achievements; + + public List Rewards => AchievedInfo._rewards; + + public IReadOnlyList StoryClearRewards { get; set; } = Array.Empty(); + + public AchievedInfo AchievedInfo { get; private set; } + + public StoryFinishDetail() + { + AchievedInfo = new AchievedInfo(); + } +} diff --git a/SVSim.BattleEngine/Engine/StoryInfo.cs b/SVSim.BattleEngine/Engine/StoryInfo.cs new file mode 100644 index 0000000..66ed91b --- /dev/null +++ b/SVSim.BattleEngine/Engine/StoryInfo.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +public class StoryInfo : HeaderData +{ + public List ChapterDataList { get; set; } = new List(); + + public bool IsPreBuildDeck { get; set; } + + public bool IsTrialDeck { get; set; } + + public bool IsStoryBattleDone { get; set; } + + public StoryChapterData FindChapterData(string chapterId) + { + return ChapterDataList.Find((StoryChapterData x) => x.ChapterId == chapterId); + } +} diff --git a/SVSim.BattleEngine/Engine/StoryLeaderSelect.cs b/SVSim.BattleEngine/Engine/StoryLeaderSelect.cs new file mode 100644 index 0000000..f9a21d9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/StoryLeaderSelect.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; + +public class StoryLeaderSelect : HeaderData +{ + private List _dataList = new List(); + + public List DataList => _dataList; + + public int LeaderCount { get; set; } + + public IEnumerable LeaderCharaIds => _dataList.Select((StoryLeaderSelectData x) => x.CharaId); + + public StoryLeaderSelectData FindLeaderSelectDataByClassId(int classId) + { + return DataList.Find((StoryLeaderSelectData x) => x.ClassId == classId); + } +} diff --git a/SVSim.BattleEngine/Engine/StoryLeaderSelectData.cs b/SVSim.BattleEngine/Engine/StoryLeaderSelectData.cs new file mode 100644 index 0000000..12cc6eb --- /dev/null +++ b/SVSim.BattleEngine/Engine/StoryLeaderSelectData.cs @@ -0,0 +1,11 @@ +public class StoryLeaderSelectData +{ + public int CharaId { get; set; } + + public bool IsFinished { get; set; } + + public string CurrentChapter { get; set; } + + public int ClassId => GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId(CharaId) + .class_id; +} diff --git a/SVSim.BattleEngine/Engine/StoryNextSceneSelector.cs b/SVSim.BattleEngine/Engine/StoryNextSceneSelector.cs new file mode 100644 index 0000000..96b33fd --- /dev/null +++ b/SVSim.BattleEngine/Engine/StoryNextSceneSelector.cs @@ -0,0 +1,252 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Story; +using Wizard.Story.ChapterSelection.SelectionProcessing.BattleResult; + +public class StoryNextSceneSelector : INextSceneSelector +{ + private BattleResultUIController m_battleResultNewControl; + + private const int BUILD_DECK_RENTAL_LOSE_COUNT = 2; + + private const float INTERVAL_OPEN_DIALOG = 0.1f; + + private bool _isEnableDeckRentalAssist; + + private bool _isWin; + + private int _loseCount; + + private readonly IProcessing _firstSelectionProcessing; + + private static bool _isHistoryOfUsingTrialDeck; + + private SelectedStoryInfo SelectedStoryInfo => Data.SelectedStoryInfo; + + private UIManager.ViewScene ChapterSelectionView => SelectedStoryInfo.ChapterSelectionView; + + private static KeyValuePair DeckRentalPlayerPrefsKey => new KeyValuePair($"{PlayerPrefsWrapper.STORY_BATTLE_LOSE_COUNT}{Data.SelectedStoryInfo.StoryId}", 0); + + public StoryNextSceneSelector(BattleResultUIController battleResultControl) + { + m_battleResultNewControl = battleResultControl; + _loseCount = GetDeckRentalLoseCount(); + _firstSelectionProcessing = CreateSelectionProcessings(); + } + + public static int GetDeckRentalLoseCount() + { + return PlayerPrefsWrapper.GetValue(DeckRentalPlayerPrefsKey); + } + + public static void SetDeckRentalLoseCount(int loseCount) + { + PlayerPrefsWrapper.SetValue(DeckRentalPlayerPrefsKey, loseCount); + } + + public static void ResetHistoryOfUsingPreBuildDeck() + { + _isHistoryOfUsingTrialDeck = false; + } + + public void Setup(bool isWin, GameObject gameObject) + { + _isWin = isWin; + if (Data.StoryInfo.IsPreBuildDeck) + { + GameMgr.GetIns().GetDataMgr().LastSelectDeckAttributeType = DeckAttributeType.BuildDeck; + } + _isHistoryOfUsingTrialDeck = _isHistoryOfUsingTrialDeck || Data.StoryInfo.IsTrialDeck; + if (!isWin) + { + Data.StoryInfo.IsPreBuildDeck = false; + } + int num = 0; + if (IsEnableDeckRentalStory() && !isWin) + { + num = _loseCount + 1; + } + if (IsEnableDeckRentalStory() && num >= 2 && !_isHistoryOfUsingTrialDeck) + { + _isEnableDeckRentalAssist = true; + } + else + { + ShowResult(isWin); + } + } + + private void ShowResult(bool isWin) + { + m_battleResultNewControl.MissionBtnObj.labels[0].text = Data.SystemText.Get("Battle_0200"); + m_battleResultNewControl.MissionBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.MissionBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + UIManager.GetInstance().createInSceneCenterLoading(); + MissionInfoTask missionInfoTask = GameMgr.GetIns().GetMissionInfoTask(); + missionInfoTask.SetParameter(); + m_battleResultNewControl.StartCoroutine(Toolbox.NetworkManager.Connect(missionInfoTask, delegate + { + m_battleResultNewControl.CreateMissionList(); + }, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + })); + m_battleResultNewControl.HomeBtnObj.buttons[0].onClick.Clear(); + m_battleResultNewControl.RetryBtnObj.buttons[0].onClick.Clear(); + if (isWin) + { + m_battleResultNewControl.HomeBtnObj.gameObject.SetActive(value: false); + m_battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Story_0004"); + m_battleResultNewControl.RetryBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE_TRANS); + if (isWin) + { + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.Scenario2); + } + })); + return; + } + m_battleResultNewControl.HomeBtnObj.labels[0].text = Data.SystemText.Get("Story_0002"); + m_battleResultNewControl.HomeBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL_TRANS); + GameMgr.GetIns().GetBattleCtrl().BattleEnd(ChapterSelectionView); + })); + m_battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Battle_0204"); + m_battleResultNewControl.RetryBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + CreateDeckSelectForStory(); + })); + } + + private void ShowDeckRentalConfirmDialog() + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(systemText.Get("Story_0054")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetTitleLabel(systemText.Get("Story_0053")); + dialogBase.SetButtonText(systemText.Get("Story_0055"), systemText.Get("Common_0005")); + dialogBase.onPushButton1 = delegate + { + CreateDeckSelectForStoryWithPrimaryTrialDeck(); + }; + dialogBase.onPushButton2 = delegate + { + DeckRentalFinish(); + }; + dialogBase.onCloseWithoutSelect = delegate + { + DeckRentalFinish(); + }; + } + + private void DeckRentalFinish() + { + if (!Data.StoryInfo.IsTrialDeck) + { + SetDeckRentalLoseCount(0); + ShowResult(_isWin); + ResultMenuAppearAnimation(); + } + } + + public void CreateDeckSelectForStory() + { + Parameter param = new Parameter(UIManager.GetInstance(), SelectedStoryInfo, (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_FORMAT), DeckAttributeType.Invalid, null, null); + ExecuteSelectionProcessings(param); + } + + private void CreateDeckSelectForStoryWithPrimaryTrialDeck() + { + bool isDecidedDeck = false; + Parameter param = new Parameter(UIManager.GetInstance(), SelectedStoryInfo, Format.Max, DeckAttributeType.TrialDeck, delegate + { + if (!isDecidedDeck) + { + ShowDeckRentalConfirmDialog(); + } + }, delegate + { + isDecidedDeck = true; + }); + ExecuteSelectionProcessings(param); + Data.StoryInfo.IsTrialDeck = false; + } + + private bool IsEnableDeckRentalStory() + { + if (SelectedStoryInfo.IsFixedDeck) + { + return false; + } + if (SelectedStoryInfo.ClearStatus == StoryChapterData.ChapterClearStatus.Cleared) + { + return false; + } + return true; + } + + private IEnumerator ShowRentalDeckCoroutine() + { + yield return new WaitForSeconds(0.5f); + bool isWaitRewardDialog = m_battleResultNewControl.IsRewardWait; + while (m_battleResultNewControl.IsRewardWait) + { + yield return null; + } + if (isWaitRewardDialog) + { + yield return new WaitForSeconds(0.1f); + } + ShowDeckRentalConfirmDialog(); + } + + public void Show() + { + if (_isEnableDeckRentalAssist) + { + m_battleResultNewControl.StartCoroutine(ShowRentalDeckCoroutine()); + } + else + { + ResultMenuAppearAnimation(); + } + } + + private void ResultMenuAppearAnimation() + { + iTween.MoveTo(m_battleResultNewControl.ButtonGrid.gameObject, iTween.Hash("position", m_battleResultNewControl.DefaultPosDict["ButtonGrid"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + private static IProcessing CreateSelectionProcessings() + { + IProcessing[] array = new IProcessing[6] + { + new DeckSelectionDialogDisplay(), + new ChapterCharaDecider(), + new DownloadInfoGetter(), + new DeckSelectionConfirmDialogDisplay(), + new Download(), + new BattleStarter() + }; + for (int i = 0; i < array.Length - 1; i++) + { + array[i].NextProcessing = array[i + 1]; + } + return array.FirstOrDefault(); + } + + private void ExecuteSelectionProcessings(Parameter param) + { + if (_firstSelectionProcessing != null) + { + _firstSelectionProcessing.Execute(param); + } + } +} diff --git a/SVSim.BattleEngine/Engine/StoryReportEndAgent.cs b/SVSim.BattleEngine/Engine/StoryReportEndAgent.cs new file mode 100644 index 0000000..4b40260 --- /dev/null +++ b/SVSim.BattleEngine/Engine/StoryReportEndAgent.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +public class StoryReportEndAgent : MonoBehaviour +{ + public bool IsEnd { get; private set; } + + public void Finished() + { + IsEnd = true; + } +} diff --git a/SVSim.BattleEngine/Engine/StoryResultAnimationAgent.cs b/SVSim.BattleEngine/Engine/StoryResultAnimationAgent.cs new file mode 100644 index 0000000..41fa8c3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/StoryResultAnimationAgent.cs @@ -0,0 +1,206 @@ +using System.Collections; +using UnityEngine; +using Wizard; +using Wizard.Story; + +public class StoryResultAnimationAgent : ResultAnimationAgent +{ + public override IEnumerator RunUI(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin) + { + if (battleResultControl.ResultReporter.LotteryData.IsEnable) + { + yield return LoadLotteryImage(battleResultControl.ResultReporter.LotteryData); + } + DataMgr.SpecialBattleResultType skipStorySpecialBatlleResult = GameMgr.GetIns().GetDataMgr().SkipStorySpecialBattleResult; + if (skipStorySpecialBatlleResult != DataMgr.SpecialBattleResultType.None && !isWin) + { + GameMgr.GetIns().GetDataMgr().ResetStorySpecialBattleResultSkipFlag(); + } + m_BattleCamera.m_CutInCamera.gameObject.SetActive(value: false); + if (skipStorySpecialBatlleResult != DataMgr.SpecialBattleResultType.None && isWin) + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + GameMgr.GetIns().GetDataMgr().SetPlayerEmotionId(string.Empty); + GameMgr.GetIns().GetDataMgr().SetEnemyEmotionId(string.Empty); + } + else + { + if (battleResultControl.IsDraw) + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleDraw.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 48, 16, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + else if (isWin) + { + battleResultControl.TitleWin.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.gameObject.SetActive(value: true); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleWin.alpha = 0f; + battleResultControl.Bg.color = new Color32(32, 24, 0, 0); + battleResultControl.ResultTitle.spriteName = "result_top_win"; + } + else + { + battleResultControl.TitleLose.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleLose.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 24, 48, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + battleResultControl.MainPanel.alpha = 1f; + yield return new WaitForSeconds(0.1f); + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + else if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOUWIN); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_WIN); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + TweenAlpha.Begin(battleResultControl.Bg.gameObject, 0.5f, 0.75f); + yield return new WaitForSeconds(0.2f); + TweenAlpha.Begin(battleResultControl.ArcaneIn.gameObject, 0.5f, 1f); + TweenAlpha.Begin(battleResultControl.ArcaneOut.gameObject, 0.5f, 1f); + iTween.ScaleTo(battleResultControl.ArcaneIn.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(battleResultControl.ArcaneOut.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + if (battleResultControl.IsDraw) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_3, Vector3.zero); + battleResultControl.TitleDraw.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else if (isWin) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_1, Vector3.zero); + battleResultControl.TitleWin.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_2, Vector3.zero); + battleResultControl.TitleLose.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + } + if (skipStorySpecialBatlleResult != DataMgr.SpecialBattleResultType.None && isWin) + { + battleResultControl.SetClassLvAndExp(); + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.Scenario2); + } + else + { + StartCoroutine(ShowResult(battleResultControl, nextSceneSelector, isWin)); + } + } + + private IEnumerator ShowResult(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin) + { + HideEmotionMessage(); + if (battleResultControl.ResultMsgWindowFlag) + { + StartCoroutine(battleResultControl.ShowSpecialResultInfo()); + } + yield return new WaitForSeconds(2f); + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_3, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 0f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 3f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_1, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_2, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + yield return new WaitForSeconds(0.2f); + if (isWin) + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_WIN_LOOP); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_LOSE_LOOP); + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_WINDOW_APPER); + iTween.MoveTo(battleResultControl.ClassCharObj.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassCharObj"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ResultTitle.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ResultTitle"], "time", 0.5f, "delay", 0f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ClassInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassInfo"], "time", 0.5f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(1f); + if (isWin) + { + string voiceId = GameMgr.GetIns().GetDataMgr().GetPlayerEmotionData()[ClassCharaPrm.EmotionType.WIN].GetVoiceId(BattleManagerBase.GetIns().BattlePlayer.IsSkinEvolved); + GameMgr.GetIns().GetSoundMgr().PlayVoiceByKey(voiceId); + } + GameMgr.GetIns().GetDataMgr().SetPlayerEmotionId(string.Empty); + GameMgr.GetIns().GetDataMgr().SetEnemyEmotionId(string.Empty); + if (battleResultControl.AddClassExp > 0) + { + battleResultControl.SettingAddClassExpTextAnimation(); + yield return new WaitForSeconds(0.5f); + for (int i = 0; i < 10; i++) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP); + yield return new WaitForSeconds(0.05f); + } + yield return new WaitForSeconds(0.5f); + } + battleResultControl.SetBattlePassGauge(delegate + { + StartCoroutine(FinishResult(battleResultControl, nextSceneSelector, isWin)); + }); + } + + public IEnumerator FinishResult(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin) + { + SelectedStoryInfo selectedStoryInfo = Data.SelectedStoryInfo; + if (!selectedStoryInfo.IsClassTutorial || !isWin) + { + nextSceneSelector.Show(); + } + else if (selectedStoryInfo.ClearStatus == StoryChapterData.ChapterClearStatus.Cleared) + { + battleResultControl.RewardCheck(); + } + battleResultControl.PrepareAchievementLog(); + if (battleResultControl.ResultReporter.LotteryData.IsEnable) + { + yield return CreateLotteryDialog(battleResultControl.ResultReporter.LotteryData); + } + if (ShowRewardDialog(battleResultControl, addStoryReward: true)) + { + while (battleResultControl.IsRewardWait) + { + yield return null; + } + } + battleResultControl.FinishResult(); + } +} diff --git a/SVSim.BattleEngine/Engine/StoryResultAnimationHandler.cs b/SVSim.BattleEngine/Engine/StoryResultAnimationHandler.cs new file mode 100644 index 0000000..ac47242 --- /dev/null +++ b/SVSim.BattleEngine/Engine/StoryResultAnimationHandler.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +public class StoryResultAnimationHandler : IResultAnimationHandler +{ + private readonly GameObject m_resultAnimationAgentObj; + + private readonly StoryResultAnimationAgent m_resultAnimationAgentIns; + + public ResultAnimationAgent m_resultAnimationAgent => m_resultAnimationAgentIns; + + public StoryResultAnimationHandler(BattleCamera battleCamera) + { + m_resultAnimationAgentObj = new GameObject(); + m_resultAnimationAgentIns = m_resultAnimationAgentObj.AddComponent(); + m_resultAnimationAgentIns.GetComponent().SetBattleCamera(battleCamera); + } + + public void Destroy() + { + Object.Destroy(m_resultAnimationAgentObj); + } +} diff --git a/SVSim.BattleEngine/Engine/StoryResultReporter.cs b/SVSim.BattleEngine/Engine/StoryResultReporter.cs new file mode 100644 index 0000000..eb54146 --- /dev/null +++ b/SVSim.BattleEngine/Engine/StoryResultReporter.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using Cute; +using LitJson; +using UnityEngine; +using Wizard; +using Wizard.Lottery; +using Wizard.Story; + +public class StoryResultReporter : IBattleResultReporter +{ + private readonly GameObject m_reportEndAgentObj; + + private readonly StoryReportEndAgent m_reportEndAgent; + + public bool IsEnd => m_reportEndAgent.IsEnd; + + public int ClassExp => GetClassExp(); + + public List UserAchievement => GetUserAchievementList(); + + public List UserMission => GetUserMissionList(); + + public List MissionRewards => GetRewardsList(); + + public List VictoryRewards => null; + + public LotteryApplyData LotteryData => Data.StoryFinish.data.AchievedInfo._lotteryData; + + public MyPageHomeDialogData HomeDialogData => null; + + public bool IsDataExist => true; + + public StoryResultReporter() + { + m_reportEndAgentObj = new GameObject(); + m_reportEndAgent = m_reportEndAgentObj.AddComponent(); + } + + public void Report(bool isWin) + { + StartFinishStory(delegate + { + m_reportEndAgent.Finished(); + }); + } + + public void StartFinishStory(Action callback) + { + SelectedStoryInfo selectedStoryInfo = Data.SelectedStoryInfo; + NetworkManager networkManager = Toolbox.NetworkManager; + BattleManagerBase battleMgr = BattleManagerBase.GetIns(); + if (Convert.ToBoolean(battleMgr.isStorySuccessful)) + { + selectedStoryInfo.SetPart(ScenarioPart.SecondHalf); + } + int cumulativeEvolutionCount = battleMgr.BattlePlayer._cumulativeEvolutionCount; + int turn = battleMgr.BattlePlayer.Turn; + LocalLog.RecordCheckLog(LocalLog.RecordType.CERBERUS, battleMgr.isStorySuccessful == 1); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + StoryFinishTask storyFinishTask = new StoryFinishTask(selectedStoryInfo); + storyFinishTask.SetParameter(battleMgr.isStorySuccessful, cumulativeEvolutionCount, turn, dataMgr.IsSelectEmptyDeck() ? (dataMgr.GetPlayerClassId() + 90) : dataMgr.GetSelectDeckId(), dataMgr.IsLastSelectDeckAttributeType(DeckAttributeType.BuildDeck), dataMgr.GetSelectDeckFormat(), dataMgr.GetPlayerClassId()); + selectedStoryInfo.IsFailure = battleMgr.isStorySuccessful == 0; + m_reportEndAgent.StartCoroutine(networkManager.Connect(storyFinishTask, delegate + { + if (battleMgr.isStorySuccessful != 0) + { + StoryNextSceneSelector.SetDeckRentalLoseCount(0); + } + else + { + StoryNextSceneSelector.SetDeckRentalLoseCount(StoryNextSceneSelector.GetDeckRentalLoseCount() + 1); + } + callback.Call(); + }, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + public void Destroy() + { + UnityEngine.Object.Destroy(m_reportEndAgentObj); + } + + public JsonData GetFinishResponseData() + { + return Data.StoryFinish.data._responseData; + } + + public List GetUserAchievementList() + { + return Data.StoryFinish.data.achieved_achievement_list; + } + + public List GetUserMissionList() + { + return Data.StoryFinish.data.achieved_mission_list; + } + + public List GetRewardsList() + { + return Data.StoryFinish.data.Rewards; + } + + public int GetClassExp() + { + return Data.StoryFinish.data.get_class_chara_experience; + } +} diff --git a/SVSim.BattleEngine/Engine/StorySectionData.cs b/SVSim.BattleEngine/Engine/StorySectionData.cs new file mode 100644 index 0000000..ff30e26 --- /dev/null +++ b/SVSim.BattleEngine/Engine/StorySectionData.cs @@ -0,0 +1,172 @@ +using LitJson; +using Wizard; +using Wizard.Story; + +public class StorySectionData +{ + private static readonly string FORMAT_STORY_SECTION_NO = "story_section_no_{0:D2}"; + + public const int WAZAWAI_SECTION_ID = 1; + + private const int WAZAWAI_FINAL_SECTION_ID = 2; + + public const int OUKOKU_KIKAN_SECTION_ID = 9003; + + public const int SHUKUSEI_HEN_KOUHEN_SECTION_ID = 20; + + public int Id { get; } + + public int AllStoryOrderId { get; } + + public string NameNo { get; } + + public string Name { get; } + + public string ImageName { get; } + + public string OffStateButtonTextureName { get; } + + public string OnStateButtonTextureName { get; } + + public bool IsLeaderSelect { get; } + + public bool IsFinish { get; } + + public bool IsUnderMaintenance { get; } + + public int ReleasedCharaCount { get; } + + public int FinishedCharaCount { get; } + + public int BackGroundId { get; } + + public StoryApiType StoryApiType { get; } + + public bool IsNew { get; } + + public bool IsSpoiler { get; } + + public string SpoilerMessage { get; } + + public UIManager.ViewScene ChapterSelectionView { get; } + + public bool IsPlayAnotherEndingAppearanceAnimation { get; } + + public bool IsTutorialCategory => Id == StorySection.TUTORIAL_SECTION_ID; + + public bool IsTutorial + { + get + { + if (IsTutorialCategory) + { + return !IsFinish; + } + return false; + } + } + + public bool IsTutorialReplay + { + get + { + if (IsTutorialCategory) + { + return IsFinish; + } + return false; + } + } + + public bool IsExistExtraBackGround() + { + if (Id != 2 && Id != 9003) + { + return Id == 20; + } + return true; + } + + public StorySectionData(JsonData jsonData) + { + Id = jsonData["section_id"].ToInt(); + AllStoryOrderId = jsonData["all_story_order_id"].ToInt(); + NameNo = GetNameNoText(jsonData); + Name = GetNameText(jsonData); + ImageName = jsonData["image_name"].ToString(); + OffStateButtonTextureName = GetOffStateButtonTextureName(jsonData); + OnStateButtonTextureName = GetOnStateButtonTextureName(jsonData); + IsLeaderSelect = jsonData["is_leader_select"].ToBoolean(); + IsFinish = jsonData["is_finished"].ToBoolean(); + IsUnderMaintenance = jsonData["is_under_maintenance"].ToBoolean(); + ReleasedCharaCount = jsonData["released_chara_count"].ToInt(); + FinishedCharaCount = jsonData["finished_chara_count"].ToInt(); + BackGroundId = jsonData["back_ground_id"].ToInt(); + IsNew = jsonData["is_new"].ToBoolean(); + IsSpoiler = jsonData.GetValueOrDefault("is_spoiler", defaultValue: false); + if (IsSpoiler) + { + SpoilerMessage = jsonData.GetValueOrDefault("spoiler_message", string.Empty); + } + StoryApiType = GetStoryApiType(jsonData["story_type_overwrite"].ToInt()); + ChapterSelectionView = GetChapterSelectionView(jsonData); + IsPlayAnotherEndingAppearanceAnimation = jsonData["is_play_another_end_appearance_animation"].ToBoolean(); + } + + public StorySectionData(int id, int backgroundId, UIManager.ViewScene chapterSelectionView) + { + Id = id; + BackGroundId = backgroundId; + ChapterSelectionView = chapterSelectionView; + } + + private static string GetNameNoText(JsonData jsonData) + { + int num = jsonData["section_id"].ToInt(); + string key = string.Format(FORMAT_STORY_SECTION_NO, num); + return Data.Master.GetStorySectionTitleText(key); + } + + private static string GetNameText(JsonData jsonData) + { + string key = jsonData["name"].ToString(); + return Data.Master.GetStorySectionTitleText(key); + } + + private static string GetOffStateButtonTextureName(JsonData jsonData) + { + return jsonData["image_name"].ToString() + "_off"; + } + + private static string GetOnStateButtonTextureName(JsonData jsonData) + { + return jsonData["image_name"].ToString() + "_on"; + } + + private static UIManager.ViewScene GetChapterSelectionView(JsonData jsonData) + { + if (jsonData["chapter_select_type"].ToInt() != 2) + { + return UIManager.ViewScene.AreaSelect; + } + return UIManager.ViewScene.StoryChapterSelectionFlowChart; + } + + private static StoryApiType GetStoryApiType(int storyTypeOverwrite) + { + switch (storyTypeOverwrite) + { + case 0: + return StoryApiType.None; + case 1: + return StoryApiType.MainStory; + case 2: + return StoryApiType.LimitedStory; + case 3: + return StoryApiType.EventStory; + default: + Debug.LogError("StorySectionใฎstory_type_overwriteใซๆƒณๅฎšๅค–ใฎๅ€คใŒ่จญๅฎšใ•ใ‚ŒใŸ"); + return StoryApiType.None; + } + } +} diff --git a/SVSim.BattleEngine/Engine/SuperSkyboundArtCountAddModifier.cs b/SVSim.BattleEngine/Engine/SuperSkyboundArtCountAddModifier.cs new file mode 100644 index 0000000..2dc10ae --- /dev/null +++ b/SVSim.BattleEngine/Engine/SuperSkyboundArtCountAddModifier.cs @@ -0,0 +1,21 @@ +public class SuperSkyboundArtCountAddModifier : ICardSuperSkyboundArtCountModifier +{ + public readonly int SuperSkyboundArtCount; + + public bool IsClearBeforeModifier => true; + + public SuperSkyboundArtCountAddModifier(int count) + { + SuperSkyboundArtCount = count; + } + + public int CalcSuperSkyboundArtCount(int superSkyboundArtCount) + { + return superSkyboundArtCount += SuperSkyboundArtCount; + } + + public ICardSuperSkyboundArtCountModifier Clone() + { + return new SuperSkyboundArtCountAddModifier(SuperSkyboundArtCount); + } +} diff --git a/SVSim.BattleEngine/Engine/TaskManager.cs b/SVSim.BattleEngine/Engine/TaskManager.cs new file mode 100644 index 0000000..7327579 --- /dev/null +++ b/SVSim.BattleEngine/Engine/TaskManager.cs @@ -0,0 +1,181 @@ +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Scripts.Network.Task.Arena; +using Wizard.Scripts.Network.Task.Arena.TwoPick; + +public class TaskManager : MonoBehaviour +{ + private NetworkManager networkManager; + + private GameObject returnSendObj; + + private static TaskManager main; + + private string returnMsg = ""; + + private const string mypageSendTraceFlag_Key = "mypageSendTraceFlag"; + + private void Awake() + { + main = this; + } + + public static TaskManager GetInstance() + { + return main; + } + + private NetworkManager getNetworkManager() + { + if (networkManager == null) + { + networkManager = Toolbox.NetworkManager; + } + return networkManager; + } + + public void StartMailTop(GameObject sendObj, string msg, bool isTutorial) + { + returnMsg = msg; + returnSendObj = sendObj; + MailTopTask mailTopTask = new MailTopTask(); + mailTopTask.SetParameter(isTutorial); + StartCoroutine(getNetworkManager().Connect(mailTopTask, mailtop, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + private void mailtop(NetworkTask.ResultCode error) + { + returnSendObj.SendMessage(returnMsg); + } + + private void ReadMail(NetworkTask.ResultCode error) + { + returnSendObj.SendMessage(returnMsg); + } + + private void UserData(NetworkTask.ResultCode error) + { + returnSendObj.SendMessage(returnMsg); + } + + public void StartArenaTopTaskData(GameObject sendObj, string msg, int mode) + { + returnMsg = msg; + returnSendObj = sendObj; + ArenaTopTaskBase taskInstance = ArenaTopTaskBase.GetTaskInstance(mode); + taskInstance.SetParameter(); + StartCoroutine(getNetworkManager().Connect(taskInstance, ArenaTopTaskData, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + private void ArenaTopTaskData(NetworkTask.ResultCode error) + { + returnSendObj.SendMessage(returnMsg); + } + + public void StartArenaPrepareData(GameObject sendObj, string msg, int mode, int payType) + { + returnMsg = msg; + returnSendObj = sendObj; + ArenaEntryTaskBase taskInstance = ArenaEntryTaskBase.GetTaskInstance(mode); + taskInstance.SetParameter(payType); + StartCoroutine(getNetworkManager().Connect(taskInstance, ArenaPrepareData, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + private void ArenaPrepareData(NetworkTask.ResultCode error) + { + returnSendObj.SendMessage(returnMsg); + } + + public void StartArenaClassCharaChooseData(GameObject sendObj, string msg, int classId) + { + ClassCharaChooseTask classCharaChooseTask = new ClassCharaChooseTask(); + classCharaChooseTask.SetParameter(classId); + StartTask(classCharaChooseTask, sendObj, msg); + } + + public void StartTask(NetworkTask task, GameObject sendObj, string msg) + { + returnMsg = msg; + returnSendObj = sendObj; + StartCoroutine(getNetworkManager().Connect(task, SendMessage, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + public void StartArenaCardChooseTaskData(GameObject sendObj, string msg, int selectedId) + { + CardChooseTask cardChooseTask = new CardChooseTask(); + cardChooseTask.SetParameter(selectedId); + StartTask(cardChooseTask, sendObj, msg); + } + + private void SendMessage(NetworkTask.ResultCode error) + { + returnSendObj.SendMessage(returnMsg); + } + + public void StartArenaRetireTaskData(GameObject sendObj, string msg, int mode) + { + returnMsg = msg; + returnSendObj = sendObj; + ArenaRetireTaskBase taskInstance = ArenaRetireTaskBase.GetTaskInstance(mode); + taskInstance.SetParameter(); + StartCoroutine(getNetworkManager().Connect(taskInstance, ArenaRetireTaskData, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + private void ArenaRetireTaskData(NetworkTask.ResultCode error) + { + returnSendObj.SendMessage(returnMsg); + } + + public void StartArenaFinishTaskData(GameObject sendObj, string msg, int mode) + { + returnMsg = msg; + returnSendObj = sendObj; + FinishTask finishTask = new FinishTask(); + finishTask.SetParameter(); + StartCoroutine(getNetworkManager().Connect(finishTask, ArenaFinishTaskData, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + private void ArenaFinishTaskData(NetworkTask.ResultCode error) + { + returnSendObj.SendMessage(returnMsg); + } + + public static void GetErrorMsgFromCode(int code, out string msg, out string title) + { + string key = "Error_" + code.ToString("0000"); + string key2 = "ErrorHeader_" + code.ToString("0000"); + msg = Data.SystemText.Get(key); + title = Data.SystemText.Get(key2); + } + + public void ClearLastLogKey() + { + LocalLog.ClearLastLogKey(); + NotMyPageSend(); + } + + public void MyPageSend() + { + PlayerPrefs.SetInt("mypageSendTraceFlag", 1); + } + + public void NotMyPageSend() + { + PlayerPrefs.SetInt("mypageSendTraceFlag", 0); + } + + public bool IsMyPageSend() + { + if (PlayerPrefs.GetInt("mypageSendTraceFlag") != 1) + { + return false; + } + return true; + } + + private void BackToHome() + { + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.MyPage); + } +} diff --git a/SVSim.BattleEngine/Engine/TempleField.cs b/SVSim.BattleEngine/Engine/TempleField.cs new file mode 100644 index 0000000..53c6e37 --- /dev/null +++ b/SVSim.BattleEngine/Engine/TempleField.cs @@ -0,0 +1,130 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class TempleField : BackGroundBase +{ + public override int FieldId => 5; + + public TempleField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_ctdl_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles05").gameObject; + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + if (FieldId == 5) + { + _fieldParticleSystemDictionary.Add("monu", _fieldParticles.transform.Find("monu").GetComponent()); + _fieldParticleSystemDictionary.Add("monu_2", _fieldParticles.transform.Find("monu_2").GetComponent()); + _fieldParticleSystemDictionary.Add("monu_summon", _fieldParticles.transform.Find("monu_summon").GetComponent()); + _fieldParticleSystemDictionary.Add("monu_gimic_1", _fieldParticles.transform.Find("monu_gimic_1").GetComponent()); + } + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_5, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_5_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _battleCamera.Camera.transform.localPosition = new Vector3(-750f, 250f, -220f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-20f, -90f, 90f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-220f, -20f, -60f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-25f, -97f, 93f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + if (FieldId == 5) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1") + { + switch (_gimicCntDictionary[obj.tag]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + _gimicCntDictionary[obj.tag]++; + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["monu"].transform.GetChild(_gimicCntDictionary[obj.tag] - 1).GetComponent().Play(); + _fieldParticleSystemDictionary["monu_2"].transform.GetChild(_gimicCntDictionary[obj.tag] - 1).GetComponent().Play(); + break; + case 9: + { + _gimicCntDictionary[obj.tag]++; + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["monu"].transform.GetChild(_gimicCntDictionary[obj.tag] - 1).GetComponent().Play(); + _fieldParticleSystemDictionary["monu_2"].transform.GetChild(_gimicCntDictionary[obj.tag] - 1).GetComponent().Play(); + yield return new WaitForSeconds(1f); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_2", "se_field_" + _str3DFieldNo, 0f, 0L); + for (int i = 0; i < _fieldParticleSystemDictionary["monu"].transform.childCount; i++) + { + ParticleSystem.MainModule main = _fieldParticleSystemDictionary["monu"].transform.GetChild(i).GetComponent().main; + main.startColor = new Color(1f, 0.25f, 0.25f); + _fieldParticleSystemDictionary["monu"].transform.GetChild(i).GetComponent().Stop(); + _fieldParticleSystemDictionary["monu"].transform.GetChild(i).GetComponent().Play(); + } + _fieldParticleSystemDictionary["monu_summon"].Play(); + yield return new WaitForSeconds(1f); + for (int j = 0; j < _fieldParticleSystemDictionary["monu"].transform.childCount; j++) + { + ParticleSystem.MainModule main2 = _fieldParticleSystemDictionary["monu"].transform.GetChild(j).GetComponent().main; + main2.startColor = new Color(0.25f, 0.5f, 1f); + _fieldParticleSystemDictionary["monu"].transform.GetChild(j).GetComponent().Stop(); + } + yield return new WaitForSeconds(4f); + _gimicCntDictionary[obj.tag] = 0; + break; + } + } + } + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/TempleNightField.cs b/SVSim.BattleEngine/Engine/TempleNightField.cs new file mode 100644 index 0000000..c49de42 --- /dev/null +++ b/SVSim.BattleEngine/Engine/TempleNightField.cs @@ -0,0 +1,11 @@ +public class TempleNightField : TempleField +{ + public override int FieldId => 15; + + public override int FieldEffectId => 5; + + public TempleNightField(string bgmId = "NONE") + : base(bgmId) + { + } +} diff --git a/SVSim.BattleEngine/Engine/TurnPanelControl.cs b/SVSim.BattleEngine/Engine/TurnPanelControl.cs new file mode 100644 index 0000000..5aa9df4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/TurnPanelControl.cs @@ -0,0 +1,242 @@ +using System.Collections; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +public class TurnPanelControl : MonoBehaviour, ITurnPanelControl +{ + [SerializeField] + private UIPanel TurnPanel; + + [SerializeField] + private UISprite TurnTitle; + + [SerializeField] + private UISprite SubTurnTitle; + + [SerializeField] + private UILabel SubTurnLabel; + + [SerializeField] + private UITable SubEvoTable; + + [SerializeField] + private UISprite SubEvoTitle; + + [SerializeField] + private UISprite SubEvoTurn; + + [SerializeField] + private UILabel SubEvoLabel; + + [SerializeField] + private UIPanel EvoPanel; + + [SerializeField] + private UISprite EvoText; + + [SerializeField] + private UIPanel ArcanePanel; + + [SerializeField] + private UISprite ArcaneOut; + + [SerializeField] + private UISprite ArcaneIn; + + [SerializeField] + private UISprite Bg; + + private int evoCnt; + + private bool isPlayer; + + [HideInInspector] + public bool isEvoEnableP; + + [HideInInspector] + public bool isEvoEnableE; + + private GameObject m_effectGameObject; + + private IEnumerator _turnStartSequenceEnumerator; + + public GameObject GameObject => base.gameObject; + + public void Initialize(bool isEvoEnableP = true, bool isEvoEnableE = true) + { + this.isEvoEnableP = isEvoEnableP; + this.isEvoEnableE = isEvoEnableE; + TurnPanel.alpha = 0f; + EvoPanel.alpha = 0f; + ArcanePanel.alpha = 0f; + Bg.alpha = 0f; + _turnStartSequenceEnumerator = RunUI(); + } + + public VfxBase LoadResource() + { + return new WaitLoadEffectAndSetSeVfx("cmn_ui_yourturn_3", "se_cmn_ui_yourturn_3", delegate(GameObject e) + { + m_effectGameObject = e; + }); + } + + public void StartUI(int turn, int evo, bool isP) + { + base.gameObject.SetActive(value: true); + evoCnt = evo; + isPlayer = isP; + if (isPlayer) + { + TurnTitle.spriteName = "img_your_turn_panel_01"; + SubTurnTitle.spriteName = "img_your_turn_count_panel_01"; + SubEvoTitle.spriteName = "text_battle_evo_left_01"; + if (evoCnt + 1 == 1) + { + SubEvoTurn.spriteName = "text_battle_evo_right_01_1"; + } + else + { + SubEvoTurn.spriteName = "text_battle_evo_right_01_2"; + } + ArcaneIn.spriteName = "arcane_01_ring"; + ArcaneOut.spriteName = "arcane_01_ring"; + SubTurnLabel.effectColor = new Color(0f, 0.5f, 0.9f, 0.5f); + SubEvoLabel.effectColor = new Color(0f, 0.5f, 0.9f, 0.5f); + if (isEvoEnableP) + { + SubTurnTitle.gameObject.SetActive(value: false); + SubEvoTable.gameObject.SetActive(value: true); + SubEvoLabel.text = (evoCnt + 1).ToString(); + } + else + { + SubTurnTitle.gameObject.SetActive(value: true); + SubEvoTable.gameObject.SetActive(value: false); + SubTurnLabel.text = turn.ToString(); + } + } + else + { + TurnTitle.spriteName = "img_your_turn_panel_02"; + SubTurnTitle.spriteName = "img_your_turn_count_panel_02"; + SubEvoTitle.spriteName = "text_battle_evo_left_02"; + if (evoCnt + 1 == 1) + { + SubEvoTurn.spriteName = "text_battle_evo_right_02_1"; + } + else + { + SubEvoTurn.spriteName = "text_battle_evo_right_02_2"; + } + ArcaneIn.spriteName = "arcane_02_ring"; + ArcaneOut.spriteName = "arcane_02_ring"; + SubTurnLabel.effectColor = new Color(0.75f, 0f, 0.25f, 0.5f); + SubEvoLabel.effectColor = new Color(0.75f, 0f, 0.25f, 0.5f); + if (isEvoEnableE) + { + SubTurnTitle.gameObject.SetActive(value: false); + SubEvoTable.gameObject.SetActive(value: true); + SubEvoLabel.text = (evoCnt + 1).ToString(); + } + else + { + SubTurnTitle.gameObject.SetActive(value: true); + SubEvoTable.gameObject.SetActive(value: false); + SubTurnLabel.text = turn.ToString(); + } + } + SnapSprites(); + TurnPanel.alpha = 0f; + EvoPanel.alpha = 0f; + ArcanePanel.alpha = 0f; + Bg.alpha = 0f; + StopCoroutine(_turnStartSequenceEnumerator); + _turnStartSequenceEnumerator = RunUI(); + StartCoroutine(_turnStartSequenceEnumerator); + } + + private IEnumerator RunUI() + { + TweenAlpha.Begin(Bg.gameObject, 0.2f, 0.5f); + TweenAlpha.Begin(TurnPanel.gameObject, 0.2f, 1f); + TurnPanel.transform.localScale = Vector3.one * 0.01f; + iTween.ScaleTo(TurnPanel.gameObject, iTween.Hash("scale", Vector3.one * 0.95f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad)); + TweenAlpha.Begin(ArcanePanel.gameObject, 0.2f, 1f); + ArcanePanel.transform.localScale = Vector3.one * 10f; + iTween.ScaleTo(ArcanePanel.gameObject, iTween.Hash("scale", Vector3.one * 1.05f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad)); + yield return new WaitForSeconds(0.2f); + TurnPanel.transform.localScale = Vector3.one * 0.95f; + iTween.ScaleTo(TurnPanel.gameObject, iTween.Hash("scale", Vector3.one, "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad)); + ArcanePanel.transform.localScale = Vector3.one * 1.05f; + iTween.ScaleTo(ArcanePanel.gameObject, iTween.Hash("scale", Vector3.one, "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad)); + yield return new WaitForSeconds(0.5f); + if ((isPlayer && isEvoEnableP) || (!isPlayer && isEvoEnableE)) + { + SubEvoLabel.transform.localScale = Vector3.one; + if (isPlayer) + { + if (evoCnt == 1) + { + SubEvoTurn.spriteName = "text_battle_evo_right_01_1"; + } + else + { + SubEvoTurn.spriteName = "text_battle_evo_right_01_2"; + } + } + else if (evoCnt == 1) + { + SubEvoTurn.spriteName = "text_battle_evo_right_02_1"; + } + else + { + SubEvoTurn.spriteName = "text_battle_evo_right_02_2"; + } + SnapSprites(); + yield return new WaitForSeconds(0.05f); + SubEvoLabel.text = evoCnt.ToString(); + SubEvoLabel.transform.localScale = Vector3.one * 1.5f; + iTween.ScaleTo(SubEvoLabel.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad)); + yield return new WaitForSeconds(0.45f); + } + else + { + yield return new WaitForSeconds(0.5f); + } + iTween.ScaleTo(TurnPanel.gameObject, iTween.Hash("scale", Vector3.one * 0.01f, "time", 0.4f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + iTween.ScaleTo(ArcanePanel.gameObject, iTween.Hash("scale", Vector3.one * 10f, "time", 0.4f, "islocal", true, "easetype", iTween.EaseType.easeInExpo)); + TweenAlpha.Begin(TurnPanel.gameObject, 0.4f, 0f); + TweenAlpha.Begin(ArcanePanel.gameObject, 0.4f, 0f); + if (evoCnt == 0 && ((isPlayer && isEvoEnableP) || (!isPlayer && isEvoEnableE))) + { + yield return new WaitForSeconds(0.2f); + BattleManagerBase.GetIns().VfxMgr.RegisterImmediateVfx(new PlayEffectAndSeVfx(() => m_effectGameObject, Vector3.zero)); + yield return new WaitForSeconds(0.2f); + EvoPanel.alpha = 1f; + EvoPanel.transform.localScale = Vector3.one * 1.05f; + iTween.ScaleTo(EvoPanel.gameObject, iTween.Hash("scale", Vector3.one, "time", 1.5f, "islocal", true, "easetype", iTween.EaseType.linear)); + yield return new WaitForSeconds(1.2f); + TweenAlpha.Begin(EvoPanel.gameObject, 0.3f, 0f); + if (isPlayer) + { + isEvoEnableP = false; + } + else + { + isEvoEnableE = false; + } + } + TweenAlpha.Begin(Bg.gameObject, 0.2f, 0f); + yield return new WaitForSeconds(0.3f); + base.gameObject.SetActive(value: false); + } + + private void SnapSprites() + { + TurnTitle.MakePixelPerfect(); + SubEvoTitle.MakePixelPerfect(); + SubEvoTurn.MakePixelPerfect(); + SubEvoTable.Reposition(); + } +} diff --git a/SVSim.BattleEngine/Engine/TweenColor.cs b/SVSim.BattleEngine/Engine/TweenColor.cs new file mode 100644 index 0000000..c8d07e4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/TweenColor.cs @@ -0,0 +1,153 @@ +using System; +using UnityEngine; + +[AddComponentMenu("NGUI/Tween/Tween Color")] +public class TweenColor : UITweener +{ + public Color from = Color.white; + + public Color to = Color.white; + + private bool mCached; + + private UIWidget mWidget; + + private Material mMat; + + private Light mLight; + + private SpriteRenderer mSr; + + [Obsolete("Use 'value' instead")] + public Color color + { + get + { + return value; + } + set + { + this.value = value; + } + } + + public Color value + { + get + { + if (!mCached) + { + Cache(); + } + if (mWidget != null) + { + return mWidget.color; + } + if (mMat != null) + { + return mMat.color; + } + if (mSr != null) + { + return mSr.color; + } + if (mLight != null) + { + return mLight.color; + } + return Color.black; + } + set + { + if (!mCached) + { + Cache(); + } + if (mWidget != null) + { + mWidget.color = value; + } + else if (mMat != null) + { + mMat.color = value; + } + else if (mSr != null) + { + mSr.color = value; + } + else if (mLight != null) + { + mLight.color = value; + mLight.enabled = value.r + value.g + value.b > 0.01f; + } + } + } + + private void Cache() + { + mCached = true; + mWidget = GetComponent(); + if (mWidget != null) + { + return; + } + mSr = GetComponent(); + if (mSr != null) + { + return; + } + Renderer component = GetComponent(); + if (component != null) + { + mMat = component.material; + return; + } + mLight = GetComponent(); + if (mLight == null) + { + mWidget = GetComponentInChildren(); + } + } + + protected override void OnUpdate(float factor, bool isFinished) + { + value = Color.Lerp(from, to, factor); + } + + public static TweenColor Begin(GameObject go, float duration, Color color) + { + TweenColor tweenColor = UITweener.Begin(go, duration); + tweenColor.from = tweenColor.value; + tweenColor.to = color; + if (duration <= 0f) + { + tweenColor.Sample(1f, isFinished: true); + tweenColor.enabled = false; + } + return tweenColor; + } + + [ContextMenu("Set 'From' to current value")] + public override void SetStartToCurrentValue() + { + from = value; + } + + [ContextMenu("Set 'To' to current value")] + public override void SetEndToCurrentValue() + { + to = value; + } + + [ContextMenu("Assume value of 'From'")] + private void SetCurrentValueToStart() + { + value = from; + } + + [ContextMenu("Assume value of 'To'")] + private void SetCurrentValueToEnd() + { + value = to; + } +} diff --git a/SVSim.BattleEngine/Engine/TweenRotation.cs b/SVSim.BattleEngine/Engine/TweenRotation.cs new file mode 100644 index 0000000..03c546a --- /dev/null +++ b/SVSim.BattleEngine/Engine/TweenRotation.cs @@ -0,0 +1,93 @@ +using System; +using UnityEngine; + +[AddComponentMenu("NGUI/Tween/Tween Rotation")] +public class TweenRotation : UITweener +{ + public Vector3 from; + + public Vector3 to; + + public bool quaternionLerp; + + private Transform mTrans; + + public Transform cachedTransform + { + get + { + if (mTrans == null) + { + mTrans = base.transform; + } + return mTrans; + } + } + + [Obsolete("Use 'value' instead")] + public Quaternion rotation + { + get + { + return value; + } + set + { + this.value = value; + } + } + + public Quaternion value + { + get + { + return cachedTransform.localRotation; + } + set + { + cachedTransform.localRotation = value; + } + } + + protected override void OnUpdate(float factor, bool isFinished) + { + value = (quaternionLerp ? Quaternion.Slerp(Quaternion.Euler(from), Quaternion.Euler(to), factor) : Quaternion.Euler(new Vector3(Mathf.Lerp(from.x, to.x, factor), Mathf.Lerp(from.y, to.y, factor), Mathf.Lerp(from.z, to.z, factor)))); + } + + public static TweenRotation Begin(GameObject go, float duration, Quaternion rot) + { + TweenRotation tweenRotation = UITweener.Begin(go, duration); + tweenRotation.from = tweenRotation.value.eulerAngles; + tweenRotation.to = rot.eulerAngles; + if (duration <= 0f) + { + tweenRotation.Sample(1f, isFinished: true); + tweenRotation.enabled = false; + } + return tweenRotation; + } + + [ContextMenu("Set 'From' to current value")] + public override void SetStartToCurrentValue() + { + from = value.eulerAngles; + } + + [ContextMenu("Set 'To' to current value")] + public override void SetEndToCurrentValue() + { + to = value.eulerAngles; + } + + [ContextMenu("Assume value of 'From'")] + private void SetCurrentValueToStart() + { + value = Quaternion.Euler(from); + } + + [ContextMenu("Assume value of 'To'")] + private void SetCurrentValueToEnd() + { + value = Quaternion.Euler(to); + } +} diff --git a/SVSim.BattleEngine/Engine/UIBase_Textuer.cs b/SVSim.BattleEngine/Engine/UIBase_Textuer.cs new file mode 100644 index 0000000..bedba8f --- /dev/null +++ b/SVSim.BattleEngine/Engine/UIBase_Textuer.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +public class UIBase_Textuer : MonoBehaviour +{ + public string TextuerName = ""; + + public UITexture texObj; +} diff --git a/SVSim.BattleEngine/Engine/UICardList.cs b/SVSim.BattleEngine/Engine/UICardList.cs new file mode 100644 index 0000000..417b95b --- /dev/null +++ b/SVSim.BattleEngine/Engine/UICardList.cs @@ -0,0 +1,1430 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.DeckCardEdit; + +public class UICardList : MonoBehaviour +{ + private const string FILTER_BTN_LEFT_ON = "pilltab_02_left_on"; + + private const string FILTER_BTN_LEFT_OFF = "pilltab_02_left_off"; + + private const string FILTER_BTN_RIGHT_ON = "pilltab_02_right_on"; + + private const string FILTER_BTN_RIGHT_OFF = "pilltab_02_right_off"; + + private const string PREMIUM_SELECT_PREFAB_PATH = "UI/DeckList/DeckIntroductionPreferSelect"; + + private readonly Vector3 MY_ROTATION_FORMAT_ICON_POSITION = new Vector3(167f, 0f, 0f); + + private readonly Vector3 MY_ROTATION_CARD_NUMBER_ICON_POSITION = new Vector3(60f, -74.3f, -1.1f); + + private readonly Vector3 MY_ROTATION_CARD_NUMBER_POSITION = new Vector3(28f, 0f, 0f); + + private readonly Vector3 MY_ROTATION_CARD_NUMBER_MAX_POSITION = new Vector3(59f, 0f, 0f); + + private const int MY_ROTATION_CLASS_NAME_WIDTH = 110; + + private const int MY_ROTATION_CLASS_NAME_UNDER_LINE_WIDTH = 182; + + [SerializeField] + private GameObject _cardListTemplatePrefab; + + private List scrollItems; + + [SerializeField] + private UIGrid GridBase; + + [SerializeField] + private UIScrollView scrollView; + + [SerializeField] + private UIScrollBar ScrollBar; + + [SerializeField] + private CostCurveUI CostCurve; + + [SerializeField] + private NguiObjs CloseBtnObj; + + [SerializeField] + private UILabel DeckNameLabel; + + [SerializeField] + private UICamera _detailCamera; + + [SerializeField] + private UIPanel _rootPanel; + + [SerializeField] + private UIPanel _scrollPanel; + + [SerializeField] + private UIPanel _costCurvePanel; + + [SerializeField] + private UILabel _deckClassLabel; + + [SerializeField] + private UILabel _deckNumLabel; + + [SerializeField] + private UILabel _deckDenoNumLabel; + + [SerializeField] + private UILabel _deckFollowerNumLabel; + + [SerializeField] + private UILabel _deckSpellNumLabel; + + [SerializeField] + private UILabel _deckAmuletNumLabel; + + [SerializeField] + private GameObject _deckNameLine; + + [SerializeField] + private UIAnchor _anchorTop; + + [SerializeField] + private UIAnchor _anchorTopRight; + + [SerializeField] + private UISprite _formatIcon; + + [SerializeField] + private UIButton _shareButton; + + [SerializeField] + private UITexture _qrCodeSmallTexture; + + [SerializeField] + private UISprite _qrCodeMaintenance; + + [SerializeField] + private GameObject _keyboardCloseSelectEffect; + + [SerializeField] + private GameObject _deckIntroductionRoot; + + [SerializeField] + private GameObject _qrCodeRoot; + + [SerializeField] + private UIButton _deckIntroductionRedEtherOffButton; + + [SerializeField] + private UIButton _deckIntroductionRedEtherOnButton; + + [SerializeField] + private UISprite _deckIntroductionRedEtherOffSprite; + + [SerializeField] + private UISprite _deckIntroductionRedEtherOnSprite; + + [SerializeField] + private UIButton _redUtilButton; + + [SerializeField] + private UILabel _redUtilButtonLabel; + + private bool _isEnableShortageCardVisible; + + [SerializeField] + private UIButton _deckIntroductionCopyButton; + + [SerializeField] + private GameObject _cardEnoughRoot; + + [SerializeField] + private GameObject _redEtherEnoughRoot; + + [SerializeField] + private GameObject _redEtherNotEnoughRoot; + + [SerializeField] + private GameObject _redEtherRoot; + + [SerializeField] + private UILabel _useRedEther; + + [SerializeField] + private UILabel _haveRedEther; + + [SerializeField] + private UILabel _haveRedEtherEnoughCard; + + [SerializeField] + private UILabel _haveRedEtherEnough; + + [SerializeField] + private UILabel _redEtherAfter; + + [SerializeField] + private UILabel _notEnoughRedEther; + + [SerializeField] + private GameObject _blueUtilButtonRoot; + + [SerializeField] + private UILabel _blueUtilButtonLabel; + + [SerializeField] + private UIButton _blueUtilButton; + + [SerializeField] + private UIButton _showQRCodeButton; + + [SerializeField] + private GameObject _useSubClassRoot; + + [SerializeField] + private UILabel _useSubClassDeckCardNumLabel; + + [SerializeField] + private UILabel _useSubClassDeckCardNumMaxLabel; + + [SerializeField] + private UISprite _useSubClassMainClassIconSprite; + + [SerializeField] + private UILabel _useSubClassMainClassCardNumLabel; + + [SerializeField] + private UILabel _useSubClassMainClassCardNumMinLabel; + + [SerializeField] + private UISprite _useSubClassSubClassIconSprite; + + [SerializeField] + private UILabel _useSubClassSubClassCardNumLabel; + + [SerializeField] + private UILabel _useSubClassSubClassCardNumMinLabel; + + [SerializeField] + private UISprite _useSubClassFormatIconSprite; + + [SerializeField] + private DeckCopyDialog _useSubClassDeckCopyDialog3OptionsPrefab; + + [SerializeField] + private SubClassSelectDialog _subClassSelectDialogPrefab; + + [SerializeField] + private GameObject _myRotationIconOriginal; + + [SerializeField] + private UIGrid _myRotationGrid; + + [SerializeField] + private GameObject _myRotationRoot; + + [SerializeField] + private GameObject _cardNumberIcon; + + [SerializeField] + private UISprite _myRotationClassIcon; + + [SerializeField] + private UILabel _myRotationPackName; + + [SerializeField] + private UISprite _classNameUnderLine; + + [SerializeField] + private GameObject _avatarBattleRoot; + + [SerializeField] + private UIButton _avatarAbilityButton; + + [NonSerialized] + public GenerateDeckCodeTask.SubmitDeckType SubmitDeckType = GenerateDeckCodeTask.SubmitDeckType.NORMAL; + + private DialogBase _qrCodeDialog; + + private static int UpdateCounter; + + private List PlayerDataIds; + + private Dictionary PlayerDataIdDict; + + private int CardCount; + + private bool m_ResetFlg; + + private bool _isActive; + + private int _followerNum; + + private int _spellNum; + + private int _amuletNum; + + private int _maxCardNum; + + private DeckData _deck; + + private Dictionary _shortageBasicCardIdList = new Dictionary(); + + private Format _format = Format.Max; + + private IFormatBehavior _formatBehavior; + + private string _deckName; + + private MyRotationInfo _myRotationInfo; + + private CardBasePrm.ClanType? _clanType; + + private ClassSet _classSet; + + private bool _isLabelMoved; + + private int _selectedSubClass = 10; + + private const int DISP_MAX_CARD_TYPE_NUM = 16; + + private const int RESET_WAIT_COUNT = 2; + + private const float CardSizeScale = 0.65f; + + private const float MOVE_BLUE_BUTTON_DISTANCE = 630f; + + private bool _isSelectCloseButton; + + [NonSerialized] + public bool _loadingEnd; + + public bool IsEnableShortageCardVisible => _isEnableShortageCardVisible; + + public Action OnCardDetailOpen { get; set; } + + public Action OnCardDetailClose { get; set; } + + public CardDetailUI CardDetail { get; private set; } + + public bool IsEnableMyRotationDisplay { get; set; } = true; + + public bool IsEnableAvatarBattleDisplay { get; set; } = true; + + public bool IsConventionDeckIntroduction { get; set; } + + private bool _isShareButtonUse { get; set; } + + private void Awake() + { + scrollItems = new List(); + PlayerDataIds = new List(); + PlayerDataIdDict = new Dictionary(); + CloseBtnObj.buttons[0].onClick.Clear(); + UIManager.GetInstance().AttachAtlas(base.gameObject); + _deckIntroductionRoot.gameObject.SetActive(value: false); + _redUtilButton.gameObject.SetActive(value: false); + _qrCodeRoot.gameObject.SetActive(value: false); + _showQRCodeButton.onClick.Clear(); + _showQRCodeButton.gameObject.SetActive(value: false); + _formatBehavior = FormatBehaviorManager.GetDefaultBehaviour(Format.Max); + _format = Format.Max; + CostCurve.Initialize(_formatBehavior.CardMasterId); + } + + private void Start() + { + _deckIntroductionCopyButton.onClick.Add(new EventDelegate(delegate + { + OnClickDeckCopy(); + })); + _deckIntroductionRedEtherOffButton.onClick.Add(new EventDelegate(delegate + { + OnClickShortageCardVisibleButton(visible: false); + })); + _deckIntroductionRedEtherOnButton.onClick.Add(new EventDelegate(delegate + { + OnClickShortageCardVisibleButton(visible: true); + })); + _myRotationIconOriginal.SetActive(value: false); + SetShortageCardVisible(visible: false); + } + + private void Update() + { + if (m_ResetFlg) + { + if (UpdateCounter >= 2) + { + ResetScrollImmediately(); + } + else + { + UpdateCounter++; + } + } + KeyboardUpdate(); + } + + private void OnEnable() + { + if (!_isActive) + { + _isActive = true; + } + } + + private void OnDisable() + { + if (_isActive) + { + _isActive = false; + } + } + + private void OnDestroy() + { + if (_qrCodeDialog != null) + { + UnityEngine.Object.Destroy(_qrCodeDialog.gameObject); + } + } + + public void Init(GameObject in_ParentObject, CardDetailUI in_CardDetail, string in_DeckName, Action in_CloseButtonEvent, string in_LayerName = "Detail", bool in_DetailCameraUse = false, CardBasePrm.ClanType? clan = null, int in_MaxCardNum = 0) + { + RemoveData(); + UpdateFormatIconPosition(isMyRotation: false); + UpdataAvatarFormatDisplay(isAvatar: false); + SetMaxCardNum(in_MaxCardNum); + if (in_ParentObject != null) + { + base.gameObject.transform.parent = in_ParentObject.transform; + base.gameObject.transform.localScale = Vector3.one; + base.gameObject.transform.localPosition = Vector3.zero; + } + int num = LayerMask.NameToLayer(in_LayerName); + UIManager.GetInstance().SetLayerRecursive(base.gameObject.transform, num); + CardDetailUI cardDetailUI = (CardDetail = in_CardDetail); + if (cardDetailUI != null) + { + CardDetail.IsShowCraftButtons = false; + } + SetDeckName(in_DeckName); + SetClan(clan); + if (_detailCamera != null) + { + if (in_DetailCameraUse) + { + _detailCamera.GetComponent().cullingMask = 1 << num; + } + _detailCamera.gameObject.SetActive(in_DetailCameraUse); + } + CloseBtnObj.buttons[0].onClick.Clear(); + if (in_CloseButtonEvent != null) + { + CloseBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + in_CloseButtonEvent(); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL); + })); + } + else + { + CloseBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate + { + SetActive(in_Active: false); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL); + })); + } + SetShareButton(clan); + UpdateDeckInfo(); + SetEnableBlueButton(isEnable: false); + } + + public void SetCameraEnable(bool enable) + { + if (_detailCamera != null) + { + _detailCamera.gameObject.SetActive(enable); + } + } + + public void SetFormat(Format inFormat, ConventionDeckList conventionDeckList) + { + _formatBehavior = FormatBehaviorManager.Create(inFormat, conventionDeckList); + _format = inFormat; + CostCurve.Initialize(_formatBehavior.CardMasterId); + _formatIcon.spriteName = _formatBehavior.SmallIconSpriteName; + _formatIcon.gameObject.SetActive(value: true); + _deckDenoNumLabel.gameObject.SetActive(_formatBehavior.DeckCardNumMin == _formatBehavior.DeckCardNumMax); + if (!_formatBehavior.IsShowDeckName) + { + SetLabelPositionToNoDeckName(); + } + UpdateDeckInfo(); + } + + public void SetFormatIcon(string iconSpriteName) + { + if (!(iconSpriteName == _formatIcon.spriteName)) + { + _formatIcon.spriteName = iconSpriteName; + _formatIcon.gameObject.SetActive(value: true); + UpdateDeckInfo(); + } + } + + public void SetLabelPositionToNoDeckName() + { + if (!_isLabelMoved) + { + UIUtil.AddPositionY(_deckClassLabel.transform, 24f); + UIUtil.AddPositionY(_deckNumLabel.transform.parent, 24f); + UIUtil.AddPositionY(_deckFollowerNumLabel.transform.parent.parent, 21f); + _isLabelMoved = true; + } + } + + public void SetClan(CardBasePrm.ClanType? clan) + { + if (!clan.HasValue) + { + if (_deckClassLabel != null) + { + _deckClassLabel.gameObject.SetActive(value: false); + } + } + else + { + _deckClassLabel.gameObject.SetActive(value: true); + _deckClassLabel.text = ClassCharaPrm.GetNameText(clan.Value); + _myRotationClassIcon.spriteName = ClassCharaPrm.GetIconSpriteName(clan.Value); + } + _clanType = clan; + SetShareButton(clan); + InitUseSubClassDisplay(); + } + + public void SetClassSet(ClassSet classSet) + { + _classSet = classSet; + _clanType = classSet.MainClass; + SetShareButton(classSet.MainClass, classSet.SubClass); + InitUseSubClassDisplay(); + } + + public void SetClassName(string name) + { + _deckClassLabel.text = name; + } + + public void SetChaosDeckName(string name) + { + SetClassName(name); + _deckClassLabel.width = 136; + } + + public void SetDeckName(string in_DeckName) + { + _deckName = in_DeckName; + DeckNameLabel.text = _deckName; + bool active = false; + if (!string.IsNullOrEmpty(_deckName)) + { + active = true; + } + DeckNameLabel.gameObject.SetActive(active); + if (_deckNameLine != null) + { + _deckNameLine.SetActive(active); + } + } + + public void SetCamera(Camera inCamera) + { + _anchorTop.uiCamera = inCamera; + _anchorTopRight.uiCamera = inCamera; + } + + public void SetMaxCardNum(int inMaxCardNum = 0) + { + _maxCardNum = inMaxCardNum; + if (_deckDenoNumLabel != null) + { + _deckDenoNumLabel.text = "/" + inMaxCardNum; + } + } + + public void SetPanelDepthOffset(int offsetDepth) + { + UIPanel[] componentsInChildren = base.transform.GetComponentsInChildren(includeInactive: true); + for (int i = 0; i < componentsInChildren.Length; i++) + { + componentsInChildren[i].depth += offsetDepth; + } + } + + public List GetLoadFileList(List inCardIdList) + { + List list = new List(); + CardParameter cardParameter = null; + if (inCardIdList != null) + { + for (int i = 0; i < inCardIdList.Count; i++) + { + cardParameter = CardMaster.GetInstance(_formatBehavior.CardMasterId).GetCardParameterFromId(inCardIdList[i]); + CardParameter cardParameterFromId = CardMaster.GetInstance(_formatBehavior.CardMasterId).GetCardParameterFromId(cardParameter.BaseCardId); + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(cardParameterFromId.ResourceCardId.ToString(), ResourcesManager.AssetLoadPathType.UnitCardMaterial)); + } + UIBase_CardManager uIBase_CardManager = UIManager.GetInstance().getUIBase_CardManager(); + list.AddRange(uIBase_CardManager.AddAssetPath(inCardIdList, is2D: false, _formatBehavior.CardMasterId, isAddSleeve: true, 3000011L)); + list = list.Distinct().ToList(); + } + list.Add(Toolbox.ResourcesManager.GetAssetTypePath("foiltextures", ResourcesManager.AssetLoadPathType.FoilTextures)); + return list; + } + + public void SetActive(bool in_Active) + { + _rootPanel.alpha = (in_Active ? 1f : 0f); + CostCurve.gameObject.GetComponent().alpha = (in_Active ? 1f : 0f); + if (in_Active) + { + OnEnable(); + } + else + { + OnDisable(); + } + } + + public void RemoveData() + { + for (int i = 0; i < scrollItems.Count; i++) + { + GridBase.RemoveChild(scrollItems[i].transform); + UnityEngine.Object.Destroy(scrollItems[i].gameObject); + } + GridBase.enabled = true; + CostCurve.Refresh(); + scrollItems.Clear(); + PlayerDataIds.Clear(); + PlayerDataIdDict.Clear(); + CardCount = 0; + _followerNum = 0; + _spellNum = 0; + _amuletNum = 0; + _qrCodeSmallTexture.mainTexture = null; + _qrCodeRoot.gameObject.SetActive(value: false); + _showQRCodeButton.onClick.Clear(); + _showQRCodeButton.gameObject.SetActive(value: false); + UpdateDeckInfo(); + } + + public int getCardNum() + { + return CardCount; + } + + public void SetDeck(DeckData deck, ConventionDeckList conventionDeckList, bool isSortIdList = false) + { + _deck = deck; + if (isSortIdList) + { + _deck.SetCardIdList(UIManager.GetInstance().getUIBase_CardManager().SortIDList(_deck.GetCardIdList(), CardMaster.CardMasterId.Default)); + } + List cardIdList = deck.GetCardIdList(); + SetFormat(deck.Format, conventionDeckList); + SetDeckName(deck.GetDeckName()); + CardBasePrm.ClanType deckSubClassID = (CardBasePrm.ClanType)deck.GetDeckSubClassID(); + if (deckSubClassID == CardBasePrm.ClanType.ALL || deckSubClassID == CardBasePrm.ClanType.NONE) + { + SetClan((CardBasePrm.ClanType)deck.GetDeckClassID()); + } + else + { + SetClassSet(new ClassSet(deck.GetDeckClassID(), deck.GetDeckSubClassID())); + } + foreach (int item in (IEnumerable)cardIdList) + { + addScrollItem(item); + } + UIDestroyUtility.RemoveChildren(_myRotationGrid.transform); + if (deck.MyRotationId != null && IsEnableMyRotationDisplay) + { + _myRotationInfo = Data.MyRotationAllInfo.Get(deck.MyRotationId); + SetMyRotationInfo(deck.GetDeckClassID(), _myRotationInfo); + } + UpdateFormatIconPosition(deck.MyRotationId != null && IsEnableMyRotationDisplay); + UpdataAvatarFormatDisplay(deck.Format == Format.Avatar, deck); + } + + private void UpdateFormatIconPosition(bool isMyRotation) + { + _myRotationRoot.SetActive(isMyRotation); + if (isMyRotation) + { + _formatIcon.transform.localPosition = MY_ROTATION_FORMAT_ICON_POSITION; + _cardNumberIcon.transform.localPosition = MY_ROTATION_CARD_NUMBER_ICON_POSITION; + _deckNumLabel.transform.localPosition = MY_ROTATION_CARD_NUMBER_POSITION; + _deckDenoNumLabel.transform.localPosition = MY_ROTATION_CARD_NUMBER_MAX_POSITION; + _deckClassLabel.width = 110; + _deckClassLabel.text = string.Empty; + _classNameUnderLine.width = 182; + } + } + + public void UpdataAvatarFormatDisplay(bool isAvatar, DeckData deck = null) + { + _avatarBattleRoot.SetActive(isAvatar); + if (!isAvatar) + { + return; + } + GameMgr.GetIns().GetDataMgr().SetPlayerAvatarBattleInfo(deck.GetSkinId().ToString()); + if (GameMgr.GetIns().GetDataMgr().TryGetPlayerAvatarBattleInfo(out var avatarBattleInfo)) + { + SetEnableBlueButton(isEnable: false); + _avatarAbilityButton.onClick.Clear(); + _avatarAbilityButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + AvatarAbilityDetailDialog.Create(avatarBattleInfo, deck); + })); + CardDetail.IsShowEvolutionButton = false; + CardDetail.IsShowVoiceButton = false; + CardDetail.IsShowFlavorTextButton = false; + } + } + + public void SetMyRotationInfo(int classId, MyRotationInfo myRotationInfo) + { + if (_deckClassLabel != null) + { + _deckClassLabel.text = string.Empty; + } + _myRotationPackName.text = myRotationInfo.LastPackText; + foreach (MyRotationInfo.MyRotationBonus ability in myRotationInfo.Abilities) + { + GameObject obj = NGUITools.AddChild(_myRotationGrid.gameObject, _myRotationIconOriginal); + obj.SetActive(value: true); + obj.GetComponent().spriteName = ability.IconName; + } + _myRotationGrid.Reposition(); + } + + public void UpdateShortageRedEther() + { + if (_deck == null) + { + return; + } + _shortageBasicCardIdList.Clear(); + DeckCardEditUI.ClassSet = _classSet; + MyRotationInfo myRotationInfo = null; + if (_deck != null) + { + myRotationInfo = Data.MyRotationAllInfo.Get(_deck.MyRotationId); + } + List shortageCardList = DeckCardEditUI.GetShortageCardList(_deck.GetCardIdList(), _deck.DeckCopyFormat, _formatBehavior, myRotationInfo); + int num = 0; + foreach (int item in shortageCardList) + { + CardParameter cardParameterFromId = CardMaster.GetInstance(_formatBehavior.CardMasterId).GetCardParameterFromId(item); + num += cardParameterFromId.UseRedEther; + int baseCardId = cardParameterFromId.BaseCardId; + if (_shortageBasicCardIdList.ContainsKey(baseCardId)) + { + _shortageBasicCardIdList[baseCardId]++; + } + else + { + _shortageBasicCardIdList[baseCardId] = 1; + } + } + int userRedEtherCount = PlayerStaticData.UserRedEtherCount; + int num2 = num - userRedEtherCount; + _useRedEther.text = num.ToString(); + _haveRedEther.text = userRedEtherCount.ToString(); + _haveRedEtherEnoughCard.text = userRedEtherCount.ToString(); + _haveRedEtherEnough.text = userRedEtherCount.ToString(); + _notEnoughRedEther.text = Data.SystemText.Get("Card_0208", num2.ToString()); + _redEtherAfter.text = Data.SystemText.Get("Card_0094", (userRedEtherCount - num).ToString()); + if (_shortageBasicCardIdList.Count == 0) + { + _cardEnoughRoot.SetActive(value: true); + _redEtherEnoughRoot.gameObject.SetActive(value: false); + _redEtherNotEnoughRoot.gameObject.SetActive(value: false); + } + else + { + _cardEnoughRoot.SetActive(value: false); + bool flag = userRedEtherCount >= num; + _redEtherEnoughRoot.gameObject.SetActive(flag); + _redEtherNotEnoughRoot.gameObject.SetActive(!flag); + } + } + + public void addScrollItem(int inCardId) + { + CardBasePrm.CharaType charType = CardMaster.GetInstance(_formatBehavior.CardMasterId).GetCardParameterFromId(inCardId).CharType; + switch (charType) + { + case CardBasePrm.CharaType.NORMAL: + _followerNum++; + break; + case CardBasePrm.CharaType.FIELD: + case CardBasePrm.CharaType.CHANT_FIELD: + _amuletNum++; + break; + default: + _spellNum++; + break; + } + if (PlayerDataIdDict.ContainsKey(inCardId)) + { + int num = PlayerDataIdDict[inCardId].GetNum(); + PlayerDataIdDict[inCardId].SetNum(++num); + PlayerDataIds.Add(inCardId); + CostCurve.Add(inCardId, withAnim: false); + CardCount = PlayerDataIds.Count; + UpdateDeckInfo(); + return; + } + CardListTemplate obj = UnityEngine.Object.Instantiate(_cardListTemplatePrefab).GetComponent(); + obj.gameObject.transform.parent = GridBase.transform; + obj.name = inCardId.ToString(); + obj.gameObject.SetActive(value: true); + obj.transform.localPosition = new Vector3(0f, 0f, 0f); + obj.transform.localScale = new Vector3(0.65f, 0.65f, 0.65f); + obj.gameObject.AddComponent().SetCardId(inCardId); + CardParameter cardParameterFromId = CardMaster.GetInstance(_formatBehavior.CardMasterId).GetCardParameterFromId(inCardId); + Material material = UIBase_CardManager.Get2dCardMaterial(cardParameterFromId); + CardShaderDefine.ReplaceBaseShader(material, cardParameterFromId.IsFoil); + obj._cardTexture.material = material; + obj.SetFrame(cardParameterFromId); + UILabel nameLabel = obj._nameLabel; + nameLabel.text = cardParameterFromId.CardName; + UIManager.GetInstance().getUIBase_CardManager().SetNameLabelStyle(nameLabel, cardParameterFromId.IsFoil); + Global.SetRepositionNameLabel(nameLabel, cardParameterFromId.CardName, is2D: true); + nameLabel.gameObject.SetActive(value: true); + if (charType == CardBasePrm.CharaType.NORMAL) + { + obj._atkLabel.text = cardParameterFromId.Atk.ToString(); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(obj._atkLabel, cardParameterFromId.IsFoil); + obj._lifeLabel.text = cardParameterFromId.Life.ToString(); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(obj._lifeLabel, cardParameterFromId.IsFoil); + } + else + { + obj._atkLabel.text = ""; + obj._lifeLabel.text = ""; + } + obj._costLabel.text = cardParameterFromId.Cost.ToString(); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(obj._costLabel, cardParameterFromId.IsFoil); + obj.SetNum(1); + obj._newLabel.gameObject.SetActive(value: false); + obj.SetId(inCardId); + obj._classIconTexture.mainTexture = ClassCharaPrm.GetClassIconTexture((int)cardParameterFromId.Clan); + obj.RotationOnlyIconVisible = cardParameterFromId.IsResurgentCard; + scrollItems.Add(obj); + PlayerDataIds.Add(inCardId); + PlayerDataIdDict.Add(inCardId, obj); + CostCurve.Add(inCardId, withAnim: false); + GridBase.Reposition(); + CardCount = PlayerDataIds.Count; + obj.gameObject.AddComponent().onClick = delegate + { + CardDetail.OnPushCardDetailOn(obj.gameObject); + OnCardDetailOpen.Call(); + }; + obj.gameObject.AddComponent().size = new Vector3(obj._cardTexture.localSize.x, obj._cardTexture.localSize.y, 1f); + CardDetail.OnClose = delegate + { + OnCardDetailClose.Call(); + }; + obj.gameObject.AddComponent().scrollView = scrollView; + ResetScroll(); + UpdateDeckInfo(); + } + + protected void UpdateDeckInfo() + { + if (_deckNumLabel != null) + { + _deckNumLabel.text = CardCount.ToString(); + _deckFollowerNumLabel.text = _followerNum.ToString(); + _deckSpellNumLabel.text = _spellNum.ToString(); + _deckAmuletNumLabel.text = _amuletNum.ToString(); + bool flag = (_formatBehavior.IsEmphasizeDeckCardShortage && CardCount < _formatBehavior.DeckCardNumMin) || (_formatBehavior.IsEmphasizeDeckCardOverage && _formatBehavior.DeckCardNumMax < CardCount); + _deckNumLabel.color = (flag ? LabelDefine.TEXT_COLOR_RED : LabelDefine.TEXT_COLOR_NORMAL); + } + UpdateUseSubClassDeckInfo(); + CheckEnableShareButton(); + } + + private void UpdateUseSubClassDeckInfo() + { + if (_formatBehavior.UseSubClass) + { + CardMaster cardMaster = CardMaster.GetInstance(_formatBehavior.CardMasterId); + int num = PlayerDataIds.Count((int cardId) => cardMaster.GetCardParameterFromId(cardId).Clan == _classSet.MainClass); + int num2 = PlayerDataIds.Count((int cardId) => cardMaster.GetCardParameterFromId(cardId).Clan == _classSet.SubClass); + bool isRed = (_formatBehavior.IsEmphasizeDeckCardShortage && CardCount < _formatBehavior.DeckCardNumMin) || (_formatBehavior.IsEmphasizeDeckCardOverage && CardCount > _formatBehavior.DeckCardNumMax); + SetCardNumLabel(_useSubClassDeckCardNumLabel, CardCount, isRed); + SetCardNumLabel(_useSubClassMainClassCardNumLabel, num, isRed: false); + SetCardNumLabel(_useSubClassSubClassCardNumLabel, num2, isRed: false); + } + static void SetCardNumLabel(UILabel label, int num3, bool flag) + { + label.text = num3.ToString(); + label.color = (flag ? LabelDefine.TEXT_COLOR_RED : LabelDefine.TEXT_COLOR_NORMAL); + } + } + + public void ResetScroll() + { + if (!m_ResetFlg) + { + m_ResetFlg = true; + scrollView.GetComponent().alpha = 0f; + } + } + + public void ResetScrollImmediately() + { + if (PlayerDataIdDict.Count > 16) + { + scrollView.ResetPosition(); + ScrollBar.value = 1f; + ScrollBar.value = 0f; + } + else + { + scrollView.ResetPosition(); + } + UpdateCounter = 0; + m_ResetFlg = false; + scrollView.GetComponent().alpha = 1f; + } + + public void SetShareButtonUse(bool isUse) + { + _isShareButtonUse = isUse; + if (_classSet != null) + { + SetShareButton(_classSet.MainClass, _classSet.SubClass); + } + else + { + SetShareButton(_clanType); + } + } + + private void SetShareButton(CardBasePrm.ClanType? clan, CardBasePrm.ClanType subClass = CardBasePrm.ClanType.NONE) + { + _shareButton.gameObject.SetActive(clan.HasValue); + _shareButton.gameObject.SetActive(value: false); + if (!clan.HasValue) + { + return; + } + CheckEnableShareButton(); + _shareButton.onClick.Clear(); + _shareButton.onClick.Add(new EventDelegate(delegate + { + List excludedPhantomCardList = PlayerDataIds; + List phantomCardList = null; + ClassSet classSet = new ClassSet(clan.Value, CardBasePrm.ClanType.NONE); + string rotationId = string.Empty; + if (CardBasePrm.ClanTypeIsUseable(subClass)) + { + classSet.SubClass = subClass; + SubmitDeckType = _formatBehavior.DeckCodeType; + } + if (_format == Format.MyRotation && _deck != null) + { + SubmitDeckType = _formatBehavior.DeckCodeType; + rotationId = _deck.MyRotationId; + } + if (SubmitDeckType == GenerateDeckCodeTask.SubmitDeckType.SEALED) + { + SealedData.GroupByPhantomCard(PlayerDataIds, out excludedPhantomCardList, out phantomCardList, isConvertToOriginalCardId: true); + } + _shareButton.gameObject.GetComponent().TweetDataFromPortal(excludedPhantomCardList.ToArray(), classSet, SubmitDeckType, phantomCardList?.ToArray(), rotationId); + })); + } + + public void SetQRSmallTexture() + { + if (PlayerDataIds.Count != 40 || !_formatBehavior.CanShowQRCode || (_formatBehavior.UseSubClass && !CanShowQRCodeUseSubclass()) || (_format == Format.MyRotation && _deck != null && !IsAllCardCorrectMyRotation())) + { + return; + } + if (PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.SHOWQRCODE) == 0) + { + _showQRCodeButton.gameObject.SetActive(value: true); + UIManager.SetObjectToGrey(_showQRCodeButton.gameObject, b: false); + _qrCodeRoot.gameObject.SetActive(value: false); + _showQRCodeButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + ShowQRCode(); + })); + } + else + { + ShowQRCode(); + } + ChangeBlueUtilButtonPosToRightSide(); + } + + public bool CanShowQRCodeUseSubclass() + { + CardMaster cardMaster = CardMaster.GetInstance(_formatBehavior.CardMasterId); + if (PlayerDataIds.Count((int cardId) => cardMaster.GetCardParameterFromId(cardId).Clan == _classSet.MainClass) < 24) + { + return false; + } + if (PlayerDataIds.Count((int cardId) => cardMaster.GetCardParameterFromId(cardId).Clan == _classSet.SubClass) < 9) + { + return false; + } + return true; + } + + public void SetQRCodeButtonToGray() + { + _showQRCodeButton.gameObject.SetActive(value: true); + UIManager.SetObjectToGrey(_showQRCodeButton.gameObject, b: true); + } + + private void ShowQRCode() + { + _qrCodeRoot.gameObject.SetActive(value: true); + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.DECK_QR_CODE)) + { + _qrCodeMaintenance.gameObject.SetActive(value: true); + return; + } + string qrCodeText = QRCodeUtility.GenerateQRCodeText(PlayerDataIds, _clanType, _classSet, _formatBehavior, _format, _myRotationInfo); + _qrCodeSmallTexture.GetComponent().mainTexture = QRCodeUtility.CreateQrCodeTexture(207, 207, qrCodeText); + _showQRCodeButton.gameObject.SetActive(value: false); + UIEventListener.Get(_qrCodeSmallTexture.gameObject).onClick = delegate + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetTitleLabel(string.Format(Data.SystemText.Get("Card_0265"), _deckName)); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + GameObject gameObject = new GameObject("QRCodeBigTexture"); + UITexture uITexture = gameObject.AddComponent(); + uITexture.SetRect(0f, 0f, 400f, 400f); + uITexture.mainTexture = QRCodeUtility.CreateQrCodeTexture(508, 508, qrCodeText); + dialogBase.SetObj(gameObject); + _qrCodeDialog = dialogBase; + }; + } + + private void CheckEnableShareButton() + { + bool flag = _formatBehavior.IsEnableDeckShareButton(CardCount, _maxCardNum); + if (_format == Format.MyRotation && _deck != null) + { + flag &= IsAllCardCorrectMyRotation(); + } + if (_formatBehavior.UseSubClass) + { + flag &= CanShowQRCodeUseSubclass(); + } + UIManager.SetObjectToGrey(_shareButton.gameObject, !flag); + } + + public bool IsAllCardCorrectMyRotation() + { + MyRotationInfo myRotationInfo = Data.MyRotationAllInfo.Get(_deck.MyRotationId); + foreach (int item in PlayerDataIds.Distinct()) + { + CardMaster instance = CardMaster.GetInstance(_formatBehavior.CardMasterId); + CardParameter cardParameterFromId = instance.GetCardParameterFromId(item); + if (cardParameterFromId.IsPrizeCard) + { + cardParameterFromId = instance.GetCardParameterFromId(cardParameterFromId.BaseCardId); + } + if (!myRotationInfo.CardPadkIdList.Contains(cardParameterFromId.CardSetId) && !IsRePrintCardAvailable(myRotationInfo, cardParameterFromId)) + { + return false; + } + } + return true; + } + + private bool IsRePrintCardAvailable(MyRotationInfo myRotationInfo, CardParameter cardParameter) + { + if (myRotationInfo.IsRePrintCard(cardParameter.BaseCardId)) + { + foreach (string cardPadkId in myRotationInfo.CardPadkIdList) + { + if (myRotationInfo.IsRePrintCardAvailablePack(cardParameter.BaseCardId, cardPadkId)) + { + return true; + } + } + } + return false; + } + + public void SetActiveDeckIntroductionObj(bool isActive) + { + _deckIntroductionRoot.gameObject.SetActive(isActive); + SetGrayOutDeckIntroductionObj(isActive); + } + + public void SetGrayOutDeckIntroductionObj(bool isActive) + { + bool flag = isActive && _deck.IsOutOfRotationFormat && _deck.HasResurgentCard() && !Data.MyRotationAllInfo.IsWithinCopyDeckIntroductionPeriod; + UIManager.SetObjectToGrey(_deckIntroductionRoot, flag); + if (flag) + { + SetShortageCardDisableDefault(); + } + } + + public void SetRedButtonOnClickCallBack(string btnNameText, Action onClickCallback) + { + _redUtilButtonLabel.text = btnNameText; + _redUtilButton.onClick.Clear(); + _redUtilButton.onClick.Add(new EventDelegate(delegate + { + onClickCallback.Call(); + })); + } + + public void SetEnableRedButton(bool isEnable) + { + _redUtilButton.gameObject.SetActive(isEnable); + } + + public void SetEnableBlueButton(bool isEnable, string label = null, Action onClickCallback = null) + { + _blueUtilButtonRoot.SetActive(isEnable); + if (!isEnable) + { + return; + } + _blueUtilButtonLabel.text = label; + _blueUtilButton.onClick.Clear(); + _blueUtilButton.onClick.Add(new EventDelegate(delegate + { + if (onClickCallback != null) + { + onClickCallback(); + } + })); + } + + private void ChangeBlueUtilButtonPosToRightSide() + { + Vector3 localPosition = _blueUtilButtonRoot.transform.localPosition; + localPosition.x = 630f; + _blueUtilButtonRoot.transform.localPosition = localPosition; + } + + private void OnClickDeckCopy() + { + if (_deck == null) + { + return; + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + _selectedSubClass = 10; + DialogBase dialog; + if (_formatBehavior.UseSubClass && FormatBehaviorManager.GetDefaultBehaviour(_deck.Format).UseSubClass) + { + dialog = DeckCopyDialog.CreateDeckCopyDialogUseSubClass(_useSubClassDeckCopyDialog3OptionsPrefab, _deck); + } + else + { + dialog = CreateDeckCopyDialog(); + } + dialog.onPushButton1 = delegate + { + if (!_formatBehavior.UseSubClass) + { + DeckIntroductionCopyDialog componentInChildren = dialog.GetComponentInChildren(); + ExecEmptyDeckInfoTask(componentInChildren.IsCopyToMyRotation || componentInChildren.IsResurgentToMyRotationDeck); + } + else if (FormatBehaviorManager.GetDefaultBehaviour(_deck.Format).UseSubClass && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS)) + { + ExecEmptyDeckInfoTask(isCopyMyRotation: false); + } + else + { + dialog.Close(); + SubClassSelectDialog.Create(_deck, _subClassSelectDialogPrefab, new List(), delegate(int subClassId) + { + _selectedSubClass = subClassId; + ExecEmptyDeckInfoTask(isCopyMyRotation: false); + }); + } + }; + } + + private void ExecEmptyDeckInfoTask(bool isCopyMyRotation) + { + EmptyDeckInfoTask emptyDeckInfoTask = new EmptyDeckInfoTask(); + Format parameter = _deck.DeckCopyFormat; + if (isCopyMyRotation) + { + parameter = Format.MyRotation; + } + emptyDeckInfoTask.SetParameter(parameter); + StartCoroutine(Toolbox.NetworkManager.Connect(emptyDeckInfoTask, delegate + { + OnSuccessEmptyDeckInfoTask(isCopyMyRotation); + })); + } + + private static bool IsTimeSlipRotationDeck(DeckData deck) + { + if (deck.RotationId == null) + { + CardMaster instance = CardMaster.GetInstance(CardMaster.CardMasterId.Default); + using List.Enumerator enumerator = deck.GetCardIdList().GetEnumerator(); + if (enumerator.MoveNext()) + { + int current = enumerator.Current; + if (!instance.GetCardParameterFromId(current).IsAvailableFormat(Format.Rotation, ClassType.None)) + { + return false; + } + return true; + } + } + return deck.RotationId == Data.Load.data.RotationLatestCardPackId.ToString(); + } + + private DialogBase CreateDeckCopyDialog() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + DeckIntroductionCopyDialog deckIntroductionCopyDialog = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject("UI/DeckList/DeckIntroductionPreferSelect", isServerResources: false)); + deckIntroductionCopyDialog.Initialize(IsTimeSlipRotationDeck(_deck)); + if (Data.MyRotationAllInfo.Get(_deck.MyRotationId) == null && IsConventionDeckIntroduction) + { + deckIntroductionCopyDialog.IsDisableMyRotation = true; + } + deckIntroductionCopyDialog.IsMyRotationDeck = _deck.Format == Format.MyRotation; + dialogBase.SetObj(deckIntroductionCopyDialog.gameObject); + dialogBase.SetTitleLabel(Data.SystemText.Get("Card_0121")); + string labelCopyConfirm = Data.SystemText.Get("Card_0112", _deck.GetDeckName()); + string labelHint; + if (!Data.MyRotationAllInfo.IsWithinCopyDeckIntroductionPeriod || deckIntroductionCopyDialog.IsDisableMyRotation) + { + labelHint = ((!IsTimeSlipRotationDeck(_deck)) ? Data.SystemText.Get("Card_0222") : ""); + } + else if (_deck.Format == Format.Unlimited) + { + labelHint = string.Empty; + deckIntroductionCopyDialog.IsDisableMyRotation = true; + } + else if (_deck.Format == Format.MyRotation) + { + labelHint = string.Empty; + } + else if (IsTimeSlipRotationDeck(_deck)) + { + labelHint = Data.SystemText.Get("Card_0303"); + } + else if (_deck.HasResurgentCard()) + { + labelHint = Data.SystemText.Get("MyRotation_ID_24"); + deckIntroductionCopyDialog.IsResurgentToMyRotationDeck = true; + } + else + { + labelHint = Data.SystemText.Get("MyRotation_ID_05"); + } + deckIntroductionCopyDialog.LabelCopyConfirm = labelCopyConfirm; + deckIntroductionCopyDialog.LabelHint = labelHint; + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(Data.SystemText.Get("Card_0122")); + return dialogBase; + } + + private void OnSuccessEmptyDeckInfoTask(bool isCopyMyRotation) + { + if (Data.EmptyDeckInfo.EmptyDeckID < 0) + { + ShowEmptyDeckNotFoundDialog(isCopyMyRotation); + return; + } + Data.CurrentFormat = _deck.DeckCopyFormat; + ShowCopySceneChangeMessag(isCopyMyRotation); + } + + private void ShowCopySceneChangeMessag(bool isCopyMyRotation) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Card_0214")); + dialogBase.SetText(Data.SystemText.Get("Card_0215")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.onCloseWithoutSelect = delegate + { + _selectedSubClass = 10; + }; + dialogBase.onPushButton1 = delegate + { + bool num = _selectedSubClass != 10; + bool flag = _formatBehavior.UseSubClass && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS); + if (num && !flag) + { + _deck.SetDeckSubClassID(_selectedSubClass); + } + Format format = _deck.DeckCopyFormat; + MyRotationInfo myRotationInfo = null; + if (isCopyMyRotation) + { + format = Format.MyRotation; + myRotationInfo = ((_deck.Format != Format.MyRotation) ? _deck.GetMyRotationInfoFromCardList() : Data.MyRotationAllInfo.Get(_deck.MyRotationId)); + } + DeckData deckData = new DeckData(format, DeckAttributeType.CustomDeck); + deckData.SetDeckID(Data.EmptyDeckInfo.EmptyDeckID); + DeckCardEditUI.SetDeckCopyParameterForDeckIntroduction(deckData, _deck, myRotationInfo); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.DeckCardEdit); + }; + } + + private void ShowEmptyDeckNotFoundDialog(bool isCopyMyRotation) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + SystemText systemText = Data.SystemText; + string formatName = FormatBehaviorManager.GetFormatName(isCopyMyRotation ? Format.MyRotation : _deck.DeckCopyFormat); + dialogBase.SetTitleLabel(systemText.Get("Card_0212")); + dialogBase.SetText(systemText.Get("Card_0213", formatName)); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + } + + private void OnClickShortageCardVisibleButton(bool visible) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + SetShortageCardVisible(visible); + } + + public void SetShortageCardVisible(bool visible) + { + _isEnableShortageCardVisible = visible; + _redEtherRoot.gameObject.SetActive(visible); + _deckIntroductionRedEtherOffButton.enabled = visible; + _deckIntroductionRedEtherOnButton.enabled = !visible; + _deckIntroductionRedEtherOffSprite.spriteName = (visible ? "pilltab_02_left_off" : "pilltab_02_left_on"); + _deckIntroductionRedEtherOnSprite.spriteName = (visible ? "pilltab_02_right_on" : "pilltab_02_right_off"); + foreach (CardListTemplate scrollItem in scrollItems) + { + CardParameter cardParameterFromId = CardMaster.GetInstance(_formatBehavior.CardMasterId).GetCardParameterFromId(scrollItem.GetId()); + bool flag = _shortageBasicCardIdList.ContainsKey(cardParameterFromId.BaseCardId); + if (visible && flag) + { + string infoLabelText = Data.SystemText.Get("Card_0209", _shortageBasicCardIdList[cardParameterFromId.BaseCardId].ToString()); + if (cardParameterFromId.IsPreReleaseCard) + { + infoLabelText = Data.SystemText.Get("Card_0245"); + scrollItem.SetInfoLabelTextColor(LabelDefine.TEXT_COLOR_RED); + } + else if (cardParameterFromId.IsBasicCard) + { + infoLabelText = Data.SystemText.Get("Card_0160"); + scrollItem.SetInfoLabelTextColor(LabelDefine.TEXT_COLOR_RED); + } + else + { + scrollItem.SetInfoLabelTextColor(LabelDefine.TEXT_COLOR_NORMAL); + } + scrollItem.AttachGrayShader(); + scrollItem.SetInfoVisible(visible: true); + scrollItem.SetInfoLabelText(infoLabelText); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(scrollItem._atkLabel, inIsPremiere: false); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(scrollItem._costLabel, inIsPremiere: false); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(scrollItem._lifeLabel, inIsPremiere: false); + } + else + { + scrollItem.AttachShaders(_formatBehavior.CardMasterId); + scrollItem.SetInfoVisible(visible: false); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(scrollItem._atkLabel, cardParameterFromId.IsFoil); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(scrollItem._costLabel, cardParameterFromId.IsFoil); + UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(scrollItem._lifeLabel, cardParameterFromId.IsFoil); + } + } + } + + private void SetShortageCardDisableDefault() + { + bool isEnableShortageCardVisible = _isEnableShortageCardVisible; + SetShortageCardVisible(visible: false); + _isEnableShortageCardVisible = isEnableShortageCardVisible; + } + + private void InitUseSubClassDisplay() + { + if (!_formatBehavior.UseSubClass) + { + if (_clanType.HasValue) + { + _deckClassLabel.gameObject.SetActive(value: true); + _deckClassLabel.text = ClassCharaPrm.GetNameText(_clanType.Value); + _formatIcon.transform.gameObject.SetActive(value: true); + _deckNumLabel.transform.parent.gameObject.SetActive(value: true); + } + _useSubClassRoot.SetActive(value: false); + } + else + { + _deckClassLabel.transform.gameObject.SetActive(value: false); + _formatIcon.transform.gameObject.SetActive(value: false); + _deckNumLabel.transform.parent.gameObject.SetActive(value: false); + _useSubClassRoot.SetActive(value: true); + _useSubClassMainClassIconSprite.spriteName = ClassCharaPrm.GetIconSpriteName(_classSet.MainClass); + _useSubClassSubClassIconSprite.spriteName = ClassCharaPrm.GetIconSpriteName(_classSet.SubClass); + _useSubClassDeckCardNumMaxLabel.text = _deckDenoNumLabel.text; + _useSubClassMainClassCardNumMinLabel.text = "/" + 24; + _useSubClassSubClassCardNumMinLabel.text = "/" + 9; + _useSubClassFormatIconSprite.spriteName = _formatBehavior.SmallIconSpriteName; + } + } + + public bool IsDeckNull() + { + return _deck == null; + } + + public void ReSearchUIRoot() + { + GetComponent().ReSearchUIRoot(); + } + + public void SetPanelSortOrder(int sortOrder) + { + _rootPanel.sortingOrder = sortOrder; + _scrollPanel.sortingOrder = sortOrder + 1; + _costCurvePanel.sortingOrder = sortOrder + 2; + } + + private void KeyboardUpdate() + { + DataMgr.BattleType battleType = GameMgr.GetIns().GetDataMgr().m_BattleType; + if ((battleType == DataMgr.BattleType.FreeBattle || battleType == DataMgr.BattleType.RankBattle) && _loadingEnd && !UIManager.GetInstance().LoadingViewManager.IsEnableInSceneCenterObj() && InputMgr.KeyboardControl) + { + if (GameMgr.GetIns().GetInputMgr().IsKeyboardLeftArrow() || GameMgr.GetIns().GetInputMgr().IsKeyboardRightArrow()) + { + _isSelectCloseButton = true; + _keyboardCloseSelectEffect.SetActive(value: true); + } + if ((GameMgr.GetIns().GetInputMgr().IsKeyboardEnter() && _isSelectCloseButton) || GameMgr.GetIns().GetInputMgr().IsKeyboardCancel()) + { + _isSelectCloseButton = false; + _keyboardCloseSelectEffect.SetActive(value: false); + CloseBtnObj.gameObject.SendMessage("OnClick"); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/UIKeyNavigation.cs b/SVSim.BattleEngine/Engine/UIKeyNavigation.cs new file mode 100644 index 0000000..58daaf8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UIKeyNavigation.cs @@ -0,0 +1,321 @@ +using System; +using UnityEngine; + +[AddComponentMenu("NGUI/Interaction/Key Navigation")] +public class UIKeyNavigation : MonoBehaviour +{ + public enum Constraint + { + None, + Vertical, + Horizontal, + Explicit + } + + public static BetterList list = new BetterList(); + + public Constraint constraint; + + public GameObject onUp; + + public GameObject onDown; + + public GameObject onLeft; + + public GameObject onRight; + + public GameObject onClick; + + public GameObject onTab; + + public bool startsSelected; + + [NonSerialized] + private bool mStarted; + + public static int mLastFrame = 0; + + public static UIKeyNavigation current + { + get + { + GameObject hoveredObject = UICamera.hoveredObject; + if (hoveredObject == null) + { + return null; + } + return hoveredObject.GetComponent(); + } + } + + public bool isColliderEnabled + { + get + { + if (base.enabled && base.gameObject.activeInHierarchy) + { + Collider component = GetComponent(); + if (component != null) + { + return component.enabled; + } + Collider2D component2 = GetComponent(); + if (component2 != null) + { + return component2.enabled; + } + return false; + } + return false; + } + } + + protected virtual void OnEnable() + { + list.Add(this); + if (mStarted) + { + Start(); + } + } + + private void Start() + { + mStarted = true; + if (startsSelected && isColliderEnabled) + { + UICamera.hoveredObject = base.gameObject; + } + } + + protected virtual void OnDisable() + { + list.Remove(this); + } + + private static bool IsActive(GameObject go) + { + if ((bool)go && go.activeInHierarchy) + { + Collider component = go.GetComponent(); + if (component != null) + { + return component.enabled; + } + Collider2D component2 = go.GetComponent(); + if (component2 != null) + { + return component2.enabled; + } + return false; + } + return false; + } + + public GameObject GetLeft() + { + if (IsActive(onLeft)) + { + return onLeft; + } + if (constraint == Constraint.Vertical || constraint == Constraint.Explicit) + { + return null; + } + return Get(Vector3.left, 1f, 2f); + } + + public GameObject GetRight() + { + if (IsActive(onRight)) + { + return onRight; + } + if (constraint == Constraint.Vertical || constraint == Constraint.Explicit) + { + return null; + } + return Get(Vector3.right, 1f, 2f); + } + + public GameObject GetUp() + { + if (IsActive(onUp)) + { + return onUp; + } + if (constraint == Constraint.Horizontal || constraint == Constraint.Explicit) + { + return null; + } + return Get(Vector3.up, 2f); + } + + public GameObject GetDown() + { + if (IsActive(onDown)) + { + return onDown; + } + if (constraint == Constraint.Horizontal || constraint == Constraint.Explicit) + { + return null; + } + return Get(Vector3.down, 2f); + } + + public GameObject Get(Vector3 myDir, float x = 1f, float y = 1f) + { + Transform transform = base.transform; + myDir = transform.TransformDirection(myDir); + Vector3 center = GetCenter(base.gameObject); + float num = float.MaxValue; + GameObject result = null; + for (int i = 0; i < list.size; i++) + { + UIKeyNavigation uIKeyNavigation = list[i]; + if (uIKeyNavigation == this || uIKeyNavigation.constraint == Constraint.Explicit || !uIKeyNavigation.isColliderEnabled) + { + continue; + } + UIWidget component = uIKeyNavigation.GetComponent(); + if (component != null && component.alpha == 0f) + { + continue; + } + Vector3 direction = GetCenter(uIKeyNavigation.gameObject) - center; + if (!(Vector3.Dot(myDir, direction.normalized) < 0.707f)) + { + direction = transform.InverseTransformDirection(direction); + direction.x *= x; + direction.y *= y; + float sqrMagnitude = direction.sqrMagnitude; + if (!(sqrMagnitude > num)) + { + result = uIKeyNavigation.gameObject; + num = sqrMagnitude; + } + } + } + return result; + } + + protected static Vector3 GetCenter(GameObject go) + { + UIWidget component = go.GetComponent(); + UICamera uICamera = UICamera.FindCameraForLayer(go.layer); + if (uICamera != null) + { + Vector3 position = go.transform.position; + if (component != null) + { + Vector3[] worldCorners = component.worldCorners; + position = (worldCorners[0] + worldCorners[2]) * 0.5f; + } + position = uICamera.cachedCamera.WorldToScreenPoint(position); + position.z = 0f; + return position; + } + if (component != null) + { + Vector3[] worldCorners2 = component.worldCorners; + return (worldCorners2[0] + worldCorners2[2]) * 0.5f; + } + return go.transform.position; + } + + public virtual void OnNavigate(KeyCode key) + { + if (!UIPopupList.isOpen && mLastFrame != Time.frameCount) + { + mLastFrame = Time.frameCount; + GameObject gameObject = null; + switch (key) + { + case KeyCode.LeftArrow: + gameObject = GetLeft(); + break; + case KeyCode.RightArrow: + gameObject = GetRight(); + break; + case KeyCode.UpArrow: + gameObject = GetUp(); + break; + case KeyCode.DownArrow: + gameObject = GetDown(); + break; + } + if (gameObject != null) + { + UICamera.hoveredObject = gameObject; + } + } + } + + public virtual void OnKey(KeyCode key) + { + if (UIPopupList.isOpen || mLastFrame == Time.frameCount) + { + return; + } + mLastFrame = Time.frameCount; + if (key != KeyCode.Tab) + { + return; + } + GameObject gameObject = onTab; + if (gameObject == null) + { + if (UICamera.GetKey(KeyCode.LeftShift) || UICamera.GetKey(KeyCode.RightShift)) + { + gameObject = GetLeft(); + if (gameObject == null) + { + gameObject = GetUp(); + } + if (gameObject == null) + { + gameObject = GetDown(); + } + if (gameObject == null) + { + gameObject = GetRight(); + } + } + else + { + gameObject = GetRight(); + if (gameObject == null) + { + gameObject = GetDown(); + } + if (gameObject == null) + { + gameObject = GetUp(); + } + if (gameObject == null) + { + gameObject = GetLeft(); + } + } + } + if (gameObject != null) + { + UICamera.currentScheme = UICamera.ControlScheme.Controller; + UICamera.hoveredObject = gameObject; + UIInput component = gameObject.GetComponent(); + if (component != null) + { + component.isSelected = true; + } + } + } + + protected virtual void OnClick() + { + if (NGUITools.GetActive(onClick)) + { + UICamera.hoveredObject = onClick; + } + } +} diff --git a/SVSim.BattleEngine/Engine/UIOrthoCamera.cs b/SVSim.BattleEngine/Engine/UIOrthoCamera.cs new file mode 100644 index 0000000..2e29c93 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UIOrthoCamera.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +[ExecuteInEditMode] +[RequireComponent(typeof(Camera))] +[AddComponentMenu("NGUI/UI/Orthographic Camera")] +public class UIOrthoCamera : MonoBehaviour +{ + private Camera mCam; + + private Transform mTrans; + + private void Start() + { + mCam = GetComponent(); + mTrans = base.transform; + mCam.orthographic = true; + } + + private void Update() + { + float num = mCam.rect.yMin * (float)Screen.height; + float num2 = (mCam.rect.yMax * (float)Screen.height - num) * 0.5f * mTrans.lossyScale.y; + if (!Mathf.Approximately(mCam.orthographicSize, num2)) + { + mCam.orthographicSize = num2; + } + } +} diff --git a/SVSim.BattleEngine/Engine/UIPopupList.cs b/SVSim.BattleEngine/Engine/UIPopupList.cs new file mode 100644 index 0000000..4584248 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UIPopupList.cs @@ -0,0 +1,933 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +[ExecuteInEditMode] +[AddComponentMenu("NGUI/Interaction/Popup List")] +public class UIPopupList : UIWidgetContainer +{ + public enum Position + { + Auto, + Above, + Below + } + + public enum OpenOn + { + ClickOrTap, + RightClick, + DoubleClick, + Manual + } + + public delegate void LegacyEvent(string val); + + public static UIPopupList current; + + private static GameObject mChild; + + private static float mFadeOutComplete; + + private const float animSpeed = 0.15f; + + public UIAtlas atlas; + + public UIFont bitmapFont; + + public Font trueTypeFont; + + public int fontSize = 16; + + public FontStyle fontStyle; + + public string backgroundSprite; + + public string highlightSprite; + + public Position position; + + public NGUIText.Alignment alignment = NGUIText.Alignment.Left; + + public List items = new List(); + + public List itemData = new List(); + + public Vector2 padding = new Vector3(4f, 4f); + + public Color textColor = Color.white; + + public Color backgroundColor = Color.white; + + public Color highlightColor = new Color(0.88235295f, 40f / 51f, 0.5882353f, 1f); + + public bool isAnimated = true; + + public bool isLocalized; + + public bool separatePanel = true; + + public OpenOn openOn; + + public List onChange = new List(); + + [HideInInspector] + [SerializeField] + protected string mSelectedItem; + + [HideInInspector] + [SerializeField] + protected UIPanel mPanel; + + [HideInInspector] + [SerializeField] + protected UISprite mBackground; + + [HideInInspector] + [SerializeField] + protected UISprite mHighlight; + + [HideInInspector] + [SerializeField] + protected UILabel mHighlightedLabel; + + [HideInInspector] + [SerializeField] + protected List mLabelList = new List(); + + [HideInInspector] + [SerializeField] + protected float mBgBorder; + + [NonSerialized] + protected GameObject mSelection; + + [NonSerialized] + protected int mOpenFrame; + + [HideInInspector] + [SerializeField] + private GameObject eventReceiver; + + [HideInInspector] + [SerializeField] + private string functionName = "OnSelectionChange"; + + [HideInInspector] + [SerializeField] + private float textScale; + + [HideInInspector] + [SerializeField] + private UIFont font; + + [HideInInspector] + [SerializeField] + private UILabel textLabel; + + private LegacyEvent mLegacyEvent; + + [NonSerialized] + protected bool mExecuting; + + protected bool mUseDynamicFont; + + protected bool mTweening; + + public GameObject source; + + public UnityEngine.Object ambigiousFont + { + get + { + if (trueTypeFont != null) + { + return trueTypeFont; + } + if (bitmapFont != null) + { + return bitmapFont; + } + return font; + } + set + { + if (value is Font) + { + trueTypeFont = value as Font; + bitmapFont = null; + font = null; + } + else if (value is UIFont) + { + bitmapFont = value as UIFont; + trueTypeFont = null; + font = null; + } + } + } + + [Obsolete("Use EventDelegate.Add(popup.onChange, YourCallback) instead, and UIPopupList.current.value to determine the state")] + public LegacyEvent onSelectionChange + { + get + { + return mLegacyEvent; + } + set + { + mLegacyEvent = value; + } + } + + public static bool isOpen + { + get + { + if (current != null) + { + if (!(mChild != null)) + { + return mFadeOutComplete > Time.unscaledTime; + } + return true; + } + return false; + } + } + + public virtual string value + { + get + { + return mSelectedItem; + } + set + { + mSelectedItem = value; + if (mSelectedItem != null && mSelectedItem != null) + { + TriggerCallbacks(); + } + } + } + + public virtual object data + { + get + { + int num = items.IndexOf(mSelectedItem); + if (num <= -1 || num >= itemData.Count) + { + return null; + } + return itemData[num]; + } + } + + public bool isColliderEnabled + { + get + { + Collider component = GetComponent(); + if (component != null) + { + return component.enabled; + } + Collider2D component2 = GetComponent(); + if (component2 != null) + { + return component2.enabled; + } + return false; + } + } + + [Obsolete("Use 'value' instead")] + public string selection + { + get + { + return value; + } + set + { + this.value = value; + } + } + + private bool isValid + { + get + { + if (!(bitmapFont != null)) + { + return trueTypeFont != null; + } + return true; + } + } + + private int activeFontSize + { + get + { + if (!(trueTypeFont != null) && !(bitmapFont == null)) + { + return bitmapFont.defaultSize; + } + return fontSize; + } + } + + private float activeFontScale + { + get + { + if (!(trueTypeFont != null) && !(bitmapFont == null)) + { + return (float)fontSize / (float)bitmapFont.defaultSize; + } + return 1f; + } + } + + public virtual void Clear() + { + items.Clear(); + itemData.Clear(); + } + + public virtual void AddItem(string text) + { + items.Add(text); + itemData.Add(null); + } + + public virtual void AddItem(string text, object data) + { + items.Add(text); + itemData.Add(data); + } + + public virtual void RemoveItem(string text) + { + int num = items.IndexOf(text); + if (num != -1) + { + items.RemoveAt(num); + itemData.RemoveAt(num); + } + } + + public virtual void RemoveItemByData(object data) + { + int num = itemData.IndexOf(data); + if (num != -1) + { + items.RemoveAt(num); + itemData.RemoveAt(num); + } + } + + protected void TriggerCallbacks() + { + if (!mExecuting) + { + mExecuting = true; + UIPopupList uIPopupList = current; + current = this; + if (mLegacyEvent != null) + { + mLegacyEvent(mSelectedItem); + } + if (EventDelegate.IsValid(onChange)) + { + EventDelegate.Execute(onChange); + } + else if (eventReceiver != null && !string.IsNullOrEmpty(functionName)) + { + eventReceiver.SendMessage(functionName, mSelectedItem, SendMessageOptions.DontRequireReceiver); + } + current = uIPopupList; + mExecuting = false; + } + } + + protected virtual void OnEnable() + { + if (EventDelegate.IsValid(onChange)) + { + eventReceiver = null; + functionName = null; + } + if (font != null) + { + if (font.isDynamic) + { + trueTypeFont = font.dynamicFont; + fontStyle = font.dynamicFontStyle; + mUseDynamicFont = true; + } + else if (bitmapFont == null) + { + bitmapFont = font; + mUseDynamicFont = false; + } + font = null; + } + if (textScale != 0f) + { + fontSize = ((bitmapFont != null) ? Mathf.RoundToInt((float)bitmapFont.defaultSize * textScale) : 16); + textScale = 0f; + } + if (trueTypeFont == null && bitmapFont != null && bitmapFont.isDynamic) + { + trueTypeFont = bitmapFont.dynamicFont; + bitmapFont = null; + } + } + + protected virtual void OnValidate() + { + Font font = trueTypeFont; + UIFont uIFont = bitmapFont; + bitmapFont = null; + trueTypeFont = null; + if (font != null && (uIFont == null || !mUseDynamicFont)) + { + bitmapFont = null; + trueTypeFont = font; + mUseDynamicFont = true; + } + else if (uIFont != null) + { + if (uIFont.isDynamic) + { + trueTypeFont = uIFont.dynamicFont; + fontStyle = uIFont.dynamicFontStyle; + fontSize = uIFont.defaultSize; + mUseDynamicFont = true; + } + else + { + bitmapFont = uIFont; + mUseDynamicFont = false; + } + } + else + { + trueTypeFont = font; + mUseDynamicFont = true; + } + } + + protected virtual void Start() + { + if (textLabel != null) + { + EventDelegate.Add(onChange, textLabel.SetCurrentSelection); + textLabel = null; + } + if (Application.isPlaying) + { + if (string.IsNullOrEmpty(mSelectedItem) && items.Count > 0) + { + mSelectedItem = items[0]; + } + if (!string.IsNullOrEmpty(mSelectedItem)) + { + TriggerCallbacks(); + } + } + } + + protected virtual void OnLocalize() + { + if (isLocalized) + { + TriggerCallbacks(); + } + } + + protected virtual void Highlight(UILabel lbl, bool instant) + { + if (!(mHighlight != null)) + { + return; + } + mHighlightedLabel = lbl; + if (mHighlight.GetAtlasSprite() == null) + { + return; + } + Vector3 highlightPosition = GetHighlightPosition(); + if (!instant && isAnimated) + { + TweenPosition.Begin(mHighlight.gameObject, 0.1f, highlightPosition).method = UITweener.Method.EaseOut; + if (!mTweening) + { + mTweening = true; + StartCoroutine("UpdateTweenPosition"); + } + } + else + { + mHighlight.cachedTransform.localPosition = highlightPosition; + } + } + + protected virtual Vector3 GetHighlightPosition() + { + if (mHighlightedLabel == null || mHighlight == null) + { + return Vector3.zero; + } + UISpriteData atlasSprite = mHighlight.GetAtlasSprite(); + if (atlasSprite == null) + { + return Vector3.zero; + } + float pixelSize = atlas.pixelSize; + float num = (float)atlasSprite.borderLeft * pixelSize; + float y = (float)atlasSprite.borderTop * pixelSize; + return mHighlightedLabel.cachedTransform.localPosition + new Vector3(0f - num, y, 1f); + } + + protected virtual IEnumerator UpdateTweenPosition() + { + if (mHighlight != null && mHighlightedLabel != null) + { + TweenPosition tp = mHighlight.GetComponent(); + while (tp != null && tp.enabled) + { + tp.to = GetHighlightPosition(); + yield return null; + } + } + mTweening = false; + } + + protected virtual void OnItemHover(GameObject go, bool isOver) + { + if (isOver) + { + UILabel component = go.GetComponent(); + Highlight(component, instant: false); + } + } + + protected virtual void OnItemPress(GameObject go, bool isPressed) + { + if (!isPressed) + { + return; + } + Select(go.GetComponent(), instant: true); + UIEventListener component = go.GetComponent(); + value = component.parameter as string; + UIPlaySound[] components = GetComponents(); + int i = 0; + for (int num = components.Length; i < num; i++) + { + UIPlaySound uIPlaySound = components[i]; + if (uIPlaySound.trigger == UIPlaySound.Trigger.OnClick) + { + NGUITools.PlaySound(uIPlaySound.audioClip, uIPlaySound.volume, 1f); + } + } + CloseSelf(); + } + + private void Select(UILabel lbl, bool instant) + { + Highlight(lbl, instant); + } + + protected virtual void OnNavigate(KeyCode key) + { + if (!base.enabled || !(current == this)) + { + return; + } + int num = mLabelList.IndexOf(mHighlightedLabel); + if (num == -1) + { + num = 0; + } + switch (key) + { + case KeyCode.UpArrow: + if (num > 0) + { + Select(mLabelList[--num], instant: false); + } + break; + case KeyCode.DownArrow: + if (num + 1 < mLabelList.Count) + { + Select(mLabelList[++num], instant: false); + } + break; + } + } + + protected virtual void OnKey(KeyCode key) + { + if (base.enabled && current == this && (key == UICamera.current.cancelKey0 || key == UICamera.current.cancelKey1)) + { + OnSelect(isSelected: false); + } + } + + protected virtual void OnDisable() + { + CloseSelf(); + } + + protected virtual void OnSelect(bool isSelected) + { + if (!isSelected) + { + CloseSelf(); + } + } + + public static void Close() + { + if (current != null) + { + current.CloseSelf(); + current = null; + } + } + + public virtual void CloseSelf() + { + if (!(mChild != null) || !(current == this)) + { + return; + } + StopCoroutine("CloseIfUnselected"); + mSelection = null; + mLabelList.Clear(); + if (isAnimated) + { + UIWidget[] componentsInChildren = mChild.GetComponentsInChildren(); + int i = 0; + for (int num = componentsInChildren.Length; i < num; i++) + { + UIWidget obj = componentsInChildren[i]; + Color color = obj.color; + color.a = 0f; + TweenColor.Begin(obj.gameObject, 0.15f, color).method = UITweener.Method.EaseOut; + } + Collider[] componentsInChildren2 = mChild.GetComponentsInChildren(); + int j = 0; + for (int num2 = componentsInChildren2.Length; j < num2; j++) + { + componentsInChildren2[j].enabled = false; + } + UnityEngine.Object.Destroy(mChild, 0.15f); + mFadeOutComplete = Time.unscaledTime + Mathf.Max(0.1f, 0.15f); + } + else + { + UnityEngine.Object.Destroy(mChild); + mFadeOutComplete = Time.unscaledTime + 0.1f; + } + mBackground = null; + mHighlight = null; + mChild = null; + current = null; + } + + protected virtual void AnimateColor(UIWidget widget) + { + Color color = widget.color; + widget.color = new Color(color.r, color.g, color.b, 0f); + TweenColor.Begin(widget.gameObject, 0.15f, color).method = UITweener.Method.EaseOut; + } + + protected virtual void AnimatePosition(UIWidget widget, bool placeAbove, float bottom) + { + Vector3 localPosition = widget.cachedTransform.localPosition; + Vector3 localPosition2 = (placeAbove ? new Vector3(localPosition.x, bottom, localPosition.z) : new Vector3(localPosition.x, 0f, localPosition.z)); + widget.cachedTransform.localPosition = localPosition2; + TweenPosition.Begin(widget.gameObject, 0.15f, localPosition).method = UITweener.Method.EaseOut; + } + + protected virtual void AnimateScale(UIWidget widget, bool placeAbove, float bottom) + { + GameObject go = widget.gameObject; + Transform cachedTransform = widget.cachedTransform; + float num = (float)activeFontSize * activeFontScale + mBgBorder * 2f; + cachedTransform.localScale = new Vector3(1f, num / (float)widget.height, 1f); + TweenScale.Begin(go, 0.15f, Vector3.one).method = UITweener.Method.EaseOut; + if (placeAbove) + { + Vector3 localPosition = cachedTransform.localPosition; + cachedTransform.localPosition = new Vector3(localPosition.x, localPosition.y - (float)widget.height + num, localPosition.z); + TweenPosition.Begin(go, 0.15f, localPosition).method = UITweener.Method.EaseOut; + } + } + + private void Animate(UIWidget widget, bool placeAbove, float bottom) + { + AnimateColor(widget); + AnimatePosition(widget, placeAbove, bottom); + } + + protected virtual void OnClick() + { + if (mOpenFrame == Time.frameCount) + { + return; + } + if (mChild == null) + { + if (openOn != OpenOn.DoubleClick && openOn != OpenOn.Manual && (openOn != OpenOn.RightClick || UICamera.currentTouchID == -2)) + { + Show(); + } + } + else if (mHighlightedLabel != null) + { + OnItemPress(mHighlightedLabel.gameObject, isPressed: true); + } + } + + protected virtual void OnDoubleClick() + { + if (openOn == OpenOn.DoubleClick) + { + Show(); + } + } + + private IEnumerator CloseIfUnselected() + { + do + { + yield return null; + } + while (!(UICamera.selectedObject != mSelection)); + CloseSelf(); + } + + public virtual void Show() + { + if (base.enabled && NGUITools.GetActive(base.gameObject) && mChild == null && atlas != null && isValid && items.Count > 0) + { + mLabelList.Clear(); + StopCoroutine("CloseIfUnselected"); + UICamera.selectedObject = UICamera.hoveredObject ?? base.gameObject; + mSelection = UICamera.selectedObject; + source = UICamera.selectedObject; + if (source == null) + { + Debug.LogError("Popup list needs a source object..."); + return; + } + mOpenFrame = Time.frameCount; + if (mPanel == null) + { + mPanel = UIPanel.Find(base.transform); + if (mPanel == null) + { + return; + } + } + mChild = new GameObject("Drop-down List"); + mChild.layer = base.gameObject.layer; + if (separatePanel) + { + if (GetComponent() != null) + { + mChild.AddComponent().isKinematic = true; + } + else if (GetComponent() != null) + { + mChild.AddComponent().isKinematic = true; + } + mChild.AddComponent().depth = 1000000; + } + current = this; + Transform transform = mChild.transform; + transform.parent = mPanel.cachedTransform; + Vector3 vector2; + Vector3 vector3; + Vector3 vector; + if (openOn == OpenOn.Manual && mSelection != base.gameObject) + { + vector = UICamera.lastEventPosition; + vector2 = mPanel.cachedTransform.InverseTransformPoint(mPanel.anchorCamera.ScreenToWorldPoint(vector)); + vector3 = vector2; + transform.localPosition = vector2; + vector = transform.position; + } + else + { + Bounds bounds = NGUIMath.CalculateRelativeWidgetBounds(mPanel.cachedTransform, base.transform, considerInactive: false, considerChildren: false); + vector2 = bounds.min; + vector3 = bounds.max; + transform.localPosition = vector2; + vector = transform.position; + } + StartCoroutine("CloseIfUnselected"); + transform.localRotation = Quaternion.identity; + transform.localScale = Vector3.one; + mBackground = NGUITools.AddSprite(mChild, atlas, backgroundSprite, (!separatePanel) ? NGUITools.CalculateNextDepth(mPanel.gameObject) : 0); + mBackground.pivot = UIWidget.Pivot.TopLeft; + mBackground.color = backgroundColor; + Vector4 border = mBackground.border; + mBgBorder = border.y; + mBackground.cachedTransform.localPosition = new Vector3(0f, border.y, 0f); + mHighlight = NGUITools.AddSprite(mChild, atlas, highlightSprite, mBackground.depth + 1); + mHighlight.pivot = UIWidget.Pivot.TopLeft; + mHighlight.color = highlightColor; + UISpriteData atlasSprite = mHighlight.GetAtlasSprite(); + if (atlasSprite == null) + { + return; + } + float num = atlasSprite.borderTop; + float num2 = activeFontSize; + float num3 = activeFontScale; + float num4 = num2 * num3; + float a = 0f; + float num5 = 0f - padding.y; + List list = new List(); + if (!items.Contains(mSelectedItem)) + { + mSelectedItem = null; + } + int i = 0; + for (int count = items.Count; i < count; i++) + { + string text = items[i]; + UILabel uILabel = NGUITools.AddWidget(mChild, mBackground.depth + 2); + uILabel.name = i.ToString(); + uILabel.pivot = UIWidget.Pivot.TopLeft; + uILabel.bitmapFont = bitmapFont; + uILabel.trueTypeFont = trueTypeFont; + uILabel.fontSize = fontSize; + uILabel.fontStyle = fontStyle; + uILabel.text = (isLocalized ? Localization.Get(text) : text); + uILabel.color = textColor; + uILabel.cachedTransform.localPosition = new Vector3(border.x + padding.x - uILabel.pivotOffset.x, num5, -1f); + uILabel.overflowMethod = UILabel.Overflow.ResizeFreely; + uILabel.alignment = alignment; + list.Add(uILabel); + num5 -= num4; + num5 -= padding.y; + a = Mathf.Max(a, uILabel.printedSize.x); + UIEventListener uIEventListener = UIEventListener.Get(uILabel.gameObject); + uIEventListener.onHover = OnItemHover; + uIEventListener.onPress = OnItemPress; + uIEventListener.parameter = text; + if (mSelectedItem == text || (i == 0 && string.IsNullOrEmpty(mSelectedItem))) + { + Highlight(uILabel, instant: true); + } + mLabelList.Add(uILabel); + } + a = Mathf.Max(a, vector3.x - vector2.x - (border.x + padding.x) * 2f); + float num6 = a; + Vector3 vector4 = new Vector3(num6 * 0.5f, (0f - num4) * 0.5f, 0f); + Vector3 vector5 = new Vector3(num6, num4 + padding.y, 1f); + int j = 0; + for (int count2 = list.Count; j < count2; j++) + { + UILabel uILabel2 = list[j]; + NGUITools.AddWidgetCollider(uILabel2.gameObject); + uILabel2.autoResizeBoxCollider = false; + BoxCollider component = uILabel2.GetComponent(); + if (component != null) + { + vector4.z = component.center.z; + component.center = vector4; + component.size = vector5; + } + else + { + BoxCollider2D component2 = uILabel2.GetComponent(); + component2.offset = vector4; + component2.size = vector5; + } + } + int width = Mathf.RoundToInt(a); + a += (border.x + padding.x) * 2f; + num5 -= border.y; + mBackground.width = Mathf.RoundToInt(a); + mBackground.height = Mathf.RoundToInt(0f - num5 + border.y); + int k = 0; + for (int count3 = list.Count; k < count3; k++) + { + UILabel uILabel3 = list[k]; + uILabel3.overflowMethod = UILabel.Overflow.ShrinkContent; + uILabel3.width = width; + } + float num7 = 2f * atlas.pixelSize; + float f = a - (border.x + padding.x) * 2f + (float)atlasSprite.borderLeft * num7; + float f2 = num4 + num * num7; + mHighlight.width = Mathf.RoundToInt(f); + mHighlight.height = Mathf.RoundToInt(f2); + bool flag = position == Position.Above; + if (position == Position.Auto) + { + UICamera uICamera = UICamera.FindCameraForLayer(mSelection.layer); + if (uICamera != null) + { + flag = uICamera.cachedCamera.WorldToViewportPoint(vector).y < 0.5f; + } + } + if (isAnimated) + { + AnimateColor(mBackground); + if (Time.timeScale == 0f || Time.timeScale >= 0.1f) + { + float bottom = num5 + num4; + Animate(mHighlight, flag, bottom); + int l = 0; + for (int count4 = list.Count; l < count4; l++) + { + Animate(list[l], flag, bottom); + } + AnimateScale(mBackground, flag, bottom); + } + } + if (flag) + { + vector2.y = vector3.y - border.y; + vector3.y = vector2.y + (float)mBackground.height; + vector3.x = vector2.x + (float)mBackground.width; + transform.localPosition = new Vector3(vector2.x, vector3.y - border.y, vector2.z); + } + else + { + vector3.y = vector2.y + border.y; + vector2.y = vector3.y - (float)mBackground.height; + vector3.x = vector2.x + (float)mBackground.width; + } + Transform parent = mPanel.cachedTransform.parent; + if (parent != null) + { + vector2 = mPanel.cachedTransform.TransformPoint(vector2); + vector3 = mPanel.cachedTransform.TransformPoint(vector3); + vector2 = parent.InverseTransformPoint(vector2); + vector3 = parent.InverseTransformPoint(vector3); + } + Vector3 vector6 = (mPanel.hasClipping ? Vector3.zero : mPanel.CalculateConstrainOffset(vector2, vector3)); + vector = transform.localPosition + vector6; + vector.x = Mathf.Round(vector.x); + vector.y = Mathf.Round(vector.y); + transform.localPosition = vector; + } + else + { + OnSelect(isSelected: false); + } + } +} diff --git a/SVSim.BattleEngine/Engine/UITweenAlpha.cs b/SVSim.BattleEngine/Engine/UITweenAlpha.cs new file mode 100644 index 0000000..ea90f7a --- /dev/null +++ b/SVSim.BattleEngine/Engine/UITweenAlpha.cs @@ -0,0 +1,242 @@ +using UnityEngine; + +public class UITweenAlpha : MonoBehaviour +{ + public delegate void FinishCallBack(UITweenAlpha in_FadeObject); + + public AnimationCurve _curve; + + public bool _autoStart; + + public float _from; + + public float _to; + + public float _delayTime; + + public float _endTime; + + public bool _loop; + + public bool PingPong; + + public UITweenAlpha[] LinkTargets; + + private UIPanel _panel; + + private UIWidget _uiWidget; + + private UIRect _rect; + + private bool _isPlay; + + private bool _isEnd; + + private bool _isPlayFoward; + + private bool _initialized; + + private float _value; + + public FinishCallBack _finishCallBack { get; set; } + + public float Timer { get; set; } + + private void Awake() + { + if (!_initialized) + { + Initialize(); + } + } + + private void Initialize() + { + _initialized = true; + _panel = base.gameObject.GetComponent(); + if (_panel != null) + { + _rect = _panel; + } + else + { + _uiWidget = base.gameObject.GetComponent(); + if (_uiWidget == null && _panel == null) + { + _uiWidget = base.gameObject.AddComponent(); + } + _rect = _uiWidget; + } + if (_autoStart) + { + PlayForward(isReset: true); + } + if (LinkTargets == null) + { + return; + } + for (int i = 0; i < LinkTargets.Length; i++) + { + if (LinkTargets[i].isActiveAndEnabled) + { + Timer = LinkTargets[i].Timer; + break; + } + } + } + + private void Update() + { + if (_isPlay) + { + Timer += Time.deltaTime; + if (Timer >= _delayTime) + { + float b = (Timer - _delayTime) / (_curve.keys[_curve.length - 1].time * _endTime); + b = Mathf.Min(_curve.keys[_curve.length - 1].time, b); + if (_isPlayFoward) + { + _value = _from + (_to - _from) * _curve.Evaluate(b); + } + else + { + _value = _from + (_to - _from) * _curve.Evaluate(_curve.keys[_curve.length - 1].time - b); + } + _rect.alpha = _value; + if (b >= _curve.keys[_curve.length - 1].time) + { + if (_isPlayFoward) + { + _rect.alpha = _to; + } + else + { + _rect.alpha = _from; + } + if (PingPong) + { + Timer = 0f; + if (_isPlayFoward) + { + _isPlayFoward = false; + } + else + { + _isPlayFoward = true; + } + } + else if (!_loop) + { + _isPlay = false; + _isEnd = true; + } + else + { + Timer = 0f; + } + } + } + } + if (_isEnd) + { + if (_finishCallBack != null) + { + _finishCallBack(this); + } + _isEnd = false; + } + } + + public void Cancel(bool isFrom = false, bool isTo = false) + { + _isPlay = false; + if (isFrom) + { + _rect.alpha = _from; + } + else if (isTo) + { + _rect.alpha = _to; + } + } + + public void PlayForward(bool isReset = false) + { + if (!base.gameObject.activeSelf) + { + return; + } + if (!_initialized) + { + Initialize(); + } + if (_curve == null) + { + return; + } + _isPlayFoward = true; + if (isReset) + { + _rect.alpha = _from; + } + if (!_loop) + { + if (_rect.alpha != _to || isReset) + { + _isPlay = true; + Timer = 0f; + } + else + { + _isEnd = true; + } + } + else + { + _isPlay = true; + Timer = 0f; + } + } + + public void PlayReverse(bool isReset = false) + { + if (!base.gameObject.activeSelf || _curve == null) + { + return; + } + _isPlayFoward = false; + if (isReset) + { + _rect.alpha = _to; + } + if (!_loop) + { + if (_rect.alpha != _from || isReset) + { + _isPlay = true; + Timer = 0f; + } + else + { + _isEnd = true; + } + } + else + { + _isPlay = true; + Timer = 0f; + } + } + + public void End() + { + if (_isPlay) + { + _isPlay = false; + if (_finishCallBack != null) + { + _finishCallBack(this); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/UnionBurstCountAddModifier.cs b/SVSim.BattleEngine/Engine/UnionBurstCountAddModifier.cs new file mode 100644 index 0000000..c08e046 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UnionBurstCountAddModifier.cs @@ -0,0 +1,21 @@ +public class UnionBurstCountAddModifier : ICardUnionBurstCountModifier +{ + public readonly int UnionBurstCount; + + public bool IsClearBeforeModifier => true; + + public UnionBurstCountAddModifier(int count) + { + UnionBurstCount = count; + } + + public int CalcUnionBurstCount(int unionBurstCount) + { + return unionBurstCount += UnionBurstCount; + } + + public ICardUnionBurstCountModifier Clone() + { + return new UnionBurstCountAddModifier(UnionBurstCount); + } +} diff --git a/SVSim.BattleEngine/Engine/UnitBattleCard.cs b/SVSim.BattleEngine/Engine/UnitBattleCard.cs new file mode 100644 index 0000000..a4d7b2b --- /dev/null +++ b/SVSim.BattleEngine/Engine/UnitBattleCard.cs @@ -0,0 +1,516 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard; +using Wizard.Battle.Card; +using Wizard.Battle.Resource; +using Wizard.Battle.UI; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class UnitBattleCard : BattleCardBase +{ + public const string DRAIN_EFFECT = "btl_magic_cure_1"; + + public const string DRAIN_SE = "se_btl_magic_cure_1"; + + public const float DRAIN_WAIT_TIME = 0.3f; + + private bool _isEvolution; + + public bool _isEvolvedOnWhenLeave; + + public override bool IsUnit => true; + + public override bool IsEvolution => _isEvolution; + + public override bool IsEvolvedOnWhenLeave => _isEvolvedOnWhenLeave; + + public override bool BaseMovable => base.Movable(); + + public override bool IsCantActivateFanfare => base.SelfBattlePlayer.Class.SkillApplyInformation.IsCantActivateFanfareUnit; + + public event Func OnAfterAttack; + + public void Evolution(bool isEvolution = true) + { + _isEvolution = isEvolution; + } + + public override bool Movable(bool isCheckOnDraw = true, bool isSkipSelecting = false, CHECK_CONDITION_MUTATIONSKILL_TYPE type = CHECK_CONDITION_MUTATIONSKILL_TYPE.NONE, bool isRecording = false) + { + type = IsCheckActiveMutationSkill; + if (!base.Movable(isCheckOnDraw, isSkipSelecting, type, isRecording)) + { + return false; + } + return IsMutationMovable(type); + } + + public UnitBattleCard(BuildInfo buildInfo) + : base(buildInfo) + { + } + + public override void Setup(bool createNullView = false, bool isRecreate = false) + { + base.Setup(createNullView, isRecreate); + base.BattleCardView.SetupIconAnimations(this, base.Skills); + } + + public override VfxBase TurnStart(SkillProcessor skillProcessor) + { + VfxBase vfxBase = base.TurnStart(skillProcessor); + if (Attackable) + { + return SequentialVfxPlayer.Create(vfxBase, InstantVfx.Create(delegate + { + base.BattleCardView._inPlayFrameEffect.UpdateCanAttackEffect(); + })); + } + return vfxBase; + } + + public override VfxBase TurnEndPostProcess() + { + base.TurnEndPostProcess(); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + if (Attackable) + { + parallelVfxPlayer.Register(InstantVfx.Create(base.BattleCardView._inPlayFrameEffect.HideFrameEffect)); + } + if (GameMgr.GetIns().IsWatchBattle || GameMgr.GetIns().IsReplayBattle) + { + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + base.BattleCardView.HideAttackFinished(); + })); + } + base.AttackableCount = 0; + return parallelVfxPlayer; + } + + public override VfxBase Evolution(bool isSkill, SkillProcessor skillProcessor, SkillConditionCheckerOption option, Func getEvolveVfxFunc = null) + { + BattlePlayerPair playerInfoPair = new BattlePlayerPair(base.SelfBattlePlayer, base.OpponentBattlePlayer); + if (!CanEvolution(isSkill, isSelfBattlePlayer: true) || !IsInplay) + { + return NullVfx.GetInstance(); + } + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + base.BattleCardView._inPlayFrameEffect.SetIsSelectingAttackTarget(enable: true); + })); + sequentialVfxPlayer.Register(OnBeforeEvolveEvent(skillProcessor)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + base.BattleCardView._inPlayFrameEffect.SetIsSelectingAttackTarget(enable: false); + })); + base.SelfBattlePlayer.EvolvedCards.Add(this); + base.SelfBattlePlayer.AddCurrentEvolvePlayCount(1); + int attackableCount = base.AttackableCount; + sequentialVfxPlayer.Register(base.SkillApplyInformation.AllSkillEffectStop(isEvolve: true)); + sequentialVfxPlayer.Register(InstantVfx.Create(base.BattleCardView._inPlayFrameEffect.HideFrameEffect)); + EpSetModifier modifier = new EpSetModifier(0); + if (isSkill) + { + base.SkillApplyInformation.AddEpModifier(modifier); + } + OnEvolve(isSkill); + if (!isSkill) + { + base.SelfBattlePlayer.NowTurnEvol = false; + base.SelfBattlePlayer.IsEpEvolveThisTurn = true; + } + _isEvolution = true; + base.AttackableCount = attackableCount; + if (BattleManagerBase.GetIns().IsRecovery) + { + sequentialVfxPlayer.Register(new RecoveryEvolveVfx(this, _buildInfo.ResourceMgr)); + } + else if (getEvolveVfxFunc == null) + { + if (base.IsPlayer && GameMgr.GetIns().GetDataMgr().Is3DSkin(isPlayer: true)) + { + sequentialVfxPlayer.Register(new Class3dEvolveVfx(this, _buildInfo.ResourceMgr)); + } + else if (base.IsPlayer && GameMgr.GetIns().GetDataMgr().IsHighRankSkinPlayer()) + { + sequentialVfxPlayer.Register(new HighRankEvolveVfx(this, _buildInfo.ResourceMgr)); + } + else + { + sequentialVfxPlayer.Register(new EvolveVfx(this, _buildInfo.ResourceMgr)); + } + } + else + { + sequentialVfxPlayer.Register(getEvolveVfxFunc(this, _buildInfo.ResourceMgr)); + } + if (_evolveSkillCollection.Count() > 0) + { + if (_evolveSkillCollection.Count((SkillBase s) => !s.IsAttachedSkill) == 0) + { + for (int num = 0; num < _evolveSkillCollection.Count(); num++) + { + base.Skills.Add(_evolveSkillCollection.ElementAt(num)); + } + _evolveSkillCollection.Clear(); + } + else + { + base.Skills = _evolveSkillCollection; + } + base.Skills.Complete(); + if (!isSkill) + { + skillProcessor.Register(base.Skills.CreateWhenEvolveInfo(skillProcessor, playerInfoPair, option)); + } + sequentialVfxPlayer.Register(base.Skills.RegisterAndProcessWhenChangeInplayImmediateInfo(playerInfoPair)); + base.Skills.CreateAndRegisterWhenChangeInplayInfo(new List { this }, skillProcessor, playerInfoPair); + foreach (SkillBase attachedSkill in base.SkillApplyInformation.AttachedSkillsInfo.AttachedSkills) + { + if (!base.Skills.Contains(attachedSkill)) + { + base.Skills.Add(attachedSkill); + } + } + base.Skills.Complete(); + if (_evolveSkillCollection._skillTimingInfo.IsWhenDestroy) + { + base.BuffInfoList.RemoveAll((BuffInfo b) => b.SkillFrom is Skill_rob_skill && b.SkillFrom.SkillPrm.ownerCard != this); + } + } + if (base.IsSelfTurn) + { + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + base.BattleCardView._inPlayFrameEffect.UpdateCanAttackEffect(); + })); + } + sequentialVfxPlayer.Register(base.SkillApplyInformation.AllSkillEffectRestart()); + if (isSkill) + { + base.SkillApplyInformation.RemoveEpModifier(modifier); + } + sequentialVfxPlayer.Register(base.BattleCardView.InitializeBattleCardIcon(this, base.Skills)); + if (!isSkill) + { + List list = base.SelfBattlePlayer.HandCardList.Where((BattleCardBase c) => c.Skills.Any((SkillBase s) => s.OnWhenEvolveOtherStart != 0 || s.OnWhenEvolveSelfAndOtherStart != 0 || s.OnWhenUseEpSelfAndOtherStart != 0)).ToList(); + list.AddRange(base.OpponentBattlePlayer.HandCardList.Where((BattleCardBase c) => c.Skills.Any((SkillBase s) => s.OnWhenEvolveOtherStart != 0 || s.OnWhenEvolveSelfAndOtherStart != 0 || s.OnWhenUseEpSelfAndOtherStart != 0))); + list.AddRange(base.SelfBattlePlayer.ClassAndInPlayCardList.Where((BattleCardBase c) => c.Skills.Any((SkillBase s) => s.OnWhenEvolveOtherStart != 0 || s.OnWhenEvolveSelfAndOtherStart != 0 || s.OnWhenUseEpSelfAndOtherStart != 0))); + list.AddRange(base.OpponentBattlePlayer.ClassAndInPlayCardList.Where((BattleCardBase c) => c.Skills.Any((SkillBase s) => s.OnWhenEvolveOtherStart != 0 || s.OnWhenEvolveSelfAndOtherStart != 0 || s.OnWhenUseEpSelfAndOtherStart != 0))); + List list2 = new List(); + list2.Add(this); + for (int num2 = 0; num2 < list.Count; num2++) + { + if (list[num2] != this && list[num2].Skills.Any((SkillBase s) => s.OnWhenEvolveOtherStart != 0)) + { + skillProcessor.Register(list[num2].Skills.CreateWhenEvolveOtherInfo(list2, skillProcessor, new BattlePlayerReadOnlyInfoPair(list[num2].SelfBattlePlayer, list[num2].OpponentBattlePlayer))); + } + if (list[num2] != this && list[num2].Skills.Any((SkillBase s) => s.OnWhenUseEpSelfAndOtherStart != 0)) + { + if (base.SelfBattlePlayer.CheckNotConsumeEpCard(this)) + { + continue; + } + skillProcessor.Register(list[num2].Skills.CreateWhenUseEpSelfAndOtherInfo(skillProcessor, new BattlePlayerReadOnlyInfoPair(list[num2].SelfBattlePlayer, list[num2].OpponentBattlePlayer))); + } + if (list[num2].Skills.Any((SkillBase s) => s.OnWhenEvolveSelfAndOtherStart != 0)) + { + skillProcessor.Register(list[num2].Skills.CreateWhenEvolveSelfAndOtherInfo(list2, skillProcessor, new BattlePlayerReadOnlyInfoPair(list[num2].SelfBattlePlayer, list[num2].OpponentBattlePlayer))); + } + } + } + return sequentialVfxPlayer; + } + + public override VfxBase SetUpInplay() + { + _isEvolution = false; + _isEvolvedOnWhenLeave = false; + return base.SetUpInplay(); + } + + public override VfxBase Banish(SkillProcessor skillProcessor, bool isReturn = false) + { + if (isReturn) + { + _isEvolvedOnWhenLeave = _isEvolution; + _isEvolution = false; + } + return base.Banish(skillProcessor, isReturn); + } + + public override VfxBase ReturnCard(SkillProcessor skillProcessor) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (Attackable) + { + sequentialVfxPlayer.Register(InstantVfx.Create(base.BattleCardView._inPlayFrameEffect.HideFrameEffect)); + } + sequentialVfxPlayer.Register(base.SkillApplyInformation.AllSkillEffectStop(isEvolve: false, isReturn: true)); + InitializeParameterOnWhenReturn(); + VfxBase vfx = base.ReturnCard(skillProcessor); + sequentialVfxPlayer.Register(vfx); + return sequentialVfxPlayer; + } + + public override void InitializeParameterOnWhenReturn() + { + base.IsFirstTurn = false; + base.IsSummonDrunkenness = true; + base.AttackableCount = 0; + _isEvolvedOnWhenLeave = _isEvolution; + _isEvolution = false; + base.InitializeParameterOnWhenReturn(); + } + + protected override VfxBase StartPlayCard() + { + base.StartPlayCard(); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + base.SelfBattlePlayer.HandCardToField(this); + base.BattleCardView.ResetTemplate(); + sequentialVfxPlayer.Register(base.VfxCreator.CreatePick()); + return sequentialVfxPlayer; + } + + public override VfxBase StartAttack(BattleCardBase underAttackCard, BattlePlayerPair battlePlayerPair) + { + return ExecuteAttackSequence(underAttackCard, battlePlayerPair); + } + + private VfxBase ExecuteAttackSequence(BattleCardBase targetCard, BattlePlayerPair battlePlayerPair) + { + SkillProcessor skillProcessor = new SkillProcessor(); + DamageParam damageCalculationAtkTypeAttack = base.DamageCalculationAtkTypeAttack; + DamageParam damageCalculationAtkTypeBeAttacked = targetCard.DamageCalculationAtkTypeBeAttacked; + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + SequentialVfxPlayer sequentialVfxPlayer2 = SequentialVfxPlayer.Create(); + AttackOpponentResult attackOpponentResult = AttackOpponent(targetCard, damageCalculationAtkTypeAttack, skillProcessor, IsChallenge: true); + if (base.SkillApplyInformation.IsDrain) + { + sequentialVfxPlayer2.Register(WaitVfx.Create(0.3f)); + sequentialVfxPlayer2.Register(ApplyDrain(damageCalculationAtkTypeAttack, skillProcessor, attackOpponentResult.damageResult)); + } + AttackOpponentResult attackOpponentResult2 = targetCard.AttackOpponent(this, damageCalculationAtkTypeBeAttacked, skillProcessor, IsChallenge: false); + SequentialVfxPlayer sequentialVfxPlayer3 = SequentialVfxPlayer.Create(attackOpponentResult.attackVfx, attackOpponentResult.damageVfx); + SequentialVfxPlayer sequentialVfxPlayer4 = SequentialVfxPlayer.Create(WaitVfx.Create(0.4f), attackOpponentResult2.attackVfx); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(attackOpponentResult2.damageVfx); + if (base.SkillApplyInformation.IsDrain) + { + parallelVfxPlayer.Register(sequentialVfxPlayer2); + } + sequentialVfxPlayer4.Register(parallelVfxPlayer); + sequentialVfxPlayer.Register(ParallelVfxPlayer.Create(sequentialVfxPlayer3, sequentialVfxPlayer4)); + ParallelVfxPlayer parallelVfxPlayer2 = ParallelVfxPlayer.Create(); + ParallelVfxPlayer parallelVfxPlayer3 = ParallelVfxPlayer.Create(); + AttackSelectControl attackSelectControl = base.SelfBattlePlayer.BattleView.AttackSelectControl; + if (IsDead) + { + parallelVfxPlayer3.Register(base.SelfBattlePlayer.CardManagement(this, skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.DESTROY, isRandom: false)); + if (!targetCard.IsDead) + { + base.BattleCardView.playVoiceOnDeath = true; + base.BattleCardView.VoiceInfo.SetDestroyCardId(targetCard.BaseParameter.BaseCardId); + } + } + else + { + parallelVfxPlayer2.Register(attackSelectControl.ResetCardAfterAttack(base.BattleCardView)); + } + if (targetCard.IsDead) + { + parallelVfxPlayer3.Register(targetCard.SelfBattlePlayer.CardManagement(targetCard, skillProcessor, BattlePlayerBase.CARD_MANAGEMENT.DESTROY, isRandom: false)); + targetCard.BattleCardView.playVoiceOnDeath = true; + targetCard.BattleCardView.VoiceInfo.SetDestroyCardId(base.BaseParameter.BaseCardId); + } + else + { + parallelVfxPlayer2.Register(attackSelectControl.ResetCardAfterAttack(targetCard.BattleCardView)); + } + SequentialVfxPlayer sequentialVfxPlayer5 = SequentialVfxPlayer.Create(); + sequentialVfxPlayer5.Register(parallelVfxPlayer2); + sequentialVfxPlayer5.Register(parallelVfxPlayer3); + sequentialVfxPlayer.Register(sequentialVfxPlayer5); + if (!base.SelfBattlePlayer.BattleMgr.IsVirtualBattle) + { + BattleLogManager.GetInstance().AddLogWar(this, targetCard); + } + VfxBase vfx = skillProcessor.Process(new BattlePlayerPair(base.SelfBattlePlayer, base.OpponentBattlePlayer)); + sequentialVfxPlayer.Register(vfx); + sequentialVfxPlayer.Register(this.OnAfterAttack.GetAllFuncVfxResults()); + return sequentialVfxPlayer; + } + + public override AttackOpponentResult AttackOpponent(BattleCardBase target, DamageParam damageParam, SkillProcessor skillProcessor, bool IsChallenge) + { + VfxBase vfx = base.VfxCreator.CreateAttack(base.BattleCardView, target.BattleCardView); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + DamageResult damageResult = target.ApplyDamage(null, damageParam, base.SkillApplyInformation.IsKiller, isReflectedDamage: false, skillProcessor, null); + BattleManagerBase ins = BattleManagerBase.GetIns(); + base.SelfBattlePlayer.Class.SkillApplyInformation.CausedDamageLife(damageResult.DamageApplied, ins.CurrentTurn, ins.BattlePlayer.IsSelfTurn); + sequentialVfxPlayer.Register(damageResult.Vfx); + SequentialVfxPlayer sequentialVfxPlayer2 = SequentialVfxPlayer.Create(); + if (IsChallenge) + { + base.AttackableCount--; + if (base.SkillApplyInformation.IsSneak) + { + sequentialVfxPlayer2.Register(AfterAddDamage()); + } + } + sequentialVfxPlayer2.Register(vfx); + return new AttackOpponentResult(sequentialVfxPlayer2, sequentialVfxPlayer, damageResult); + } + + protected VfxBase ApplyDrain(DamageParam damageParam, SkillProcessor skillProcessor, DamageResult damageResult) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattleCardBase beforeHealCard = base.SelfBattlePlayer.Class.VirtualClone(base.SelfBattlePlayer.Class.SelfBattlePlayer, base.SelfBattlePlayer.Class.OpponentBattlePlayer); + HealParam healParam = new HealParam(damageResult.GainLife, this, base.SelfBattlePlayer.Class); + HealResult healResult = base.SelfBattlePlayer.Class.ApplyHealing(healParam, skillProcessor); + SequentialVfxPlayer sequentialVfxPlayer2 = SequentialVfxPlayer.Create(healResult.HealVfx, healResult.PrehealVfxVfx, healResult.PosthealVfxVfx); + skillProcessor.Register(base.SelfBattlePlayer.Class.Skills.CreateWhenHealing(base.SelfBattlePlayer.Class, skillProcessor, new BattlePlayerReadOnlyInfoPair(base.SelfBattlePlayer, base.OpponentBattlePlayer), healResult.HealAmount)); + sequentialVfxPlayer2.Register(base.SelfBattlePlayer.StartSkillWhenHealingSelfAndOther(new List { base.SelfBattlePlayer.Class }, skillProcessor, new List { healResult.HealAmount })); + base.SelfBattlePlayer.CallOnDrain(healResult.HealAmount); + if (base.SelfBattlePlayer.Class.BattleCardView.CardWrapObject != null) + { + EffectBattle effectBattle = null; + Vector3 effectPosition = base.SelfBattlePlayer.Class.BattleCardView.CardWrapObject.transform.position; + sequentialVfxPlayer.Register(new SkillBase.WaitEffectLoadVfx("btl_magic_cure_1", EffectMgr.EngineType.SHURIKEN, "se_btl_magic_cure_1", BattleManagerBase.GetIns().BattleResourceMgr, delegate(EffectBattle eb) + { + effectBattle = eb; + })); + DelaySetupVfx vfx = new DelaySetupVfx(() => new SkillEffectBattleVfx(effectBattle, base.SelfBattlePlayer.Class.BattleCardView, BattleManagerBase.GetIns().BattleResourceMgr, () => effectPosition, () => effectPosition, 0f, 0.2f, EffectMgr.MoveType.NONE, base.SelfBattlePlayer.Class.SelfBattlePlayer.IsPlayer, Color.clear)); + sequentialVfxPlayer2.Register(vfx); + } + sequentialVfxPlayer.Register(sequentialVfxPlayer2); + if (!base.SelfBattlePlayer.BattleMgr.IsVirtualBattle) + { + BattleLogManager.GetInstance().AddLogHeal(beforeHealCard, healResult.HealAmount); + } + return sequentialVfxPlayer; + } + + public override DamageResult ApplyDamage(SkillBase skill, DamageParam damageParam, bool doesAttackerPossessKiller, bool isReflectedDamage, SkillProcessor skillProcessor, BattleCardBase reflectCard) + { + int damage = damageParam.Damage; + bool isSkillDamage = skill != null; + bool isSpellDamage = skill?.SkillPrm.ownerCard.IsSpell ?? false; + BattleCardBase damageReflectionTarget = GetDamageReflectionTarget(isSkillDamage); + if (damageReflectionTarget != this) + { + return damageReflectionTarget.ApplyDamage(skill, damageParam, doesAttackerPossessKiller: false, isReflectedDamage: true, skillProcessor, this); + } + damageParam.Damage = CalculateFinalDamageAmount(damageParam.Damage, isSkillDamage, isSpellDamage); + new SkillConditionCheckerOption().DefaultDamage = new DamageInfo(skill, damage); + BattleManagerBase ins = BattleManagerBase.GetIns(); + base.SkillApplyInformation.DamageLife(damageParam.Damage, ins.CurrentTurn, ins.BattlePlayer.IsSelfTurn); + if (doesAttackerPossessKiller && !base.SkillApplyInformation.IsIndependent && !base.SkillApplyInformation.IsIndestructible) + { + FlagCardAsDestroyedByKiller(); + } + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(base.VfxCreator.CreateDamage(damageParam.Damage, base.Life, base.MaxLife, BaseMaxLife, isReflectedDamage, isSkillDamage)); + skillProcessor.Register(base.Skills.CreateWhenDamageInfo(skill, skillProcessor, new BattlePlayerReadOnlyInfoPair(base.SelfBattlePlayer, base.OpponentBattlePlayer), damage, damageParam.Damage)); + sequentialVfxPlayer.Register(base.ApplyDamage(skill, damageParam, doesAttackerPossessKiller, isReflectedDamage, skillProcessor, reflectCard).Vfx); + return new DamageResult(sequentialVfxPlayer, damageParam.Damage, damageParam.Damage, null, null, isReflectedDamage); + } + + public override HealResult ApplyHealing(HealParam healParam, SkillProcessor skillProcessor) + { + BattleManagerBase ins = BattleManagerBase.GetIns(); + int num = HealLife(healParam.HealAmount, ins.CurrentTurn, ins.BattlePlayer.IsSelfTurn); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(base.VfxCreator.CreateHealing(num, base.Life, base.MaxLife, BaseMaxLife)); + new SkillConditionCheckerOption().HealingCardAndValue = new List + { + new BattlePlayerBase.CardAndValue(this, num) + }; + return new HealResult(num, sequentialVfxPlayer); + } + + public override VfxBase RemoveFromInPlay() + { + VfxBase result = base.RemoveFromInPlay(); + if (this != null && !IsDead) + { + base.SkillApplyInformation.ClearParameterModifier(); + } + return result; + } + + protected override ICardVfxCreator CreateVfxCreator(bool isPlayer, IBattleCardView battleCardView, bool isNullView) + { + if (isNullView) + { + return NullCardVfxCreator.GetInstance(); + } + return new UnitCardVfxCreator(isPlayer, this, battleCardView, _buildInfo.ResourceMgr); + } + + protected override ISkillApplyInformation CreateSkillApplyInformation(BattleCardBase card, ICardVfxCreator vfxCreator) + { + return new UnitSkillApplyInformation(card, vfxCreator); + } + + protected override IBattleCardView CreateView(BattleCardView.BuildInfo buildInfo, bool isNullView) + { + if (isNullView) + { + return new NullBattleCardView(buildInfo); + } + return new UnitBattleCardView(buildInfo); + } + + public override string GetCardSkillDescription(BattlePlayerBase.SideLogInfo sideLogInfo, bool? isForceGetEvolveText = null) + { + bool flag = IsEvolution; + if (isForceGetEvolveText.HasValue) + { + flag = isForceGetEvolveText.Value; + } + if (!flag) + { + return SkillDescription(sideLogInfo); + } + return EvoSkillDescription(sideLogInfo); + } + + public override VfxBase RecoveryInPlay(int inPlayIndex, bool newReplayMoveTurn = false) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(base.RecoveryInPlay(inPlayIndex, newReplayMoveTurn)); + if (IsEvolution) + { + sequentialVfxPlayer.Register(new EvolveImageChangeVfx(this, _buildInfo.ResourceMgr)); + if (base.IsChoiceEvolutionCard) + { + sequentialVfxPlayer.Register(new EvolveNameChangeVfx(this)); + } + sequentialVfxPlayer.Register(new EvolveUnitMaskCardInPlayVfx(base.BattleCardView)); + } + sequentialVfxPlayer.Register(new RefreshAttackVfx(base.BattleCardView, base.Atk, base.BaseAtk, forceUpdate: true, newReplayMoveTurn)); + sequentialVfxPlayer.Register(new RefreshHealthVfx(base.BattleCardView, base.Life, base.MaxLife, BaseMaxLife, newReplayMoveTurn)); + if (Attackable && base.IsSelfTurn) + { + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + base.BattleCardView._inPlayFrameEffect.UpdateCanAttackEffect(); + })); + } + return sequentialVfxPlayer; + } + + public override BattleCardBase VirtualClone(BattlePlayerBase selfBattlePlayer, BattlePlayerBase opponentBattlePlayer) + { + VirtualUnitBattleCard virtualUnitBattleCard = new VirtualUnitBattleCard(_buildInfo.VirtualClone(selfBattlePlayer, opponentBattlePlayer)); + virtualUnitBattleCard._isEvolution = IsEvolution; + CopyToVirtualCardBase(virtualUnitBattleCard); + return virtualUnitBattleCard; + } +} diff --git a/SVSim.BattleEngine/Engine/User.cs b/SVSim.BattleEngine/Engine/User.cs new file mode 100644 index 0000000..312da15 --- /dev/null +++ b/SVSim.BattleEngine/Engine/User.cs @@ -0,0 +1,8 @@ +using System; + +public class User : HeaderData +{ + public DateTime ConnectTimeForMasterReset { get; set; } + + public float ConnectSinceStartUp { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/UserCard.cs b/SVSim.BattleEngine/Engine/UserCard.cs new file mode 100644 index 0000000..7b6207e --- /dev/null +++ b/SVSim.BattleEngine/Engine/UserCard.cs @@ -0,0 +1,16 @@ +public class UserCard : HeaderData +{ + public int card_id; + + public int number; + + public string last_got_time; + + public string create_time; + + public string update_time; + + public string delete_time; + + public string affected_rows; +} diff --git a/SVSim.BattleEngine/Engine/UserConfig.cs b/SVSim.BattleEngine/Engine/UserConfig.cs new file mode 100644 index 0000000..f4b046f --- /dev/null +++ b/SVSim.BattleEngine/Engine/UserConfig.cs @@ -0,0 +1,50 @@ +using Cute; +using LitJson; +using Wizard; + +public class UserConfig : HeaderData +{ + public string create_time; + + public string update_time; + + public string delete_time; + + public string affected_rows; + + public bool ReceivedInvite { get; set; } + + public bool ReceivedInviteInBattle { get; set; } + + public bool ReceivedInviteInOffline { get; set; } + + public bool ReceivedFriendApply { get; set; } + + public bool ArrowAdjustSend { get; private set; } + + public bool IsFoilPreferred { get; set; } + + public bool IsPrizePreferred { get; set; } + + public void SetArrowAdjustSend(bool arrow) + { + ArrowAdjustSend = arrow; + int num = (arrow ? 1 : 0); + if (Toolbox.SavedataManager.GetInt("ADJUST_ON", 1) != num) + { + Toolbox.SavedataManager.SetInt("ADJUST_ON", num); + WizardFirebase.OnChangeDataUseEnable(); + } + } + + public void Parse(JsonData data) + { + ReceivedInvite = data["receive_invitation"].ToInt() == 1; + ReceivedInviteInBattle = data["receive_invitation_in_battle"].ToInt() == 1; + ReceivedInviteInOffline = data["receive_invitation_in_offline"].ToInt() == 1; + ReceivedFriendApply = data["receive_friend_apply"].ToInt() == 1; + SetArrowAdjustSend(data["is_allow_send_adjust"].ToInt() == 1); + IsFoilPreferred = data["is_foil_preferred"].ToInt() == 1; + IsPrizePreferred = data["is_prize_preferred"].ToInt() == 1; + } +} diff --git a/SVSim.BattleEngine/Engine/UserCrystalCount.cs b/SVSim.BattleEngine/Engine/UserCrystalCount.cs new file mode 100644 index 0000000..dc5062e --- /dev/null +++ b/SVSim.BattleEngine/Engine/UserCrystalCount.cs @@ -0,0 +1,92 @@ +using System.Collections.Generic; +using LitJson; +using Wizard; + +public class UserCrystalCount : HeaderData +{ + private const string ORB_KEY = "orb"; + + public int total_crystal; + + public int free_crystal; + + public int charge_crystal; + + public int red_ether; + + public int rupy; + + public int _spotcardPoint; + + public string create_time; + + public string update_time; + + public string delete_time; + + public string affected_rows; + + public int last_payment_date; + + public string _lastPaymentId; + + public int _lastPaymentItemBuyNumber; + + public List SpecialCrystalInfo { get; private set; } + + public bool EnableSpecialCrystal => SpecialCrystalInfo.Count > 0; + + public bool NeedNewIcon + { + get + { + foreach (SpecialCrystalInfo item in SpecialCrystalInfo) + { + if (item.AvailablePurchaseCount > 0) + { + return true; + } + } + return false; + } + } + + public RemainTime GetCloseTimeLimit() + { + int num = int.MaxValue; + RemainTime result = null; + foreach (SpecialCrystalInfo item in SpecialCrystalInfo) + { + if (item.RemainTime.Second < num) + { + num = item.RemainTime.Second; + result = item.RemainTime; + } + } + return result; + } + + public void SetUserCrystalCount(JsonData data) + { + total_crystal = data["total_crystal"].ToInt(); + free_crystal = data["free_crystal"].ToInt(); + charge_crystal = data["crystal"].ToInt(); + red_ether = data["red_ether"].ToInt(); + rupy = data["rupy"].ToInt(); + } + + public void ParseSpecialCrystal(JsonData responseData) + { + SpecialCrystalInfo = new List(); + JsonData jsonData = responseData["data"]; + if (jsonData.Keys.Contains("special_crystal_info")) + { + JsonData jsonData2 = jsonData["special_crystal_info"]; + for (int i = 0; i < jsonData2.Count; i++) + { + SpecialCrystalInfo item = new SpecialCrystalInfo(jsonData2[i], responseData); + SpecialCrystalInfo.Add(item); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/UserDegree.cs b/SVSim.BattleEngine/Engine/UserDegree.cs new file mode 100644 index 0000000..0fd5b1a --- /dev/null +++ b/SVSim.BattleEngine/Engine/UserDegree.cs @@ -0,0 +1,14 @@ +public class UserDegree : HeaderData +{ + public int degree_id; + + public int is_get; + + public string create_time; + + public string update_time; + + public string delete_time; + + public string affected_rows; +} diff --git a/SVSim.BattleEngine/Engine/UserEmblem.cs b/SVSim.BattleEngine/Engine/UserEmblem.cs new file mode 100644 index 0000000..15f7284 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UserEmblem.cs @@ -0,0 +1,14 @@ +public class UserEmblem : HeaderData +{ + public int emblem_id; + + public int is_get; + + public string create_time; + + public string update_time; + + public string delete_time; + + public string affected_rows; +} diff --git a/SVSim.BattleEngine/Engine/UserFriend.cs b/SVSim.BattleEngine/Engine/UserFriend.cs new file mode 100644 index 0000000..10653d2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UserFriend.cs @@ -0,0 +1,38 @@ +using LitJson; + +public class UserFriend : HeaderData +{ + public int viewerId; + + public string name; + + public string countryCode; + + public int rank; + + public long emblemId; + + public int degreeId; + + public bool IsFriend { get; private set; } + + public bool IsSameGuildMember { get; private set; } + + public UserFriend(JsonData data) + { + viewerId = data["viewer_id"].ToInt(); + name = data["name"].ToString(); + countryCode = data["country_code"].ToString(); + rank = data["rank"].ToInt(); + emblemId = data["emblem_id"].ToLong(); + degreeId = data["degree_id"].ToInt(); + if (data.Keys.Contains("is_friend")) + { + IsFriend = data["is_friend"].ToBoolean(); + } + if (data.Keys.Contains("is_guild_member")) + { + IsSameGuildMember = data["is_guild_member"].ToBoolean(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/UserInfo.cs b/SVSim.BattleEngine/Engine/UserInfo.cs new file mode 100644 index 0000000..f9c1843 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UserInfo.cs @@ -0,0 +1,12 @@ +public class UserInfo : HeaderData +{ + public string name; + + public long selected_emblem_id; + + public int selected_degree_id; + + public string country_code; + + public string birth_day; +} diff --git a/SVSim.BattleEngine/Engine/UserPromotionMatch.cs b/SVSim.BattleEngine/Engine/UserPromotionMatch.cs new file mode 100644 index 0000000..9b087e4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UserPromotionMatch.cs @@ -0,0 +1,20 @@ +public class UserPromotionMatch : HeaderData +{ + public int match_count; + + public int battle_result; + + public int win; + + public int lose; + + public bool is_promotion; + + public string create_time; + + public string update_time; + + public string delete_time; + + public string affected_rows; +} diff --git a/SVSim.BattleEngine/Engine/UserRank.cs b/SVSim.BattleEngine/Engine/UserRank.cs new file mode 100644 index 0000000..6bdc7f5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UserRank.cs @@ -0,0 +1,78 @@ +using LitJson; +using Wizard; + +public class UserRank : HeaderData +{ + public class GrandMasterData + { + public int[] id = new int[3]; + + public int[] periodNum = new int[3]; + + public int[] masterPoint = new int[3]; + + public int[] rankId = new int[3]; + + public int targetMasterPoint; + + public int currentMasterPoint; + } + + public const int GRAND_MASTER_PERIOD = 3; + + public const int MASTER_RANK_INDEX = 24; + + public int rank; + + public int battle_point; + + public int master_point; + + public int successive_win_number; + + public bool is_master_rank; + + public bool is_grand_master_rank; + + public GrandMasterData grandMasterData = new GrandMasterData(); + + public UserPromotionMatch user_promotion_match = new UserPromotionMatch(); + + public static bool IsGrandMasterAvailability { get; set; } + + public void Initialize(JsonData userRank, Format format) + { + rank = userRank["rank"].ToInt(); + battle_point = userRank["battle_point"].ToInt(); + master_point = userRank["master_point"].ToInt(); + successive_win_number = userRank["successive_win_number"].ToInt(); + is_master_rank = userRank["is_master_rank"].ToInt() != 0; + is_grand_master_rank = userRank.GetValueOrDefault("is_grand_master_rank", 0) != 0; + user_promotion_match.is_promotion = userRank["is_promotion"].ToInt() != 0; + if (user_promotion_match.is_promotion) + { + user_promotion_match.match_count = userRank["user_promotion_match"]["match_count"].ToInt(); + user_promotion_match.battle_result = userRank["user_promotion_match"]["battle_result"].ToInt(); + user_promotion_match.win = userRank["user_promotion_match"]["win"].ToInt(); + user_promotion_match.lose = userRank["user_promotion_match"]["lose"].ToInt(); + } + if (is_master_rank && format != Format.Crossover) + { + IsGrandMasterAvailability = false; + if (userRank.Keys.Contains("target_grand_master_point")) + { + grandMasterData.targetMasterPoint = userRank["target_grand_master_point"].ToInt(); + IsGrandMasterAvailability = true; + } + if (userRank.Keys.Contains("current_grand_master_point")) + { + grandMasterData.currentMasterPoint = userRank["current_grand_master_point"].ToInt(); + IsGrandMasterAvailability = true; + } + } + if (is_master_rank && format == Format.Crossover) + { + grandMasterData.currentMasterPoint = master_point; + } + } +} diff --git a/SVSim.BattleEngine/Engine/UserTutorial.cs b/SVSim.BattleEngine/Engine/UserTutorial.cs new file mode 100644 index 0000000..0bb289a --- /dev/null +++ b/SVSim.BattleEngine/Engine/UserTutorial.cs @@ -0,0 +1,66 @@ +using LitJson; +using Wizard; + +public class UserTutorial : HeaderData +{ + public const int TUTORIAL_STEP0 = 1; + + public const int TUTORIAL_STEP1 = 11; + + public const int TUTORIAL_STEP2 = 21; + + public const int TUTORIAL_STEP_RECEIVE_GIFT = 31; + + public const int TUTORIAL_STEP_BUY_CARD_PACK = 41; + + public const int TUTORIAL_END = 100; + + public int tutorial_step; + + public int tutorial_replay_step; + + public string create_time; + + public string update_time; + + public string delete_time; + + public string affected_rows; + + public const int PRE_TUTORIAL_STEP = 0; + + public const int ENTER_USER_ID_ACTION_NUMBER = 1; + + public const int CLEARED_PROLOGUE_ACTION_NUMBER = 2; + + public bool NeedAllResource => tutorial_step >= 31; + + public int TutorialStep + { + get + { + if ((tutorial_step == 31 || tutorial_step == 41) && Data.MaintenanceCodeList != null) + { + bool num = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GIFT_MAINTENANCE); + bool flag = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.SHOP_CARDPACK_MAINTENANCE); + if (num || flag) + { + tutorial_step = 100; + } + } + return tutorial_step; + } + set + { + tutorial_step = value; + } + } + + public void Update(JsonData data) + { + if (data.Keys.Contains("tutorial_step")) + { + tutorial_step = data["tutorial_step"].ToInt(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/UtilityDrumrollScroll.cs b/SVSim.BattleEngine/Engine/UtilityDrumrollScroll.cs new file mode 100644 index 0000000..2054aca --- /dev/null +++ b/SVSim.BattleEngine/Engine/UtilityDrumrollScroll.cs @@ -0,0 +1,162 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +public class UtilityDrumrollScroll : MonoBehaviour +{ + [SerializeField] + private UIScrollView _scrollView; + + [SerializeField] + private UIGrid _gridItemList; + + [SerializeField] + private UICenterOnChild _centerOnChild; + + [SerializeField] + private GameObject _itemOriginal; + + private List _itemList = new List(); + + private bool _isDrag; + + private Action _selectCallBack; + + [SerializeField] + private UIButton _upButton; + + [SerializeField] + private UIButton _downButton; + + [SerializeField] + private UIPanel _panel; + + public int CurrentIndex { get; private set; } + + public IEnumerator CreateDrumrollScroll_Coroutine(List textList, int defaultIndex, Action selectCallback, Action callBack = null) + { + if (_panel != null) + { + _panel.alpha = 0f; + } + _InitList(); + CurrentIndex = defaultIndex; + _selectCallBack = selectCallback; + for (int i = 0; i < textList.Count; i++) + { + _AddList(i, textList[i]); + UIEventListener uIEventListener = UIEventListener.Get(_itemList[i]); + uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate(GameObject g) + { + _OnChangeScroll(g); + }); + } + yield return null; + _centerOnChild.onCenter = null; + float springStrength = _centerOnChild.springStrength; + _centerOnChild.springStrength = 100f; + _centerOnChild.CenterOn(_itemList[defaultIndex].transform); + _centerOnChild.springStrength = springStrength; + _centerOnChild.onCenter = delegate(GameObject g) + { + _isDrag = true; + _OnChangeScroll(g); + }; + if (_itemList.Count <= 1) + { + _scrollView.enabled = false; + } + if (_upButton != null) + { + _upButton.onClick.Add(new EventDelegate(delegate + { + OnClickUpButton(); + })); + } + if (_downButton != null) + { + _downButton.onClick.Add(new EventDelegate(delegate + { + OnClickDownButton(); + })); + } + callBack.Call(); + yield return null; + if (_panel != null) + { + _panel.alpha = 1f; + } + } + + private void OnClickUpButton() + { + if (CurrentIndex > 0) + { + _centerOnChild.CenterOn(_itemList[CurrentIndex - 1].transform); + } + } + + private void OnClickDownButton() + { + if (CurrentIndex < _itemList.Count - 1) + { + _centerOnChild.CenterOn(_itemList[CurrentIndex + 1].transform); + } + } + + private void _InitList() + { + if (_itemList.Count > 0) + { + foreach (GameObject item in _itemList) + { + UnityEngine.Object.Destroy(item.gameObject); + } + } + _itemList.Clear(); + _itemOriginal.gameObject.SetActive(value: false); + } + + private void _AddList(int index, string text, bool isNew = false) + { + GameObject gameObject = UnityEngine.Object.Instantiate(_itemOriginal.gameObject); + gameObject.transform.parent = _gridItemList.transform; + gameObject.transform.localScale = _itemOriginal.transform.localScale; + gameObject.name = index.ToString(); + gameObject.gameObject.SetActive(value: true); + UtilityDrumrollItem utilityDrumrollItem = gameObject.GetComponent(); + if (utilityDrumrollItem == null) + { + utilityDrumrollItem = gameObject.AddComponent(); + } + utilityDrumrollItem.Init(_scrollView.GetComponent(), index, text); + if (utilityDrumrollItem.CustomizeItem != null) + { + utilityDrumrollItem.CustomizeItem.OnInitialize(index); + } + _itemList.Add(gameObject); + _gridItemList.repositionNow = true; + _scrollView.ResetPosition(); + } + + private void _OnChangeScroll(GameObject g) + { + int index = g.GetComponent()._index; + if (CurrentIndex != index) + { + CurrentIndex = index; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + if (!_isDrag) + { + _centerOnChild.CenterOn(g.transform); + } + else + { + _isDrag = false; + } + _selectCallBack.Call(CurrentIndex); + } + } +} diff --git a/SVSim.BattleEngine/Engine/VellsarDesertField.cs b/SVSim.BattleEngine/Engine/VellsarDesertField.cs new file mode 100644 index 0000000..013224e --- /dev/null +++ b/SVSim.BattleEngine/Engine/VellsarDesertField.cs @@ -0,0 +1,84 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class VellsarDesertField : BackGroundBase +{ + public override int FieldId => 43; + + public VellsarDesertField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_0043_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles43").gameObject; + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + _fieldParticleSystemDictionary.Add("start", _fieldParticles.transform.Find("start").GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_43, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_43_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["start"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(-2810f, 1044f, 51f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(20.5f, 73f, -96f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-218f, 123f, -36.3f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(18.5f, 95f, -88f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _gimicCntDictionary[obj.tag]++; + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(3f); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/VideoHostingUtil.cs b/SVSim.BattleEngine/Engine/VideoHostingUtil.cs new file mode 100644 index 0000000..645e915 --- /dev/null +++ b/SVSim.BattleEngine/Engine/VideoHostingUtil.cs @@ -0,0 +1,790 @@ +using System; +using System.Collections; +using UnityEngine; +using Wizard; + +public class VideoHostingUtil : SingletonMonoBehaviour +{ + public enum Option + { + EnemyNameDisplay, + RecordPauseInMenu, + UseRecordingFaceCamera, + UseRecordingMicrophone, + UsePublishingFaceCamera, + UsePublishingMicrophone, + NicoNicoNotificationAgreement, + AutoPauseRecording, + AutoPausePublishing, + AutoStopRecording, + IsPublishing, + IsRecording, + Max + } + + public enum HUDScene + { + Title = 0, + Home = 1, + Battle = 2, + BattleResult = 3, + RoomMatchRobby = 4, + Default = 1 + } + + private enum RecordingAutoStopStatus + { + Null, + Active, + Pause + } + + public const int FACECAMERAWINDOW_WIDTH_DEFAULT = 72; + + public const int FACECAMERAWINDOW_HEIGHT_DEFAULT = 72; + + public const float FACECAMERAWINDOW_WIDTH_MIN = 72f; + + public const float FACECAMERAWINDOW_WIDTH_MAX = 400f; + + public const float FACECAMERAWINDOW_HEIGHT_MIN = 72f; + + public const float FACECAMERAWINDOW_HEIGHT_MAX = 400f; + + private const int TAGRECORDING_EDITABLE_CAPACITY = 2; + + private const int TAGRECORDING_UNEDITABLE_CAPACITY = 2; + + private const int TAGPUBLISHING_UNEDITABLE_CAPACITY = 3; + + public const int VIDEOHOSTING_DIALOG_OVERLAY_DEPTH = 5000; + + public const int VIDEOHOSTING_DIALOG_OVERLAY_DEPTH_AUTOSTOP = 5010; + + private const int NICONICODIALOG_BUTTON_NICONICO = 0; + + private const int NICONICODIALOG_BUTTON_NICONAMA = 1; + + private const int NICONICODIALOG_BUTTON_AGREE = 2; + + private const int NICONICODIALOG_LABEL_NICONICO = 0; + + private const int NICONICODIALOG_LABEL_NICONAMA = 1; + + private const int NICONICODIALOG_LABEL_AGREE = 2; + + private const int NICONICODIALOG_LABEL_DIALOGBODY = 3; + + private const int NICONICODIALOG_TOGGLE_AGREE = 0; + + public const int VIDEOHOSTING_OPTION_DEFAULT = 1; + + private const int ERROR_DIALOG_DEPTH_OFFSET = 5; + + private const int ERROR_DIALOG_MAX = 100; + + private const float DELAY_UPLOAD_SEC = 0.3f; + + private const float DELAY_UPLOAD_RETURN_MUTE_SEC = 1f; + + private const float RECORD_AUTOSTOP_SEC_BUFFER = 10f; + + private const float RECORD_AUTOSTOP_SEC = 1510f; + + private bool _isRecordModeEnable; + + private bool _isPublishModeEnable; + + private HUDScene _HUDScene = HUDScene.Home; + + [SerializeField] + private GameObject _niconicoNotifcation; + + private double _autoStopTimer; + + private RecordingAutoStopStatus _autoStopStatus; + + public static int GetFaceCameraWindowXDefault() + { + UIManager uIManager = UIManager.GetInstance(); + if (null == uIManager) + { + return 0; + } + if (null == uIManager.getCamera() || null == uIManager.GetVideoHostingHUD()) + { + return 0; + } + return (int)uIManager.getCamera().WorldToScreenPoint(uIManager.GetVideoHostingHUD().GetFaceCameraWindowLocator().position).x; + } + + public static int GetFaceCameraWindowYDefault() + { + UIManager uIManager = UIManager.GetInstance(); + if (null == uIManager) + { + return Screen.height; + } + if (null == uIManager.getCamera() || null == uIManager.GetVideoHostingHUD()) + { + return Screen.height; + } + return (int)uIManager.getCamera().WorldToScreenPoint(uIManager.GetVideoHostingHUD().GetFaceCameraWindowLocator().position).y; + } + + private void Update() + { + _UpdateRecordingAutoStopTimer(); + } + + public static bool GetRecordModeEnable() + { + return SingletonMonoBehaviour.instance._isRecordModeEnable; + } + + public static void SetRecordModeEnable(bool isEnable) + { + SingletonMonoBehaviour.instance._isRecordModeEnable = isEnable; + } + + public static bool GetPublishModeEnable() + { + return SingletonMonoBehaviour.instance._isPublishModeEnable; + } + + public static void SetPublishModeEnable(bool isEnable) + { + SingletonMonoBehaviour.instance._isPublishModeEnable = isEnable; + } + + public static bool GetOptionFlagFromPlayerPrefs(Option option) + { + if (option < Option.EnemyNameDisplay || option >= Option.Max) + { + return false; + } + int value = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.VIDEOHOSTING_FLAGS); + return (value & (1 << (int)option)) != 0; + } + + public static void SetOptionFlagFromPlayerPrefs(Option option, bool enable) + { + if (option >= Option.EnemyNameDisplay && option < Option.Max) + { + int value = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.VIDEOHOSTING_FLAGS); + value = ((!enable) ? (value & ~(1 << (int)option)) : (value | (1 << (int)option))); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.VIDEOHOSTING_FLAGS, value); + } + } + + public static string GetVideoHostingVersion() + { + return PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.VIDEOHOSTING_VERSION); + } + + public static void SetVideoHostingVersion(string version) + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.VIDEOHOSTING_VERSION, version); + } + + public static void CreateVideoHostingSetting() + { + if (SingletonMonoBehaviour.instance.IsRecording() || SingletonMonoBehaviour.instance.IsPublising()) + { + CreateDialogInvalidOperation(); + } + else + { + UIManager.GetInstance().CreateVideoHostingSettingRoot().SetTitleLabel(GetVideoHostingSettingTitle()); + } + } + + public static void CreateNicoNicoNotification() + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetTitleLabel(systemText.Get("VideoHosting_0037")); + dialogBase.SetButtonText(systemText.Get("Common_0004"), systemText.Get("Common_0005")); + GameObject gameObject = UnityEngine.Object.Instantiate(SingletonMonoBehaviour.instance._niconicoNotifcation); + dialogBase.SetObj(gameObject); + gameObject.GetComponent().SetParent(dialogBase); + } + + public static string GetVideoHostingSettingTitle() + { + return Data.SystemText.Get("VideoHosting_0001"); + } + + public static void CheckVideoHostingAndShowAchievement(Action cbAchievement) + { + cbAchievement(); + } + + public static void CheckVideoHostingAndExecAction(Action cbClose) + { + bool flag = SingletonMonoBehaviour.instance.IsPublising() && !SingletonMonoBehaviour.instance.IsPublishingPause(); + bool flag2 = SingletonMonoBehaviour.instance.IsRecording() && !SingletonMonoBehaviour.instance.IsRecordingPause(); + if (flag || flag2) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetTitleLabel(systemText.Get("Common_0021")); + dialogBase.SetButtonText(systemText.Get("Common_0004")); + dialogBase.SetPanelDepth(5000); + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, cbClose); + if (flag) + { + dialogBase.SetText(systemText.Get("VideoHosting_0069")); + } + else + { + dialogBase.SetText(systemText.Get("VideoHosting_0077")); + } + } + else + { + cbClose(); + } + } + + private static void _OverrideSoundMute() + { + GameMgr.GetIns().GetSoundMgr().AllMute(isMute: true); + } + + private static void _ReturnSoundMute() + { + GameMgr.GetIns().GetSoundMgr().AllMute(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SOUND_MUTE)); + } + + public static void UploadRecordingAndSoundMute() + { + if (SingletonMonoBehaviour.instance.HasRecordedData() && !SingletonMonoBehaviour.instance.IsUploading()) + { + _OverrideSoundMute(); + SingletonMonoBehaviour.instance.UploadRecording(); + } + else + { + CreateDialogNotHasRecordedData(); + } + } + + private static void _DelayUpload() + { + UIManager.GetInstance().closeInSceneCenterLoading(); + UploadRecordingAndSoundMute(); + } + + public static void CheckAndCreateHUD(HUDScene scene) + { + if (GetRecordModeEnable()) + { + UIManager.GetInstance().CreateVideoHostingHUD(VideoHostingHUD.HUDMode.Recording); + SetHUDScene(scene); + } + else if (GetPublishModeEnable()) + { + UIManager.GetInstance().CreateVideoHostingHUD(VideoHostingHUD.HUDMode.Publishing); + SetHUDScene(scene); + } + else + { + UIManager.GetInstance().DestroyVideoHostingHUD(); + } + } + + public static void SetHUDScene(HUDScene scene) + { + VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD(); + if (null == videoHostingHUD) + { + return; + } + bool pushEnablePlay = false; + bool pushEnableSetting = false; + int controlButtonLayer = VideoHostingHUD.CONTROLBUTTON_LAYER_DEFAULT; + switch (scene) + { + case HUDScene.Home: + if (GetRecordModeEnable()) + { + pushEnablePlay = true; + pushEnableSetting = true; + } + else if (GetPublishModeEnable()) + { + pushEnablePlay = true; + pushEnableSetting = true; + } + break; + case HUDScene.Battle: + if (GetRecordModeEnable()) + { + pushEnablePlay = true; + pushEnableSetting = true; + } + else if (GetPublishModeEnable()) + { + pushEnablePlay = false; + pushEnableSetting = true; + } + controlButtonLayer = VideoHostingHUD.CONTROLBUTTON_LAYER_BATTLE; + break; + case HUDScene.BattleResult: + if (GetRecordModeEnable()) + { + pushEnablePlay = true; + pushEnableSetting = true; + } + else if (GetPublishModeEnable()) + { + pushEnablePlay = false; + pushEnableSetting = true; + } + break; + case HUDScene.RoomMatchRobby: + if (GetRecordModeEnable()) + { + pushEnablePlay = true; + pushEnableSetting = true; + } + else if (GetPublishModeEnable()) + { + pushEnablePlay = false; + pushEnableSetting = true; + } + break; + case HUDScene.Title: + if (GetRecordModeEnable()) + { + pushEnablePlay = false; + pushEnableSetting = false; + } + else if (GetPublishModeEnable()) + { + pushEnablePlay = false; + pushEnableSetting = false; + } + break; + } + SingletonMonoBehaviour.instance._HUDScene = scene; + videoHostingHUD.SetPushEnablePlay(pushEnablePlay); + videoHostingHUD.SetPushEnableSetting(pushEnableSetting); + videoHostingHUD.SetControlButtonLayer(controlButtonLayer); + } + + public static HUDScene GetHUDScene() + { + return SingletonMonoBehaviour.instance._HUDScene; + } + + public static bool CheckHUDSceneUploadEnable(HUDScene scene) + { + if (scene == HUDScene.Battle || scene == HUDScene.BattleResult || scene == HUDScene.RoomMatchRobby) + { + return false; + } + return true; + } + + public static void FaceCameraAdjustSwitch() + { + VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD(); + if (!(null == videoHostingHUD)) + { + if (GetPublishModeEnable() && SingletonMonoBehaviour.instance.GetPublishingFaceCameraEnable()) + { + videoHostingHUD.InitFaceCameraAdjust(); + videoHostingHUD.SetFaceCameraAdjustSwitchEnable(isEnable: true); + } + else + { + videoHostingHUD.SetFaceCameraAdjustSwitchEnable(isEnable: false); + } + } + } + + private static IEnumerator _InitHUDForPublishing() + { + VideoHostingHUD vhHUD = UIManager.GetInstance().GetVideoHostingHUD(); + while (!vhHUD.GetInitialized()) + { + yield return null; + } + UIManager.GetInstance().GetVideoHostingHUD().OnStartPublishing(); + FaceCameraAdjustSwitch(); + } + + public static bool IsAutoPauseRecording() + { + return GetOptionFlagFromPlayerPrefs(Option.AutoPauseRecording); + } + + public static bool IsAutoStopRecording() + { + return GetOptionFlagFromPlayerPrefs(Option.AutoStopRecording); + } + + public static bool IsAutoPausePublishing() + { + return GetOptionFlagFromPlayerPrefs(Option.AutoPausePublishing); + } + + public static void AutoPausePublishing(bool isSave) + { + if (SingletonMonoBehaviour.instance.IsPublising() && !SingletonMonoBehaviour.instance.IsPublishingPause()) + { + SingletonMonoBehaviour.instance.PausePublishing(); + if (isSave) + { + SetOptionFlagFromPlayerPrefs(Option.AutoPausePublishing, enable: true); + } + } + } + + public static void AutoPauseRecording(bool isSave) + { + if (SingletonMonoBehaviour.instance.IsRecording() && !SingletonMonoBehaviour.instance.IsRecordingPause()) + { + SingletonMonoBehaviour.instance.PauseRecording(); + if (isSave) + { + SetOptionFlagFromPlayerPrefs(Option.AutoPauseRecording, enable: true); + } + } + } + + public static void AutoStopRecording(bool isSave) + { + if (SingletonMonoBehaviour.instance.IsRecording()) + { + SingletonMonoBehaviour.instance.StopRecording(); + if (isSave) + { + SetOptionFlagFromPlayerPrefs(Option.AutoStopRecording, enable: true); + } + } + } + + public static void AutoResumePublishing() + { + if (IsAutoPausePublishing()) + { + if (SingletonMonoBehaviour.instance.IsPublishingPause()) + { + SingletonMonoBehaviour.instance.ResumePublishing(); + } + SetOptionFlagFromPlayerPrefs(Option.AutoPausePublishing, enable: false); + } + } + + public static void AutoResumeRecording() + { + if (IsAutoPauseRecording()) + { + if (SingletonMonoBehaviour.instance.IsRecordingPause()) + { + SingletonMonoBehaviour.instance.ResumeRecording(); + } + SetOptionFlagFromPlayerPrefs(Option.AutoPauseRecording, enable: false); + } + } + + private void _UpdateRecordingAutoStopTimer() + { + if (RecordingAutoStopStatus.Active != _autoStopStatus) + { + return; + } + _autoStopTimer -= Time.deltaTime; + if (_autoStopTimer < 0.0) + { + VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD(); + if (null != videoHostingHUD) + { + videoHostingHUD.CloseSettingMenuDialog(); + } + CreateDialogStopRecording(CheckHUDSceneUploadEnable(GetHUDScene()), isTimeOut: true); + SingletonMonoBehaviour.instance.StopRecording(); + _StopRecordingAutoStopTimer(); + } + } + + private void _StartRecordingAutoStopTimer(float sec) + { + _StopRecordingAutoStopTimer(); + _autoStopStatus = RecordingAutoStopStatus.Active; + _autoStopTimer = sec; + } + + private void _StopRecordingAutoStopTimer() + { + _autoStopStatus = RecordingAutoStopStatus.Null; + _autoStopTimer = 0.0; + } + + private void _PauseRecordingAutoStopTimer() + { + if (RecordingAutoStopStatus.Active == _autoStopStatus) + { + _autoStopStatus = RecordingAutoStopStatus.Pause; + } + } + + private void _ResumeRecordingAutoStopTimer() + { + if (RecordingAutoStopStatus.Pause == _autoStopStatus) + { + _autoStopStatus = RecordingAutoStopStatus.Active; + } + } + + public static string GetUserNameHidden(string userName) + { + if ((GetRecordModeEnable() || GetPublishModeEnable()) && !GetOptionFlagFromPlayerPrefs(Option.EnemyNameDisplay)) + { + userName = Data.SystemText.Get("VideoHosting_0046"); + } + return userName; + } + + public static string GetUserIDHidden(string userID) + { + if (GetRecordModeEnable() || GetPublishModeEnable()) + { + userID = Data.SystemText.Get("VideoHosting_0081"); + } + return userID; + } + + public static void OnStartRecording() + { + VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD(); + if (null != videoHostingHUD) + { + videoHostingHUD.OnStartRecording(); + } + SetOptionFlagFromPlayerPrefs(Option.IsRecording, enable: true); + } + + public static void OnFinishRecording() + { + VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD(); + if (null != videoHostingHUD) + { + videoHostingHUD.OnFinishRecording(); + } + SetOptionFlagFromPlayerPrefs(Option.AutoPauseRecording, enable: false); + SetOptionFlagFromPlayerPrefs(Option.IsRecording, enable: false); + } + + public static void OnPauseRecording() + { + VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD(); + if (null != videoHostingHUD) + { + videoHostingHUD.OnPauseRecording(); + } + } + + public static void OnResumeRecording() + { + VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD(); + if (null != videoHostingHUD) + { + videoHostingHUD.OnResumeRecording(); + } + } + + public static void OnStartUploadRecording() + { + } + + public static void OnFinishUploadRecording(string strVideoId, string strUrl) + { + } + + public static void OnCameraStartedSession() + { + FaceCameraAdjustSwitch(); + } + + public static void OnCameraStoppedSession() + { + VideoHostingHUD videoHostingHUD = UIManager.GetInstance().GetVideoHostingHUD(); + if (null != videoHostingHUD) + { + videoHostingHUD.EndFaceCameraAdjust(); + videoHostingHUD.SetFaceCameraAdjustSwitchEnable(isEnable: false); + } + } + + public static void OnSoftwareReset() + { + AutoPausePublishing(isSave: true); + AutoStopRecording(isSave: true); + SingletonMonoBehaviour.instance.SetRecordingFaceCameraMicrophoneStatus(isEnableCamera: false, isEnableMicrophone: false); + SingletonMonoBehaviour.instance.SetPublishingFaceCameraMicrophoneStatus(isEnableCamera: false, isEnableMicrophone: false); + } + + private static DialogBase _CreateVideoHostingDialogCommon(string strKeyTitle, string strKeyText) + { + return _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, strKeyTitle, strKeyText, "", ""); + } + + private static DialogBase _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout layout, string strKeyTitle, string strKeyText, string strKeyButton1, string strKeyButton2) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetButtonLayout(layout); + dialogBase.SetTitleLabel(systemText.Get(strKeyTitle)); + dialogBase.SetText(systemText.Get(strKeyText)); + if (!string.IsNullOrEmpty(strKeyButton1) && !string.IsNullOrEmpty(strKeyButton2)) + { + dialogBase.SetButtonText(systemText.Get(strKeyButton1), systemText.Get(strKeyButton2)); + } + else if (!string.IsNullOrEmpty(strKeyButton1)) + { + dialogBase.SetButtonText(systemText.Get(strKeyButton1)); + } + dialogBase.SetPanelDepth(5000); + return dialogBase; + } + + public static void CreateDialogNotHasRecordedData() + { + _CreateVideoHostingDialogCommon("Common_0021", "VideoHosting_0075"); + } + + public static void CreateDialogStopRecording(bool isUseUploadButton, bool isTimeOut) + { + if (isUseUploadButton) + { + string strKeyText = (isTimeOut ? "VideoHosting_0049" : "VideoHosting_0051"); + string strKeyButton = "VideoHosting_0021"; + DialogBase dialogBase = _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.BlueBtn_CancelBtn, "Common_0021", strKeyText, "Common_0004", strKeyButton); + dialogBase.onPushButton2 = (Action)Delegate.Combine(dialogBase.onPushButton2, (Action)delegate + { + SingletonMonoBehaviour.instance.StartCoroutine(Timer.DelayMethod(0.3f, _DelayUpload)); + }); + dialogBase.SetPanelDepth(5010); + } + else + { + string strKeyText2 = (isTimeOut ? "VideoHosting_0024" : "VideoHosting_0050"); + _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, "Common_0021", strKeyText2, "Common_0004", "").SetPanelDepth(5010); + } + } + + private static void _CreateDialogStopPublishing(bool isTimeOut) + { + string text = ""; + text = ((!isTimeOut) ? "VideoHosting_0040" : "VideoHosting_0039"); + _CreateVideoHostingDialogCommon("Common_0021", text); + } + + public static void CreateDialogNotSupported() + { + _CreateVideoHostingDialogCommon("Error_0001", "VideoHosting_0080"); + } + + public static void CreateDialogInvalidOperation() + { + string strKeyText = ""; + if (SingletonMonoBehaviour.instance.IsPublising()) + { + strKeyText = "VideoHosting_0067"; + } + else if (SingletonMonoBehaviour.instance.IsRecording()) + { + strKeyText = "VideoHosting_0068"; + } + _CreateVideoHostingDialogCommon("Common_0021", strKeyText); + } + + public static void CreateDialogPrivacyAccount() + { + string strKeyText = ""; + if (SingletonMonoBehaviour.instance.IsPublising()) + { + strKeyText = "VideoHosting_0057"; + } + else if (SingletonMonoBehaviour.instance.IsRecording()) + { + strKeyText = "VideoHosting_0056"; + } + _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, "Common_0021", strKeyText, "Common_0004", ""); + } + + public static void CreateDialogAchievementEnter() + { + string strKeyText = ""; + if (SingletonMonoBehaviour.instance.IsPublising()) + { + strKeyText = "VideoHosting_0072"; + } + else if (SingletonMonoBehaviour.instance.IsRecording()) + { + strKeyText = "VideoHosting_0068"; + } + _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, "Common_0021", strKeyText, "Common_0004", ""); + } + + public static void CreateDialogPrivacyBuyCrystalEnter(Action cbPushOK) + { + DialogBase dialogBase = null; + if (SingletonMonoBehaviour.instance.IsPublising()) + { + string strKeyTitle = "VideoHosting_0078"; + string strKeyText = "VideoHosting_0054"; + string strKeyButton = "VideoHosting_0063"; + dialogBase = _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.BlueBtn_CancelBtn, strKeyTitle, strKeyText, strKeyButton, ""); + DialogBase dialogBase2 = dialogBase; + dialogBase2.onPushButton1 = (Action)Delegate.Combine(dialogBase2.onPushButton1, (Action)delegate + { + AutoPausePublishing(isSave: true); + }); + } + else if (SingletonMonoBehaviour.instance.IsRecording()) + { + string strKeyTitle2 = "VideoHosting_0079"; + string strKeyText2 = "VideoHosting_0052"; + string strKeyButton2 = "VideoHosting_0048"; + dialogBase = _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.BlueBtn_CancelBtn, strKeyTitle2, strKeyText2, strKeyButton2, ""); + DialogBase dialogBase3 = dialogBase; + dialogBase3.onPushButton1 = (Action)Delegate.Combine(dialogBase3.onPushButton1, (Action)delegate + { + AutoStopRecording(isSave: false); + }); + } + if (!(null == dialogBase) && cbPushOK != null) + { + DialogBase dialogBase4 = dialogBase; + dialogBase4.onPushButton1 = (Action)Delegate.Combine(dialogBase4.onPushButton1, cbPushOK); + } + } + + public static void CreateDialogPrivacyBuyCrystalExit() + { + DialogBase dialogBase = _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, "Common_0021", "VideoHosting_0055", "Common_0004", ""); + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, new Action(AutoResumePublishing)); + } + + public static void CreateDialogPrivacyAutoStopRecordingTitle(Action cbPushOK) + { + DialogBase dialogBase = _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, "Common_0021", "VideoHosting_0066", "Common_0004", ""); + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, cbPushOK); + } + + public static void CreateDialogPrivacyAutoPausePublishingTitle(Action cbPushOK) + { + DialogBase dialogBase = _CreateVideoHostingDialogCommon(DialogBase.ButtonLayout.OkBtn, "Common_0021", "VideoHosting_0065", "Common_0004", ""); + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, cbPushOK); + } +} diff --git a/SVSim.BattleEngine/Engine/VirtualBattleEnemy.cs b/SVSim.BattleEngine/Engine/VirtualBattleEnemy.cs new file mode 100644 index 0000000..0b7521b --- /dev/null +++ b/SVSim.BattleEngine/Engine/VirtualBattleEnemy.cs @@ -0,0 +1,71 @@ +using UnityEngine; +using Wizard.Battle; +using Wizard.Battle.UI; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class VirtualBattleEnemy : BattleEnemy +{ + public override IStatusPanelControl StatusPanelControl => null; + + public VirtualBattleEnemy(BattleManagerBase battleMgr, BattleCamera battleCamera, BackGroundBase backGround) + : base(battleMgr, battleCamera, backGround, NullInnerOptionsBuilder.GetInstance()) + { + } + + protected override void Initialize() + { + BattleEnemyView = new NullEnemyBattleView(); + } + + protected override IBattlePlayerVfxCreator CreateVfxCreator() + { + return new NullBattlePlayerVfxCreator(); + } + + public override void Setup(BattlePlayerBase opponentBattlePlayer) + { + base.Setup(opponentBattlePlayer); + } + + protected override void SetActive() + { + } + + public override EffectBattle GetSkillEffect(string skillEffectPath) + { + return null; + } + + public override Vector3 GetFieldCenterPosition() + { + return Vector3.zero; + } + + public override VfxBase CreateUpdateDeckCountLabelVfx() + { + return NullVfx.GetInstance(); + } + + protected override VfxBase CreateUpdateClassInfoVfx(bool playEffect) + { + return NullVfx.GetInstance(); + } + + public override BattleCardBase CreateCard(int cardId, int cardIndex, bool isChoiceBrave = false) + { + BattleCardBase battleCardBase = CardCreatorBase.CreateVirtualCard(cardId, cardIndex, IsPlayer, base.BattleMgr, this, _opponentBattlePlayer, _innerOptionsBuilder); + SetupCardEvent(battleCardBase); + return battleCardBase; + } + + public override IClassInfomationUI CreateClassInfomationUI(int orderCount = 1, int clanId = -1, int totalInfoNum = 1) + { + return NullClassInfomationUI.GetInstance(); + } + + public override void SetupCardEvent(BattleCardBase card) + { + base.SetupCardEvent(card); + } +} diff --git a/SVSim.BattleEngine/Engine/VirtualBattlePlayer.cs b/SVSim.BattleEngine/Engine/VirtualBattlePlayer.cs new file mode 100644 index 0000000..df932b6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/VirtualBattlePlayer.cs @@ -0,0 +1,71 @@ +using UnityEngine; +using Wizard.Battle; +using Wizard.Battle.UI; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class VirtualBattlePlayer : BattlePlayer +{ + public override IStatusPanelControl StatusPanelControl => null; + + public VirtualBattlePlayer(BattleManagerBase battleMgr, BattleCamera battleCamera, BackGroundBase backGround) + : base(battleMgr, battleCamera, backGround, NullInnerOptionsBuilder.GetInstance()) + { + } + + protected override void Initialize() + { + PlayerBattleView = new NullPlayerBattleView(); + } + + protected override IBattlePlayerVfxCreator CreateVfxCreator() + { + return new NullBattlePlayerVfxCreator(); + } + + public override void Setup(BattlePlayerBase opponentBattlePlayer) + { + base.Setup(opponentBattlePlayer); + } + + protected override void SetActive() + { + } + + public override EffectBattle GetSkillEffect(string skillEffectPath) + { + return null; + } + + public override Vector3 GetFieldCenterPosition() + { + return Vector3.zero; + } + + public override VfxBase CreateUpdateDeckCountLabelVfx() + { + return NullVfx.GetInstance(); + } + + protected override VfxBase CreateUpdateClassInfoVfx(bool playEffect) + { + return NullVfx.GetInstance(); + } + + public override BattleCardBase CreateCard(int cardId, int cardIndex, bool isChoiceBrave = false) + { + BattleCardBase battleCardBase = CardCreatorBase.CreateVirtualCard(cardId, cardIndex, IsPlayer, base.BattleMgr, this, _opponentBattlePlayer, _innerOptionsBuilder); + SetupCardEvent(battleCardBase); + return battleCardBase; + } + + public override IClassInfomationUI CreateClassInfomationUI(int orderCount = 1, int clanId = -1, int totalInfoNum = 1) + { + return NullClassInfomationUI.GetInstance(); + } + + public override void SetupCardEvent(BattleCardBase card) + { + base.SetupCardEvent(card); + } +} diff --git a/SVSim.BattleEngine/Engine/VoiceDictionaries.cs b/SVSim.BattleEngine/Engine/VoiceDictionaries.cs new file mode 100644 index 0000000..46580bd --- /dev/null +++ b/SVSim.BattleEngine/Engine/VoiceDictionaries.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard; + +public class VoiceDictionaries +{ + public VoiceDictionary playVoices; + + public VoiceDictionary evoVoices; + + public VoiceDictionary atkVoices; + + public VoiceDictionary evoAtkVoices; + + public VoiceDictionary destroyVoices; + + public VoiceDictionary evoDestroyVoices; + + public List skillVoices; + + public List evoSkillVoices; + + public List attachSkillVoices; + + private const string UNDER_BAR = "_"; + + public string VoiceId { get; private set; } + + public VoiceDictionaries(int cardId, CardMaster.CardMasterId cardMasterId) + { + CardParameter cardParameterFromId = CardMaster.GetInstance(cardMasterId).GetCardParameterFromId(cardId); + if (cardParameterFromId != null) + { + VoiceDictionary.SettingVoiceData(ref playVoices, (cardParameterFromId.PlayVoice != null) ? cardParameterFromId.PlayVoice : ""); + VoiceDictionary.SettingVoiceData(ref evoVoices, (cardParameterFromId.EvoVoice != null) ? cardParameterFromId.EvoVoice : ""); + VoiceDictionary.SettingVoiceData(ref atkVoices, ref evoAtkVoices, (cardParameterFromId.AtkVoice != null) ? cardParameterFromId.AtkVoice : ""); + VoiceDictionary.SettingVoiceData(ref destroyVoices, ref evoDestroyVoices, (cardParameterFromId.DestroyVoice != null) ? cardParameterFromId.DestroyVoice : ""); + VoiceDictionary.SettingVoiceDataList(out skillVoices, out evoSkillVoices, (cardParameterFromId.SkillVoice != null) ? cardParameterFromId.SkillVoice : ""); + } + attachSkillVoices = new List(); + VoiceId = GetVoiceId(); + } + + private bool GetVoiceIDBeforeUnderBar(VoiceDictionary dic, ref string retVoiceID) + { + string[] allVoiceList = dic.GetAllVoiceList(); + if (allVoiceList.Length == 0) + { + return false; + } + if (string.IsNullOrEmpty(allVoiceList[0])) + { + return false; + } + string text = allVoiceList.FirstOrDefault((string v) => v != "NONE".ToLower()); + if (text == null) + { + return false; + } + retVoiceID = text.Split(new string[1] { "_" }, StringSplitOptions.None)[0]; + return true; + } + + private bool GetVoiceIDListBeforeUnderBar(List dicList, ref string retVoiceID) + { + if (dicList != null && dicList.Count > 0) + { + for (int i = 0; i < dicList.Count; i++) + { + if (GetVoiceIDBeforeUnderBar(dicList[i], ref retVoiceID)) + { + return true; + } + } + } + return false; + } + + private string GetVoiceId() + { + string retVoiceID = ""; + if (GetVoiceIDBeforeUnderBar(playVoices, ref retVoiceID)) + { + return retVoiceID; + } + if (GetVoiceIDBeforeUnderBar(evoVoices, ref retVoiceID)) + { + return retVoiceID; + } + if (GetVoiceIDBeforeUnderBar(atkVoices, ref retVoiceID)) + { + return retVoiceID; + } + if (GetVoiceIDBeforeUnderBar(evoAtkVoices, ref retVoiceID)) + { + return retVoiceID; + } + if (GetVoiceIDBeforeUnderBar(destroyVoices, ref retVoiceID)) + { + return retVoiceID; + } + if (GetVoiceIDBeforeUnderBar(evoDestroyVoices, ref retVoiceID)) + { + return retVoiceID; + } + if (GetVoiceIDListBeforeUnderBar(skillVoices, ref retVoiceID)) + { + return retVoiceID; + } + if (GetVoiceIDListBeforeUnderBar(evoSkillVoices, ref retVoiceID)) + { + return retVoiceID; + } + GetVoiceIDListBeforeUnderBar(attachSkillVoices, ref retVoiceID); + return retVoiceID; + } + + public List GetNormalPlayVoices() + { + List list = playVoices.GetAllVoiceList().ToList(); + List list2 = new List(); + for (int i = 0; i < list.Count; i++) + { + string text = list.ElementAt(i); + if ((text.Contains("_ub") || text.Contains("_sb") || text.Contains("_ssb")) && !text.Contains("_ubp") && !text.Contains("_sbp") && !text.Contains("_ssbp")) + { + if (text.Contains("_ubl")) + { + list[i] = list[i].Replace("_ubl", "_ub"); + } + else if (text.Contains("_sbl")) + { + list[i] = list[i].Replace("_sbl", "_sb"); + } + else if (text.Contains("_ssbl")) + { + list[i] = list[i].Replace("_ssbl", "_ssb"); + } + else + { + list2.Add(text); + } + } + } + foreach (string item in list2) + { + list.Remove(item); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/VolcanoField.cs b/SVSim.BattleEngine/Engine/VolcanoField.cs new file mode 100644 index 0000000..868d367 --- /dev/null +++ b/SVSim.BattleEngine/Engine/VolcanoField.cs @@ -0,0 +1,144 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +public class VolcanoField : BackGroundBase +{ + public override int FieldId => 3; + + public VolcanoField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_vlca_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles03").gameObject; + _fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles); + _fieldObjDictionary.Add("obj1", _fieldModel.transform.Find("md_bf_vlca_01_obj1").gameObject); + _fieldParticleSystemDictionary.Add("pillar1", _fieldParticles.transform.Find("pillar1").GetComponent()); + _fieldParticleSystemDictionary.Add("pillar2", _fieldParticles.transform.Find("pillar2").GetComponent()); + _fieldParticleSystemDictionary.Add("pillar3", _fieldParticles.transform.Find("pillar3").GetComponent()); + _fieldParticleSystemDictionary.Add("obj1_fog", _fieldParticles.transform.Find("obj1_fog").GetComponent()); + _fieldParticleSystemDictionary.Add("obj1_stay", _fieldParticles.transform.Find("obj1_stay").GetComponent()); + _fieldParticleSystemDictionary.Add("obj1_shake", _fieldParticles.transform.Find("obj1_shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_3, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_3_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_3_2, pos); + break; + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldObjDictionary["obj1"].transform.localPosition = new Vector3(1.308078f, 1.5f, -0.4518712f); + _battleCamera.Camera.transform.localPosition = new Vector3(840f, -30f, -100f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-50f, -30f, 37f)); + Vector3[] bezierQuad = MotionUtils.GetBezierQuad(new Vector3(840f, -30f, -100f), new Vector3(720f, 450f, -100f), new Vector3(20f, 240f, -80f), 10); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierQuad, "movetopath", false, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-20f, -75f, 85f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[1], "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["pillar2"].Play(); + yield return new WaitForSeconds(0.5f); + _fieldParticleSystemDictionary["pillar3"].Play(); + yield return new WaitForSeconds(0.5f); + _fieldParticleSystemDictionary["pillar1"].Play(); + yield return new WaitForSeconds(1f); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(4f); + _fieldParticleSystemDictionary["obj1_stay"].Play(); + _fieldParticleSystemDictionary["obj1_fog"].Play(); + iTween.MoveTo(_fieldObjDictionary["obj1"], iTween.Hash("position", new Vector3(1.308078f, 0.5299267f, -0.4518712f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1") + { + switch (_gimicCntDictionary[obj.tag]) + { + case 0: + case 1: + case 2: + case 3: + _gimicCntDictionary[obj.tag]++; + _fieldParticleSystemDictionary["obj1_shake"].Play(); + iTween.Stop(_fieldObjDictionary["obj1"]); + iTween.ShakePosition(_fieldObjDictionary["obj1"], iTween.Hash("amount", new Vector3(0.005f, 0f, 0.005f) * _gimicCntDictionary[obj.tag], "time", 0.5f)); + iTween.MoveTo(_fieldObjDictionary["obj1"], iTween.Hash("position", new Vector3(1.308078f, 0.5299267f, -0.4518712f), "time", 0.1f, "delay", 0.5f, "islocal", true)); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[0], "se_field_" + _str3DFieldNo, 0f, 0L); + break; + case 4: + _gimicCntDictionary[obj.tag]++; + _fieldParticleSystemDictionary["obj1_shake"].Play(); + _fieldParticleSystemDictionary["obj1_stay"].Stop(); + iTween.ShakePosition(_fieldObjDictionary["obj1"], iTween.Hash("amount", new Vector3(0.005f, 0f, 0.005f) * _gimicCntDictionary[obj.tag], "time", 0.5f)); + iTween.MoveTo(_fieldObjDictionary["obj1"], iTween.Hash("position", new Vector3(1.308078f, -1f, -0.4518712f), "time", 0.5f, "delay", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInExpo)); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[0], "se_field_" + _str3DFieldNo, 0f, 0L); + yield return new WaitForSeconds(1f); + _fieldParticleSystemDictionary["pillar1"].Play(); + m_BtlMgrIns.VfxMgr.RegisterImmediateVfx(_battleCamera.ShakeCamera(Vector3.one * 0.1f, 0.5f, 0f)); + m_BtlMgrIns.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(WaitVfx.Create(0.5f), _battleCamera.ShakeComplete())); + yield return new WaitForSeconds(5f); + _fieldParticleSystemDictionary["obj1_fog"].Play(); + _fieldObjDictionary["obj1"].transform.localPosition = new Vector3(1.308078f, 1.5f, -0.4518712f); + iTween.MoveTo(_fieldObjDictionary["obj1"], iTween.Hash("position", new Vector3(1.308078f, 0.5299267f, -0.4518712f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + yield return new WaitForSeconds(2f); + _gimicCntDictionary[obj.tag] = 0; + _fieldParticleSystemDictionary["obj1_stay"].Play(); + break; + } + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + if (_gimicCntDictionary["FieldGimic1"] < 4) + { + _fieldParticleSystemDictionary["obj1_shake"].Play(); + iTween.ShakePosition(_fieldObjDictionary["obj1"], iTween.Hash("amount", new Vector3(0.01f, 0f, 0.01f), "time", 0.8f)); + iTween.MoveTo(_fieldObjDictionary["obj1"], iTween.Hash("position", new Vector3(1.308078f, 0.5299267f, -0.4518712f), "time", 0.1f, "delay", 0.8f, "islocal", true)); + } + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/VoteData.cs b/SVSim.BattleEngine/Engine/VoteData.cs new file mode 100644 index 0000000..11cd507 --- /dev/null +++ b/SVSim.BattleEngine/Engine/VoteData.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +public class VoteData : HeaderData +{ + public bool is_vote; + + public string title_text; + + public string before_content_text; + + public string after_content_text; + + public string tweet_text; + + public string tweet_tag; + + public string tweet_url; + + public string tweet_image; + + public string vote_name; + + public Dictionary vote_target_list; +} diff --git a/SVSim.BattleEngine/Engine/WatchOperateReceive.cs b/SVSim.BattleEngine/Engine/WatchOperateReceive.cs new file mode 100644 index 0000000..ec85481 --- /dev/null +++ b/SVSim.BattleEngine/Engine/WatchOperateReceive.cs @@ -0,0 +1,17 @@ +public class WatchOperateReceive : OperateReceive +{ + public WatchOperateReceive(NetworkBattleManagerBase networkBattleMgr, RegisterActionManager registerCardList, OperateMgr operateMgr, NetworkBattleData networkBattleData) + : base(networkBattleMgr, registerCardList, operateMgr, networkBattleData) + { + } + + protected override PlayHandCardReflection CreateNetworkPlayCardAction() + { + return new WatchPlayCardAction(_battleMgr, _operateMgr, _networkBattleData); + } + + protected override InPlayCardReflection CreateNetworkInPlayAction() + { + return new WatchInPlayAction(_battleMgr, _operateMgr); + } +} diff --git a/SVSim.BattleEngine/Engine/WatchOperationCollection.cs b/SVSim.BattleEngine/Engine/WatchOperationCollection.cs new file mode 100644 index 0000000..e2e90cd --- /dev/null +++ b/SVSim.BattleEngine/Engine/WatchOperationCollection.cs @@ -0,0 +1,494 @@ +using System; +using System.Collections.Generic; +using Wizard; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class WatchOperationCollection : NetworkOperationCollectionBase +{ + private NetworkWatchBattleMgr _watchBattleMgr; + + private int _lastIndex; + + private const float TOUCH_ASYNC_WAIT_TIME = 0.3f; + + public WatchOperationCollection(NetworkWatchBattleMgr watchBattleMgr, OperateMgr operateMgr, NetworkBattleReceiver.ReceiveData receivedData, NetworkBattleData networkBattleData, bool isPlayer) + : base(watchBattleMgr, operateMgr, receivedData, networkBattleData, isPlayer) + { + _watchBattleMgr = watchBattleMgr; + } + + public WatchOperationCollection(NetworkBattleManagerBase networkBattleMgr, OperateMgr operateMgr, NetworkBattleReceiver.ReceiveData receivedData, NetworkBattleData networkBattleData, bool isPlayer) + : base(networkBattleMgr, operateMgr, receivedData, networkBattleData, isPlayer) + { + } + + public override void RetryOperation() + { + } + + public override void SwapOperation(Func, VfxBase> OnReceiveOpponentMulligan, Func, VfxBase> OnReceivePlayerMulligan) + { + OperateMulligan(OnReceiveOpponentMulligan, OnReceivePlayerMulligan); + } + + public override void SecondMulliganOperation(Func, VfxBase> OnReceiveOpponentMulligan, Func, VfxBase> OnReceivePlayerMulligan, Func OnEndMulligan) + { + OperateMulligan(OnReceiveOpponentMulligan, OnReceivePlayerMulligan); + RegisterSequentialVfx(OnEndMulligan.GetAllFuncVfxResults()); + } + + protected void OperateMulligan(Func, VfxBase> OnReceiveOpponentMulligan, Func, VfxBase> OnReceivePlayerMulligan) + { + if (_isPlayer) + { + RegisterSequentialVfx(OperatePlayerMulligan(_receivedData, OnReceivePlayerMulligan)); + } + else + { + RegisterSequentialVfx(OperateOppoMulligan(_receivedData, OnReceiveOpponentMulligan)); + } + } + + public override void TurnStartOperation(NetworkBattleDefine.NetworkBattleURI lastReceivedUri, int lastReceivedTime) + { + if (_isPlayer) + { + RegisterSequentialVfx(_networkBattleMgr.ControlTurnStartPlayer()); + } + else + { + RegisterSequentialVfx(_networkBattleMgr.ControlTurnStartOpponent()); + } + } + + public override void TurnEndOperation(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction) + { + CheckStateAndCancel(networkPlayCardAction, networkInPlayAction, _isPlayer); + if (!_networkBattleData.isReceiveTurnEndAction) + { + RegisterSequentialVfx(_operateMgr.TurnEndOperation(_isPlayer)); + } + _networkBattleData.isReceiveTurnEndAction = false; + } + + public override void TurnEndFinalOperation() + { + } + + public override void TurnEndWithSkillActivationOperation(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction) + { + CheckStateAndCancel(networkPlayCardAction, networkInPlayAction, _isPlayer); + _networkBattleData.isReceiveTurnEndAction = true; + RegisterSequentialVfx(ParallelVfxPlayer.Create(_operateMgr.TurnEndOperation(_isPlayer), InstantVfx.Create(delegate + { + TurnEndTimeController turnEndTimeController = _networkBattleMgr.turnEndTimeController; + if (turnEndTimeController != null) + { + if (turnEndTimeController.IsCountdownRunning()) + { + turnEndTimeController.EndCountDown("watchTurnEndWithSkillActivationOperation"); + } + _watchBattleMgr.SlideObjectReceiveCtrl.CancelSlide(); + } + }))); + } + + public override void JudgeOperation() + { + } + + public override void PlayHandCardOperation(PlayHandCardReflection networkPlayCardAction, List choiceIdList = null, bool isChoice = false) + { + List targetDataList = (_isPlayer ? _receivedData.PlayerTargetDataList : _receivedData.OpponentTargetDataList); + SetupNetworkPlayCardAction(networkPlayCardAction, targetDataList); + BattlePlayerBase battlePlayer = _networkBattleMgr.GetBattlePlayer(_isPlayer); + RegisterSequentialVfx(InstantVfx.Create(delegate + { + BattleCardBase playedCard = networkPlayCardAction.Play(battlePlayer, _isPlayer, choiceIdList, isChoice); + HideDetailPanelOfPlayedCard(playedCard); + })); + } + + public override void PlaySkillSelectHandCardOperation(PlayHandCardReflection networkPlayCardAction, List choiceIdList = null) + { + List targetDataList = (_isPlayer ? _receivedData.PlayerTargetDataList : _receivedData.OpponentTargetDataList); + SetupNetworkPlayCardAction(networkPlayCardAction, targetDataList); + RegisterSequentialVfx(InstantVfx.Create(delegate + { + BattleCardBase playedCard = networkPlayCardAction.PlayAction(_isPlayer, choiceIdList); + IPlayerView playerBattleView = _networkBattleMgr.BattlePlayer.PlayerBattleView; + if (playerBattleView.DetailOpenCard != null && !playerBattleView.DetailOpenCard.IsClass) + { + HideDetailPanelOfPlayedCard(playedCard); + } + })); + } + + private void HideDetailPanelOfPlayedCard(BattleCardBase playedCard) + { + IPlayerView playerBattleView = _networkBattleMgr.BattlePlayer.PlayerBattleView; + if (playedCard == playerBattleView.DetailOpenCard && playerBattleView.DetailOpenCard != null && !playerBattleView.DetailOpenCard.IsClass) + { + _networkBattleMgr.BattlePlayer.PlayerBattleView.HideDetailPanel(); + } + } + + public override void InPlayActionOperation(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction) + { + LocalLog.AccumulateLastTraceLog("PlayActionsReceive"); + CheckStateAndCancel(networkPlayCardAction, networkInPlayAction, _isPlayer); + switch (_receivedData.actionType) + { + case NetworkBattleDefine.PlayActionType.PLAY_HAND: + if (_receivedData.IsChoiceBrave && (BattleManagerBase.GetIns().IsRecovery || (!_receivedData.isSelf && !GameMgr.GetIns().IsAdminWatch))) + { + ChoiceBraveOperation(networkPlayCardAction, _receivedData.choiceIdList); + } + else + { + PlayHandCardOperation(networkPlayCardAction, _receivedData.choiceIdList, _receivedData.IsChoice || _receivedData.IsChoiceBrave); + } + CallCompleteEvent(networkPlayCardAction); + break; + case NetworkBattleDefine.PlayActionType.PLAY_HAND_SELECT: + if (_receivedData.IsChoiceBrave && (BattleManagerBase.GetIns().IsRecovery || (!_receivedData.isSelf && !GameMgr.GetIns().IsAdminWatch))) + { + ChoiceBraveOperation(networkPlayCardAction, _receivedData.choiceIdList); + } + else + { + PlaySkillSelectHandCardOperation(networkPlayCardAction, _receivedData.choiceIdList); + } + CallCompleteEvent(networkPlayCardAction); + break; + case NetworkBattleDefine.PlayActionType.ATTACK: + case NetworkBattleDefine.PlayActionType.EVOLUTION: + case NetworkBattleDefine.PlayActionType.EVOLUTION_SELECT: + { + PlayCancelSlide(); + List action = (_isPlayer ? _receivedData.PlayerTargetDataList : _receivedData.OpponentTargetDataList); + networkInPlayAction.ReadySetting(action, _receivedData.actionType, _receivedData.playCardIndex); + networkInPlayAction.Play(_isPlayer, _receivedData.choiceIdList, _receivedData.IsChoice); + CallCompleteEvent(networkInPlayAction); + break; + } + case NetworkBattleDefine.PlayActionType.FUSION: + FusionCardOperation(networkPlayCardAction, _isPlayer, _isPlayer ? _receivedData.PlayerTargetDataList : _receivedData.OpponentTargetDataList); + CallCompleteEvent(networkPlayCardAction); + break; + } + } + + protected virtual void CallCompleteEvent(ReceivePlayActionsReflectionBase networkAction) + { + if (networkAction.CompleteSelectDataIns != null) + { + _networkBattleMgr.VfxMgr.RegisterSequentialVfx((networkAction.CompleteSelectDataIns.PlayCardVfx == null) ? NullVfx.GetInstance() : networkAction.CompleteSelectDataIns.PlayCardVfx); + networkAction.CompleteSelectDataIns = null; + } + if (networkAction.CompleteChoiceDataIns != null) + { + _networkBattleMgr.VfxMgr.RegisterSequentialVfx((networkAction.CompleteChoiceDataIns.PlayCardVfx == null) ? NullVfx.GetInstance() : networkAction.CompleteChoiceDataIns.PlayCardVfx); + networkAction.CompleteChoiceDataIns = null; + } + networkAction.CurrentState = ReceivePlayActionsReflectionBase.SelectChoiceState.NONE; + } + + protected virtual void PlayCancelSlide() + { + _watchBattleMgr.SlideObjectReceiveCtrl.CancelSlide(); + } + + public override void RetireOperation() + { + _networkBattleMgr.ReceiveRetire(_isPlayer); + } + + public override void ChatStampOperation() + { + ClassCharaPrm.EmotionType result2; + if (_isPlayer) + { + if (Enum.TryParse(_receivedData.playChatStamp.ToString(), out var result) && !ClassCharaPrm.IsEvolutionEmotionType(result)) + { + VfxBase vfx = _networkBattleMgr.BattlePlayer.Emotion.PlayEmotion(result, 1.5f); + _networkBattleMgr.VfxMgr.RegisterSequentialVfx(vfx); + } + } + else if (Enum.TryParse(_receivedData.oppoChatStamp.ToString(), out result2) && !ClassCharaPrm.IsEvolutionEmotionType(result2)) + { + VfxBase vfx2 = _networkBattleMgr.BattleEnemy.Emotion.PlayEmotion(result2, 1.5f); + _networkBattleMgr.VfxMgr.RegisterSequentialVfx(vfx2); + } + } + + public override void DataInconsistencyBattleEndOperation() + { + JudgeEndTypeToLose(_receivedData.judgeEndType); + } + + public override void TouchOperation() + { + if (_lastIndex != _receivedData.idx) + { + bool isSelf = _receivedData.isSelf; + _lastIndex = _receivedData.idx; + BattleCardBase battleCardBase = _networkBattleMgr.GetBattlePlayer(isSelf).HandCardList.Find((BattleCardBase c) => c.Index == _lastIndex); + if (battleCardBase != null && battleCardBase.BattleCardView.GameObject != null) + { + _networkBattleMgr.VfxMgr.RegisterSequentialVfx(_networkBattleMgr.GetBattlePlayer(isSelf).BattleView.HandView.AsyncTouchCard(battleCardBase.BattleCardView.GameObject)); + _networkBattleMgr.VfxMgr.RegisterSequentialVfx(WaitVfx.Create(0.3f)); + } + } + } + + public override void SelectSkillOperation(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction) + { + ReceivePlayActionsReflectionBase receivePlayActionsReflectionBase = ((!_receivedData._isEvolveTargetSelect) ? ((ReceivePlayActionsReflectionBase)networkPlayCardAction) : ((ReceivePlayActionsReflectionBase)networkInPlayAction)); + switch (_receivedData._selectSkillOperation) + { + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartSelect: + CheckStateAndCancel(networkPlayCardAction, networkInPlayAction, _receivedData.isSelf); + receivePlayActionsReflectionBase.CurrentState = ReceivePlayActionsReflectionBase.SelectChoiceState.SELECT; + _watchBattleMgr.SlideObjectReceiveCtrl.CancelSlide(); + receivePlayActionsReflectionBase.StartSelect(_receivedData.idx, _receivedData.isSelf); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectCard: + receivePlayActionsReflectionBase.SelectCard(_receivedData._selectedCardIndex, IsTargetSelf(), _receivedData._isEvolveTargetSelect, _receivedData.isSelf, _receivedData._isBurialRiteSelect, isChoiceBrave: false, isComplete: false); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CompleteSelect: + receivePlayActionsReflectionBase.CurrentState = ReceivePlayActionsReflectionBase.SelectChoiceState.NONE; + receivePlayActionsReflectionBase.CompleteSelectCard(_receivedData._selectedCardIndex, IsTargetSelf(), _receivedData._isEvolveTargetSelect, _receivedData.isSelf, _receivedData._isBurialRiteSelect, _receivedData.IsChoiceBraveSelect); + _watchBattleMgr.GetBattlePlayer(_isPlayer).BattleView.ClearSelectSkillActCard(); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CancelSelect: + receivePlayActionsReflectionBase.CurrentState = ReceivePlayActionsReflectionBase.SelectChoiceState.NONE; + receivePlayActionsReflectionBase.CancelSelect(_receivedData.isSelf); + _watchBattleMgr.GetBattlePlayer(_isPlayer).BattleView.ClearSelectSkillActCard(); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartChoiceSelect: + CheckStateAndCancel(networkPlayCardAction, networkInPlayAction, _receivedData.isSelf); + receivePlayActionsReflectionBase.CurrentState = ReceivePlayActionsReflectionBase.SelectChoiceState.CHOICE; + _watchBattleMgr.SlideObjectReceiveCtrl.CancelSlide(); + receivePlayActionsReflectionBase.StartChoiceSelect(_receivedData.idx, _receivedData.isSelf); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectChoiceCard: + receivePlayActionsReflectionBase.WatchSelectChoiceCards(_receivedData._selectedChoiceCardIdList, _receivedData._isEvolveTargetSelect, _receivedData.isSelf); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CompleteChoiceSelect: + receivePlayActionsReflectionBase.CurrentState = ReceivePlayActionsReflectionBase.SelectChoiceState.NONE; + receivePlayActionsReflectionBase.CompleteChoiceCard(_receivedData._selectedChoiceCardIdList, _receivedData._isEvolveTargetSelect, _receivedData.isSelf); + receivePlayActionsReflectionBase.WatchSelectChoiceCards(_receivedData._selectedChoiceCardIdList, _receivedData._isEvolveTargetSelect, _receivedData.isSelf, isComplete: true); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CancelChoiceSelect: + receivePlayActionsReflectionBase.CurrentState = ReceivePlayActionsReflectionBase.SelectChoiceState.NONE; + receivePlayActionsReflectionBase.CancelChoiceSelect(_receivedData.isSelf); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.StartFusionSelect: + CheckStateAndCancel(networkPlayCardAction, networkInPlayAction, _receivedData.isSelf); + receivePlayActionsReflectionBase.CurrentState = ReceivePlayActionsReflectionBase.SelectChoiceState.FUSION; + _watchBattleMgr.SlideObjectReceiveCtrl.CancelSlide(); + receivePlayActionsReflectionBase.StartSelectFusion(_receivedData.idx, _receivedData.isSelf); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.SelectFusionIngredient: + receivePlayActionsReflectionBase.SelectFusionIngredientCard(_receivedData._selectedCardIndex, IsTargetSelf()); + break; + case NetworkBattleSender.SELECT_SKILL_OPERATION.CompleteFusionSelect: + receivePlayActionsReflectionBase.CurrentState = ReceivePlayActionsReflectionBase.SelectChoiceState.NONE; + receivePlayActionsReflectionBase.CompleteSelectFusionIngredientCard(_isPlayer); + _watchBattleMgr.GetBattlePlayer(_isPlayer).BattleView.ClearSelectSkillActCard(); + break; + default: + Debug.LogError("Invalid Select Skill Operation"); + break; + } + } + + protected virtual void CheckStateAndCancel(PlayHandCardReflection networkPlayCardAction, InPlayCardReflection networkInPlayAction, bool isPlayer) + { + if (networkPlayCardAction.CompleteSelectDataIns == null && networkPlayCardAction.CompleteChoiceDataIns == null && networkInPlayAction.CompleteSelectDataIns == null && networkInPlayAction.CompleteChoiceDataIns == null) + { + switch (networkPlayCardAction.CurrentState) + { + case ReceivePlayActionsReflectionBase.SelectChoiceState.SELECT: + case ReceivePlayActionsReflectionBase.SelectChoiceState.FUSION: + networkPlayCardAction.CancelSelect(isPlayer); + break; + case ReceivePlayActionsReflectionBase.SelectChoiceState.CHOICE: + networkPlayCardAction.CancelChoiceSelect(isPlayer); + break; + } + switch (networkInPlayAction.CurrentState) + { + case ReceivePlayActionsReflectionBase.SelectChoiceState.SELECT: + networkInPlayAction.CancelSelect(isPlayer); + break; + case ReceivePlayActionsReflectionBase.SelectChoiceState.CHOICE: + networkInPlayAction.CancelChoiceSelect(isPlayer); + break; + } + networkPlayCardAction.CurrentState = ReceivePlayActionsReflectionBase.SelectChoiceState.NONE; + networkInPlayAction.CurrentState = ReceivePlayActionsReflectionBase.SelectChoiceState.NONE; + } + } + + private bool IsTargetSelf() + { + if (_receivedData.isSelf) + { + if (_receivedData._isPlayerCard) + { + return true; + } + return false; + } + if (_receivedData._isPlayerCard) + { + return false; + } + return true; + } + + public override void SelectObjectOperation() + { + bool flag = _receivedData._isPlayerCard; + if (!_receivedData.isSelf) + { + flag = !flag; + } + BattlePlayerBase battlePlayer = _networkBattleMgr.GetBattlePlayer(flag); + switch (_receivedData._selectObjectTargetType) + { + case NetworkBattleSender.SELECT_OBJECT_TARGET_TYPE.Deselect: + _watchBattleMgr.ToggleSelectHandCardMove(null, _receivedData.isSelf); + break; + case NetworkBattleSender.SELECT_OBJECT_TARGET_TYPE.Select: + { + BattleCardBase indexToCardBase = NetworkBattleGenericTool.GetIndexToCardBase(_networkBattleMgr, battlePlayer, _receivedData.idx); + if (indexToCardBase != null && battlePlayer.HandCardList.Contains(indexToCardBase) && !_networkBattleMgr.IsSkillSelectTiming) + { + _watchBattleMgr.ToggleSelectHandCardMove(indexToCardBase, _receivedData.isSelf); + } + break; + } + default: + Debug.LogError("Invalid Select Object Target Type: " + _receivedData._selectObjectTargetType); + break; + } + } + + public override void TurnEndReady() + { + if (!_receivedData._isNotTurnEndReady) + { + TurnEndTimeController turnEndTimeController = _networkBattleMgr.turnEndTimeController; + turnEndTimeController.EndCountDown("WatchTurnEndReady"); + turnEndTimeController.StartCountDown("WatchTurnEndReady"); + float timeLeftLong = PlayerStaticData.UserTime.GetTimeLeftLong(_receivedData._timeSent); + turnEndTimeController.SetExtendTime(20f - timeLeftLong - turnEndTimeController.GetMaxSecond()); + } + } + + public override void SlideObject() + { + _watchBattleMgr.SlideObjectReceiveCtrl.SlideObjectReceiveAction(_receivedData); + } + + public override void BattleFinishOperation() + { + NetworkBattleReceiver.RESULT_CODE rESULT_CODE = _receivedData.result; + if (IsResultNotFinish(rESULT_CODE)) + { + rESULT_CODE = _receivedData.opponentResult; + switch (rESULT_CODE) + { + case NetworkBattleReceiver.RESULT_CODE.LifeWin: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.LifeLose; + break; + case NetworkBattleReceiver.RESULT_CODE.DeckoutWin: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.DeckoutLose; + break; + case NetworkBattleReceiver.RESULT_CODE.RetireWin: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.RetireLose; + break; + case NetworkBattleReceiver.RESULT_CODE.SpecialWin: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.SpecialLose; + break; + case NetworkBattleReceiver.RESULT_CODE.DisconnectWin: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.DisconnectLose; + break; + case NetworkBattleReceiver.RESULT_CODE.FirstcardWin: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.FirstcardLose; + break; + case NetworkBattleReceiver.RESULT_CODE.TurnendWin: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.TurnendLose; + break; + case NetworkBattleReceiver.RESULT_CODE.TurnstartWin: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.TurnstartLose; + break; + case NetworkBattleReceiver.RESULT_CODE.LifeLose: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.LifeWin; + break; + case NetworkBattleReceiver.RESULT_CODE.DeckoutLose: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.DeckoutWin; + break; + case NetworkBattleReceiver.RESULT_CODE.RetireLose: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.RetireWin; + break; + case NetworkBattleReceiver.RESULT_CODE.SpecialLose: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.SpecialWin; + break; + case NetworkBattleReceiver.RESULT_CODE.DisconnectLose: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.DisconnectWin; + break; + case NetworkBattleReceiver.RESULT_CODE.FirstcardLose: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.FirstcardWin; + break; + case NetworkBattleReceiver.RESULT_CODE.TurnendLose: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.TurnendWin; + break; + case NetworkBattleReceiver.RESULT_CODE.TurnstartLose: + rESULT_CODE = NetworkBattleReceiver.RESULT_CODE.TurnstartWin; + break; + } + } + _networkBattleMgr.JudgeResultReceive(rESULT_CODE, isNotStopCoroutine: true); + _networkBattleMgr.BattleFinishReceiveAfterFinishBattleSend(NetworkBattleSender.JUDGE_RESULT_STATUS.WatchJudgeResult, _isPlayer); + LocalLog.SendLastTraceLog(null); + } + + public override void MaintenanceOperation() + { + ToolboxGame.RealTimeNetworkAgent.StopNetworkBattle(); + ToolboxGame.RealTimeNetworkAgent.CallMaintenanceError(); + ToolboxGame.RealTimeNetworkAgent.DestroyObj(RealTimeNetworkAgent.DESTROY_OBJECT_LOG.WatchMaintenance); + } + + public override void JudgeResultOperation() + { + if (!IsResultNotFinish(_receivedData.result) || !IsResultNotFinish(_receivedData.opponentResult)) + { + BattleFinishOperation(); + } + } + + private bool IsResultNotFinish(NetworkBattleReceiver.RESULT_CODE result) + { + if (result == NetworkBattleReceiver.RESULT_CODE.NotFinish || result == NetworkBattleReceiver.RESULT_CODE.Error) + { + return true; + } + return false; + } + + protected override int GetPlayedCardIndex() + { + return _networkBattleData.GetPlayCardIndex(); + } + + public override void SendEcho() + { + _networkBattleMgr.ClearRegisterCardList(); + } +} diff --git a/SVSim.BattleEngine/Engine/WatchTouchControl.cs b/SVSim.BattleEngine/Engine/WatchTouchControl.cs new file mode 100644 index 0000000..65eb8cd --- /dev/null +++ b/SVSim.BattleEngine/Engine/WatchTouchControl.cs @@ -0,0 +1,122 @@ +using System.Linq; +using UnityEngine; +using Wizard.Battle.Touch; +using Wizard.Battle.View.Vfx; + +public class WatchTouchControl : NetworkTouchControl +{ + private const float IDLE_TIME = 20f; + + private const int IDLE_EMOTE_KIND = 3; + + private Coroutine idleTimeCoroutine; + + private ClassCharaPrm.EmotionType _previousEmotionType; + + public new bool notAttackFlag { private get; set; } + + public new bool notEmoteFlag { private get; set; } + + public new bool notDragPlayCardFlag { private get; set; } + + public new bool notEvolCardFlag { private get; set; } + + public WatchTouchControl(BattleManagerBase battleMgr, BattleCamera battleCamera, BackGroundBase backGround) + : base(battleMgr, battleCamera, backGround) + { + notAttackFlag = true; + notEmoteFlag = true; + notDragPlayCardFlag = true; + notEvolCardFlag = true; + } + + protected override bool IsFeasibleAttack() + { + if (notAttackFlag) + { + return false; + } + return base.IsFeasibleAttack(); + } + + protected override bool IsFeasibleEmote() + { + if (notEmoteFlag) + { + return false; + } + return base.IsFeasibleEmote(); + } + + protected override bool IsFeasiblePlayCard() + { + if (notDragPlayCardFlag) + { + return false; + } + return base.IsFeasiblePlayCard(); + } + + protected override bool IsFeasibleEvol() + { + if (notEvolCardFlag) + { + return false; + } + return base.IsFeasibleEvol(); + } + + protected override void StopDraggingArrow() + { + } + + protected override BattleCardBase GetHitCardFromRayCastHit(RaycastHit hit) + { + GameObject cardRootGameObject = hit.collider.gameObject.transform.parent.gameObject; + BattleCardBase battleCardBase = base.BattlePlayer.FindCardFromGameObject(cardRootGameObject); + if (battleCardBase != null) + { + return battleCardBase; + } + battleCardBase = base.BattlePlayer.BattleView.GetSelectCardList().FirstOrDefault((BattleCardBase s) => s.BattleCardView.GameObject == cardRootGameObject); + if (battleCardBase != null) + { + return battleCardBase; + } + BattleCardBase battleCardBase2 = base.BattleEnemy.FindCardFromGameObject(cardRootGameObject); + if (battleCardBase2 != null) + { + return battleCardBase2; + } + battleCardBase2 = base.BattleEnemy.BattleView.GetSelectCardList().FirstOrDefault((BattleCardBase s) => s.BattleCardView.GameObject == cardRootGameObject); + if (battleCardBase2 != null) + { + return battleCardBase2; + } + return null; + } + + protected override void WatchChoiceDetail(BattleCardBase hitCard, ParallelVfxPlayer parallelVfx) + { + if (hitCard != null && !hitCard.IsInHand && !hitCard.IsInDeck && !hitCard.IsInplay && !hitCard.IsDead) + { + _hitCard = hitCard; + SelectCardProcessor touchProcessor = new SelectCardProcessor(_battleMgr, _hitCard, _inputMgr, _pressedCard != null); + parallelVfx.Register(RegisterTouchProcessor(touchProcessor)); + if (hitCard.BattleCardView.Transform.localScale.x >= 1f) + { + StartOpenHandDetail(_hitCard, right: false); + } + } + } + + protected override void HideAlert() + { + _alertCard = null; + } + + protected override bool IsShowingAlert() + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/WatchTurnEndTimeController.cs b/SVSim.BattleEngine/Engine/WatchTurnEndTimeController.cs new file mode 100644 index 0000000..94979db --- /dev/null +++ b/SVSim.BattleEngine/Engine/WatchTurnEndTimeController.cs @@ -0,0 +1,27 @@ +public class WatchTurnEndTimeController : TurnEndTimeController +{ + protected override bool IsTurnTimeDecrement + { + get + { + return false; + } + set + { + } + } + + public WatchTurnEndTimeController(BattleManagerBase battleMgr, BattlePlayer battlePlayer, ITurnEndButtonUI turnEnd) + : base(battleMgr, battlePlayer, turnEnd) + { + } + + protected override bool CompulsionTurnEnd() + { + return false; + } + + protected override void UpdateTimerPosition(float timeDifference, bool isShowingAlert) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.AutoTest/AutoTestBattleMgr.cs b/SVSim.BattleEngine/Engine/Wizard.AutoTest/AutoTestBattleMgr.cs new file mode 100644 index 0000000..2e1c861 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.AutoTest/AutoTestBattleMgr.cs @@ -0,0 +1,103 @@ +using System.Collections.Generic; +using LitJson; +using UnityEngine; +using Wizard.Battle; +using Wizard.Battle.Operation; + +namespace Wizard.AutoTest; + +public static class AutoTestBattleMgr +{ + public class CardInfo : IBattleCardUniqueID + { + public string Name { get; private set; } + + public bool IsPlayer { get; private set; } + + public int Index { get; private set; } + + public int CardId { get; private set; } + + public int Cost { get; private set; } + + public int AddAtk { get; set; } + + public int AddLife { get; set; } + + public int ChangeClan { get; set; } + + public CardInfo(string cardName, int cardId = 0, int cost = -1, int addAtk = 0, int addLife = 0, int clan = 0) + { + Name = cardName; + IsPlayer = cardName[0] == 'p'; + Index = int.Parse(cardName.Substring(1)); + CardId = cardId; + Cost = cost; + AddAtk = addAtk; + AddLife = addLife; + ChangeClan = clan; + } + + public CardInfo(IReadOnlyBattleCardInfo cardInfo) + { + IsPlayer = cardInfo.IsPlayer; + Index = cardInfo.Index; + Name = cardInfo.GetName(); + CardId = cardInfo.CardId; + Cost = cardInfo.Cost; + } + } + + public static IEnumerable CreateOperationCommands(IEnumerable actionJsonDatas, bool startTurnIsPlayer) + { + bool currentTurnIsPlayer = startTurnIsPlayer; + foreach (JsonData actionJsonData in actionJsonDatas) + { + string text = actionJsonData["ope"].ToString(); + switch (text) + { + case "play": + yield return new PlayOperationCommand(actionJsonData); + break; + case "attack": + yield return new AttackOperationCommand(actionJsonData); + break; + case "evolve": + yield return new EvolveOperationCommand(actionJsonData); + break; + case "turn_end": + yield return new TurnEndOperationCommand(currentTurnIsPlayer); + currentTurnIsPlayer = !currentTurnIsPlayer; + break; + case "change_ai": + yield return new ChangeAIOperationCommand(actionJsonData); + break; + case "comp_fusion": + yield return new FusionOperationCommand(actionJsonData); + break; + default: + Debug.LogError("Auto test \"" + text + "\" is not supported."); + break; + } + } + } + + public static JsonData LoadJsonData(string filePath) + { + return JsonMapper.ToObject(Resources.Load(filePath).text); + } + + private static IEnumerable CreateDeckIds(JsonData playerJsonData) + { + JsonData deckJsonData = playerJsonData["deck"]; + if (deckJsonData.IsArray) + { + int deckCardCount = deckJsonData.Count; + for (int i = 0; i < deckCardCount; i++) + { + JsonData jsonData = deckJsonData[i]; + yield return jsonData["id"].ToInt(); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Card/IVirtualBattleCard.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Card/IVirtualBattleCard.cs new file mode 100644 index 0000000..d461172 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Card/IVirtualBattleCard.cs @@ -0,0 +1,6 @@ +namespace Wizard.Battle.Card; + +public interface IVirtualBattleCard +{ + bool UsedRandomSkill { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/MulliganMgrBase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/MulliganMgrBase.cs new file mode 100644 index 0000000..a027776 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/MulliganMgrBase.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.Battle.UI; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Mulligan; + +public abstract class MulliganMgrBase : IMulliganMgr +{ + protected OpponentMulliganCtrl _opponentMulliganControl; + + private const float MULLIGAN_LIMIT_TIME = 5f; + + private Coroutine mulliganTimeoutCoroutine; + + public PlayerMulliganCtrl PlayerMlgCtrl { get; protected set; } + + public OpponentMulliganCtrl OpponentMlgCtrl => _opponentMulliganControl; + + public IList AbandonList => PlayerMlgCtrl.AbandonList; + + public Action OnSubmit { get; set; } + + public VfxBase StartDeal(List playerDealIdxList, List oppoDealIdxList, SkillProcessor skillProcessor) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + parallelVfxPlayer.Register(InstantVfx.Create(StopTimeout)); + PlayerMlgCtrl.DealIdxList = playerDealIdxList; + _opponentMulliganControl.DealIdxList = oppoDealIdxList; + PlayerMlgCtrl.CreateMulliganDealList(playerDealIdxList); + _opponentMulliganControl.CreateMulliganDealList(oppoDealIdxList); + VfxBase instance = NullVfx.GetInstance(); + VfxBase instance2 = NullVfx.GetInstance(); + instance = PlayerMlgCtrl.StartMulliganVfx(skillProcessor); + instance2 = _opponentMulliganControl.StartMulliganVfx(skillProcessor); + parallelVfxPlayer.Register(instance); + parallelVfxPlayer.Register(instance2); + if (BattleManagerBase.GetIns().IsRecovery && Data.BattleRecoveryInfo.IsMulliganEnd) + { + return NullVfx.GetInstance(); + } + return parallelVfxPlayer; + } + + protected virtual void StartTimeout() + { + StopTimeout(); + mulliganTimeoutCoroutine = BattleCoroutine.GetInstance().StartCoroutine(MulliganNetworkTimeout()); + } + + protected virtual void StopTimeout() + { + if (mulliganTimeoutCoroutine != null) + { + BattleCoroutine.GetInstance().StopCoroutine(mulliganTimeoutCoroutine); + mulliganTimeoutCoroutine = null; + } + BattleManagerBase.GetIns().BattlePlayer.BattleView.HideAlertDialogue(); + } + + private IEnumerator MulliganNetworkTimeout() + { + long matchedTimer = TimeUtil.GetAbsoluteTime().Ticks; + do + { + yield return null; + if (BattleManagerBase.GetIns().IsBattleEnd) + { + StopTimeout(); + yield break; + } + } + while (!((float)NetworkUtility.GetTimeSpanSecond(matchedTimer) >= 5f)); + BattleManagerBase.GetIns().BattlePlayer.BattleView.ShowAlert(PanelMgr.BattleAlertType.DisconnectInfomationMulligan, isClass: false); + } + + public virtual VfxBase Submit(BattleManagerBase m_BtlMgrIns) + { + OnSubmit.Call(); + ImmediateVfxMgr.GetInstance().Register(PlayerMlgCtrl.MoveMulliganUIOutWhenSubmitMulligan()); + return NullVfx.GetInstance(); + } + + private void AddBattleLogMulliganResult(BattleManagerBase battleMgr) + { + BattleLogManager instance = BattleLogManager.GetInstance(); + instance.AddLogMulliganChanged(battleMgr.BattlePlayer, PlayerMlgCtrl.GetChangedNum()); + instance.AddLogMulliganChanged(battleMgr.BattleEnemy, OpponentMlgCtrl.GetChangedNum()); + } + + public virtual VfxBase PlayerChangeCardVfx(BattleManagerBase btlMgrIns) + { + VfxBase result = PlayerMlgCtrl.SubmitMulliganVfx(PlayerMlgCtrl.AbandonList); + List completeCards = btlMgrIns.BattlePlayer.HandCardList.Select((BattleCardBase c) => c.Index).ToList(); + btlMgrIns.BattlePlayer.CallRecordingMulligan(PlayerMlgCtrl.AbandonList, completeCards); + btlMgrIns.BattlePlayer.CallRecordingMulliganEnd(btlMgrIns.BattlePlayer.HandCardList); + return result; + } + + public abstract VfxBase EnemyChangeCardVfx(BattleManagerBase btlMgrIns); + + public virtual VfxBase CompleteMulligan(BattleManagerBase battleMgr) + { + if (!battleMgr.IsVirtualBattle && !GameMgr.GetIns().IsNewReplayBattle) + { + AddBattleLogMulliganResult(battleMgr); + } + return NullVfx.GetInstance(); + } + + public virtual VfxBase InitMulligan(MulliganInfoControl mulliganInfo, IPlayerView view) + { + PlayerMlgCtrl = new PlayerMulliganCtrl(BattleManagerBase.GetIns().BattlePlayer, mulliganInfo, view); + _opponentMulliganControl = new OpponentMulliganCtrl(BattleManagerBase.GetIns().BattleEnemy, mulliganInfo, isUseExchangeMark: false); + return NullVfx.GetInstance(); + } + + public virtual VfxBase MulliganStartDraw(bool firstAttack, SkillProcessor skillProcessor) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + VfxBase instance = NullVfx.GetInstance(); + VfxBase instance2 = NullVfx.GetInstance(); + if (firstAttack) + { + instance = PlayerMlgCtrl.StartMulliganVfx(skillProcessor); + instance2 = _opponentMulliganControl.StartMulliganVfx(skillProcessor); + } + else + { + instance2 = _opponentMulliganControl.StartMulliganVfx(skillProcessor); + instance = PlayerMlgCtrl.StartMulliganVfx(skillProcessor); + } + parallelVfxPlayer.Register(instance); + parallelVfxPlayer.Register(instance2); + return parallelVfxPlayer; + } + + public virtual VfxBase RecoverMulligan(bool didPlayerSubmitMulligan, BattleManagerBase battleMgr) + { + return NullVfx.GetInstance(); + } + + public MulliganInfoControl GetMulliganInfo() + { + return PlayerMlgCtrl.GetMulliganInfo(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/MulliganOperateControl.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/MulliganOperateControl.cs new file mode 100644 index 0000000..29aac9c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/MulliganOperateControl.cs @@ -0,0 +1,510 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Mulligan; + +public class MulliganOperateControl +{ + public enum STATE + { + WAIT, + CARD_SELECTED, + EXIT, + NONE + } + + private STATE _state; + + private InputMgr _inputManager; + + private PlayerMulliganCtrl _playerMulliganCtrl; + + protected PlayerMulliganView _mulliganView; + + protected IList PlayerFirstDrawCards; + + private BattleCardBase _touchingCard; + + private BattleCardBase _showDetailCard; + + private float _timeSamePosition; + + private Vector2 _idlePosition; + + private BattleCardBase _pressedCard; + + private const float SHOW_DETAIL_DELAY = 0f; + + private const int START_CARD_NUMBER = 0; + + private const int END_CARD_NUMBER = 2; + + private const int ENTER_MULLIGAN_NUMBER = 3; + + public STATE State => _state; + + public MulliganOperateControl(PlayerMulliganCtrl mulliganCtrl) + { + _inputManager = GameMgr.GetIns().GetInputMgr(); + _state = STATE.WAIT; + _playerMulliganCtrl = mulliganCtrl; + _mulliganView = mulliganCtrl.GetPlayerMulliganView(); + PlayerFirstDrawCards = mulliganCtrl.GetFirstDrawList(); + _mulliganView.MulliganInfo.OnTimeUp += ReturnOnMoveCardWhenMulliganPhaseEnd; + } + + public VfxBase Update() + { + return _state switch + { + STATE.WAIT => Wait(), + STATE.CARD_SELECTED => CardSelected(), + _ => Reset(), + }; + } + + private VfxBase Wait() + { + if (BattleManagerBase.UseCustomMouse) + { + if (_inputManager.IsDown()) + { + if ((_pressedCard = CheckCardCollision()) == null) + { + CheckDetailPanelCollision(); + } + } + else if (_inputManager.IsNone() || _inputManager.IsUp()) + { + _pressedCard = null; + } + if (_inputManager.IsDown()) + { + _showDetailCard = null; + } + if (_inputManager.IsClick() || (_inputManager.IsDownMoved() && _pressedCard != null)) + { + if (CanMoveCard()) + { + CheckSelectCard(); + } + } + else if (UseChangeShortcut()) + { + if (!BattleManagerBase.GetIns().VfxMgr.IsEnd) + { + return NullVfx.GetInstance(); + } + BattleCardBase battleCardBase = CheckCardCollision(); + if (_touchingCard == null && battleCardBase != null && !battleCardBase.IsOnDraw && !IsOnMoveFirstDrawCards()) + { + if (_showDetailCard != null) + { + _mulliganView.ShutDownCardDetail(); + _showDetailCard = null; + _idlePosition = _inputManager.GetPos(); + _timeSamePosition = 0f; + } + _touchingCard = battleCardBase; + return ChangeCardSide(); + } + } + else if (UseDetailShortcut()) + { + BattleCardBase battleCardBase2 = CheckCardCollision(); + if (battleCardBase2 != null && !battleCardBase2.IsOnMove && !battleCardBase2.IsOnDraw && battleCardBase2 != _showDetailCard) + { + _showDetailCard = battleCardBase2; + _mulliganView.ShowCardDetail(_showDetailCard); + } + } + else if (_inputManager.IsNone() && BattleManagerBase.GetIns().HasFocus && OptionSettingWindow.ShortcutDetailPanel == OptionSettingWindow.ShortcutDetail.Auto) + { + RaycastHit[] hits = _mulliganView.ConvertMousePositionToFrontUIRaycastHits(Input.mousePosition); + if (!IsTouchingDetail(hits)) + { + if (_idlePosition == _inputManager.GetPos()) + { + _timeSamePosition += Time.deltaTime; + if (_timeSamePosition > 0f && _showDetailCard == null) + { + BattleCardBase battleCardBase3 = CheckCardCollision(); + if (battleCardBase3 != null && !battleCardBase3.IsOnMove && !battleCardBase3.IsOnDraw) + { + _showDetailCard = battleCardBase3; + _mulliganView.ShowCardDetail(_showDetailCard); + } + } + } + else if (_showDetailCard != null) + { + BattleCardBase battleCardBase4 = CheckCardCollision(); + if (battleCardBase4 != _showDetailCard && battleCardBase4 != null && !battleCardBase4.IsOnDraw) + { + _showDetailCard = null; + _mulliganView.ShutDownCardDetail(); + _idlePosition = _inputManager.GetPos(); + _timeSamePosition = 0f; + } + } + else + { + _idlePosition = _inputManager.GetPos(); + _timeSamePosition = 0f; + } + } + } + return NullVfx.GetInstance(); + } + if (_inputManager.IsDown()) + { + CheckSelectCard(); + } + return NullVfx.GetInstance(); + } + + private void CheckSelectCard() + { + if (_touchingCard != null) + { + return; + } + BattleCardBase battleCardBase = CheckCardCollision(); + if (battleCardBase != null) + { + if (battleCardBase.IsOnMove || battleCardBase.IsOnDraw) + { + return; + } + RaycastHit[] hits = _mulliganView.ConvertMousePositionToFrontUIRaycastHits(Input.mousePosition); + if (!IsTouchingDetail(hits)) + { + _touchingCard = battleCardBase; + _state = STATE.CARD_SELECTED; + if (BattleManagerBase.UseCustomMouse) + { + SetCardDragable(); + } + } + } + else + { + CheckDetailPanelCollision(); + } + } + + private void CheckDetailPanelCollision() + { + RaycastHit[] hits = _mulliganView.ConvertMousePositionToFrontUIRaycastHits(Input.mousePosition); + if (!IsTouchingDetail(hits) && !UIManager.GetInstance().isOpenDialog()) + { + _mulliganView.ShutDownCardDetail(); + } + } + + private BattleCardBase CheckCardCollision() + { + RaycastHit[] hits = _mulliganView.ConvertMousePositionToRayCastHits(Input.mousePosition); + if (IsTouchingSystemUI(hits)) + { + return null; + } + return GetTouchedCardFromRaycast(hits); + } + + private VfxBase CardSelected() + { + if (UIManager.GetInstance().IsQuitDialog()) + { + return PutDownCard(); + } + Vector3 mousePosition = Input.mousePosition; + if (BattleManagerBase.UseCustomMouse && UseChangeShortcutDoubleClick()) + { + if (_touchingCard != null && !_touchingCard.IsOnDraw) + { + return ChangeCardSide(); + } + } + else if (BattleManagerBase.UseCustomMouse && UseDetailShortcutDoubleClick()) + { + if (_touchingCard != null && !_touchingCard.IsOnDraw) + { + _mulliganView.ShowCardDetail(_touchingCard); + return PutDownCard(); + } + } + else + { + if (IsWantToPutDownCard()) + { + return PutDownCard(); + } + if (CanMoveCard()) + { + if (_touchingCard == null) + { + return NullVfx.GetInstance(); + } + if (_touchingCard.IsOnDraw) + { + return NullVfx.GetInstance(); + } + if (_touchingCard.IsOnMove) + { + MoveMulliganCard(mousePosition); + } + else if (_inputManager.IsOverDragDistanceMulligan()) + { + SetCardDragable(); + } + else if (BattleManagerBase.UseCustomMouse && UseChangeShortcut()) + { + return ChangeCardSide(); + } + } + } + return NullVfx.GetInstance(); + } + + protected virtual void MoveMulliganCard(Vector3 mousePosition) + { + Vector3 position = new Vector3(mousePosition.x, mousePosition.y, 1.5f); + Vector3 worldPointInMulliganUICamera = _mulliganView.GetWorldPointInMulliganUICamera(position); + _mulliganView.DragCard(_touchingCard, worldPointInMulliganUICamera); + } + + private VfxBase Reset() + { + _state = STATE.WAIT; + return NullVfx.GetInstance(); + } + + protected virtual VfxBase PutDownCard() + { + _state = STATE.EXIT; + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (_touchingCard != null) + { + BattleCardBase touchingCard = _touchingCard; + _touchingCard = null; + if (touchingCard.IsOnMove) + { + bool isAtAbandonZone = _playerMulliganCtrl.AbandonList.Contains(touchingCard); + int posIndex = PlayerFirstDrawCards.IndexOf(touchingCard); + if (IsTouchingAbandonZone(Input.mousePosition, isAtAbandonZone)) + { + sequentialVfxPlayer.Register(_mulliganView.MoveCardToStaticPosition(touchingCard, posIndex, isAbandon: true)); + _playerMulliganCtrl.RegisterAbandonCard(touchingCard); + } + else + { + sequentialVfxPlayer.Register(_mulliganView.MoveCardToStaticPosition(touchingCard, posIndex, isAbandon: false)); + _playerMulliganCtrl.TakeOutAbandonCard(touchingCard); + } + } + else + { + _mulliganView.ShowCardDetail(touchingCard); + } + } + return sequentialVfxPlayer; + } + + public VfxBase ReturnOnMoveCardWhenMulliganPhaseEnd() + { + if (_touchingCard != null && _touchingCard.IsOnMove) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (_playerMulliganCtrl.AbandonList.Contains(_touchingCard)) + { + _playerMulliganCtrl.AbandonList.Remove(_touchingCard); + } + int posIndex = PlayerFirstDrawCards.IndexOf(_touchingCard); + sequentialVfxPlayer.Register(_mulliganView.MoveCardToStaticPosition(_touchingCard, posIndex, isAbandon: false)); + sequentialVfxPlayer.Register(WaitVfx.Create(0.3f)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + _mulliganView.DragCardStop(_touchingCard); + })); + return sequentialVfxPlayer; + } + return NullVfx.GetInstance(); + } + + private BattleCardBase GetTouchedCardFromRaycast(RaycastHit[] hits) + { + int num = hits.Length; + for (int i = 0; i < num; i++) + { + RaycastHit hit = hits[i]; + BattleCardBase hitCard = GetHitCard(hit); + if (hitCard != null && IsCardDraggable(hitCard)) + { + return hitCard; + } + } + return null; + } + + protected virtual bool IsCardDraggable(BattleCardBase hitCard) + { + return PlayerFirstDrawCards.Contains(hitCard); + } + + public bool IsOnMoveFirstDrawCards() + { + return PlayerFirstDrawCards.Any((BattleCardBase c) => c.IsOnMove); + } + + private BattleCardBase GetHitCard(RaycastHit hit) + { + if (hit.collider.CompareTag("Player") || hit.collider.CompareTag("Enemy") || hit.collider.CompareTag("PlayerToken")) + { + GameObject gameObject = hit.collider.transform.parent.gameObject; + if (gameObject.layer == 10) + { + BattleCardBase battleCard = gameObject.GetBattleCard(); + if (battleCard != null) + { + return battleCard; + } + } + } + return null; + } + + private bool IsTouchingDetail(RaycastHit[] hits) + { + int num = hits.Length; + for (int i = 0; i < num; i++) + { + RaycastHit raycastHit = hits[i]; + if (raycastHit.collider.CompareTag("DetailPanel") && raycastHit.collider.gameObject.layer == 26) + { + return true; + } + } + return false; + } + + private bool IsTouchingSystemUI(RaycastHit[] hits) + { + int num = hits.Length; + for (int i = 0; i < num; i++) + { + RaycastHit raycastHit = hits[i]; + if (raycastHit.collider.gameObject.layer == 22) + { + return true; + } + } + return false; + } + + protected bool IsTouchingAbandonZone(Vector3 mousePosition, bool isAtAbandonZone) + { + if (isAtAbandonZone) + { + return !_mulliganView.MulliganInfo.IsLeavingAbandonZone(mousePosition); + } + return _mulliganView.MulliganInfo.IsLeavingKeepZone(mousePosition); + } + + private bool IsWantToPutDownCard() + { + if (BattleManagerBase.UseCustomMouse) + { + if (!_inputManager.IsUp() && !_inputManager.IsDoubleClick()) + { + return _inputManager.IsClick(); + } + return true; + } + if (!_inputManager.IsUp()) + { + return _inputManager.IsNone(); + } + return true; + } + + protected virtual bool CanMoveCard() + { + if (BattleManagerBase.UseCustomMouse) + { + return true; + } + return _inputManager.IsPress(); + } + + protected virtual VfxBase ChangeCardSide() + { + _state = STATE.EXIT; + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattleCardBase touchingCard = _touchingCard; + _touchingCard = null; + bool num = _playerMulliganCtrl.AbandonList.Contains(touchingCard); + int num2 = PlayerFirstDrawCards.IndexOf(touchingCard); + _mulliganView.MulliganInfo.SetExchangeMarkPlayer(num2, on: false); + if (!num) + { + sequentialVfxPlayer.Register(_mulliganView.MoveCardToStaticPosition(touchingCard, num2, isAbandon: true)); + _playerMulliganCtrl.RegisterAbandonCard(touchingCard); + } + else + { + sequentialVfxPlayer.Register(_mulliganView.MoveCardToStaticPosition(touchingCard, num2, isAbandon: false)); + _playerMulliganCtrl.TakeOutAbandonCard(touchingCard); + } + return sequentialVfxPlayer; + } + + protected virtual void SetCardDragable() + { + int index = PlayerFirstDrawCards.IndexOf(_touchingCard); + _mulliganView.MulliganInfo.SetExchangeMarkPlayer(index, on: false); + _mulliganView.DragCardStart(_touchingCard); + _mulliganView.ShutDownCardDetail(); + } + + private bool UseChangeShortcut() + { + return OptionSettingWindow.ShortcutPlay switch + { + OptionSettingWindow.Shortcut.RightClick => Input.GetMouseButtonDown(1), + OptionSettingWindow.Shortcut.MiddleClick => Input.GetMouseButtonDown(2), + _ => false, + }; + } + + private bool UseChangeShortcutDoubleClick() + { + if (OptionSettingWindow.ShortcutPlay == OptionSettingWindow.Shortcut.DoubleClick) + { + return _inputManager.IsDoubleClick(); + } + return false; + } + + private bool UseDetailShortcut() + { + return OptionSettingWindow.ShortcutDetailPanel switch + { + OptionSettingWindow.ShortcutDetail.RightClick => Input.GetMouseButtonDown(1), + OptionSettingWindow.ShortcutDetail.MiddleClick => Input.GetMouseButtonDown(2), + OptionSettingWindow.ShortcutDetail.LongPress => _inputManager.IsLongPress(), + _ => false, + }; + } + + private bool UseDetailShortcutDoubleClick() + { + if (OptionSettingWindow.ShortcutDetailPanel == OptionSettingWindow.ShortcutDetail.DoubleClick) + { + return _inputManager.IsDoubleClick(); + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/NetworkMulliganMgr.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/NetworkMulliganMgr.cs new file mode 100644 index 0000000..0595448 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/NetworkMulliganMgr.cs @@ -0,0 +1,133 @@ +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Mulligan; + +public class NetworkMulliganMgr : MulliganMgrBase +{ + private readonly NetworkBattleManagerBase _networkBattleManager; + + private readonly NetworkBattleSender _networkBattleSender; + + public NetworkMulliganMgr(NetworkBattleSender sender) + { + _networkBattleSender = sender; + _networkBattleManager = BattleManagerBase.GetIns() as NetworkBattleManagerBase; + } + + public override VfxBase InitMulligan(MulliganInfoControl mulliganInfo, IPlayerView view) + { + base.PlayerMlgCtrl = new NetworkPlayerMulliganCtrl(BattleManagerBase.GetIns().BattlePlayer, mulliganInfo, view); + _opponentMulliganControl = new NetworkOpponentMulliganCtrl(BattleManagerBase.GetIns().BattleEnemy, mulliganInfo, isUseExchangeMark: false); + return NullVfx.GetInstance(); + } + + public override VfxBase MulliganStartDraw(bool firstAttack, SkillProcessor skillProcessor) + { + if (_networkBattleManager.OperateReceive.DealVfx != null) + { + return _networkBattleManager.OperateReceive.DealVfx; + } + _networkBattleSender.SendDeal(); + return InstantVfx.Create(StartTimeout); + } + + public override VfxBase Submit(BattleManagerBase m_BtlMgrIns) + { + List swapIndexList = base.PlayerMlgCtrl.AbandonList.Select((BattleCardBase x) => x.Index).ToList(); + _networkBattleSender.SendSwapInfo(swapIndexList); + StartTimeout(); + return base.Submit(m_BtlMgrIns); + } + + public void SetPlayerHandCardIndexList(List list) + { + base.PlayerMlgCtrl.SetMulliganAfterCardIndexList(list); + } + + public void SetOpponentMulliganAfterCardIndexList(List list) + { + _opponentMulliganControl.SetMulliganAfterCardIndexList(list); + } + + public override VfxBase PlayerChangeCardVfx(BattleManagerBase btlMgrIns) + { + StopTimeout(); + if (!btlMgrIns.IsRecovery) + { + return base.PlayerChangeCardVfx(btlMgrIns); + } + List retCardList = null; + List retPosList = null; + base.PlayerMlgCtrl.GetAbandonCardList(btlMgrIns, ref retCardList, ref retPosList); + btlMgrIns.BattlePlayer.CallRecordingMulligan(retCardList, new int[0]); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(base.PlayerMlgCtrl.SubmitMulliganVfx(retCardList)); + btlMgrIns.BattlePlayer.CallRecordingMulliganEnd(btlMgrIns.BattlePlayer.HandCardList); + return sequentialVfxPlayer; + } + + public override VfxBase EnemyChangeCardVfx(BattleManagerBase btlMgrIns) + { + List retCardList = null; + List retPosList = null; + _opponentMulliganControl.GetAbandonCardList(btlMgrIns, ref retCardList, ref retPosList); + _opponentMulliganControl.DrawFirstMulliganCard(); + btlMgrIns.BattleEnemy.CallRecordingMulligan(retCardList, _opponentMulliganControl.GetMulliganAfterCardIndexList()); + btlMgrIns.BattleEnemy.CallRecordingMulliganEnd(_opponentMulliganControl.GetMulliganAfterCardIndexList()); + return _opponentMulliganControl.SubmitMulliganVfx(retCardList); + } + + public override VfxBase CompleteMulligan(BattleManagerBase battleMgr) + { + LocalLog.AccumulateLastTraceLog("CompleteMulligan"); + VfxBase vfx = base.CompleteMulligan(battleMgr); + battleMgr.TouchControl.ResetDetail(); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(vfx); + sequentialVfxPlayer.Register(battleMgr.StartBattle()); + return sequentialVfxPlayer; + } + + public override VfxBase RecoverMulligan(bool didPlayerSubmitMulligan, BattleManagerBase battleMgr) + { + if (!didPlayerSubmitMulligan) + { + return NullVfx.GetInstance(); + } + MulliganInfoControl mulliganInfo = GetMulliganInfo(); + List firstDrawList = base.PlayerMlgCtrl.GetFirstDrawList(); + List stockList = base.PlayerMlgCtrl.GetStockList(); + base.OnSubmit.Call(); + mulliganInfo.HideButtons(); + if (stockList.Count < 3) + { + mulliganInfo.GetAbandonZonePlayer().alpha = 0f; + } + List list = new List(); + List handCardList = base.PlayerMlgCtrl.GetBattlePlayer().HandCardList; + for (int i = 0; i < handCardList.Count; i++) + { + if (firstDrawList[i] != handCardList[i]) + { + BattleCardBase battleCardBase = firstDrawList[i]; + battleCardBase.BattleCardView.GameObject.SetActive(value: false); + battleCardBase.BattleCardView.Transform.SetParent(battleMgr.CardHolder.transform); + battleCardBase.BattleCardView.Transform.position = battleMgr.CardHolder.transform.position; + list.Add(handCardList[i]); + } + IBattleCardView battleCardView = handCardList[i].BattleCardView; + battleCardView.Transform.SetParent(mulliganInfo.GetKeepZonePlayer().gameObject.transform); + battleCardView.Transform.localPosition = mulliganInfo.GetMulliganZoneCardPos(i, isAbandon: false, handCardList[i].IsPlayer); + battleCardView.Transform.localScale = mulliganInfo.GetMulliganZoneCardScale(); + battleCardView.Transform.localRotation = Quaternion.Euler(MulliganViewBase.CARD_ROTATION); + battleCardView.GameObject.SetActive(value: true); + } + DummyDeckRemoveCardVfx dummyDeckRemoveCardVfx = new DummyDeckRemoveCardVfx(isPlayer: true, 3); + return ParallelVfxPlayer.Create(dummyDeckRemoveCardVfx, _networkBattleManager.LoadCardResources(list)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/OpponentMulliganView.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/OpponentMulliganView.cs new file mode 100644 index 0000000..5024c1b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/OpponentMulliganView.cs @@ -0,0 +1,44 @@ +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Mulligan; + +public class OpponentMulliganView : MulliganViewBase +{ + private bool _isUseExchangeMark; + + public OpponentMulliganView(MulliganInfoControl mulliganInfo, bool isUseExchangeMark) + : base(mulliganInfo) + { + _isUseExchangeMark = isUseExchangeMark; + } + + public override SequentialVfxPlayer MoveCardToStaticPosition(BattleCardBase card, int posIndex, bool isAbandon) + { + SequentialVfxPlayer sequentialVfxPlayer = base.MoveCardToStaticPosition(card, posIndex, isAbandon); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + card.SetOnMove(move: false); + if (_isUseExchangeMark && isAbandon) + { + m_MlgUI.SetExchangeMarkOpponent(posIndex, on: true); + } + })); + return sequentialVfxPlayer; + } + + protected override GameObject GetMulliganUIKeepZone() + { + return m_MlgUI.GetKeepZoneOpponent().gameObject; + } + + protected override GameObject GetMulliganUIAbandonZone() + { + return m_MlgUI.GetAbandonZoneOpponent().gameObject; + } + + public override void HideMulliganUIAbandonZone() + { + m_MlgUI.HideMulliganOpponentChangeUI(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/PlayerMulliganCardSortOutVfx.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/PlayerMulliganCardSortOutVfx.cs new file mode 100644 index 0000000..4c6e42a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/PlayerMulliganCardSortOutVfx.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Mulligan; + +public class PlayerMulliganCardSortOutVfx : SequentialVfxPlayer +{ + public PlayerMulliganCardSortOutVfx(GameObject keepZone, IList firstDraws, MulliganInfoControl mulliganUI) + { + Register(ShiftParentVfx(keepZone, firstDraws)); + Register(SortOutCardVfx(keepZone, firstDraws, mulliganUI)); + } + + private VfxBase ShiftParentVfx(GameObject keepZone, IList firstDraws) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + int count = firstDraws.Count; + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + for (int i = 0; i < count; i++) + { + GameObject gameObject = firstDraws[i].BattleCardView.GameObject; + gameObject.SetActive(value: false); + gameObject.transform.parent = keepZone.transform; + MotionUtils.SetLayerAll(gameObject, 10); + gameObject.SetActive(value: true); + } + })); + return sequentialVfxPlayer; + } + + private VfxBase SortOutCardVfx(GameObject keepZone, IList firstDraws, MulliganInfoControl mulliganUI) + { + LocalLog.AccumulateLastTraceLog("SortOutCardVfx"); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + int count = firstDraws.Count; + for (int i = 0; i < count; i++) + { + parallelVfxPlayer.Register(MulliganViewBase.MoveCardToMulliganZone(firstDraws[i], keepZone, i, mulliganUI, isAbandon: false)); + } + if (BattleManagerBase.GetIns().IsRecovery) + { + return parallelVfxPlayer; + } + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_HAND_MOVE_RIGHT); + })); + return parallelVfxPlayer; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/SingleMulliganMgr.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/SingleMulliganMgr.cs new file mode 100644 index 0000000..91d9981 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/SingleMulliganMgr.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Mulligan; + +public class SingleMulliganMgr : MulliganMgrBase +{ + public override VfxBase Submit(BattleManagerBase battleManager) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(base.Submit(battleManager)); + if (GameMgr.GetIns().IsAINetwork && !battleManager.IsRecovery) + { + sequentialVfxPlayer.Register(parallelVfxPlayer); + return sequentialVfxPlayer; + } + parallelVfxPlayer.Register(PlayerChangeCardVfx(battleManager)); + parallelVfxPlayer.Register(EnemyChangeCardVfx(battleManager)); + sequentialVfxPlayer.Register(parallelVfxPlayer); + sequentialVfxPlayer.Register(CompleteMulligan(battleManager)); + return sequentialVfxPlayer; + } + + public override VfxBase InitMulligan(MulliganInfoControl mulliganInfo, IPlayerView view) + { + VfxBase result = base.InitMulligan(mulliganInfo, view); + if (GameMgr.GetIns().IsAINetwork && !BattleManagerBase.GetIns().IsRecovery) + { + ((AINetworkBattleManager)BattleManagerBase.GetIns()).SetupMulliganLaunchCompleteEvent(); + } + return result; + } + + public void AIMulliganEndAction() + { + BattleManagerBase ins = BattleManagerBase.GetIns(); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + parallelVfxPlayer.Register(PlayerChangeCardVfx(ins)); + parallelVfxPlayer.Register(EnemyChangeCardVfx(ins)); + sequentialVfxPlayer.Register(parallelVfxPlayer); + sequentialVfxPlayer.Register(CompleteMulligan(ins)); + ins.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer); + } + + public override VfxBase EnemyChangeCardVfx(BattleManagerBase btlMgrIns) + { + List list = new List(); + btlMgrIns.EnemyAI.Mulligan(list, btlMgrIns.BattleEnemy, btlMgrIns.BattlePlayer); + VfxBase result = _opponentMulliganControl.SubmitMulliganVfx(list); + btlMgrIns.BattleEnemy.CallRecordingMulligan(list, btlMgrIns.BattleEnemy.HandCardList.Select((BattleCardBase c) => c.Index).ToList()); + return result; + } + + public override VfxBase MulliganStartDraw(bool firstAttack, SkillProcessor skillProcessor) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(base.MulliganStartDraw(firstAttack, skillProcessor)); + _opponentMulliganControl.GetBattlePlayer().DrawCards(_opponentMulliganControl.GetFirstDrawList(), skillProcessor, isOpen: false, isMulligan: true); + return sequentialVfxPlayer; + } + + public override VfxBase CompleteMulligan(BattleManagerBase battleMgr) + { + VfxBase vfx = base.CompleteMulligan(battleMgr); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(vfx); + sequentialVfxPlayer.Register(battleMgr.StartBattle()); + return sequentialVfxPlayer; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/OperationSimulator.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/OperationSimulator.cs new file mode 100644 index 0000000..fa7c417 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/OperationSimulator.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; +using Cute; + +namespace Wizard.Battle.Operation; + +public static class OperationSimulator +{ + public static BattlePlayerPair Attack(BattlePlayerPair sourcePair, IBattleCardUniqueID attackCardId, IBattleCardUniqueID targetCardId, bool isPrediction = false, Action OnVirtualPairCloned = null) + { + BattleManagerBase.IsForecast = true; + bool isRecovery = BattleManagerBase.GetIns().IsRecovery; + BattleManagerBase.GetIns().IsRecovery = true; + BattlePlayerPair battlePlayerPair = sourcePair.VirtualClone(CloneActualFlags.All); + OnVirtualPairCloned?.Call(battlePlayerPair); + if (isPrediction) + { + Prediction.ChangeFilters(battlePlayerPair); + } + Prediction.CloneSkillsPreprocessAndBuffInfo(sourcePair, battlePlayerPair); + new ActionProcessor(battlePlayerPair).Attack(attackCardId, targetCardId); + BattleManagerBase.GetIns().IsRecovery = isRecovery; + BattleManagerBase.IsForecast = false; + return battlePlayerPair; + } + + public static BattlePlayerPair Play(BattlePlayerPair sourcePair, IBattleCardUniqueID playCardId, List skillTargets, Action OnVirtualPairCloned = null, Action playCardSkillEvent = null) + { + BattleManagerBase.IsForecast = true; + bool isRecovery = BattleManagerBase.GetIns().IsRecovery; + BattleManagerBase.GetIns().IsRecovery = true; + BattlePlayerPair battlePlayerPair = sourcePair.VirtualClone(CloneActualFlags.All); + OnVirtualPairCloned?.Call(battlePlayerPair); + Prediction.CloneSkillsPreprocessAndBuffInfo(sourcePair, battlePlayerPair); + List first = Play_GetTargetsAndChoice(battlePlayerPair, skillTargets).first; + ActionProcessor actionProcessor = new ActionProcessor(battlePlayerPair); + BattleCardBase battleCardBase = battlePlayerPair.Self.HandCardList.FindFromCardId(playCardId); + playCardSkillEvent?.Call(battleCardBase); + battlePlayerPair.Self.SetupActionProcessorEvent(actionProcessor); + battlePlayerPair.Opponent.SetupActionProcessorEvent(actionProcessor); + actionProcessor.PlayCard(battleCardBase, first); + BattleManagerBase.GetIns().IsRecovery = isRecovery; + BattleManagerBase.IsForecast = false; + return battlePlayerPair; + } + + public static Tuple, List> Play_GetTargetsAndChoice(BattlePlayerPair virtualPair, List skillTargets) + { + List list = null; + List list2 = null; + if (skillTargets.IsNotNullOrEmpty()) + { + list = new List(); + foreach (BattleCardBase skillTarget in skillTargets) + { + BattleCardBase battleCardBase = FindSkillTargetCard(virtualPair, skillTarget); + if (battleCardBase == null) + { + list.Add(skillTarget); + if (list2 == null) + { + list2 = new List(); + } + list2.Add(skillTarget.Index); + } + else + { + list.Add(battleCardBase); + } + } + } + return new Tuple, List>(list, list2); + } + + public static BattlePlayerPair Evolve(BattlePlayerPair sourcePair, IBattleCardUniqueID evolutionCardId, List skillTargets, Action OnVirtualPairCloned = null) + { + BattleManagerBase.IsForecast = true; + bool isRecovery = BattleManagerBase.GetIns().IsRecovery; + BattleManagerBase.GetIns().IsRecovery = true; + BattlePlayerPair battlePlayerPair = sourcePair.VirtualClone(CloneActualFlags.All); + OnVirtualPairCloned?.Call(battlePlayerPair); + Prediction.CloneSkillsPreprocessAndBuffInfo(sourcePair, battlePlayerPair); + BattleCardBase[] first = Evolve_GetTargetsAndChoice(battlePlayerPair, skillTargets).first; + BattleCardBase card = battlePlayerPair.Self.ClassAndInPlayCardList.FindFromCardId(evolutionCardId); + new ActionProcessor(battlePlayerPair).Evolution(card, first); + BattleManagerBase.GetIns().IsRecovery = isRecovery; + BattleManagerBase.IsForecast = false; + return battlePlayerPair; + } + + public static Tuple> Evolve_GetTargetsAndChoice(BattlePlayerPair virtualPair, List skillTargets) + { + List list = new List(); + List list2 = null; + if (skillTargets != null) + { + for (int i = 0; i < skillTargets.Count; i++) + { + BattleCardBase battleCardBase = FindSkillTargetCard(virtualPair, skillTargets[i]); + if (battleCardBase == null) + { + list.Add(skillTargets[i]); + if (list2 == null) + { + list2 = new List(); + } + list2.Add(skillTargets[i].Index); + } + else + { + list.Add(battleCardBase); + } + } + } + return new Tuple>(list.ToArray(), list2); + } + + private static BattleCardBase FindSkillTargetCard(BattlePlayerPair pair, IBattleCardUniqueID skillTargetCardId) + { + BattleCardBase battleCardBase = pair.Self.ClassAndInPlayCardList.FindFromCardId(skillTargetCardId); + if (battleCardBase != null) + { + return battleCardBase; + } + BattleCardBase battleCardBase2 = pair.Self.HandCardList.FindFromCardId(skillTargetCardId); + if (battleCardBase2 != null) + { + return battleCardBase2; + } + BattleCardBase battleCardBase3 = pair.Opponent.ClassAndInPlayCardList.FindFromCardId(skillTargetCardId); + if (battleCardBase3 != null) + { + return battleCardBase3; + } + BattleCardBase battleCardBase4 = pair.Opponent.HandCardList.FindFromCardId(skillTargetCardId); + if (battleCardBase4 != null) + { + return battleCardBase4; + } + return null; + } + + public static BattlePlayerPair TurnEnd(BattlePlayerPair sourcePair) + { + BattleManagerBase.IsForecast = true; + bool isRecovery = BattleManagerBase.GetIns().IsRecovery; + BattleManagerBase.GetIns().IsRecovery = true; + BattlePlayerPair battlePlayerPair = sourcePair.VirtualClone(CloneActualFlags.All); + Prediction.CloneSkillsPreprocessAndBuffInfo(sourcePair, battlePlayerPair); + battlePlayerPair.Self.GetTurnEndSkillProcess().Process(battlePlayerPair); + BattleManagerBase.GetIns().IsRecovery = isRecovery; + BattleManagerBase.IsForecast = false; + return battlePlayerPair; + } + + public static BattlePlayerPair TurnStart(BattlePlayerPair sourcePair) + { + BattleManagerBase.IsForecast = true; + bool isRecovery = BattleManagerBase.GetIns().IsRecovery; + BattleManagerBase.GetIns().IsRecovery = true; + BattlePlayerPair battlePlayerPair = sourcePair.VirtualClone(CloneActualFlags.All); + Prediction.CloneSkillsPreprocessAndBuffInfo(sourcePair, battlePlayerPair); + battlePlayerPair.Self.IsSelfTurn = true; + battlePlayerPair.Opponent.IsSelfTurn = false; + SkillProcessor skillProcessor = new SkillProcessor(); + foreach (BattleCardBase inPlayCard in battlePlayerPair.Self.InPlayCards) + { + inPlayCard.TurnStart(skillProcessor); + } + foreach (BattleCardBase inPlayCard2 in battlePlayerPair.Opponent.InPlayCards) + { + inPlayCard2.OpponentTurnStart(skillProcessor); + } + skillProcessor.Process(battlePlayerPair); + BattleManagerBase.GetIns().IsRecovery = isRecovery; + BattleManagerBase.IsForecast = false; + return battlePlayerPair; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/SimulateRandomSelectFilter.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/SimulateRandomSelectFilter.cs new file mode 100644 index 0000000..c0962aa --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/SimulateRandomSelectFilter.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.Card; + +namespace Wizard.Battle.Operation; + +public class SimulateRandomSelectFilter : ISkillSelectFilter +{ + private readonly IVirtualBattleCard _virtualOwnerCard; + + private readonly string _contText; + + public SimulationSelection _selection; + + public SimulateRandomSelectFilter(IVirtualBattleCard virtualOwnerCard, string randomCountText) + { + _virtualOwnerCard = virtualOwnerCard; + _contText = randomCountText; + } + + public int CalcCount(SkillOptionValue option) + { + return option.ParseInt(_contText); + } + + public IEnumerable Filtering(IEnumerable cards, SkillOptionValue option, SkillConditionCheckerOption checkerOption) + { + _virtualOwnerCard.UsedRandomSkill = true; + if (_selection == SimulationSelection.None) + { + return new List(); + } + if (_selection == SimulationSelection.All) + { + return cards; + } + return cards.Take(CalcCount(option)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/TurnEndOperationCommand.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/TurnEndOperationCommand.cs new file mode 100644 index 0000000..5780f43 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/TurnEndOperationCommand.cs @@ -0,0 +1,18 @@ +namespace Wizard.Battle.Operation; + +public class TurnEndOperationCommand : IOperationCommand +{ + public TurnEndOperationCommand(bool currentTurnIsPlayer) + { + } + + public void Operation(BattleManagerBase battleMgr) + { + battleMgr.VfxMgr.RegisterSequentialVfx(battleMgr.OperateMgr.TurnEndOperation(battleMgr.BattlePlayer.IsSelfTurn)); + } + + public override string ToString() + { + return "Operation turn_end"; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/LoadingPhase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/LoadingPhase.cs new file mode 100644 index 0000000..9d9238a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/LoadingPhase.cs @@ -0,0 +1,32 @@ +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Phase; + +public class LoadingPhase : IPhase +{ + protected readonly BattleManagerBase _battleMgr; + + public LoadingPhase(BattleManagerBase battleMgr) + { + _battleMgr = battleMgr; + } + + public virtual VfxBase Setup() + { + return NullVfx.GetInstance(); + } + + public virtual VfxWith Update(float dt) + { + return new VfxWith(NullVfx.GetInstance(), null); + } + + public virtual VfxBase Teardown() + { + return new BattleLoadingEndVfx(_battleMgr); + } + + public virtual void Pause() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/MainPhase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/MainPhase.cs new file mode 100644 index 0000000..a803c32 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/MainPhase.cs @@ -0,0 +1,169 @@ +using System; +using UnityEngine; +using Wizard.Battle.Resource; +using Wizard.Battle.Touch; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Phase; + +public class MainPhase : IPhase +{ + protected readonly BattleManagerBase _battleManager; + + protected readonly BattlePlayer _battlePlayer; + + protected readonly BattleEnemy _battleEnemy; + + private readonly TouchControl _touchControl; + + protected readonly GameObject _menuButton; + + private readonly IBattleResourceMgr _battleResourceMgr; + + private readonly BattleLogManager _battleLogManager; + + private readonly GameObject _battery; + + protected bool _enableTouch; + + private CanNotTouchCardVfx _canNotTouchCardVfx; + + private readonly Func _getOperateMgr; + + private OperateMgr OperateMgr => _getOperateMgr(); + + public MainPhase(BattleManagerBase battleManager, BattleLogManager logManager) + { + _battleManager = battleManager; + _battlePlayer = battleManager.BattlePlayer; + _battleEnemy = battleManager.BattleEnemy; + _touchControl = battleManager.TouchControl; + _menuButton = battleManager.MenuButtonObject; + _getOperateMgr = () => battleManager.OperateMgr; + _battleResourceMgr = battleManager.BattleResourceMgr; + _battleLogManager = logManager; + _battery = battleManager.BattleUIContainer.Battery; + } + + public virtual VfxBase Setup() + { + ParallelVfxPlayer parallelVfxPlayer = CreateUpdateBattlePlayersVfx(); + parallelVfxPlayer.Register(InstantVfx.Create(delegate + { + if (!_battleManager.IsBattleEnd) + { + if (_menuButton != null) + { + _menuButton.SetActive(value: true); + } + _battleLogManager.SetActiveShowButton(isActive: true); + } + })); + return SequentialVfxPlayer.Create(parallelVfxPlayer, InstantVfx.Create(delegate + { + _enableTouch = true; + })); + } + + public VfxWith Update(float dt) + { + if (_enableTouch) + { + return new VfxWith(_touchControl.Update(dt), null); + } + return new VfxWith(NullVfx.GetInstance(), null); + } + + public virtual VfxBase Teardown() + { + _battleManager.VfxMgr.RegisterImmediateVfx(new CanNotTouchCardVfx()); + _menuButton.SetActive(value: false); + _battlePlayer.PlayerBattleView.HideTurnEndButton(); + _battleLogManager.HideLog(); + _battleLogManager.SetActiveShowButton(isActive: false); + OperateMgr.AllClearBattleView(); + _enableTouch = false; + _battlePlayer.ClassInformationUIController.HideInfomation(); + _battleEnemy.ClassInformationUIController.HideInfomation(); + _battery.SetActive(value: false); + _battlePlayer.StatusPanelControl.HideStatusPanelAlways(); + _battleEnemy.StatusPanelControl.HideStatusPanelAlways(); + if (_battleManager is NewReplayBattleMgr) + { + (_battleManager as NewReplayBattleMgr).SetActiveMoveTurnButton(isActive: false); + } + _battleManager.FinishBattle(); + return ParallelVfxPlayer.Create(new ThinkIconHideVfx(_battleResourceMgr), new EmotionHideMessageVfx(_battleResourceMgr), (_touchControl._touchProcessor == null) ? NullVfx.GetInstance() : _touchControl._touchProcessor.End().Vfx, InstantVfx.Create(delegate + { + if (UIManager.GetInstance().NowOpenDialog != null) + { + UIManager.GetInstance().NowOpenDialog.Close(); + } + }), InstantVfx.Create(_battlePlayer.PlayerEmotion.CancelShowButtons), _battlePlayer.PlayerEmotion.HideButtons()); + } + + public void Pause() + { + bool isSelecting = _battlePlayer.PlayerBattleView.IsSelecting; + if (isSelecting) + { + _battlePlayer.BattleMgr.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + SetTouchable(enable: false); + })); + } + _battlePlayer.PlayerBattleView.DragArrowStop(BattleManagerBase.GetIns()); + _battlePlayer.PlayerBattleView.ReleaseLockOnTarget(); + BattleCardBase hitCard = _touchControl._hitCard; + if (hitCard != null && hitCard.IsOnMove) + { + _touchControl.StopMovingHandCard(hitCard); + } + ResetInput(); + if (isSelecting) + { + _battlePlayer.BattleMgr.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + SetTouchable(enable: true); + })); + } + } + + protected virtual void ResetInput() + { + _touchControl.Exit(); + _battlePlayer.BattleMgr.VfxMgr.RegisterSequentialVfx(_touchControl.ForceEndTouchProcessor()); + if (_battlePlayer.IsSelfTurn && !_battlePlayer.PlayerBattleView.IsEvolutionVfx) + { + _battlePlayer.PlayerBattleView.TurnEndButtonUI.ShowBtn(_battlePlayer.PlayerBattleView.CanPlayerEndTurnImmediately); + } + } + + protected ParallelVfxPlayer CreateUpdateBattlePlayersVfx() + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + parallelVfxPlayer.Register(ParallelVfxPlayer.Create(_battlePlayer.CreateUpdateDeckCountLabelVfx(), _battleEnemy.CreateUpdateDeckCountLabelVfx())); + parallelVfxPlayer.Register(_battlePlayer.StartBattleMainView()); + parallelVfxPlayer.Register(_battleEnemy.StartBattleMainView()); + return parallelVfxPlayer; + } + + protected virtual void SetTouchable(bool enable) + { + if (enable && _canNotTouchCardVfx == null) + { + bool isUpdateHandCardsPlayability = true; + if (GameMgr.GetIns().IsWatchBattle) + { + isUpdateHandCardsPlayability = !(BattleManagerBase.GetIns() as NetworkBattleManagerBase).IsSkillSelectTiming; + } + _canNotTouchCardVfx = new CanNotTouchCardVfx(isUpdateHandCardsPlayability); + } + else if (_canNotTouchCardVfx != null) + { + _canNotTouchCardVfx.End(); + _canNotTouchCardVfx = null; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/MulliganPhaseBase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/MulliganPhaseBase.cs new file mode 100644 index 0000000..e4f2b93 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/MulliganPhaseBase.cs @@ -0,0 +1,112 @@ +using System; +using System.Collections.Generic; +using Wizard.Battle.Mulligan; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Phase; + +public class MulliganPhaseBase : IPhase +{ + protected IMulliganMgr _mulliganMgr; + + private readonly BattleManagerBase _battleMgr; + + private MulliganOperateControl _mulliganOperateCtrl; + + private bool _enableTouch; + + private const float MULLIGAN_LOG_WAIT_TIME = 20f; + + protected MulliganPhaseBase(BattleManagerBase battleMgr) + { + _battleMgr = battleMgr; + } + + protected void Initialize(IMulliganMgr mulliganMgr) + { + _mulliganMgr = mulliganMgr; + _battleMgr.MulliganMgr = _mulliganMgr; + MulliganInfoControl component = NGUITools.AddChild(_battleMgr.Battle3DContainer, GameMgr.GetIns().GetPrefabMgr().Get("Prefab/UI/MulliganInfo")).GetComponent(); + _mulliganMgr.InitMulligan(component, _battleMgr.BattlePlayer.PlayerBattleView); + _mulliganOperateCtrl = CreateMulliganOperateControl(); + } + + protected virtual MulliganOperateControl CreateMulliganOperateControl() + { + return new MulliganOperateControl(_mulliganMgr.PlayerMlgCtrl); + } + + protected virtual void ShowMulliganInfo() + { + _mulliganMgr.GetMulliganInfo().Show(MulliganInfoControl.ViewType.Normal); + } + + public virtual VfxBase Setup() + { + IMulliganMgr mulliganMgr = _mulliganMgr; + mulliganMgr.OnSubmit = (Action)Delegate.Combine(mulliganMgr.OnSubmit, (Action)delegate + { + _enableTouch = false; + }); + _battleMgr.OnSubmitMulligan += SubmitMulligan; + VfxBase vfxBase = _mulliganMgr.MulliganStartDraw(_battleMgr.IsFirst, new SkillProcessor()); + _battleMgr.BattleUIContainer.Battery.SetActive(value: false); + _enableTouch = true; + return SequentialVfxPlayer.Create(InstantVfx.Create(ShowMulliganInfo), vfxBase); + } + + protected void StartDeal(List playerDealIdxList, List oppoDealIdxList) + { + if (playerDealIdxList != null && playerDealIdxList.Count == 3 && oppoDealIdxList != null && oppoDealIdxList.Count == 3) + { + _battleMgr.VfxMgr.RegisterSequentialVfx(_mulliganMgr.StartDeal(playerDealIdxList, oppoDealIdxList, new SkillProcessor())); + } + } + + public virtual VfxWith Update(float dt) + { + if (_enableTouch) + { + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + parallelVfxPlayer.Register(_mulliganOperateCtrl.Update()); + return new VfxWith(parallelVfxPlayer, null); + } + return new VfxWith(NullVfx.GetInstance(), null); + } + + public virtual VfxBase Teardown() + { + _battleMgr.OnSubmitMulligan -= SubmitMulligan; + MulliganInfoControl mulliganInfo = _mulliganMgr.GetMulliganInfo(); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(new MulliganEndVfx(mulliganInfo, _battleMgr.BattlePlayer, _battleMgr.BattleEnemy)); + sequentialVfxPlayer.Register(mulliganInfo.SetPlayerReady()); + sequentialVfxPlayer.Register(InstantVfx.Create(mulliganInfo.HideTopPanels)); + sequentialVfxPlayer.Register(new PlayerAndEnemyReadyVfx(_battleMgr.BattlePlayer, _battleMgr.BattleEnemy)); + sequentialVfxPlayer.Register(mulliganInfo.DestroyMulliganUIVfx()); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + _battleMgr.MulliganMgr = null; + _battleMgr.BattleUIContainer.Battery.SetActive(value: true); + })); + return sequentialVfxPlayer; + } + + public void Pause() + { + } + + private VfxBase SubmitMulligan() + { + if (IsCardUndecided()) + { + return NullVfx.GetInstance(); + } + return _mulliganMgr.Submit(_battleMgr); + } + + private bool IsCardUndecided() + { + return _mulliganOperateCtrl.State == MulliganOperateControl.STATE.CARD_SELECTED; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/NetworkMulliganPhase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/NetworkMulliganPhase.cs new file mode 100644 index 0000000..564a59c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/NetworkMulliganPhase.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using Cute; +using Wizard.Battle.Mulligan; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Phase; + +public class NetworkMulliganPhase : MulliganPhaseBase +{ + protected readonly NetworkBattleManagerBase _networkBattleMgr; + + protected readonly NetworkMulliganMgr _networkMulliganMgr; + + protected readonly SingleMulliganMgr _singleMulliganMgr; + + private Action OnNetworkAlive; + + public event Func OnEndMulligan; + + public NetworkMulliganPhase(NetworkBattleManagerBase battleMgr, NetworkBattleSender sender) + : base(battleMgr) + { + _networkBattleMgr = battleMgr; + if (GameMgr.GetIns().IsAINetwork) + { + _singleMulliganMgr = new SingleMulliganMgr(); + } + else + { + _networkMulliganMgr = new NetworkMulliganMgr(sender); + } + IMulliganMgr mulliganMgr; + if (!GameMgr.GetIns().IsAINetwork) + { + IMulliganMgr networkMulliganMgr = _networkMulliganMgr; + mulliganMgr = networkMulliganMgr; + } + else + { + IMulliganMgr networkMulliganMgr = _singleMulliganMgr; + mulliganMgr = networkMulliganMgr; + } + Initialize(mulliganMgr); + } + + public override VfxBase Setup() + { + VfxBase result = base.Setup(); + MulliganEventSetting(); + if (!_networkBattleMgr.IsRecovery) + { + SetUpSubmitEvent(); + } + return result; + } + + protected void SetUpSubmitEvent() + { + IMulliganMgr mulliganMgr = _mulliganMgr; + mulliganMgr.OnSubmit = (Action)Delegate.Combine(mulliganMgr.OnSubmit, (Action)delegate + { + if (GameMgr.GetIns().IsAINetwork) + { + SingleMulliganMgr singleMulligan = _mulliganMgr as SingleMulliganMgr; + OnNetworkAlive = (Action)Delegate.Combine(OnNetworkAlive, (Action)delegate + { + singleMulligan.AIMulliganEndAction(); + OnNetworkAlive = null; + }); + } + }); + } + + public override VfxWith Update(float dt) + { + if (GameMgr.GetIns().IsAINetwork && ToolboxGame.RealTimeNetworkAgent != null && ToolboxGame.RealTimeNetworkAgent.PlayerNetworkStatus.IsAlive) + { + OnNetworkAlive.Call(); + } + return base.Update(dt); + } + + public void MulliganEventSetting() + { + if (!GameMgr.GetIns().IsAINetwork) + { + OperateReceive operateReceive = _networkBattleMgr.OperateReceive; + operateReceive.OnEndMulligan = (Func)Delegate.Combine(operateReceive.OnEndMulligan, new Func(EndMulligan)); + OperateReceive operateReceive2 = _networkBattleMgr.OperateReceive; + operateReceive2.OnReceiveDeal = (Action, List>)Delegate.Combine(operateReceive2.OnReceiveDeal, new Action, List>(base.StartDeal)); + OperateReceive operateReceive3 = _networkBattleMgr.OperateReceive; + operateReceive3.OnReceivePlayerMulligan = (Func, VfxBase>)Delegate.Combine(operateReceive3.OnReceivePlayerMulligan, new Func, VfxBase>(ReceivePlayerMulligan)); + OperateReceive operateReceive4 = _networkBattleMgr.OperateReceive; + operateReceive4.OnReceiveOpponentMulligan = (Func, VfxBase>)Delegate.Combine(operateReceive4.OnReceiveOpponentMulligan, new Func, VfxBase>(ReceiveOpponentMulligan)); + } + } + + public override VfxBase Teardown() + { + VfxBase result = base.Teardown(); + if (GameMgr.GetIns().IsAINetwork) + { + return result; + } + OperateReceive operateReceive = _networkBattleMgr.OperateReceive; + operateReceive.OnEndMulligan = (Func)Delegate.Remove(operateReceive.OnEndMulligan, new Func(EndMulligan)); + OperateReceive operateReceive2 = _networkBattleMgr.OperateReceive; + operateReceive2.OnReceiveDeal = (Action, List>)Delegate.Remove(operateReceive2.OnReceiveDeal, new Action, List>(base.StartDeal)); + OperateReceive operateReceive3 = _networkBattleMgr.OperateReceive; + operateReceive3.OnReceivePlayerMulligan = (Func, VfxBase>)Delegate.Remove(operateReceive3.OnReceivePlayerMulligan, new Func, VfxBase>(ReceivePlayerMulligan)); + OperateReceive operateReceive4 = _networkBattleMgr.OperateReceive; + operateReceive4.OnReceiveOpponentMulligan = (Func, VfxBase>)Delegate.Remove(operateReceive4.OnReceiveOpponentMulligan, new Func, VfxBase>(ReceiveOpponentMulligan)); + return result; + } + + private VfxBase EndMulligan() + { + LocalLog.AccumulateLastTraceLog("EndMulligan"); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(this.OnEndMulligan.GetAllFuncVfxResults()); + sequentialVfxPlayer.Register(GameMgr.GetIns().IsAINetwork ? _singleMulliganMgr.CompleteMulligan(_networkBattleMgr) : _networkMulliganMgr.CompleteMulligan(_networkBattleMgr)); + return sequentialVfxPlayer; + } + + protected virtual VfxBase ReceivePlayerMulligan(List mulliganAfterCardIndexes) + { + if (GameMgr.GetIns().IsAINetwork) + { + return NullVfx.GetInstance(); + } + _networkMulliganMgr.SetPlayerHandCardIndexList(mulliganAfterCardIndexes); + return _networkMulliganMgr.PlayerChangeCardVfx(_networkBattleMgr); + } + + protected VfxBase ReceiveOpponentMulligan(List mulliganAfterCardIndexes) + { + LocalLog.AccumulateLastTraceLog("ReceiveOpponentMulligan"); + if (GameMgr.GetIns().IsAINetwork) + { + return NullVfx.GetInstance(); + } + _networkMulliganMgr.SetOpponentMulliganAfterCardIndexList(mulliganAfterCardIndexes); + VfxBase vfx = _networkMulliganMgr.EnemyChangeCardVfx(_networkBattleMgr); + _networkBattleMgr.ClearRegisterCardList(); + OnEndMulligan += () => vfx; + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/OpeningPhase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/OpeningPhase.cs new file mode 100644 index 0000000..ccaf85b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/OpeningPhase.cs @@ -0,0 +1,32 @@ +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Phase; + +public class OpeningPhase : IPhase +{ + protected readonly BattleManagerBase _battleMgr; + + public OpeningPhase(BattleManagerBase battleMgr) + { + _battleMgr = battleMgr; + } + + public virtual VfxBase Setup() + { + return new DefaultOpeningVfx(_battleMgr.BackGround); + } + + public virtual VfxWith Update(float dt) + { + return new VfxWith(NullVfx.GetInstance(), _battleMgr.PhaseCreator.CreateMulliganPhase()); + } + + public virtual VfxBase Teardown() + { + return NullVfx.GetInstance(); + } + + public virtual void Pause() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/PhaseCreatorBase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/PhaseCreatorBase.cs new file mode 100644 index 0000000..14f8489 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/PhaseCreatorBase.cs @@ -0,0 +1,46 @@ +using Wizard.Battle.UI; + +namespace Wizard.Battle.Phase; + +public abstract class PhaseCreatorBase : IPhaseCreator +{ + protected readonly BattleManagerBase _battleMgr; + + protected PhaseCreatorBase(BattleManagerBase battleMgr) + { + _battleMgr = battleMgr; + } + + public virtual IPhase CreateFirstPhase() + { + return new LoadingPhase(_battleMgr); + } + + public virtual IPhase CreateOpeningPhase() + { + CreateBattleLogManager(); + return new OpeningPhase(_battleMgr); + } + + public virtual IPhase CreateMulliganPhase() + { + return new SingleMulliganPhase(_battleMgr); + } + + public virtual IPhase CreateMainPhase() + { + return new MainPhase(_battleMgr, BattleLogManager.GetInstance()); + } + + public virtual IResultPhase CreateResultPhase(bool winnerIsPlayer) + { + return new ResultPhase(_battleMgr, winnerIsPlayer); + } + + protected BattleLogManager CreateBattleLogManager() + { + BattleLogManager instance = BattleLogManager.GetInstance(); + instance.SetUp(_battleMgr.BtlUIContainer.transform, _battleMgr, _battleMgr.OperateMgr, _battleMgr.BattlePlayer); + return instance; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/RecoveryAfterMulliganPhase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/RecoveryAfterMulliganPhase.cs new file mode 100644 index 0000000..047ec18 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/RecoveryAfterMulliganPhase.cs @@ -0,0 +1,161 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.Recovery; +using Wizard.Battle.UI; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Phase; + +public class RecoveryAfterMulliganPhase : IPhase +{ + private readonly IRecoveryManager _recoveryManager; + + private readonly BattleManagerBase _battleMgr; + + private readonly Func _createMainPhase; + + private readonly BattlePlayer _battlePlayer; + + private readonly BattleEnemy _battleEnemy; + + private readonly TouchControl _touchControl; + + private bool _isEndRecovery; + + public RecoveryAfterMulliganPhase(IRecoveryManager recoveryManager, BattleManagerBase battleMgr, Func createMainPhase) + { + _recoveryManager = recoveryManager; + _battleMgr = battleMgr; + _createMainPhase = createMainPhase; + _battlePlayer = battleMgr.BattlePlayer; + _battleEnemy = battleMgr.BattleEnemy; + _touchControl = battleMgr.TouchControl; + } + + public VfxBase Setup() + { + _recoveryManager.OnEndRecovery += delegate + { + _isEndRecovery = true; + }; + return _recoveryManager.Recovery(_battleMgr.BattlePlayer, _battleMgr.BattleEnemy, BattleCoroutine.GetInstance().StartCoroutine); + } + + public VfxWith Update(float dt) + { + _battleMgr.VfxMgr.Update(dt); + VfxBase vfx = _recoveryManager.UpdateRecovery(); + if (_isEndRecovery) + { + return new VfxWith(vfx, _createMainPhase()); + } + return new VfxWith(vfx, null); + } + + public VfxBase Teardown() + { + if (_recoveryManager is SingleBattleRecoveryManager) + { + ((SingleBattleRecoveryManager)_recoveryManager).CreateRecoveryFileFromTempFile(); + ((SingleBattleRecoveryRecordManager)((SingleBattleMgr)BattleManagerBase.GetIns()).ContentsCreator.RecoveryRecordManager).ClearRecoderTempFilePath(); + } + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + _battleMgr.BattlePlayer.PlayerBattleView.PlayQueueView.ForceClearPlayQueue(); + _battleMgr.BattleEnemy.BattleEnemyView.PlayQueueView.ForceClearPlayQueue(); + if (_battleMgr.IsBattleEnd) + { + BattleLogManager.GetInstance().SetActiveShowButton(isActive: false); + } + if (_battleMgr.BattlePlayer.Class.IsDead && _battleMgr.BattleEnemy.Class.IsDead) + { + VfxBase vfx = (_battleMgr.BattlePlayer.IsSelfTurn ? _battleMgr.DeadClass(PlayerDead: true, BattleManagerBase.FINISH_TYPE.NORMAL) : _battleMgr.DeadClass(PlayerDead: false, BattleManagerBase.FINISH_TYPE.NORMAL)); + sequentialVfxPlayer.Register(vfx); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + _battleMgr.InitiateGameEndSequence(!_battleMgr.BattlePlayer.IsSelfTurn); + })); + } + else if (_battleMgr.BattlePlayer.Class.IsDead) + { + sequentialVfxPlayer.Register(_battleMgr.DeadClass(PlayerDead: true, BattleManagerBase.FINISH_TYPE.NORMAL)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + _battleMgr.InitiateGameEndSequence(hasWon: false); + })); + } + else if (_battleMgr.BattleEnemy.Class.IsDead) + { + sequentialVfxPlayer.Register(_battleMgr.DeadClass(PlayerDead: false, BattleManagerBase.FINISH_TYPE.NORMAL)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + _battleMgr.InitiateGameEndSequence(hasWon: true); + })); + } + if (_battlePlayer.PlayerBattleView.IsSelecting) + { + _touchControl.SelectCancelActCard(); + } + _touchControl.Exit(); + if (_battlePlayer.IsSelfTurn) + { + for (int num = 0; num < _battlePlayer.HandCardList.Count; num++) + { + _battlePlayer.HandCardList[num].BattleCardView.UpdateMovability(); + } + } + VfxBase vfxBase = (_battleEnemy.IsSelfTurn ? _battleEnemy.CreateThinkingVfx(_battleMgr) : NullVfx.GetInstance()); + VfxBase vfxBase2 = RestoreUI(_battleMgr); + return SequentialVfxPlayer.Create(InstantVfx.Create(delegate + { + _battleMgr.BackGround.PlayBgm(); + }), vfxBase2, InstantVfx.Create(delegate + { + _battleMgr.BattlePlayer.ClassInformationUIController.Recovery(); + _battleMgr.BattleEnemy.ClassInformationUIController.Recovery(); + _battleMgr.BattlePlayer.PlayerBattleView.TurnEndButtonUI.Recovery(); + _battleMgr.BattleResultControl.Recovery(); + if (!_battleMgr.IsBattleEnd) + { + IPlayerView playerBattleView = _battleMgr.BattlePlayer.PlayerBattleView; + playerBattleView.TurnEndButtonUI._isButtonForcedOff = false; + _battleMgr.BattlePlayer.TurnStartEffectEnd(); + playerBattleView.HideTurnEndPulseEffect(); + playerBattleView.ShowTurnEndButton(); + } + }), new BattleLoadingEndVfx(_battleMgr), vfxBase, sequentialVfxPlayer); + } + + public static VfxBase RestoreUI(BattleManagerBase battleMgr) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register((!battleMgr.BattlePlayer.NowTurnEvol) ? ((VfxBase)InstantVfx.Create(delegate + { + battleMgr.BattlePlayer.BattleView.EpIcon.GetComponent().spriteName = "battle_icon_evo_off"; + })) : ((VfxBase)NullVfx.GetInstance())); + sequentialVfxPlayer.Register((!battleMgr.BattleEnemy.NowTurnEvol) ? ((VfxBase)InstantVfx.Create(delegate + { + battleMgr.BattleEnemy.BattleView.EpIcon.GetComponent().spriteName = "battle_icon_evo_off"; + })) : ((VfxBase)NullVfx.GetInstance())); + sequentialVfxPlayer.Register(new DummyDeckChangeCardVfx(isPlayer: true, battleMgr.BattlePlayer.DeckCardList.Count)); + sequentialVfxPlayer.Register(new DummyDeckChangeCardVfx(isPlayer: false, battleMgr.BattleEnemy.DeckCardList.Count)); + sequentialVfxPlayer.Register(ParallelVfxPlayer.Create(battleMgr.BattlePlayer.Class.SkillApplyInformation.AllSkillEffectRestart(), battleMgr.BattleEnemy.Class.SkillApplyInformation.AllSkillEffectRestart())); + foreach (BattleCardBase handCard in battleMgr.BattlePlayer.HandCardList) + { + sequentialVfxPlayer.Register(handCard.BattleCardView.ShowHandCardInfo(isRecovery: true)); + } + List list = battleMgr.BattlePlayer.InPlayCards.ToList(); + list.AddRange(battleMgr.BattleEnemy.InPlayCards.ToList()); + for (int num = 0; num < list.Count; num++) + { + sequentialVfxPlayer.Register(list[num].BattleCardView.InitializeBattleCardIcon(list[num], list[num].Skills)); + sequentialVfxPlayer.Register(list[num].BattleCardView.ShowBattleCardIcon()); + } + return sequentialVfxPlayer; + } + + public void Pause() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/RecoveryNetworkBeforeSubmitMulliganPhase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/RecoveryNetworkBeforeSubmitMulliganPhase.cs new file mode 100644 index 0000000..5e3ec3b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/RecoveryNetworkBeforeSubmitMulliganPhase.cs @@ -0,0 +1,14 @@ +namespace Wizard.Battle.Phase; + +public class RecoveryNetworkBeforeSubmitMulliganPhase : NetworkMulliganPhase +{ + public RecoveryNetworkBeforeSubmitMulliganPhase(NetworkBattleManagerBase networkBattleMgr, NetworkBattleSender networkBattleSender) + : base(networkBattleMgr, networkBattleSender) + { + } + + public void RecoveryEnd() + { + SetUpSubmitEvent(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/Class3dCharacterBase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/Class3dCharacterBase.cs new file mode 100644 index 0000000..642e0cf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/Class3dCharacterBase.cs @@ -0,0 +1,532 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using UnityEngine.Experimental.Rendering; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Player.ClassCharacter; + +public class Class3dCharacterBase : ClassCharacterBase +{ + protected Material _class3DMaterial; + + private Camera _norCamera; + + private Camera _evoCamera; + + protected GameObject _root; + + protected Charactor3dInformation _charaInfo; + + private Effect3dInformation _effectInfo; + + private ClassCharaPrm.MotionType _currentMotion = ClassCharaPrm.MotionType.idle; + + protected List _idleStateHash = new List(); + + private readonly Vector3 PP_PANEL_POSITION = new Vector3(0f, -34.22f, -29.25f); + + private readonly Vector3 WIDGET_POSITION = new Vector3(0f, 490f, 30f); + + private readonly int WIDGET_OFFSET_TOP = -1162; + + private readonly int WIDGET_OFFSET_BOTTOM = 195; + + private readonly string IDLE_NAME = "Base Layer.idle"; + + protected int _classCharacterId = 3604; + + public bool IsPlayer = true; + + protected const int RENDER_QUEUE = 2999; + + protected override Vector3 MessagePosition => _initPosition + new Vector3(0f, -0.3f, 0f); + + public override VfxBase CreateLoadResouceVfx() + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(LoadResouceVfx()); + return sequentialVfxPlayer; + } + + private VfxBase LoadResouceVfx() + { + return InstantVfx.Create(delegate + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + int num = (IsPlayer ? dataMgr.GetPlayerSkinId() : dataMgr.GetEnemySkinId()); + if (_classCharacterId != num) + { + _classCharacterId = num; + } + ClassCharacterMasterData charaPrmByCharaId = GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId(_classCharacterId); + GameObject gobj = new ClassCardCreator(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(charaPrmByCharaId.path, ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true))).LoadRootObject(); + GameObject gameObject = NGUITools.AddChild(BattleManagerBase.GetIns().Battle3DContainer); + gameObject.name = "ClassCharacterRoot"; + GameObject gameObject2 = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(gobj, gameObject); + SetUpAnchor(gameObject); + AttachOtherUI(gameObject); + GameObject gameObject3 = gameObject2.transform.Find("ClassObj").gameObject; + GameObject gameObject4 = gameObject2.transform.Find("Collider").gameObject; + base.GameObject = gameObject2; + base.GameObject.tag = GetTagName(); + base.GameObject.transform.localPosition = GetPosition(); + _initPosition = base.GameObject.transform.position; + gameObject3.transform.localScale = Global.CLASS_BATTLE_SCALE; + gameObject3.tag = GetTagName(); + gameObject4.tag = GetTagName(); + Transform transform = gameObject3.transform.Find("Class"); + transform.GetComponent().sharedMesh = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_uma_Base", ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true)); + MotionUtils.SetLayerAll(transform.gameObject, 15); + Transform child = transform.transform.GetChild(0); + child.GetComponent().sharedMesh = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_uma_Outside", ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true)); + MotionUtils.SetLayerAll(child.gameObject, 10); + RenderTextureFormat lutFormat = GetLutFormat(); + RenderTexture renderTexture = new RenderTexture(2048, 2048, 1, lutFormat); + Shader shader = Shader.Find("UI/Default"); + _class3DMaterial = new Material(shader); + _class3DMaterial.name = "ClassEvolveMaterial"; + _class3DMaterial.mainTexture = renderTexture; + Material source = new Material(Shader.Find("Custom/ModelShaderBattle")) + { + name = "ClassFlameMaterial", + mainTexture = renderTexture + }; + _root = new GameObject(); + _root.name = (IsPlayer ? "Player3DChara" : "Enemy3DChara"); + Transform transform2 = _root.transform; + transform2.localPosition = Vector3.zero; + float width = (float)Screen.width / (float)Screen.height; + _norCamera = new GameObject + { + name = "Player3DCamera" + }.AddComponent(); + _norCamera.backgroundColor = new Color(0f, 0f, 0f, 0f); + _norCamera.nearClipPlane = 1f; + _norCamera.farClipPlane = 40f; + _norCamera.fieldOfView = 33f; + _norCamera.transform.parent = transform2; + _norCamera.targetTexture = renderTexture; + _norCamera.cullingMask = 1; + _norCamera.transform.localPosition = new Vector3(0f, 0.09718f, -3.338f); + _norCamera.transform.localEulerAngles = new Vector3(2.5f, 0f, 0f); + Class3dPostImageEffect class3dPostImageEffect = null; + if (IsPlayer) + { + GameObject gameObject5 = new GameObject + { + name = "Evo3DCamera" + }; + _evoCamera = gameObject5.AddComponent(); + _evoCamera.backgroundColor = new Color(0f, 0f, 0f, 0f); + _evoCamera.nearClipPlane = 1f; + _evoCamera.farClipPlane = 40f; + _evoCamera.fieldOfView = 21f; + _evoCamera.rect = new Rect(0f, 0f, width, 1f); + _evoCamera.transform.parent = transform2; + _evoCamera.allowMSAA = false; + _evoCamera.depth = 30f; + _evoCamera.cullingMask = 1; + _evoCamera.clearFlags = CameraClearFlags.Depth; + _evoCamera.gameObject.SetActive(value: false); + _evoCamera.transform.localPosition = new Vector3(0f, 0.12f, 0f); + _evoCamera.transform.localEulerAngles = new Vector3(2.5f, 0f, 0f); + class3dPostImageEffect = gameObject5.AddComponent(); + class3dPostImageEffect.Initialize(); + } + GameObject gameObject6 = null; + gameObject6 = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(_classCharacterId.ToString(), ResourcesManager.AssetLoadPathType.ClassChara3D, isfetch: true)), transform2) as GameObject; + _effectInfo = gameObject6.GetComponent(); + _charaInfo = gameObject6.GetComponent(); + _charaInfo.InitializeMesh(this, class3dPostImageEffect); + _charaInfo.Quad.SetLayer(15, isSetChildren: true); + Transform transform3 = _charaInfo.Quad.transform; + transform3.transform.parent = transform.parent; + float y = (IsPlayer ? 0.2f : (-0.41f)); + transform3.localPosition = new Vector3(0f, y, -0.35f); + float y2 = (IsPlayer ? 5.7f : 6.1725f); + transform3.localScale = new Vector3(5.7f, y2, 1f); + Vector3 battleCameraPos = BattleManagerBase.GetIns().Camera.BattleCameraPos; + battleCameraPos.x = transform3.position.x; + transform3.LookAt(battleCameraPos); + MeshRenderer component = _charaInfo.Quad.GetComponent(); + component.sharedMaterial = new Material(source); + component.sharedMaterial.renderQueue = 2999; + CardTemplate cardTemplate = gameObject2.AddComponent(); + cardTemplate.CardWrapObjTemp = gameObject3; + cardTemplate.Collider = gameObject4.GetComponent(); + Transform transform4 = transform.transform; + transform4.localRotation = ConvertBackPanelRotation(transform4.localRotation); + GameObject gameObject7 = gameObject3.transform.Find("Shield").gameObject; + gameObject7.GetComponent().sharedMesh = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true)); + gameObject7.GetComponent().sharedMaterial = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true)); + gameObject7.GetComponent().sharedMaterial.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaTexture, isfetch: true)); + gameObject7.transform.localPosition = GetShieldPosition(); + gameObject7.transform.localScale = new Vector3(1.5f, 1.5f, 1f); + GameMgr.GetIns().GetEffectMgr().SetParticleShader(gameObject7); + MeshRenderer component2 = transform.GetComponent(); + MeshRenderer component3 = child.GetComponent(); + Material material = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_uma_Frame", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true)) as Material; + if (material != null) + { + material.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_uma_Frame", ResourcesManager.AssetLoadPathType.ClassCharaFrameTexture, isfetch: true)); + } + CardCreatorBase.SetupClassMaterialToCenterCharacterMesh(component2, component3, new Material(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(GetTextureName(), ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true))) + { + mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(((int)charaPrmByCharaId.ClassColorId).ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaEncampment, isfetch: true)) + }, material); + gameObject7.SetActive(value: true); + SBattleLoad sBattleLoad = BattleManagerBase.GetIns().SBattleLoad; + GameObject gameObject8 = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_class_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), BattleManagerBase.GetIns().Battle3DContainer); + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(gameObject8, null, isBattle: true, isField: true); + gameObject8.transform.parent = gameObject3.transform; + gameObject8.transform.localPosition = new Vector3(0f, 0.1f, 0.15f); + gameObject8.transform.localRotation = GetMaskImageRotation(); + gameObject8.transform.localScale = new Vector3(6.4f, 6.4f, 20.48f); + gameObject8.SetActive(value: false); + cardTemplate.FrameEffectNormal = gameObject8; + GameObject gameObject9 = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(sBattleLoad.LifePoolIcon, BattleManagerBase.GetIns().Battle3DContainer); + gameObject9.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); + gameObject9.transform.parent = gameObject7.transform; + gameObject9.transform.localPosition = GetLifeIconPosition(); + gameObject3.transform.localScale = new Vector3(80f, 80f, 25f); + gameObject4.transform.localScale = new Vector3(80f, 80f, 25f); + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(0); + (cardTemplate.LifeLabelTemp = gameObject9.transform.Find("LifeLabel").GetComponent()).text = cardParameterFromId.Life.ToString(); + SpriteRenderer spriteRenderer = new GameObject().AddComponent(); + spriteRenderer.sprite = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_uma_mask", ResourcesManager.AssetLoadPathType.ClassCharaTexture, isfetch: true)); + Material material2 = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("mt_encampment_mask", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true))); + material2.SetInt("_Stencil", GetStencil()); + spriteRenderer.material = material2; + spriteRenderer.transform.parent = gameObject3.transform; + spriteRenderer.transform.localPosition = GetMaskImagePosition(); + spriteRenderer.transform.localScale = Vector3.one * 0.46f; + spriteRenderer.gameObject.SetLayer(15, isSetChildren: true); + spriteRenderer.sortingOrder = GetMaskSortingOrder(); + spriteRenderer.name = "SpineMask"; + spriteRenderer.transform.localRotation = GetMaskImageRotation(); + GameMgr.GetIns().GetPrefabMgr().Load("UI/Battle/EmotionMessage"); + _emotionLabel = NGUITools.AddChild(BattleManagerBase.GetIns().BtlUIContainer, GameMgr.GetIns().GetPrefabMgr().Get("UI/Battle/EmotionMessage")); + _emotionLabel.transform.Find("Scale").GetComponent().depth = GetEmoteLabelDepth(); + _emotionLabel.SetActive(value: false); + GameMgr.GetIns().GetPrefabMgr().Load("UI/Battle/EnvironmentMessage"); + _enviromentLabel = NGUITools.AddChild(BattleManagerBase.GetIns().BtlUIContainer, GameMgr.GetIns().GetPrefabMgr().Get("UI/Battle/EnvironmentMessage")); + _enviromentLabel.SetActive(value: false); + base.GameObject.SetActive(value: false); + }); + } + + private RenderTextureFormat GetLutFormat() + { + RenderTextureFormat renderTextureFormat = RenderTextureFormat.ARGB32; + if (!IsRenderTextureFormatSupportedForLinearFiltering(renderTextureFormat)) + { + renderTextureFormat = RenderTextureFormat.ARGB64; + if (!IsRenderTextureFormatSupportedForLinearFiltering(renderTextureFormat)) + { + renderTextureFormat = RenderTextureFormat.ARGBHalf; + } + if (!IsRenderTextureFormatSupportedForLinearFiltering(renderTextureFormat)) + { + Debug.LogError("RenderTexture not Supported."); + } + } + return renderTextureFormat; + } + + private static bool IsRenderTextureFormatSupportedForLinearFiltering(RenderTextureFormat format) + { + return SystemInfo.IsFormatSupported(GraphicsFormatUtility.GetGraphicsFormat(format, RenderTextureReadWrite.Linear), FormatUsage.Linear); + } + + public void EnableEvolve(bool enable) + { + _charaInfo.Quad.SetActive(!enable); + _evoCamera.gameObject.SetActive(enable); + } + + public override void PlayMotion(ClassCharaPrm.MotionType motionType) + { + if (BattleManagerBase.GetIns().IsRecovery || !_isAnimation) + { + return; + } + _currentMotion = motionType; + Animator[] animators = _charaInfo.Animators; + foreach (Animator animator in animators) + { + if (_currentMotion == ClassCharaPrm.MotionType.damage || motionType == ClassCharaPrm.MotionType.damage) + { + animator.ResetTrigger(ClassCharaPrm.MotionType.idle.ToString()); + string trigger = ClassCharaPrm.MotionType.damage.ToString(); + animator.SetTrigger(trigger); + } + else if (animator.GetCurrentAnimatorStateInfo(0).IsName(IDLE_NAME)) + { + animator.ResetTrigger(ClassCharaPrm.MotionType.idle.ToString()); + animator.SetTrigger(motionType.ToString()); + _effectInfo.PlayEffect(motionType); + } + else + { + BattleCoroutine.GetInstance().StartCoroutine(WaitMotionEnd(animator, motionType)); + } + } + } + + public override void ResetMotion() + { + _currentMotion = ClassCharaPrm.MotionType.idle; + Animator[] animators = _charaInfo.Animators; + foreach (Animator obj in animators) + { + obj.ResetTrigger(ClassCharaPrm.MotionType.idle.ToString()); + obj.SetTrigger(ClassCharaPrm.MotionType.idle.ToString()); + } + } + + private IEnumerator WaitMotionEnd(Animator animator, ClassCharaPrm.MotionType motionType) + { + animator.SetTrigger(ClassCharaPrm.MotionType.idle.ToString()); + _currentMotion = ClassCharaPrm.MotionType.idle; + yield return new WaitForSeconds(0.1f); + animator.ResetTrigger(ClassCharaPrm.MotionType.idle.ToString()); + animator.SetTrigger(motionType.ToString()); + _effectInfo.PlayEffect(motionType); + } + + public override bool IsAnimationEnable() + { + return _isAnimation; + } + + protected override string GetTagName() + { + return "Enemy"; + } + + protected override Quaternion ConvertBackPanelRotation(Quaternion originalRotation) + { + return Quaternion.Euler(0f, -180f, 180f); + } + + protected override Vector3 GetPosition() + { + return Global.CLASS_BATTLE_POSITION_ENEMY; + } + + protected override void SetUpAnchor(GameObject o) + { + o.transform.localPosition = WIDGET_POSITION; + UIWidget uIWidget = o.AddComponent(); + uIWidget.topAnchor.relative = 1f; + uIWidget.topAnchor.absolute = WIDGET_OFFSET_TOP; + Transform target = BattleManagerBase.GetIns().Battle3DContainer.transform.Find("Camera"); + uIWidget.topAnchor.target = target; + uIWidget.bottomAnchor.target = target; + uIWidget.bottomAnchor.relative = 0.5f; + uIWidget.bottomAnchor.absolute = WIDGET_OFFSET_BOTTOM; + } + + protected override void AttachOtherUI(GameObject o) + { + BattleManagerBase.GetIns().BattleEnemy.BattleView.EpPanel.transform.parent = o.transform; + EnemyStatusPanelControl enemyStatusPanelControl = BattleManagerBase.GetIns().BattleEnemy.StatusPanelControl as EnemyStatusPanelControl; + if ((bool)enemyStatusPanelControl) + { + enemyStatusPanelControl.ChangePPPanelParent(o.transform, PP_PANEL_POSITION); + } + } + + public override Vector3 GetSpinePosition() + { + return new Vector3(0f, -0.36f, 0.17f); + } + + public override Vector3 GetMaskImagePosition() + { + return new Vector3(0f, 0.04f, 0f); + } + + protected override Vector3 GetShieldPosition() + { + return new Vector3(1.86f, 0.48f, 0f); + } + + protected override Vector3 GetLifeIconPosition() + { + return new Vector3(0f, 0f, 0.1f); + } + + protected override string GetTextureName() + { + return "mt_Encampment_Chara_1_Rev"; + } + + public override Quaternion GetMaskImageRotation() + { + return Quaternion.Euler(new Vector3(0f, 0f, 180f)); + } + + public override Vector3 ConvertSpineScale(Vector3 originalScale) + { + return originalScale; + } + + protected int GetSpineSortingOrder() + { + return -1; + } + + protected int GetMaskSortingOrder() + { + return -1; + } + + protected override int GetEmoteLabelDepth() + { + return 0; + } + + protected override int GetCharaId() + { + return GameMgr.GetIns().GetDataMgr().GetEnemyCharaId(); + } + + public override int GetSkinId() + { + return GameMgr.GetIns().GetDataMgr().GetEnemySkinId(); + } + + public override int GetStencil() + { + return 2; + } + + public override void SetAnimationEnable(bool enable) + { + _isAnimation = enable; + if (enable) + { + PlayMotion(ClassCharaPrm.MotionType.idle); + SetAnimatorSpeed(1f); + return; + } + Animator[] animators = _charaInfo.Animators; + for (int i = 0; i < animators.Length; i++) + { + animators[i].Play(ClassCharaPrm.MotionType.idle.ToString(), -1, 0f); + } + SetAnimatorSpeed(0f); + } + + private void SetAnimatorSpeed(float speed) + { + Animator[] animators = _charaInfo.Animators; + for (int i = 0; i < animators.Length; i++) + { + animators[i].speed = speed; + } + } + + public override float GetCurrentClipTime() + { + return 0f; + } + + public override bool GetCurrentClipIsName(ClassCharaPrm.MotionType motionType) + { + return false; + } + + protected override IEnumerator WaitReturnFrame() + { + yield return null; + } + + public override void OutFrame() + { + } + + public override int GetSpineSortingOrder(bool isBack = false) + { + if (!isBack) + { + return -1; + } + return -9; + } + + public override int GetMaskSortingOrder(bool isBack = false) + { + if (!isBack) + { + return -1; + } + return -9; + } + + public override void SetTrigger(string str) + { + } + + public override IEnumerator WaitChangeFace(ClassCharaPrm.FaceType faceType) + { + yield return null; + } + + public override IEnumerator WaitMotionEnd() + { + yield return null; + } + + public override void ChangeFace(ClassCharaPrm.FaceType faceType) + { + } + + public override void ClearResourceObject() + { + if (_class3DMaterial != null) + { + Object.Destroy(_class3DMaterial); + _class3DMaterial = null; + } + if (_norCamera != null && _norCamera.targetTexture != null) + { + _norCamera.targetTexture.Release(); + _norCamera.targetTexture = null; + } + if (_effectInfo != null) + { + _effectInfo.DestroyEffect(); + _effectInfo = null; + } + if (_charaInfo != null) + { + _charaInfo.Destroy(); + _charaInfo = null; + } + if (_root != null) + { + Object.Destroy(_root); + _root = null; + } + Toolbox.ResourcesManager.RemoveAsset(Toolbox.ResourcesManager.GetAssetTypePath(_classCharacterId.ToString(), ResourcesManager.AssetLoadPathType.ClassChara3D)); + } + + public override ClassCharaPrm.MotionType GetMotion() + { + return _currentMotion; + } + + public override bool IsNoEvolveShift() + { + return false; + } + + public override bool IsOpponentReverse() + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/ClassCharacterBase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/ClassCharacterBase.cs new file mode 100644 index 0000000..505fce8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/ClassCharacterBase.cs @@ -0,0 +1,202 @@ +using System.Collections; +using UnityEngine; +using Wizard.Battle.Sound; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Player.ClassCharacter; + +public abstract class ClassCharacterBase : IClassCharacter +{ + protected const float ENEMY_ORTHO_SCALE_X = 0.934f; + + protected Vector3 _initPosition; + + private LeaderSoundManager _leaderSoundManager; + + protected bool _isAnimation; + + protected GameObject _emotionLabel; + + protected GameObject _enviromentLabel; + + protected abstract Vector3 MessagePosition { get; } + + public GameObject GameObject { get; protected set; } + + public bool IsWaiting { get; private set; } + + public bool IsRecovery { get; private set; } + + protected ClassCharacterBase() + { + _leaderSoundManager = new LeaderSoundManager(); + } + + public abstract VfxBase CreateLoadResouceVfx(); + + public abstract void ClearResourceObject(); + + public abstract void PlayMotion(ClassCharaPrm.MotionType motionType); + + public abstract void ResetMotion(); + + public abstract void SetTrigger(string str); + + public abstract IEnumerator WaitMotionEnd(); + + public abstract void ChangeFace(ClassCharaPrm.FaceType faceType); + + public abstract IEnumerator WaitChangeFace(ClassCharaPrm.FaceType faceType); + + public abstract void SetAnimationEnable(bool enable); + + public abstract bool IsAnimationEnable(); + + public VfxBase CreateLoadVoiceResource(string voiceId) + { + OpeningVfx.OpenningLogStep = "CreateLoadVoiceResource " + voiceId; + return _leaderSoundManager.CreateLoadResouceVfx(voiceId); + } + + public VfxBase PlayVoice(string voiceId, bool forcePlay = false) + { + OpeningVfx.OpenningLogStep = "PlayVoice " + voiceId; + return _leaderSoundManager.CreatePlayVfx(voiceId, forcePlay); + } + + public VfxBase PlaySkinEvolveSe(string skinId, string suffix) + { + OpeningVfx.OpenningLogStep = "PlaySe " + skinId + suffix; + return _leaderSoundManager.CreateLoadAndPlayEvolveSeVfx(skinId, suffix); + } + + public VfxBase ShowVoiceMessage(string text) + { + return InstantVfx.Create(delegate + { + if (GameMgr.GetIns().IsWatchBattle) + { + if (GameMgr.GetIns().GetDataMgr().Is3DSkin(isPlayer: true)) + { + _emotionLabel.layer = 24; + } + else + { + _emotionLabel.SetLayer(24, isSetChildren: true); + } + } + else + { + _emotionLabel.layer = 24; + } + _emotionLabel.SetActive(value: true); + _emotionLabel.transform.Find("Scale/MessageLabel").GetComponent().text = text; + _emotionLabel.transform.position = MessagePosition; + }); + } + + public VfxBase HideVoiceMessage() + { + return InstantVfx.Create(delegate + { + _emotionLabel.SetActive(value: false); + }); + } + + public VfxBase SetWaiting(bool flag) + { + IsWaiting = flag; + return UpdateEnviromentMessage(); + } + + public VfxBase SetRecovery(bool flag) + { + IsRecovery = flag; + return UpdateEnviromentMessage(); + } + + public VfxBase ResetStatusInfo() + { + IsRecovery = false; + IsWaiting = false; + return UpdateEnviromentMessage(); + } + + public VfxBase UpdateEnviromentMessage() + { + return InstantVfx.Create(delegate + { + if (_enviromentLabel != null) + { + _enviromentLabel.layer = LayerMask.NameToLayer("FrontUI"); + string text = string.Empty; + if (IsRecovery) + { + text = Data.SystemText.Get("Battle_0473"); + } + else if (IsWaiting) + { + text = Data.SystemText.Get("Battle_0445"); + } + _enviromentLabel.SetActive(text != string.Empty); + _enviromentLabel.transform.Find("Scale/MessageLabel").GetComponent().text = text; + _enviromentLabel.transform.position = MessagePosition; + } + }); + } + + public abstract void OutFrame(); + + public void IntoFrame() + { + BattleCoroutine.GetInstance().StartCoroutine(WaitReturnFrame()); + } + + protected abstract IEnumerator WaitReturnFrame(); + + public abstract float GetCurrentClipTime(); + + public abstract bool GetCurrentClipIsName(ClassCharaPrm.MotionType motionType); + + protected abstract string GetTagName(); + + protected abstract Quaternion ConvertBackPanelRotation(Quaternion originalRotation); + + protected abstract Vector3 GetPosition(); + + protected abstract void SetUpAnchor(GameObject o); + + protected abstract void AttachOtherUI(GameObject o); + + public abstract Vector3 GetSpinePosition(); + + public abstract Vector3 GetMaskImagePosition(); + + protected abstract Vector3 GetShieldPosition(); + + protected abstract Vector3 GetLifeIconPosition(); + + protected abstract string GetTextureName(); + + public abstract Quaternion GetMaskImageRotation(); + + public abstract Vector3 ConvertSpineScale(Vector3 originalScale); + + public abstract int GetSpineSortingOrder(bool isBack = false); + + public abstract int GetMaskSortingOrder(bool isBack = false); + + protected abstract int GetEmoteLabelDepth(); + + protected abstract int GetCharaId(); + + public abstract int GetSkinId(); + + public abstract int GetStencil(); + + public abstract ClassCharaPrm.MotionType GetMotion(); + + public abstract bool IsNoEvolveShift(); + + public abstract bool IsOpponentReverse(); +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/HighRankSpineClassCharacter.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/HighRankSpineClassCharacter.cs new file mode 100644 index 0000000..72c55c8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/HighRankSpineClassCharacter.cs @@ -0,0 +1,447 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using Spine; +using UnityEngine; +using Wizard.Battle.Resource; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Player.ClassCharacter; + +public abstract class HighRankSpineClassCharacter : ClassCharacterBase +{ + public const string EFFECT_FILE_PATH = "Jpn/Effect/Effects/"; + + protected readonly float ScreenWidthFraction = 0.5f; + + protected readonly float ScreenHeightFraction = 0.05f; + + public SpineObject _backSpineObject; + + public SpineObject _frontSpineObject; + + private ClassCharaPrm.MotionType _currentMotion = ClassCharaPrm.MotionType.idle; + + public List EvolveEffects = new List(); + + public bool IsEvolveSkin { get; private set; } + + protected override Vector3 MessagePosition => UIManager.GetInstance().getCamera().ScreenToWorldPoint(new Vector3((float)Screen.width * ScreenWidthFraction, (float)Screen.height * ScreenHeightFraction, 0f)); + + public HighRankSpineClassCharacter() + { + } + + public static Vector3 BoneWorldToGlobalPosConsiderRotate(Bone _bone, Transform _position, Vector3 _lossyScale) + { + return _position.position + Quaternion.Euler(_position.eulerAngles) * (Vector3.Scale(new Vector3(_bone.WorldX, _bone.WorldY, 0f), _lossyScale) - Vector3.Scale(_position.localPosition, _position.lossyScale)); + } + + public IEnumerator TrackTarget(bool isFront, GameObject effect, Vector3 absolutePosition, bool _followX = true, bool _followY = true, Bone bone = null, bool trackRotation = false, Transform traskScale = null, float _coefficient = 1f) + { + GameObject spine = (isFront ? _frontSpineObject._spineObject : _backSpineObject._spineObject); + Transform transform = effect.transform; + Vector3 baseLocalScale = transform.localScale; + while (this != null && !(spine == null) && !(transform == null)) + { + if (_followX && _followY) + { + transform.position = BoneWorldToGlobalPosConsiderRotate(bone, spine.transform, spine.transform.lossyScale); + } + else if (!_followX) + { + Vector3 position = transform.position; + position.y = BoneWorldToGlobalPosConsiderRotate(bone, spine.transform, spine.transform.lossyScale).y; + transform.position = position; + } + else if (!_followY) + { + Vector3 position2 = transform.position; + position2.x = BoneWorldToGlobalPosConsiderRotate(bone, spine.transform, spine.transform.lossyScale).x; + transform.position = position2; + } + if (trackRotation && bone != null) + { + float num = (((bone.Skeleton.ScaleX < 0f) ^ (bone.Skeleton.ScaleY < 0f) ^ (spine.transform.localScale.x < 0f)) ? (-1f) : 1f); + Vector3 eulerAngles = transform.localRotation.eulerAngles; + transform.localRotation = Quaternion.Euler(eulerAngles.x, eulerAngles.y, bone.WorldRotationX * num); + } + if (traskScale != null) + { + transform.localScale = Vector3.Scale(baseLocalScale * _coefficient, traskScale.localScale); + } + yield return null; + } + } + + public static bool IsEvolveMotion(ClassCharaPrm.MotionType motionType) + { + if (motionType == ClassCharaPrm.MotionType.extra || (uint)(motionType - 15) <= 2u) + { + return true; + } + return false; + } + + public static bool IsOpponentEvolveMotion(ClassCharaPrm.MotionType motionType) + { + if ((uint)(motionType - 18) <= 2u) + { + return true; + } + return false; + } + + public override void PlayMotion(ClassCharaPrm.MotionType motionType) + { + if ((BattleManagerBase.GetIns() != null && BattleManagerBase.GetIns().IsRecovery) || (_frontSpineObject._animator == null && _backSpineObject._animator == null)) + { + return; + } + if (!_isAnimation) + { + if (!IsEvolveSkin) + { + return; + } + bool num = IsEvolveMotion(motionType); + bool flag = IsOpponentEvolveMotion(motionType); + if (num || flag) + { + _currentMotion = motionType; + if (_frontSpineObject._animator != null) + { + Animator animator = _frontSpineObject._animator; + animator.Play(ClassCharaPrm.MotionType.z_idle.ToString(), 0, animator.GetCurrentAnimatorStateInfo(0).normalizedTime); + } + if (_backSpineObject._animator != null) + { + Animator animator2 = _backSpineObject._animator; + animator2.Play(ClassCharaPrm.MotionType.z_idle.ToString(), 0, animator2.GetCurrentAnimatorStateInfo(0).normalizedTime); + } + } + else if (motionType == ClassCharaPrm.MotionType.z_idle && _currentMotion != motionType) + { + _currentMotion = motionType; + if (_frontSpineObject._animator != null) + { + _frontSpineObject._animator.Play(ClassCharaPrm.MotionType.z_idle.ToString(), 0, 0f); + } + if (_backSpineObject._animator != null) + { + _backSpineObject._animator.Play(ClassCharaPrm.MotionType.z_idle.ToString(), 0, 0f); + } + } + return; + } + _currentMotion = motionType; + bool isEvolve = IsEvolveMotion(motionType); + if (_frontSpineObject._animator != null && !isEvolve) + { + _frontSpineObject._animator.SetTrigger(motionType.ToString()); + } + if (_backSpineObject._animator != null && !isEvolve) + { + _backSpineObject._animator.SetTrigger(motionType.ToString()); + } + BattleCoroutine.GetInstance().StartCoroutine(WaitMotionEnd()); + if (isEvolve) + { + float normalizedTime = 1f / _frontSpineObject._animator.GetCurrentAnimatorClipInfo(0)[0].clip.frameRate; + if (_frontSpineObject._animator != null) + { + _frontSpineObject._animator.Play(motionType.ToString(), 0, normalizedTime); + } + if (_backSpineObject._animator != null) + { + _backSpineObject._animator.Play(motionType.ToString(), 0, normalizedTime); + } + } + if (BattleManagerBase.GetIns() == null) + { + new BattleResourceMgr(); + } + else + { + _ = BattleManagerBase.GetIns().BattleResourceMgr; + } + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + Transform effectTransform = ((_frontSpineObject._spineObject != null) ? _frontSpineObject._spineObject.transform : _backSpineObject._spineObject.transform); + foreach (HighRankEffectInfo effect in EvolveEffects) + { + if (!effect.IsEffectMotion(motionType) || !(effect.Prefab != "")) + { + continue; + } + Object original = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(effect.Prefab, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)); + EffectBattle effObject = (Object.Instantiate(original) as GameObject).AddComponent(); + effObject.gameObject.SetActive(value: false); + if (!isEvolve) + { + effObject.transform.SetParent(_frontSpineObject._skeletonMecanim.transform); + } + SequentialVfxPlayer sequentialVfxPlayer2 = SequentialVfxPlayer.Create(); + if (BattleManagerBase.GetIns() != null) + { + if (Global.PreLoadSkinId.Contains(GetSkinId()) && this is PlayerHighRankSpineClassCharacter) + { + sequentialVfxPlayer2.Register(InstantVfx.Create(delegate + { + GameMgr.GetIns().GetEffectMgr().SetOnlyUIParticleShader(effObject.gameObject); + })); + } + else + { + sequentialVfxPlayer2.Register(InstantVfx.Create(delegate + { + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(effObject.gameObject, delegate + { + }, isBattle: true); + })); + } + } + if (effect.Delay > 0) + { + sequentialVfxPlayer2.Register(WaitVfx.Create((float)effect.Delay / 30f)); + } + sequentialVfxPlayer2.Register(new DelaySetupVfx(() => new SkinEffectVfx(() => effObject, effectTransform, effect.Layer, isEvolve))); + if (effect.TargetBoneName != "") + { + sequentialVfxPlayer2.Register(InstantVfx.Create(delegate + { + BattleCoroutine.GetInstance().StartCoroutine(TrackTarget(isFront: true, effObject.gameObject, Vector3.zero, _followX: true, _followY: true, _frontSpineObject._skeletonMecanim.Skeleton.FindBone(effect.TargetBoneName))); + })); + } + parallelVfxPlayer.Register(sequentialVfxPlayer2); + } + sequentialVfxPlayer.Register(parallelVfxPlayer); + if (BattleManagerBase.GetIns() != null) + { + BattleManagerBase.GetIns().VfxMgr.RegisterImmediateVfx(sequentialVfxPlayer); + } + } + + public override void ResetMotion() + { + _currentMotion = ClassCharaPrm.MotionType.idle; + if (_frontSpineObject._animator != null) + { + _frontSpineObject._animator.Play(ClassCharaPrm.MotionType.idle.ToString(), 0, 0f); + } + if (_backSpineObject._animator != null) + { + _backSpineObject._animator.Play(ClassCharaPrm.MotionType.idle.ToString(), 0, 0f); + } + } + + public override ClassCharaPrm.MotionType GetMotion() + { + return _currentMotion; + } + + private void Load() + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + ClassCharacterMasterData charaPrmByCharaId = dataMgr.GetCharaPrmByCharaId(GetCharaId()); + bool isPlayer = this is PlayerHighRankSpineClassCharacter; + IsEvolveSkin = dataMgr.IsEvolveSkin(isPlayer); + GameObject gobj = new ClassCardCreator(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(charaPrmByCharaId.path, ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true))).LoadRootObject(); + int skinId = GetSkinId(); + GameObject gameObject = NGUITools.AddChild(BattleManagerBase.GetIns().Battle3DContainer); + gameObject.name = "ClassCharacterRoot"; + GameObject gameObject2 = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(gobj, gameObject); + SetUpAnchor(gameObject); + AttachOtherUI(gameObject); + GameObject gameObject3 = gameObject2.transform.Find("ClassObj").gameObject; + GameObject gameObject4 = gameObject2.transform.Find("Collider").gameObject; + base.GameObject = gameObject2; + base.GameObject.tag = GetTagName(); + base.GameObject.transform.localPosition = GetPosition(); + _initPosition = base.GameObject.transform.position; + gameObject3.transform.localScale = Global.CLASS_BATTLE_SCALE; + gameObject3.tag = GetTagName(); + gameObject4.tag = GetTagName(); + Transform transform = gameObject3.transform.Find("Class"); + transform.GetComponent().sharedMesh = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_" + skinId + "_Base", ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true)); + MotionUtils.SetLayerAll(transform.gameObject, 15); + Transform child = transform.transform.GetChild(0); + child.GetComponent().sharedMesh = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_" + skinId + "_Outside", ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true)); + MotionUtils.SetLayerAll(child.gameObject, 10); + CardTemplate cardTemplate = gameObject2.AddComponent(); + cardTemplate.CardWrapObjTemp = gameObject3; + cardTemplate.Collider = gameObject4.GetComponent(); + Transform transform2 = transform.transform; + transform2.localRotation = ConvertBackPanelRotation(transform2.localRotation); + GameObject gameObject5 = gameObject3.transform.Find("Shield").gameObject; + gameObject5.GetComponent().sharedMesh = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true)); + gameObject5.GetComponent().sharedMaterial = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true)); + gameObject5.GetComponent().sharedMaterial.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaTexture, isfetch: true)); + gameObject5.transform.localPosition = GetShieldPosition(); + gameObject5.transform.localScale = new Vector3(1.5f, 1.5f, 1f); + GameMgr.GetIns().GetEffectMgr().SetParticleShader(gameObject5); + MeshRenderer component = transform.GetComponent(); + MeshRenderer component2 = child.GetComponent(); + Material material = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_" + skinId + "_Frame", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true)) as Material; + if (material != null) + { + material.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_" + skinId + "_Frame", ResourcesManager.AssetLoadPathType.ClassCharaFrameTexture, isfetch: true)); + } + Material material2 = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(GetTextureName(), ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true)); + material2.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(((int)charaPrmByCharaId.ClassColorId).ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaEncampment, isfetch: true)); + CardCreatorBase.SetupClassMaterialToCenterCharacterMesh(component, component2, material2, material); + gameObject5.SetActive(value: true); + SBattleLoad sBattleLoad = BattleManagerBase.GetIns().SBattleLoad; + GameObject gameObject6 = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_class_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), BattleManagerBase.GetIns().Battle3DContainer); + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(gameObject6, null, isBattle: true, isField: true); + gameObject6.transform.parent = gameObject3.transform; + gameObject6.transform.localPosition = new Vector3(0f, 0.1f, 0.15f); + gameObject6.transform.localRotation = GetMaskImageRotation(); + gameObject6.transform.localScale = new Vector3(6.4f, 6.4f, 20.48f); + gameObject6.SetActive(value: false); + cardTemplate.FrameEffectNormal = gameObject6; + GameObject gameObject7 = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(sBattleLoad.LifePoolIcon, BattleManagerBase.GetIns().Battle3DContainer); + gameObject7.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); + gameObject7.transform.parent = gameObject5.transform; + gameObject7.transform.localPosition = GetLifeIconPosition(); + gameObject3.transform.localScale = new Vector3(80f, 80f, 25f); + gameObject4.transform.localScale = new Vector3(80f, 80f, 25f); + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(0); + (cardTemplate.LifeLabelTemp = gameObject7.transform.Find("LifeLabel").GetComponent()).text = cardParameterFromId.Life.ToString(); + _frontSpineObject = new SpineObject(); + _frontSpineObject.LoadAndSet(skinId.ToString(), this, gameObject3.transform); + _backSpineObject = new SpineObject(); + _backSpineObject.LoadAndSet(skinId.ToString(), this, gameObject3.transform, isBack: true); + string key = "class_" + skinId; + if (Data.Master.HighRankEffect.ContainsKey(key)) + { + EvolveEffects = Data.Master.HighRankEffect[key]; + } + GameMgr.GetIns().GetPrefabMgr().Load("UI/Battle/EmotionMessage"); + _emotionLabel = NGUITools.AddChild(BattleManagerBase.GetIns().BtlUIContainer, GameMgr.GetIns().GetPrefabMgr().Get("UI/Battle/EmotionMessage")); + _emotionLabel.transform.Find("Scale").GetComponent().depth = GetEmoteLabelDepth(); + _emotionLabel.SetActive(value: false); + GameMgr.GetIns().GetPrefabMgr().Load("UI/Battle/EnvironmentMessage"); + _enviromentLabel = NGUITools.AddChild(BattleManagerBase.GetIns().BtlUIContainer, GameMgr.GetIns().GetPrefabMgr().Get("UI/Battle/EnvironmentMessage")); + _enviromentLabel.SetActive(value: false); + base.GameObject.SetActive(value: false); + } + + public override VfxBase CreateLoadResouceVfx() + { + return InstantVfx.Create(delegate + { + Load(); + }); + } + + public override void ClearResourceObject() + { + if (_frontSpineObject != null) + { + _frontSpineObject.Clear(); + } + if (_backSpineObject != null) + { + _backSpineObject.Clear(); + } + } + + protected override IEnumerator WaitReturnFrame() + { + BattleCoroutine.GetInstance().StartCoroutine(_backSpineObject.WaitReturnFrame(GetSpinePosition(), isHighRank: true)); + yield return _frontSpineObject.WaitReturnFrame(GetSpinePosition(), isHighRank: true); + } + + public override void OutFrame() + { + if (_isAnimation) + { + _frontSpineObject.OutFrame(isHighRank: true); + _backSpineObject.OutFrame(isHighRank: true); + } + } + + public override void SetTrigger(string str) + { + _frontSpineObject._animator.SetTrigger(str); + _backSpineObject._animator.SetTrigger(str); + } + + public override IEnumerator WaitChangeFace(ClassCharaPrm.FaceType faceType) + { + yield return null; + string faceStr = faceType.ToString(); + _frontSpineObject.WaitChangeFace(faceStr); + _backSpineObject.WaitChangeFace(faceStr); + } + + public override void SetAnimationEnable(bool enable) + { + bool isAnimation = _isAnimation; + _isAnimation = enable; + BattleManagerBase ins = BattleManagerBase.GetIns(); + bool isPlayer = this is PlayerHighRankSpineClassCharacter; + bool isEvolved = false; + if (ins != null) + { + isEvolved = ins.GetBattlePlayer(isPlayer).IsSkinEvolved; + } + _frontSpineObject.SetAnimationEnable(_isAnimation, isAnimation, IsEvolveSkin, isEvolved); + _backSpineObject.SetAnimationEnable(_isAnimation, isAnimation, IsEvolveSkin, isEvolved); + } + + public override bool IsAnimationEnable() + { + return _isAnimation; + } + + public override IEnumerator WaitMotionEnd() + { + yield return null; + float num = 0f; + if (_frontSpineObject._animator != null) + { + num = ((!GetCurrentClipIsName(ClassCharaPrm.MotionType.idle)) ? _frontSpineObject._animator.GetCurrentAnimatorStateInfo(0).length : (_frontSpineObject._animator.GetCurrentAnimatorStateInfo(0).length * 0.5f)); + } + num -= Time.deltaTime * 2f; + yield return new WaitForSeconds(num); + ChangeFace(ClassCharaPrm.FaceType.skin_01); + } + + public override void ChangeFace(ClassCharaPrm.FaceType faceType) + { + if (BattleManagerBase.GetIns() != null && !BattleManagerBase.GetIns().IsRecovery && _isAnimation && !(_frontSpineObject._skeletonMecanim == null)) + { + BattleCoroutine.GetInstance().StartCoroutine(WaitChangeFace(faceType)); + } + } + + public override float GetCurrentClipTime() + { + if (_frontSpineObject._animator == null) + { + return 0f; + } + return _frontSpineObject._animator.GetCurrentAnimatorStateInfo(0).length; + } + + public override bool GetCurrentClipIsName(ClassCharaPrm.MotionType motionType) + { + if (_frontSpineObject._animator == null) + { + return false; + } + return _frontSpineObject._animator.GetCurrentAnimatorStateInfo(0).IsName(motionType.ToString()); + } + + public override bool IsNoEvolveShift() + { + return false; + } + + public override bool IsOpponentReverse() + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/SpineObject.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/SpineObject.cs new file mode 100644 index 0000000..fbdfe85 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/SpineObject.cs @@ -0,0 +1,379 @@ +using System.Collections; +using System.Linq; +using Cute; +using Spine; +using Spine.Unity; +using UnityEngine; + +namespace Wizard.Battle.Player.ClassCharacter; + +public class SpineObject +{ + protected readonly string ANIMATION_TRANSFORM_NAME = "AnimationTransform"; + + public const float SPINE_CORRECTION_SCALE = 1.003125f; + + public const float SPINE_ORTHO_SCALE_Y = 1.1207f; + + protected readonly Vector3 SPINE_DEFAULT_SCALE = new Vector3(6.4f, 6.4f, 20.48f) * 1.003125f; + + protected readonly Vector3 SPINE_EVOLVE_ROTATION = new Vector3(-29f, 0f, 0f); + + protected readonly Vector3 OUT_OF_FRAME_POSITION = new Vector3(3f, 2f, -6f); + + public static readonly Vector3 BILLBOARD_ROTATE = new Vector3(-12f, 0f, 0f); + + public static readonly Vector3 BILLBOARD_ROTATE_REVERSE_VERTICAL = new Vector3(-12f, 0f, 180f); + + protected readonly Vector3 BILLBOARD_ROTATE_EVOLVE = new Vector3(-29f, 0f, 0f); + + protected readonly Vector3 SPINE_EVOLVE_SCALE = new Vector3(5.8f, 6.5f, 20.48f) * 1.003125f; + + public static readonly Vector3 OPPONENT_MECANIM_POSITION = new Vector3(0f, -0.2f, 0f); + + public GameObject _spineObject; + + protected Transform _animationTransform; + + protected SpriteRenderer _maskOutSprite; + + protected Material _spineMaterial; + + protected Material _maskMaterial; + + protected Vector3 _spineEvolveScale; + + protected ClassCharacterBase _character; + + public SkeletonMecanim _skeletonMecanim { get; private set; } + + public Animator _animator { get; private set; } + + public SpriteRenderer _maskSprite { get; protected set; } + + public bool IsBack { get; private set; } + + public bool IsNoEvolveShift { get; private set; } + + public bool IsOpponentReverse { get; private set; } + + private string MaskTextureName(string skinId) + { + if (_character is HighRankSpineClassCharacter) + { + return "tx_Encampment_" + skinId + "_mask"; + } + if (Global.IsSnCollabSkin(int.Parse(skinId))) + { + return "tx_Encampment_sn_mask"; + } + return "tx_encampment_mask"; + } + + private void SetMaterialInfo(MeshRenderer meshRenderer, int stencil) + { + _spineMaterial = Object.Instantiate(meshRenderer.material); + _spineMaterial.SetInt("_Stencil", stencil); + meshRenderer.material = _spineMaterial; + for (int i = 0; i < meshRenderer.materials.Length; i++) + { + Material material = meshRenderer.materials[i]; + if (material != null && material.GetInt("_Stencil") != stencil) + { + meshRenderer.materials[i] = Object.Instantiate(material); + meshRenderer.materials[i].SetInt("_Stencil", stencil); + } + } + } + + public void LoadAndSetTest(string skinId, ClassCharacterBase character, Transform wrapObject, bool isBack = false) + { + _spineObject = null; + _character = character; + IsBack = isBack; + IsNoEvolveShift = _character.IsNoEvolveShift(); + GameObject gameObject = Resources.Load("Jpn/Ui/ClassChar/Prefab/class_" + skinId); + if (!(gameObject != null)) + { + return; + } + _maskSprite = new GameObject().AddComponent(); + _maskSprite.sprite = Resources.Load("Jpn/Ui/ClassChar/Textures/" + MaskTextureName(skinId)); + _maskMaterial = Object.Instantiate(Resources.Load("Jpn/Ui/ClassChar/Materials/mt_encampment_mask")); + _maskMaterial.SetInt("_Stencil", character.GetStencil()); + _maskSprite.material = _maskMaterial; + _maskSprite.transform.parent = wrapObject; + _maskSprite.transform.localPosition = character.GetMaskImagePosition(); + _maskSprite.transform.localScale = Vector3.one * 0.46f; + _maskSprite.gameObject.layer = 15; + _maskSprite.sortingOrder = character.GetMaskSortingOrder(IsBack); + _maskSprite.name = "SpineMask"; + _maskSprite.transform.localRotation = character.GetMaskImageRotation(); + _maskOutSprite = new GameObject().AddComponent(); + _maskOutSprite.sprite = Resources.Load("Jpn/Ui/ClassChar/Textures/tx_encampment_mask_out"); + _maskOutSprite.material = _maskMaterial; + _maskOutSprite.transform.parent = wrapObject; + _maskOutSprite.transform.localPosition = character.GetMaskImagePosition(); + _maskOutSprite.transform.localScale = new Vector3(30f, 30f, 1f); + _maskOutSprite.gameObject.layer = 10; + _maskOutSprite.sortingOrder = character.GetMaskSortingOrder(IsBack); + _maskOutSprite.name = "SpineMaskOut"; + _maskOutSprite.gameObject.SetActive(value: false); + if (character is HighRankSpineClassCharacter) + { + GameObject gameObject2 = null; + foreach (Transform item in gameObject.transform) + { + if (item.gameObject.name == (IsBack ? "back" : "front")) + { + gameObject2 = item.gameObject; + break; + } + } + if (!(gameObject2 != null)) + { + return; + } + gameObject = gameObject2; + } + _spineObject = Object.Instantiate(gameObject); + _animationTransform = _spineObject.transform.Find(ANIMATION_TRANSFORM_NAME); + Transform transform2 = _spineObject.transform; + MotionUtils.SetLayerAll(_spineObject, 15); + transform2.parent = wrapObject; + transform2.localPosition = character.GetSpinePosition(); + transform2.localScale = character.ConvertSpineScale(transform2.localScale); + transform2.localEulerAngles = GetDefaultRotate(); + _skeletonMecanim = transform2.GetComponentInChildren(); + if (IsOpponentReverse) + { + _skeletonMecanim.transform.localPosition = OPPONENT_MECANIM_POSITION; + } + MeshRenderer component = _skeletonMecanim.GetComponent(); + component.sortingOrder = character.GetSpineSortingOrder(IsBack); + _animator = transform2.GetComponentInChildren(); + _animator.speed = 1f; + SetMaterialInfo(component, character.GetStencil()); + _spineEvolveScale = new Vector3(SPINE_DEFAULT_SCALE.x * Mathf.Abs(_animationTransform.localScale.x), SPINE_DEFAULT_SCALE.y * Mathf.Abs(_animationTransform.localScale.y) * 1.1207f, SPINE_DEFAULT_SCALE.z * Mathf.Abs(_animationTransform.localScale.z)) * 1.3f; + } + + public void LoadAndSet(string skinId, ClassCharacterBase character, Transform wrapObject, bool isBack = false) + { + IsBack = isBack; + _character = character; + IsNoEvolveShift = _character.IsNoEvolveShift(); + IsOpponentReverse = _character.IsOpponentReverse(); + _maskSprite = new GameObject().AddComponent(); + _maskSprite.sprite = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(MaskTextureName(skinId), ResourcesManager.AssetLoadPathType.ClassCharaTexture, isfetch: true)); + _maskMaterial = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("mt_encampment_mask", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true))); + _maskMaterial.SetInt("_Stencil", character.GetStencil()); + _maskSprite.material = _maskMaterial; + _maskSprite.transform.parent = wrapObject; + _maskSprite.transform.localPosition = character.GetMaskImagePosition(); + _maskSprite.transform.localScale = Vector3.one * 0.46f; + _maskSprite.gameObject.layer = 15; + _maskSprite.sortingOrder = character.GetMaskSortingOrder(IsBack); + _maskSprite.name = "SpineMask"; + _maskSprite.transform.localRotation = character.GetMaskImageRotation(); + _maskOutSprite = new GameObject().AddComponent(); + _maskOutSprite.sprite = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("tx_encampment_mask_out", ResourcesManager.AssetLoadPathType.ClassCharaTexture, isfetch: true)); + _maskOutSprite.material = _maskMaterial; + _maskOutSprite.transform.parent = wrapObject; + _maskOutSprite.transform.localPosition = character.GetMaskImagePosition(); + _maskOutSprite.transform.localScale = new Vector3(30f, 30f, 1f); + _maskOutSprite.gameObject.layer = 10; + _maskOutSprite.sortingOrder = character.GetMaskSortingOrder(IsBack); + _maskOutSprite.name = "SpineMaskOut"; + _maskOutSprite.gameObject.SetActive(value: false); + _spineObject = null; + GameObject gameObject = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(skinId, ResourcesManager.AssetLoadPathType.ClassCharaSpine, isfetch: true)); + if (!(gameObject != null)) + { + return; + } + if (character is HighRankSpineClassCharacter) + { + GameObject gameObject2 = null; + foreach (Transform item in gameObject.transform) + { + if (item.gameObject.name == (IsBack ? "back" : "front")) + { + gameObject2 = item.gameObject; + break; + } + } + if (!(gameObject2 != null)) + { + return; + } + gameObject = gameObject2; + } + _spineObject = Object.Instantiate(gameObject); + _animationTransform = _spineObject.transform.Find(ANIMATION_TRANSFORM_NAME); + MotionUtils.SetLayerAll(_spineObject, 15); + Transform transform2 = _spineObject.transform; + transform2.parent = wrapObject; + transform2.localPosition = character.GetSpinePosition(); + transform2.localScale = character.ConvertSpineScale(transform2.localScale); + transform2.localEulerAngles = GetDefaultRotate(); + _skeletonMecanim = transform2.GetComponentInChildren(); + if (IsOpponentReverse) + { + _skeletonMecanim.transform.localPosition = OPPONENT_MECANIM_POSITION; + } + MeshRenderer component = _skeletonMecanim.GetComponent(); + component.sortingOrder = character.GetSpineSortingOrder(IsBack); + _animator = transform2.GetComponentInChildren(); + _animator.speed = 1f; + SetMaterialInfo(component, character.GetStencil()); + _spineEvolveScale = new Vector3(SPINE_DEFAULT_SCALE.x * Mathf.Abs(_animationTransform.localScale.x), SPINE_DEFAULT_SCALE.y * Mathf.Abs(_animationTransform.localScale.y) * 1.1207f, SPINE_DEFAULT_SCALE.z * Mathf.Abs(_animationTransform.localScale.z)) * 1.3f; + } + + private Vector3 GetDefaultRotate() + { + if (!IsOpponentReverse) + { + return BILLBOARD_ROTATE; + } + return BILLBOARD_ROTATE_REVERSE_VERTICAL; + } + + public void Clear() + { + if (_spineObject != null) + { + Object.Destroy(_spineObject); + } + _spineObject = null; + _skeletonMecanim = null; + _animator = null; + _spineMaterial = null; + _maskMaterial = null; + } + + public void WaitChangeFace(string faceStr) + { + if (_skeletonMecanim != null) + { + _ = _skeletonMecanim.skeleton; + if (_skeletonMecanim.skeleton.Data.Skins.Any((Skin a) => a.Name == faceStr)) + { + _skeletonMecanim.skeleton.SetSkin(faceStr); + } + } + } + + public void OutFrame(bool isHighRank) + { + if (_maskOutSprite == null) + { + return; + } + _maskOutSprite.gameObject.SetActive(value: true); + if (!(_spineObject != null)) + { + return; + } + if (isHighRank) + { + _maskOutSprite.gameObject.layer = 13; + _spineObject.layer = 13; + _skeletonMecanim.gameObject.layer = 13; + if (_character is PlayerHighRankSpineClassCharacter) + { + iTween.RotateTo(_spineObject, iTween.Hash("rotation", BILLBOARD_ROTATE_EVOLVE, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(_spineObject, iTween.Hash("scale", SPINE_EVOLVE_SCALE, "time", 0.3f, "easetype", iTween.EaseType.easeOutExpo)); + } + return; + } + if (_skeletonMecanim != null) + { + _spineObject.layer = 10; + _skeletonMecanim.gameObject.layer = 10; + _skeletonMecanim.gameObject.GetComponent().sortingOrder = 1000; + _maskOutSprite.sortingOrder = 1000; + } + if (IsNoEvolveShift) + { + _maskOutSprite.gameObject.layer = 13; + _spineObject.layer = 13; + _skeletonMecanim.gameObject.layer = 13; + return; + } + iTween.MoveTo(_spineObject, iTween.Hash("position", OUT_OF_FRAME_POSITION + _animationTransform.localPosition, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(_spineObject, iTween.Hash("scale", _spineEvolveScale, "time", 0.3f, "easetype", iTween.EaseType.easeOutExpo)); + iTween.RotateTo(_spineObject, iTween.Hash("rotation", SPINE_EVOLVE_ROTATION, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + public void SetAnimationEnable(bool isAnimation, bool previous, bool isEvolveSkin = false, bool isEvolved = false) + { + if (_animator == null) + { + return; + } + if (isEvolveSkin) + { + if (previous != isAnimation) + { + _animator.Play(((!isEvolved) ? ClassCharaPrm.MotionType.idle : ClassCharaPrm.MotionType.z_idle).ToString(), 0, 0f); + } + _animator.speed = (isAnimation ? 1 : 0); + return; + } + _animator.gameObject.SetActive(value: false); + _animator.gameObject.SetActive(value: true); + if (isAnimation) + { + _animator.enabled = true; + return; + } + _animator.enabled = false; + string faceStr = ClassCharaPrm.FaceType.skin_01.ToString(); + if (_skeletonMecanim.skeleton.Data.Skins.Any((Skin a) => a.Name == faceStr)) + { + _skeletonMecanim.skeleton.SetSkin(faceStr); + } + _skeletonMecanim.skeleton.Update(Time.deltaTime); + } + + public IEnumerator WaitReturnFrame(Vector3 position, bool isHighRank) + { + if (_spineObject != null && !IsNoEvolveShift) + { + if (!isHighRank) + { + iTween.MoveTo(_spineObject, iTween.Hash("position", position, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInExpo)); + } + iTween.ScaleTo(_spineObject, iTween.Hash("scale", SPINE_DEFAULT_SCALE, "time", isHighRank ? 0.24f : 0.3f, "easetype", iTween.EaseType.easeInExpo)); + iTween.RotateTo(_spineObject, iTween.Hash("rotation", GetDefaultRotate(), "time", isHighRank ? 0.24f : 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInExpo)); + } + yield return new WaitForSeconds(isHighRank ? 0.3f : 0.33f); + if (!IsNoEvolveShift) + { + SetDefaultLayer(isHighRank); + } + } + + public void SetDefaultLayer(bool isHighRank) + { + if (_spineObject != null) + { + if (isHighRank || IsNoEvolveShift) + { + _maskOutSprite.gameObject.layer = 10; + } + _spineObject.layer = 15; + _skeletonMecanim.gameObject.layer = 15; + } + if (_skeletonMecanim != null) + { + _skeletonMecanim.gameObject.GetComponent().sortingOrder = _character.GetSpineSortingOrder(IsBack); + _maskOutSprite.sortingOrder = _character.GetMaskSortingOrder(IsBack); + _maskSprite.sortingOrder = _character.GetMaskSortingOrder(IsBack); + } + if (_maskOutSprite != null) + { + _maskOutSprite.gameObject.SetActive(value: false); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/Debug722006NullVfx.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/Debug722006NullVfx.cs new file mode 100644 index 0000000..b2bda80 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/Debug722006NullVfx.cs @@ -0,0 +1,8 @@ +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Player.Emotion; + +public class Debug722006NullVfx : VfxBase +{ + public override bool IsEnd => true; +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/OperationRecorderBase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/OperationRecorderBase.cs new file mode 100644 index 0000000..aef782d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/OperationRecorderBase.cs @@ -0,0 +1,188 @@ +using System.Collections.Generic; +using System.IO; +using Cute; +using LitJson; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Recovery; + +public abstract class OperationRecorderBase +{ + protected readonly string _filePath; + + protected readonly List _operationJsonDataList = new List(); + + protected readonly List _skillTargetList = new List(); + + public static string RecordDirectoryName => "recovery"; + + public static string RecordDirectoryPath => Application.persistentDataPath + "/" + RecordDirectoryName + "/"; + + public OperationRecorderBase(string filePath) + { + _filePath = filePath; + } + + public abstract void RecordBattleType(DataMgr.BattleType battleType); + + public abstract void RecordRandomSeed(int randomSeed); + + public abstract void RecordBackGroundId(int backGroundId); + + public abstract void RecordBgmId(string bgmId); + + public abstract void RecordClass(string playerName, int clanType); + + public abstract void RecordSubClass(string playerName, int clanType); + + public abstract void RecordMyRotationId(string playerName, string myRotationId); + + public abstract void RecordSleeve(string playerName, long sleeveId); + + public abstract void RecordChara(string playerName, int charaId); + + public abstract void RecordDeck(string playerName, char indexHeadChar, IEnumerable cardIds); + + public abstract void RecordEnemyAIDifficulty(int difficulty); + + public abstract void RecordEnemyAILogicLevel(int level); + + public abstract void RecordEnemyAIMaxLife(int life); + + public abstract void RecordEnemyAIDeckId(int deckId); + + public abstract void RecordEnemyAIStyleId(int styleId); + + public abstract void RecordEnemyAIEmoteId(int emoteId); + + public abstract void RecordEnemyAIUseInnerEmote(bool useInnerEmote); + + public abstract void RecordStartTurnIsPlayer(bool startTurnIsPlayer); + + public abstract void RecordPracticeDifficultyDegreeId(int degreeId); + + public abstract void RecordIsPreBuildDeck(bool isPreBuildDeck); + + public abstract void RecordIsTrialDeck(bool isTrialDeck); + + public abstract void RecordIsDefaultDeck(bool isDefaultDeck); + + public abstract void RecordQuestStageId(int id); + + public abstract void RecordQuestEnemyAiId(int id); + + public abstract void RecordQuestEnemyEmblemId(int id); + + public abstract void RecordQuestEnemyDegreeId(int id); + + public abstract void RecordQuestEnemyEmotionOverride(int id); + + public abstract void RecordQuestPlayerEmotionOverride(int id); + + public abstract void RecordQuestRecoveryPoint(int recoveryPoint); + + public abstract void RecordQuestPlayerSkillList(List skills); + + public abstract void RecordQuestEnemySkill(BossRushSpecialSkill skill); + + public abstract void RecordQuestMaxBattleCount(int maxBattleCount); + + public abstract void RecordQuestCurrentWinCount(int currentWinCount); + + public abstract void RecordQuestIsExtra(bool isExtra); + + public abstract void RecordQuestIsMockBattle(bool isMockBattle); + + public abstract void RecordQuestExtraDeckScheduleId(int id); + + public abstract void RecordMissionNecessaryInformation(BattleManagerBase.MissionNecessaryInformation missionNecessaryInformation); + + public virtual void RecordStoryData() + { + } + + public abstract void RecordPractice3DFieldId(int id); + + public abstract void RecordMulliganStart(); + + public abstract void RecordPlayerMulliganReplaceCards(IEnumerable replaceCards, IEnumerable completeCards); + + public abstract void RecordEnemyMulliganReplaceCards(IEnumerable replaceCards, IEnumerable completeCards); + + public abstract void RecordPlay(BattleCardBase originalCard, BattleCardBase card, IEnumerable selectedCard); + + public abstract VfxBase RecordAttack(BattleCardBase attackCard, BattleCardBase targetCard, SkillProcessor skillProcessor); + + public abstract void RecordEvolve(BattleCardBase originalCard, BattleCardBase card, IEnumerable selectedCard); + + public abstract void RecordTurnStart(); + + public abstract void RecordTurnEnd(); + + public abstract void RecordRetire(); + + public abstract void RecordSkillTargets(IEnumerable targetCards); + + public abstract void RecordStartFusion(BattleCardBase fusionCard, List selectableCards); + + public abstract void RecordSelectFusion(BattleCardBase card); + + public abstract void RecordCompleteFusionSelect(BattleCardBase fusionCard, IEnumerable ingredientCards); + + public abstract void RecordCancelFusion(BattleCardBase card); + + public abstract void RecordStartSelect(BattleCardBase card, bool isEvolve, List selectableCard, bool isChoiceBrave); + + public abstract void RecordSelect(BattleCardBase card, bool isEvolve, BattleCardBase actCard, bool isBurialRite, bool isChoiceBrave); + + public abstract void RecordCompleteSelect(BattleCardBase card, bool isEvolve, BattleCardBase actCard, bool isChoiceBrave, bool isBurialRite); + + public abstract void RecordStartChoice(BattleCardBase card, bool isEvolve, List choiceCards, bool isChoiceBrave); + + public abstract void RecordCompleteChoice(BattleCardBase card, bool isEvolve, List chosenCardList, BattleCardBase actCard, List chosenCardIndexList, bool hasSelectionSkill, bool isChoiceBrave); + + public abstract void RecordCancelChoice(BattleCardBase card, bool isEvolve, bool isChoiceBrave); + + public abstract void RecordCancelSelect(BattleCardBase actCard, bool isEvolve, bool isChoiceBrave); + + protected abstract void WriteJsonData(); + + protected virtual void WriteJsonDataToFile(JsonData jsonData, string overrideFilePath = "") + { + string text = (string.IsNullOrEmpty(overrideFilePath) ? _filePath : overrideFilePath); + try + { + using StreamWriter streamWriter = new StreamWriter(text); + streamWriter.Write(CryptAES.encryptForNode(jsonData.ToJson())); + } + catch + { + LocalLog.AccumulateTraceLog("File Unauthorized to Access:" + text); + } + } + + protected string CardToIndexName(IBattleCardUniqueID card) + { + if (card == null) + { + return string.Empty; + } + return card.GetName(); + } + + protected void WriteSkillTargetInfoToJson(IEnumerable selectedCards, JsonData jsonData) + { + if (!selectedCards.IsNotNullOrEmpty()) + { + return; + } + JsonData jsonData2 = new JsonData(); + jsonData2.SetJsonType(JsonType.Array); + foreach (BattleCardBase selectedCard in selectedCards) + { + jsonData2.Add(CardToIndexName(selectedCard)); + } + jsonData["skill_target"] = jsonData2; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/RecoveryManagerBase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/RecoveryManagerBase.cs new file mode 100644 index 0000000..09cd20d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/RecoveryManagerBase.cs @@ -0,0 +1,281 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; +using Wizard.Story.ChapterSelection; + +namespace Wizard.Battle.Recovery; + +public abstract class RecoveryManagerBase : IRecoveryManager +{ + protected readonly RecoveryOperationInfo _operationInfo; + + protected bool _needUpdate; + + private readonly Queue _skillTargetNameQueue; + + protected Action StartRecoveryEvent; + + protected Action EndDataRecoveryEvent; + + protected Action EndRecoveryEvent; + + protected RecoveryController _recoveryController; + + public DataMgr.BattleType BattleType => _operationInfo.BattleType; + + public bool? DidPlayerGoFirst => _operationInfo.SetupInfo.DidPlayerGoFirst; + + public int RandomSeed => _operationInfo.SetupInfo.RandomSeed; + + public bool HasMulliganInfo => _operationInfo.SetupInfo.HasMulliganInfo; + + public int BackGroundId => _operationInfo.SetupInfo.BackGroundId; + + public string BgmId => _operationInfo.SetupInfo.BgmId; + + public long RecordTime => _operationInfo.RecordTime; + + public int IdxChangeSeed => -1; + + public static bool failedRecoveryFlag { get; private set; } + + public event Action OnStartRecovery + { + add + { + StartRecoveryEvent = (Action)Delegate.Combine(StartRecoveryEvent, value); + } + remove + { + StartRecoveryEvent = (Action)Delegate.Remove(StartRecoveryEvent, value); + } + } + + public event Action OnEndDataRecovery + { + add + { + EndDataRecoveryEvent = (Action)Delegate.Combine(EndDataRecoveryEvent, value); + } + remove + { + EndDataRecoveryEvent = (Action)Delegate.Remove(EndDataRecoveryEvent, value); + } + } + + public event Action OnEndRecovery + { + add + { + EndRecoveryEvent = (Action)Delegate.Combine(EndRecoveryEvent, value); + } + remove + { + EndRecoveryEvent = (Action)Delegate.Remove(EndRecoveryEvent, value); + } + } + + public static void OpenRecoveryFailedDialog() + { + AbortSoloPlayRecoveryTask task = new AbortSoloPlayRecoveryTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("ErrorHeader_20001")); + dialogBase.SetText(Data.SystemText.Get("Error_20001")); + dialogBase.AddButton(DialogBase.ButtonType.BackToTitle); + dialogBase.SetPanelDepth(6000); + dialogBase.SetFadeButtonEnabled(flag: false); + dialogBase.onPushButton1 = (Action)Delegate.Combine(dialogBase.onPushButton1, (Action)delegate + { + failedRecoveryFlag = false; + UIManager.GetInstance().StartCoroutine(GameMgr.GetIns().GetBattleCtrl().BattleEnd()); + }); + failedRecoveryFlag = true; + RecoveryRecordManagerBase.DeleteRecoveryFile(); + })); + } + + public RecoveryManagerBase(string filePath) + { + try + { + _operationInfo = new RecoveryOperationInfo(filePath); + _skillTargetNameQueue = new Queue(_operationInfo.SkillTargetCardNames); + } + catch (Exception) + { + OpenRecoveryFailedDialog(); + } + } + + public void Setup() + { + try + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + dataMgr.m_BattleType = _operationInfo.BattleType; + SetupConditionInfo setupInfo = _operationInfo.SetupInfo; + BattleConditionPlayerInfo playerInfo = setupInfo.PlayerInfo; + BattleConditionEnemyInfo enemyInfo = setupInfo.EnemyInfo; + int enemyAiID = -1; + List currentDeckData = playerInfo.DeckCardInfos.Select((DeckCardInfo i) => i.CardId.Value).ToList(); + List specialAbilityIdList = null; + dataMgr.SetCurrentDeckData(currentDeckData); + dataMgr.SetPlayerCharaId(playerInfo.CharaId); + dataMgr.SetPlayerSubClassID(playerInfo.SubClassId); + dataMgr.SetPlayerMyRotationInfo(playerInfo.MyRotationId); + dataMgr.SetPlayerSleeveId(playerInfo.SleeveId); + dataMgr.PracticeDifficultyDegreeId = setupInfo.PracticeDifficultyDegreeId; + dataMgr.MissionNecessaryInformation = setupInfo.MissionNecessaryInformation; + if (setupInfo.IsPrebuildDeck) + { + dataMgr.LastSelectDeckAttributeType = DeckAttributeType.BuildDeck; + } + if (setupInfo.IsTrialDeck) + { + dataMgr.LastSelectDeckAttributeType = DeckAttributeType.TrialDeck; + } + if (dataMgr.m_BattleType == DataMgr.BattleType.Quest) + { + dataMgr.SetSoroPlay3DFieldID(setupInfo.BackGroundId); + dataMgr.SetQuestBattleData(new QuestBattleData(setupInfo)); + enemyAiID = setupInfo.QuestEnemyAiId; + } + if (dataMgr.m_BattleType == DataMgr.BattleType.BossRushQuest || dataMgr.m_BattleType == DataMgr.BattleType.SecretBossQuest) + { + dataMgr.SetSoroPlay3DFieldID(setupInfo.BackGroundId); + dataMgr.SetBossRushBattleData(new BossRushBattleData(setupInfo)); + specialAbilityIdList = dataMgr.BossRushBattleData.PlayerSkillList.Select((BossRushSpecialSkill s) => s.OriginalCardId).ToList(); + enemyAiID = setupInfo.QuestEnemyAiId; + } + else if (dataMgr.m_BattleType == DataMgr.BattleType.Practice) + { + dataMgr.SetSoroPlay3DFieldID(BackGroundId); + } + else if (dataMgr.m_BattleType == DataMgr.BattleType.Story) + { + UIManager.GetInstance().OverrideSceneParam(UIManager.ViewScene.ClassSelectionPage, ClassSelectionPageParam.CreateStorySelect()); + AreaSelectUI.SetRecoveryData(setupInfo); + if (setupInfo.IsDefaultDeck) + { + dataMgr.LastSelectDeckAttributeType = DeckAttributeType.DefaultDeck; + } + } + dataMgr.SetEnemyCharaId(enemyInfo.CharaId); + dataMgr.SetEnemySubClassID(enemyInfo.SubClassId); + dataMgr.SetEnemyMyRotationInfo(enemyInfo.MyRotationId); + dataMgr.SetEnemySleeveId(enemyInfo.SleeveId); + dataMgr.SetSelectDeckFormat((Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_FORMAT_FOR_SINGLE_RECOVER)); + Data.CurrentFormat = dataMgr.GetSelectDeckFormat(); + CardMaster.SetBattleCardMasterId(FormatBehaviorManager.GetDefaultBehaviour(dataMgr.GetSelectDeckFormat()).CardMasterId); + if (enemyInfo.AIDeckId >= 0) + { + if (dataMgr.m_BattleType == DataMgr.BattleType.Story) + { + StoryChapterSelectionUtility.RegisterStoryBattleData(Data.SelectedStoryInfo.ChapterData.FindBattleSettingDataByPlayerCharaId(setupInfo.StoryRecoveryData.ChapterCharaId)); + } + else + { + dataMgr.SetCurrentEnemyDeckDataFromAIDeck(enemyInfo.ClassId, enemyInfo.AIDifficulty.Value, enemyInfo.AILevel.Value, enemyInfo.AIMaxLife.Value, enemyInfo.AIDeckId.Value, enemyInfo.AIStyleId.Value, enemyInfo.AIEmoteId.Value, enemyInfo.AIUseInnerEmote.Value, enemyAiID, specialAbilityIdList); + } + } + else + { + List deck = enemyInfo.DeckCardInfos.Select((DeckCardInfo i) => i.CardId.Value).ToList(); + dataMgr.SetEnemyAIDeckFromCustomDeck(enemyInfo.ClassId, deck, enemyInfo.AIDifficulty.Value, enemyInfo.AILevel.Value, enemyInfo.AIMaxLife.Value, enemyInfo.AIStyleId.Value, enemyInfo.AIEmoteId.Value, enemyInfo.AIUseInnerEmote.Value); + } + dataMgr.Load(); + dataMgr.LoadEnemy(); + } + catch (Exception) + { + OpenRecoveryFailedDialog(); + } + } + + protected abstract List CreateEnemyDeckIDList(BattleConditionEnemyInfo enemyInfo); + + public abstract VfxBase Recovery(BattlePlayer battlePlayer, BattleEnemy battleEnemy, Func startCoroutine); + + public abstract VfxBase UpdateRecovery(); + + public virtual void RecoveryBeforeMulligan() + { + } + + public virtual VfxBase RecoveryMulligan(BattlePlayer battlePlayer, BattleEnemy battleEnemy) + { + EndDataRecovery(); + return SequentialVfxPlayer.Create(InstantVfx.Create(delegate + { + GameMgr.GetIns().GetBattleCtrl().StartCoroutine(FontChanger.FontChange(null)); + }), ParallelVfxPlayer.Create(battlePlayer.BattleView.RecoveryMulligan(), battleEnemy.BattleView.RecoveryMulligan()), InstantVfx.Create(delegate + { + EndRecoveryEvent.Call(); + })); + } + + public virtual string RecoveryPopSkillTargetCardName() + { + return _skillTargetNameQueue.Dequeue(); + } + + protected void EndDataRecovery() + { + _needUpdate = false; + EndDataRecoveryEvent.Call(); + } + + protected void RecoveryTurnStartPanel() + { + BattleManagerBase.GetIns().ReinitializeTurnPanelControl(); + } + + protected void Dump(BattlePlayer battlePlayer, BattleEnemy battleEnemy) + { + string text = ""; + text += "P Hand :"; + foreach (BattleCardBase handCard in battlePlayer.HandCardList) + { + text = text + " p" + handCard.Index; + } + text += "\nP Inplay :"; + foreach (BattleCardBase inPlayCard in battlePlayer.InPlayCards) + { + text = text + " p" + inPlayCard.Index; + } + text += "\nE Hand :"; + foreach (BattleCardBase handCard2 in battleEnemy.HandCardList) + { + text = text + " e" + handCard2.Index; + } + text += "\nE Inplay :"; + foreach (BattleCardBase inPlayCard2 in battleEnemy.InPlayCards) + { + text = text + " e" + inPlayCard2.Index; + } + } + + protected void ResetLeaderAnimation(BattlePlayer battlePlayer, BattleEnemy battleEnemy) + { + PlayerClassBattleCardView playerClassBattleCardView = battlePlayer.Class.BattleCardView as PlayerClassBattleCardView; + playerClassBattleCardView.ClassCharacter.SetAnimationEnable(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION)); + if (battlePlayer.IsSkinEvolved) + { + playerClassBattleCardView.ClassCharacter.PlayMotion(ClassCharaPrm.MotionType.z_idle); + } + EnemyClassBattleCardView enemyClassBattleCardView = battleEnemy.Class.BattleCardView as EnemyClassBattleCardView; + enemyClassBattleCardView.ClassCharacter.SetAnimationEnable(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION)); + if (battleEnemy.IsSkinEvolved) + { + enemyClassBattleCardView.ClassCharacter.PlayMotion(ClassCharaPrm.MotionType.z_idle); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/RecoveryRecordManagerBase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/RecoveryRecordManagerBase.cs new file mode 100644 index 0000000..1c02aa0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/RecoveryRecordManagerBase.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Cute; +using LitJson; +using Wizard.AutoTest; +using Wizard.ErrorDialog; + +namespace Wizard.Battle.Recovery; + +public abstract class RecoveryRecordManagerBase : IRecoveryRecordManager +{ + protected OperationRecorderBase _recorder; + + protected GameMgr _gameMgr; + + protected DataMgr.BattleType _battleType; + + protected readonly string _recoveryFilePath; + + public const string DEFAULT_RECOVERY_SINGLE_FILE_NAME = "recovery_single.json"; + + public const string DEFAULT_RECOVERY_NETWORK_FILE_NAME = "recovery_network.json"; + + public const string DEFAULT_RECOVERY_AI_NETWORK_FILE_NAME = "recovery_ai_network.json"; + + protected abstract string DefaultRecoveryFileName { get; } + + public RecoveryRecordManagerBase() + { + _recoveryFilePath = OperationRecorderBase.RecordDirectoryPath + DefaultRecoveryFileName; + } + + public RecoveryRecordManagerBase(string recoveryFilePath) + { + _recoveryFilePath = OperationRecorderBase.RecordDirectoryPath + recoveryFilePath; + } + + public void RecordSkillTarget(IEnumerable targetCards) + { + _recorder.RecordSkillTargets(targetCards); + } + + public virtual void SetupRecording(BattleManagerBase battleMgr, DataMgr.BattleType battleType, int randomSeed, int backGroundId, string bgmId = "NONE") + { + Directory.CreateDirectory(OperationRecorderBase.RecordDirectoryPath); + _gameMgr = GameMgr.GetIns(); + _battleType = battleType; + _recorder = CreateOperationRecorder(); + SetupRecorderEvents(_recorder, battleMgr); + } + + public virtual void SetupMulliganStartTimeRecorderEvent(BattleManagerBase battleMgr) + { + } + + protected abstract OperationRecorderBase CreateOperationRecorder(); + + protected virtual void SetupRecorderEvents(OperationRecorderBase operationRecorder, BattleManagerBase battleMgr) + { + battleMgr.OnStartOpening += operationRecorder.RecordStartTurnIsPlayer; + battleMgr.BattlePlayer.OnMulliganEnd += operationRecorder.RecordPlayerMulliganReplaceCards; + battleMgr.BattleEnemy.OnMulliganEnd += operationRecorder.RecordEnemyMulliganReplaceCards; + battleMgr.OperateMgr.OnSetCardSuccess += operationRecorder.RecordPlay; + battleMgr.OperateMgr.OnBeforeAttack += operationRecorder.RecordAttack; + battleMgr.OperateMgr.OnEvolveSuccess += operationRecorder.RecordEvolve; + battleMgr.OperateMgr.OnStartSelect += operationRecorder.RecordStartSelect; + battleMgr.OperateMgr.OnSelect += operationRecorder.RecordSelect; + battleMgr.OperateMgr.OnCompleteSelect += operationRecorder.RecordCompleteSelect; + battleMgr.OperateMgr.OnStartChoice += operationRecorder.RecordStartChoice; + battleMgr.OperateMgr.OnCompleteChoice += operationRecorder.RecordCompleteChoice; + battleMgr.OperateMgr.OnCancelSelect += operationRecorder.RecordCancelSelect; + battleMgr.OperateMgr.OnCancelChoice += operationRecorder.RecordCancelChoice; + battleMgr.OperateMgr.OnStartFusion += operationRecorder.RecordStartFusion; + battleMgr.OperateMgr.OnSelectFusionForRecovery += operationRecorder.RecordSelectFusion; + battleMgr.OperateMgr.OnCancelFusion += operationRecorder.RecordCancelFusion; + battleMgr.OperateMgr.OnBeforeFusion += operationRecorder.RecordCompleteFusionSelect; + if (battleMgr is SingleBattleMgr singleBattleMgr && _gameMgr.GetDataMgr().BossRushBattleData != null) + { + singleBattleMgr.OnBattleRetire += operationRecorder.RecordRetire; + } + } + + public static bool IsExistsNetworkRecoveryFile() + { + return File.Exists(OperationRecorderBase.RecordDirectoryPath + "recovery_network.json"); + } + + public static bool IsExistsAINetworkRecoveryFile() + { + return File.Exists(OperationRecorderBase.RecordDirectoryPath + "recovery_ai_network.json"); + } + + public static bool IsExistsSingleRecoveryFile() + { + return File.Exists(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json"); + } + + public static bool IsBossRushBattleRetired() + { + if (!IsExistsSingleRecoveryFile()) + { + return false; + } + JsonData jsonData; + try + { + jsonData = RecoveryOperationInfo.ReadRecoveryFile(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json"); + } + catch (Exception ex) + { + AbortSoloPlayRecoveryTask task = new AbortSoloPlayRecoveryTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + Data.Load.data.InitRecoveryStatus(); + UIManager.GetInstance().isBattleRecovery = false; + DeleteRecoveryFile(); + DialogBase dialogBase = Wizard.ErrorDialog.Dialog.Create(20001); + dialogBase.SetButtonDelegate(delegate + { + SoftwareReset.exec(); + }); + dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_CANCEL_TRANS; + })); + throw ex; + } + if (!jsonData.Keys.Contains("operations")) + { + return false; + } + for (int num = jsonData["operations"].Count - 1; num >= 0; num--) + { + JsonData jsonData2 = jsonData["operations"][num]; + if (jsonData2.Keys.Contains("ope") && jsonData2["ope"].ToString() == "retire") + { + return true; + } + } + return false; + } + + public static void DeleteTempAINetworkRecoveryFile() + { + if (File.Exists(OperationRecorderBase.RecordDirectoryPath + "temp_recovery_ai_network.json")) + { + File.Delete(OperationRecorderBase.RecordDirectoryPath + "temp_recovery_ai_network.json"); + } + } + + public static DataMgr.BattleType GetRecoveryBattleType() + { + if (IsExistsNetworkRecoveryFile() || IsExistsAINetworkRecoveryFile()) + { + if (IsExistsAINetworkRecoveryFile()) + { + GameMgr.GetIns().IsAINetwork = true; + } + return Data.BattleRecoveryInfo.BattleType; + } + if (IsExistsSingleRecoveryFile()) + { + JsonData jsonData = RecoveryOperationInfo.ReadRecoveryFile(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json"); + return (DataMgr.BattleType)jsonData.ToIntOrDefault("battle_type", 100); + } + return DataMgr.BattleType.None; + } + + public static void DeleteRecoveryFile() + { + if (File.Exists(OperationRecorderBase.RecordDirectoryPath + "recovery_network.json")) + { + File.Delete(OperationRecorderBase.RecordDirectoryPath + "recovery_network.json"); + } + if (File.Exists(OperationRecorderBase.RecordDirectoryPath + "recovery_ai_network.json")) + { + File.Delete(OperationRecorderBase.RecordDirectoryPath + "recovery_ai_network.json"); + } + if (IsExistsSingleRecoveryFile()) + { + File.Delete(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json"); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Sound/LeaderSoundManager.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Sound/LeaderSoundManager.cs new file mode 100644 index 0000000..4bcd7ba --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Sound/LeaderSoundManager.cs @@ -0,0 +1,51 @@ +using Cute; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Sound; + +public class LeaderSoundManager +{ + public VfxBase CreateLoadResouceVfx(string voiceId, bool isSe = false) + { + if (BattleManagerBase.GetIns() == null || BattleManagerBase.GetIns().IsRecovery) + { + return NullVfx.GetInstance(); + } + string text = (isSe ? "s/se_" : "v/vo_") + voiceId + ".acb"; + if (!Toolbox.ResourcesManager.BattleListAssetPathList.Contains(text)) + { + return new WaitLoadResourceVfx(text); + } + return NullVfx.GetInstance(); + } + + public VfxBase CreatePlayVfx(string voiceId, bool forcePlay = false) + { + if (BattleManagerBase.GetIns() == null || BattleManagerBase.GetIns().IsRecovery) + { + return NullVfx.GetInstance(); + } + return InstantVfx.Create(delegate + { + GameMgr.GetIns().GetSoundMgr().PlayVoiceByKey(voiceId, forcePlay); + }); + } + + public VfxBase CreatePlaySeVfx(string seId) + { + if (BattleManagerBase.GetIns() == null || BattleManagerBase.GetIns().IsRecovery) + { + return NullVfx.GetInstance(); + } + return InstantVfx.Create(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr(seId, 0f, 0L); + }); + } + + public VfxBase CreateLoadAndPlayEvolveSeVfx(string skinId, string suffiix) + { + string text = skinId + "_000_evo" + suffiix; + return SequentialVfxPlayer.Create(CreateLoadResouceVfx(text, isSe: true), CreatePlaySeVfx("se_" + text)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Touch/ITouchProcessor.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Touch/ITouchProcessor.cs new file mode 100644 index 0000000..2b507c1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Touch/ITouchProcessor.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Touch; + +public interface ITouchProcessor +{ + VfxBase Start(); + + VfxBase Update(float dt, Camera camera); + + VfxWith End(); + + bool CheckIsEnd(); +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.UI/IClassInfomationUI.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.UI/IClassInfomationUI.cs new file mode 100644 index 0000000..e679759 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.UI/IClassInfomationUI.cs @@ -0,0 +1,31 @@ +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.UI; + +public interface IClassInfomationUI +{ + void ShowInfomation(bool playEffect = true); + + void NewReplayUpdateInfomation(NetworkBattleReceiver.ClassInfoUiInfo classInfo); + + void HideInfomation(); + + void HideOtherInfomation(); + + void HideAllInfomation(); + + VfxBase LoadResources(Transform parent, bool isPlayer); + + void SetUpEvent(BattlePlayerBase player); + + void Recovery(); + + GameObject GetInfomationUI(); + + void SetIsSelect(bool flg); + + void SetInCardFocus(bool flg); + + void SetTouchable(bool flg); +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.UI/LogType.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.UI/LogType.cs new file mode 100644 index 0000000..4320915 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.UI/LogType.cs @@ -0,0 +1,88 @@ +namespace Wizard.Battle.UI; + +public enum LogType +{ + Null, + Turn, + Cost, + MulliganChanged, + BuffAdd, + BuffMultiply, + BuffSetAttack, + BuffSetLife, + BuffAddMaxLife, + BuffInHandAdd, + Gain, + AttachSkill, + Heal, + HealSkill, + Damage, + DamageSkill, + CantAttack, + ChantCount, + GiveWhiteRitualStack, + DepriveWhiteRitualStack, + AttackCountRecovery, + ChangeDeck, + PlayChoice, + Attack, + AttackCounter, + Metamorphose, + UniteMaterial, + Play, + Summon, + WhenPlay, + WhenDestroy, + WhenLeave, + WhenAttackSelfAndOtherAfter, + OtherEffect, + EP, + PP, + PPMax, + AddCost, + SetCost, + DrawToken, + DrawCard, + Enhance, + Accelerate, + Crystallize, + OverDraw, + OverDrawOnTurnStartDraw, + UsePp, + OpenDrawCard, + ReturnCard, + Discard, + BanishHand, + BanishDeck, + Destroy, + Banish, + Evolution, + EvolutionSkill, + ChangeCemetery, + AwakeBySkill, + AwakeByTurnStart, + BerserkBySkill, + BerserkByWar, + Necromance, + Lose, + ChangeClan, + ChangeTribe, + ChangePlayCount, + BattleLogCardList, + DeckSummonCardList, + FusionInfoList, + FusionIngredientList, + BurialRite, + ShortageDeckWin, + CopiedSkill, + RandomArray, + Fusion, + FusionIngredient, + ClearDestroyedCardList, + ClearSummonedCardList, + Geton, + GetonIngredient, + GetoffIngredient, + ReserveToken, + NotConsumeEp +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.UI/SkillGainType.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.UI/SkillGainType.cs new file mode 100644 index 0000000..be04bb8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.UI/SkillGainType.cs @@ -0,0 +1,47 @@ +namespace Wizard.Battle.UI; + +public enum SkillGainType +{ + Null, + Drain, + Guard, + IgnoreGuard, + Killer, + NotBeAttacked, + Quick, + Rush, + Sneak, + AddDamage, + HealModifier, + ShieldAll, + ShieldSkill, + ShieldSpell, + ShieldAttack, + Untouchable, + AttackCount, + RemoveByDestroy, + Indestructible, + CantActivateFanfare, + CantActivateShortageDeckWin, + ForceAttack, + ForceSkillTarget, + AttractSkillTarget, + Independent, + NotBeDebuffed, + DamageMaxClipping, + LifeLowerLimit, + TurnStartFixedPP, + DecreaseTurnPP, + CantPlayUnit, + CantSummon, + RepeatFanfare, + RepeatLastWord, + DamageCut, + AttackByLife, + Reflection, + DontConsumeEp, + RobLastWords, + ShortageDeckWin, + NotDecreasePP, + Max +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.View/HandCardFrameEffectType.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.View/HandCardFrameEffectType.cs new file mode 100644 index 0000000..1303790 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.View/HandCardFrameEffectType.cs @@ -0,0 +1,12 @@ +namespace Wizard.Battle.View; + +public enum HandCardFrameEffectType +{ + NONE = 0, + YELLOW = 1, + LIGHT_BLUE = 2, + SELECTABLE = 3, + FUSION_METAMORPHOSE = 4, + MAX = 5, + NULL = -1 +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.View/HandParameter.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.View/HandParameter.cs new file mode 100644 index 0000000..239eff1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.View/HandParameter.cs @@ -0,0 +1,65 @@ +using UnityEngine; + +namespace Wizard.Battle.View; + +public class HandParameter : MonoBehaviour +{ + public enum IconLayout + { + Simple, + FixedUse + } + + private struct IconLayoutInfo + { + public Vector3 _attackPos; + + public Vector3 _lifePos; + + public Vector3 _costPos; + } + + private static readonly IconLayoutInfo[] ICON_LAYOUT = new IconLayoutInfo[2] + { + new IconLayoutInfo + { + _attackPos = new Vector3(0f, 0f, 0f), + _lifePos = new Vector3(0f, -45.73f, 0f), + _costPos = new Vector3(0f, 0f, 0f) + }, + new IconLayoutInfo + { + _attackPos = new Vector3(0f, -36f, 0f), + _lifePos = new Vector3(0f, -83.1f, 0f), + _costPos = new Vector3(0f, 6.3f, 0f) + } + }; + + [SerializeField] + public GameObject _attackIcon; + + [SerializeField] + public UILabel _attackLabel; + + [SerializeField] + public GameObject _lifeIcon; + + [SerializeField] + public UILabel _lifeLabel; + + [SerializeField] + public GameObject _costIcon; + + [SerializeField] + public UILabel _costLabel; + + [SerializeField] + public UISprite _costSprite; + + public void InitIconPos(IconLayout layout) + { + _attackIcon.transform.localPosition = ICON_LAYOUT[(int)layout]._attackPos; + _lifeIcon.transform.localPosition = ICON_LAYOUT[(int)layout]._lifePos; + _costIcon.transform.localPosition = ICON_LAYOUT[(int)layout]._costPos; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.View/IBattleCardView.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.View/IBattleCardView.cs new file mode 100644 index 0000000..38a452f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.View/IBattleCardView.cs @@ -0,0 +1,185 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.View; + +public interface IBattleCardView +{ + Vector3 ForecastIconPosition { get; } + + Vector3 ForecastIconScale { get; } + + float OriginalRootYPosition { get; } + + IReadOnlyBattleCardInfo CardInfo { get; } + + BattlePlayerReadOnlyInfoPair PlayerInfoPair { get; } + + IReadOnlyVoiceInfo VoiceInfo { get; } + + GameObject GameObject { get; } + + GameObject CardWrapObject { get; } + + Transform Transform { get; } + + CardTemplate CardTemplate { get; } + + BoxCollider Collider { get; } + + BattleCardIconAnimations BattleCardIconAnimations { get; } + + Func GetIsOnMove { get; } + + bool InPlayModelActive { get; set; } + + BattleCamera m_BattleCamera { get; } + + BackGroundBase m_BackGround { get; } + + HandParameter HandParam { get; } + + BattleCardView.AttackTargetSelectInfo _attackTargetSelectInfo { get; set; } + + InPlayCardFrameEffectControl _inPlayFrameEffect { get; set; } + + bool areArrowsForcedOff { get; set; } + + bool _isCardQueuedToBePlayed { get; set; } + + bool isHiddenFromHandView { get; set; } + + bool isHiddenFromInPlayView { get; set; } + + bool isHideFrameEffect { get; set; } + + bool _hasCardEnteredPlayQueue { get; set; } + + bool playVoiceOnDeath { get; set; } + + Coroutine _inPlayRearrangeCoroutine { get; set; } + + Coroutine _waitUntilCardIsInQueueCoroutine { get; set; } + + bool IsNullView { get; } + + bool IsLoadResorces { get; } + + void InitializeVoiceInfo(int cardID); + + void SetupIconAnimations(BattleCardBase card, SkillCollectionBase skills); + + VfxBase LoadResource(); + + VfxBase GetResourcePathes(List resourceInfos); + + VfxBase LoadChoiceTransformCardsResources(BattleCardBase card); + + VfxBase GetChoiceTransformCardsResourcePathes(BattleCardBase card, List resourceInfos, bool isRecoveryFinish = false); + + void ResetTemplate(); + + bool HasChild(string objectName); + + void AttachChild(string objectName, GameObject gameObject, bool isDestoryEarlierAttached = false); + + void ReserveAttachChild(string objectName); + + bool HasReservedAttachChild(string objectName); + + GameObject DetachChild(string objectName); + + void DestroyChild(string objectName); + + VfxBase UnloadResource(); + + void UpdateMovability(); + + void HideCanPlayEffect(); + + GameObject GetCardMeshGameObject(); + + void UpdateParameterView(int offence, int life, int cost, string name, bool isOnField, bool isRecovery = false, bool useNormalCost = false); + + void UpdateOffence(int offence); + + void UpdateLife(int life); + + void UpdateCost(List costList, bool isGenerateInHand = true, bool playEffect = true, bool isForceUpdate = false, bool isOnlyFixedUseCost = false); + + List GetUseCostList(int cost, bool useNomalCost = false); + + void UpdateCostWithoutFixedUse(int cost); + + void SetTillingAndOffset(Vector2 tilling, Vector2 offset); + + void SetVoiceFileCueName(string cueName); + + void PlayVoice(string voiceName); + + void StopVoice(); + + void ShowInHandFrameEffect(bool enable); + + void ShowInHandFrameEffect(bool enable, HandCardFrameEffectType type); + + void ShowFusionMetamorphoseFrameEffect(bool enable); + + VfxBase ResetCardView(CardParameter baseParameter); + + VfxBase RecoveryInPlay(); + + VfxBase RecoveryInHand(); + + VfxBase ShowHandCardInfo(bool isRecovery = false, bool modifyParameterLabel = true); + + void HideHandCardInfo(); + + VfxBase ShowAttackFinished(); + + VfxBase ShowAttackFinished(SkillBase skill); + + void HideAttackFinished(); + + VfxBase InitializeBattleCardIcon(BattleCardBase card, SkillCollectionBase collection, bool isStackWhiteRitual = false); + + VfxBase InitializeBattleCardStackIcon(BattleCardBase card, SkillCollectionBase collection); + + VfxBase ShowBattleCardIcon(); + + void SetCostLabelEnable(bool isEnable); + + void SetNormalLabelEnable(bool isEnable); + + GameObject GetChild(string objectName); + + void InitHandParameter(); + + void UpdateCostViewStrategy(bool isForceUpdate = false); + + void InitHandParameterIconPos(HandParameter.IconLayout layout); + + VfxBase UpdateBattleCardIconLabelNumber(BattleCardBase card, SkillCollectionBase collection); + + VfxBase UpdateStackWhiteRitualIconNumber(); + + void SetCutInLayerNormalObject(); + + void ResetPlayQueueFlags(); + + void SetParameterIconEnable(bool isEnable); + + VfxBase AddBattleCardIcon(string iconType, string iconFileName); + + VfxBase DeleteBattleCardIcon(string iconType); + + void SetNotCancelColliderEnable(bool isEnable); + + void InitCostViewAnim(); + + VfxBase LoadEvolveFrameEffect(); + + VfxBase HideBattleCardIcon(); +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.View/IBattlePlayerView.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.View/IBattlePlayerView.cs new file mode 100644 index 0000000..a15629f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.View/IBattlePlayerView.cs @@ -0,0 +1,193 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.View; + +public interface IBattlePlayerView +{ + ITurnEndButtonUI TurnEndButtonUI { get; } + + GameObject EpIcon { get; } + + bool IsSelecting { get; } + + HandViewBase HandView { get; } + + HandControl HandControl { get; } + + BattleCardBase SelectSkillActCard { get; } + + GameObject TurnEndBtn { get; } + + BattleCardBase m_CurrentTarget { get; } + + PlayQueueViewBase PlayQueueView { get; } + + AttackSelectControl AttackSelectControl { get; } + + InPlayViewBase InPlayView { get; } + + GameObject StatusParentPanel { get; } + + GameObject AnchorL { get; } + + GameObject CommonPanel { get; } + + GameObject EpPanel { get; } + + UIGrid HandDeck { get; } + + UIGrid SetDeck { get; } + + GameObject CemeteryParent { get; } + + GameObject BanishParent { get; } + + bool IsNowTurnEnd { get; } + + Action OnCancelSkillTargetSelect { get; set; } + + Action OnCancelPlayCard { get; set; } + + Action OnSelect { get; set; } + + Transform ChoiceBraveButtonTransform { get; } + + bool IsShowCantChoiceBraveText { get; } + + VfxBase Recovery(bool doseFirst, bool isFocusHand = true); + + VfxBase RecoveryTurnStart(); + + IList GetSelectCardList(); + + void ForceStopShowSelect(); + + void AllClear(bool popUpClose = false, bool isRemoveSideLog = true, bool isStopDrag = true, bool isResetDetail = true); + + bool IsTouchable(); + + void LockOnEffectOff(); + + void ShowCommonPanel(); + + void DragArrowStop(BattleManagerBase battleMgr); + + VfxBase HandUnfocus(); + + VfxBase HandFocus(); + + bool ShowAlertMessageTouchCard(ref BattleCardBase hitCard, ref BattleManagerBase battleMgr); + + void DisableSettingFlag(); + + void HideAlertDialogue(); + + void HideAlertDialogue(PanelMgr.BattleAlertType alertType); + + bool IsShowingAlert(); + + void ClearPlayQueue(); + + void ShowAlert(PanelMgr.BattleAlertType AlertType, bool isClass, string text = null); + + VfxBase RearrangeHand(); + + void StopShowSelect(BattleCardBase actCard, bool isAct, bool isTransformskill = false, bool isNewReplayMoveTurn = false); + + void RegisterPlayCard(BattleCardBase actCard); + + UIButton GetChoiceButtonFromIndex(int index); + + GameObject GetCheckFromIndex(int index); + + void SetTouchable(bool enable); + + void HideTurnEndButton(); + + void SetCancelSkillChoiceTransformCards(BattleCardBase actCard, BattleCardBase transformCard); + + void SetCancelPlayChoiceTransformCards(BattleCardBase actCard, BattleCardBase transformCard); + + void SetCancelPlayCardWithChoice(BattleCardBase actCard, List choiceCards); + + void ReleaseLockOnTarget(); + + void ShowChoiceAlert(BattleCardBase card, bool isEvolve, int count, int max); + + void StopChoiceSelectUI(); + + void HideCommonPanel(); + + void ClearSelectCardList(); + + void SetSelectCardList(List list); + + Vector3 GetPPLabelPosition(); + + Vector3 GetBPLabelPosition(); + + VfxBase CreateBeforeFusionVfx(BattleCardBase fusionCard, List ingredientCards); + + VfxBase ReturnActCardAfterFusion(IBattleCardView fusionCardView, bool isFusionMetamorphose = false); + + SideLogControl GetSideLogControl(bool isSkillTargetSelect); + + VfxBase SetIsNowTurnEnd(bool flg); + + VfxBase RecoveryInPlayCards(); + + VfxBase RecoveryClassAndInPlayCardAttachSkillEffect(); + + VfxBase RecoveryInHandCards(); + + VfxBase RecoveryBattleUI(); + + VfxBase CreateStopAttackFloatVfx(IBattleCardView battleCardView); + + VfxBase CreateStopShowSelectVfx(BattleCardBase actCard, bool isAct, bool stopChoiceSelectUiImmediately = true, bool isTransformskill = false, bool isNewReplayMoveTurn = false); + + void ClearSelectSkillActCard(); + + VfxBase StartShowSelect(BattleCardBase actCard, SkillBase skill, IEnumerable selectableCards, bool isEvol); + + void CancelPlayCard(BattleCardBase actCard, bool isPlay = false, bool isNewReplayMoveTurn = false); + + VfxBase StartShowChoice(BattleCardBase actCard, SkillBase choiceSkill, List choiceCards, bool isEvol, BattleCardBase accelerateCard, bool isChoiceBrave); + + void StartShowFusionUI(BattleCardBase actCard, IEnumerable selectableCards, int maxSelectCount, EventDelegate onClickDecision); + + VfxBase RemoveFusionSelectedCardFromHand(List selectedCards); + + void StopFusionUI(); + + void Setup(GameObject statusPanel, GameObject uiContainer, GameObject btlContainer, GameObject battle3DContainer); + + VfxBase RecoveryMulligan(); + + VfxBase PrepareCardsForAttackSequenceVfx(IBattleCardView attackInitiator, IBattleCardView attackTarget); + + void SelectedFusionIngredientCard(int index, bool isActive, int maxSelectCount = 8); + + void UpdateFusionUi(bool isTouchableDecisionButton); + + void SetNotCancelCollider(List cards, bool isEnable); + + void ShowChoiceSelectUI(BattleCardBase actCard, IList choiceCards, SkillBase skill, bool isEvolve, bool isChoiceBrave); + + VfxBase HideCardAttackEffects(IList _targetCards); + + void ShowChoiceBraveButton(bool isNewReplay); + + void UpdateChoiceBraveActivatingEffect(bool isActivating); + + void HideChoiceBraveButton(); + + void UpdateChoiceBraveButtonPulsateEffectAndSprite(); + + void HideChoiceBraveButtonPulsateEffect(); + + VfxBase SetBp(int num); +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.View/IClassBattleCardView.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.View/IClassBattleCardView.cs new file mode 100644 index 0000000..e87f967 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.View/IClassBattleCardView.cs @@ -0,0 +1,18 @@ +using Wizard.Battle.Player.ClassCharacter; + +namespace Wizard.Battle.View; + +public interface IClassBattleCardView : IBattleCardView +{ + IClassCharacter ClassCharacter { get; } + + void StartOutFrame(); + + void StartIntoFrame(); + + float GetCurrentClipTime(); + + bool GetCurrentClipIsName(ClassCharaPrm.MotionType motionType); + + void ClearSpineObject(); +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.View/IPlayerView.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.View/IPlayerView.cs new file mode 100644 index 0000000..2f36262 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.View/IPlayerView.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.View; + +public interface IPlayerView : IBattlePlayerView +{ + bool _isEvolutionSkillSelect { get; set; } + + bool IsEvolutionStart { get; set; } + + bool IsEvolutionVfx { get; set; } + + bool IsMenuOpen { get; set; } + + BattleCardBase DetailOpenCard { get; } + + bool CanPlayerEndTurnImmediately { get; } + + bool IsShowTurnEndDialogOfNotAttackingOrPlaying { get; } + + bool IsShowTurnEndDialogOfNotUsingHeroSkill { get; } + + bool IsMenuCloseEscape { get; set; } + + GameObject CardMoveEffect { get; set; } + + event Action OnRetire; + + event Func OnCheckImmediateTurnEnd; + + event Action OnStartMoveCard; + + event Action OnCancelMoveCard; + + event Action OnOpenEvolveDialoguePanel; + + event Action OnLockOn; + + event Action OnReleaseLockOn; + + event Action OnOpenDetailPanel; + + void HideDetailPanel(); + + void ShowTurnEndDialog(GameObject return_obj = null); + + void UpdateTurnEndPulseEffect(); + + void CallOnOpenEvolveDialoguePanel(); + + void DragArrowStart(BattleManagerBase battleMgr, BattleCardBase attackCard, GameObject arrowHead); + + void DragArrowStart(BattleManagerBase battleMgr, GameObject startObject, GameObject arrowHead, bool isTargettingEnemy = true); + + void DragArrow(BattleManagerBase battleMgr, GameObject arrowHead, Vector3 pos); + + void ShowTurnEndButton(bool showEffect = true); + + void MoveCardCancel(BattleCardBase hitCard, Vector3 position, Quaternion rotation, bool IsPress); + + bool IsDetailOn(); + + void MoveCardStart(BattleCardBase moveCard, bool isEffectAndSoundOn); + + void CancelCardDrag(BattleCardBase cardBeingDragged); + + void ShowDetailPanel(BattleManagerBase battleMgrBase, OperateMgr operateMgr, BattleCardBase card, DetailPanelControl.ShowRequest showRequest, BattleLogItem.CardTextureOption textureOption = BattleLogItem.CardTextureOption.Null, BuffInfo buff = null, string divergenceId = "", int logTextureId = 0); + + BattleCardBase GetDetailCard(); + + void ResetTouchable(); + + VfxBase HideTurnEndPulseEffect(); + + bool IsMoving(); + + void OffNotHideAndNotCreate(); + + void ForceShowTurnEndButton(); + + void ClearDifferentiatePopUp(List deselectionItem); + + void ShowPlayerTurnEnd(bool isAuto = false); + + void HideSubDetailPanel(); + + void ShowKeyPanel(int page); + + void HideKeyPanel(); + + DialogBase CreateKeyPanel(BattleCardBase card, UILabel label, CardMaster.CardMasterId cardMasterId, CardParameter baseParameter); + + DialogBase ShowRetireConfirmPanel(); + + DialogBase CreateBattleSetting(); + + void MoveCard(BattleCardBase hitCard, Vector3 pos); + + void CardMoveEffectSwitch(bool on); + + void SetDetailScreenPosition(bool right); + + Effect DetailPanelSelectEffectOn(BattleCardBase selectedCard, DetailPanelControl.ShowRequest request); + + void DetailPanelSelectEffectOff(); + + void GetCardSelectedWithButton(Camera camera, ref UIButton button, ref BattleCardBase card, ref GameObject check); + + void ShowDetailPanelList(BattleManagerBase battleMgrBase, OperateMgr operateMgr, List cards, DetailPanelControl.ShowRequest showRequest); + + void LockOnAttackTarget(BattleCardBase Attacker, BattleCardBase Target); + + bool IsFieldDetailOn(); + + DialogBase ShowFusionCardPlayDialog(EventDelegate onClickOk, Action onClose); + + void HideModeEffect(bool on); + + void DetailReverseOver(); + + void AddPopUpPanel(NonDialogPopup popup, BattlePlayerViewBase.BattleDialogItem item); +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle/NetworkOpponentInnerOptionsBuilder.cs b/SVSim.BattleEngine/Engine/Wizard.Battle/NetworkOpponentInnerOptionsBuilder.cs new file mode 100644 index 0000000..cd00635 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle/NetworkOpponentInnerOptionsBuilder.cs @@ -0,0 +1,24 @@ +using Wizard.Battle.Card.InnerOptions; +using Wizard.Battle.Player.Emotion; +using Wizard.Battle.View; + +namespace Wizard.Battle; + +public class NetworkOpponentInnerOptionsBuilder : IInnerOptionsBuilder +{ + public IPlayerEmotion CreatePlayerEmotion(IClassBattleCardView classCardView) + { + return new NullPlayerEmotion(); + } + + public IEmotion CreateEnemyEmotion(IClassBattleCardView classCardView) + { + return new NetworkOpponentEmotion(GameMgr.GetIns().GetDataMgr().GetEnemyCharaId() + .ToString(), classCardView.ClassCharacter); + } + + public CardInnerOptionsBase CreateCardOptions() + { + return new CardInnerOptionsBase(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle/NullInnerOptionsBuilder.cs b/SVSim.BattleEngine/Engine/Wizard.Battle/NullInnerOptionsBuilder.cs new file mode 100644 index 0000000..b5e91e7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle/NullInnerOptionsBuilder.cs @@ -0,0 +1,38 @@ +using Wizard.Battle.Card.InnerOptions; +using Wizard.Battle.Player.Emotion; +using Wizard.Battle.View; + +namespace Wizard.Battle; + +public class NullInnerOptionsBuilder : IInnerOptionsBuilder +{ + private static NullInnerOptionsBuilder m_instance; + + public static NullInnerOptionsBuilder GetInstance() + { + if (m_instance == null) + { + m_instance = new NullInnerOptionsBuilder(); + } + return m_instance; + } + + private NullInnerOptionsBuilder() + { + } + + public IPlayerEmotion CreatePlayerEmotion(IClassBattleCardView classCardView) + { + return new NullPlayerEmotion(); + } + + public IEmotion CreateEnemyEmotion(IClassBattleCardView classCardView) + { + return new NullEmotion(); + } + + public CardInnerOptionsBase CreateCardOptions() + { + return new CardInnerOptionsBase(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle/PlayerInnerOptionsBuilder.cs b/SVSim.BattleEngine/Engine/Wizard.Battle/PlayerInnerOptionsBuilder.cs new file mode 100644 index 0000000..ec63d67 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle/PlayerInnerOptionsBuilder.cs @@ -0,0 +1,31 @@ +using Wizard.Battle.Card.InnerOptions; +using Wizard.Battle.Player.Emotion; +using Wizard.Battle.Resource; +using Wizard.Battle.View; + +namespace Wizard.Battle; + +public class PlayerInnerOptionsBuilder : IInnerOptionsBuilder +{ + private readonly IBattleResourceMgr _resourceMgr; + + public PlayerInnerOptionsBuilder(IBattleResourceMgr resourceMgr) + { + _resourceMgr = resourceMgr; + } + + public IPlayerEmotion CreatePlayerEmotion(IClassBattleCardView classCardView) + { + return new PlayerEmotion(GameMgr.GetIns().GetDataMgr().GetPlayerEmotionId(), classCardView.ClassCharacter, _resourceMgr); + } + + public IEmotion CreateEnemyEmotion(IClassBattleCardView classCardView) + { + return new NullEmotion(); + } + + public CardInnerOptionsBase CreateCardOptions() + { + return new PlayerCardInnerOptions(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Bingo/BingoDrawTask.cs b/SVSim.BattleEngine/Engine/Wizard.Bingo/BingoDrawTask.cs new file mode 100644 index 0000000..da1b199 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Bingo/BingoDrawTask.cs @@ -0,0 +1,117 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard.Bingo; + +public class BingoDrawTask : BaseTask +{ + public class BingoDrawTaskParam : BaseParam + { + public int draw_count; + } + + public class BingoDrawTaskData + { + public bool IsSheetCompleted { get; private set; } + + public bool IsSwitchNextSheet { get; private set; } + + public List HitSquareIdList { get; private set; } + + public List TreasureBoxReawrdList { get; private set; } + + public List LineRewardData { get; private set; } + + public List> CompletedLineConditionList { get; private set; } + + public bool IsBingoLoginBonus { get; private set; } + + public bool IsDisplayTweetDialog { get; private set; } + + public BingoDrawTaskData(bool isSheetCompleted, bool isSwitchNextSheet, List hitSquareIdList, List treasureBoxReawrdList, List lineRewardData, List> completedLineConditionList, bool isBingoLoginBonus, bool isDisplayTweetDialog) + { + IsSheetCompleted = isSheetCompleted; + IsSwitchNextSheet = isSwitchNextSheet; + HitSquareIdList = hitSquareIdList; + TreasureBoxReawrdList = treasureBoxReawrdList; + LineRewardData = lineRewardData; + CompletedLineConditionList = completedLineConditionList; + IsBingoLoginBonus = isBingoLoginBonus; + IsDisplayTweetDialog = isDisplayTweetDialog; + } + } + + public BingoDrawTaskData Result { get; private set; } + + private static List CompletedLine(JsonData squareJsonData) + { + List list = new List(); + for (int i = 0; i < squareJsonData.Count; i++) + { + list.Add(squareJsonData[i].ToInt()); + } + return list; + } + + public BingoDrawTask() + { + base.type = ApiType.Type.BingoDraw; + } + + public void SetParameter(int buyNum, int viewerId) + { + BingoDrawTaskParam bingoDrawTaskParam = new BingoDrawTaskParam(); + bingoDrawTaskParam.viewer_id = viewerId.ToString(); + bingoDrawTaskParam.draw_count = buyNum; + base.Params = bingoDrawTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData response = base.ResponseData["data"]; + Result = ParseBingoDrawResult(response); + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } + + public static BingoDrawTaskData ParseBingoDrawResult(JsonData response, bool isBingoLoginBonus = false) + { + bool isSheetCompleted = response["is_sheet_completed"].ToInt() == 1; + bool isSwitchNextSheet = response["is_switch_next_sheet"].ToInt() == 1; + JsonData jsonData = response["hit_square_id_list"]; + List list = new List(); + for (int i = 0; i < jsonData.Count; i++) + { + int item = jsonData[i].ToInt(); + list.Add(item); + } + JsonData jsonData2 = response["treasure_box_reward_list"]; + List list2 = new List(); + for (int j = 1; j < jsonData2.Count; j++) + { + ReceivedReward item2 = ReceivedReward.CreateFromBingoTreasureBoxReward(jsonData2[j]); + list2.Add(item2); + } + JsonData jsonData3 = response["line_reward_list"]; + List list3 = new List(); + for (int k = 1; k < jsonData3.Count; k++) + { + ReceivedReward item3 = ReceivedReward.CreateFromBingoLineReward(jsonData3[k]); + list3.Add(item3); + } + JsonData jsonData4 = response["completed_line_condition_list"]; + List> list4 = new List>(); + for (int l = 0; l < jsonData4.Count; l++) + { + List item4 = CompletedLine(jsonData4[l]); + list4.Add(item4); + } + bool isDisplayTweetDialog = response["is_display_tweet_dialog"].ToBoolean(); + return new BingoDrawTaskData(isSheetCompleted, isSwitchNextSheet, list, list2, list3, list4, isBingoLoginBonus, isDisplayTweetDialog); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Bingo/BingoInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard.Bingo/BingoInfoTask.cs new file mode 100644 index 0000000..50dffb1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Bingo/BingoInfoTask.cs @@ -0,0 +1,224 @@ +using System; +using System.Collections.Generic; +using LitJson; + +namespace Wizard.Bingo; + +public class BingoInfoTask : BaseTask +{ + public struct SquareData + { + public int SquareId; + + public int DisplayId; + + public bool IsOpen; + + public int TreasureBoxGradeId; + + public SquareData(JsonData squareJsonData) + { + SquareId = squareJsonData["square_id"].ToInt(); + DisplayId = squareJsonData["display_id"].ToInt(); + IsOpen = squareJsonData["is_open"].ToInt() == 1; + TreasureBoxGradeId = squareJsonData["treasure_box_grade_id"].ToInt(); + } + } + + public struct BingoMissionData + { + public string MissionTitle { get; private set; } + + public int MissionCurrent { get; private set; } + + public int MissionMax { get; private set; } + + public bool IsCleared { get; private set; } + + public ReceivedReward Reward { get; private set; } + + public float MissionRatio + { + get + { + if (MissionMax == 0) + { + return 0f; + } + return (float)MissionCurrent / (float)MissionMax; + } + } + + public BingoMissionData(JsonData json) + { + MissionTitle = json["mission_name"].ToString(); + MissionCurrent = json["total_count"].ToInt(); + MissionMax = json["require_number"].ToInt(); + IsCleared = json["is_achieved"].ToInt() == 1; + ReceivedReward reward = ReceivedReward.CreateFromBingoMissionReward(json["reward_list"][0]); + Reward = reward; + } + } + + public struct CurrentLineRewardInfo + { + public string LineNum { get; private set; } + + public bool IsCleared { get; private set; } + + public ReceivedReward Reward { get; private set; } + + public CurrentLineRewardInfo(JsonData json) + { + LineNum = json["line_num"].ToString(); + IsCleared = json["is_achieved"].ToInt() == 1; + ReceivedReward reward = ReceivedReward.CreateFromBingoMissionReward(json); + Reward = reward; + } + } + + public class BingoInfoData + { + public int CampaignId; + + public int SheetNum { get; private set; } + + public int BingoTicketNum { get; private set; } + + public int MaxSquareNum { get; private set; } + + public int MaxSheetNum { get; private set; } + + public int BingoDrawCost { get; private set; } + + public List SquareDataList { get; private set; } + + public Dictionary> AllLineRewardsListDic { get; private set; } + + public DateTime StartTime { get; private set; } + + public DateTime EndTime { get; private set; } + + public string NotificationId { get; private set; } + + public List MissionList { get; private set; } + + public List CurrentLineRewardList { get; private set; } + + public DateTime MissionEndTime { get; private set; } + + public bool IsMissionActivePeriod { get; private set; } + + public BingoInfoData(int campaignId, int sheetNum, int bingoTicketNum, int maxSquareNum, int maxSheetNum, int bingoDrawCost, DateTime startTime, DateTime endTime, List squareDataList, Dictionary> allLineRewardsListDic, string notificationId, List missionList, List currentLineRewardList, DateTime missionEndTime, bool isMissionActivePeriod) + { + CampaignId = campaignId; + SheetNum = sheetNum; + BingoTicketNum = bingoTicketNum; + MaxSquareNum = maxSquareNum; + MaxSheetNum = maxSheetNum; + BingoDrawCost = bingoDrawCost; + StartTime = startTime; + EndTime = endTime; + SquareDataList = squareDataList; + AllLineRewardsListDic = allLineRewardsListDic; + NotificationId = notificationId; + MissionList = missionList; + CurrentLineRewardList = currentLineRewardList; + MissionEndTime = missionEndTime; + IsMissionActivePeriod = isMissionActivePeriod; + } + } + + public class BingoInfoTaskParam : BaseParam + { + public bool is_display_update; + } + + public BingoInfoData Result { get; private set; } + + public bool CanGiveDailyLoginBonus { get; private set; } + + public BingoDrawTask.BingoDrawTaskData BingoLoginDrawResult { get; private set; } + + public BingoInfoTask() + { + base.type = ApiType.Type.BingoInfo; + } + + public void SetParameter(bool isDisplayUpdate) + { + BingoInfoTaskParam bingoInfoTaskParam = new BingoInfoTaskParam(); + bingoInfoTaskParam.is_display_update = isDisplayUpdate; + base.Params = bingoInfoTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + CanGiveDailyLoginBonus = jsonData.GetValueOrDefault("can_give_login_bonus", defaultValue: false); + if (CanGiveDailyLoginBonus) + { + return num; + } + int campaignId = jsonData["campaign_id"].ToInt(); + int sheetNum = jsonData["sheet_num"].ToInt(); + int bingoTicketNum = jsonData["bingo_ticket_num"].ToInt(); + int maxSquareNum = jsonData["max_square_num"].ToInt(); + int maxSheetNum = jsonData["max_sheet_num"].ToInt(); + int bingoDrawCost = jsonData["bingo_draw_cost"].ToInt(); + string notificationId = jsonData["notice_text_id"].ToString(); + DateTime startTime = DateTime.Parse(jsonData["start_time"].ToString()); + DateTime endTime = DateTime.Parse(jsonData["end_time"].ToString()); + DateTime missionEndTime = DateTime.Parse(jsonData["mission_end_time"].ToString()); + bool isMissionActivePeriod = jsonData["is_mission_active_period"].ToBoolean(); + JsonData jsonData2 = jsonData["square_list"]; + List list = new List(); + for (int i = 1; i < jsonData2.Count; i++) + { + SquareData item = new SquareData(jsonData2[i]); + list.Add(item); + } + JsonData jsonData3 = jsonData["all_line_reward_list"]; + Dictionary> dictionary = new Dictionary>(); + for (int j = 0; j < jsonData3.Count; j++) + { + for (int k = 0; k < jsonData3[j].Count; k++) + { + ReceivedReward item2 = ReceivedReward.CreateFromBingoLineReward(jsonData3[j][k]); + if (dictionary.ContainsKey(j)) + { + dictionary[j].Add(item2); + continue; + } + dictionary[j] = new List(); + dictionary[j].Add(item2); + } + } + JsonData jsonData4 = jsonData["mission_list"]; + List list2 = new List(); + for (int l = 0; l < jsonData4.Count; l++) + { + BingoMissionData item3 = new BingoMissionData(jsonData4[l]); + list2.Add(item3); + } + JsonData jsonData5 = jsonData["current_line_reward_list"]; + List list3 = new List(); + for (int m = 0; m < jsonData5.Count; m++) + { + CurrentLineRewardInfo item4 = new CurrentLineRewardInfo(jsonData5[m]); + list3.Add(item4); + } + if (jsonData.TryGetValue("login_bonus", out var value)) + { + BingoLoginDrawResult = BingoDrawTask.ParseBingoDrawResult(value, isBingoLoginBonus: true); + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(value["reward_list"]); + } + Result = new BingoInfoData(campaignId, sheetNum, bingoTicketNum, maxSquareNum, maxSheetNum, bingoDrawCost, startTime, endTime, list, dictionary, notificationId, list2, list3, missionEndTime, isMissionActivePeriod); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/CardSelectListUIBase.cs b/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/CardSelectListUIBase.cs new file mode 100644 index 0000000..8c8bd4e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/CardSelectListUIBase.cs @@ -0,0 +1,888 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard.DeckCardEdit; + +public abstract class CardSelectListUIBase : MecanimSceneBase +{ + private enum SlideType + { + None, + Next, + Prev + } + + public const int CARD_PER_PAGE_IN_SELECTION_AREA = 10; + + public const int CARD_PER_PAGE = 8; + + public const float CARD_WIDTH = 120f; + + private const float DRAG_DEGREE = 70f; + + public const float SELECTION_AREA_CARD_SCALE = 0.5f; + + public const float PAGE_CARD_SCALE = 0.6f; + + [SerializeField] + protected MecanimStateBase _stateDefaultView; + + [SerializeField] + protected CardSelectListUI_State_Edit _stateEdit; + + [SerializeField] + protected CardSelectListUI_State_CardDrag _stateCardDrag; + + [SerializeField] + private UIButton m_nextPageBtn; + + [SerializeField] + private UIButton m_prevPageBtn; + + [SerializeField] + private UISprite m_nextPageBtnGrayout; + + [SerializeField] + private UISprite m_prevPageBtnGrayout; + + private SlideType _slideType; + + private bool _isSlideEnd = true; + + public Action OnChangeSlideEnd; + + protected CardBundleControllerBase _cardBundle; + + [SerializeField] + protected Transform _parentSelectionObj; + + [SerializeField] + protected Transform m_parentPagingObj; + + [SerializeField] + protected SimpleCardDetail m_simpleDetailPrefab; + + protected SimpleCardDetail _simpleDetail; + + [SerializeField] + private UILabel m_labelPageInfo; + + [SerializeField] + protected UITexture m_sleeveOriginal; + + [SerializeField] + protected GameObject m_cardInfoOriginal; + + [SerializeField] + private GameObject _hideFilter; + + [SerializeField] + private FilterController _prefabFilter; + + protected FilterController _selectCardFilter; + + protected FilterController _pagingFilter; + + [SerializeField] + protected UIInputWizard m_searchInput; + + [SerializeField] + protected UIButton m_searchCancelButton; + + [SerializeField] + private UILabel m_noEditCardLabel; + + [SerializeField] + protected GameObject m_PagingDragPanel; + + [SerializeField] + protected UILabel _redetherNum; + + [SerializeField] + private UIScrollView _scrollView; + + private bool _isLoading; + + protected bool _isDisableTouchWhileLoading; + + protected List _resourcePathList; + + protected bool _enableSelectSameKindCardNum = true; + + protected bool _isSelectableSpotCard; + + private GameObject _detailTargetObj; + + private MyRotationInfo _myRotationInfoBeforeInitialize; + + private FilterController.MyRotationFilterType _filterType = FilterController.MyRotationFilterType.CARD_POOL_SELECT_ONLY; + + private MyRotationInfo _myRotationInfo; + + protected bool IsSlideEnd + { + get + { + return _isSlideEnd; + } + set + { + if (value != _isSlideEnd) + { + _isSlideEnd = value; + OnChangeSlideEnd.Call(value); + } + } + } + + public FilteringCardBundle SelectionAreaList => _cardBundle.SelectionAreaList; + + public CardBundle PagingList => _cardBundle.PagingList; + + public bool IsSetup { get; protected set; } + + public Format Format { get; protected set; } + + public bool IsLoading + { + get + { + return _isLoading; + } + protected set + { + if (_isLoading = value && !IsSetup) + { + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true, !_isDisableTouchWhileLoading); + } + else + { + UIManager.GetInstance().closeInSceneCenterLoading(); + } + } + } + + public bool IsSliding => _slideType != SlideType.None; + + protected bool IsShowCardDetailCraftPanel { get; set; } = true; + + public IFormatBehavior FormatBehavior { get; private set; } + + protected FilterController.MyRotationFilterType MyRotationFilterTypeCardPool + { + get + { + return _filterType; + } + set + { + _filterType = value; + _stateCardDrag.SetMyRotationInfo(_myRotationInfo, MyRotationFilterTypeCardPool); + } + } + + public abstract bool IsEnableSwipeAutoSameBasicCardAdd(); + + protected void InitializeBase(Format format, ConventionDeckList conventionDeckList) + { + FormatBehavior = FormatBehaviorManager.Create(format, conventionDeckList); + } + + protected void SetMyRotationData(MyRotationInfo myRotationInfo) + { + _myRotationInfo = myRotationInfo; + _stateCardDrag.SetMyRotationInfo(myRotationInfo, MyRotationFilterTypeCardPool); + if (_selectCardFilter != null && _pagingFilter != null && _cardBundle != null) + { + _selectCardFilter.SetMyRotationData(myRotationInfo, FilterController.MyRotationFilterType.DECK, MyRotationFilterTypeCardPool == FilterController.MyRotationFilterType.CARD_POOL_ALL_PACK); + _pagingFilter.SetMyRotationData(myRotationInfo, MyRotationFilterTypeCardPool, isAllBackVisible: false); + _isDisableTouchWhileLoading = true; + FetchPagingCard(); + _cardBundle.UpdateMyRotationInfo(myRotationInfo, MyRotationFilterTypeCardPool); + _myRotationInfoBeforeInitialize = null; + } + else + { + _myRotationInfoBeforeInitialize = myRotationInfo; + } + } + + public override void onFirstStart() + { + base.IsShowFooterMenu = false; + UIEventListener.Get(m_PagingDragPanel).onDrag = OnDragPagingCard; + UIEventListener.Get(m_PagingDragPanel).onDragOver = OnDragOverPagingCard; + UIEventListener.Get(m_PagingDragPanel).onScroll = OnScrollPagingCard; + UIEventListener.Get(m_nextPageBtn.gameObject).onPress = delegate(GameObject g, bool b) + { + if (b) + { + NextPage(); + } + }; + UIEventListener.Get(m_prevPageBtn.gameObject).onPress = delegate(GameObject g, bool b) + { + if (b) + { + PrevPage(); + } + }; + UIEventListener uIEventListener = UIEventListener.Get(m_nextPageBtn.gameObject); + uIEventListener.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener.onDrag, (UIEventListener.VectorDelegate)delegate + { + if (IsSlideEnd) + { + m_nextPageBtn.state = UIButtonColor.State.Normal; + } + }); + UIEventListener uIEventListener2 = UIEventListener.Get(m_prevPageBtn.gameObject); + uIEventListener2.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener2.onDrag, (UIEventListener.VectorDelegate)delegate + { + if (IsSlideEnd) + { + m_prevPageBtn.state = UIButtonColor.State.Normal; + } + }); + _simpleDetail = UnityEngine.Object.Instantiate(m_simpleDetailPrefab); + _simpleDetail.transform.parent = base.transform; + _simpleDetail.transform.localPosition = Vector3.zero; + _simpleDetail.transform.localScale = Vector3.one; + _simpleDetail.OnClickCloseButton += HideDetail; + _simpleDetail.OnClickCreateButton += OnCreate; + _simpleDetail.OnClickLiquefyButton += OnLiquefy; + _cardBundle.OnClickSelectionAreaCard += OnClickSelectionAreaCard; + _cardBundle.OnClickPagingCard += OnClickPagingCard; + _cardBundle.OnDragPagingCard += OnDragPagingCard; + _cardBundle.OnScrollPagingCard += OnScrollPagingCard; + _cardBundle.OnDragOverPagingCard += OnDragOverPagingCard; + _cardBundle.OnCreatePagingSleeve += OnCreatePagingSleeve; + _cardBundle.OnCreatePagingCard += OnCreatePagingCard; + Action onInputSearchText = delegate + { + if (!_isDisableTouchWhileLoading) + { + SearchApplyOwn(m_searchInput.value); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + } + }; + m_searchInput.onSubmit.Add(new EventDelegate(delegate + { + if (onInputSearchText != null) + { + onInputSearchText(); + } + })); + m_searchInput.onDeselect.Add(new EventDelegate(delegate + { + onInputSearchText(); + })); + base.onFirstStart(); + } + + protected override void onOpen() + { + base.onOpen(); + UIManager.GetInstance().ShowFooterMenu(isShow: false); + _selectCardFilter = UnityEngine.Object.Instantiate(_prefabFilter); + _pagingFilter = UnityEngine.Object.Instantiate(_prefabFilter); + _selectCardFilter.Initialize(FormatBehavior); + _pagingFilter.Initialize(FormatBehavior); + if (_myRotationInfoBeforeInitialize != null) + { + _selectCardFilter.SetMyRotationData(_myRotationInfoBeforeInitialize, FilterController.MyRotationFilterType.DECK, isAllBackVisible: false); + _pagingFilter.SetMyRotationData(_myRotationInfoBeforeInitialize, MyRotationFilterTypeCardPool, isAllBackVisible: false); + _cardBundle.UpdateMyRotationInfo(_myRotationInfoBeforeInitialize, MyRotationFilterTypeCardPool); + } + _selectCardFilter.Hide(); + _pagingFilter.Hide(); + RegistFilterEvent(); + GameMgr.GetIns().GetGameObjMgr().GetUIContainer() + .SetActive(value: false); + _stateEdit.ResetScroll(); + m_searchInput.value = ""; + m_searchCancelButton.gameObject.SetActive(value: false); + } + + private void RegistFilterEvent() + { + _selectCardFilter.OnValidate += OnValidateSelectionAreaFilter; + _pagingFilter.OnValidate += OnValidatePagingFilter; + } + + private void ClearFilterEvent() + { + _selectCardFilter.OnValidate -= OnValidateSelectionAreaFilter; + _pagingFilter.OnValidate -= OnValidatePagingFilter; + } + + protected List GetEffectAssetPathList() + { + return new List + { + Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_1", ResourcesManager.AssetLoadPathType.Effect2D), + Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_3", ResourcesManager.AssetLoadPathType.Effect2D), + Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_2", ResourcesManager.AssetLoadPathType.Effect2D) + }; + } + + protected void SetupEffect(Action callback) + { + List effectObjList = new List + { + Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_3", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), + Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_2", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), + Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_card_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) + }; + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(effectObjList, callback); + } + + protected void SetupState() + { + _stateEdit.RefreshSelectionArea(isImmediate: true); + _stateEdit.RefreshPage(isImmediate: true); + } + + protected void SetupSimpleDetail() + { + if (FormatBehavior.IsConventionMode) + { + _simpleDetail.ActiveCraftPanel(isActive: false); + } + } + + protected override void onClose() + { + _cardBundle.DisableNewFlagDisplayedCards(); + _cardBundle.Destroy(); + _stateCardDrag.DestroyDragCard(); + UnityEngine.Object.Destroy(_selectCardFilter.gameObject); + UnityEngine.Object.Destroy(_pagingFilter.gameObject); + Toolbox.ResourcesManager.RemoveAssetGroup(Toolbox.ResourcesManager.Card2DAssetPathList); + Toolbox.ResourcesManager.RemoveAssetGroup(_resourcePathList); + Toolbox.ResourcesManager.CardListAssetPathList.Clear(); + _stateEdit.RefreshSelectionArea(isImmediate: true); + _stateEdit.RefreshPage(isImmediate: true); + MyPageMenu.SetEnableReloadCard(); + UIDrawCall.ReleaseInactive(); + base.onClose(); + } + + public override void onMove() + { + if (_cardBundle != null) + { + _cardBundle.Tick(); + base.onMove(); + } + } + + protected virtual void OnFinishFadeIn() + { + ChangeState(_stateDefaultView, skipCloseAnim: true); + ClearFilterEvent(); + _selectCardFilter.Reset(); + _pagingFilter.Reset(); + RegistFilterEvent(); + IsSetup = false; + } + + public bool LoadPagingCard(int page) + { + IsLoading = true; + HideDetail(); + return _cardBundle.LoadPagingCard(page, isDestroyImmediate: true); + } + + public void FetchPagingCard() + { + IsLoading = true; + HideDetail(); + _cardBundle.FetchPagingCard(); + } + + public void NextPage() + { + if (!IsLoading && m_state != _stateCardDrag && !m_searchInput.isSelected && _cardBundle.CurrentPage + 1 <= _cardBundle.MaxPage) + { + if (m_searchInput.ClearIMEOnlyOSX()) + { + SearchApplyOwn(m_searchInput.value); + return; + } + IsSlideEnd = false; + _slideType = SlideType.Next; + IsLoading = true; + PagingBase(_stateEdit.NextPage, _cardBundle.CurrentPage + 1, NextPage); + } + else if (IsLoading) + { + if (_slideType == SlideType.Prev) + { + IsSlideEnd = true; + m_nextPageBtn.state = UIButtonColor.State.Normal; + } + } + else if (m_searchInput.isSelected) + { + if (m_searchInput.ClearIMEOnlyOSX()) + { + SearchApplyOwn(m_searchInput.value); + } + m_searchInput.ClearFocusOnlyOSX(); + } + } + + public void PrevPage() + { + if (!IsLoading && m_state != _stateCardDrag && !m_searchInput.isSelected && _cardBundle.CurrentPage - 1 >= 0) + { + if (m_searchInput.ClearIMEOnlyOSX()) + { + SearchApplyOwn(m_searchInput.value); + return; + } + IsSlideEnd = false; + _slideType = SlideType.Prev; + IsLoading = true; + PagingBase(_stateEdit.PrevPage, _cardBundle.CurrentPage - 1, PrevPage); + } + else if (IsLoading) + { + if (_slideType == SlideType.Next) + { + IsSlideEnd = true; + m_prevPageBtn.state = UIButtonColor.State.Normal; + } + } + else if (m_searchInput.isSelected) + { + if (m_searchInput.ClearIMEOnlyOSX()) + { + SearchApplyOwn(m_searchInput.value); + } + m_searchInput.ClearFocusOnlyOSX(); + } + } + + public void OnBtnPushSeachCancelOwn() + { + if (!IsLoading) + { + SearchApplyOwn(""); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL); + } + } + + private void PagingBase(Action anim, int page, Action next) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_CARD_MOVE_OUT); + GameMgr.GetIns().GetSoundMgr().StopSe(Se.TYPE.SYS_CARDLIST_REVERSE); + anim.Call(delegate + { + if (LoadPagingCard(page)) + { + Action replay = null; + replay = delegate + { + _cardBundle.OnCreatePagingCard -= replay; + if (Input.GetMouseButton(0) && !IsSlideEnd && (m_nextPageBtn.state == UIButtonColor.State.Pressed || m_prevPageBtn.state == UIButtonColor.State.Pressed)) + { + next(); + } + else + { + _slideType = SlideType.None; + IsSlideEnd = true; + } + }; + _cardBundle.OnCreatePagingCard += replay; + } + }); + } + + public virtual int InsertToSelectionArea(CardObject card) + { + int num = _cardBundle.InsertToSelectionArea(card); + CardObject cardObject = SelectionAreaList.FindWithIndex(num); + if (cardObject != null && SelectionAreaList.CountKind > 10) + { + int num2 = Mathf.Clamp(num, 5, SelectionAreaList.CountKind - 5); + if (cardObject.TotalCardNum == 1 && num > 0) + { + num2++; + } + _stateEdit.CenterOn(num2); + } + if (_scrollView != null) + { + _scrollView.customMovement = ((SelectionAreaList.CountKind > 10) ? Vector2.right : Vector2.zero); + } + return num; + } + + public virtual int RemoveFromSelectionArea(CardObject card) + { + int result = _cardBundle.RemoveFromSelectionArea(card); + _stateEdit.Fit(); + if (_scrollView != null) + { + _scrollView.customMovement = ((SelectionAreaList.CountKind > 10) ? Vector2.right : Vector2.zero); + } + return result; + } + + private bool IsMaxCardNumInSelectionArea(int cardId) + { + if (!_enableSelectSameKindCardNum) + { + return false; + } + int num = GetSameKindNumMaxInFormat(cardId); + if (_myRotationInfo != null) + { + num = _myRotationInfo.GetSameCardCount(CardMaster.GetInstance(FormatBehavior.CardMasterId).GetCardParameterFromId(cardId).BaseCardId); + } + if (_cardBundle.CountCardNumInSelectionArea(cardId, isStrictSameCard: false) >= num) + { + return true; + } + return false; + } + + protected virtual int GetSameKindNumMaxInFormat(int cardId) + { + return FormatBehavior.DeckSameKindCardNumMax; + } + + public bool IsExistCardCardPool(int cardId) + { + if (IsMaxCardNumInSelectionArea(cardId)) + { + return false; + } + int num = SelectionAreaList.CardList.Where((CardObject c) => c.CardId == cardId).Sum((CardObject c) => c.TotalCardNum); + return FormatBehavior.GetPossessionCardNum(cardId, _isSelectableSpotCard) > num; + } + + public bool IsAddableByBaseCardId(int cardId, out int addCardId) + { + if (IsMaxCardNumInSelectionArea(cardId)) + { + addCardId = 0; + return false; + } + CardMaster instance = CardMaster.GetInstance(FormatBehavior.CardMasterId); + List list = new List(); + foreach (int item in instance.GetSameCardListByBaseCardId(instance.GetCardParameterFromId(cardId).BaseCardId)) + { + if (FormatBehavior.SortedDeckUsableCardList.Contains(item)) + { + list.Add(item); + } + } + IOrderedEnumerable orderedEnumerable = list.OrderBy((int id) => -id); + CardParameter cardParameterFromId = instance.GetCardParameterFromId(cardId); + foreach (int item2 in list) + { + if (instance.GetCardParameterFromId(item2).NormalCardId == cardParameterFromId.NormalCardId && IsExistCardCardPool(item2)) + { + addCardId = item2; + return true; + } + } + foreach (int item3 in orderedEnumerable) + { + if (instance.GetCardParameterFromId(item3).IsFoil == cardParameterFromId.IsFoil && IsExistCardCardPool(item3)) + { + addCardId = item3; + return true; + } + } + foreach (int item4 in orderedEnumerable) + { + if (IsExistCardCardPool(item4)) + { + addCardId = item4; + return true; + } + } + if (_cardBundle.CanUseNonPossessionCard) + { + if (instance.GetCardParameterFromId(cardId).CanCraft) + { + addCardId = cardId; + return true; + } + foreach (int item5 in list) + { + if (instance.GetCardParameterFromId(item5).CanCraft) + { + addCardId = item5; + return true; + } + } + } + addCardId = 0; + return false; + } + + public bool IsRemainingAddableCardToSelectionArea(int cardId) + { + if (IsMaxCardNumInSelectionArea(cardId)) + { + return false; + } + CardParameter cardParameterFromId = CardMaster.GetInstance(FormatBehavior.CardMasterId).GetCardParameterFromId(cardId); + if (_cardBundle.CanUseNonPossessionCard && DeckCardEditUI.IsSelectableNonPossessionCard(cardParameterFromId)) + { + return true; + } + int num = SelectionAreaList.CardList.Where((CardObject c) => c.CardId == cardId).Sum((CardObject c) => c.TotalCardNum); + return FormatBehavior.GetPossessionCardNum(cardId, _isSelectableSpotCard) > num; + } + + private void ShowDetail(GameObject obj, int id, bool isSelectionArea) + { + if (!IsLoading && !UIManager.GetInstance().isOpenDialog()) + { + SelectCard(obj, isSelectionArea); + _simpleDetail.ChangeDetail(id, FormatBehavior.CardMasterId, _myRotationInfo); + _simpleDetail.ActiveCraftPanel(!isSelectionArea && IsShowCardDetailCraftPanel); + } + } + + public void HideDetail() + { + SelectCard(null, isSelectionArea: false); + _simpleDetail.HideDetail(); + } + + private void SelectCard(GameObject obj, bool isSelectionArea) + { + Se.TYPE setype = Se.TYPE.NONE; + CardObject cardObject = SelectionAreaList.FindWithObject(_detailTargetObj); + if (cardObject == null) + { + cardObject = PagingList.FindWithObject(_detailTargetObj); + } + if (cardObject != null && cardObject.IsVisibleCursorEffect) + { + cardObject.ChangeSelectingState(isSelect: false); + setype = Se.TYPE.SYS_CARD_INFO_CANCEL; + } + CardObject cardObject2 = (isSelectionArea ? SelectionAreaList.FindWithObject(obj) : PagingList.FindWithObject(obj)); + if (cardObject2 != null) + { + cardObject2.ChangeSelectingState(isSelect: true); + setype = Se.TYPE.SYS_CARD_INFO_SMALL; + } + _detailTargetObj = obj; + GameMgr.GetIns().GetSoundMgr().PlaySe(setype); + } + + protected virtual void AccordCardInfo() + { + _cardBundle.AccordCardInfo(); + _stateEdit.RefreshSelectionArea(isImmediate: false); + } + + private void SearchApplyOwn(string word) + { + SetSearchKeyword(word); + _isDisableTouchWhileLoading = true; + FetchPagingCard(); + } + + private void SetSearchKeyword(string word) + { + if (!(_cardBundle.FilterParameter.Word == word)) + { + m_searchInput.RemoveFocus(); + m_searchCancelButton.gameObject.SetActive(word.Length > 0); + UIBase_CardManager.FilterParameter filterParameter = _cardBundle.FilterParameter; + string word2 = (m_searchInput.value = word); + filterParameter.Word = word2; + _cardBundle.FilterParameter = filterParameter; + } + } + + protected void ShowFilterMenu(FilterController filter, string title) + { + HideDetail(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetTitleLabel(title); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetObj(filter.gameObject); + dialogBase.CloseOnOff(flag: false); + filter.Show(); + dialogBase.OnClose = delegate + { + filter.Hide(); + filter.transform.parent = _hideFilter.transform; + }; + } + + protected virtual void OnValidateSelectionAreaFilter() + { + _stateCardDrag.OnChangeSelectionAreaFilter(); + UIBase_CardManager.FilterParameter filterParameter = _selectCardFilter.GetFilterParameter(new UIBase_CardManager.FilterParameter()); + SelectionAreaList.ApplyFilter(filterParameter); + _stateEdit.RefreshSelectionArea(isImmediate: false); + _stateEdit.Fit(); + } + + protected virtual void OnValidatePagingFilter() + { + if (!_isDisableTouchWhileLoading) + { + SetSearchKeyword(m_searchInput.value); + _cardBundle.FilterParameter = _pagingFilter.GetFilterParameter(_cardBundle.FilterParameter); + _isDisableTouchWhileLoading = true; + FetchPagingCard(); + } + } + + protected virtual void OnCreatePagingSleeve() + { + m_labelPageInfo.text = Data.SystemText.Get("Card_0053", (_cardBundle.CurrentPage + 1).ToString(), (_cardBundle.MaxPage + 1).ToString()); + bool flag = _cardBundle.CurrentPage + 1 <= _cardBundle.MaxPage; + bool flag2 = _cardBundle.CurrentPage - 1 >= 0; + m_nextPageBtn.gameObject.SetActive(flag); + m_prevPageBtn.gameObject.SetActive(flag2); + m_nextPageBtnGrayout.gameObject.SetActive(!flag); + m_prevPageBtnGrayout.gameObject.SetActive(!flag2); + _stateEdit.RefreshPage(isImmediate: false); + } + + private void OnCreatePagingCard() + { + IsLoading = false; + _isDisableTouchWhileLoading = false; + _stateEdit.RefreshSelectionArea(isImmediate: true); + _stateEdit.RefreshPage(isImmediate: true); + m_noEditCardLabel.gameObject.SetActive(_cardBundle.PagingList.CountKind <= 0); + } + + private void OnCreate() + { + _cardBundle.OnCreateCard(_simpleDetail.CardID); + AccordCardInfo(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + if (dataMgr.GetPossessionCardNum(_simpleDetail.CardID, _isSelectableSpotCard) == 1) + { + if (!_cardBundle.IsCraftMode) + { + _cardBundle.FetchPagingCard(); + } + dataMgr.SetIsNewCard(_simpleDetail.CardID, isNew: false); + } + } + + protected virtual void OnLiquefy(int cardId) + { + AccordCardInfo(); + } + + private void OnClickSelectionAreaCard(GameObject obj) + { + OnClickCard(obj, isSelectionArea: true, isIdCheck: true); + } + + private void OnClickPagingCard(GameObject obj) + { + OnClickCard(obj, isSelectionArea: false, isIdCheck: true); + } + + private void OnClickCard(GameObject obj, bool isSelectionArea, bool isIdCheck) + { + if (!_stateEdit.IsClick && !(m_state == _stateDefaultView)) + { + return; + } + CharIdx component = obj.GetComponent(); + if (component != null) + { + if (isIdCheck && _simpleDetail.IsVisible && _simpleDetail.CardID == component.GetCardId()) + { + HideDetail(); + } + else + { + ShowDetail(obj, component.GetCardId(), isSelectionArea); + } + } + } + + private void OnDragPagingCard(GameObject obj, Vector2 dir) + { + if (Mathf.Abs(dir.x) >= 70f) + { + RequestChangePage(dir.x); + } + } + + private void OnScrollPagingCard(GameObject o, float factor) + { + RequestChangePage(factor); + } + + private void RequestChangePage(float dir) + { + if (!(m_state == _stateEdit) || _simpleDetail.IsVisible || IsLoading) + { + return; + } + if (dir > 0f) + { + if (_cardBundle.CurrentPage > 0) + { + PrevPage(); + } + } + else if (_cardBundle.CurrentPage < _cardBundle.MaxPage) + { + NextPage(); + } + } + + private void OnDragOverPagingCard(GameObject obj) + { + if (_simpleDetail.IsVisible && !_simpleDetail.IsDetailPanelDragging) + { + OnClickCard(obj, isSelectionArea: false, isIdCheck: false); + } + } + + public override bool IsGetOutOfScene(Action backupExec) + { + if (IsLoading) + { + return false; + } + if (_selectCardFilter.IsShow) + { + _selectCardFilter.Hide(); + return false; + } + if (_pagingFilter.IsShow) + { + _pagingFilter.Hide(); + return false; + } + if (_simpleDetail.IsVisible) + { + HideDetail(); + return false; + } + if (m_state == _stateCardDrag) + { + return false; + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/CardSelectListUI_State_CardDrag.cs b/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/CardSelectListUI_State_CardDrag.cs new file mode 100644 index 0000000..c1e24e9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/CardSelectListUI_State_CardDrag.cs @@ -0,0 +1,629 @@ +using System; +using System.Collections; +using UnityEngine; + +namespace Wizard.DeckCardEdit; + +public class CardSelectListUI_State_CardDrag : MecanimStateBase +{ + public enum Mode + { + OutToIn, + InToOut + } + + private enum Area + { + InSelectionArea, + OutSelectionArea, + NoSelectionArea, + SameCardArea + } + + [SerializeField] + private string m_closeStateName_Insert; + + [SerializeField] + private string m_closeStateName_Remove; + + [SerializeField] + private CardSelectListUIBase m_scene; + + [SerializeField] + private CardSelectListUI_State_Edit _stateEdit; + + [SerializeField] + private GameObject m_parentCloneCard; + + [SerializeField] + private UIWidget m_parentClone_Grab; + + [SerializeField] + private UIWidget m_parentClone_Insert; + + [SerializeField] + private UISprite m_darkMask_Grab; + + [SerializeField] + private UISprite m_darkMask_Insert; + + [SerializeField] + private BoxCollider _colliderSelectionArea; + + [SerializeField] + private BoxCollider _sameCardAddCollider; + + [SerializeField] + private BoxCollider _colliderPagingArea; + + [SerializeField] + private GameObject m_insertInfo; + + [SerializeField] + private GameObject m_removeInfo; + + private CardObject m_grabCardData; + + private GameObject[] m_destroyList; + + private Area _cursorArea; + + private Area _lastDragArea; + + private bool _isFlashWhenInsert = true; + + private MyRotationInfo _myRotationInfo; + + private FilterController.MyRotationFilterType _myRotationFilterType; + + public Mode EditMode { get; set; } = Mode.InToOut; + + public bool ImmediateMove { get; set; } + + public bool IsDraggableMaintenance { get; set; } + + public Action AddCardForSameCardSwipe { get; set; } + + public void SetMyRotationInfo(MyRotationInfo info, FilterController.MyRotationFilterType filterType) + { + _myRotationInfo = info; + _myRotationFilterType = filterType; + } + + private void Awake() + { + m_parentCloneCard.gameObject.layer = LayerMask.NameToLayer("Detail"); + } + + private void Start() + { + if (m_scene == null) + { + MonoBehaviour.print("ใ‚ทใƒผใƒณใŒใ‚ปใƒƒใƒˆใ•ใ‚Œใฆใ„ใพใ›ใ‚“"); + } + _colliderSelectionArea.gameObject.SetActive(value: false); + _colliderPagingArea.gameObject.SetActive(value: false); + m_darkMask_Insert.gameObject.SetActive(value: false); + m_darkMask_Grab.gameObject.SetActive(value: false); + _sameCardAddCollider.gameObject.SetActive(value: false); + } + + public override bool onCloseRequest(MecanimStateBase next, bool isSkip) + { + if (!(next == _stateEdit)) + { + return next == this; + } + return true; + } + + public override void onOpen() + { + base.onOpen(); + _colliderSelectionArea.gameObject.SetActive(value: true); + _colliderPagingArea.gameObject.SetActive(value: true); + switch (EditMode) + { + case Mode.OutToIn: + m_insertInfo.SetActive(value: true); + m_removeInfo.SetActive(value: false); + _sameCardAddCollider.gameObject.SetActive(value: false); + break; + case Mode.InToOut: + m_insertInfo.SetActive(value: false); + m_removeInfo.SetActive(value: true); + break; + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DRAG_CARD); + } + + public override void onFinishCloseAnim() + { + base.onFinishCloseAnim(); + _colliderSelectionArea.gameObject.SetActive(value: false); + _colliderPagingArea.gameObject.SetActive(value: false); + _sameCardAddCollider.gameObject.SetActive(value: false); + DestroyDragCard(); + } + + public override void onMove() + { + base.onMove(); + if (ImmediateMove) + { + if (EditMode == Mode.OutToIn) + { + _cursorArea = Area.InSelectionArea; + } + else + { + _cursorArea = Area.OutSelectionArea; + } + moveCard(); + ImmediateMove = false; + return; + } + if (Input.GetMouseButton(0)) + { + Camera camera = UIManager.GetInstance().getCamera(); + Vector3 position = camera.ScreenToWorldPoint(Input.mousePosition); + m_parentClone_Grab.transform.localPosition = camera.transform.InverseTransformPoint(position); + return; + } + RaycastHit[] array = Physics.RaycastAll(UIManager.GetInstance().getCamera().ScreenPointToRay(Input.mousePosition)); + _cursorArea = Area.NoSelectionArea; + for (int i = 0; i < array.Length; i++) + { + if (array[i].collider.gameObject == _sameCardAddCollider.gameObject) + { + _cursorArea = Area.SameCardArea; + } + } + if (_cursorArea == Area.NoSelectionArea) + { + for (int j = 0; j < array.Length; j++) + { + if (array[j].collider.gameObject == _colliderSelectionArea.gameObject) + { + _cursorArea = Area.InSelectionArea; + break; + } + if (array[j].collider.gameObject == _colliderPagingArea.gameObject) + { + _cursorArea = Area.OutSelectionArea; + break; + } + } + } + moveCard(); + } + + private void AddSelectionSameCard() + { + if (AddCardForSameCardSwipe == null) + { + AddDragCardToDeck(); + } + else if (!m_scene.IsExistCardCardPool(m_grabCardData.CardId)) + { + m_scene.IsAddableByBaseCardId(m_grabCardData.CardId, out var addCardId); + if (addCardId == m_grabCardData.CardId) + { + AddDragCardToDeck(); + } + else + { + if (addCardId == 0) + { + return; + } + m_parentClone_Insert.gameObject.SetActive(value: true); + m_darkMask_Insert.gameObject.SetActive(value: false); + m_darkMask_Grab.gameObject.SetActive(value: false); + CardObject cardObject = m_scene.SelectionAreaList.FindWithCardId(addCardId); + int num = cardObject?.MainCardNum ?? 0; + int num2 = cardObject?.SubCardNum ?? 0; + AddCardForSameCardSwipe(addCardId); + DestroyDragCard(); + if (cardObject != null && (cardObject.MainCardNum != num || cardObject.SubCardNum != num2)) + { + CreateCardAddAnimation(cardObject); + } + CardObject cardObject2 = m_scene.SelectionAreaList.FindWithCardId(addCardId); + if (cardObject2 != null) + { + int num3 = m_scene.SelectionAreaList.IndexOf(cardObject2); + int num4 = Mathf.Clamp(num3, 5, m_scene.SelectionAreaList.CountKind - 5); + if (cardObject2.TotalCardNum == 1 && num3 > 0) + { + num4++; + } + _stateEdit.CenterOn(num4); + } + } + } + else + { + AddDragCardToDeck(); + } + } + + private void AddDragCardToDeck() + { + m_parentClone_Insert.gameObject.SetActive(value: true); + m_darkMask_Insert.gameObject.SetActive(value: false); + m_darkMask_Grab.gameObject.SetActive(value: false); + int num = (m_scene.IsRemainingAddableCardToSelectionArea(m_grabCardData.CardId) ? m_scene.InsertToSelectionArea(m_grabCardData) : (-1)); + _stateEdit.RefreshSelectionArea(isImmediate: false); + _stateEdit.RefreshPage(isImmediate: false); + bool flag = m_scene.SelectionAreaList.FindWithCardId(m_grabCardData.CardId) != null; + if (num >= 0) + { + m_grabCardData = m_scene.SelectionAreaList.FindWithIndex(num); + if (!m_grabCardData.IsNonPossessionCard) + { + UITexture[] componentsInChildren = m_parentClone_Insert.GetComponentsInChildren(); + Shader shader = Resources.Load("Shader/Effect/Additive"); + UITexture[] array = componentsInChildren; + for (int i = 0; i < array.Length; i++) + { + array[i].shader = shader; + } + } + if (m_grabCardData != null) + { + m_grabCardData.CardObj.SetActive(num >= 0 && flag); + } + base.CloseStateName = m_closeStateName_Insert; + _isFlashWhenInsert = true; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_CARD_MOVE_IN); + } + else + { + m_parentClone_Insert.gameObject.SetActive(value: false); + base.CloseStateName = m_closeStateName_Insert; + _isFlashWhenInsert = false; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_CARD_MOVE_IN); + } + } + + private void moveCard() + { + _lastDragArea = _cursorArea; + switch (EditMode) + { + case Mode.OutToIn: + switch (_cursorArea) + { + case Area.InSelectionArea: + AddSelectionSameCard(); + break; + case Area.OutSelectionArea: + m_parentClone_Insert.gameObject.SetActive(value: true); + m_parentClone_Insert.gameObject.transform.position = m_grabCardData.CardObj.transform.position; + m_grabCardData.CardObj.transform.position = m_parentClone_Grab.transform.position; + m_parentClone_Grab.alpha = 0f; + base.CloseStateName = ""; + m_darkMask_Grab.gameObject.SetActive(value: false); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_CARD_MOVE_OUT); + break; + } + break; + case Mode.InToOut: + switch (_cursorArea) + { + case Area.SameCardArea: + AddSelectionSameCard(); + break; + case Area.InSelectionArea: + m_parentClone_Insert.gameObject.SetActive(value: true); + m_parentClone_Insert.gameObject.transform.position = m_grabCardData.CardObj.transform.position; + m_grabCardData.CardObj.transform.position = m_parentClone_Grab.transform.position; + m_parentClone_Grab.alpha = 0f; + base.CloseStateName = ""; + m_darkMask_Grab.gameObject.SetActive(value: false); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_CARD_MOVE_OUT); + break; + case Area.OutSelectionArea: + { + m_darkMask_Grab.gameObject.SetActive(value: false); + int num = m_scene.RemoveFromSelectionArea(m_grabCardData); + _stateEdit.Fit(); + if (num >= 0) + { + m_grabCardData = m_scene.PagingList.FindWithIndex(num); + m_darkMask_Insert.gameObject.SetActive(value: true); + m_parentClone_Insert.gameObject.SetActive(value: true); + } + else + { + m_darkMask_Insert.gameObject.SetActive(value: false); + m_parentClone_Insert.gameObject.SetActive(value: false); + } + _stateEdit.RefreshSelectionArea(isImmediate: false); + _stateEdit.RefreshPage(isImmediate: true); + base.CloseStateName = m_closeStateName_Remove; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_OUT); + break; + } + } + break; + } + m_scene.ChangeState(_stateEdit, skipCloseAnim: false, skipOpenAnim: true); + } + + public override void onUpdateCloseAnim() + { + base.onUpdateCloseAnim(); + if (m_grabCardData != null && m_grabCardData.CardObj != null) + { + m_parentClone_Insert.transform.position = m_grabCardData.CardObj.transform.position; + m_darkMask_Insert.transform.position = m_grabCardData.CardObj.transform.position; + } + _stateEdit.onMove(); + } + + public override void onNotify(int value) + { + base.onNotify(value); + if (_isFlashWhenInsert) + { + if (m_grabCardData != null) + { + m_grabCardData.CardObj.SetActive(value: true); + m_grabCardData.ChangeSelectingState(isSelect: false); + } + if (_lastDragArea != Area.NoSelectionArea) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DECK_IN); + } + } + } + + public CardObject TryGetCard(GameObject cardObj) + { + if (m_scene.IsLoading) + { + return null; + } + CardObject grabCard = null; + switch (EditMode) + { + case Mode.InToOut: + grabCard = m_scene.SelectionAreaList.FindWithObject(cardObj); + if (!grabCard.IsNonPossessionCard) + { + CardObject cardObject = m_scene.SelectionAreaList.CardList.Find((CardObject c) => c.IsNonPossessionCard && c.CardId == grabCard.CardId); + if (cardObject != null) + { + return cardObject; + } + } + return grabCard; + case Mode.OutToIn: + { + grabCard = m_scene.PagingList.FindWithObject(cardObj); + if (grabCard == null) + { + return null; + } + bool flag = !IsDraggableMaintenance && GameMgr.GetIns().GetDataMgr().IsMaintenanceCard(grabCard.CardId); + if (grabCard.IsVisibleSleeve || flag) + { + return null; + } + if (!m_scene.IsRemainingAddableCardToSelectionArea(grabCard.CardId)) + { + if (m_scene.IsEnableSwipeAutoSameBasicCardAdd() && m_scene.IsAddableByBaseCardId(grabCard.CardId, out var _)) + { + return grabCard; + } + return null; + } + return grabCard; + } + default: + return null; + } + } + + private bool IsEnableSameCardAddCollider() + { + if (_myRotationInfo != null && _myRotationFilterType != FilterController.MyRotationFilterType.CARD_POOL_ALL_PACK && !CardMaster.GetInstance(FormatBehaviorManager.GetDefaultBehaviour(Format.MyRotation).CardMasterId).GetCardParameterFromId(m_grabCardData.CardId).IsAvailableFormat(Format.MyRotation, ClassType.None, _myRotationInfo)) + { + return false; + } + if (m_scene.IsRemainingAddableCardToSelectionArea(m_grabCardData.CardId)) + { + return true; + } + if (m_scene.IsEnableSwipeAutoSameBasicCardAdd() && m_scene.IsAddableByBaseCardId(m_grabCardData.CardId, out var _)) + { + return true; + } + return false; + } + + private void CreateCardAddAnimation(CardObject original) + { + DestroyDragCard(); + m_grabCardData = original; + m_grabCardData.ActiveCardInfo(isActive: false); + GameObject gameObject = UnityEngine.Object.Instantiate(m_grabCardData.CardObj); + CardParameter cardParameterFromId = CardMaster.GetInstance(m_scene.FormatBehavior.CardMasterId).GetCardParameterFromId(m_grabCardData.CardId); + CardListTemplate component = gameObject.GetComponent(); + UITexture cardTexture = component._cardTexture; + component.HideNum(); + component.AttachNormalFrame(cardParameterFromId); + if ((bool)cardTexture && (bool)cardTexture.material && (bool)cardTexture.material.mainTexture) + { + Texture mainTexture = cardTexture.material.mainTexture; + cardTexture.material = null; + cardTexture.mainTexture = mainTexture; + } + gameObject.transform.localScale = Vector3.one * 0.6f; + m_grabCardData.ActiveCardInfo(isActive: true); + gameObject.name = "DragCard"; + Vector3 localScale = gameObject.transform.localScale; + gameObject.transform.parent = m_parentClone_Grab.transform; + gameObject.transform.localPosition = Vector3.zero; + gameObject.transform.localScale = localScale; + gameObject.transform.localRotation = Quaternion.identity; + GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject); + CardListTemplate component2 = gameObject2.GetComponent(); + component2.HideNum(); + gameObject2.transform.parent = m_parentClone_Insert.transform; + gameObject2.transform.localPosition = Vector3.zero; + gameObject2.transform.localScale = localScale; + m_parentClone_Insert.gameObject.SetActive(value: true); + m_parentClone_Insert.gameObject.transform.position = original.CardObj.transform.position; + component2.RotationOnlyIconVisible = cardParameterFromId.IsResurgentCard; + m_destroyList = new GameObject[2] { gameObject, gameObject2 }; + Camera camera = UIManager.GetInstance().getCamera(); + Vector3 position = camera.ScreenToWorldPoint(Input.mousePosition); + m_parentClone_Grab.transform.localPosition = camera.transform.InverseTransformPoint(position); + m_parentClone_Grab.alpha = 1f; + base.CloseStateName = m_closeStateName_Insert; + _isFlashWhenInsert = true; + } + + public bool CreateDragCard(CardObject original) + { + DestroyDragCard(); + m_grabCardData = original; + if (original != null && EditMode == Mode.InToOut && IsEnableSameCardAddCollider()) + { + _sameCardAddCollider.gameObject.SetActive(value: true); + Vector3 position = _sameCardAddCollider.transform.position; + position.x = original.CardObj.transform.position.x; + _sameCardAddCollider.transform.position = position; + } + m_grabCardData.ActiveCardInfo(isActive: false); + GameObject gameObject = UnityEngine.Object.Instantiate(m_grabCardData.CardObj); + gameObject.GetComponent(); + TweenScale component = gameObject.GetComponent(); + if ((bool)component) + { + UnityEngine.Object.Destroy(component); + } + CardParameter cardParameterFromId = CardMaster.GetInstance(m_scene.FormatBehavior.CardMasterId).GetCardParameterFromId(m_grabCardData.CardId); + CardListTemplate component2 = gameObject.GetComponent(); + UITexture cardTexture = component2._cardTexture; + component2.HideNum(); + component2.RotationOnlyIconVisible = cardParameterFromId.IsResurgentCard; + component2.AttachNormalShaderRotationOnlyIcon(); + if (m_scene.FormatBehavior.GetPossessionCardNum(m_grabCardData.CardId, isIncludingSpotCard: true) > 0) + { + component2.AttachNormalFrame(cardParameterFromId); + if ((bool)cardTexture && (bool)cardTexture.material && (bool)cardTexture.material.mainTexture) + { + Texture mainTexture = cardTexture.material.mainTexture; + cardTexture.material = null; + cardTexture.mainTexture = mainTexture; + } + } + else + { + component2.AttachGrayShader(); + } + gameObject.transform.localScale = Vector3.one * 0.6f; + m_grabCardData.ActiveCardInfo(isActive: true); + gameObject.name = "DragCard"; + Vector3 localScale = gameObject.transform.localScale; + gameObject.transform.parent = m_parentClone_Grab.transform; + gameObject.transform.localPosition = Vector3.zero; + gameObject.transform.localScale = localScale; + gameObject.transform.localRotation = Quaternion.identity; + GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject); + CardListTemplate component3 = gameObject2.GetComponent(); + component3.HideNum(); + gameObject2.transform.parent = m_parentClone_Insert.transform; + gameObject2.transform.localPosition = Vector3.zero; + gameObject2.transform.localScale = localScale; + m_parentClone_Insert.gameObject.SetActive(value: false); + component3.RotationOnlyIconVisible = cardParameterFromId.IsResurgentCard; + m_destroyList = new GameObject[2] { gameObject, gameObject2 }; + m_darkMask_Grab.transform.position = m_grabCardData.CardObj.transform.position + Vector3.back * 0.01f; + m_darkMask_Grab.transform.localScale = m_grabCardData.CardObj.transform.localScale; + m_darkMask_Grab.gameObject.SetActive(value: true); + m_darkMask_Insert.transform.localScale = m_grabCardData.CardObj.transform.localScale; + m_darkMask_Insert.width = cardTexture.width; + m_darkMask_Insert.height = cardTexture.height; + Camera camera = UIManager.GetInstance().getCamera(); + Vector3 position2 = camera.ScreenToWorldPoint(Input.mousePosition); + m_parentClone_Grab.transform.localPosition = camera.transform.InverseTransformPoint(position2); + m_parentClone_Grab.alpha = 1f; + return true; + } + + public void DestroyDragCard() + { + if (m_grabCardData != null && m_grabCardData.CardObj != null) + { + m_grabCardData.CardObj.SetActive(value: true); + } + m_grabCardData = null; + if (m_destroyList != null) + { + for (int i = 0; i < m_destroyList.Length; i++) + { + UnityEngine.Object.Destroy(m_destroyList[i]); + } + m_destroyList = null; + } + m_darkMask_Insert.gameObject.SetActive(value: false); + m_darkMask_Grab.gameObject.SetActive(value: false); + } + + public void OnChangeSelectionAreaFilter() + { + DestroyDragCard(); + } + + public void DragEmulate(CardObject original, CardObject target) + { + CloneToGrab(original); + StartCoroutine(MoveToTarget(m_parentClone_Grab.transform, target.CardObj.transform)); + } + + public void DropDown(CardObject original) + { + CloneToGrab(original); + Vector3 point = m_parentClone_Grab.transform.position + Vector3.down * 0.5f; + StartCoroutine(MoveToPoint(m_parentClone_Grab.transform, point)); + TweenAlpha.Begin(m_parentClone_Grab.gameObject, 0.15f, 0f); + } + + private void CloneToGrab(CardObject original) + { + Vector3 position = original.CardObj.transform.position; + DestroyDragCard(); + CreateDragCard(original); + m_parentClone_Grab.transform.position = position; + m_parentClone_Grab.transform.localScale = Vector3.one; + m_parentClone_Grab.alpha = 1f; + m_darkMask_Grab.gameObject.SetActive(value: false); + m_darkMask_Insert.gameObject.SetActive(value: false); + m_parentClone_Insert.gameObject.SetActive(value: false); + } + + private IEnumerator MoveToTarget(Transform obj, Transform target) + { + for (float num = Vector3.Distance(target.position, obj.position); num >= 0.05f; num = Vector3.Distance(target.position, obj.position)) + { + obj.position += (target.position - obj.position) * 0.4f; + yield return null; + } + DestroyDragCard(); + } + + private IEnumerator MoveToPoint(Transform obj, Vector3 point) + { + for (float num = Vector3.Distance(point, obj.position); num >= 0.05f; num = Vector3.Distance(point, obj.position)) + { + obj.position += (point - obj.position) * 0.4f; + yield return null; + } + DestroyDragCard(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/CardSelectListUI_State_Edit.cs b/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/CardSelectListUI_State_Edit.cs new file mode 100644 index 0000000..8f4a227 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/CardSelectListUI_State_Edit.cs @@ -0,0 +1,350 @@ +using System; +using System.Collections; +using Cute; +using UnityEngine; + +namespace Wizard.DeckCardEdit; + +[RequireComponent(typeof(CardSelectListUI_Positioning))] +public class CardSelectListUI_State_Edit : MecanimStateBase +{ + private const float PRESS_TIME_TO_DRAGMODE = 0.5f; + + private const float PRESS_POINT_DIST_TO_DRAGMODE = 35f; + + private const float PAGING_OFFSET = 1400f; + + private const float PAGING_SPEED = 0.4f; + + [SerializeField] + private CardSelectListUIBase m_scene; + + [SerializeField] + private CardSelectListUI_State_CardDrag m_stateDragMode; + + [SerializeField] + private UIScrollView m_scrollView; + + private UIPanel _scrollViewPanel; + + private SpringPanel _springPanel; + + [SerializeField] + private UICenterOnChild m_scrollViewCenterOnChild; + + [SerializeField] + private CardSelectListUI_Positioning _selectionAreaCardPositioning; + + [SerializeField] + private CardSelectListUI_Positioning _pagingAreaCardPositioning; + + [SerializeField] + private UIPanel _maskPanel; + + private GameObject _pressObj; + + private float _pressTime; + + private Vector2 _pressPoint = Vector2.zero; + + private Coroutine _pagingCoroutine; + + private bool _requestImmediateMove; + + public bool IsClick { get; private set; } + + private void Start() + { + if (m_scene == null) + { + MonoBehaviour.print("ใ‚ทใƒผใƒณใŒใ‚ปใƒƒใƒˆใ•ใ‚Œใฆใ„ใพใ›ใ‚“"); + } + UIScrollView scrollView = m_scrollView; + scrollView.onDragStarted = (UIScrollView.OnDragNotification)Delegate.Combine(scrollView.onDragStarted, (UIScrollView.OnDragNotification)delegate + { + m_scrollViewCenterOnChild.gameObject.SetActive(value: false); + }); + UIScrollView scrollView2 = m_scrollView; + scrollView2.onMomentumMove = (UIScrollView.OnDragNotification)Delegate.Combine(scrollView2.onMomentumMove, new UIScrollView.OnDragNotification(Fit)); + UIScrollView scrollView3 = m_scrollView; + scrollView3.onStoppedMoving = (UIScrollView.OnDragNotification)Delegate.Combine(scrollView3.onStoppedMoving, new UIScrollView.OnDragNotification(Fit)); + } + + public override void onOpen() + { + base.onOpen(); + RefreshSelectionArea(isImmediate: false); + RefreshPage(isImmediate: false); + m_scrollView.enabled = true; + _maskPanel.clipping = UIDrawCall.Clipping.None; + } + + public override void onClose() + { + base.onClose(); + RefreshSelectionArea(isImmediate: false); + RefreshPage(isImmediate: false); + } + + public void RefreshSelectionArea(bool isImmediate) + { + RefreshBase(m_scene.SelectionAreaList, onPressSelectionAreaCard, delegate(GameObject o) + { + onDoubleClick(o, CardSelectListUI_State_CardDrag.Mode.InToOut); + }, _selectionAreaCardPositioning, isMerge: false, isImmediate); + } + + public void RefreshPage(bool isImmediate) + { + RefreshBase(m_scene.PagingList, onPressPagingCard, delegate(GameObject o) + { + onDoubleClick(o, CardSelectListUI_State_CardDrag.Mode.OutToIn); + }, _pagingAreaCardPositioning, isMerge: false, isImmediate); + } + + private void RefreshBase(CardBundle cardList, UIEventListener.BoolDelegate callback, UIEventListener.VoidDelegate doubleClickCallback, CardSelectListUI_Positioning positioning, bool isMerge, bool isImmediate) + { + int countKind = cardList.CountKind; + GameObject[] array = new GameObject[countKind]; + for (int i = 0; i < countKind; i++) + { + array[i] = cardList.FindWithIndex(i).CardObj; + if (!(array[i] != null)) + { + continue; + } + BoxCollider component = array[i].GetComponent(); + if (!component) + { + component = array[i].AddComponent(); + UIWidget component2 = array[i].GetComponent(); + if ((bool)component2) + { + component.size = component2.localSize; + } + } + UIEventListener uIEventListener = UIEventListener.Get(array[i]); + uIEventListener.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener.onPress, callback); + UIEventListener uIEventListener2 = UIEventListener.Get(array[i]); + uIEventListener2.onPressRight = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener2.onPressRight, callback); + UIEventListener uIEventListener3 = UIEventListener.Get(array[i]); + uIEventListener3.onDoubleClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener3.onDoubleClick, doubleClickCallback); + } + if (isMerge) + { + positioning.Add(array); + } + else + { + positioning.Change(array); + } + if (isImmediate) + { + positioning.Immediate(); + } + } + + public void NextPage(Action onMoved) + { + if (_pagingCoroutine != null) + { + StopCoroutine(_pagingCoroutine); + } + _pagingCoroutine = StartCoroutine(PagingBase(-1f, onMoved)); + } + + public void PrevPage(Action onMoved) + { + if (_pagingCoroutine != null) + { + StopCoroutine(_pagingCoroutine); + } + _pagingCoroutine = StartCoroutine(PagingBase(1f, onMoved)); + } + + private IEnumerator PagingBase(float direction, Action onMoved) + { + Vector3 offset = _pagingAreaCardPositioning.Offset; + offset.x = 1400f * direction; + _pagingAreaCardPositioning.Offset = offset; + _pagingAreaCardPositioning.Speed = 0.4f; + while (_pagingAreaCardPositioning.IsMoving) + { + yield return null; + } + offset.x = 1400f * (0f - direction); + _pagingAreaCardPositioning.Offset = offset; + _pagingAreaCardPositioning.Speed = 1f; + onMoved.Call(); + yield return null; + offset.x = 0f; + _pagingAreaCardPositioning.Offset = offset; + _pagingAreaCardPositioning.Speed = 0.4f; + } + + public void Fit() + { + SetupScrollComponent(); + float num = Mathf.Max(0f, _scrollViewPanel.clipOffset.x); + int a = Mathf.Max(0, m_scene.SelectionAreaList.CountKind - 10); + float breakWidth = _selectionAreaCardPositioning.BreakWidth; + int b = Mathf.RoundToInt(num / breakWidth); + Fit(Mathf.Min(a, b)); + m_scrollView.customMovement = ((m_scene.SelectionAreaList.CountKind > 10) ? Vector2.right : Vector2.zero); + } + + public void CenterOn(int idx) + { + SetupScrollComponent(); + idx -= 5; + int a = Mathf.Max(0, m_scene.SelectionAreaList.CountKind - 10); + int a2 = 0; + Fit(Mathf.Max(a2, Mathf.Min(a, idx))); + } + + private void Fit(int idx) + { + float breakWidth = _selectionAreaCardPositioning.BreakWidth; + _springPanel.target.x = (float)(-idx) * breakWidth; + _springPanel.enabled = true; + } + + public void ResetScroll() + { + SetupScrollComponent(); + m_scrollView.ResetPosition(); + _springPanel.target.x = 0f; + _springPanel.enabled = true; + } + + private void SetupScrollComponent() + { + if (_scrollViewPanel == null) + { + _scrollViewPanel = m_scrollView.GetComponent(); + } + if (_springPanel == null) + { + _springPanel = m_scrollView.GetComponent(); + } + m_scrollViewCenterOnChild.gameObject.SetActive(value: true); + } + + public void RemoveSelectionArea() + { + _selectionAreaCardPositioning.Clear(); + } + + public void RemovePaging() + { + _pagingAreaCardPositioning.Clear(); + } + + private void StartDragState(bool immediate) + { + CardObject cardObject = m_stateDragMode.TryGetCard(_pressObj); + if (cardObject != null) + { + m_scene.HideDetail(); + m_scene.ChangeState(m_stateDragMode, skipCloseAnim: true); + m_stateDragMode.ImmediateMove = immediate; + m_stateDragMode.CreateDragCard(cardObject); + m_scrollView.enabled = false; + m_scrollViewCenterOnChild.gameObject.SetActive(value: true); + IsClick = false; + } + _pressObj = null; + _pressTime = 0f; + } + + public override void onMove() + { + base.onMove(); + if (!_pressObj) + { + return; + } + if (_requestImmediateMove) + { + StartDragState(immediate: true); + _requestImmediateMove = false; + } + else if (Input.GetMouseButton(0)) + { + IsClick = true; + _pressTime += Time.deltaTime; + Vector2 vector = _pressPoint - (Vector2)Input.mousePosition; + vector.Normalize(); + float num = Mathf.Abs(vector.y); + float num2 = Vector2.Distance(_pressPoint, Input.mousePosition); + if (num2 >= 35f && num < 0.8f) + { + _pressObj = null; + _pressTime = 0f; + } + else if (_pressTime >= 0.5f || (num >= 0.8f && num2 >= 35f)) + { + StartDragState(immediate: false); + } + } + else + { + _pressObj = null; + _pressTime = 0f; + } + } + + private void onPressSelectionAreaCard(GameObject obj, bool state) + { + if (!m_scene.IsLoading) + { + bool mouseButton = Input.GetMouseButton(0); + bool flag = !mouseButton && Input.GetMouseButtonDown(1); + if (mouseButton || flag) + { + initPress(obj, CardSelectListUI_State_CardDrag.Mode.InToOut); + _requestImmediateMove = flag; + } + } + } + + private void onPressPagingCard(GameObject obj, bool state) + { + if (!m_scene.IsLoading) + { + bool mouseButton = Input.GetMouseButton(0); + bool flag = !mouseButton && Input.GetMouseButtonDown(1); + if (mouseButton || flag) + { + initPress(obj, CardSelectListUI_State_CardDrag.Mode.OutToIn); + _requestImmediateMove = flag; + } + } + } + + private void initPress(GameObject obj, CardSelectListUI_State_CardDrag.Mode mode) + { + m_stateDragMode.EditMode = mode; + _pressObj = obj; + _pressPoint = Input.mousePosition; + } + + private void onDoubleClick(GameObject obj, CardSelectListUI_State_CardDrag.Mode mode) + { + if (!m_scene.IsLoading) + { + _requestImmediateMove = true; + initPress(obj, mode); + } + } + + public void DragEmulate(CardObject original, CardObject target) + { + m_stateDragMode.DragEmulate(original, target); + } + + public void DropDown(CardObject original) + { + m_stateDragMode.DropDown(original); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/DeckCardEditUI.cs b/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/DeckCardEditUI.cs new file mode 100644 index 0000000..fb11acb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/DeckCardEditUI.cs @@ -0,0 +1,1961 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.Dialog.Setting; + +namespace Wizard.DeckCardEdit; + +public class DeckCardEditUI : CardSelectListUIBase +{ + private class CopyDeckFormation + { + private enum CardType + { + Original, + OriginalNormal, + OriginalPremium, + BaseNormal, + BasePremium, + SameBaseNormal, + SameBasePremium, + PrizeNormal, + PrizePremium + } + + private List _sourceDeckCardList; + + private List _afterDeckCardList; + + private Dictionary _userOwnCardData; + + private IFormatBehavior _formatBehavior; + + public CopyDeckFormation(List sourceDeckCardList, IFormatBehavior formatBehavior) + { + _sourceDeckCardList = sourceDeckCardList; + _afterDeckCardList = new List(40); + _userOwnCardData = formatBehavior.ClonePossessionCardDictionary(isIncludingSpotCard: true); + _formatBehavior = formatBehavior; + } + + public List EditNormal() + { + for (int i = 0; i < _sourceDeckCardList.Count; i++) + { + int num = _sourceDeckCardList[i]; + if (!ConvertCardTypeAndAddCardToDeck(CardType.Original, num) && !ConvertCardTypeAndAddCardToDeck(CardType.OriginalNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.OriginalPremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.SameBaseNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.SameBasePremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.BaseNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.BasePremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.PrizeNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.PrizePremium, num) && CanUseNonPossessionCard) + { + AddNewestCraftableCardToDeck(num); + } + } + return _afterDeckCardList; + } + + public List EditPremium() + { + for (int i = 0; i < _sourceDeckCardList.Count; i++) + { + int num = _sourceDeckCardList[i]; + if (!ConvertCardTypeAndAddCardToDeck(CardType.OriginalPremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.SameBasePremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.BasePremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.PrizePremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.OriginalNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.SameBaseNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.BaseNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.PrizeNormal, num) && CanUseNonPossessionCard) + { + AddNewestCraftableCardToDeck(num); + } + } + return _afterDeckCardList; + } + + public List EditPrize() + { + for (int i = 0; i < _sourceDeckCardList.Count; i++) + { + int num = _sourceDeckCardList[i]; + if (!ConvertCardTypeAndAddCardToDeck(CardType.PrizeNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.PrizePremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.OriginalNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.SameBaseNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.BaseNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.OriginalPremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.BasePremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.SameBasePremium, num) && CanUseNonPossessionCard) + { + AddNewestCraftableCardToDeck(num); + } + } + return _afterDeckCardList; + } + + public List EditPremiumAndPrize() + { + for (int i = 0; i < _sourceDeckCardList.Count; i++) + { + int num = _sourceDeckCardList[i]; + if (!ConvertCardTypeAndAddCardToDeck(CardType.PrizePremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.PrizeNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.OriginalPremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.BasePremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.SameBasePremium, num) && !ConvertCardTypeAndAddCardToDeck(CardType.OriginalNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.SameBaseNormal, num) && !ConvertCardTypeAndAddCardToDeck(CardType.BaseNormal, num) && CanUseNonPossessionCard) + { + AddNewestCraftableCardToDeck(num); + } + } + return _afterDeckCardList; + } + + private bool ConvertCardTypeAndAddCardToDeck(CardType cardType, int originalCardId) + { + CardMaster _cardMaster = CardMaster.GetInstance(_formatBehavior.CardMasterId); + CardParameter cardParameterFromId = _cardMaster.GetCardParameterFromId(originalCardId); + return cardType switch + { + CardType.Original => AddCardToDeck(cardParameterFromId.CardId), + CardType.OriginalNormal => AddCardToDeck(cardParameterFromId.NormalCardId), + CardType.OriginalPremium => AddCardToDeck(cardParameterFromId.FoilCardId), + CardType.BaseNormal => AddCardToDeck(_cardMaster.GetCardParameterFromId(cardParameterFromId.BaseCardId).NormalCardId), + CardType.BasePremium => AddCardToDeck(_cardMaster.GetCardParameterFromId(cardParameterFromId.BaseCardId).FoilCardId), + CardType.SameBaseNormal => (from id in GetSameBaseIdListInUserCard(cardParameterFromId.BaseCardId).Where(delegate(int id) + { + CardParameter cardParameterFromId2 = _cardMaster.GetCardParameterFromId(id); + return !cardParameterFromId2.IsFoil && !cardParameterFromId2.IsPrizeCard; + }) + orderby id descending + select id).ToList().Find(AddCardToDeck) > 0, + CardType.SameBasePremium => (from id in GetSameBaseIdListInUserCard(cardParameterFromId.BaseCardId).Where(delegate(int id) + { + CardParameter cardParameterFromId2 = _cardMaster.GetCardParameterFromId(id); + return cardParameterFromId2.IsFoil && !cardParameterFromId2.IsPrizeCard; + }) + orderby id descending + select id).ToList().Find(AddCardToDeck) > 0, + CardType.PrizeNormal => (from id in GetSameBaseIdListInUserCard(cardParameterFromId.BaseCardId).Where(delegate(int id) + { + CardParameter cardParameterFromId2 = _cardMaster.GetCardParameterFromId(id); + return cardParameterFromId2.IsReprintedCard && !cardParameterFromId2.IsFoil; + }) + orderby id descending + select id).ToList().Find(AddCardToDeck) > 0, + CardType.PrizePremium => (from id in GetSameBaseIdListInUserCard(cardParameterFromId.BaseCardId).Where(delegate(int id) + { + CardParameter cardParameterFromId2 = _cardMaster.GetCardParameterFromId(id); + return cardParameterFromId2.IsReprintedCard && cardParameterFromId2.IsFoil; + }) + orderby id descending + select id).ToList().Find(AddCardToDeck) > 0, + _ => false, + }; + } + + private List GetSameBaseIdListInUserCard(int baseCardId) + { + return _userOwnCardData.Keys.ToList().FindAll(delegate(int id) + { + CardParameter cardParameterFromId = CardMaster.GetInstance(_formatBehavior.CardMasterId).GetCardParameterFromId(id); + return cardParameterFromId.BaseCardId == baseCardId && cardParameterFromId.NormalCardId != baseCardId; + }); + } + + private bool AddCardToDeck(int cardId) + { + if (IsHaveCard(cardId)) + { + _afterDeckCardList.Add(cardId); + _userOwnCardData[cardId]--; + return true; + } + return false; + } + + private void AddNewestCraftableCardToDeck(int cardId) + { + int newestCraftableCardId = GetNewestCraftableCardId(CardMaster.GetInstance(_formatBehavior.CardMasterId).GetCardParameterFromId(cardId).BaseCardId, _formatBehavior); + _afterDeckCardList.Add(newestCraftableCardId); + if (_userOwnCardData.ContainsKey(newestCraftableCardId)) + { + _userOwnCardData[newestCraftableCardId]--; + } + } + + private bool IsHaveCard(int cardId) + { + int value = 0; + _userOwnCardData.TryGetValue(cardId, out value); + return value > 0; + } + } + + private const int DEPTH_RESULT_DIALOG = 100; + + public static string CurrentDeckName = null; + + private static Format EditDeckFormat = Format.Max; + + private static int CurrentDeckId = 1; + + public static DeckData CurrentDeckData = null; + + public static ClassSet ClassSet = null; + + public static MyRotationInfo MyRotationInfo = null; + + private static DeckData CopySrcDeckData = null; + + private static bool IsCopySkinAndSleeve = false; + + private static bool IsCopySubClass = false; + + private static bool IsCreatedByBuilder = false; + + private static bool IsCreateAuto = false; + + private static ConventionDeckList _conventionDeckList = null; + + private static bool CanUseNonPossessionCard = false; + + private DeckGroupListData _deckGroupListData; + + private const string CRAFT_BTN_LEFT_ON = "pilltab_02_left_on"; + + private const string CRAFT_BTN_LEFT_OFF = "pilltab_02_left_off"; + + private const string CRAFT_BTN_RIGHT_ON = "pilltab_02_right_on"; + + private const string CRAFT_BTN_RIGHT_OFF = "pilltab_02_right_off"; + + private const string MY_ROTATION_ALL_PACK_SPRITE = "btn_check_"; + + private const string BUTTON_SPRITE_FOOTER_OFF = "off"; + + private const string BUTTON_SPRITE_FOOTER_ON = "on"; + + private readonly Vector3 MY_ROTATION_FORMAT_ICON_POSITION = new Vector3(45f, -47f, 0f); + + private readonly Vector3 MY_ROTATION_CARD_NUMBER_ICON_POSITION = new Vector3(68f, -62f, -1f); + + private readonly Vector3 MY_ROTATION_CARD_NUMBER_POSITION = new Vector3(24f, 0f, 0f); + + private readonly Vector3 MY_ROTATION_CARD_NUMBER_MAX_POSITION = new Vector3(58f, 0f, 0f); + + private const int MY_ROTATION_CLASS_NAME_WIDTH = 107; + + private const int MY_ROTATION_CLASS_UNDER_LINE_WIDTH = 184; + + private const float BACK_BUTTON_POS_Y = -40.7f; + + [SerializeField] + private DeckBuildShortageCardView _prefabShortageCardView; + + [SerializeField] + private UISprite _formatIcon; + + [SerializeField] + private CostCurveUI m_costCurve; + + [SerializeField] + private UICardList m_deckViewerPrefab; + + private UICardList _deckViewer; + + [SerializeField] + private CardDetailUI m_cardDetailPrefab; + + private CardDetailUI _cardDetail; + + [SerializeField] + private UILabel m_labelDeckName; + + [SerializeField] + private UILabel m_labelClassName; + + [SerializeField] + private UILabel m_labelDeckCardNum; + + private int _deckCardNum; + + [SerializeField] + private UILabel _labelDeckCardMaxNum; + + [SerializeField] + private UILabel m_labelCharCardNum; + + [SerializeField] + private UILabel m_labelSpellCardNum; + + [SerializeField] + private UILabel m_labelFieldCardNum; + + [SerializeField] + private UIButton m_craftOnBtn; + + [SerializeField] + private UIButton m_craftOffBtn; + + [SerializeField] + private UIButton m_saveButton; + + [SerializeField] + private UIButton m_autoCreateButton; + + [SerializeField] + private UIButton m_deckViewerButton; + + [SerializeField] + private RewardBase _rewardBase; + + [SerializeField] + private UIButton _craftShortageCardButton; + + [SerializeField] + private UIButton _swapClassButton; + + [SerializeField] + private GameObject _useSubClassRoot; + + [SerializeField] + private UILabel _useSubClassDeckCardNumLabel; + + [SerializeField] + private UILabel _useSubClassDeckCardNumMaxLabel; + + [SerializeField] + private UISprite _useSubClassMainClassIconSprite; + + [SerializeField] + private UILabel _useSubClassMainClassCardNumLabel; + + [SerializeField] + private UILabel _useSubClassMainClassCardNumMinLabel; + + [SerializeField] + private UISprite _useSubClassSubClassIconSprite; + + [SerializeField] + private UILabel _useSubClassSubClassCardNumLabel; + + [SerializeField] + private UILabel _useSubClassSubClassCardNumMinLabel; + + [SerializeField] + private UISprite _useSubClassFormatIconSprite; + + [SerializeField] + private UIButton _myRotationChangeButton; + + [SerializeField] + private GameObject _myRotationRoot; + + [SerializeField] + private GameObject _myRotationRoot2; + + [SerializeField] + private UIGrid _myRotationAbilityGrid; + + [SerializeField] + private GameObject _myRotationIconOriginal; + + [SerializeField] + private UISprite _myRotationClassIcon; + + [SerializeField] + private ItemToggle _myRotationAllPackVisibleToggle; + + private bool _myRotationAllPackVisible; + + [SerializeField] + private GameObject _cardNumberIcon; + + [SerializeField] + private UISprite _classNameUnderLine; + + [SerializeField] + private UILabel _myRotationPackShortName; + + [SerializeField] + private BoxCollider _allPackVisibleCollider; + + private MyRotationInfo _myRotationInfo; + + private bool _hasChanged; + + private bool _fadeInFinish; + + private IFormatBehavior _formatBehavior; + + private List _shortageIdList = new List(); + + private bool _isEnableSpotCard; + + private bool _enableFitOnChangeDeckCardNumChange = true; + + private List _otherDeckNames = new List(); + + private bool _needsClearSkin; + + private bool _isDefaultDeckName; + + private ConventionInfo ConventionInfo + { + get + { + if (_conventionDeckList != null) + { + return _conventionDeckList.Conventioninfo; + } + return null; + } + } + + private CardBundleController _deckCardBundle + { + get + { + return (CardBundleController)_cardBundle; + } + set + { + _cardBundle = value; + } + } + + private int DeckCardNum + { + get + { + return _deckCardNum; + } + set + { + _deckCardNum = value; + UIManager.SetObjectToGrey(m_saveButton.gameObject, _deckCardNum <= 0); + _deckCardBundle.SelectionAreaList.CountEachType(out var charNum, out var spellNum, out var fieldNum); + m_labelCharCardNum.text = charNum.ToString(); + m_labelSpellCardNum.text = spellNum.ToString(); + m_labelFieldCardNum.text = fieldNum.ToString(); + if (_enableFitOnChangeDeckCardNumChange) + { + _stateEdit.Fit(); + } + this.OnChangeDeckCardNum.Call(value); + } + } + + public bool IsCraftMode => _deckCardBundle.IsCraftMode; + + public bool IsBattleRetry { get; set; } + + public bool IsEditState => m_state == _stateEdit; + + public event Action OnChangeDeckCardNum; + + private DeckData GetDeck(Format format, int deckId) + { + if (_conventionDeckList != null) + { + return _conventionDeckList.DeckList[deckId]; + } + return _deckGroupListData.GetDeckByAttribute(DeckAttributeType.CustomDeck, deckId, format); + } + + public static void SetDeckEditParameter(DeckData deck, ConventionDeckList conventionDeckList, bool canUseNonPossessionCard = true) + { + CurrentDeckName = deck.GetDeckName(); + CurrentDeckId = deck.GetDeckID(); + CurrentDeckData = deck; + EditDeckFormat = deck.Format; + ClassSet = new ClassSet(deck.GetDeckClassID(), deck.GetDeckSubClassID()); + CopySrcDeckData = null; + IsCopySkinAndSleeve = false; + IsCopySubClass = false; + IsCreatedByBuilder = false; + IsCreateAuto = false; + _conventionDeckList = conventionDeckList; + CanUseNonPossessionCard = conventionDeckList == null && canUseNonPossessionCard; + MyRotationInfo = Data.MyRotationAllInfo.Get(deck.MyRotationId); + UIManager.GetInstance().OverrideSceneParam(UIManager.ViewScene.DeckList, new DeckListUIParam(deck.Format, conventionDeckList?.Conventioninfo)); + } + + public static void SetDeckCopyParameter(DeckData deck, bool isCreatedByBuilder, bool isCopySubClass, ConventionDeckList conventionDeckList, MyRotationInfo myRotationInfo = null) + { + CopySrcDeckData = deck; + ClassSet = new ClassSet(deck.GetDeckClassID(), deck.GetDeckSubClassID()); + IsCopySkinAndSleeve = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SLEEVE_AND_SKIN); + IsCopySubClass = isCopySubClass; + IsCreatedByBuilder = isCreatedByBuilder; + _conventionDeckList = conventionDeckList; + CanUseNonPossessionCard = conventionDeckList == null; + if (deck.DeckAttributeType == DeckAttributeType.TrialDeck || deck.DeckAttributeType == DeckAttributeType.SampleDeck) + { + IsCreatedByBuilder = true; + } + if (myRotationInfo == null) + { + MyRotationInfo = Data.MyRotationAllInfo.Get(deck.MyRotationId); + } + else + { + MyRotationInfo = myRotationInfo; + } + } + + public static void SetCreateAutoParameter(Format format, bool canUseNonPossessionCard) + { + IsCreateAuto = true; + CanUseNonPossessionCard = canUseNonPossessionCard; + } + + public static void SetDeckCopyParameterForDeckIntroduction(DeckData emptyDeck, DeckData srcDeck, MyRotationInfo myRotationInfo = null) + { + CurrentDeckName = null; + CurrentDeckId = emptyDeck.GetDeckID(); + CurrentDeckData = emptyDeck; + EditDeckFormat = emptyDeck.Format; + ClassSet = new ClassSet(srcDeck.GetDeckClassID(), srcDeck.GetDeckSubClassID()); + CopySrcDeckData = srcDeck; + IsCopySkinAndSleeve = false; + IsCopySubClass = FormatBehaviorManager.GetDefaultBehaviour(srcDeck.Format).UseSubClass && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS); + IsCreatedByBuilder = true; + IsCreateAuto = false; + _conventionDeckList = null; + CanUseNonPossessionCard = true; + if (EditDeckFormat == Format.MyRotation) + { + if (myRotationInfo == null) + { + MyRotationInfo = Data.MyRotationAllInfo.Get(srcDeck.MyRotationId); + } + else + { + MyRotationInfo = myRotationInfo; + } + } + UIManager.GetInstance().OverrideSceneParam(UIManager.ViewScene.DeckList, new DeckListUIParam(emptyDeck.Format, null)); + } + + public static void SetBuildDeckEditParameter(DeckData buildDeck, string deckName, DeckData emptyDeck) + { + CurrentDeckName = deckName; + CurrentDeckId = emptyDeck.GetDeckID(); + CurrentDeckData = emptyDeck; + ClassSet = new ClassSet(buildDeck.GetDeckClassID(), buildDeck.GetDeckSubClassID()); + EditDeckFormat = emptyDeck.Format; + CopySrcDeckData = buildDeck; + IsCopySkinAndSleeve = false; + IsCopySubClass = FormatBehaviorManager.GetDefaultBehaviour(buildDeck.Format).UseSubClass && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS); + IsCreatedByBuilder = true; + IsCreateAuto = false; + _conventionDeckList = null; + CanUseNonPossessionCard = true; + MyRotationInfo = null; + UIManager.GetInstance().OverrideSceneParam(UIManager.ViewScene.DeckList, new DeckListUIParam(emptyDeck.Format, null)); + } + + public override bool IsEnableSwipeAutoSameBasicCardAdd() + { + return true; + } + + private static MyRotationInfo GetDefaultMyRotationData() + { + return Data.MyRotationAllInfo.MyRotationInfoList[Data.MyRotationAllInfo.MyRotationInfoList.Count - 1]; + } + + public override void onFirstStart() + { + if (!DeckListUI.IsSpecialFormatPeriodError(EditDeckFormat)) + { + if (EditDeckFormat == Format.MyRotation && MyRotationInfo == null) + { + MyRotationInfo = GetDefaultMyRotationData(); + } + if (MyRotationInfo != null) + { + _myRotationInfo = MyRotationInfo; + MyRotationInfo = null; + SetMyRotationData(_myRotationInfo); + } + _deckViewer = UnityEngine.Object.Instantiate(m_deckViewerPrefab); + _deckViewer.transform.parent = base.transform; + _deckViewer.transform.localPosition = Vector3.zero; + _deckViewer.transform.localScale = Vector3.one; + _deckViewer.SetCamera(null); + _deckViewer.SetShareButtonUse(isUse: true); + _deckViewer.gameObject.SetActive(value: false); + TopBar topBar = UIManager.GetInstance().CreateTopBar(base.gameObject, null, UIManager.ViewScene.DeckList, MoneyDraw: false); + InitFormatDependency(); + m_costCurve.Initialize(base.FormatBehavior.CardMasterId); + Transform obj = topBar.BackButton.transform; + Vector3 localPosition = obj.localPosition; + localPosition.y = -40.7f; + obj.localPosition = localPosition; + base.Format = EditDeckFormat; + UIEventListener.Get(m_autoCreateButton.gameObject).onClick = OnClickAutoDeckBtn; + UIEventListener.Get(m_saveButton.gameObject).onClick = OnClickSaveBtn; + UIEventListener.Get(m_craftOnBtn.gameObject).onClick = delegate + { + ChangeCraftMode(isCraft: true); + }; + UIEventListener.Get(m_craftOffBtn.gameObject).onClick = delegate + { + ChangeCraftMode(isCraft: false); + }; + UIEventListener.Get(m_deckViewerButton.gameObject).onClick = delegate + { + ShowDeckViewer(); + }; + UIEventListener.Get(_craftShortageCardButton.gameObject).onClick = OnClickCraftShortageCardButton; + UIEventListener.Get(_swapClassButton.gameObject).onClick = OnClickSwapClassButton; + UIEventListener.Get(_myRotationChangeButton.gameObject).onClick = OnClickMyRotationChangeButton; + _craftShortageCardButton.gameObject.SetActive(CanUseNonPossessionCard); + _swapClassButton.gameObject.SetActive(base.FormatBehavior.UseSubClass); + _isSelectableSpotCard = true; + _isEnableSpotCard = !base.FormatBehavior.IsConventionMode; + _deckCardBundle = new CardBundleController(_parentSelectionObj, m_parentPagingObj, m_sleeveOriginal, m_cardInfoOriginal, _formatBehavior, _isEnableSpotCard, _isEnableSpotCard, _isEnableSpotCard, CanUseNonPossessionCard); + _deckCardBundle.OnCreateDeckSleeve += OnCreateDeckSleeve; + _deckCardBundle.OnCreateDeckCard += OnCreateDeckCard; + _deckCardBundle.OnCreateAutoDeck += OnCreateAutoDeck; + _deckCardBundle.OnInsertDeckCard += OnInsertDeckCard; + _deckCardBundle.OnRemoveDeckCard += OnRemoveDeckCard; + _enableSelectSameKindCardNum = true; + base.onFirstStart(); + DeckListUtility.SaveLastSelectDeck(CurrentDeckId, isDefaultDeck: false, isTrialDeck: false, EditDeckFormat); + if (ConventionInfo == null) + { + UIManager.GetInstance().UpdateFooterMenuTexture(UIManager.ViewScene.DeckCardEdit); + } + CardMaster.CardMasterId cardMasterId = base.FormatBehavior.CardMasterId; + List cardPool = UIManager.GetInstance().getUIBase_CardManager().SortIDList(CardMaster.GetInstance(cardMasterId).GetAllCardIds(), cardMasterId); + FilterController.MyRotationFilterType myRotationFilterType = FilterController.MyRotationFilterType.None; + if (_myRotationInfo != null) + { + myRotationFilterType = base.MyRotationFilterTypeCardPool; + } + _selectCardFilter.InitializeFilterForDeckEdit(cardPool, ClassSet, EditDeckFormat, _myRotationInfo, myRotationFilterType); + _pagingFilter.InitializeFilterForDeckEdit(cardPool, ClassSet, EditDeckFormat, _myRotationInfo, myRotationFilterType); + _stateCardDrag.AddCardForSameCardSwipe = AddCardForSwipe; + _myRotationRoot.SetActive(EditDeckFormat == Format.MyRotation); + _myRotationRoot2.SetActive(EditDeckFormat == Format.MyRotation); + _myRotationIconOriginal.SetActive(value: false); + if (EditDeckFormat == Format.MyRotation) + { + InitializeMyRotation(); + UpdateMyRotationAbilityIcon(); + SetMyRotationRayout(); + } + StartCoroutine(Setup_Coroutine()); + } + } + + private void SetMyRotationRayout() + { + _formatIcon.transform.localPosition = MY_ROTATION_FORMAT_ICON_POSITION; + _cardNumberIcon.transform.localPosition = MY_ROTATION_CARD_NUMBER_ICON_POSITION; + m_labelClassName.width = 107; + m_labelDeckCardNum.transform.localPosition = MY_ROTATION_CARD_NUMBER_POSITION; + _labelDeckCardMaxNum.transform.localPosition = MY_ROTATION_CARD_NUMBER_MAX_POSITION; + _classNameUnderLine.width = 184; + } + + private void InitializeMyRotation() + { + _myRotationClassIcon.spriteName = ClassCharaPrm.GetIconSpriteName(ClassSet.MainClass); + m_labelClassName.enabled = false; + _myRotationPackShortName.text = _myRotationInfo.LastPackText; + } + + private void AddCardForSwipe(int cardNo) + { + _enableFitOnChangeDeckCardNumChange = false; + List list = new List(); + list.Add(cardNo); + _deckCardBundle.CreateDeckAddCard(list); + } + + private IEnumerator Setup_Coroutine() + { + base.IsSetup = true; + yield return null; + _hasChanged = false; + OnChangeSlideEnd = delegate(bool slideEnd) + { + _allPackVisibleCollider.enabled = slideEnd; + }; + _myRotationAllPackVisibleToggle.AddChangeCallback(delegate + { + OnChangeMyRotationAllPackVisible(); + }); + _myRotationAllPackVisibleToggle.SetValidator(ChangeMyRotationAllPackVisibleValidator); + SetupDeckProperty(out var rawSkinId, out var isRandomLeaderSkin, out var leaderSkinIdList, out var sleeveId, out var isNotAvailableCard); + if (EditDeckFormat != Format.Sealed) + { + DeckInfoTask task = new DeckInfoTask(); + task.SetParameter(Format.All); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + _deckGroupListData = task.DeckGroupListData; + List source = ((_conventionDeckList != null) ? new List(_conventionDeckList.DeckIdList.Select((int deckId) => _conventionDeckList.DeckList[deckId])) : _deckGroupListData.GetDeckListByFormat(base.Format)); + _otherDeckNames = (from deck in source + where deck != null + select deck.GetDeckName() into name + where name != CurrentDeckName + select name).ToList(); + })); + while (!task.IsResultSuccess) + { + yield return null; + } + } + SetupConventionView(); + m_craftOnBtn.normalSprite = "pilltab_02_right_off"; + m_craftOffBtn.normalSprite = "pilltab_02_left_on"; + _selectCardFilter.FormatState = EditDeckFormat; + _selectCardFilter.IsAbleFormatFilter = false; + _pagingFilter.FormatState = EditDeckFormat; + UIBase_CardManager.FilterParameter param = new UIBase_CardManager.FilterParameter + { + FixedClassSet = ClassSet + }; + _deckCardBundle.FilterParameter = _pagingFilter.GetFilterParameter(param); + string text = CurrentDeckName; + if (CurrentDeckName == null && CurrentDeckData.IsNoCard()) + { + text = DeckUtil.CreateDefaultDeckName(ClassSet, base.FormatBehavior.UseSubClass, _otherDeckNames, EditDeckFormat, _myRotationInfo); + _isDefaultDeckName = true; + } + _deckCardBundle.Setup(text, CurrentDeckData, ClassSet, rawSkinId, isRandomLeaderSkin, leaderSkinIdList, sleeveId, CopySrcDeckData, EditDeckFormat, _conventionDeckList, _deckGroupListData); + while (!_deckCardBundle.IsReady) + { + yield return null; + } + string sleevePath = sleeveId.ToString(); + Sleeve sleeveData = Data.Master.SleeveMgr.Get(sleeveId); + _resourcePathList = GetResourcePathList(sleevePath, sleeveData); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_resourcePathList, null)); + m_sleeveOriginal.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(sleevePath, ResourcesManager.AssetLoadPathType.SleeveTexture, isfetch: true)); + if (sleeveData.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().SetSleeveTexture(m_sleeveOriginal, sleeveData.sleeve_id); + } + if (base.Format == Format.MyRotation) + { + SetMyRotationData(_myRotationInfo); + } + bool isEffectSetupEnd = false; + SetupEffect(delegate + { + isEffectSetupEnd = true; + }); + while (!isEffectSetupEnd) + { + yield return null; + } + SetupDeckViewerAndText(); + if (_formatBehavior.IsShowFirstTipsAtDeckEdit) + { + UIManager.GetInstance().CheckFirstTips(FirstTips.TipsType.Deck); + } + CountDeckCardNum(); + SetupState(); + SetupSimpleDetail(); + HideDetail(); + HideDeckViewer(); + if (IsCreateAuto) + { + CreateAutoDeck(forceClear: false); + while (IsCreateAuto) + { + yield return null; + } + } + if (IsCreatedByBuilder && _shortageIdList.Count > 0) + { + ShowShortageCardViewer(delegate + { + UIManager.GetInstance().OnReadyViewScene(isFadein: true, OnFinishFadeIn); + }); + } + else + { + UIManager.GetInstance().OnReadyViewScene(isFadein: true, OnFinishFadeIn); + } + while (!_fadeInFinish) + { + yield return null; + } + if (_formatBehavior.IsShowFirstTipsAtDeckEdit) + { + while (FirstTips.IsFirstTipsOpen(FirstTips.TipsType.Deck)) + { + yield return null; + } + } + if (isNotAvailableCard) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetText(Data.SystemText.Get("Card_0188")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + } + } + + private void SetupDeckViewerAndText() + { + m_labelDeckName.text = _deckCardBundle.DeckName; + m_labelClassName.text = GameMgr.GetIns().GetDataMgr().GetClanNameByKey((int)ClassSet.MainClass); + _deckViewer.RemoveData(); + _deckViewer.SetDeckName(_deckCardBundle.DeckName); + _deckViewer.SetClassSet(ClassSet); + _deckViewer.SetFormat(EditDeckFormat, _conventionDeckList); + _redetherNum.text = PlayerStaticData.UserRedEtherCount.ToString(); + } + + private List GetResourcePathList(string sleevePath, Sleeve sleeveData) + { + _resourcePathList = new List(); + _resourcePathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(sleevePath, ResourcesManager.AssetLoadPathType.SleeveTexture)); + if (sleeveData.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref _resourcePathList, sleeveData); + } + _resourcePathList.AddRange(GetEffectAssetPathList()); + return _resourcePathList; + } + + private void SetupDeckProperty(out int rawSkinId, out bool isRandomLeaderSkin, out List leaderSkinIdList, out long sleeveId, out bool isNotAvailableCard) + { + if (CopySrcDeckData != null) + { + _hasChanged = true; + ClassSet = new ClassSet(CopySrcDeckData.GetDeckClassID(), CopySrcDeckData.GetDeckSubClassID()); + if (EditDeckFormat == Format.Crossover && !IsCopySubClass) + { + CopySrcDeckData.ExtractMainClassAndNeutralCards(); + } + List cardIdList = CopySrcDeckData.GetCardIdList(); + if (ConventionInfo != null) + { + CopySrcDeckData.SetCardIdList(AccordDeck(cardIdList)); + } + else if (IsCreatedByBuilder) + { + bool isFoilPreferred = Data.Load.data._userConfig.IsFoilPreferred; + bool isPrizePreferred = Data.Load.data._userConfig.IsPrizePreferred; + if (isFoilPreferred && isPrizePreferred) + { + CopySrcDeckData.SetCardIdList(AccordDeckPremiumAndPrize(cardIdList)); + } + else if (isPrizePreferred) + { + CopySrcDeckData.SetCardIdList(AccordDeckPrize(cardIdList)); + } + else if (isFoilPreferred) + { + CopySrcDeckData.SetCardIdList(AccordDeckPremium(cardIdList)); + } + else + { + CopySrcDeckData.SetCardIdList(AccordDeck(cardIdList)); + } + } + isNotAvailableCard = IsNotAvailableCardInIds(cardIdList, EditDeckFormat, base.FormatBehavior, _myRotationInfo); + rawSkinId = (IsCopySkinAndSleeve ? CopySrcDeckData.GetRawSkinId() : 0); + isRandomLeaderSkin = IsCopySkinAndSleeve && CopySrcDeckData.IsSkinRandom; + bool flag = IsCopySkinAndSleeve && CopySrcDeckData.SelectRandomSkinIdList != null && CopySrcDeckData.SelectRandomSkinIdList.Count > 0; + leaderSkinIdList = (flag ? CopySrcDeckData.SelectRandomSkinIdList : new List { 0 }); + sleeveId = (IsCopySkinAndSleeve ? Toolbox.ResourcesManager.GetExistingSleeveId(CopySrcDeckData.GetDeckSleeveID()) : 3000011); + } + else + { + isNotAvailableCard = false; + rawSkinId = CurrentDeckData.GetRawSkinId(); + isRandomLeaderSkin = CurrentDeckData.IsSkinRandom; + bool flag2 = CurrentDeckData.SelectRandomSkinIdList != null && CurrentDeckData.SelectRandomSkinIdList.Count > 0; + leaderSkinIdList = (flag2 ? CurrentDeckData.SelectRandomSkinIdList : new List { 0 }); + sleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(CurrentDeckData.GetDeckSleeveID()); + } + } + + private void SetupConventionView() + { + if (ConventionInfo != null) + { + m_craftOnBtn.gameObject.SetActive(value: false); + m_craftOffBtn.gameObject.SetActive(value: false); + _redetherNum.transform.parent.gameObject.SetActive(value: false); + } + } + + private void InitFormatDependency() + { + InitializeBase(EditDeckFormat, _conventionDeckList); + _formatBehavior = base.FormatBehavior; + bool isCraftableCardAtDeckEdit = _formatBehavior.IsCraftableCardAtDeckEdit; + UIManager.GetInstance().setBackScene(base.gameObject, _formatBehavior.DeckEditBackScene); + _formatIcon.spriteName = _formatBehavior.SmallIconSpriteName; + m_labelDeckName.gameObject.SetActive(_formatBehavior.IsShowDeckName); + if (!_formatBehavior.IsShowDeckName) + { + UIUtil.AddPositionY(m_labelClassName.transform, 21f); + UIUtil.AddPositionY(_formatIcon.transform, 21f); + UIUtil.AddPositionY(m_labelDeckCardNum.transform.parent, 21f); + UIUtil.AddPositionY(m_labelCharCardNum.transform.parent.parent, 18f); + } + m_autoCreateButton.gameObject.SetActive(_formatBehavior.IsShowAutoDeckCreateButtonAtDeckEdit); + m_craftOnBtn.gameObject.SetActive(isCraftableCardAtDeckEdit); + m_craftOffBtn.gameObject.SetActive(isCraftableCardAtDeckEdit); + _redetherNum.transform.parent.gameObject.SetActive(isCraftableCardAtDeckEdit); + base.IsShowCardDetailCraftPanel = isCraftableCardAtDeckEdit; + _cardDetail = UnityEngine.Object.Instantiate(m_cardDetailPrefab); + _cardDetail.transform.parent = base.transform; + _cardDetail.transform.localPosition = Vector3.zero; + _cardDetail.transform.localScale = Vector3.one; + _cardDetail.gameObject.SetActive(value: false); + _cardDetail.Initialize(_cardDetail.gameObject.layer, base.FormatBehavior.CardMasterId); + _cardDetail.IsShowFlavorTextButton = true; + _cardDetail.IsShowVoiceButton = true; + _cardDetail.IsShowEvolutionButton = true; + _deckViewer.Init(_deckViewer.gameObject, _cardDetail, "", HideDeckViewer, "Detail", in_DetailCameraUse: false, null, _formatBehavior.DeckCardNumMax); + _deckViewer.SubmitDeckType = _formatBehavior.DeckCodeType; + bool flag = _formatBehavior.DeckCardNumMin == _formatBehavior.DeckCardNumMax; + _labelDeckCardMaxNum.gameObject.SetActive(flag); + if (flag) + { + _labelDeckCardMaxNum.text = "/" + _formatBehavior.DeckCardNumMax; + } + InitUseSubClassDisplay(); + } + + public void OnBtnPushSelectCardFilter() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + ShowFilterMenu(_selectCardFilter, Data.SystemText.Get("Card_0126")); + } + + public void OnBtnPushOwnFilter() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + ShowFilterMenu(_pagingFilter, Data.SystemText.Get("Card_0021")); + } + + protected override void OnFinishFadeIn() + { + _fadeInFinish = true; + base.OnFinishFadeIn(); + IsCreatedByBuilder = false; + } + + public static bool IsNotAvailableCardInIds(List cardIds, Format format, IFormatBehavior formatBehavior, MyRotationInfo myRotationInfo) + { + CardMaster master = CardMaster.GetInstance(formatBehavior.CardMasterId); + List source = cardIds.ConvertAll((int id) => master.GetCardParameterFromId(id).BaseCardId); + List list = source.Distinct().ToList(); + for (int num = 0; num < list.Count; num++) + { + CardParameter param = master.GetCardParameterFromId(list[num]); + ClassType classType = ClassUtil.GetClassType(param, format, ClassSet); + if (!param.IsAvailableFormat(format, classType, myRotationInfo)) + { + return true; + } + if (source.Count((int entry) => entry == param.BaseCardId) > param.GetSameKindNumMaxInFormat(format, formatBehavior, classType, myRotationInfo)) + { + return true; + } + } + return false; + } + + public bool LoadDeckCard(List idList) + { + base.IsLoading = true; + HideDetail(); + return _deckCardBundle.LoadDeckCard(idList); + } + + public void ChangeCraftMode(bool isCraft) + { + if (!base.IsLoading && base.CurrentState == _stateEdit) + { + base.IsLoading = true; + m_craftOnBtn.normalSprite = (isCraft ? "pilltab_02_right_on" : "pilltab_02_right_off"); + m_craftOffBtn.normalSprite = (isCraft ? "pilltab_02_left_off" : "pilltab_02_left_on"); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + _deckCardBundle.ChangeCraftMode(isCraft); + } + } + + public void CreateAutoDeck(bool forceClear) + { + _isDisableTouchWhileLoading = true; + base.IsLoading = true; + m_costCurve.Refresh(); + DeckCardNum = 0; + _hasChanged = true; + int tournamentId = 0; + if (ConventionInfo != null && base.FormatBehavior.IsConventionMode) + { + tournamentId = int.Parse(ConventionInfo.Id); + } + _deckCardBundle.CreateAutoDeck(forceClear, tournamentId, _myRotationInfo); + } + + private void RecreateDeckAddCard(List addIdList) + { + _isDisableTouchWhileLoading = true; + base.IsLoading = true; + m_costCurve.Refresh(); + DeckCardNum = 0; + if (CanUseNonPossessionCard) + { + addIdList = new List(); + } + _hasChanged = true; + _deckCardBundle.CreateDeckAddCard(addIdList); + } + + private void RecreateDeckRemoveCard(int removeId) + { + _isDisableTouchWhileLoading = true; + base.IsLoading = true; + m_costCurve.Refresh(); + DeckCardNum = 0; + if (CanUseNonPossessionCard) + { + removeId = -1; + } + _hasChanged = true; + _deckCardBundle.CreateDeckRemoveCard(removeId); + } + + private void SaveDeck() + { + Action deckSaveFunc = _formatBehavior.DeckSaveFunc; + if (deckSaveFunc != null) + { + deckSaveFunc(_deckCardBundle); + return; + } + Action saveCompleteDialogAction = delegate(bool isUsable) + { + Action changeSceneToDeckList = delegate + { + DeckListUI.ChangeSceneToDeckList(EditDeckFormat, null, ConventionInfo); + }; + Action closeAction = delegate(Action changeSceneAction) + { + DeckUpdateTask deckUpdateTask = null; + bool flag = false; + if (ConventionInfo == null) + { + deckUpdateTask = GameMgr.GetIns().GetDeckUpdateTask(); + flag = deckUpdateTask.AchievedInfo._rewards.Count > 0; + } + if (flag) + { + UIManager.GetInstance().createInSceneCenterLoading(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("Story_0029")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.OnClose = changeSceneAction; + RewardBase component = NGUITools.AddChild(dialogBase.gameObject, _rewardBase.gameObject).GetComponent(); + for (int i = 0; i < deckUpdateTask.AchievedInfo._rewards.Count; i++) + { + component.AddReward(deckUpdateTask.AchievedInfo._rewards[i]); + } + component.EndCreate(); + } + else + { + changeSceneAction(); + } + }; + DialogBase saveCompleteDialog = UIManager.GetInstance().CreateDialogClose(); + saveCompleteDialog.OnClose = delegate + { + closeAction(changeSceneToDeckList); + }; + if (IsBattleRetry && isUsable) + { + SystemText systemText = Data.SystemText; + saveCompleteDialog.SetTitleLabel(Data.SystemText.Get("Card_0246")); + saveCompleteDialog.SetText(GetSaveAndRetryDialogText()); + saveCompleteDialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + saveCompleteDialog.SetButtonText(systemText.Get("Card_0247"), systemText.Get("Card_0248")); + saveCompleteDialog.onPushButton1 = delegate + { + saveCompleteDialog.OnClose = delegate + { + closeAction(ChangeSceneToBattle); + }; + }; + } + else + { + saveCompleteDialog.SetTitleLabel(Data.SystemText.Get("Dia_DeckEdit_007_Title")); + saveCompleteDialog.SetText(Data.SystemText.Get("Card_0019")); + saveCompleteDialog.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + } + }; + _deckCardBundle.SaveDeck(null, saveCompleteDialogAction, _needsClearSkin); + } + + private void ChangeSceneToBattle() + { + DataMgr dataManager = GameMgr.GetIns().GetDataMgr(); + DeckInfoTask task = new DeckInfoTask(); + task.SetParameter(Format.All); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + DeckData deckByAttribute = task.DeckGroupListData.GetDeckByAttribute(DeckAttributeType.CustomDeck, _deckCardBundle.DeckId, base.Format); + switch (dataManager.m_BattleType) + { + case DataMgr.BattleType.FreeBattle: + case DataMgr.BattleType.RankBattle: + FreeAndRankMatchDeckSelectConfirmDialog.DecideDeck(deckByAttribute, isBattleEnd: false, notBlack: true, notCollider: true); + break; + case DataMgr.BattleType.Quest: + QuestDeckSelectConfirmDialog.DecideDeck(deckByAttribute, isBattleAgain: false); + break; + } + })); + } + + private string GetSaveAndRetryDialogText() + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + switch (dataMgr.m_BattleType) + { + case DataMgr.BattleType.FreeBattle: + return Data.SystemText.Get("Card_0242"); + case DataMgr.BattleType.RankBattle: + return Data.SystemText.Get("Card_0243"); + case DataMgr.BattleType.Story: + return Data.SystemText.Get("Card_0240"); + case DataMgr.BattleType.Practice: + return Data.SystemText.Get("Card_0241"); + case DataMgr.BattleType.Quest: + if (dataMgr.QuestBattleData.IsMockBattle) + { + return Data.SystemText.Get("Quest_0027"); + } + return Data.SystemText.Get("Card_0249"); + case DataMgr.BattleType.BossRushQuest: + if (!dataMgr.BossRushBattleData.IsMockBattle) + { + return Data.SystemText.Get("Card_0249"); + } + return Data.SystemText.Get("Quest_0027"); + default: + return string.Empty; + } + } + + private string GetRetryDialogText() + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + switch (dataMgr.m_BattleType) + { + case DataMgr.BattleType.FreeBattle: + return Data.SystemText.Get("Card_0238"); + case DataMgr.BattleType.RankBattle: + return Data.SystemText.Get("Card_0239"); + case DataMgr.BattleType.Story: + return Data.SystemText.Get("Card_0236"); + case DataMgr.BattleType.Practice: + return Data.SystemText.Get("Card_0237"); + case DataMgr.BattleType.Quest: + if (dataMgr.QuestBattleData.IsMockBattle) + { + return Data.SystemText.Get("Quest_0028"); + } + return Data.SystemText.Get("Card_0250"); + default: + return string.Empty; + } + } + + public int CountDeckCardNum() + { + DeckCardNum = _deckCardBundle.SelectionAreaList.CountSum; + if (_formatBehavior.UseSubClass) + { + int num = _deckCardBundle.SelectionAreaList.CountClassCard(ClassSet.MainClass); + int num2 = _deckCardBundle.SelectionAreaList.CountClassCard(ClassSet.SubClass); + SetDeckCardNumLabel(_useSubClassDeckCardNumLabel, DeckCardNum, IsDeckCardNumToRed(DeckCardNum)); + SetDeckCardNumLabel(_useSubClassMainClassCardNumLabel, num, isRed: false); + SetDeckCardNumLabel(_useSubClassSubClassCardNumLabel, num2, isRed: false); + } + else + { + SetDeckCardNumLabel(m_labelDeckCardNum, DeckCardNum, IsDeckCardNumToRed(DeckCardNum)); + } + m_costCurve.Refresh(_deckCardBundle.SelectionAreaList.IdList.ToArray()); + return DeckCardNum; + } + + protected override void AccordCardInfo() + { + base.AccordCardInfo(); + CountDeckCardNum(); + _redetherNum.text = PlayerStaticData.UserRedEtherCount.ToString(); + UpdateCraftShortageButton(); + } + + private int GetDeckCardCount() + { + return _deckCardBundle.SelectionAreaList.CountSum; + } + + private int GetMainClassCardCount() + { + return _deckCardBundle.SelectionAreaList.CountClassCard(ClassSet.MainClass); + } + + private int GetSubClassCardCount() + { + return _deckCardBundle.SelectionAreaList.CountClassCard(ClassSet.SubClass); + } + + private void DeckCardNumAnim() + { + DeckCardNum = _deckCardBundle.SelectionAreaList.CountSum; + if (_formatBehavior.UseSubClass) + { + PlayCardNumAnimation(_useSubClassDeckCardNumLabel, IsDeckCardNumToRed(DeckCardNum), GetDeckCardCount); + if (int.TryParse(_useSubClassMainClassCardNumLabel.text, out var result) && _deckCardBundle.SelectionAreaList.CountClassCard(ClassSet.MainClass) != result) + { + PlayCardNumAnimation(_useSubClassMainClassCardNumLabel, isRed: false, GetMainClassCardCount); + } + if (int.TryParse(_useSubClassSubClassCardNumLabel.text, out var result2) && _deckCardBundle.SelectionAreaList.CountClassCard(ClassSet.SubClass) != result2) + { + PlayCardNumAnimation(_useSubClassSubClassCardNumLabel, isRed: false, GetSubClassCardCount); + } + } + else + { + PlayCardNumAnimation(m_labelDeckCardNum, IsDeckCardNumToRed(DeckCardNum), GetDeckCardCount); + } + } + + private void PlayCardNumAnimation(UILabel originLabel, bool isRed, Func latestCardCount) + { + Transform transform = originLabel.transform; + UILabel cloneLabel = UnityEngine.Object.Instantiate(originLabel, transform.position, transform.rotation, transform.parent); + cloneLabel.transform.localScale = transform.localScale; + cloneLabel.depth = originLabel.depth + 1; + cloneLabel.alpha = 0f; + TweenAlpha anim = TweenAlpha.Begin(originLabel.gameObject, 0.2f, 0f); + TweenAlpha.Begin(cloneLabel.gameObject, 0.3f, 1f).onFinished.Add(new EventDelegate(delegate + { + UnityEngine.Object.Destroy(anim); + originLabel.alpha = 1f; + SetDeckCardNumLabel(originLabel, latestCardCount.Call(), isRed); + UnityEngine.Object.Destroy(cloneLabel.gameObject); + })); + SetDeckCardNumLabel(cloneLabel, latestCardCount.Call(), isRed); + } + + private bool IsDeckCardNumToRed(int num) + { + if (!_formatBehavior.IsEmphasizeDeckCardShortage || num >= _formatBehavior.DeckCardNumMin) + { + if (_formatBehavior.IsEmphasizeDeckCardOverage) + { + return num > _formatBehavior.DeckCardNumMax; + } + return false; + } + return true; + } + + private void SetDeckCardNumLabel(UILabel label, int num, bool isRed) + { + label.text = num.ToString(); + label.color = (isRed ? LabelDefine.TEXT_COLOR_RED : LabelDefine.TEXT_COLOR_NORMAL); + } + + private void OnCreateDeckSleeve() + { + _stateEdit.RefreshSelectionArea(isImmediate: false); + } + + private void OnCreateDeckCard() + { + CountDeckCardNum(); + base.IsLoading = false; + _isDisableTouchWhileLoading = false; + _stateEdit.RefreshSelectionArea(isImmediate: true); + UpdateCraftShortageButton(); + _enableFitOnChangeDeckCardNumChange = true; + } + + protected override void OnCreatePagingSleeve() + { + CountDeckCardNum(); + base.OnCreatePagingSleeve(); + } + + private void OnInsertDeckCard(int id) + { + m_costCurve.Add(id, withAnim: true); + _hasChanged = true; + DeckCardNumAnim(); + UpdateCraftShortageButton(); + } + + private void OnRemoveDeckCard(int id) + { + m_costCurve.Sub(id, withAnim: true); + _hasChanged = true; + DeckCardNumAnim(); + UpdateCraftShortageButton(); + } + + private void OnChangeManyDeckCards() + { + _hasChanged = true; + m_costCurve.Refresh(_deckCardBundle.SelectionAreaList.IdList.ToArray()); + DeckCardNumAnim(); + UpdateCraftShortageButton(); + } + + public void SetAllDeckCards(List cardIdList, Action onFirstAnimationFinish = null, float cardRotateDelayTimeMax = float.MaxValue) + { + _deckCardBundle.SetSelectionArea(cardIdList, onFirstAnimationFinish, cardRotateDelayTimeMax); + OnChangeManyDeckCards(); + } + + public void RemoveAllDeckCards() + { + _deckCardBundle.ClearSelectionArea(); + OnChangeManyDeckCards(); + } + + public CardBundle GetDeckCardBundle() + { + return _deckCardBundle.SelectionAreaList; + } + + private void OnClickAutoDeckBtn(GameObject obj) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.AUTO_DECK_CREATE)) + { + DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(Data.SystemText.Get("Card_0266")); + dialogBase.SetPanelDepth(2000); + dialogBase.SetSize(DialogBase.Size.M); + return; + } + bool forceClear = false; + if (EditDeckFormat == Format.Crossover) + { + forceClear = !CanAutoCreateCrossoverDeck(); + } + if (EditDeckFormat == Format.MyRotation) + { + forceClear = NeedMyRotationAutoCreateDeckClear(); + } + bool flag = base.SelectionAreaList.IdList.Count <= _formatBehavior.DeckCardNumMax; + SystemText systemText = Data.SystemText; + DialogBase dialogBase2 = UIManager.GetInstance().CreateDialogClose(); + dialogBase2.SetTitleLabel(systemText.Get("Dia_DeckEdit_010_Title")); + string text = systemText.Get("Card_0294"); + if (EditDeckFormat == Format.MyRotation) + { + text = systemText.Get("MyRotation_ID_07"); + } + dialogBase2.SetText((flag && forceClear) ? text : systemText.Get("Card_0092")); + dialogBase2.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase2.SetButtonText(systemText.Get("Dia_DeckEdit_010_Button")); + dialogBase2.onPushButton1 = delegate + { + HideDetail(); + _stateEdit.RemoveSelectionArea(); + CreateAutoDeck(forceClear); + }; + } + + private void OnCreateAutoDeck() + { + SystemText systemText = Data.SystemText; + _stateEdit.RefreshSelectionArea(isImmediate: true); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Dia_DeckEdit_011_Title")); + dialogBase.SetText(systemText.Get("Card_0082")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + base.IsLoading = false; + IsCreateAuto = false; + } + + private void OnClickSaveBtn(GameObject obj) + { + SaveDeck(); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + } + + private DeckData CreateDeckData() + { + DeckData deckData = new DeckData(EditDeckFormat); + deckData.SetDeckClassID((int)ClassSet.MainClass); + deckData.SetDeckSubClassID((int)ClassSet.SubClass); + if (base.SelectionAreaList.IdList.Count > 0) + { + deckData.SetCardIdList(base.SelectionAreaList.IdList); + } + else + { + deckData.SetEmptyCardIdList(); + } + deckData.SetDeckName(_deckCardBundle.DeckName); + if (_myRotationInfo != null) + { + deckData.MyRotationId = _myRotationInfo.Id; + } + return deckData; + } + + private void ShowDeckViewer() + { + HideDetail(); + _deckViewer.gameObject.SetActive(value: true); + _deckViewer.SetDeck(CreateDeckData(), _conventionDeckList); + if (QRCodeUtility.IsShowQRCode(_deckViewer, _formatBehavior, base.Format)) + { + _deckViewer.SetQRSmallTexture(); + } + else if (_formatBehavior.CanShowQRCode) + { + _deckViewer.SetQRCodeButtonToGray(); + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + } + + private void HideDeckViewer() + { + _deckViewer.RemoveData(); + _deckViewer.gameObject.SetActive(value: false); + } + + private void OnClickCraftShortageCardButton(GameObject obj) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + if (!CanUseNonPossessionCard || base.IsLoading) + { + return; + } + _shortageIdList = new List(); + CardMaster instance = CardMaster.GetInstance(base.FormatBehavior.CardMasterId); + foreach (CardObject card in base.SelectionAreaList.CardList) + { + if (card.IsNonPossessionCard) + { + CardParameter cardParameterFromId = instance.GetCardParameterFromId(card.CardId); + if (cardParameterFromId.IsAvailableFormat(classType: ClassUtil.GetClassType(cardParameterFromId, base.Format, ClassSet), inFormat: base.Format, myRotationInfo: _myRotationInfo)) + { + _shortageIdList.AddRange(Enumerable.Repeat(card.CardId, card.MainCardNum)); + } + } + } + if (_shortageIdList.Count != 0) + { + HideDetail(); + ShowShortageCardViewer(null); + } + } + + private void UpdateCraftShortageButton() + { + CardMaster cardMaster = CardMaster.GetInstance(base.FormatBehavior.CardMasterId); + UIManager.SetObjectToGrey(_craftShortageCardButton.gameObject, !base.SelectionAreaList.CardList.Any(delegate(CardObject c) + { + if (c.IsNonPossessionCard) + { + CardParameter cardParameterFromId = cardMaster.GetCardParameterFromId(c.CardId); + return cardParameterFromId.IsAvailableFormat(classType: ClassUtil.GetClassType(cardParameterFromId, base.Format, ClassSet), inFormat: base.Format, myRotationInfo: _myRotationInfo); + } + return false; + })); + } + + private void ShowShortageCardViewer(Action callback) + { + UIManager.GetInstance().MyPageUICameraObj.SetActive(value: true); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.gameObject.layer = LayerMask.NameToLayer("MyPage"); + dialogBase.SetBackViewLayer(LayerMask.NameToLayer("MyPage")); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_DeckEdit_014_Title")); + dialogBase.SetPanelDepth(100); + dialogBase.OpenSe = Se.TYPE.NONE; + DeckBuildShortageCardView _shortageCardView = UnityEngine.Object.Instantiate(_prefabShortageCardView); + dialogBase.SetObj(_shortageCardView.gameObject); + dialogBase.OnCloseStart = CloseShortageCardViewer; + UIManager.GetInstance().AttachAtlas(_shortageCardView.gameObject); + _cardDetail.IsShortageUI = true; + _cardDetail.IsOwnCardNum = true; + _cardDetail.IsShowCraftButtons = true; + _cardDetail.OnCardBuy = delegate + { + int cardId = _cardDetail.CardData.CardId; + if (_shortageIdList.Contains(cardId)) + { + RecreateDeckAddCard(new List { cardId }); + _shortageCardView.RemoveCardNum(cardId, 1); + _shortageIdList.Remove(cardId); + } + AccordCardInfo(); + _deckCardBundle.InvalidateFilteredIdListCache(); + FetchPagingCard(); + _shortageCardView.UpdateExplainText(); + }; + _cardDetail.OnCardSellId = delegate(int id) + { + RecreateDeckRemoveCard(id); + _shortageCardView.AddCardNum(id, 1); + _shortageIdList.Add(id); + AccordCardInfo(); + _deckCardBundle.InvalidateFilteredIdListCache(); + FetchPagingCard(); + _shortageCardView.UpdateExplainText(); + }; + _shortageCardView.Init(_shortageIdList, _cardDetail, dialogBase, callback, OnCraftShortageCard, base.FormatBehavior.CardMasterId, DeactivateMyPageCamera); + } + + private void OnCraftShortageCard() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + SystemText systemText = Data.SystemText; + dialogBase.SetTitleLabel(systemText.Get("Dia_DeckEdit_015_Title")); + dialogBase.SetText(systemText.Get("Dia_DeckEdit_015_Body")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + List addIdList = _shortageIdList.FindAll(delegate(int id) + { + if (GameMgr.GetIns().GetDataMgr().IsMaintenanceCard(id)) + { + return false; + } + return !CardMaster.GetInstance(base.FormatBehavior.CardMasterId).GetCardParameterFromId(id).IsNotCraftDestruct; + }); + RecreateDeckAddCard(addIdList); + _deckCardBundle.InvalidateFilteredIdListCache(); + FetchPagingCard(); + _redetherNum.text = PlayerStaticData.UserRedEtherCount.ToString(); + } + + private void CloseShortageCardViewer() + { + _cardDetail.IsShortageUI = false; + _cardDetail.IsOwnCardNum = false; + _cardDetail.IsShowCraftButtons = false; + _cardDetail.OnCardBuy = null; + _cardDetail.OnCardSellId = null; + } + + protected override void OnLiquefy(int cardId) + { + ReplaceLiquefiedCardInSelectionArea(cardId); + base.OnLiquefy(cardId); + } + + private void ReplaceLiquefiedCardInSelectionArea(int cardId) + { + List idList = base.SelectionAreaList.IdList; + if (!idList.Contains(cardId) || idList.Count((int id) => id == cardId) <= base.FormatBehavior.GetPossessionCardNum(cardId, _isEnableSpotCard)) + { + return; + } + CardMaster instance = CardMaster.GetInstance(base.FormatBehavior.CardMasterId); + CardParameter cardParameterFromId = instance.GetCardParameterFromId(cardId); + int normalCardId = cardParameterFromId.NormalCardId; + int baseCardId = cardParameterFromId.BaseCardId; + IEnumerable enumerable = from c in instance.GetAllParameters() + where c.BaseCardId == baseCardId && !c.IsFoil && c.CardId != normalCardId && c.CardId != baseCardId + select c; + IOrderedEnumerable orderedEnumerable = from c in enumerable + where c.IsPrizeCard + orderby c.CardId descending + select c; + IOrderedEnumerable source = from c in enumerable.Except(orderedEnumerable) + orderby cardId descending + select c; + CardParameter cardParameterFromId2 = instance.GetCardParameterFromId(baseCardId); + List list = new List(); + if (Data.Load.data._userConfig.IsFoilPreferred) + { + list.Add(cardParameterFromId.FoilCardId); + list.AddRange(source.Select((CardParameter c) => c.FoilCardId)); + list.Add(cardParameterFromId2.FoilCardId); + list.AddRange(orderedEnumerable.Select((CardParameter c) => c.FoilCardId)); + list.Add(cardParameterFromId.NormalCardId); + list.AddRange(source.Select((CardParameter c) => c.NormalCardId)); + list.Add(cardParameterFromId2.NormalCardId); + list.AddRange(orderedEnumerable.Select((CardParameter c) => c.NormalCardId)); + } + else + { + list.Add(cardParameterFromId.NormalCardId); + list.Add(cardParameterFromId.FoilCardId); + list.AddRange(source.Select((CardParameter c) => c.NormalCardId)); + list.AddRange(source.Select((CardParameter c) => c.FoilCardId)); + list.Add(cardParameterFromId2.NormalCardId); + list.Add(cardParameterFromId2.FoilCardId); + list.AddRange(orderedEnumerable.Select((CardParameter c) => c.NormalCardId)); + list.AddRange(orderedEnumerable.Select((CardParameter c) => c.FoilCardId)); + } + int num = -1; + foreach (int replaceCardIdChoice in list) + { + CardParameter cardParameterFromId3 = instance.GetCardParameterFromId(replaceCardIdChoice); + if (cardParameterFromId3.IsAvailableFormat(classType: ClassUtil.GetClassType(cardParameterFromId3, base.Format, ClassSet), inFormat: base.Format, myRotationInfo: _myRotationInfo) && idList.Count((int id) => id == replaceCardIdChoice) < base.FormatBehavior.GetPossessionCardNum(replaceCardIdChoice, _isEnableSpotCard)) + { + num = replaceCardIdChoice; + break; + } + } + if (CanUseNonPossessionCard && num == -1) + { + num = GetNewestCraftableCardId(cardParameterFromId.BaseCardId, _formatBehavior); + } + idList.Remove(cardId); + if (num != -1) + { + idList.Add(num); + } + _deckCardBundle.ReloadDeckCard(idList); + } + + private void DeactivateMyPageCamera() + { + UIManager.GetInstance().MyPageUICameraObj.SetActive(value: false); + } + + public override bool IsGetOutOfScene(Action backupExec) + { + if (_deckViewer.isActiveAndEnabled) + { + HideDeckViewer(); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL); + return false; + } + if (_hasChanged && DeckCardNum > 0) + { + AskForSave(backupExec); + return false; + } + if (IsBattleRetry && !_hasChanged && GetDeck(base.Format, _deckCardBundle.DeckId).IsUsable()) + { + AskForBattleRetry(backupExec); + return false; + } + return base.IsGetOutOfScene(backupExec); + } + + private void AskForBattleRetry(Action onCloseDialog) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Card_0246")); + dialogBase.SetText(GetRetryDialogText()); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("Card_0247"), systemText.Get("Card_0248")); + dialogBase.onPushButton1 = ChangeSceneToBattle; + dialogBase.onPushButton2 = onCloseDialog; + dialogBase.onCloseWithoutSelect = onCloseDialog; + } + + public void AskForSave(Action onCloseDialog) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Dia_DeckEdit_012_Title")); + dialogBase.SetText(systemText.Get("Card_0087")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("Dia_DeckEdit_012_Button"), systemText.Get("Dia_DeckEdit_012_Button_2")); + dialogBase.onPushButton1 = SaveDeck; + dialogBase.onPushButton2 = onCloseDialog; + } + + private List AccordDeck(List copyDeckCardList) + { + List list = new CopyDeckFormation(copyDeckCardList, _formatBehavior).EditNormal(); + if (CanUseNonPossessionCard || list.Count < copyDeckCardList.Count) + { + AddShortageCardList(copyDeckCardList); + } + return list; + } + + private List AccordDeckPrize(List deckCardList) + { + List list = new CopyDeckFormation(deckCardList, _formatBehavior).EditPrize(); + if (CanUseNonPossessionCard || list.Count < deckCardList.Count) + { + AddShortageCardList(deckCardList); + } + return list; + } + + private List AccordDeckPremiumAndPrize(List deckCardList) + { + List list = new CopyDeckFormation(deckCardList, _formatBehavior).EditPremiumAndPrize(); + if (CanUseNonPossessionCard || list.Count < deckCardList.Count) + { + AddShortageCardList(deckCardList); + } + return list; + } + + private List AccordDeckPremium(List deckCardList) + { + List list = new CopyDeckFormation(deckCardList, _formatBehavior).EditPremium(); + if (CanUseNonPossessionCard || list.Count < deckCardList.Count) + { + AddShortageCardList(deckCardList); + } + return list; + } + + public static List GetShortageCardList(List deckCardList, Format format, IFormatBehavior formatBehavior, MyRotationInfo myRotationInfo) + { + List list = new List(); + List source = deckCardList.ConvertAll((int id) => CardMaster.GetInstance(formatBehavior.CardMasterId).GetCardParameterFromId(id).BaseCardId); + List needBaseIdList = source.Distinct().ToList(); + Dictionary possessionBaseCardDictionary = GameMgr.GetIns().GetDataMgr().GetPossessionBaseCardDictionary(isIncludingSpotCard: true, formatBehavior.CardMasterId); + int i; + for (i = 0; i < needBaseIdList.Count; i++) + { + CardParameter cardParameterFromId = CardMaster.GetInstance(formatBehavior.CardMasterId).GetCardParameterFromId(needBaseIdList[i]); + ClassType classType = ClassUtil.GetClassType(cardParameterFromId, format, ClassSet); + if (!cardParameterFromId.IsAvailableFormat(format, classType, myRotationInfo)) + { + continue; + } + int sameKindNumMaxInFormat = cardParameterFromId.GetSameKindNumMaxInFormat(format, formatBehavior, classType, myRotationInfo); + int num = source.Count((int id) => id == needBaseIdList[i]); + int value = 0; + possessionBaseCardDictionary.TryGetValue(needBaseIdList[i], out value); + int num2 = num - value; + if (num > sameKindNumMaxInFormat) + { + num2 -= num - sameKindNumMaxInFormat; + } + num2 = Mathf.Max(0, num2); + if (num2 > 0) + { + int newestCraftableCardId = GetNewestCraftableCardId(cardParameterFromId.BaseCardId, formatBehavior); + for (int num3 = 0; num3 < num2; num3++) + { + list.Add(newestCraftableCardId); + } + } + } + return list; + } + + public static int GetNewestCraftableCardId(int baseCardId, IFormatBehavior formatBehavior) + { + CardMaster instance = CardMaster.GetInstance(formatBehavior.CardMasterId); + List sameCardListByBaseCardId = instance.GetSameCardListByBaseCardId(baseCardId); + int num = baseCardId; + foreach (int item in sameCardListByBaseCardId) + { + CardParameter cardParameterFromId = instance.GetCardParameterFromId(item); + if (cardParameterFromId.CanCraft && cardParameterFromId.CardId > num) + { + num = cardParameterFromId.CardId; + } + } + return num; + } + + private void AddShortageCardList(List deckCardList) + { + _shortageIdList.AddRange(GetShortageCardList(deckCardList, EditDeckFormat, base.FormatBehavior, _myRotationInfo)); + } + + public static bool IsSelectableNonPossessionCard(CardParameter cardParameter) + { + if (!cardParameter.IsFoil && !cardParameter.IsPrizeCard) + { + return cardParameter.CanCraft; + } + return false; + } + + public static void SendConfigUpdateFoilPreferred(bool isFoilPreferred) + { + ConfigUpdateFoilPreferredTask configUpdateFoilPreferredTask = new ConfigUpdateFoilPreferredTask(); + configUpdateFoilPreferredTask.SetParameter(isFoilPreferred); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(configUpdateFoilPreferredTask, delegate + { + Data.Load.data._userConfig.IsFoilPreferred = isFoilPreferred; + })); + } + + public static void SendConfigUpdatePrizePreferred(bool isPrizePreferred) + { + ConfigUpdatePrizePreferredTask configUpdatePrizePreferredTask = new ConfigUpdatePrizePreferredTask(); + configUpdatePrizePreferredTask.SetParameter(isPrizePreferred); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(configUpdatePrizePreferredTask, delegate + { + Data.Load.data._userConfig.IsPrizePreferred = isPrizePreferred; + })); + } + + protected override int GetSameKindNumMaxInFormat(int cardId) + { + CardParameter cardParameterFromId = CardMaster.GetInstance(base.FormatBehavior.CardMasterId).GetCardParameterFromId(cardId); + return cardParameterFromId.GetSameKindNumMaxInFormat(classType: ClassUtil.GetClassType(cardParameterFromId, base.Format, ClassSet), inFormat: base.Format, behavior: base.FormatBehavior, myRotationInfo: _myRotationInfo); + } + + private void OnClickSwapClassButton(GameObject obj) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Card_0274")); + dialogBase.SetText(Data.SystemText.Get("Card_0275")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(Data.SystemText.Get("Card_0276")); + dialogBase.onPushButton1 = delegate + { + StartCoroutine(SwapClass()); + }; + } + + private void OnClickMyRotationChangeButton(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + MyRotationPeriodSelectDialog.Create(_myRotationInfo, ClassSet.MainClass, delegate(MyRotationInfo selectData) + { + if (_myRotationInfo.Id != selectData.Id) + { + UpdateMyRotationInfo(selectData, isChangeAllCardView: false); + } + }); + } + + private void UpdateMyRotationInfo(MyRotationInfo info, bool isChangeAllCardView) + { + bool num = _myRotationInfo.Id != info.Id || isChangeAllCardView; + _selectCardFilter.SetMyRotationData(info, FilterController.MyRotationFilterType.DECK, base.MyRotationFilterTypeCardPool == FilterController.MyRotationFilterType.CARD_POOL_ALL_PACK); + _pagingFilter.SetMyRotationData(info, base.MyRotationFilterTypeCardPool, isAllBackVisible: false); + _myRotationInfo = info; + SetMyRotationData(info); + _myRotationPackShortName.text = _myRotationInfo.LastPackText; + UpdateCardDisplay(); + if (num) + { + _selectCardFilter.Reset(isEnableValidateCall: false); + _pagingFilter.Reset(isEnableValidateCall: false); + } + OnValidateSelectionAreaFilter(); + OnValidatePagingFilter(); + if (_isDefaultDeckName) + { + _deckCardBundle.DeckName = DeckUtil.CreateDefaultDeckName(ClassSet, useSubClass: false, _otherDeckNames, EditDeckFormat, _myRotationInfo); + } + CardMaster.CardMasterId cardMasterId = base.FormatBehavior.CardMasterId; + List cardPool = UIManager.GetInstance().getUIBase_CardManager().SortIDList(CardMaster.GetInstance(cardMasterId).GetAllCardIds(), cardMasterId); + _selectCardFilter.UpdateTypeFilterForDeckEdit(cardPool, ClassSet, EditDeckFormat, _myRotationInfo, base.MyRotationFilterTypeCardPool); + _pagingFilter.UpdateTypeFilterForDeckEdit(cardPool, ClassSet, EditDeckFormat, _myRotationInfo, base.MyRotationFilterTypeCardPool); + m_labelClassName.text = DeckData.CreateMyRotationClassName((int)ClassSet.MainClass, _myRotationInfo); + _deckCardBundle.OnCreatePagingCard += UpdateCardDisplay; + SetupDeckViewerAndText(); + UpdateMyRotationAbilityIcon(); + } + + private void UpdateMyRotationAbilityIcon() + { + _myRotationAbilityGrid.transform.DestroyChildren(); + foreach (MyRotationInfo.MyRotationBonus ability in _myRotationInfo.Abilities) + { + GameObject obj = NGUITools.AddChild(_myRotationAbilityGrid.gameObject, _myRotationIconOriginal); + obj.GetComponent().spriteName = ability.IconName; + obj.gameObject.SetActive(value: true); + } + _myRotationAbilityGrid.Reposition(); + } + + private void UpdateCardDisplay() + { + _deckCardBundle.UpdateCardDisplay(); + _deckCardBundle.OnCreatePagingCard -= UpdateCardDisplay; + UpdateCraftShortageButton(); + } + + private IEnumerator SwapClass() + { + bool isDefaultDeckName = DeckUtil.IsDefaultDeckName(ClassSet, base.FormatBehavior.UseSubClass, _deckCardBundle.DeckName, EditDeckFormat, _myRotationInfo); + ClassSet.Swap(); + _needsClearSkin = !_needsClearSkin; + InitUseSubClassDisplay(); + OnValidateSelectionAreaFilter(); + OnValidatePagingFilter(); + while (base.IsLoading) + { + yield return null; + } + _deckCardBundle.UpdateCardDisplay(); + if (isDefaultDeckName) + { + string text = DeckUtil.CreateDefaultDeckName(ClassSet, base.FormatBehavior.UseSubClass, _otherDeckNames, EditDeckFormat, _myRotationInfo); + if (CurrentDeckName != null) + { + CurrentDeckName = text; + } + _deckCardBundle.DeckName = text; + SetupDeckViewerAndText(); + } + } + + private void InitUseSubClassDisplay() + { + if (!_formatBehavior.UseSubClass) + { + _useSubClassRoot.SetActive(value: false); + return; + } + m_labelClassName.transform.gameObject.SetActive(value: false); + _formatIcon.transform.gameObject.SetActive(value: false); + m_labelDeckCardNum.transform.parent.gameObject.SetActive(value: false); + _useSubClassRoot.SetActive(value: true); + _useSubClassMainClassIconSprite.spriteName = ClassCharaPrm.GetIconSpriteName(ClassSet.MainClass); + _useSubClassSubClassIconSprite.spriteName = ClassCharaPrm.GetIconSpriteName(ClassSet.SubClass); + _useSubClassDeckCardNumMaxLabel.text = _labelDeckCardMaxNum.text; + _useSubClassMainClassCardNumMinLabel.text = "/" + 24; + _useSubClassSubClassCardNumMinLabel.text = "/" + 9; + _useSubClassFormatIconSprite.spriteName = _formatBehavior.SmallIconSpriteName; + } + + private bool NeedMyRotationAutoCreateDeckClear() + { + CardMaster instance = CardMaster.GetInstance(_formatBehavior.CardMasterId); + foreach (int id in base.SelectionAreaList.IdList) + { + if (!instance.GetCardParameterFromId(id).IsAvailableFormat(Format.MyRotation, ClassType.None, _myRotationInfo)) + { + return true; + } + } + return false; + } + + private bool CanAutoCreateCrossoverDeck() + { + List source = _deckCardBundle.FindAllAvailableCardInFormat(base.SelectionAreaList.IdList, base.Format, null); + CardMaster cardMaster = CardMaster.GetInstance(_formatBehavior.CardMasterId); + int num = source.Count((int cardId) => cardMaster.GetCardParameterFromId(cardId).Clan == ClassSet.MainClass); + int num2 = source.Count((int cardId) => cardMaster.GetCardParameterFromId(cardId).Clan == ClassSet.SubClass); + int num3 = source.Count((int cardId) => cardMaster.GetCardParameterFromId(cardId).Clan == CardBasePrm.ClanType.ALL); + if (num + num3 <= Crossover.AUTO_CREATE_MAIN_AND_NEUTRAL_MAX && num2 + num3 <= Crossover.AUTO_CREATE_SUB_AND_NEUTRAL_MAX && num3 <= 7) + { + return true; + } + return false; + } + + private bool ChangeMyRotationAllPackVisibleValidator(bool newCheck) + { + if (!base.IsLoading && base.CurrentState == _stateEdit) + { + return true; + } + return false; + } + + private void OnChangeMyRotationAllPackVisible() + { + _myRotationAllPackVisible = !_myRotationAllPackVisible; + base.MyRotationFilterTypeCardPool = (_myRotationAllPackVisible ? FilterController.MyRotationFilterType.CARD_POOL_ALL_PACK : FilterController.MyRotationFilterType.CARD_POOL_SELECT_ONLY); + UpdateMyRotationInfo(_myRotationInfo, isChangeAllCardView: true); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/DeckSave.cs b/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/DeckSave.cs new file mode 100644 index 0000000..471144c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.DeckCardEdit/DeckSave.cs @@ -0,0 +1,278 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.ErrorDialog; + +namespace Wizard.DeckCardEdit; + +public class DeckSave +{ + public class DeckSaveCoroutineMonoBehaviour : MonoBehaviour + { + private DeckSaveCoroutineMonoBehaviour() + { + } + } + + public class Option + { + public int[] CardIds; + + public int DeckId; + + public string DeckName; + + public int ClassType; + + public int SubClassType; + + public int RawSkinId; + + public bool IsRandomLeaderSkin; + + public List LeaderSkinIdList; + + public long SleeveId; + + public bool IsNew; + + public Format Format; + + public string MyRotationId; + + public ConventionDeckList ConventionDeckList; + + public Action OnFinish; + + public Action OnSaveCompleteDialog; + } + + private Action _onFinish; + + private int[] _deck; + + private int _id; + + private string _name; + + private string _defaultName; + + private int _class; + + private int _rawSkinId; + + private bool _isRandomLeaderSkin; + + private List _leaderSkinIdList; + + private long _sleeveId; + + private Format _format; + + private ConventionDeckList _conventionDeckList; + + private bool _isNew; + + private string _myRotationId; + + private int _subClass; + + private MonoBehaviour _behaviour; + + private DialogBase _nameEditDialog; + + private IFormatBehavior _formatBehavior; + + private Action _saveCompleteDialogOverrideAction; + + private bool _isUsableDeck; + + public void Destroy() + { + if ((bool)_behaviour) + { + UnityEngine.Object.Destroy(_behaviour.gameObject); + } + } + + public void Start(Option option) + { + IFormatBehavior formatBehavior = FormatBehaviorManager.Create(option.Format, option.ConventionDeckList); + _deck = option.CardIds; + _name = option.DeckName; + _defaultName = option.DeckName; + _id = option.DeckId; + _format = option.Format; + _isNew = option.IsNew; + _class = option.ClassType; + _subClass = option.SubClassType; + _rawSkinId = option.RawSkinId; + _isRandomLeaderSkin = option.IsRandomLeaderSkin; + _leaderSkinIdList = option.LeaderSkinIdList; + _sleeveId = option.SleeveId; + _conventionDeckList = option.ConventionDeckList; + _myRotationId = option.MyRotationId; + _onFinish = option.OnFinish; + _saveCompleteDialogOverrideAction = option.OnSaveCompleteDialog; + MyRotationInfo myRotationInfo = null; + if (!string.IsNullOrEmpty(_myRotationId)) + { + myRotationInfo = Data.MyRotationAllInfo.Get(_myRotationId); + } + _formatBehavior = formatBehavior; + if (_deck.Length < 40) + { + CreateSaveConfirmDialog(Data.SystemText.Get("Card_0050", 40.ToString())); + return; + } + if (_deck.Length > 50) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_DeckEdit_006_Title")); + dialogBase.SetText(Data.SystemText.Get("Card_0107", 40.ToString())); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.OnCloseStart = Destroy; + return; + } + if (_deck.Length > 40) + { + CreateSaveConfirmDialog(Data.SystemText.Get("Card_0138", 41.ToString())); + return; + } + if (_format == Format.Crossover) + { + CardMaster cardMaster = CardMaster.GetInstance(formatBehavior.CardMasterId); + List source = _deck.ToList(); + CardBasePrm.ClanType mainClass = (CardBasePrm.ClanType)_class; + if (source.Count((int cardId) => cardMaster.GetCardParameterFromId(cardId).Clan == mainClass) < 24) + { + CreateSaveConfirmDialog(Data.SystemText.Get("Card_0279", 24.ToString())); + return; + } + CardBasePrm.ClanType subClass = (CardBasePrm.ClanType)_subClass; + if (source.Count((int cardId) => cardMaster.GetCardParameterFromId(cardId).Clan == subClass) < 9) + { + CreateSaveConfirmDialog(Data.SystemText.Get("Card_0280", 9.ToString())); + return; + } + } + if (DeckCardEditUI.IsNotAvailableCardInIds(new List(_deck), _format, formatBehavior, myRotationInfo)) + { + CreateSaveConfirmDialog(Data.SystemText.Get("Card_0191")); + return; + } + if (DeckData.ContainsNonPossessionCard(_deck, formatBehavior)) + { + CreateSaveConfirmDialog(Data.SystemText.Get("Card_0252")); + return; + } + _isUsableDeck = true; + CheckNewDeckBeforeSave(); + } + + private void CreateSaveConfirmDialog(string messageText) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_DeckEdit_005_Title")); + dialogBase.SetText(messageText); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(Data.SystemText.Get("Dia_DeckEdit_005_Button"), Data.SystemText.Get("Dia_DeckEdit_005_Button_2")); + dialogBase.onPushButton1 = CheckNewDeckBeforeSave; + } + + private void CheckNewDeckBeforeSave() + { + if (_isNew) + { + _nameEditDialog = InputDialog.Create(30, 24); + _nameEditDialog.InputAreaObjs.labels[0].text = _name; + _nameEditDialog.InputAreaObjs.labels[1].text = _id.ToString(); + _nameEditDialog.InputAreaObjs.labels[2].text = Data.SystemText.Get("Card_0012"); + _nameEditDialog.InputAreaObjs.labels[3].text = Data.SystemText.Get("Common_0401", 24.ToString()); + _nameEditDialog.SetTitleLabel(Data.SystemText.Get("Card_0011")); + _nameEditDialog.onPushButton1 = NameSetEnd; + _nameEditDialog.onCloseWithoutSelect = Destroy; + _nameEditDialog.SetPanelDepth(2000); + } + else + { + SaveRequest(); + } + } + + private void NameSetEnd() + { + _name = _nameEditDialog.InputAreaObjs.labels[0].text; + if (string.IsNullOrEmpty(_name)) + { + _name = _defaultName; + } + SaveRequest(); + } + + private void SaveRequest() + { + if (_deck.Length > 50) + { + return; + } + GameObject gameObject = new GameObject(); + _behaviour = gameObject.AddComponent(); + if (_formatBehavior.IsConventionMode) + { + DeckConventionUpdateTask deckConventionUpdateTask = new DeckConventionUpdateTask(); + if (_formatBehavior.UseSubClass) + { + deckConventionUpdateTask.SetParameterWithSubClass(_id, _class, _subClass, _rawSkinId, _isRandomLeaderSkin, _leaderSkinIdList.ToArray(), _sleeveId, _name, is_delete: false, _deck, _conventionDeckList); + } + else + { + deckConventionUpdateTask.SetParameter(_id, _class, _rawSkinId, _isRandomLeaderSkin, _leaderSkinIdList.ToArray(), _sleeveId, _name, is_delete: false, _deck, _myRotationId, _conventionDeckList); + } + deckConventionUpdateTask.SkipAllCuteResultCodeCheckErrorPopup(); + _behaviour.StartCoroutine(Toolbox.NetworkManager.Connect(deckConventionUpdateTask, OnFinishSaveRequest, null, OnFailedSaveRequest)); + } + else + { + DeckUpdateTask deckUpdateTask = GameMgr.GetIns().GetDeckUpdateTask(); + if (_formatBehavior.UseSubClass) + { + deckUpdateTask.SetParameterWithSubClass(_id, _class, _subClass, _rawSkinId, _isRandomLeaderSkin, _leaderSkinIdList.ToArray(), _sleeveId, _name, isDelete: false, _deck, _format); + } + else + { + deckUpdateTask.SetParameter(_id, _class, _rawSkinId, _isRandomLeaderSkin, _leaderSkinIdList.ToArray(), _sleeveId, _name, is_delete: false, _deck, _format, _myRotationId); + } + deckUpdateTask.SkipAllCuteResultCodeCheckErrorPopup(); + _behaviour.StartCoroutine(Toolbox.NetworkManager.Connect(deckUpdateTask, OnFinishSaveRequest, null, OnFailedSaveRequest)); + } + } + + private void OnFinishSaveRequest(NetworkTask.ResultCode error) + { + if (_saveCompleteDialogOverrideAction != null) + { + _saveCompleteDialogOverrideAction(_isUsableDeck); + } + else + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_DeckEdit_007_Title")); + dialogBase.SetText(Data.SystemText.Get("Card_0019")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.OnCloseStart = _onFinish; + } + Destroy(); + } + + private void OnFailedSaveRequest(int code) + { + DialogBase dialogBase = Wizard.ErrorDialog.Dialog.Create(code); + if (_isNew) + { + dialogBase.OnCloseStart = CheckNewDeckBeforeSave; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/FirstDisplayPageIndexGetterBase.cs b/SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/FirstDisplayPageIndexGetterBase.cs new file mode 100644 index 0000000..9a28cb4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/FirstDisplayPageIndexGetterBase.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard.DeckSelect.FirstDisplayPageIndexGetter; + +public abstract class FirstDisplayPageIndexGetterBase : IFirstDisplayPageIndexGetter +{ + public int Get(List pageList, Format viewFormat, DeckData primaryDisplayDeck, bool canUseNonPossessionCard) + { + if (primaryDisplayDeck != null) + { + int num = pageList.FindIndex((DeckSelectUI.PageData page) => page.DeckViewList.FirstOrDefault((DeckUI.DeckViewData deck) => deck.Deck == primaryDisplayDeck) != null); + if (num >= 0) + { + return num; + } + } + return DerivedGet(pageList, viewFormat, canUseNonPossessionCard); + } + + protected abstract int DerivedGet(List pageList, Format viewFormat, bool canUseNonPossessionCard); +} diff --git a/SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/IFirstDisplayPageIndexGetter.cs b/SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/IFirstDisplayPageIndexGetter.cs new file mode 100644 index 0000000..9fbc393 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/IFirstDisplayPageIndexGetter.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace Wizard.DeckSelect.FirstDisplayPageIndexGetter; + +public interface IFirstDisplayPageIndexGetter +{ + int Get(List pageList, Format viewFormat, DeckData primaryDisplayDeck, bool canUseNonPossessionCard); +} diff --git a/SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/QuestFirstDisplayPageIndexGetter.cs b/SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/QuestFirstDisplayPageIndexGetter.cs new file mode 100644 index 0000000..50270ba --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/QuestFirstDisplayPageIndexGetter.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard.DeckSelect.FirstDisplayPageIndexGetter; + +public class QuestFirstDisplayPageIndexGetter : FirstDisplayPageIndexGetterBase +{ + protected override int DerivedGet(List pageList, Format viewFormat, bool canUseNonPossessionCard) + { + int questStageId = GameMgr.GetIns().GetDataMgr().QuestBattleData.QuestStageId; + QuestLastUsedDeckSaveDataManager.ExtractedDeckData deck = new QuestLastUsedDeckSaveDataManager().GetDeck(questStageId); + if (deck == null || !TryGetPageIndex(pageList, deck, out var pageIndex)) + { + return new DefaultFirstDisplayPageIndexGetter().Get(pageList, viewFormat, null, canUseNonPossessionCard); + } + return pageIndex; + } + + private static bool TryGetPageIndex(List pageList, QuestLastUsedDeckSaveDataManager.ExtractedDeckData deckData, out int pageIndex) + { + for (int i = 0; i < pageList.Count; i++) + { + DeckSelectUI.PageData pageData = pageList[i]; + if (pageData.Format == deckData.Format && pageData.DeckViewList.Any((DeckUI.DeckViewData x) => x.Deck.GetDeckID() == deckData.ID)) + { + pageIndex = i; + return true; + } + } + pageIndex = 0; + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemButton.cs b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemButton.cs new file mode 100644 index 0000000..8ab3b4f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemButton.cs @@ -0,0 +1,121 @@ +using UnityEngine; + +namespace Wizard.Dialog.Setting; + +public class ItemButton : Item +{ + [SerializeField] + private UISprite _sprite; + + [SerializeField] + private UIButton _button; + + [SerializeField] + private UILabel _label; + + [SerializeField] + private UISprite _spriteOnButton; + + [SerializeField] + private BoxCollider _collider; + + [SerializeField] + private GameObject _separatorLineObj; + + [SerializeField] + private UILabel _subLabel; + + private void Awake() + { + _label.text = string.Empty; + _separatorLineObj.SetActive(value: false); + } + + public void SetSpritePos(Vector3 localPos) + { + _sprite.transform.localPosition = localPos; + } + + public void SetLabelPos(Vector3 localPos) + { + _label.transform.localPosition = localPos; + } + + public void SetSubLabelPos(Vector3 localPos) + { + _subLabel.transform.localPosition = localPos; + } + + public void SetValue(string text) + { + _label.text = text; + } + + public void SetSubLabelText(string text) + { + _subLabel.text = text; + } + + public string GetValue() + { + return _label.text; + } + + public void SetSpriteName(string spriteName, bool isMakePixelPerfect, bool isCollisionResize) + { + _sprite.spriteName = spriteName; + _button.normalSprite = spriteName; + if (isMakePixelPerfect) + { + _sprite.MakePixelPerfect(); + } + if (isCollisionResize) + { + _collider.size = new Vector3(_sprite.width, _sprite.height); + } + } + + public void SetSpriteNameOnPress(string spriteName) + { + _button.pressedSprite = spriteName; + } + + public void SetSpriteOnButtonName(string spriteName, bool isMakePixelPerfect) + { + _spriteOnButton.spriteName = spriteName; + if (isMakePixelPerfect) + { + _spriteOnButton.MakePixelPerfect(); + } + } + + public void SetSpriteOnButtonPos(Vector3 localPos) + { + _spriteOnButton.transform.localPosition = localPos; + } + + public void SetActive_SpriteOnButton(bool isActive) + { + if (_spriteOnButton.gameObject.activeSelf != isActive) + { + _spriteOnButton.gameObject.SetActive(isActive); + } + } + + public override void AddChangeCallback(EventDelegate.Callback callback) + { + EventDelegate.Add(_button.onClick, callback); + } + + public override void SetActive_SeparatorLine(bool isActive) + { + _separatorLineObj.SetActive(isActive); + } + + public void SetToGrey(bool isGrey) + { + UIManager.SetObjectToGrey(base.gameObject, isGrey); + UIManager.SetObjectToGrey(_separatorLineObj, b: false); + _button.enabled = !isGrey; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemGrid.cs b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemGrid.cs new file mode 100644 index 0000000..c97a51d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemGrid.cs @@ -0,0 +1,52 @@ +using UnityEngine; + +namespace Wizard.Dialog.Setting; + +public class ItemGrid : Item +{ + [SerializeField] + private UIGrid _grid; + + public UIGrid GetUIGrid() + { + return _grid; + } + + public void SetArangement(UIGrid.Arrangement arrangement) + { + _grid.arrangement = arrangement; + } + + public UIGrid.Arrangement GetArrangement() + { + return _grid.arrangement; + } + + public void SetCellWidth(float width) + { + _grid.cellWidth = width; + } + + public float GetCellWidth() + { + return _grid.cellWidth; + } + + public void SetCellHeight(float height) + { + _grid.cellHeight = height; + } + + public float GetCellHeight() + { + return _grid.cellHeight; + } + + public override void AddChangeCallback(EventDelegate.Callback callback) + { + } + + public override void SetActive_SeparatorLine(bool isActive) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemLabel.cs b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemLabel.cs new file mode 100644 index 0000000..494141c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemLabel.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace Wizard.Dialog.Setting; + +public class ItemLabel : Item +{ + [SerializeField] + private SettingBase _parant; + + [SerializeField] + private UILabel _label; + + [SerializeField] + private GameObject _separatorLineObj; + + private void Awake() + { + _label.text = string.Empty; + _separatorLineObj.SetActive(value: false); + } + + public void SetValue(string text) + { + _label.text = text; + } + + public string GetValue() + { + return _label.text; + } + + public override void AddChangeCallback(EventDelegate.Callback callback) + { + } + + public override void SetActive_SeparatorLine(bool isActive) + { + _separatorLineObj.SetActive(isActive); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemSelect.cs b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemSelect.cs new file mode 100644 index 0000000..88b5d17 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemSelect.cs @@ -0,0 +1,305 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard.Dialog.Setting; + +public class ItemSelect : Item +{ + [SerializeField] + private UILabel _title; + + [SerializeField] + private GameObject _state; + + [SerializeField] + private GameObject _separatorLineObj; + + [SerializeField] + private UIButton _button; + + [SerializeField] + private GameObject _list; + + [SerializeField] + private UITable _table; + + [SerializeField] + private BoxCollider _listCollider; + + private EventDelegate.Callback _onClick; + + [SerializeField] + private GameObject _resolutionItem; + + [SerializeField] + private UIPanel _panel; + + private string _currentValue; + + private const int BOTTOM_PADDING = -10; + + private const int NORMAL_ITEM_SIZE = 188; + + private Color _originalColor; + + private const int PANEL_DEPTH_CLOSE = 30; + + private const int PANEL_DEPTH_OPEN = 50; + + private UIScrollView _parentScrollView; + + private List _possibleValues; + + private List _items; + + private const int DIRECTION_UP_TABLE_POSITION = 14; + + private const int DIRECTION_UP_LIST_POSITION = 12; + + public bool _isOpenDirectionUp; + + public List PossibleValues => _possibleValues; + + private void Awake() + { + _button.onClick.Add(new EventDelegate(delegate + { + if (_list.activeSelf) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + } + SetListVisible(!_list.activeSelf); + })); + UIEventListener.Get(_listCollider.gameObject).onPress = delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL); + SetListVisible(b: false); + }; + } + + public void SetPossibleResolutionValues(List possibleValues, bool resizeListSprite) + { + for (int i = 0; i < possibleValues.Count; i++) + { + GameObject o = NGUITools.AddChild(_table.gameObject, _resolutionItem); + string str = possibleValues[i]; + string[] array = str.Split('ร—'); + o.transform.Find("width").gameObject.GetComponent().text = array[0]; + o.transform.Find("height").gameObject.GetComponent().text = array[1]; + o.SetActive(value: true); + if ((bool)_parentScrollView) + { + o.AddMissingComponent().scrollView = _parentScrollView; + } + if (resizeListSprite && i == possibleValues.Count - 1) + { + UISprite component = _list.GetComponent(); + component.bottomAnchor.target = o.transform; + component.bottomAnchor.relative = 0f; + component.bottomAnchor.absolute = -10; + } + _originalColor = o.GetComponentInChildren().color; + UIEventListener.Get(o).onHover = delegate(GameObject g, bool b) + { + o.GetComponentInChildren().enabled = b; + }; + UIEventListener.Get(o).onClick = delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + o.GetComponentInChildren().enabled = false; + SetListVisible(b: false); + SetResolutionValue(str); + if (_onClick != null) + { + _onClick(); + } + }; + } + } + + public void SetPossibleIdValues(List possibleValues, bool resizeListSprite) + { + SetPossibleValues(possibleValues, resizeListSprite, (string s) => Data.SystemText.Get(s)); + } + + public void SetPossibleValues(List possibleValues, bool resizeListSprite, Func textChange = null) + { + if (_possibleValues != null) + { + _possibleValues.Clear(); + } + else + { + _possibleValues = new List(); + } + if (_items != null) + { + foreach (GameObject item in _items) + { + UnityEngine.Object.Destroy(item); + } + _items.Clear(); + } + else + { + _items = new List(); + } + List list = new List(possibleValues); + if (_isOpenDirectionUp) + { + list.Reverse(); + } + for (int i = 0; i < list.Count; i++) + { + if (string.IsNullOrEmpty(list[i])) + { + continue; + } + GameObject o = NGUITools.AddChild(_table.gameObject, _resolutionItem); + _items.Add(o); + string str = list[i]; + if (textChange != null) + { + str = textChange(str); + } + _possibleValues.Add(str); + o.transform.Find("width").gameObject.SetActive(value: false); + o.transform.Find("height").gameObject.SetActive(value: false); + UILabel component = o.transform.Find("center").gameObject.GetComponent(); + component.width = 188; + component.text = str; + o.SetActive(value: true); + if ((bool)_parentScrollView) + { + o.AddMissingComponent().scrollView = _parentScrollView; + } + _originalColor = o.GetComponentInChildren().color; + UIEventListener.Get(o).onHover = delegate(GameObject g, bool b) + { + o.GetComponentInChildren().enabled = b; + }; + UIEventListener.Get(o).onClick = delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + o.GetComponentInChildren().enabled = false; + SetListVisible(b: false); + SetValue(str); + if (_onClick != null) + { + _onClick(); + } + }; + } + if (_isOpenDirectionUp) + { + _possibleValues.Reverse(); + } + if (resizeListSprite && _items.Count > 0) + { + GameObject gameObject = _items[_items.Count - 1]; + UISprite component2 = _list.GetComponent(); + if (_isOpenDirectionUp) + { + component2.topAnchor.target = gameObject.transform; + component2.topAnchor.relative = 1f; + component2.topAnchor.absolute = 10; + } + else + { + component2.bottomAnchor.target = gameObject.transform; + component2.bottomAnchor.relative = 0f; + component2.bottomAnchor.absolute = -10; + } + } + if (_isOpenDirectionUp) + { + _table.GetComponent().pivot = UIWidget.Pivot.BottomLeft; + Vector3 localPosition = _table.transform.localPosition; + localPosition.y = 14f; + _table.transform.localPosition = localPosition; + _table.direction = UITable.Direction.Up; + _list.GetComponent().pivot = UIWidget.Pivot.Bottom; + Vector3 localPosition2 = _list.transform.localPosition; + localPosition2.y = 12f; + _list.transform.localPosition = localPosition2; + } + _table.repositionNow = true; + _list.GetComponent().ResetAndUpdateAnchors(); + } + + private void SetListVisible(bool b) + { + _list.SetActive(b); + _listCollider.enabled = b; + _panel.depth = (b ? 50 : 30); + UISprite component = _list.GetComponent(); + component.ResetAndUpdateAnchors(); + component.gameObject.SetActive(b); + } + + public void SetResolutionValue(string value) + { + _currentValue = value; + string[] array = value.Split('ร—'); + _state.transform.Find("width").gameObject.GetComponent().text = array[0]; + _state.transform.Find("height").gameObject.GetComponent().text = array[1]; + } + + public void SetValue(string value) + { + _currentValue = value; + _state.transform.Find("width").gameObject.SetActive(value: false); + _state.transform.Find("height").gameObject.SetActive(value: false); + UILabel component = _state.transform.Find("center").gameObject.GetComponent(); + component.width = 188; + component.text = value; + } + + public string GetValue() + { + return _currentValue; + } + + public void SetTitleLabel(string title) + { + _title.text = title; + } + + public override void AddChangeCallback(EventDelegate.Callback callback) + { + _onClick = (EventDelegate.Callback)Delegate.Combine(_onClick, callback); + } + + public override void SetActive_SeparatorLine(bool isActive) + { + _separatorLineObj.SetActive(isActive); + } + + public void SetTitleTextLocalPos(Vector3 localPos) + { + _title.transform.localPosition = localPos; + } + + public void SetToGrey(bool b) + { + UIManager.SetObjectToGrey(base.gameObject, b); + UIManager.SetObjectToGrey(_separatorLineObj, b: false); + UISprite[] componentsInChildren = _table.GetComponentsInChildren(includeInactive: true); + for (int i = 0; i < componentsInChildren.Length; i++) + { + componentsInChildren[i].color = _originalColor; + } + } + + public void SetScrollView(UIScrollView view) + { + _listCollider.gameObject.AddMissingComponent().scrollView = view; + _parentScrollView = view; + _button.gameObject.AddMissingComponent().scrollView = view; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemSlider.cs b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemSlider.cs new file mode 100644 index 0000000..dcb3414 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemSlider.cs @@ -0,0 +1,116 @@ +using System; +using UnityEngine; + +namespace Wizard.Dialog.Setting; + +public class ItemSlider : Item +{ + [SerializeField] + private SettingBase m_parant; + + [SerializeField] + private UILabel m_titleLabel; + + [SerializeField] + private UILabel m_valueLabel; + + [SerializeField] + private UISlider m_slider; + + [SerializeField] + private UISprite m_foregroundSprite; + + [SerializeField] + private UISprite _foregroundEdgeSprite; + + [SerializeField] + private UISprite m_thumbSprite; + + [SerializeField] + private GameObject m_separatorLineObj; + + private const string FOREGROUND_ON_SPRITE_NAME = "gauge_blue_bottom"; + + private const string FOREGROUND_OFF_SPRITE_NAME = "gauge_gray_bottom"; + + private const string FOREGROUND_EDGE_ON_SPRITE_NAME = "gauge_blue_edge"; + + private const string FOREGROUND_EDGE_OFF_SPRITE_NAME = "gauge_gray_edge"; + + private const string THUMB_ON_SPRITE_NAME = "btn_gauge_on"; + + private const string THUMB_OFF_SPRITE_NAME = "btn_gauge_off"; + + private bool m_isPlaySe; + + private void Awake() + { + m_titleLabel.text = string.Empty; + m_valueLabel.text = string.Empty; + m_separatorLineObj.SetActive(value: false); + AddChangeCallback(delegate + { + string text = Mathf.CeilToInt(m_slider.value * 10f).ToString(); + bool flag = m_valueLabel.text != text; + m_valueLabel.text = text; + if (m_isPlaySe) + { + if (flag) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BAR_SLIDE); + } + } + else + { + m_isPlaySe = true; + } + }); + } + + public void SetValue(float value) + { + m_slider.value = value; + m_isPlaySe = false; + } + + public float GetValue() + { + return m_slider.value; + } + + public void SetTitleLabel(string title) + { + m_titleLabel.text = title; + } + + public void SetLooks(bool isOn) + { + m_foregroundSprite.spriteName = (isOn ? "gauge_blue_bottom" : "gauge_gray_bottom"); + _foregroundEdgeSprite.spriteName = (isOn ? "gauge_blue_edge" : "gauge_gray_edge"); + m_thumbSprite.spriteName = (isOn ? "btn_gauge_on" : "btn_gauge_off"); + } + + public override void AddChangeCallback(EventDelegate.Callback callback) + { + EventDelegate.Add(m_slider.onChange, callback); + } + + public void AddDragFinishedCallback(UIProgressBar.OnDragFinished callback) + { + UISlider slider = m_slider; + slider.onDragFinished = (UIProgressBar.OnDragFinished)Delegate.Combine(slider.onDragFinished, callback); + } + + public override void SetActive_SeparatorLine(bool isActive) + { + m_separatorLineObj.SetActive(isActive); + } + + public void SetScrollView(UIScrollView view) + { + UIDragScrollView componentInChildren = m_slider.gameObject.GetComponentInChildren(); + componentInChildren.enabled = true; + componentInChildren._dragEnabled = false; + componentInChildren.scrollView = view; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemToggle.cs b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemToggle.cs new file mode 100644 index 0000000..e436e30 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/ItemToggle.cs @@ -0,0 +1,232 @@ +using UnityEngine; + +namespace Wizard.Dialog.Setting; + +public class ItemToggle : Item +{ + [SerializeField] + private SettingBase m_parant; + + [SerializeField] + private UILabel m_titleLabel; + + [SerializeField] + private UILabel _subTextLabel; + + [SerializeField] + private UILabel m_stateLabel; + + [SerializeField] + private UIToggle m_toggle; + + [SerializeField] + private GameObject m_separatorLineObj; + + [SerializeField] + private UISprite _spriteON; + + [SerializeField] + private UISprite _spriteOFF; + + [SerializeField] + private BoxCollider _collider; + + private string m_OnText; + + private string m_OffText; + + private bool m_isPlaySe; + + private void Awake() + { + m_titleLabel.text = string.Empty; + if (m_stateLabel != null) + { + m_stateLabel.text = string.Empty; + } + if (m_separatorLineObj != null) + { + m_separatorLineObj.SetActive(value: false); + } + _collider = m_toggle.GetComponent(); + if (_subTextLabel != null) + { + _subTextLabel.gameObject.SetActive(value: false); + _subTextLabel.text = string.Empty; + } + AddChangeCallback(delegate + { + UpdateStateLabel(); + if (m_isPlaySe) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(m_toggle.value ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF); + } + else + { + m_isPlaySe = true; + } + }); + } + + public void SetValue(bool value, bool isDisablePlayse = true) + { + m_toggle.value = value; + if (isDisablePlayse) + { + m_isPlaySe = false; + } + } + + public bool GetValue() + { + return m_toggle.value; + } + + public void SetTitleLabel(string title) + { + m_titleLabel.text = title; + } + + public void SetSutTextLabel(string text) + { + _subTextLabel.gameObject.SetActive(value: true); + _subTextLabel.text = text; + } + + public void SetStateText(string onText, string offText) + { + m_OnText = onText; + m_OffText = offText; + UpdateStateLabel(); + } + + public void SetActive_StateText(bool isActive) + { + m_stateLabel.gameObject.SetActive(isActive); + } + + public void SetTitleTextLocalPos(Vector3 localPos) + { + m_titleLabel.transform.localPosition = localPos; + } + + public void SetStateTextLocalPos(Vector3 localPos) + { + m_stateLabel.transform.localPosition = localPos; + } + + public void SetToggleLocalPos(Vector3 localPos) + { + m_toggle.transform.localPosition = localPos; + } + + private void UpdateStateLabel() + { + if (!string.IsNullOrEmpty(m_OnText) && !string.IsNullOrEmpty(m_OffText)) + { + m_stateLabel.text = (m_toggle.value ? m_OnText : m_OffText); + } + } + + public void SetToggleLooks(bool isNormal) + { + UIManager.SetObjectToGrey(m_toggle.gameObject, !isNormal); + bool value = GetValue(); + SetValue(!value, isDisablePlayse: false); + SetValue(value, isDisablePlayse: false); + _collider.enabled = isNormal; + } + + public void SetLabelLooks(bool isNormal) + { + UIManager.SetObjectToGrey(m_stateLabel.gameObject, !isNormal); + UIManager.SetObjectToGrey(m_titleLabel.gameObject, !isNormal); + } + + public void SetSpriteONName(string spriteName, bool isMakePixelPerfect, bool isCollisionResize) + { + _spriteON.spriteName = spriteName; + if (isMakePixelPerfect) + { + _spriteON.MakePixelPerfect(); + } + if (isCollisionResize) + { + _collider.size = new Vector3(_spriteON.width, _spriteON.height); + } + } + + public void SetSpriteOFFName(string spriteName, bool isMakePixelPerfect, bool isCollisionResize) + { + _spriteOFF.spriteName = spriteName; + if (isMakePixelPerfect) + { + _spriteOFF.MakePixelPerfect(); + } + if (isCollisionResize) + { + _collider.size = new Vector3(_spriteOFF.width, _spriteOFF.height); + } + } + + public void SetButtonEnable(bool isEnable) + { + UIButton component = m_toggle.GetComponent(); + if (null != component && component.enabled != isEnable) + { + component.enabled = isEnable; + } + } + + public void SetValidator(UIToggle.Validate validator) + { + m_toggle.validator = validator; + } + + public override void AddChangeCallback(EventDelegate.Callback callback) + { + EventDelegate.Add(m_toggle.onChange, callback); + } + + public void ClearChangeCallback() + { + m_toggle.onChange.Clear(); + } + + public void AddChangeCallback(EventDelegate callback) + { + m_toggle.onChange.Add(callback); + } + + public override void SetActive_SeparatorLine(bool isActive) + { + m_separatorLineObj.SetActive(isActive); + } + + public void SetScrollView(UIScrollView view) + { + _collider.gameObject.AddMissingComponent().scrollView = view; + } + + public void SetToggleEnable(bool isEnable) + { + if (!(m_toggle != null)) + { + return; + } + m_toggle.enabled = isEnable; + if (isEnable) + { + return; + } + TweenColor[] componentsInChildren = m_toggle.GetComponentsInChildren(); + if (componentsInChildren != null) + { + TweenColor[] array = componentsInChildren; + for (int i = 0; i < array.Length; i++) + { + array[i].enabled = true; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/SettingBase.cs b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/SettingBase.cs new file mode 100644 index 0000000..ca48e75 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Dialog.Setting/SettingBase.cs @@ -0,0 +1,688 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard.Dialog.Setting; + +public class SettingBase : MonoBehaviour +{ + public enum Type + { + NORMAL, + SCENARIO, + VIDEOHOSTING_SETTING_RECORD, + VIDEOHOSTING_SETTING_PUBLISH, + VIDEOHOSTING_MENU_RECORD, + VIDEOHOSTING_MENU_PUBLISH + } + + public enum ID + { + SOUND, + BGM, + SE, + VOICE, + MOVIE_SUBTITLES, + BATTLE_EFFECT_DISPLAY, + LEADER_ANIMATION_DISPLAY, + PREDICTION_ICONS_DISPLAY, + TURN_END_CONFIRM, + TURN_END_WITHOUT_USING_HERO_SKILL_CONFIRM, + EVOLVE_CONFIRM, + FIXEDUSE_COST_INFO, + OPPONENT_MESSAGE_DISPLAY, + OPPONENT_SHOW_DEFAULT_SKIN, + SHOW_FOIL_CARD_ANIMATION, + SELECT_WSS, + SELECT_IPV6, + PURCHASE_ALERT, + SCREEN_FIX, + INVITATION_FRIEND_ROOM, + INVITATION_IN_BATTLE, + INVITATION_IN_OFFLINE, + RECEIVED_FRIEND_APPLY, + SHOW_PANEL_ALWAYS, + SHOW_SIDE_LOG, + SHOW_FUSION_CARD_PLAY_DIALOG, + AUTO_MESSAGE, + SIMPLE_STAGE, + COLLABORATION_SOUND, + USE_STAGE_SELECT, + STAGE_SELECT, + ENEMYNAME_DISPLAY, + RECORD_MODE, + RECORD_UPLOAD, + RECORD_WATCH, + RECORD_PAUSE, + RECORD_RESUME, + RECORD_STOP, + RECORD_FACECAMERA, + RECORD_MICROPHONE, + RECORD_MICROPHONE_GAIN, + RECORD_PAUSE_IN_MENU, + RECORD_BUTTON_GRID, + PUBLISH_MODE, + PLAY_SOUND_IN_BG, + FULLSCREEN, + RESOLUTION, + FPS, + QRCode, + MOUSE_CONTROL, + MOUSE_SHORTCUT_PLAY, + MOUSE_SHORTCUT_EVOLUTION, + MOUSE_SHORTCUT_DETAIL, + BATTLE_DETAIL_PANEL_SIZE, + SHOW_DETAIL_LEFT_AND_RIGHT, + KEYBOARD_CONTROL, + KEYBOARD_SHORTCUT_EVOLUTION, + KEYBOARD_SHORTCUT_SPACE, + PLAY_BGM_ON_OTHER_BGM, + BATTLE_PASS_SHOW_RESULT + } + + [SerializeField] + private GameObject m_scrollView; + + [SerializeField] + private GameObject m_itemToggle; + + [SerializeField] + private GameObject m_itemSlider; + + [SerializeField] + private GameObject m_itemGrid; + + [SerializeField] + private GameObject m_itemLabel; + + [SerializeField] + private GameObject m_itemButton; + + [SerializeField] + private GameObject _itemSelect; + + protected static readonly Vector3 CHILD_STATE_LABEL_POS = new Vector3(-297f, 0f, 0f); + + private Dictionary m_dicItems = new Dictionary(); + + private Type m_type; + + private const string VOICE_NAME = "vo_test_01"; + + protected DialogBase _dialogObject; + + private static readonly Vector3 PUBLISHMODE_STATELABEL_POS = new Vector3(80f, 0f, 0f); + + private static readonly Vector3 PUBLISHMODE_TOGGLE_POS = new Vector3(275f, 0f, 0f); + + private static readonly Vector3 RECORDMODE_STATELABEL_POS = new Vector3(80f, 0f, 0f); + + private static readonly Vector3 RECORDMODE_TOGGLE_POS = new Vector3(275f, 0f, 0f); + + private static readonly Vector3 SPRITE_POS_RECORD_PLAYPAUSE = new Vector3(-93f, 0f, 0f); + + private static readonly Vector3 SPRITE_POS_RECORD_STOP = new Vector3(-93f, 0f, 0f); + + private static readonly Vector3 LABEL_POS_RECORD_PLAYPAUSE = new Vector3(20f, 0f, 0f); + + private static readonly Vector3 LABEL_POS_RECORD_STOP = new Vector3(20f, 0f, 0f); + + protected GameObject SingleTabRoot => m_scrollView; + + public static DialogBase CreateDialog(Type type = Type.NORMAL) + { + SettingBase settingBase = null; + settingBase = ((type != Type.NORMAL) ? Object.Instantiate(UIManager.GetInstance().SettingPrefab) : Object.Instantiate(UIManager.GetInstance().OptionSettingPrefab)); + settingBase.Create(type); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("OtherTop_0003")); + dialogBase.SetObj(settingBase.gameObject, settingBase.transform.localPosition); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + settingBase.SettingDialogObject(dialogBase); + return dialogBase; + } + + public void SettingDialogObject(DialogBase dialog) + { + _dialogObject = dialog; + } + + private void Start() + { + GameMgr.GetIns().GetSoundMgr().LoadVoice("vo_test_01"); + } + + public virtual void Create() + { + } + + public virtual void Create(Type type) + { + m_type = type; + Create(); + if (m_type != Type.NORMAL) + { + if (m_type == Type.SCENARIO) + { + CreateToggle_AutoMessage(isDispSeparatorLine: true); + CreateToggle_MovieSubtitles(isDispSeparatorLine: true, m_scrollView.gameObject); + CreateSoundItem(m_scrollView.gameObject); + } + else if (m_type == Type.VIDEOHOSTING_SETTING_RECORD) + { + CreateVideoHostingSettingRecord(); + } + else if (m_type == Type.VIDEOHOSTING_SETTING_PUBLISH) + { + CreateVideoHostingSettingPublish(); + } + else if (m_type == Type.VIDEOHOSTING_MENU_RECORD) + { + CreateVideoHostingMenuRecord(); + } + else if (m_type == Type.VIDEOHOSTING_MENU_PUBLISH) + { + CreateVideoHostingMenuPublish(); + } + } + } + + protected void ResetScroll() + { + m_scrollView.GetComponent().ResetPosition(); + } + + protected virtual void OnDestroy() + { + GameMgr.GetIns().GetSoundMgr().UnloadVoice("vo_test_01"); + } + + protected void CreateSoundItem(GameObject parent) + { + ItemToggle soundToggle = CreateToggle_Sound(isDispSeparatorLine: true, parent); + ItemSlider bgmSlider = AddSlider_BGM(isDispSeparatorLine: false, parent); + ItemSlider seSlider = AddSlider_SE(isDispSeparatorLine: false, parent); + ItemSlider voiceSlider = AddSlider_Voice(isDispSeparatorLine: true, parent); + soundToggle.AddChangeCallback(delegate + { + bool value = soundToggle.GetValue(); + bgmSlider.SetLooks(value); + seSlider.SetLooks(value); + voiceSlider.SetLooks(value); + }); + } + + public Item FindItem(ID id) + { + if (!m_dicItems.ContainsKey(id)) + { + return null; + } + return m_dicItems[id]; + } + + protected ItemToggle CreateToggle(ID id, bool isDispSeparatorLine, GameObject parent) + { + ItemToggle component = NGUITools.AddChild(parent, m_itemToggle).GetComponent(); + component.SetScrollView(m_scrollView.GetComponent()); + component.name = id.ToString(); + component.SetActive_SeparatorLine(isDispSeparatorLine); + m_dicItems.Add(id, component); + return component; + } + + protected ItemSlider CreateSlider(ID id, bool isDispSeparatorLine, GameObject parent) + { + ItemSlider component = NGUITools.AddChild(parent, m_itemSlider).GetComponent(); + component.SetScrollView(m_scrollView.GetComponent()); + component.name = id.ToString(); + component.SetActive_SeparatorLine(isDispSeparatorLine); + m_dicItems.Add(id, component); + return component; + } + + protected ItemGrid CreateGrid(ID id, bool isDispSeparatorLine, GameObject parent) + { + ItemGrid component = NGUITools.AddChild(parent, m_itemGrid).GetComponent(); + component.name = id.ToString(); + component.SetActive_SeparatorLine(isDispSeparatorLine); + m_dicItems.Add(id, component); + return component; + } + + protected ItemButton CreateButton(ID id, bool isDispSeparatorLine, GameObject parent) + { + ItemButton component = NGUITools.AddChild(parent, m_itemButton).GetComponent(); + component.name = id.ToString(); + component.SetActive_SeparatorLine(isDispSeparatorLine); + m_dicItems.Add(id, component); + return component; + } + + private ItemLabel CreateLabel(ID id, bool isDispSeparatorLine) + { + ItemLabel component = NGUITools.AddChild(m_scrollView, m_itemLabel).GetComponent(); + component.name = id.ToString(); + component.SetActive_SeparatorLine(isDispSeparatorLine); + m_dicItems.Add(id, component); + return component; + } + + protected ItemSelect CreateSelect(ID id, bool isDispSeparatorLine, GameObject parent) + { + ItemSelect component = NGUITools.AddChild(parent, _itemSelect).GetComponent(); + component.SetScrollView(m_scrollView.GetComponent()); + component.name = id.ToString(); + component.SetActive_SeparatorLine(isDispSeparatorLine); + m_dicItems.Add(id, component); + return component; + } + + protected ItemToggle CreateToggle_ScreenFix(bool isDispSeparatorLine, GameObject parent) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.SCREEN_FIX, isDispSeparatorLine, parent); + item.SetTitleLabel(systemText.Get("OtherConfig_0011")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.DEVICE_ORIENTATION)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.DEVICE_ORIENTATION, item.GetValue()); + UIManager.GetInstance().SetDeviceOrientation(); + }); + return item; + } + + protected ItemToggle CreateToggle_MovieSubtitles(bool isDispSeparatorLine, GameObject parent) + { + ItemToggle item = CreateToggle(ID.MOVIE_SUBTITLES, isDispSeparatorLine, parent); + item.SetTitleLabel(Data.SystemText.Get("OtherConfig_0063")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.MOVIE_SUBTITLES)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.MOVIE_SUBTITLES, item.GetValue()); + }); + return item; + } + + private ItemToggle CreateToggle_Sound(bool isDispSeparatorLine, GameObject parent) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.SOUND, isDispSeparatorLine, parent); + item.SetTitleLabel(systemText.Get("OtherConfig_0017")); + item.SetValue(!PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SOUND_MUTE)); + item.AddChangeCallback(delegate + { + bool flag = !item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SOUND_MUTE, flag); + GameMgr.GetIns().GetSoundMgr().AllMute(flag); + }); + return item; + } + + private ItemSlider AddSlider_BGM(bool isDispSeparatorLine, GameObject parent) + { + SystemText systemText = Data.SystemText; + SoundMgr soundMgr = GameMgr.GetIns().GetSoundMgr(); + ItemSlider item = CreateSlider(ID.BGM, isDispSeparatorLine, parent); + item.SetTitleLabel(systemText.Get("OtherConfig_0001")); + item.SetValue(soundMgr.GetBgmVolume()); + item.AddChangeCallback(delegate + { + float value = item.GetValue(); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.BGM_VOLUME, value); + soundMgr.SetBgmVolume(value); + }); + return item; + } + + private ItemSlider AddSlider_SE(bool isDispSeparatorLine, GameObject parent) + { + SystemText systemText = Data.SystemText; + SoundMgr soundMgr = GameMgr.GetIns().GetSoundMgr(); + ItemSlider item = CreateSlider(ID.SE, isDispSeparatorLine, parent); + item.SetTitleLabel(systemText.Get("OtherConfig_0002")); + item.SetValue(soundMgr.GetSeVolume()); + item.AddChangeCallback(delegate + { + float value = item.GetValue(); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.SE_VOLUME, value); + soundMgr.SetSeVolume(value); + }); + return item; + } + + private ItemSlider AddSlider_Voice(bool isDispSeparatorLine, GameObject parent) + { + SystemText systemText = Data.SystemText; + SoundMgr soundMgr = GameMgr.GetIns().GetSoundMgr(); + ItemSlider item = CreateSlider(ID.VOICE, isDispSeparatorLine, parent); + item.SetTitleLabel(systemText.Get("OtherConfig_0003")); + item.SetValue(soundMgr.GetVoiceVolume()); + item.AddChangeCallback(delegate + { + float value = item.GetValue(); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.VOICE_VOLUME, value); + soundMgr.SetVoiceVolume(value); + }); + item.AddDragFinishedCallback(delegate + { + soundMgr.PlayVoiceScenario("vo_test_01"); + }); + return item; + } + + private ItemToggle CreateToggle_AutoMessage(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.AUTO_MESSAGE, isDispSeparatorLine, m_scrollView.gameObject); + item.SetTitleLabel(systemText.Get("OtherConfig_0014")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.AUTO_MESSAGE)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.AUTO_MESSAGE, item.GetValue()); + }); + return item; + } + + private void CreateVideoHostingSettingRecord() + { + } + + private void CreateVideoHostingSettingPublish() + { + } + + private void CreateVideoHostingMenuRecord() + { + } + + private void CreateVideoHostingMenuPublish() + { + } + + private void CreateSetting_Publish_NicoNico() + { + CreateToggle_PublishMode(isDispSeparatorLine: true); + CreateToggle_EnemyNameDisplay(isDispSeparatorLine: true); + } + + private void CreateSetting_Record_NicoNico() + { + CreateToggle_RecordMode(isDispSeparatorLine: true); + CreateToggle_RecordFaceCamera(isDispSeparatorLine: true); + CreateToggle_RecordMicrophone(isDispSeparatorLine: true); + CreateToggle_RecordPauseInMenu(isDispSeparatorLine: true); + CreateToggle_EnemyNameDisplay(isDispSeparatorLine: true); + } + + private void CreateMenu_Record_NicoNico_iOS() + { + ItemGrid itemGrid = CreateGrid_RecordButton(isDispSeparatorLine: true); + CreateButton_RecordPlayPause(isDispSeparatorLine: false, itemGrid.GetUIGrid().gameObject); + CreateButton_RecordStop(isDispSeparatorLine: false, itemGrid.GetUIGrid().gameObject); + CreateToggle_RecordPauseInMenu(isDispSeparatorLine: true); + CreateToggle_EnemyNameDisplay(isDispSeparatorLine: true); + CreateSlider_RecordMicrophoneGain(isDispSeparatorLine: false); + } + + private void CreateSetting_Record_EveryPlay_iOS() + { + CreateToggle_RecordMode(isDispSeparatorLine: true); + CreateToggle_RecordFaceCamera(isDispSeparatorLine: true); + CreateToggle_RecordMicrophone(isDispSeparatorLine: true); + CreateToggle_RecordPauseInMenu(isDispSeparatorLine: true); + CreateToggle_EnemyNameDisplay(isDispSeparatorLine: true); + } + + private void CreateSetting_Record_EveryPlay_Android() + { + CreateToggle_RecordMode(isDispSeparatorLine: true); + CreateToggle_RecordPauseInMenu(isDispSeparatorLine: true); + CreateToggle_EnemyNameDisplay(isDispSeparatorLine: true); + } + + private void CreateMenu_Record_EveryPlay_iOS() + { + ItemGrid itemGrid = CreateGrid_RecordButton(isDispSeparatorLine: true); + CreateButton_RecordPlayPause(isDispSeparatorLine: false, itemGrid.GetUIGrid().gameObject); + CreateButton_RecordStop(isDispSeparatorLine: false, itemGrid.GetUIGrid().gameObject); + CreateToggle_RecordPauseInMenu(isDispSeparatorLine: true); + CreateToggle_EnemyNameDisplay(isDispSeparatorLine: true); + } + + private void CreateMenu_Record_EveryPlay_Android() + { + ItemGrid itemGrid = CreateGrid_RecordButton(isDispSeparatorLine: true); + CreateButton_RecordPlayPause(isDispSeparatorLine: false, itemGrid.GetUIGrid().gameObject); + CreateButton_RecordStop(isDispSeparatorLine: false, itemGrid.GetUIGrid().gameObject); + CreateToggle_RecordPauseInMenu(isDispSeparatorLine: true); + CreateToggle_EnemyNameDisplay(isDispSeparatorLine: true); + } + + private ItemToggle CreateToggle_EnemyNameDisplay(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.ENEMYNAME_DISPLAY, isDispSeparatorLine, SingleTabRoot); + item.SetTitleLabel(systemText.Get("VideoHosting_0013")); + item.SetTitleTextLocalPos(CHILD_STATE_LABEL_POS); + item.SetButtonEnable(isEnable: false); + item.SetValue(VideoHostingUtil.GetOptionFlagFromPlayerPrefs(VideoHostingUtil.Option.EnemyNameDisplay)); + item.AddChangeCallback(delegate + { + VideoHostingUtil.SetOptionFlagFromPlayerPrefs(VideoHostingUtil.Option.EnemyNameDisplay, item.GetValue()); + }); + return item; + } + + private ItemToggle CreateToggle_RecordMode(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.RECORD_MODE, isDispSeparatorLine, SingleTabRoot); + item.SetTitleLabel(systemText.Get("VideoHosting_0006")); + item.SetStateText(systemText.Get("VideoHosting_0010"), systemText.Get("VideoHosting_0011")); + item.SetActive_StateText(isActive: true); + item.SetButtonEnable(isEnable: false); + item.SetToggleLocalPos(RECORDMODE_TOGGLE_POS); + item.SetStateTextLocalPos(RECORDMODE_STATELABEL_POS); + item.SetSpriteONName("btn_check_03_on", isMakePixelPerfect: true, isCollisionResize: true); + item.SetSpriteOFFName("btn_check_03_off", isMakePixelPerfect: true, isCollisionResize: true); + item.SetValue(VideoHostingUtil.GetRecordModeEnable()); + item.AddChangeCallback(delegate + { + bool value = item.GetValue(); + VideoHostingUtil.SetRecordModeEnable(value); + if (value) + { + VideoHostingUtil.SetPublishModeEnable(isEnable: false); + } + _SetItemToggleLooks(ID.RECORD_FACECAMERA, value); + _SetItemToggleLooks(ID.RECORD_MICROPHONE, value); + _SetItemToggleLooks(ID.ENEMYNAME_DISPLAY, value); + _SetItemToggleLooks(ID.RECORD_PAUSE_IN_MENU, value); + VideoHostingUtil.CheckAndCreateHUD(VideoHostingUtil.HUDScene.Home); + UpdateRecordingFaceCameraStatus(); + }); + return item; + } + + private ItemButton CreateButton_RecordPlayPause(bool isDispSeparatorLine, GameObject parent) + { + ItemButton item = CreateButton(ID.RECORD_PAUSE, isDispSeparatorLine, parent); + item.SetSpriteName("btn_common_04_m_off", isMakePixelPerfect: true, isCollisionResize: true); + item.SetSpriteNameOnPress("btn_common_04_m_on"); + item.SetActive_SpriteOnButton(isActive: true); + ChangeSpriteNameRecordPlayPause(item); + item.SetLabelPos(LABEL_POS_RECORD_PLAYPAUSE); + item.SetSpriteOnButtonPos(SPRITE_POS_RECORD_PLAYPAUSE); + item.AddChangeCallback(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + if (SingletonMonoBehaviour.instance.IsRecording() && !SingletonMonoBehaviour.instance.IsRecordingPause()) + { + SingletonMonoBehaviour.instance.PauseRecording(); + } + else + { + SingletonMonoBehaviour.instance.ResumeRecording(); + UIManager.GetInstance().CloseLatestDialog(); + } + ChangeSpriteNameRecordPlayPause(item); + }); + return item; + } + + private void ChangeSpriteNameRecordPlayPause(ItemButton item) + { + if (SingletonMonoBehaviour.instance.IsRecording() && !SingletonMonoBehaviour.instance.IsRecordingPause()) + { + item.SetValue(Data.SystemText.Get("VideoHosting_0030")); + item.SetSpriteOnButtonName("icon_button_rec_stop", isMakePixelPerfect: true); + } + else + { + item.SetValue(Data.SystemText.Get("VideoHosting_0031")); + item.SetSpriteOnButtonName("icon_button_rec_resume", isMakePixelPerfect: true); + } + } + + private ItemButton CreateButton_RecordStop(bool isDispSeparatorLine, GameObject parent) + { + SystemText systemText = Data.SystemText; + ItemButton itemButton = CreateButton(ID.RECORD_STOP, isDispSeparatorLine, parent); + itemButton.SetValue(systemText.Get("VideoHosting_0020")); + itemButton.SetSpriteName("btn_common_02_m_off", isMakePixelPerfect: true, isCollisionResize: true); + itemButton.SetSpriteNameOnPress("btn_common_02_m_on"); + itemButton.SetSpriteOnButtonName("icon_button_rec_end", isMakePixelPerfect: true); + itemButton.SetActive_SpriteOnButton(isActive: true); + itemButton.SetLabelPos(LABEL_POS_RECORD_STOP); + itemButton.SetSpriteOnButtonPos(SPRITE_POS_RECORD_STOP); + itemButton.AddChangeCallback(delegate + { + if (SingletonMonoBehaviour.instance.IsRecording()) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SingletonMonoBehaviour.instance.StopRecording(); + VideoHostingUtil.CreateDialogStopRecording(VideoHostingUtil.CheckHUDSceneUploadEnable(VideoHostingUtil.GetHUDScene()), isTimeOut: false); + UIManager.GetInstance().GetVideoHostingHUD().CloseSettingMenuDialog(); + } + }); + return itemButton; + } + + private ItemToggle CreateToggle_RecordFaceCamera(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.RECORD_FACECAMERA, isDispSeparatorLine, SingleTabRoot); + item.SetTitleLabel(systemText.Get("VideoHosting_0015")); + item.SetTitleTextLocalPos(CHILD_STATE_LABEL_POS); + item.SetButtonEnable(isEnable: false); + item.SetValue(VideoHostingUtil.GetOptionFlagFromPlayerPrefs(VideoHostingUtil.Option.UseRecordingFaceCamera)); + item.AddChangeCallback(delegate + { + VideoHostingUtil.SetOptionFlagFromPlayerPrefs(VideoHostingUtil.Option.UseRecordingFaceCamera, item.GetValue()); + UpdateRecordingFaceCameraStatus(); + }); + return item; + } + + private ItemToggle CreateToggle_RecordMicrophone(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.RECORD_MICROPHONE, isDispSeparatorLine, SingleTabRoot); + item.SetTitleLabel(systemText.Get("VideoHosting_0016")); + item.SetTitleTextLocalPos(CHILD_STATE_LABEL_POS); + item.SetButtonEnable(isEnable: false); + item.SetValue(VideoHostingUtil.GetOptionFlagFromPlayerPrefs(VideoHostingUtil.Option.UseRecordingMicrophone)); + item.AddChangeCallback(delegate + { + VideoHostingUtil.SetOptionFlagFromPlayerPrefs(VideoHostingUtil.Option.UseRecordingMicrophone, item.GetValue()); + UpdateRecordingFaceCameraStatus(); + }); + return item; + } + + private void UpdateRecordingFaceCameraStatus() + { + bool isEnableCamera = VideoHostingUtil.GetRecordModeEnable() && VideoHostingUtil.GetOptionFlagFromPlayerPrefs(VideoHostingUtil.Option.UseRecordingFaceCamera); + bool isEnableMicrophone = VideoHostingUtil.GetRecordModeEnable() && VideoHostingUtil.GetOptionFlagFromPlayerPrefs(VideoHostingUtil.Option.UseRecordingMicrophone); + SingletonMonoBehaviour.instance.SetRecordingFaceCameraMicrophoneStatus(isEnableCamera, isEnableMicrophone); + SingletonMonoBehaviour.instance.SetFaceCameraWindowVisible(isVisible: false); + } + + private ItemSlider CreateSlider_RecordMicrophoneGain(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemSlider item = CreateSlider(ID.RECORD_MICROPHONE_GAIN, isDispSeparatorLine, SingleTabRoot); + item.SetTitleLabel(systemText.Get("VideoHosting_0033")); + item.SetLooks(isOn: true); + item.SetValue(PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.VIDEOHOSTING_MICROPHONE_GAIN)); + item.AddChangeCallback(delegate + { + float value = item.GetValue(); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.VIDEOHOSTING_MICROPHONE_GAIN, value); + SingletonMonoBehaviour.instance.SetRecordingMicrophoneGain(value); + }); + return item; + } + + private ItemToggle CreateToggle_RecordPauseInMenu(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.RECORD_PAUSE_IN_MENU, isDispSeparatorLine, SingleTabRoot); + item.SetTitleLabel(systemText.Get("VideoHosting_0017")); + item.SetTitleTextLocalPos(CHILD_STATE_LABEL_POS); + item.SetButtonEnable(isEnable: false); + item.SetValue(VideoHostingUtil.GetOptionFlagFromPlayerPrefs(VideoHostingUtil.Option.RecordPauseInMenu)); + item.AddChangeCallback(delegate + { + VideoHostingUtil.SetOptionFlagFromPlayerPrefs(VideoHostingUtil.Option.RecordPauseInMenu, item.GetValue()); + }); + return item; + } + + private ItemGrid CreateGrid_RecordButton(bool isDispSeparatorLine) + { + ItemGrid itemGrid = CreateGrid(ID.RECORD_BUTTON_GRID, isDispSeparatorLine, m_scrollView); + itemGrid.SetArangement(UIGrid.Arrangement.Horizontal); + itemGrid.SetCellWidth(300f); + return itemGrid; + } + + private ItemToggle CreateToggle_PublishMode(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.PUBLISH_MODE, isDispSeparatorLine, SingleTabRoot); + item.SetTitleLabel(systemText.Get("VideoHosting_0009")); + item.SetStateText(systemText.Get("VideoHosting_0010"), systemText.Get("VideoHosting_0011")); + item.SetActive_StateText(isActive: true); + item.SetButtonEnable(isEnable: false); + item.SetToggleLocalPos(PUBLISHMODE_TOGGLE_POS); + item.SetStateTextLocalPos(PUBLISHMODE_STATELABEL_POS); + item.SetSpriteONName("btn_check_03_on", isMakePixelPerfect: true, isCollisionResize: true); + item.SetSpriteOFFName("btn_check_03_off", isMakePixelPerfect: true, isCollisionResize: true); + item.SetValue(VideoHostingUtil.GetPublishModeEnable()); + item.AddChangeCallback(delegate + { + bool value = item.GetValue(); + VideoHostingUtil.SetPublishModeEnable(value); + if (value) + { + VideoHostingUtil.SetRecordModeEnable(isEnable: false); + UpdateRecordingFaceCameraStatus(); + } + _SetItemToggleLooks(ID.ENEMYNAME_DISPLAY, value); + VideoHostingUtil.CheckAndCreateHUD(VideoHostingUtil.HUDScene.Home); + }); + return item; + } + + protected void _SetItemToggleLooks(ID id, bool isNormal) + { + ItemToggle itemToggle = FindItem(id) as ItemToggle; + if (!(null == itemToggle)) + { + itemToggle.SetToggleLooks(isNormal); + itemToggle.SetLabelLooks(isNormal); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.ErrorDialog/Dialog.cs b/SVSim.BattleEngine/Engine/Wizard.ErrorDialog/Dialog.cs new file mode 100644 index 0000000..117b76e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.ErrorDialog/Dialog.cs @@ -0,0 +1,120 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard.ErrorDialog; + +public static class Dialog +{ + public const int SORTING_ORDER = 2; + + private static bool _isInitialized; + + private static Dictionary _dataList = new Dictionary(); + + private static Data _defaultData; + + public static void Initialize() + { + if (_isInitialized) + { + _dataList.Clear(); + _defaultData = null; + } + _isInitialized = true; + ArrayList arrayList = Utility.ConvertCSV((Resources.Load("CSV/error_dialog") as TextAsset).ToString()); + bool flag = true; + foreach (ArrayList item in arrayList) + { + string[] array = (string[])item.ToArray(typeof(string)); + if (flag) + { + flag = false; + continue; + } + string text = array[0]; + Data data = new Data(text, array[1], array[2], array[3], array[4], array[5], array[6]); + if (text != "DEFAULT") + { + _dataList.Add(text, data); + } + else + { + _defaultData = data; + } + } + } + + public static Data FindData(string errorId) + { + if (_dataList.ContainsKey(errorId)) + { + return _dataList[errorId]; + } + return null; + } + + public static Data FindData(int errorId) + { + return FindData(errorId.ToString()); + } + + public static DialogBase Create(string errorId) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true); + Setup(dialogBase, errorId); + UIManager.GetInstance().WebViewHelper.CloseWebViewDialog(); + return dialogBase; + } + + public static DialogBase Create(int errorId) + { + return Create(errorId.ToString()); + } + + public static void Setup(DialogBase dialog, string errorId) + { + Data data = (_dataList.ContainsKey(errorId) ? _dataList[errorId] : _defaultData); + dialog.SetSize(DialogBase.Size.M); + dialog.SetTitleLabel(Wizard.Data.SystemText.Get(data.TitleId)); + dialog.SetText(Wizard.Data.SystemText.Get(data.BodyId, errorId)); + dialog.SetVisibleContactButton(data.IsDisplayContact, errorId); + dialog.SetButtonLayout(DialogBase.ButtonLayout.NONE); + AddButtonToDialog(dialog, data.MainButton, data.SubButton == Data.ButtonType._NONE_); + AddButtonToDialog(dialog, data.SubButton, isReflect: true); + dialog.SetFadeButtonEnabled(flag: false); + dialog.SetPanelDepth(data.PanelDepth); + dialog.SetPanelSortingOrder(2); + } + + private static void AddButtonToDialog(DialogBase dialog, Data.ButtonType type, bool isReflect) + { + switch (type) + { + case Data.ButtonType.OK: + dialog.AddButton(DialogBase.ButtonType.OK, isReflect); + break; + case Data.ButtonType.ใƒชใƒˆใƒฉใ‚ค: + dialog.AddButton(DialogBase.ButtonType.Retry, isReflect); + break; + case Data.ButtonType.ใ‚ฟใ‚คใƒˆใƒซใธๆˆปใ‚‹: + dialog.AddButton(DialogBase.ButtonType.BackToTitle, isReflect); + break; + case Data.ButtonType.ใƒ›ใƒผใƒ ใธๆˆปใ‚‹: + dialog.AddButton(DialogBase.ButtonType.BackToHome, isReflect); + break; + case Data.ButtonType.ใ‚ขใƒ—ใƒช็ต‚ไบ†: + dialog.AddButton(DialogBase.ButtonType.QuitApplication, isReflect); + break; + case Data.ButtonType.ใƒใƒผใ‚ธใƒงใƒณใ‚ขใƒƒใƒ—: + dialog.AddButton(DialogBase.ButtonType.VersionUp, isReflect); + break; + case Data.ButtonType.ๆŽจๅฅจ็ซฏๆœซไธ€่ฆง: + dialog.AddButton(DialogBase.ButtonType.RecommendedList, isReflect); + break; + case Data.ButtonType._NONE_: + break; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryApplyDialog.cs b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryApplyDialog.cs new file mode 100644 index 0000000..f24373c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryApplyDialog.cs @@ -0,0 +1,44 @@ +using Cute; +using UnityEngine; + +namespace Wizard.Lottery; + +public class LotteryApplyDialog : MonoBehaviour +{ + private const float DIALOG_AUTO_CLOSE_TIME = 5f; + + [SerializeField] + private UITexture _banner; + + [SerializeField] + private UILabel _label; + + private LotteryApplyData _data; + + public static string GetLotteryTexturePath(LotteryApplyData data, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(data.BannerFileName, ResourcesManager.AssetLoadPathType.Lottery, isFetch); + } + + public static DialogBase Create(LotteryApplyData data, bool autoClose = true) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(data.DialogTitle); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + if (autoClose) + { + dialogBase.AutoClose(5f); + } + GameObject gameObject = Object.Instantiate(UIManager.GetInstance()._lotteryApplyPrefab); + gameObject.GetComponent()._data = data; + dialogBase.SetObj(gameObject); + return dialogBase; + } + + private void Start() + { + _banner.mainTexture = Toolbox.ResourcesManager.LoadObject(GetLotteryTexturePath(_data, isFetch: true)); + _label.text = _data.DialogMessage; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryLoadTaskData.cs b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryLoadTaskData.cs new file mode 100644 index 0000000..816bec6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryLoadTaskData.cs @@ -0,0 +1,78 @@ +using System; +using LitJson; +using UnityEngine; + +namespace Wizard.Lottery; + +public class LotteryLoadTaskData +{ + private bool IsEnable { get; set; } + + private DateTime StartTime { get; set; } + + private DateTime EndTime { get; set; } + + private DateTime CloseTime { get; set; } + + private int ReceiveServerTime { get; set; } + + private double ReceiveSinceStartUpTime { get; set; } + + public bool IsExistReward { get; private set; } + + public static LotteryLoadTaskData Parse(JsonData json) + { + LotteryLoadTaskData lotteryLoadTaskData = new LotteryLoadTaskData(); + if (json["data"].Keys.Contains("lottery_period_info")) + { + JsonData jsonData = json["data"]["lottery_period_info"]; + if (jsonData != null) + { + DateTime startTime = DateTime.Parse(jsonData["start_time"].ToString()); + DateTime endTime = DateTime.Parse(jsonData["end_time"].ToString()); + lotteryLoadTaskData.IsEnable = true; + lotteryLoadTaskData.StartTime = startTime; + lotteryLoadTaskData.EndTime = endTime; + lotteryLoadTaskData.CloseTime = DateTime.Parse(jsonData["close_time"].ToString()); + lotteryLoadTaskData.ReceiveServerTime = json["data_headers"]["servertime"].ToInt(); + lotteryLoadTaskData.ReceiveSinceStartUpTime = Time.realtimeSinceStartup; + lotteryLoadTaskData.IsExistReward = jsonData["has_reward"].ToBoolean(); + } + else + { + lotteryLoadTaskData.IsEnable = false; + } + } + else + { + lotteryLoadTaskData.IsEnable = false; + } + return lotteryLoadTaskData; + } + + public bool IsCampaignTimeNow() + { + return IsTimeEnablePeriod(StartTime, EndTime); + } + + public bool IsReceiveTimeNow() + { + return IsTimeEnablePeriod(StartTime, CloseTime); + } + + private bool IsTimeEnablePeriod(DateTime start, DateTime end) + { + if (!IsEnable) + { + return false; + } + double num = ConvertTime.DateTimeToUnixTime(start); + double num2 = ConvertTime.DateTimeToUnixTime(end); + double num3 = (double)((float)ReceiveServerTime + Time.realtimeSinceStartup) - ReceiveSinceStartUpTime; + if (num3 < num || num3 >= num2) + { + return false; + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryMissionData.cs b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryMissionData.cs new file mode 100644 index 0000000..de445cb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryMissionData.cs @@ -0,0 +1,57 @@ +using LitJson; + +namespace Wizard.Lottery; + +public class LotteryMissionData +{ + public int MissionId { get; private set; } + + public string MissionTitle { get; private set; } + + public UserGoods.Type UserGoodsType { get; private set; } + + public int ItemId { get; private set; } + + public int ItemCount { get; private set; } + + public RemainTime StartTime { get; private set; } + + public RemainTime EndTime { get; private set; } + + public int MissionCurrent { get; private set; } + + public int MissionMax { get; private set; } + + public bool IsCleared { get; private set; } + + public bool IsTimeOver { get; private set; } + + public float MissionRatio + { + get + { + if (MissionMax == 0) + { + return 0f; + } + return (float)MissionCurrent / (float)MissionMax; + } + } + + public LotteryMissionData(JsonData json, double serverTime) + { + MissionId = json["mission_id"].ToInt(); + ItemId = json["reward_detail_id"].ToInt(); + UserGoodsType = (UserGoods.Type)json["reward_type"].ToInt(); + ItemCount = json["reward_number"].ToInt(); + MissionTitle = json["mission_name"].ToString(); + MissionCurrent = json["total_count"].ToInt(); + MissionMax = json["require_number"].ToInt(); + IsCleared = json["is_achieved"].ToInt() == 1; + IsTimeOver = json["is_failed"].ToInt() == 1; + string endTime = ConvertTime.UnixTimeToDateTime(json["start_time"].ToInt()).ToString(); + string endTime2 = ConvertTime.UnixTimeToDateTime(json["end_time"].ToInt()).ToString(); + StartTime = new RemainTime(endTime, serverTime); + EndTime = new RemainTime(endTime2, serverTime); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/CandidateCard.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/CandidateCard.cs new file mode 100644 index 0000000..361a07f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/CandidateCard.cs @@ -0,0 +1,32 @@ +using LitJson; + +namespace Wizard.Scripts.Network.Data.TableData.Arena.TwoPick; + +public class CandidateCard +{ + public int id; + + public int turn; + + public int setNum; + + public int cardId1; + + public int cardId2; + + public bool isSelected; + + public CandidateCard() + { + } + + public CandidateCard(JsonData data) + { + id = data["id"].ToInt(); + turn = data["turn"].ToInt(); + setNum = data["set_num"].ToInt(); + cardId1 = data["card_id_1"].ToInt(); + cardId2 = data["card_id_2"].ToInt(); + isSelected = data["is_selected"].ToInt() == 1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/CandidateChaos.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/CandidateChaos.cs new file mode 100644 index 0000000..6c5ba6d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/CandidateChaos.cs @@ -0,0 +1,85 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard.Scripts.Network.Data.TableData.Arena.TwoPick; + +public class CandidateChaos +{ + public class ChaosCharaData + { + public int ChaosId; + + public int ClassId; + + public int CharaId; + + public int[] SourceClassIds; + } + + private const int CHAOS_CHARA_DATA_NUM = 3; + + public ChaosCharaData[] CharaData; + + public int SelectedChaosId; + + public int SelectedCharaId; + + public int SelectedClassId; + + public CandidateChaos() + { + } + + public CandidateChaos(JsonData chaosInfoData, JsonData classInfoData) + { + CharaData = new ChaosCharaData[3]; + for (int i = 0; i < 3; i++) + { + CharaData[i] = GetChaosCharaData(chaosInfoData, classInfoData[$"chaos_id_{i + 1}"].ToString()); + } + } + + public CandidateChaos(JsonData chaosInfoData, List idList) + { + CharaData = new ChaosCharaData[3]; + for (int i = 0; i < 3; i++) + { + CharaData[i] = GetChaosCharaData(chaosInfoData, idList[i]); + } + } + + public CandidateChaos(JsonData data) + { + SelectedChaosId = data["selected_chaos_id"].ToInt(); + SelectedCharaId = data["selected_leader_skin_id"].ToInt(); + SelectedClassId = data["selected_class_id"].ToInt(); + CharaData = new ChaosCharaData[3]; + JsonData chaosInfoData = data["chaos_info"]; + for (int i = 0; i < 3; i++) + { + CharaData[i] = GetChaosCharaData(chaosInfoData, data[$"chaos_id_{i + 1}"].ToString()); + } + } + + public static ChaosCharaData GetChaosCharaData(JsonData chaosInfoData, string chaosIdString) + { + if (!chaosInfoData.TryGetValue(chaosIdString, out var value)) + { + return null; + } + ChaosCharaData chaosCharaData = new ChaosCharaData + { + ChaosId = value["chaos_id"].ToInt(), + ClassId = value["main_class_id"].ToInt(), + CharaId = value["leader_skin_id"].ToInt() + }; + JsonData jsonData = value["usable_class_ids"]; + int[] array = new int[jsonData.Count]; + for (int i = 0; i < jsonData.Count; i++) + { + array[i] = jsonData[i].ToInt(); + } + chaosCharaData.SourceClassIds = array; + return chaosCharaData; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/CandidateClass.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/CandidateClass.cs new file mode 100644 index 0000000..39aac8a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/CandidateClass.cs @@ -0,0 +1,56 @@ +using LitJson; + +namespace Wizard.Scripts.Network.Data.TableData.Arena.TwoPick; + +public class CandidateClass +{ + public int classId1; + + public int classId2; + + public int classId3; + + public int classId4; + + public int selectedClassId; + + public int charaId1; + + public int charaId2; + + public int charaId3; + + public int selectedCharacterId; + + public int SelectedChaosId { get; private set; } + + public CandidateClass() + { + } + + public CandidateClass(JsonData data) + { + if (data.Keys.Contains("class_id_1")) + { + classId1 = data["class_id_1"].ToInt(); + classId2 = data["class_id_2"].ToInt(); + classId3 = data["class_id_3"].ToInt(); + if (data.Keys.Contains("class_id_4")) + { + classId4 = data["class_id_4"].ToInt(); + } + } + else + { + classId1 = data["chaos_id_1"].ToInt(); + classId2 = data["chaos_id_2"].ToInt(); + classId3 = data["chaos_id_3"].ToInt(); + if (data.Keys.Contains("chaos_id_4")) + { + classId4 = data["chaos_id_4"].ToInt(); + } + } + selectedClassId = data["selected_class_id"].ToInt(); + SelectedChaosId = data.GetValueOrDefault("selected_chaos_id", 0); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/Deck.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/Deck.cs new file mode 100644 index 0000000..2eb4860 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/Deck.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard.Scripts.Network.Data.TableData.Arena.TwoPick; + +public class Deck +{ + public int entryId; + + public int classId; + + public int skinId; + + public int[] cardIds; + + public bool isSelectCompleted; + + public int selectTurn; + + public Deck() + { + } + + public Deck(JsonData data) + { + if (data != null) + { + ICollection keys = data.Keys; + if (keys.Contains("two_pick_entry_id")) + { + entryId = data["two_pick_entry_id"].ToInt(); + } + if (keys.Contains("class_id")) + { + classId = data["class_id"].ToInt(); + } + isSelectCompleted = data["is_select_completed"].ToInt() == 1; + JsonData jsonData = data["selected_card_ids"]; + cardIds = new int[jsonData.Count]; + for (int i = 0; i < cardIds.Length; i++) + { + cardIds[i] = jsonData[i].ToInt(); + } + selectTurn = data["select_turn"].ToInt(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/EntryInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/EntryInfo.cs new file mode 100644 index 0000000..c2de139 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Arena.TwoPick/EntryInfo.cs @@ -0,0 +1,26 @@ +using LitJson; + +namespace Wizard.Scripts.Network.Data.TableData.Arena.TwoPick; + +public class EntryInfo +{ + public int rewardScheduleId; + + public int maxBattleCount; + + public bool isRetire; + + public EntryInfo() + { + } + + public EntryInfo(JsonData data) + { + if (data != null) + { + rewardScheduleId = data["reward_schedule_id"].ToInt(); + maxBattleCount = data["max_battle_count"].ToInt(); + isRetire = data["is_retire"].ToInt() == 1; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/MyMasterRanking.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/MyMasterRanking.cs new file mode 100644 index 0000000..bd2bf50 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/MyMasterRanking.cs @@ -0,0 +1,56 @@ +using System; +using LitJson; + +namespace Wizard.Scripts.Network.Data.TableData.Ranking; + +public class MyMasterRanking +{ + public int periodId; + + public int periodNum; + + public DateTime beginTime; + + public string endTime; + + public bool isCalculated; + + public int rank; + + public int score; + + public int _masterRankId; + + public MyMasterRanking(JsonData periods, JsonData histories) + { + if (periods == null || histories == null) + { + Initialize(); + return; + } + periodId = periods["id"].ToInt(); + periodNum = periods["period_num"].ToInt(); + beginTime = DateTime.Parse(periods["begin_time"].ToString()); + endTime = periods["end_time"].ToString(); + isCalculated = periods["is_calculated"].ToBoolean(); + JsonData jsonData = histories[periodId.ToString()]; + rank = jsonData["rank"].ToInt(); + score = jsonData["score"].ToInt(); + if (jsonData.Keys.Contains("rank_id")) + { + _masterRankId = jsonData["rank_id"].ToInt(); + } + } + + private void Initialize() + { + periodId = 0; + periodNum = 0; + beginTime = default(DateTime); + endTime = string.Empty; + isCalculated = false; + rank = 0; + score = 0; + _masterRankId = 0; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/RankingPeriod.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/RankingPeriod.cs new file mode 100644 index 0000000..0ff8381 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/RankingPeriod.cs @@ -0,0 +1,70 @@ +using System; +using LitJson; + +namespace Wizard.Scripts.Network.Data.TableData.Ranking; + +public class RankingPeriod +{ + public int id; + + public int periodNum; + + public bool hasHistory; + + public DateTime beginTime; + + public string endTime; + + public int _detailType; + + public int IsAfter460; + + private const string TYPE_KEY = "type"; + + private const string KEY_460 = "over_460"; + + public RankingPeriod() + { + Initialize(); + } + + public bool IsSamePeriod(RankingPeriod time) + { + if (time.beginTime == beginTime) + { + return time.endTime == endTime; + } + return false; + } + + public RankingPeriod(JsonData data) + { + if (data == null) + { + Initialize(); + return; + } + id = data["id"].ToInt(); + periodNum = data["period_num"].ToInt(); + hasHistory = true; + beginTime = DateTime.Parse(data["begin_time"].ToString()); + endTime = data["end_time"].ToString(); + if (data.Keys.Contains("type")) + { + _detailType = data["type"].ToInt(); + } + if (data.TryGetValue("over_460", out var value)) + { + IsAfter460 = value.ToInt(); + } + } + + private void Initialize() + { + id = 0; + periodNum = 0; + hasHistory = false; + beginTime = new DateTime(0L); + endTime = ""; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/RankingPeriodList.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/RankingPeriodList.cs new file mode 100644 index 0000000..6a704f2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/RankingPeriodList.cs @@ -0,0 +1,46 @@ +using System.Collections; +using System.Collections.Generic; +using LitJson; + +namespace Wizard.Scripts.Network.Data.TableData.Ranking; + +public class RankingPeriodList : HeaderData +{ + public List Master { get; private set; } + + public List RankMatchClass { get; private set; } + + public List TwoPick { get; private set; } + + public List Sealed { get; private set; } + + public List CrossoverMasterPoint { get; private set; } + + public List CrossoverClassWin { get; private set; } + + public RankingPeriodList(JsonData data) + { + Master = ToPeriodList(data["master_point"]); + RankMatchClass = ToPeriodList(data["rank_match"]); + TwoPick = ToPeriodList(data["two_pick"]); + Sealed = ToPeriodList(data["sealed"]); + if (data.TryGetValue("crossover_master_point", out var value)) + { + CrossoverMasterPoint = ToPeriodList(value); + } + if (data.TryGetValue("crossover_rank_match", out var value2)) + { + CrossoverClassWin = ToPeriodList(value2); + } + } + + private static List ToPeriodList(JsonData data) + { + List list = new List(); + foreach (JsonData item in (IEnumerable)data) + { + list.Add(new RankingPeriod(item)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/RankingUser.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/RankingUser.cs new file mode 100644 index 0000000..1bf3b06 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData.Ranking/RankingUser.cs @@ -0,0 +1,57 @@ +using System; +using LitJson; + +namespace Wizard.Scripts.Network.Data.TableData.Ranking; + +public class RankingUser +{ + public int viewerId; + + public int rankingRank; + + public int score; + + public string name; + + public string countryCode; + + public int rank; + + public long emblemId; + + public int degreeId; + + public DateTime lastPlayTime; + + public RankingUser(JsonData data) + { + if (data == null) + { + Initialize(); + return; + } + viewerId = data["viewer_id"].ToInt(); + rankingRank = data["ranking_rank"].ToInt(); + score = data["score"].ToInt(); + name = data["name"].ToString(); + countryCode = (string)data["country_code"]; + rank = data["rank"].ToInt(); + emblemId = data["emblem_id"].ToLong(); + degreeId = data["degree_id"].ToInt(); + string text = data["last_play_time"].ToString(); + lastPlayTime = (string.IsNullOrEmpty(text) ? default(DateTime) : DateTime.Parse(text)); + } + + private void Initialize() + { + viewerId = 0; + rankingRank = 0; + score = 0; + rank = 0; + name = ""; + countryCode = ""; + emblemId = 0L; + degreeId = 0; + lastPlayTime = new DateTime(0L); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData/ItemAcquireHistory.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData/ItemAcquireHistory.cs new file mode 100644 index 0000000..4320e75 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TableData/ItemAcquireHistory.cs @@ -0,0 +1,33 @@ +using System; +using LitJson; + +namespace Wizard.Scripts.Network.Data.TableData; + +public class ItemAcquireHistory +{ + public int RewardType { get; private set; } + + public long RewardUserGoodsId { get; private set; } + + public int RewardCount { get; private set; } + + public string Message { get; private set; } + + public int AcquireType { get; private set; } + + public DateTime AcquireTime { get; private set; } + + public ItemAcquireHistory() + { + } + + public ItemAcquireHistory(JsonData data) + { + RewardType = data["reward_type"].ToInt(); + RewardUserGoodsId = data["reward_detail_id"].ToLong(); + RewardCount = data["reward_count"].ToInt(); + Message = data["message"].ToString(); + AcquireType = data["acquire_type"].ToInt(); + AcquireTime = DateTime.Parse(data["acquire_time"].ToString()); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick/BattleResult.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick/BattleResult.cs new file mode 100644 index 0000000..0706a50 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick/BattleResult.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick; + +public class BattleResult +{ + public int winCount; + + public List resultList = new List(); + + public BattleResult() + { + } + + public BattleResult(JsonData data) + { + JsonData jsonData = data["result_list"]; + resultList = new List(); + for (int i = 0; i < jsonData.Count; i++) + { + bool item = jsonData[i].ToInt() == 1; + resultList.Add(item); + } + winCount = data["win_count"].ToInt(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick/CandidateCardInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick/CandidateCardInfo.cs new file mode 100644 index 0000000..dff96b4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick/CandidateCardInfo.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using LitJson; +using Wizard.Scripts.Network.Data.TableData.Arena.TwoPick; + +namespace Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick; + +public class CandidateCardInfo +{ + public List candidateCards; + + public CandidateCardInfo() + { + } + + public CandidateCardInfo(JsonData data) + { + candidateCards = new List(); + for (int i = 0; i < data.Count; i++) + { + CandidateCard item = new CandidateCard(data[i]); + candidateCards.Add(item); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick/Entry.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick/Entry.cs new file mode 100644 index 0000000..0bb89ea --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick/Entry.cs @@ -0,0 +1,24 @@ +using LitJson; + +namespace Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick; + +public class Entry : HeaderData +{ + public int[] candidateClassIds; + + public Entry() + { + } + + public Entry(JsonData data) + { + JsonData jsonData = null; + jsonData = ((!data.Keys.Contains("candidate_class_ids")) ? data["candidate_chaos_ids"] : data["candidate_class_ids"]); + candidateClassIds = new int[jsonData.Count]; + for (int i = 0; i < jsonData.Count; i++) + { + int num = jsonData[i].ToInt(); + candidateClassIds[i] = num; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena/Finish.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena/Finish.cs new file mode 100644 index 0000000..c18fc90 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena/Finish.cs @@ -0,0 +1,11 @@ +namespace Wizard.Scripts.Network.Data.TaskData.Arena; + +public class Finish : HeaderData +{ + public FinishDetail data; + + public Finish() + { + data = new FinishDetail(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena/FinishDetail.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena/FinishDetail.cs new file mode 100644 index 0000000..cd3edc2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena/FinishDetail.cs @@ -0,0 +1,10 @@ +namespace Wizard.Scripts.Network.Data.TaskData.Arena; + +public class FinishDetail : MatchFinishBase +{ + public FinishDetail() + { + class_chara_experience = 0; + class_chara_level = 0; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena/TwoPickInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena/TwoPickInfo.cs new file mode 100644 index 0000000..f0311c6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Arena/TwoPickInfo.cs @@ -0,0 +1,154 @@ +using System.Collections; +using System.Collections.Generic; +using LitJson; +using Wizard.Scripts.Network.Data.TableData.Arena.TwoPick; +using Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick; + +namespace Wizard.Scripts.Network.Data.TaskData.Arena; + +public class TwoPickInfo +{ + public enum PREPARE_STATE + { + NO_ENTRY, + CLASS_SELECT, + CARD_SELECT, + SETTING_COMPLETED + } + + public EntryInfo entryInfo; + + public CandidateClass classInfo; + + public CandidateChaos chaosInfo; + + public CandidateCardInfo candidateCardInfo; + + public Deck deckInfo; + + public BattleResult battleResult = new BattleResult(); + + public CampaignBattleWin TreasureCP = new CampaignBattleWin(); + + public List entryRewardList = new List(); + + public TwoPickInfo() + { + } + + public TwoPickInfo(JsonData data, JsonData headerData) + { + SetEntryInfo(data["entry_info"]); + if (data.Keys.Contains("class_info")) + { + SetClassInfo(data["class_info"]); + } + if (data.Keys.Contains("chaos_info") && data["chaos_info"] != null) + { + if (data.Keys.Contains("candidate_chaos_ids")) + { + SetChaosInfoFormEntry(data["chaos_info"], data["candidate_chaos_ids"]); + } + else + { + SetChaosInfo(data["chaos_info"], data["class_info"]); + } + } + if (data.Keys.Contains("deck_info")) + { + SetDeckInfo(data["deck_info"]); + } + if (data.Keys.Contains("candidate_card_list")) + { + SetCandidateCardList(data["candidate_card_list"]); + } + if (data.Keys.Contains("battle_results")) + { + SetBattleResult(data["battle_results"]); + } + if (data.Keys.Contains("leader_skin_id")) + { + GameMgr.GetIns().GetDataMgr().GetClassPrm(classInfo.selectedClassId) + .SetCurrentCharaId(data["leader_skin_id"].ToInt()); + } + if (data.TryGetValue("treasure_info", out var value)) + { + TreasureCP.Parse(value); + } + if (data.TryGetValue("upgrade_treasure_box_info", out var value2)) + { + Wizard.Data.TreasureBoxCp.Parse(value2, headerData); + } + } + + public void SetEntryInfo(JsonData entryInfoData) + { + entryInfo = new EntryInfo(entryInfoData); + } + + public void SetClassInfo(JsonData classInfoData) + { + classInfo = new CandidateClass(classInfoData); + } + + public void SetChaosInfo(JsonData chaosInfoData, JsonData classInfoData) + { + chaosInfo = new CandidateChaos(chaosInfoData, classInfoData); + } + + public void SetChaosInfoFormEntry(JsonData chaosInfoData, JsonData classIds) + { + List list = new List(); + foreach (object item in (IEnumerable)classIds) + { + list.Add(item.ToString()); + } + chaosInfo = new CandidateChaos(chaosInfoData, list); + } + + public void SetDeckInfo(JsonData deckInfoData) + { + deckInfo = new Deck(deckInfoData); + } + + public void SetCandidateCardList(JsonData candidateCardListData) + { + candidateCardInfo = new CandidateCardInfo(candidateCardListData); + } + + public void SetBattleResult(JsonData battleResultInfoData) + { + battleResult = new BattleResult(battleResultInfoData); + } + + public void SetEntryRewardList(JsonData rewards) + { + entryRewardList = new List(); + for (int i = 0; i < rewards.Count; i++) + { + ReceivedReward item = new ReceivedReward(rewards[i]); + entryRewardList.Add(item); + } + } + + public PREPARE_STATE GetPrepareState() + { + if (entryInfo == null) + { + return PREPARE_STATE.NO_ENTRY; + } + if (classInfo != null && classInfo.selectedClassId == 0) + { + return PREPARE_STATE.CLASS_SELECT; + } + if (deckInfo != null && !deckInfo.isSelectCompleted) + { + return PREPARE_STATE.CARD_SELECT; + } + if (deckInfo != null && deckInfo.isSelectCompleted) + { + return PREPARE_STATE.SETTING_COMPLETED; + } + return PREPARE_STATE.NO_ENTRY; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Battle/DoMatchingResponse.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Battle/DoMatchingResponse.cs new file mode 100644 index 0000000..18d7717 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Battle/DoMatchingResponse.cs @@ -0,0 +1,20 @@ +using LitJson; + +namespace Wizard.Scripts.Network.Data.TaskData.Battle; + +public class DoMatchingResponse +{ + public int battleState; + + public int matchingState; + + public DoMatchingResponse() + { + } + + public DoMatchingResponse(JsonData data) + { + battleState = data["battle_state"].ToInt(); + matchingState = data["matching_state"].ToInt(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckBuyTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckBuyTask.cs new file mode 100644 index 0000000..f2cc0ab --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckBuyTask.cs @@ -0,0 +1,85 @@ +using System.Collections.Generic; +using LitJson; +using Wizard.Lottery; + +namespace Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase; + +public class BuildDeckBuyTask : BaseTask +{ + public class BuildDeckBuySingleTaskParam : BaseParam + { + public int product_id; + + public int sales_type; + } + + public List _seriesRewardList = new List(); + + public List LotteryRewardList = new List(); + + public List MissionRewardList = new List(); + + public LotteryApplyData LotteryData { get; private set; } + + public List NotificatonAnimationParams { get; set; } + + public BuildDeckBuyTask() + { + base.type = ApiType.Type.BuildDeckBuy; + LotteryData = LotteryApplyData.EmptyData(); + } + + public void SetParameter(int productId, ShopCommonUtility.SalesType sales_type) + { + BuildDeckBuySingleTaskParam buildDeckBuySingleTaskParam = new BuildDeckBuySingleTaskParam(); + buildDeckBuySingleTaskParam.product_id = productId; + buildDeckBuySingleTaskParam.sales_type = (int)sales_type; + base.Params = buildDeckBuySingleTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + JsonData jsonData = base.ResponseData["data"]["series_rewards"]; + for (int i = 0; i < jsonData.Count; i++) + { + ShopCommonRewardInfo shopCommonRewardInfo = new ShopCommonRewardInfo(); + shopCommonRewardInfo.Type = jsonData[i]["reward_type"].ToInt(); + shopCommonRewardInfo.UserGoodsId = jsonData[i]["reward_detail_id"].ToLong(); + shopCommonRewardInfo.Num = jsonData[i]["reward_number"].ToInt(); + _seriesRewardList.Add(shopCommonRewardInfo); + } + LotteryData = LotteryApplyData.Parse(base.ResponseData["data"]); + if (base.ResponseData["data"].TryGetValue("achieved_info", out var value)) + { + if (value.TryGetValue("achieved_mission_reward_list", out var value2)) + { + for (int j = 0; j < value2.Count; j++) + { + if (LotteryData.IsEnable) + { + LotteryRewardList.Add(ReceivedReward.CreateFromBattleResult(value2[j])); + } + else + { + MissionRewardList.Add(ReceivedReward.CreateFromBattleResult(value2[j])); + } + } + } + if (value.TryGetValue("achieved_mission_list", out var value3)) + { + NotificatonAnimationParams = new List(); + for (int k = 0; k < value3.Count; k++) + { + NotificatonAnimationParams.Add(new NotificatonAnimation.Param(NotificatonAnimation.Param.Type.TemporaryDeckResult, value3[k]["achieved_message"].ToString())); + } + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckProductInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckProductInfo.cs new file mode 100644 index 0000000..796dc2e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckProductInfo.cs @@ -0,0 +1,83 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase; + +public class BuildDeckProductInfo +{ + private List _cardList = new List(); + + private List _rewardInfoList = new List(); + + public int product_id { get; set; } + + public string deck_code { get; set; } + + public int leader_id { get; set; } + + public int featured_card_id { get; set; } + + public int purchase_num_max { get; set; } + + public int purchase_num_current { get; set; } + + public bool is_first_price { get; set; } + + public bool is_purchased + { + get + { + if (purchase_num_max <= purchase_num_current) + { + return true; + } + return false; + } + } + + public ShopCommonSaleInfo saleInfo { get; set; } + + public List cardList => _cardList; + + public List rewardInfoList => _rewardInfoList; + + public List CardIdList + { + get + { + List list = new List(); + for (int i = 0; i < cardList.Count; i++) + { + for (int j = 0; j < cardList[i]._number; j++) + { + list.Add(cardList[i]._cardId); + } + } + return list; + } + } + + public bool HasResurgentCard + { + get + { + CardMaster cardMaster = CardMaster.GetInstance(CardMaster.CardMasterId.Default); + return _cardList.Any((BuildDeckCard card) => cardMaster.GetCardParameterFromId(card._cardId).IsResurgentCard); + } + } + + public bool ContainsOnlyRotationCards() + { + CardMaster master = CardMaster.GetInstance(CardMaster.CardMasterId.Default); + List source = _cardList.ConvertAll((BuildDeckCard card) => master.GetCardParameterFromId(card._cardId).BaseCardId); + source = source.Distinct().ToList(); + for (int num = 0; num < source.Count; num++) + { + if (!master.GetCardParameterFromId(source[num]).IsAvailableFormat(Format.Rotation, ClassType.None)) + { + return false; + } + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckPurchaseInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckPurchaseInfo.cs new file mode 100644 index 0000000..e4e57a0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckPurchaseInfo.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; + +namespace Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase; + +public class BuildDeckPurchaseInfo +{ + private List _seriesList = new List(); + + public List seriesList => _seriesList; + + public BuildDeckProductInfo GetProductInfo(int productID) + { + foreach (BuildDeckSeriesPurchaseInfo series in _seriesList) + { + foreach (BuildDeckProductInfo product in series.productList) + { + if (product.product_id == productID) + { + return product; + } + } + } + return null; + } + + public int GetSeriesId(int productID) + { + foreach (BuildDeckSeriesPurchaseInfo series in _seriesList) + { + foreach (BuildDeckProductInfo product in series.productList) + { + if (product.product_id == productID) + { + return series._seriesId; + } + } + } + return -1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckSeriesPurchaseInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckSeriesPurchaseInfo.cs new file mode 100644 index 0000000..f53981b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase/BuildDeckSeriesPurchaseInfo.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase; + +public class BuildDeckSeriesPurchaseInfo +{ + private List _productList = new List(); + + private List _seriesRewardList = new List(); + + public int _seriesId { get; set; } + + public string _introduction { get; set; } + + public bool _isNew { get; set; } + + public List productList => _productList; + + public List SeriesRewardList => _seriesRewardList; +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseBuyTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseBuyTask.cs new file mode 100644 index 0000000..f375215 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseBuyTask.cs @@ -0,0 +1,35 @@ +namespace Wizard.Scripts.Network.Data.TaskData.ItemPurchase; + +public class ItemPurchaseBuyTask : BaseTask +{ + public class ItemPurchaseBuyTaskParam : BaseParam + { + public int purchase_id; + + public int rest; + } + + public ItemPurchaseBuyTask() + { + base.type = ApiType.Type.ItemPurchaseBuy; + } + + public void SetParameter(int purchaseId, int rest) + { + ItemPurchaseBuyTaskParam itemPurchaseBuyTaskParam = new ItemPurchaseBuyTaskParam(); + itemPurchaseBuyTaskParam.purchase_id = purchaseId; + itemPurchaseBuyTaskParam.rest = rest; + base.Params = itemPurchaseBuyTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseData.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseData.cs new file mode 100644 index 0000000..6a95426 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseData.cs @@ -0,0 +1,30 @@ +namespace Wizard.Scripts.Network.Data.TaskData.ItemPurchase; + +public class ItemPurchaseData +{ + public int purchase_id { get; set; } + + public UserGoods.Type purchase_item_type { get; set; } + + public long PurchaseUserGoodsId { get; set; } + + public int purchase_item_num { get; set; } + + public string purchase_name { get; set; } + + public UserGoods.Type require_item_type { get; set; } + + public long RequireUserGoodsId { get; set; } + + public int require_item_num { get; set; } + + public bool isMonthryReset { get; set; } + + public string purchase_begin_time { get; set; } + + public string purchase_end_time { get; set; } + + public int rest { get; set; } + + public string textureName { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseInfo.cs new file mode 100644 index 0000000..c29dd8c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseInfo.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace Wizard.Scripts.Network.Data.TaskData.ItemPurchase; + +public class ItemPurchaseInfo +{ + private List _itemPurchaseList = new List(); + + public List itemPurchaseList => _itemPurchaseList; +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Ranking/MonthlyRanking.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Ranking/MonthlyRanking.cs new file mode 100644 index 0000000..419d5c0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Ranking/MonthlyRanking.cs @@ -0,0 +1,29 @@ +using LitJson; +using Wizard.Scripts.Network.Data.TableData.Ranking; + +namespace Wizard.Scripts.Network.Data.TaskData.Ranking; + +public class MonthlyRanking : Ranking +{ + public RankingPeriod period; + + public MonthlyRanking() + { + Initialize(); + } + + public MonthlyRanking(JsonData data) + : base(data) + { + Initialize(); + if (data.Count >= 1) + { + period = new RankingPeriod(data["period"]); + } + } + + public new void Initialize() + { + period = new RankingPeriod(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Ranking/MyMasterPointHistories.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Ranking/MyMasterPointHistories.cs new file mode 100644 index 0000000..a9ccfb7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Ranking/MyMasterPointHistories.cs @@ -0,0 +1,44 @@ +using System.Collections.Generic; +using LitJson; +using Wizard.Scripts.Network.Data.TableData.Ranking; + +namespace Wizard.Scripts.Network.Data.TaskData.Ranking; + +public class MyMasterPointHistories : HeaderData +{ + public List rankingHistories; + + public MyMasterPointHistories() + { + Initialize(); + } + + public MyMasterPointHistories(JsonData data, Format inFormat) + { + Initialize(); + if (data.Count < 1) + { + return; + } + JsonData jsonData = ((inFormat == Format.Crossover) ? data["periods"]["crossover"] : data["periods"]["normal"]); + JsonData jsonData2 = data["histories"]; + for (int i = 0; i < jsonData.Count; i++) + { + string text = Wizard.Data.FormatConvertApi(inFormat).ToString(); + if (jsonData2.Keys.Contains(text)) + { + JsonData jsonData3 = jsonData[i]; + if (jsonData2[text].Keys.Contains(jsonData3["id"].ToString())) + { + MyMasterRanking item = new MyMasterRanking(jsonData[i], jsonData2[text]); + rankingHistories.Add(item); + } + } + } + } + + public void Initialize() + { + rankingHistories = new List(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Ranking/Ranking.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Ranking/Ranking.cs new file mode 100644 index 0000000..62f5ca6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.Ranking/Ranking.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using LitJson; +using Wizard.Scripts.Network.Data.TableData.Ranking; + +namespace Wizard.Scripts.Network.Data.TaskData.Ranking; + +public class Ranking : HeaderData +{ + public List rankingUserList; + + public Ranking() + { + Initialize(); + } + + public Ranking(JsonData data) + { + Initialize(); + if (data.Count >= 1) + { + for (int i = 0; i < data["ranking"].Count; i++) + { + RankingUser item = new RankingUser(data["ranking"][i]); + rankingUserList.Add(item); + } + } + } + + public void Initialize() + { + rankingUserList = new List(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinBuyMultiRewardTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinBuyMultiRewardTask.cs new file mode 100644 index 0000000..edd658d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinBuyMultiRewardTask.cs @@ -0,0 +1,34 @@ +namespace Wizard.Scripts.Network.Data.TaskData.SkinPurchase; + +public class SkinBuyMultiRewardTask : BaseTask +{ + public class SkinBuyMultiRewardTaskParam : BaseParam + { + public int series_id; + + public int sales_type; + } + + public SkinBuyMultiRewardTask() + { + base.type = ApiType.Type.SkinBuyMultiReward; + } + + public void SetParameter(int series_id) + { + SkinBuyMultiRewardTaskParam skinBuyMultiRewardTaskParam = new SkinBuyMultiRewardTaskParam(); + skinBuyMultiRewardTaskParam.series_id = series_id; + base.Params = skinBuyMultiRewardTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinBuyMultiTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinBuyMultiTask.cs new file mode 100644 index 0000000..3a97576 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinBuyMultiTask.cs @@ -0,0 +1,38 @@ +namespace Wizard.Scripts.Network.Data.TaskData.SkinPurchase; + +public class SkinBuyMultiTask : BaseTask +{ + public class SkinBuyMultiTaskParam : BaseParam + { + public int series_id; + + public int sales_type; + + public long? item_id; + } + + public SkinBuyMultiTask() + { + base.type = ApiType.Type.SkinBuyMulti; + } + + public void SetParameter(int series_id, ShopCommonUtility.SalesType sales_type, long? ticketItemId) + { + SkinBuyMultiTaskParam skinBuyMultiTaskParam = new SkinBuyMultiTaskParam(); + skinBuyMultiTaskParam.series_id = series_id; + skinBuyMultiTaskParam.sales_type = (int)sales_type; + skinBuyMultiTaskParam.item_id = ticketItemId; + base.Params = skinBuyMultiTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinBuySingleTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinBuySingleTask.cs new file mode 100644 index 0000000..7a09529 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinBuySingleTask.cs @@ -0,0 +1,38 @@ +namespace Wizard.Scripts.Network.Data.TaskData.SkinPurchase; + +public class SkinBuySingleTask : BaseTask +{ + public class SkinBuySingleTaskParam : BaseParam + { + public int product_id; + + public int sales_type; + + public long? item_id; + } + + public SkinBuySingleTask() + { + base.type = ApiType.Type.SkinBuySingle; + } + + public void SetParameter(int productId, ShopCommonUtility.SalesType sales_type, long? item_id) + { + SkinBuySingleTaskParam skinBuySingleTaskParam = new SkinBuySingleTaskParam(); + skinBuySingleTaskParam.product_id = productId; + skinBuySingleTaskParam.sales_type = (int)sales_type; + skinBuySingleTaskParam.item_id = item_id; + base.Params = skinBuySingleTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinProductInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinProductInfo.cs new file mode 100644 index 0000000..f635152 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinProductInfo.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; + +namespace Wizard.Scripts.Network.Data.TaskData.SkinPurchase; + +public class SkinProductInfo +{ + private List _rewardInfoList = new List(); + + public int product_id { get; set; } + + public string description { get; set; } + + public int leader_skin_id { get; set; } + + public string cv_name { get; set; } + + public bool is_purchased { get; set; } + + public ShopCommonSaleInfo saleInfo { get; set; } + + public List rewardInfoList => _rewardInfoList; + + public bool IsEnableBuyTicket + { + get + { + if (!saleInfo.costTicket.HasValue || !saleInfo.haveTicketNum.HasValue) + { + return false; + } + if (saleInfo.costTicket.Value > 0) + { + return saleInfo.haveTicketNum.Value > 0; + } + return false; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinPurchaseInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinPurchaseInfo.cs new file mode 100644 index 0000000..2f6fd99 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinPurchaseInfo.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace Wizard.Scripts.Network.Data.TaskData.SkinPurchase; + +public class SkinPurchaseInfo +{ + private List _SeriesList = new List(); + + public List seriesList => _SeriesList; +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinSeriesPurchaseInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinSeriesPurchaseInfo.cs new file mode 100644 index 0000000..5d8faff --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SkinPurchase/SkinSeriesPurchaseInfo.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; + +namespace Wizard.Scripts.Network.Data.TaskData.SkinPurchase; + +public class SkinSeriesPurchaseInfo +{ + public enum RewardStatus + { + none, + not_got, + got + } + + public enum eSetSalesStatus + { + None, + Enable, + Disable + } + + private List _rewardInfoList = new List(); + + private List _ProductList = new List(); + + public int series_id { get; set; } + + public string description { get; set; } + + public bool is_completed { get; set; } + + public RewardStatus _rewardStatus { get; set; } + + public bool HaveTicket { get; set; } + + public eSetSalesStatus SetSalesStatus { get; set; } + + public ShopCommonSaleInfo saleInfo { get; set; } + + public List rewardInfoList => _rewardInfoList; + + public List productList => _ProductList; + + public bool IsNew { get; set; } + + public int GetProductCount() + { + int num = productList.Count; + if (SetSalesStatus != eSetSalesStatus.None) + { + num++; + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SleevePurchase/SleeveProductInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SleevePurchase/SleeveProductInfo.cs new file mode 100644 index 0000000..b4fc5b8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SleevePurchase/SleeveProductInfo.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Wizard.Scripts.Network.Data.TaskData.SleevePurchase; + +public class SleeveProductInfo +{ + private List _rewardInfoList = new List(); + + public int product_id { get; set; } + + public ShopCommonSaleInfo saleInfo { get; set; } + + public List rewardInfoList => _rewardInfoList; + + public bool is_purchased { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SleevePurchase/SleevePurchaseInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SleevePurchase/SleevePurchaseInfo.cs new file mode 100644 index 0000000..9792a87 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SleevePurchase/SleevePurchaseInfo.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace Wizard.Scripts.Network.Data.TaskData.SleevePurchase; + +public class SleevePurchaseInfo +{ + private List m_SeriesList = new List(); + + public List seriesList => m_SeriesList; +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SleevePurchase/SleeveSeriesPurchaseInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SleevePurchase/SleeveSeriesPurchaseInfo.cs new file mode 100644 index 0000000..a969685 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SleevePurchase/SleeveSeriesPurchaseInfo.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace Wizard.Scripts.Network.Data.TaskData.SleevePurchase; + +public class SleeveSeriesPurchaseInfo +{ + private List m_ProductList = new List(); + + public int series_id { get; set; } + + public List productList => m_ProductList; + + public bool IsNew { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/GachaPointExchangeInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/GachaPointExchangeInfoTask.cs new file mode 100644 index 0000000..deb5bd1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/GachaPointExchangeInfoTask.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard.Scripts.Network.Data.TaskData.SpotCardExchange; + +public class GachaPointExchangeInfoTask : BaseTask +{ + public class GachaPointExchangeInfoTaskParam : BaseParam + { + public int odds_gacha_id; + + public int parent_gacha_id; + } + + public Dictionary> ExchangeableRewardListInClassDict { get; private set; } + + public GachaPointExchangeInfoTask() + { + base.type = ApiType.Type.GachaPointInfo; + } + + public void SetParameter(int oddsGachaId, int gachaPointPackId) + { + GachaPointExchangeInfoTaskParam gachaPointExchangeInfoTaskParam = new GachaPointExchangeInfoTaskParam(); + gachaPointExchangeInfoTaskParam.odds_gacha_id = oddsGachaId; + gachaPointExchangeInfoTaskParam.parent_gacha_id = gachaPointPackId; + base.Params = gachaPointExchangeInfoTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + ExchangeableRewardListInClassDict = new Dictionary>(); + for (CardBasePrm.ClanType clanType = CardBasePrm.ClanType.ALL; clanType < CardBasePrm.ClanType.MAX; clanType++) + { + ExchangeableRewardListInClassDict[clanType] = new List(); + } + JsonData jsonData2 = jsonData["gacha_point_rewards"]; + for (int i = 0; i < jsonData2.Count; i++) + { + GachaPointExchangeInfo gachaPointExchangeInfo = new GachaPointExchangeInfo(jsonData2[i]); + ExchangeableRewardListInClassDict[gachaPointExchangeInfo.Class].Add(gachaPointExchangeInfo); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/GachaPointExchangeTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/GachaPointExchangeTask.cs new file mode 100644 index 0000000..08b26b7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/GachaPointExchangeTask.cs @@ -0,0 +1,38 @@ +namespace Wizard.Scripts.Network.Data.TaskData.SpotCardExchange; + +public class GachaPointExchangeTask : BaseTask +{ + public class GachaPointExchangeTaskParam : BaseParam + { + public int card_id; + + public int parent_gacha_id; + + public int odds_gacha_id; + } + + public GachaPointExchangeTask() + { + base.type = ApiType.Type.GachaPointExchange; + } + + public void SetParameter(int cardId, int parentGachaId, int oddsId) + { + GachaPointExchangeTaskParam gachaPointExchangeTaskParam = new GachaPointExchangeTaskParam(); + gachaPointExchangeTaskParam.card_id = cardId; + gachaPointExchangeTaskParam.parent_gacha_id = parentGachaId; + gachaPointExchangeTaskParam.odds_gacha_id = oddsId; + base.Params = gachaPointExchangeTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/SpotCardExchangeInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/SpotCardExchangeInfoTask.cs new file mode 100644 index 0000000..e4662c3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/SpotCardExchangeInfoTask.cs @@ -0,0 +1,77 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard.Scripts.Network.Data.TaskData.SpotCardExchange; + +public class SpotCardExchangeInfoTask : BaseTask +{ + public class PrereleaseExchangeInfo + { + private int _exchangeablePrereleaseCardLimit; + + private int _exchangedPrereleaseCardCount; + + public bool IsPrerelease { get; private set; } + + public int RemainingExchangeableCount + { + get + { + if (IsPrerelease) + { + return _exchangeablePrereleaseCardLimit - _exchangedPrereleaseCardCount; + } + return 0; + } + } + + public PrereleaseExchangeInfo(JsonData jsonData) + { + IsPrerelease = jsonData["is_pre_release"].ToBoolean(); + _exchangeablePrereleaseCardLimit = jsonData["pre_release_spot_card_exchange_limit"].ToInt(); + _exchangedPrereleaseCardCount = jsonData["pre_release_spot_card_exchange_count"].ToInt(); + } + } + + public Dictionary> ExchangeableSpotCardListInClassDict { get; private set; } + + public int NextCycleOutPackId { get; private set; } + + public PrereleaseExchangeInfo PrereleaseInfo { get; private set; } + + public SpotCardExchangeInfoTask() + { + base.type = ApiType.Type.SpotCardInfo; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + PlayerStaticData.UserSpotCardPointCount = jsonData["spot_point"].ToInt(); + ExchangeableSpotCardListInClassDict = new Dictionary>(); + for (CardBasePrm.ClanType clanType = CardBasePrm.ClanType.ALL; clanType < CardBasePrm.ClanType.MAX; clanType++) + { + ExchangeableSpotCardListInClassDict[clanType] = new List(); + JsonData jsonData2 = jsonData["exchangeable_card_list"][(int)clanType]; + List list = new List(jsonData2.Keys); + for (int i = 0; i < list.Count; i++) + { + JsonData jsonData3 = jsonData2[list[i]]; + for (int j = 0; j < jsonData3.Count; j++) + { + SpotCardExchangeInfo item = new SpotCardExchangeInfo(jsonData3[j], int.Parse(list[i])); + ExchangeableSpotCardListInClassDict[clanType].Add(item); + } + } + } + int.TryParse(jsonData["soon_cycle_out_card_set_id"].ToString(), out var result); + NextCycleOutPackId = result; + PrereleaseInfo = new PrereleaseExchangeInfo(jsonData["pre_relase_info"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/SpotCardExchangeTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/SpotCardExchangeTask.cs new file mode 100644 index 0000000..cce61d2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.SpotCardExchange/SpotCardExchangeTask.cs @@ -0,0 +1,35 @@ +namespace Wizard.Scripts.Network.Data.TaskData.SpotCardExchange; + +public class SpotCardExchangeTask : BaseTask +{ + public class SpotCardExchangeTaskParam : BaseParam + { + public int card_id; + + public int exchange_point; + } + + public SpotCardExchangeTask() + { + base.type = ApiType.Type.SpotCardExchange; + } + + public void SetParameter(int cardId, int exchangePoint) + { + SpotCardExchangeTaskParam spotCardExchangeTaskParam = new SpotCardExchangeTaskParam(); + spotCardExchangeTaskParam.card_id = cardId; + spotCardExchangeTaskParam.exchange_point = exchangePoint; + base.Params = spotCardExchangeTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData/ItemAcquireHistoryInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData/ItemAcquireHistoryInfo.cs new file mode 100644 index 0000000..2ad93e7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData/ItemAcquireHistoryInfo.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using LitJson; +using Wizard.Scripts.Network.Data.TableData; + +namespace Wizard.Scripts.Network.Data.TaskData; + +public class ItemAcquireHistoryInfo +{ + public List Histories { get; private set; } + + public ItemAcquireHistoryInfo() + { + } + + public ItemAcquireHistoryInfo(JsonData data) + { + Histories = new List(); + for (int i = 0; i < data.Count; i++) + { + ItemAcquireHistory item = new ItemAcquireHistory(data[i]); + Histories.Add(item); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAccelerate.cs b/SVSim.BattleEngine/Engine/Wizard/AIAccelerate.cs new file mode 100644 index 0000000..4f5c6d4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAccelerate.cs @@ -0,0 +1,32 @@ +namespace Wizard; + +public class AIAccelerate : AIScriptArgumentExpressions +{ + public AIAccelerate(string text) + : base(text) + { + } + + public void RegisterSelfToOwner(AIVirtualCard owner, AIVirtualField field, AIConditionExpressions cond) + { + int num = 0; + while (num < _exprList.Count) + { + AIAccelerateInformation aIAccelerateInformation = new AIAccelerateInformation(); + aIAccelerateInformation.Cost = (int)EvalArg(num, owner, EnemyAI.EmptyPlayPtn, field, null); + num++; + if (num < _exprList.Count) + { + aIAccelerateInformation.CardId = EvalID(num); + if (!cond.IsEmpty) + { + aIAccelerateInformation.SetCondition(cond); + } + owner.AccelerateCostList = AIParamQuery.AddElementToList(aIAccelerateInformation, owner.AccelerateCostList); + num++; + continue; + } + break; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAfterAttackBanish.cs b/SVSim.BattleEngine/Engine/Wizard/AIAfterAttackBanish.cs new file mode 100644 index 0000000..03ffce2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAfterAttackBanish.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAfterAttackBanish : AITriggerAndTargetFiltersTagBase +{ + private const int SELECT_TYPE_ARG_INDEX = 1; + + public AIScriptTokenArgType SelectType { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIAfterAttackBanish(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (AIPlayTagInitializingUtility.TryCreateSelectType(_exprList[_exprList.Count - 1], base.LegalSelectTypes, out var selectType)) + { + SelectType = selectType; + } + else + { + SelectType = AIScriptTokenArgType.NONE; + } + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBanishSimulationUtility.BanishAll(targets, situation); + } + else + { + AIConsoleUtility.LogError($"AIAfterAttackBanish.Execute(): Unsupported selecttype. type:{SelectType}"); + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAfterAttackDraw.cs b/SVSim.BattleEngine/Engine/Wizard/AIAfterAttackDraw.cs new file mode 100644 index 0000000..ed2df9a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAfterAttackDraw.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAfterAttackDraw : AIFiltersArgument +{ + private AIPolishConvertedExpression _drawCountArg; + + private const int DRAW_COUNT_ARG_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIAfterAttackDraw(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _drawCountArg = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (situation != null && situation.Actor != null && AIFilteringUtility.CheckMatchTargetFiltering(situation.Actor, null, base.Filters, playPtn, tagOwner, situation)) + { + int drawCount = (int)_drawCountArg.EvalArg(tagOwner, playPtn, field, situation); + field.DrawCard(tagOwner.IsAlly, drawCount, playPtn, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAfterAttackEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIAfterAttackEvo.cs new file mode 100644 index 0000000..9117455 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAfterAttackEvo.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAfterAttackEvo : AITriggerAndTargetFiltersTagBase +{ + private const int SELECT_TYPE_ARG_INDEX = 1; + + public AIScriptTokenArgType SelectType { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIAfterAttackEvo(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (IsLegalSelectType(_exprList[_exprList.Count - 1], out var selectType)) + { + SelectType = selectType; + } + else + { + LogSelectTypeError(selectType); + } + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + AIAutoEvolutionSimulationUtility.AutoEvolution(field, targets, playPtn, situation, SelectType); + } + } + + private void LogSelectTypeError(AIScriptTokenArgType selectType) + { + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.TargetFilters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.AllyInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAfterAttackHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIAfterAttackHeal.cs new file mode 100644 index 0000000..885d968 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAfterAttackHeal.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAfterAttackHeal : AITriggerAndTargetFiltersTagBase +{ + private const int HEAL_AMOUNT_ARG_INDEX = 1; + + public AIPolishConvertedExpression HealAmount { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIAfterAttackHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + HealAmount = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + int heal = (int)HealAmount.EvalArg(tagOwner, null, field, situation); + if (targets != null && targets.Count > 0) + { + AISkillSimulationUtility.HealAll(targets, field, heal, field.BestPlayPtn, situation); + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAfterClashDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIAfterClashDamage.cs new file mode 100644 index 0000000..3469fa6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAfterClashDamage.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAfterClashDamage : AIFiltersAndSelectTypeArgument +{ + private AIPolishConvertedExpression _damage; + + private readonly int DAMAGE_AMOUNT_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIAfterClashDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _damage = _exprList[_exprList.Count - DAMAGE_AMOUNT_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int damage = (int)_damage.EvalArg(tagOwner, playPtn, field, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, damage, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, damage, situation); + break; + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAfterClashHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIAfterClashHeal.cs new file mode 100644 index 0000000..e57fcab --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAfterClashHeal.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAfterClashHeal : AIFiltersAndSelectTypeArgument +{ + private readonly int HEAL_AMOUNT_ARG_OFFSET = 1; + + public AIPolishConvertedExpression HealAmount { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIAfterClashHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + HealAmount = _exprList[_exprList.Count - HEAL_AMOUNT_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int heal = (int)HealAmount.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targetsFromField, field, heal, playPtn, situation); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAllyDiscardBonus.cs b/SVSim.BattleEngine/Engine/Wizard/AIAllyDiscardBonus.cs new file mode 100644 index 0000000..63b7f7b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAllyDiscardBonus.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAllyDiscardBonus : AIBonusArgumentWithIgnoreInBattle +{ + private List _filters; + + public AIAllyDiscardBonus(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _filters = GetFilters(_exprList.GetRange(0, _exprList.Count - _valueIndexOffset)); + } + + public void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, bool useIgnoreInBattle, AISituationInfo situation = null) + { + AIDiscardInfo discardInfo = situation.DiscardInfo; + if (discardInfo != null && discardInfo.IsValuable) + { + field.SimulationExtraBonus += GetBonusValue(tagOwner, playPtn, situation, useIgnoreInBattle) * (float)discardInfo.TargetList.Count; + } + } + + public override float GetBonusValue(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool useIgnoreInBattle) + { + if (!AIFilteringUtility.CheckMatchTargetFiltering(situation.Actor, null, _filters, playPtn, tagOwner, situation)) + { + return 0f; + } + return base.GetBonusValue(tagOwner, playPtn, situation, useIgnoreInBattle); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttachEventToBattleModuleUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttachEventToBattleModuleUtility.cs new file mode 100644 index 0000000..c63e44e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttachEventToBattleModuleUtility.cs @@ -0,0 +1,343 @@ +using System; +using System.Collections.Generic; +using Wizard.Battle.View.Vfx; + +namespace Wizard; + +public static class AIAttachEventToBattleModuleUtility +{ + public static void SetupEventWhenInitGame(BattlePlayerBase ally, BattlePlayerBase opponent, OperateMgr operateMgr, EnemyAI ai) + { + SetupOnAddCemeteryEvent(ally, opponent, ai); + SetupOnTurnStartComplete(ally, opponent, ai); + SetupOnTurnEndStart(ally, opponent, ai); + SetupOperateMgrEvent(operateMgr, ai); + } + + public static void DepriveAttachedAIBattleModule(BattlePlayerBase ally, BattlePlayerBase opponent, OperateMgr operateMgr, EnemyAI ai) + { + DepriveAttachedPlayerBattleEvent(ally, opponent, ai.PlayerBattleEvent); + DepriveAttachedOperateMgrBattleEvent(operateMgr, ai.OprMgrBattleEvent); + } + + private static void DepriveAttachedPlayerBattleEvent(BattlePlayerBase ally, BattlePlayerBase opponent, AIAttachPlayerBattleEventCache playerBattleEvent) + { + if (playerBattleEvent.AllyAddCemeteryEvent != null) + { + ally.OnAddCemeteryEvent -= playerBattleEvent.AllyAddCemeteryEvent; + playerBattleEvent.AllyAddCemeteryEvent = null; + } + if (playerBattleEvent.OpponentAddCemeteryEvent != null) + { + opponent.OnAddCemeteryEvent -= playerBattleEvent.OpponentAddCemeteryEvent; + playerBattleEvent.OpponentAddCemeteryEvent = null; + } + if (playerBattleEvent.AllyTurnStartCompleteEvent != null) + { + ally.OnTurnStartComplete = (Action)Delegate.Remove(ally.OnTurnStartComplete, playerBattleEvent.AllyTurnStartCompleteEvent); + playerBattleEvent.AllyTurnStartCompleteEvent = null; + } + if (playerBattleEvent.OpponentTurnStartCompleteEvent != null) + { + opponent.OnTurnStartComplete = (Action)Delegate.Remove(opponent.OnTurnStartComplete, playerBattleEvent.OpponentTurnStartCompleteEvent); + playerBattleEvent.OpponentTurnStartCompleteEvent = null; + } + } + + private static void DepriveAttachedOperateMgrBattleEvent(OperateMgr oprMgr, AIAttachOperateMgrBattleEventCache oprMgrBattleEvent) + { + if (oprMgrBattleEvent.OnSetCardSuccessEvent != null) + { + oprMgr.OnSetCardSuccess -= oprMgrBattleEvent.OnSetCardSuccessEvent; + oprMgrBattleEvent.OnSetCardSuccessEvent = null; + } + if (oprMgrBattleEvent.OnSetCardExecutedEvent != null) + { + oprMgr.OnSetCardExecuted -= oprMgrBattleEvent.OnSetCardExecutedEvent; + oprMgrBattleEvent.OnSetCardExecutedEvent = null; + } + if (oprMgrBattleEvent.OnEvolveSuccessEvent != null) + { + oprMgr.OnEvolveSuccess -= oprMgrBattleEvent.OnEvolveSuccessEvent; + oprMgrBattleEvent.OnEvolveSuccessEvent = null; + } + if (oprMgrBattleEvent.OnEvolveCompleteEvent != null) + { + oprMgr.OnEvoleComplete -= oprMgrBattleEvent.OnEvolveCompleteEvent; + oprMgrBattleEvent.OnEvolveCompleteEvent = null; + } + if (oprMgrBattleEvent.OnBeforeAttackEvent != null) + { + oprMgr.OnBeforeAttack -= oprMgrBattleEvent.OnBeforeAttackEvent; + oprMgrBattleEvent.OnBeforeAttackEvent = null; + } + if (oprMgrBattleEvent.OnAttackExecutedEvent != null) + { + oprMgr.OnAttackExecuted -= oprMgrBattleEvent.OnAttackExecutedEvent; + oprMgrBattleEvent.OnAttackExecutedEvent = null; + } + if (oprMgrBattleEvent.OnBeforeFusionEvent != null) + { + oprMgr.OnBeforeFusion -= oprMgrBattleEvent.OnBeforeFusionEvent; + oprMgrBattleEvent.OnBeforeFusionEvent = null; + } + if (oprMgrBattleEvent.OnAfterFusionEvent != null) + { + oprMgr.OnAfterFusion -= oprMgrBattleEvent.OnAfterFusionEvent; + oprMgrBattleEvent.OnAfterFusionEvent = null; + } + } + + private static void SetupOnAddCemeteryEvent(BattlePlayerBase ally, BattlePlayerBase opponent, EnemyAI ai) + { + ai.PlayerBattleEvent.AllyAddCemeteryEvent = delegate(BattleCardBase card, BattlePlayerBase.CEMETERY_TYPE cemeteryType, bool isOpen, SkillBase skill) + { + if (cemeteryType == BattlePlayerBase.CEMETERY_TYPE.NORMAL && !(card is NullBattleCard) && card.SelfBattlePlayer.ClassAndInPlayCardList.Contains(card) && card.HasSkillWhenDestroy && ai.LatestAction != null) + { + ai.LatestAction.CreateRandomTargetInformation(card, (SkillBase skillBase) => skillBase.IsWhenDestroySkill && RegisterTool.IsSkillRandom(skillBase)); + } + }; + ally.OnAddCemeteryEvent += ai.PlayerBattleEvent.AllyAddCemeteryEvent; + ai.PlayerBattleEvent.OpponentAddCemeteryEvent = delegate(BattleCardBase card, BattlePlayerBase.CEMETERY_TYPE cemeteryType, bool isOpen, SkillBase skill) + { + if (cemeteryType == BattlePlayerBase.CEMETERY_TYPE.NORMAL && !(card is NullBattleCard) && card.SelfBattlePlayer.ClassAndInPlayCardList.Contains(card)) + { + RecordOpponentBarbarossa(card, ai); + if (card.HasSkillWhenDestroy && ai.LatestAction != null) + { + ai.LatestAction.CreateRandomTargetInformation(card, (SkillBase skillBase) => skillBase.IsWhenDestroySkill && RegisterTool.IsSkillRandom(skillBase)); + } + } + }; + opponent.OnAddCemeteryEvent += ai.PlayerBattleEvent.OpponentAddCemeteryEvent; + } + + private static void SetupOnTurnStartComplete(BattlePlayerBase ally, BattlePlayerBase opponent, EnemyAI ai) + { + ai.PlayerBattleEvent.AllyTurnStartCompleteEvent = delegate + { + ai.UpdateAICurrentVirtualField(); + AIVirtualField currentVirtualField = ai.CurrentVirtualField; + if (ai.LatestAction != null && ai.BeforeLatestActionField != null) + { + currentVirtualField.UpdateTagInformationFromLatestAction(ai.LatestAction, ai.BeforeLatestActionField); + } + ai.LatestAction = null; + ai.BeforeLatestActionField = null; + }; + ally.OnTurnStartComplete = (Action)Delegate.Combine(ally.OnTurnStartComplete, ai.PlayerBattleEvent.AllyTurnStartCompleteEvent); + ai.PlayerBattleEvent.OpponentTurnStartCompleteEvent = delegate + { + if (!ai.IsBattleEnd) + { + if (ai.IsOpponentBarbarossaDestroyed) + { + ai.IsOpponentBarbarossaDestroyed = false; + } + ai.UpdateAICurrentVirtualField(); + AIVirtualField currentVirtualField = ai.CurrentVirtualField; + if (ai.LatestAction != null && ai.BeforeLatestActionField != null) + { + currentVirtualField.UpdateTagInformationFromLatestAction(ai.LatestAction, ai.BeforeLatestActionField); + } + ai.LatestAction = null; + ai.BeforeLatestActionField = null; + } + }; + opponent.OnTurnStartComplete = (Action)Delegate.Combine(opponent.OnTurnStartComplete, ai.PlayerBattleEvent.OpponentTurnStartCompleteEvent); + } + + private static void SetupOnTurnEndStart(BattlePlayerBase ally, BattlePlayerBase opponent, EnemyAI ai) + { + ai.PlayerBattleEvent.AllySelfTurnEndEvent = delegate + { + ai.LatestAction = new AIRealActionInformation(AIOperationType.TURNEND, ally.Class, ally.Class, null); + ai.SaveBeforeLatestActionInformation(); + for (int i = 0; i < ally.ClassAndInPlayCardList.Count; i++) + { + ai.LatestAction.CreateRandomTargetInformation(ally.ClassAndInPlayCardList[i], (SkillBase skill) => skill.OnSelfTurnEndStart != 0 && RegisterTool.IsSkillRandom(skill)); + } + for (int num = 0; num < opponent.ClassAndInPlayCardList.Count; num++) + { + ai.LatestAction.CreateRandomTargetInformation(opponent.ClassAndInPlayCardList[num], (SkillBase skill) => skill.OnOpponentTurnEndStart != 0 && RegisterTool.IsSkillRandom(skill)); + } + }; + ally.OnTurnEndStart += ai.PlayerBattleEvent.AllySelfTurnEndEvent; + ai.PlayerBattleEvent.OpponentSelfTurnEndEvent = delegate + { + ai.LatestAction = new AIRealActionInformation(AIOperationType.TURNEND, opponent.Class, opponent.Class, null); + ai.SaveBeforeLatestActionInformation(); + for (int i = 0; i < opponent.ClassAndInPlayCardList.Count; i++) + { + ai.LatestAction.CreateRandomTargetInformation(opponent.ClassAndInPlayCardList[i], (SkillBase skill) => skill.OnSelfTurnEndStart != 0 && RegisterTool.IsSkillRandom(skill)); + } + for (int num = 0; num < ally.ClassAndInPlayCardList.Count; num++) + { + ai.LatestAction.CreateRandomTargetInformation(ally.ClassAndInPlayCardList[num], (SkillBase skill) => skill.OnOpponentTurnEndStart != 0 && RegisterTool.IsSkillRandom(skill)); + } + }; + opponent.OnTurnEndStart += ai.PlayerBattleEvent.OpponentSelfTurnEndEvent; + } + + private static void SetupVirtualPairOnAfterPickCard(BattlePlayerPair pair, AIOperationSimulatorAccessor accessor) + { + pair.Self.OnAfterPickCard += delegate + { + accessor.UpdateCurrentField(pair, EnemyAI.EmptyPlayPtn); + }; + pair.Opponent.OnAfterPickCard += delegate + { + accessor.UpdateCurrentField(pair, EnemyAI.EmptyPlayPtn); + }; + } + + private static void SetupOperateMgrEvent(OperateMgr operateMgr, EnemyAI ai) + { + SetupOperateMgrOnSetCardSuccess(operateMgr, ai); + SetupOperateMgrOnSetCardExecuted(operateMgr, ai); + SetupOperateMgrOnEvolveSuccess(operateMgr, ai); + SetupOperateMgrOnEvolveComplete(operateMgr, ai); + SetupOperateMgrOnBeforeAttack(operateMgr, ai); + SetupOperateMgrOnAttackExecuted(operateMgr, ai); + SetupOperateMgrOnBeforeFusion(operateMgr, ai); + SetupOperateMgrOnAfterFusion(operateMgr, ai); + } + + private static void SetupOperateMgrOnSetCardSuccess(OperateMgr operateMgr, EnemyAI ai) + { + ai.OprMgrBattleEvent.OnSetCardSuccessEvent = delegate(BattleCardBase originalCard, BattleCardBase playCard, IEnumerable selectedCards) + { + ai.LatestAction = new AIRealActionInformation(AIOperationType.PLAY, playCard, originalCard, selectedCards); + ai.SaveBeforeLatestActionInformation(); + ai.LatestAction.CreateRandomTargetInformation(playCard, (SkillBase skill) => skill.IsWhenPlaySkill && RegisterTool.IsSkillRandom(skill)); + }; + operateMgr.OnSetCardSuccess += ai.OprMgrBattleEvent.OnSetCardSuccessEvent; + } + + private static void SetupOperateMgrOnSetCardExecuted(OperateMgr operateMgr, EnemyAI ai) + { + ai.OprMgrBattleEvent.OnSetCardExecutedEvent = delegate + { + if (ai.IsBattleEnd) + { + return NullVfx.GetInstance(); + } + ai.UpdateAICurrentVirtualField(); + AIVirtualField currentVirtualField = ai.CurrentVirtualField; + if (ai.LatestAction != null && ai.BeforeLatestActionField != null) + { + currentVirtualField.UpdateTagInformationFromLatestAction(ai.LatestAction, ai.BeforeLatestActionField); + } + ai.LatestAction = null; + ai.BeforeLatestActionField = null; + return NullVfx.GetInstance(); + }; + operateMgr.OnSetCardExecuted += ai.OprMgrBattleEvent.OnSetCardExecutedEvent; + } + + private static void RecordOpponentBarbarossa(BattleCardBase destroyCard, EnemyAI ai) + { + if (destroyCard.BaseParameter.BaseCardId == 106241020) + { + ai.IsOpponentBarbarossaDestroyed = true; + } + } + + private static void SetupOperateMgrOnEvolveSuccess(OperateMgr operateMgr, EnemyAI ai) + { + ai.OprMgrBattleEvent.OnEvolveSuccessEvent = delegate(BattleCardBase originalEvolver, BattleCardBase realEvolver, IEnumerable selectedTargets) + { + ai.SaveBeforeLatestActionInformation(); + ai.LatestAction = new AIRealActionInformation(AIOperationType.EVOLVE, realEvolver, originalEvolver, selectedTargets); + ai.LatestAction.CreateRandomTargetInformation(realEvolver, (SkillBase skill) => skill.IsWhenEvolveSkill && RegisterTool.IsSkillRandom(skill), forceCheckEvolveSkills: true); + }; + operateMgr.OnEvolveSuccess += ai.OprMgrBattleEvent.OnEvolveSuccessEvent; + } + + private static void SetupOperateMgrOnEvolveComplete(OperateMgr operateMgr, EnemyAI ai) + { + ai.OprMgrBattleEvent.OnEvolveCompleteEvent = delegate + { + if (!ai.IsBattleEnd) + { + ai.UpdateAICurrentVirtualField(); + AIVirtualField currentVirtualField = ai.CurrentVirtualField; + if (ai.LatestAction != null && ai.BeforeLatestActionField != null) + { + currentVirtualField.UpdateTagInformationFromLatestAction(ai.LatestAction, ai.BeforeLatestActionField); + } + ai.LatestAction = null; + ai.BeforeLatestActionField = null; + } + return NullVfx.GetInstance(); + }; + operateMgr.OnEvoleComplete += ai.OprMgrBattleEvent.OnEvolveCompleteEvent; + } + + private static void SetupOperateMgrOnBeforeAttack(OperateMgr operateMgr, EnemyAI ai) + { + ai.OprMgrBattleEvent.OnBeforeAttackEvent = delegate(BattleCardBase attacker, BattleCardBase target, SkillProcessor skillProcessorOneTime) + { + ai.LatestAction = new AIRealActionInformation(AIOperationType.ATTACK, attacker, attacker, new List { target }); + ai.SaveBeforeLatestActionInformation(); + ai.LatestAction.CreateRandomTargetInformation(attacker, (SkillBase skill) => skill.IsBeforAttackSkill && RegisterTool.IsSkillRandom(skill)); + return NullVfx.GetInstance(); + }; + operateMgr.OnBeforeAttack += ai.OprMgrBattleEvent.OnBeforeAttackEvent; + } + + private static void SetupOperateMgrOnAttackExecuted(OperateMgr operateMgr, EnemyAI ai) + { + ai.OprMgrBattleEvent.OnAttackExecutedEvent = delegate + { + if (!ai.IsBattleEnd) + { + ai.UpdateAICurrentVirtualField(); + AIVirtualField currentVirtualField = ai.CurrentVirtualField; + if (ai.LatestAction != null && ai.BeforeLatestActionField != null) + { + currentVirtualField.UpdateTagInformationFromLatestAction(ai.LatestAction, ai.BeforeLatestActionField); + } + ai.LatestAction = null; + ai.BeforeLatestActionField = null; + } + return NullVfx.GetInstance(); + }; + operateMgr.OnAttackExecuted += ai.OprMgrBattleEvent.OnAttackExecutedEvent; + } + + private static void SetupOperateMgrOnBeforeFusion(OperateMgr operateMgr, EnemyAI ai) + { + ai.OprMgrBattleEvent.OnBeforeFusionEvent = delegate(BattleCardBase fusionActor, IEnumerable targets) + { + ai.LatestAction = new AIRealActionInformation(AIOperationType.FUSION, fusionActor, fusionActor, targets); + ai.SaveBeforeLatestActionInformation(); + }; + operateMgr.OnBeforeFusion += ai.OprMgrBattleEvent.OnBeforeFusionEvent; + } + + private static void SetupOperateMgrOnAfterFusion(OperateMgr operateMgr, EnemyAI ai) + { + ai.OprMgrBattleEvent.OnAfterFusionEvent = delegate + { + if (!ai.IsBattleEnd) + { + ai.UpdateAICurrentVirtualField(); + AIVirtualField currentVirtualField = ai.CurrentVirtualField; + if (ai.LatestAction != null && ai.BeforeLatestActionField != null) + { + currentVirtualField.UpdateTagInformationFromLatestAction(ai.LatestAction, ai.BeforeLatestActionField); + } + ai.LatestAction = null; + ai.BeforeLatestActionField = null; + } + return NullVfx.GetInstance(); + }; + operateMgr.OnAfterFusion += ai.OprMgrBattleEvent.OnAfterFusionEvent; + } + + public static void SetupVirtualPairEventForOperationSimulator(BattlePlayerPair pair, AIOperationSimulatorAccessor accessor) + { + SetupVirtualPairOnAfterPickCard(pair, accessor); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagLeaveStopInformation.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagLeaveStopInformation.cs new file mode 100644 index 0000000..a56d81a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagLeaveStopInformation.cs @@ -0,0 +1,26 @@ +namespace Wizard; + +public class AIAttachedTagLeaveStopInformation : AILeaveStopInformation +{ + private AIPlayTag _targetTag; + + public AIAttachedTagLeaveStopInformation(AIAttachedTagStopPreprocessOption option, AIVirtualCard provider) + : base(option.TargetCard, provider) + { + base.Type = AITagPreprocessInfoType.REMOVE_ATTACHED_TAG; + _targetTag = option.TargetTag; + } + + protected override void StopMethod(AISituationInfo situation) + { + AIRemoveTagUtility.RemoveTemporaryAttachedTag(base.TargetCard, base.TargetCard.SelfField, _targetTag, situation); + } + + public override AITagPreprocessCreationOptionBase CreateOptionInfoForOverride(AIVirtualCard overridedTarget) + { + return new AIAttachedTagStopPreprocessOption(overridedTarget) + { + TargetTag = _targetTag + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagStopPreprocessOption.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagStopPreprocessOption.cs new file mode 100644 index 0000000..d76604c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagStopPreprocessOption.cs @@ -0,0 +1,11 @@ +namespace Wizard; + +public class AIAttachedTagStopPreprocessOption : AITagPreprocessCreationOptionBase +{ + public AIPlayTag TargetTag; + + public AIAttachedTagStopPreprocessOption(AIVirtualCard targetCard) + : base(AITagPreprocessInfoType.REMOVE_ATTACHED_TAG, targetCard) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagTurnEndStopInformation.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagTurnEndStopInformation.cs new file mode 100644 index 0000000..536228d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagTurnEndStopInformation.cs @@ -0,0 +1,26 @@ +namespace Wizard; + +public class AIAttachedTagTurnEndStopInformation : AITurnEndStopInformation +{ + private AIPlayTag _targetTag; + + public AIAttachedTagTurnEndStopInformation(AIAttachedTagStopPreprocessOption option, int defaultIncrement) + : base(option.TargetCard, defaultIncrement) + { + base.Type = AITagPreprocessInfoType.REMOVE_ATTACHED_TAG; + _targetTag = option.TargetTag; + } + + protected override void RunMethod(bool isAllyTurnEnd, AIVirtualTurnEndInfo situation) + { + AIRemoveTagUtility.RemoveTemporaryAttachedTag(base.TargetCard, base.TargetCard.SelfField, _targetTag, situation); + } + + public override AITagPreprocessCreationOptionBase CreateOptionInfoForOverride(AIVirtualCard overridedTarget) + { + return new AIAttachedTagStopPreprocessOption(overridedTarget) + { + TargetTag = _targetTag + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagTurnStartStopInformation.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagTurnStartStopInformation.cs new file mode 100644 index 0000000..6815c84 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagTurnStartStopInformation.cs @@ -0,0 +1,26 @@ +namespace Wizard; + +public class AIAttachedTagTurnStartStopInformation : AITurnStartStopInformation +{ + private AIPlayTag _targetTag; + + public AIAttachedTagTurnStartStopInformation(AIAttachedTagStopPreprocessOption option) + : base(option.TargetCard) + { + base.Type = AITagPreprocessInfoType.REMOVE_ATTACHED_TAG; + _targetTag = option.TargetTag; + } + + public override void ExecuteReservedAction(bool isAllyTurnEnd, AISituationInfo situation) + { + AIRemoveTagUtility.RemoveTemporaryAttachedTag(base.TargetCard, base.TargetCard.SelfField, _targetTag, situation); + } + + public override AITagPreprocessCreationOptionBase CreateOptionInfoForOverride(AIVirtualCard overridedTarget) + { + return new AIAttachedTagStopPreprocessOption(overridedTarget) + { + TargetTag = _targetTag + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackAddDeck.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackAddDeck.cs new file mode 100644 index 0000000..ffb1cf6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackAddDeck.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackAddDeck : AIWhenAttackOrWhenFightTagArgument +{ + private AIPolishConvertedExpression _count; + + private AIPolishConvertedExpression _id; + + private const int COUNT_ARG_INDEX = 1; + + private const int ID_ARG_INDEX = 0; + + public AIAttackAddDeck(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _id = _exprList[0]; + _count = _exprList[1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + int tokenCount = (int)_count.EvalArg(tagOwner, playPtn, field, situation); + int tokenId = _id.EvalID(); + field.AddDeckCard(tokenId, tokenCount, tagOwner, playPtn, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackAttachTag.cs new file mode 100644 index 0000000..db39060 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackAttachTag.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackAttachTag : AIWhenAttackOrWhenFightTagArgument +{ + private AIScriptTokenArgType _removeTiming; + + private const int REMOVE_TIMING_OFFSET = 1; + + private const int TAG_WORD_START_INDEX = 1; + + public AIPlayTag Tag { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIAttackAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + _removeTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targetsFromField, tagOwner, Tag, _removeTiming, situation); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (Tag != null) + { + return Tag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackAttackableCount.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackAttackableCount.cs new file mode 100644 index 0000000..b62e4f4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackAttackableCount.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackAttackableCount : AIWhenAttackOrWhenFightTagArgument +{ + private AIPolishConvertedExpression _attackableCountArg; + + private const int ATTACKABLE_COUNT_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIAttackAttackableCount(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _attackableCountArg = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int attackableCount = (int)_attackableCountArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIAttackableCountSimulationUtility.ExecuteChangeAttackableCountAll(targetsFromField, attackableCount); + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackBreakAttackTwice.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackBreakAttackTwice.cs new file mode 100644 index 0000000..6a031ae --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackBreakAttackTwice.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackBreakAttackTwice : AIScriptArgumentExpressions +{ + public AIAttackBreakAttackTwice(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + tagOwner.GiveAttackableCount(2); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackBreakDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackBreakDamage.cs new file mode 100644 index 0000000..866c252 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackBreakDamage.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackBreakDamage : AIFiltersAndSelectTypeArgument +{ + private readonly int DAMAGE_ARG_OFFSET = 1; + + public AIPolishConvertedExpression Damage { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIAttackBreakDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Damage = _exprList[_exprList.Count - DAMAGE_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, field.BestPlayPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int damage = (int)Damage.EvalArg(tagOwner, field.BestPlayPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, damage, situation); + } + else if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, damage, situation); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackBreakEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackBreakEvo.cs new file mode 100644 index 0000000..e41fa6a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackBreakEvo.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackBreakEvo : AIScriptArgumentExpressions +{ + public AIAttackBreakEvo(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + if (!situation.Actor.IsEvolution) + { + AIAutoEvolutionSimulationUtility.AutoEvolveSingle(situation.Actor, field, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackBreakRecoverPp.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackBreakRecoverPp.cs new file mode 100644 index 0000000..d9d417d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackBreakRecoverPp.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackBreakRecoverPp : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression _recoverValue; + + public AIAttackBreakRecoverPp(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList != null && _exprList.Count > 0) + { + _recoverValue = _exprList[0]; + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + int amount = (int)_recoverValue.EvalArg(tagOwner, playPtn, field, situation); + field.RecoverPp(amount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackBuff.cs new file mode 100644 index 0000000..c92ba34 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackBuff.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackBuff : AIWhenAttackOrWhenFightTagArgument +{ + private AIPolishConvertedExpression _attack; + + private AIPolishConvertedExpression _life; + + private AIScriptTokenArgType _tempOrPerm; + + private readonly int TEMP_OR_PERM_ARG_OFFSET = 1; + + private readonly int LIFE_ARG_OFFSET = 2; + + private readonly int ATTACK_ARG_OFFSET = 3; + + protected override int SELECT_TYPE_OFFSET => 4; + + public override bool IsActivateWhenEvalInstantAttack => true; + + public AIAttackBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count > SELECT_TYPE_OFFSET) + { + _attack = _exprList[_exprList.Count - ATTACK_ARG_OFFSET]; + _life = _exprList[_exprList.Count - LIFE_ARG_OFFSET]; + _tempOrPerm = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - TEMP_OR_PERM_ARG_OFFSET], AIBuffEvaluationUtility.LEGAL_TEMP_OR_PERM_ARGUMENTS); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, _attack, _life); + bool isTemp = _tempOrPerm == AIScriptTokenArgType.TEMP; + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBuffSimulationUtility.BuffAll_old(targetsFromField, field, buffExecutingInfo_old, isTemp, playPtn, situation); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool isAttackEffective = !_attack.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective, isBlockDead); + } + + public void RegisterBuffInfo(AISimulationBuffInfoCollection collection, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, ulong tagHash) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, _attack, _life); + if (!buffExecutingInfo_old.IsMultiplyAttack && !buffExecutingInfo_old.IsMultiplyLife) + { + bool num = _tempOrPerm == AIScriptTokenArgType.TEMP; + int attackValue = buffExecutingInfo_old.AttackValue; + int lifeValue = buffExecutingInfo_old.LifeValue; + AISimulationBuffInfo buffInfo = (num ? new AISimulationBuffInfo(attackValue, lifeValue, attackValue, lifeValue) : new AISimulationBuffInfo(0, 0, attackValue, lifeValue)); + collection.Add(tagHash, targetsFromField, buffInfo); + } + } + } + + public override void PseudoSimulateForEvalInstantAttack(AIVirtualCard tagOwner, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, EvalInstantAttackInformation information) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + bool flag = situation.Actor.IsSameCardIncluded(targetsFromField); + bool flag2 = situation.AttackTarget.IsSameCardIncluded(targetsFromField); + if (flag || flag2) + { + if (flag) + { + int attack = (int)_attack.EvalArg(tagOwner, playPtn, field, situation); + int life = (int)_life.EvalArg(tagOwner, playPtn, field, situation); + information.AddAttackerWhenAttackBuff(attack, life); + } + if (flag2) + { + int value = (int)_life.EvalArg(tagOwner, playPtn, field, situation); + information.AddTargetLifeBuff(value); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackDamage.cs new file mode 100644 index 0000000..398141f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackDamage.cs @@ -0,0 +1,120 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackDamage : AIWhenAttackOrWhenFightTagArgument +{ + private AIPolishConvertedExpression _damage; + + private readonly int DAMAGE_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public override bool IsActivateWhenEvalInstantAttack => true; + + public AIAttackDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _damage = _exprList[_exprList.Count - DAMAGE_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int damage = (int)_damage.EvalArg(tagOwner, playPtn, field, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, damage, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, damage, situation); + break; + } + } + } + + private int GetAttackDamageToCertainTarget(AIVirtualCard tagOwner, AISituationInfo situation, AIVirtualField field, List playPtn, AIVirtualCard damageTarget) + { + if (damageTarget.IsIndependent) + { + return 0; + } + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField.Contains(damageTarget)) + { + int num = (int)_damage.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT || (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT && damageTarget.IsSameCard(AIDamageSimulationUtility.SelectDamageTarget(targetsFromField, field, playPtn, situation, num, isSpell: false, AISelectTargetPattern.Worst)))) + { + return num; + } + } + return 0; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + public override bool CanKillTarget(AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, AIBarrierPseudoSimulationInfo simBarrier, ref int totalDamage) + { + totalDamage += PseudoSimulateWhenAttackDamageToCertainCard(tagOwner, target, field, situation, playPtn, simBarrier); + return totalDamage >= target.Life; + } + + public override int PseudoSimulateWhenAttackDamageToCertainCard(AIVirtualCard tagOwner, AIVirtualCard damageTarget, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, AIBarrierPseudoSimulationInfo simBarrier) + { + int attackDamageToCertainTarget = GetAttackDamageToCertainTarget(tagOwner, situation, field, playPtn, damageTarget); + if (attackDamageToCertainTarget <= 0) + { + return 0; + } + bool isSpell = tagOwner.IsSpell; + int result = simBarrier.SimulateDamageAmount(damageTarget.SimulateDamageShield(attackDamageToCertainTarget, isSkillDamage: true, isSpell), isSpell); + simBarrier.DepriveBarrier(AIBarrierStopTiming.AfterDamage); + return result; + } + + public override bool CanKillAnyTarget(AIVirtualCard tagOwner, List targetList, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, List simBarrierList, int[] realDamageList) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return false; + } + int num = (int)_damage.EvalArg(tagOwner, playPtn, field, situation); + if (num <= 0) + { + return false; + } + bool isSpell = tagOwner.IsSpell; + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard aIVirtualCard = targetList[i]; + if (aIVirtualCard.IsIndependent || !aIVirtualCard.IsSameCardIncluded(targetsFromField)) + { + continue; + } + AIBarrierPseudoSimulationInfo aIBarrierPseudoSimulationInfo = simBarrierList[i]; + int num2 = aIBarrierPseudoSimulationInfo.SimulateDamageAmount(aIVirtualCard.SimulateDamageShield(num, isSkillDamage: true, isSpell), isSpell); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT || (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT && aIVirtualCard.IsSameCard(AIDamageSimulationUtility.SelectDamageTarget(targetsFromField, field, playPtn, situation, num2, isSpell: false, AISelectTargetPattern.Worst)))) + { + aIBarrierPseudoSimulationInfo.DepriveBarrier(AIBarrierStopTiming.AfterDamage); + realDamageList[i] += num2; + if (realDamageList[i] >= aIVirtualCard.Life) + { + return true; + } + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackDestroy.cs new file mode 100644 index 0000000..81cbd29 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackDestroy.cs @@ -0,0 +1,95 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackDestroy : AIWhenAttackOrWhenFightTagArgument +{ + public override bool IsActivateWhenEvalInstantAttack => true; + + public AIAttackDestroy(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.DestroyAll(targetsFromField, field, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AISkillSimulationUtility.DestroyRandom(targetsFromField, tagOwner, field, playPtn, situation); + break; + default: + LogSelectTypeError(base.SelectType); + break; + } + } + } + + public override bool CanKillTarget(AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, AIBarrierPseudoSimulationInfo simBarrier, ref int totalDamage) + { + if (target.IsIndependent || target.IsIndestructible) + { + return false; + } + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Contains(target)) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + return true; + case AIScriptTokenArgType.RANDOM_SELECT: + { + AIVirtualCard card = AISimulationRemovalUtility.SelectRemovalTarget(targetsFromField, tagOwner, field, playPtn, situation, AISelectTargetPattern.Worst, AIRemovalType.Destroy); + return target.IsSameCard(card); + } + } + } + return false; + } + + public override bool CanKillAnyTarget(AIVirtualCard tagOwner, List targetList, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, List simBarrierList, int[] realDamageList) + { + if (targetList == null || targetList.Count <= 0) + { + return false; + } + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return false; + } + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + { + for (int i = 0; i < targetList.Count; i++) + { + if (targetList[i].IsSameCardIncluded(targetsFromField)) + { + return true; + } + } + break; + } + case AIScriptTokenArgType.RANDOM_SELECT: + return AISimulationRemovalUtility.SelectRemovalTarget(targetsFromField, tagOwner, field, playPtn, situation, AISelectTargetPattern.Worst, AIRemovalType.Destroy).IsSameCardIncluded(targetList); + } + return false; + } + + private void LogSelectTypeError(AIScriptTokenArgType selectType) + { + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackDiscard.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackDiscard.cs new file mode 100644 index 0000000..37edad5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackDiscard.cs @@ -0,0 +1,67 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackDiscard : AIWhenAttackOrWhenFightTagArgument +{ + private AIPolishConvertedExpression _discardCountArg; + + private const int DISCARD_COUNT_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIAttackDiscard(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _discardCountArg = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int discardCount = GetDiscardCount(tagOwner, playPtn, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.RANDOM_SELECT: + AISkillSimulationUtility.DiscardRandom(tagOwner, field, targetsFromField, discardCount, situation); + break; + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.DiscardAll(tagOwner, targetsFromField, field, situation); + break; + } + } + } + + public bool IsAttackDiscardTargetInPlayPtn(AIVirtualCard tagOwner, List handCards, List playPtn, AISituationInfo situation) + { + for (int i = 0; i < playPtn.Count; i++) + { + if (AIFilteringUtility.CheckMatchTargetFiltering(handCards[playPtn[i]], handCards, base.Filters, playPtn, tagOwner, situation)) + { + return true; + } + } + return false; + } + + private int GetDiscardCount(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (_discardCountArg == null) + { + return 0; + } + return (int)_discardCountArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackEvo.cs new file mode 100644 index 0000000..62c931b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackEvo.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackEvo : AIWhenAttackOrWhenFightTagArgument +{ + public AIAttackEvo(string text) + : base(text) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIAutoEvolutionSimulationUtility.AutoEvolution(field, targetsFromField, playPtn, situation, base.SelectType); + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.AllyInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackHandBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackHandBuff.cs new file mode 100644 index 0000000..011cd08 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackHandBuff.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackHandBuff : AIWhenAttackOrWhenFightTagArgument +{ + private AIPolishConvertedExpression _attack; + + private AIPolishConvertedExpression _life; + + private readonly int ATTACK_BUFF_ARG_OFFSET = 2; + + private readonly int LIFE_BUFF_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIAttackHandBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _attack = _exprList[_exprList.Count - ATTACK_BUFF_ARG_OFFSET]; + _life = _exprList[_exprList.Count - LIFE_BUFF_ARG_OFFSET]; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.RANDOM_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: true, isBlockDead); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, _attack, _life); + if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + ExecuteRandomSelectHandBuff(targetsFromField, buffExecutingInfo_old, tagOwner, field, playPtn, situation); + } + } + } + + private void ExecuteRandomSelectHandBuff(List candidates, AIBuffExecutingInfo_old buffInfo, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIVirtualCardRealTargetInformation aIVirtualCardRealTargetInformation = null; + if (situation.IsLatestAction) + { + aIVirtualCardRealTargetInformation = situation.DequeueRealTargetInfo(tagOwner, field); + if (aIVirtualCardRealTargetInformation == null || aIVirtualCardRealTargetInformation.TargetList.Count <= 0) + { + AIConsoleUtility.LogError("AIAttackHandBuff.ExecuteRandomSelectHandBuff error!! Cannot find real target!!!!!! tagOwner.BaseId = " + tagOwner.BaseId); + } + else if (IsCandidateLegal(aIVirtualCardRealTargetInformation, candidates, tagOwner.BaseId)) + { + AIHandBuffSimulationUtility.ExecuteHandBuffAll(aIVirtualCardRealTargetInformation.TargetList, buffInfo, situation); + } + } + else + { + AIHandBuffSimulationUtility.ExecuteHandBuffRandom(candidates, buffInfo, playPtn, situation); + } + } + + private bool IsCandidateLegal(AIVirtualCardRealTargetInformation realTargets, List virtualCandidates, int tagOwnerId) + { + for (int i = 0; i < realTargets.TargetList.Count; i++) + { + AIVirtualCard card = realTargets.TargetList[i]; + bool flag = false; + for (int j = 0; j < virtualCandidates.Count; j++) + { + if (virtualCandidates[j].IsSameCard(card)) + { + flag = true; + break; + } + } + if (!flag) + { + AIConsoleUtility.LogError("AIAttackHandBuff.IsCandidateLegal() error!! Candidates does not include target!!!!! tagOwner.BaseId == " + tagOwnerId); + return false; + } + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackMove.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackMove.cs new file mode 100644 index 0000000..f77ddf6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackMove.cs @@ -0,0 +1,20 @@ +namespace Wizard; + +internal class AIAttackMove : AIMove +{ + public BattleCardBase Src { get; private set; } + + public BattleCardBase Target { get; private set; } + + public AIAttackMove(BattleCardBase src, BattleCardBase target) + : base(AIOperationType.ATTACK) + { + Src = src; + Target = target; + } + + public override void RunOperation(BattleManagerBase mgr, bool isPlayer) + { + mgr.VfxMgr.RegisterSequentialVfx(mgr.OperateMgr.Attack(Src, Target, isPlayer)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashBanish.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashBanish.cs new file mode 100644 index 0000000..5673711 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashBanish.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackOrClashBanish : AIWhenAttackOrWhenFightTagArgument +{ + public override bool IsActivateWhenEvalInstantAttack => true; + + public AIAttackOrClashBanish(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBanishSimulationUtility.BanishAll(targetsFromField, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIBanishSimulationUtility.BanishRandom(targetsFromField, tagOwner, field, playPtn, situation); + break; + } + } + } + + public override bool CanKillTarget(AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, AIBarrierPseudoSimulationInfo simBarrier, ref int totalDamage) + { + if (target.IsIndependent || target.IsUnbanishable) + { + return false; + } + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Contains(target)) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + return true; + } + if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIVirtualCard card = AISimulationRemovalUtility.SelectRemovalTarget(targetsFromField, tagOwner, field, field.BestPlayPtn, situation, AISelectTargetPattern.Worst, AIRemovalType.Banish); + return target.IsSameCard(card); + } + } + return false; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashBarrierBase.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashBarrierBase.cs new file mode 100644 index 0000000..36d2540 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashBarrierBase.cs @@ -0,0 +1,76 @@ +using System.Collections.Generic; + +namespace Wizard; + +public abstract class AIAttackOrClashBarrierBase : AIWhenAttackOrWhenFightTagArgument +{ + protected AIScriptTokenArgType _stopTiming; + + protected AIScriptTokenArgType _damageType; + + protected bool _isDamageTypeDefinedByMaster; + + protected abstract int _defaultDamageTypeOffset { get; } + + protected abstract int _stopTimingOffset { get; } + + protected override int SELECT_TYPE_OFFSET => 1 + (_isDamageTypeDefinedByMaster ? _defaultDamageTypeOffset : _stopTimingOffset); + + public override bool IsActivateWhenEvalInstantAttack => true; + + public AIAttackOrClashBarrierBase(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - _stopTimingOffset]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - _defaultDamageTypeOffset], out _isDamageTypeDefinedByMaster); + InitSelectType(); + InitializeFilter(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + GiveBarrierToAllTargets(targetsFromField, tagOwner, field, playPtn, situation); + } + } + + public override bool CanKillTarget(AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, AIBarrierPseudoSimulationInfo simBarrier, ref int totalDamage) + { + PseudoSimulateWhenAttackDamageToCertainCard(tagOwner, target, field, situation, playPtn, simBarrier); + return false; + } + + public override int PseudoSimulateWhenAttackDamageToCertainCard(AIVirtualCard tagOwner, AIVirtualCard damageTarget, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, AIBarrierPseudoSimulationInfo simBarrier) + { + if (situation == null || situation.ActionType != AIOperationType.ATTACK) + { + return 0; + } + if (AIFilteringUtility.CheckMatchTargetFiltering(simBarrier.Owner, null, base.Filters, playPtn, tagOwner, situation)) + { + PseudoGiveBarrierToCertainTarget(simBarrier, tagOwner, field, playPtn, situation); + } + return 0; + } + + protected abstract void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation); + + protected abstract void PseudoGiveBarrierToCertainTarget(AIBarrierPseudoSimulationInfo simBarrier, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashDamageClip.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashDamageClip.cs new file mode 100644 index 0000000..a3416ba --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashDamageClip.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackOrClashDamageClip : AIAttackOrClashBarrierBase +{ + private AIPolishConvertedExpression _clipAmount; + + private const int CLIP_AMOUNT_OFFSET = 1; + + protected override int _defaultDamageTypeOffset => 3; + + protected override int _stopTimingOffset => 2; + + public AIAttackOrClashDamageClip(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _clipAmount = _exprList[_exprList.Count - 1]; + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int clipAmount = (int)_clipAmount.EvalArg(tagOwner, playPtn, field, situation); + AIBarrierSimulationUtility.AddDamageClipToAll(targets, tagOwner, field, _damageType, _stopTiming, clipAmount); + } + + protected override void PseudoGiveBarrierToCertainTarget(AIBarrierPseudoSimulationInfo simBarrier, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int clipAmount = (int)_clipAmount.EvalArg(tagOwner, playPtn, field, situation); + AIDamageType damageTypeFromArgType = AIBarrierSimulationUtility.GetDamageTypeFromArgType(_damageType); + AIBarrierStopTiming barrierStopTimingFromArgType = AIBarrierSimulationUtility.GetBarrierStopTimingFromArgType(_stopTiming, tagOwner); + AIBarrierSimulationUtility.PseudoAddDamageClipToSingle(simBarrier, damageTypeFromArgType, barrierStopTimingFromArgType, clipAmount); + } + + public override void PseudoSimulateForEvalInstantAttack(AIVirtualCard tagOwner, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, EvalInstantAttackInformation information) + { + int clipAmount = (int)_clipAmount.EvalArg(tagOwner, playPtn, field, situation); + AIDamageType damageTypeFromArgType = AIBarrierSimulationUtility.GetDamageTypeFromArgType(_damageType); + AIBarrierStopTiming barrierStopTimingFromArgType = AIBarrierSimulationUtility.GetBarrierStopTimingFromArgType(_stopTiming, tagOwner); + if (AIFilteringUtility.CheckMatchTargetFiltering(information.AttackerBarrierInfo.Owner, null, base.Filters, playPtn, tagOwner, situation)) + { + AIBarrierSimulationUtility.PseudoAddDamageClipToSingle(information.AttackerBarrierInfo, damageTypeFromArgType, barrierStopTimingFromArgType, clipAmount); + } + if (AIFilteringUtility.CheckMatchTargetFiltering(information.TargetBarrierInfo.Owner, null, base.Filters, playPtn, tagOwner, situation)) + { + AIBarrierSimulationUtility.PseudoAddDamageClipToSingle(information.TargetBarrierInfo, damageTypeFromArgType, barrierStopTimingFromArgType, clipAmount); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashHeal.cs new file mode 100644 index 0000000..7921a0f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashHeal.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackOrClashHeal : AIWhenAttackOrWhenFightTagArgument +{ + private AIPolishConvertedExpression _healValueArg; + + private const int HEAL_VALUE_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIAttackOrClashHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _healValueArg = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int heal = (int)_healValueArg.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targetsFromField, field, heal, playPtn, situation); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashKeywordSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashKeywordSkill.cs new file mode 100644 index 0000000..5fa2058 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashKeywordSkill.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackOrClashKeywordSkill : AIWhenAttackOrWhenFightTagArgument +{ + private readonly AIScriptTokenArgType _skillType; + + public AIAttackOrClashKeywordSkill(string text, AIScriptTokenArgType skill) + : base(text) + { + _skillType = skill; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.GiveSkillToAll(targetsFromField, field, _skillType); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashRemoveSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashRemoveSkill.cs new file mode 100644 index 0000000..a46fe09 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashRemoveSkill.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackOrClashRemoveSkill : AIWhenAttackOrWhenFightTagArgument +{ + public AIAttackOrClashRemoveSkill(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIScriptTokenArgType selectType = base.SelectType; + if (selectType != AIScriptTokenArgType.RANDOM_SELECT && selectType == AIScriptTokenArgType.ALL_SELECT) + { + AIRemoveSkillSimulationUtility.RemoveSkillAll(targetsFromField, situation); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashRemoveTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashRemoveTag.cs new file mode 100644 index 0000000..121467f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashRemoveTag.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackOrClashRemoveTag : AIWhenAttackOrWhenFightTagArgument, IAIRemoveTagArgument +{ + private const int NEEDS_SPLITED_WORDS_LENGS = 3; + + private const int REMOVE_TAG_START_SPLITED_INDEX = 0; + + public AIPlayTag RemoveTag { get; private set; } + + public AIAttackOrClashRemoveTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + if (list == null || list.Count < 3) + { + AIConsoleUtility.LogError("AIClashRemoveTag error!! splitedText.Length is not enough"); + } + else + { + RemoveTag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[0], list[1], list[2]); + } + } + + public void Execute(AIVirtualCard tagOwner, AIVirtualField field, AISituationInfo situation, AIPlayTag ownerTag, List playPtn = null) + { + AIRemoveTagUtility.RemoveOneTag(tagOwner, field, RemoveTag, situation); + AIRemoveTagUtility.RemoveOneTag(tagOwner, field, ownerTag, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashShield.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashShield.cs new file mode 100644 index 0000000..b2391bf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashShield.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackOrClashShield : AIAttackOrClashBarrierBase +{ + private List _stopTimingList; + + protected override int _defaultDamageTypeOffset => 2; + + protected override int _stopTimingOffset => 1; + + public AIAttackOrClashShield(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _stopTimingList = AIPlayTagInitializingUtility.InitializeStopTimingList(_exprList[_exprList.Count - _stopTimingOffset]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - _defaultDamageTypeOffset], out _isDamageTypeDefinedByMaster); + InitSelectType(); + InitializeFilter(); + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIBarrierSimulationUtility.AddMultipleStopTimingShieldToAll(targets, tagOwner, field, _damageType, _stopTimingList); + } + + protected override void PseudoGiveBarrierToCertainTarget(AIBarrierPseudoSimulationInfo simBarrier, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIDamageType damageTypeFromArgType = AIBarrierSimulationUtility.GetDamageTypeFromArgType(_damageType); + List barrierStopTimingListFromArgType = AIBarrierSimulationUtility.GetBarrierStopTimingListFromArgType(_stopTimingList, tagOwner); + AIBarrierSimulationUtility.PseudoAddMultipleStopTimingShieldToSingle(simBarrier, damageTypeFromArgType, barrierStopTimingListFromArgType); + } + + public override void PseudoSimulateForEvalInstantAttack(AIVirtualCard tagOwner, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, EvalInstantAttackInformation information) + { + AIDamageType damageTypeFromArgType = AIBarrierSimulationUtility.GetDamageTypeFromArgType(_damageType); + List barrierStopTimingListFromArgType = AIBarrierSimulationUtility.GetBarrierStopTimingListFromArgType(_stopTimingList, tagOwner); + if (AIFilteringUtility.CheckMatchTargetFiltering(information.AttackerBarrierInfo.Owner, null, base.Filters, playPtn, tagOwner, situation)) + { + AIBarrierSimulationUtility.PseudoAddMultipleStopTimingShieldToSingle(information.AttackerBarrierInfo, damageTypeFromArgType, barrierStopTimingListFromArgType); + } + if (AIFilteringUtility.CheckMatchTargetFiltering(information.TargetBarrierInfo.Owner, null, base.Filters, playPtn, tagOwner, situation)) + { + AIBarrierSimulationUtility.PseudoAddMultipleStopTimingShieldToSingle(information.TargetBarrierInfo, damageTypeFromArgType, barrierStopTimingListFromArgType); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashSpellboost.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashSpellboost.cs new file mode 100644 index 0000000..1156b44 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashSpellboost.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackOrClashSpellboost : AIWhenAttackOrWhenFightTagArgument +{ + private AIPolishConvertedExpression _spellboostValue; + + private const int SPELLBOOST_VALUE_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIAttackOrClashSpellboost(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _spellboostValue = _exprList[_exprList.Count - 1]; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForSpellboost(candidates, tagOwner, base.Filters, playPtn, situation); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int count = (int)_spellboostValue.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISpellboostSimulationUtility.SpellboostAll(targetsFromField, count); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashToken.cs new file mode 100644 index 0000000..06dc0c7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackOrClashToken.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackOrClashToken : AIWhenAttackOrWhenFightTagArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + protected override int SELECT_TYPE_OFFSET => 0; + + public AIAttackOrClashToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + protected override void InitSelectType() + { + base.SelectType = AIScriptTokenArgType.ALL_SELECT; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AISummonTokenUtility.ExecuteSummonToken(GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false), base.Filters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackSetStatus.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackSetStatus.cs new file mode 100644 index 0000000..9ddc948 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackSetStatus.cs @@ -0,0 +1,118 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackSetStatus : AIWhenAttackOrWhenFightTagArgument +{ + private AIPolishConvertedExpression _attackExpression; + + private AIPolishConvertedExpression _lifeExpression; + + private readonly int ATTACK_ARG_OFFSET = 2; + + private readonly int LIFE_ARG_OFFSET = 1; + + private bool _isSetAttack; + + private bool _isSetLife; + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIAttackSetStatus(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _attackExpression = _exprList[_exprList.Count - ATTACK_ARG_OFFSET]; + _lifeExpression = _exprList[_exprList.Count - LIFE_ARG_OFFSET]; + _isSetAttack = !AISetStatusSimulationUtility.IsNoneSetValue(_attackExpression); + _isSetLife = !AISetStatusSimulationUtility.IsNoneSetValue(_lifeExpression); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + ExecuteSetStatusToAll(targetsFromField, tagOwner, field, playPtn, situation); + } + } + + private void ExecuteSetStatusToAll(List targetList, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int attack = (_isSetAttack ? ((int)_attackExpression.EvalArg(tagOwner, playPtn, field, situation)) : 0); + int newLife = (_isSetLife ? ((int)_lifeExpression.EvalArg(tagOwner, playPtn, field, situation)) : 0); + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard aIVirtualCard = targetList[i]; + if (_isSetAttack) + { + aIVirtualCard.SetAttack(attack); + } + if (_isSetLife) + { + aIVirtualCard.SetLife(newLife, situation); + } + } + } + + public override bool CanKillTarget(AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, AIBarrierPseudoSimulationInfo simBarrier, ref int totalDamage) + { + if (!_isSetLife) + { + return false; + } + if (AIFilteringUtility.CheckMatchTargetFiltering(target, GetCandidateRange(field), base.Filters, playPtn, tagOwner, situation)) + { + int num = (int)_lifeExpression.EvalArg(tagOwner, playPtn, field, situation); + int num2 = target.Life - totalDamage; + totalDamage = num2 - num; + if (num <= 0) + { + return true; + } + } + return false; + } + + public override bool CanKillAnyTarget(AIVirtualCard tagOwner, List targetList, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, List simBarrierList, int[] realDamageList) + { + if (!_isSetLife) + { + return false; + } + if (targetList == null || targetList.Count <= 0) + { + return false; + } + for (int i = 0; i < simBarrierList.Count; i++) + { + AIBarrierPseudoSimulationInfo aIBarrierPseudoSimulationInfo = simBarrierList[i]; + AIVirtualCard owner = aIBarrierPseudoSimulationInfo.Owner; + int totalDamage = realDamageList[i]; + if (CanKillTarget(tagOwner, owner, field, situation, playPtn, aIBarrierPseudoSimulationInfo, ref totalDamage)) + { + return true; + } + } + return false; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: true, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackSimulationUtility.cs new file mode 100644 index 0000000..9d01be7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackSimulationUtility.cs @@ -0,0 +1,156 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIAttackSimulationUtility +{ + public static bool IsUsePreCheckBuff(AIPlayTag tag, AIVirtualAttackInfo situation) + { + if (!situation.IsUsePreCheck || tag.Type != AIPlayTagType.AttackBuff) + { + return false; + } + AIAttackPreCheckInformation preCheckInformation = situation.PreCheckInformation; + if (preCheckInformation.HasBuffInfo) + { + return preCheckInformation.HasPreCheckBuffInfo(tag); + } + return false; + } + + public static void SimulateAttackIfValuable(AIVirtualAttackInfo situation, AIVirtualField field, bool useAttackLeaderPreCheck, ref bool isAttackerUsed) + { + AIVirtualCard actor = situation.Actor; + AIVirtualCard attackTarget = situation.AttackTarget; + situation.IsAttackSuccessed = false; + AIVirtualCard allyClass = field.AllyClass; + int attackDamageToCertainCard = AIAttackTagSimulator.GetAttackDamageToCertainCard(field, situation, allyClass); + if (field.AllyClass.SimulateDamageAmount(attackDamageToCertainCard, isSkillDamage: true) >= allyClass.Life) + { + isAttackerUsed = true; + return; + } + if (AIDiscardUtility.CheckAttackDiscardTargetInPlayPtn(actor.SelfField, field.BestPlayPtn, situation)) + { + isAttackerUsed = true; + return; + } + if (attackTarget.IsLeader) + { + int attackDamageToCertainCard2 = AIAttackTagSimulator.GetAttackDamageToCertainCard(field, situation, actor); + AISimulationBuffInfoCollection buffInfoListWhenCertainAttack = AIAttackTagSimulator.GetBuffInfoListWhenCertainAttack(field, situation); + float attackBonus = actor.GetAttackBonus(field.BestPlayPtn, situation); + AISimulationBuffInfo buffInfo = buffInfoListWhenCertainAttack?.GetBuffInfoToCertainCard(actor); + if (useAttackLeaderPreCheck && !IsExecuteAttackValuable(field, actor, actor.Attack, actor.Life, attackDamageToCertainCard2, buffInfo, attackBonus)) + { + isAttackerUsed = true; + return; + } + AIAttackPreCheckInformation preCheckInformation = new AIAttackPreCheckInformation(attackBonus, buffInfoListWhenCertainAttack); + situation.SetPreCheckInformation(preCheckInformation); + } + AIVirtualAttackSimulator.Attack(situation, field); + if (actor.IsDead || !actor.IsAttackable(EnemyAI.EmptyPlayPtn)) + { + isAttackerUsed = true; + } + if (!field.CardListSet.HasAttackableClassHolder) + { + return; + } + for (int i = 0; i < field.CardListSet.AttackableClassHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.AttackableClassHolders[i]; + if (aIVirtualCard.IsUnit && !aIVirtualCard.IsDead) + { + aIVirtualCard.TagCollectionContainer.AttackableClassTags.ChangeAttackableClassStatus(aIVirtualCard, field, field.BestPlayPtn); + } + } + } + + public static bool IsAttackPossible(AIVirtualField field, AIVirtualAttackInfo attackSituation, List replacedEnemyInplayCards = null) + { + if (attackSituation == null || attackSituation.ActionType != AIOperationType.ATTACK) + { + return false; + } + AIVirtualCard actor = attackSituation.Actor; + AIVirtualCard attackTarget = attackSituation.AttackTarget; + if (actor.IsDead || attackTarget.IsDead || !actor.IsAttackable(EnemyAI.EmptyPlayPtn)) + { + return false; + } + bool flag = attackTarget == field.EnemyClass; + if (actor.IsSkillCantAttackUnit) + { + if (flag) + { + return !actor.IsCantAttackClass(); + } + return false; + } + if (flag && actor.IsCantAttackClass()) + { + return false; + } + if (!(actor.IsAlly ? field.AllyInplayCards : field.EnemyInplayCards).Contains(actor)) + { + return false; + } + if (attackTarget.IsAmulet || attackTarget.IsCantUnderAttack(field.ParamQuery, actor, null, field)) + { + return false; + } + if (actor.IsCannotAttackByTag(attackSituation)) + { + return false; + } + List list = ((!actor.IsAlly) ? field.AllyInplayCards : ((replacedEnemyInplayCards == null) ? field.EnemyInplayCards : replacedEnemyInplayCards)); + bool flag2 = false; + if (list != null) + { + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (aIVirtualCard.IsGuard && !aIVirtualCard.IsDead && !aIVirtualCard.IsCantUnderAttack(field.ParamQuery, actor, null, field)) + { + flag2 = true; + break; + } + } + } + bool isGuard = attackTarget.IsGuard; + if (flag2 && !actor.IsIgnoreGuard && !isGuard) + { + return false; + } + if (!flag && actor.IsSkillCantAtkUnitNotHasGuard && !isGuard) + { + return false; + } + return true; + } + + public static bool IsExecuteAttackValuable(AIVirtualField field, AIVirtualCard attacker, int attack, int life, int preDamage, AISimulationBuffInfo buffInfo, float attackBonus) + { + int num = attack; + int num2 = life; + num2 -= preDamage; + if (buffInfo != null) + { + num += buffInfo.TotalAttackBuff; + num2 += buffInfo.TotalLifeBuff; + } + if (num2 > 0 && num > 0) + { + return true; + } + float num3 = attackBonus; + if (num2 <= 0) + { + float num4 = attacker.EvaluateBreakValue(field.BestPlayPtn, useIgnoreBreak: true) + attacker.EvaluateLeaveValue(field.BestPlayPtn, useIgnoreInBattle: true); + num3 += num4 - attacker.Value; + } + return num3 > 0f; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackSubtractCountdown.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackSubtractCountdown.cs new file mode 100644 index 0000000..b6d717e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackSubtractCountdown.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIAttackSubtractCountdown : AIWhenAttackOrWhenFightTagArgument +{ + private AIPolishConvertedExpression _countChange; + + private const int COUNT_CHANGE_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIAttackSubtractCountdown(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _countChange = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int value = (int)_countChange.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISubtractCountdownSimulationUtility.SubtractCountdownAll(targetsFromField, value, situation); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForCountdownAmuletOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.AllyInplayCards; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackTagSimulator.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackTagSimulator.cs new file mode 100644 index 0000000..31d2b73 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackTagSimulator.cs @@ -0,0 +1,115 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIAttackTagSimulator +{ + public static int GetAttackDamageToCertainCard(AIVirtualField field, AIVirtualAttackInfo situation, AIVirtualCard damageTarget) + { + if (damageTarget.IsIndependent) + { + return 0; + } + int num = 0; + AIVirtualCard actor = situation.Actor; + List bestPlayPtn = field.BestPlayPtn; + AIBarrierPseudoSimulationInfo aIBarrierPseudoSimulationInfo = new AIBarrierPseudoSimulationInfo(damageTarget); + num += actor.GetAttackDamageToCertainTarget(situation, field, bestPlayPtn, aIBarrierPseudoSimulationInfo); + if (field.CardListSet.HasOtherAttackDamage()) + { + for (int i = 0; i < field.CardListSet.OtherAttackDamageHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.OtherAttackDamageHolders[i]; + if (aIVirtualCard.TagCollectionContainer.HasTag(AIPlayTagType.OtherAttackDamage)) + { + num += aIVirtualCard.TagCollectionContainer.OtherAttackTags.GetAttackDamageToCertainTarget(aIVirtualCard, field, bestPlayPtn, situation, aIBarrierPseudoSimulationInfo); + } + } + } + return num; + } + + public static AISimulationBuffInfoCollection GetBuffInfoListWhenCertainAttack(AIVirtualField field, AISituationInfo situation) + { + AISimulationBuffInfoCollection aISimulationBuffInfoCollection = new AISimulationBuffInfoCollection(); + AIVirtualCard actor = situation.Actor; + AIPreprocessSimulationUtility.SimulatePreprocess(actor, situation, field, AIScriptTokenArgType.WHEN_ATTACK, isPseudo: true); + if (actor.TagCollectionContainer.HasTag(AIPlayTagType.AttackBuff)) + { + actor.TagCollectionContainer.AttackTags.RegisterBuffInfoToCollection(field, actor, situation, aISimulationBuffInfoCollection); + } + if (field.CardListSet.HasOtherAttackBuffHolder) + { + for (int i = 0; i < field.CardListSet.OtherAttackBuffTagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.OtherAttackBuffTagHolders[i]; + if (!aIVirtualCard.IsSameCard(actor) && aIVirtualCard.TagCollectionContainer.HasTag(AIPlayTagType.OtherAttackBuff)) + { + aIVirtualCard.TagCollectionContainer.OtherAttackTags.RegisterBuffInfoToCollection(field, aIVirtualCard, situation, aISimulationBuffInfoCollection); + } + } + } + AIPreprocessSimulationUtility.ResetPreprocess(situation, field); + return aISimulationBuffInfoCollection; + } + + public static void ExecuteAttackByLife(AIVirtualField field, AIVirtualCard attacker, AIVirtualCard target, ref int attackerAtk, ref int targetAtk) + { + attacker.AttackByLifeCount = 0; + target.AttackByLifeCount = 0; + List tagHolders = field.CardListSet.GetTagHolders(CardListsForReference.TagHolderReferenceType.AttackByLife); + if (tagHolders == null || tagHolders.Count <= 0) + { + return; + } + for (int i = 0; i < tagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = tagHolders[i]; + if (!aIVirtualCard.IsDead && aIVirtualCard.TagCollectionContainer.HasTag(AIPlayTagType.AttackByLife)) + { + AttackByLifeTagCollection attackByLifeTags = aIVirtualCard.TagCollectionContainer.AttackByLifeTags; + if (attacker.AttackByLifeCount <= 0) + { + attackerAtk = attackByLifeTags.GetRealAttack(aIVirtualCard, attacker, attackerAtk); + } + if (target.AttackByLifeCount <= 0) + { + targetAtk = attackByLifeTags.GetRealAttack(aIVirtualCard, target, targetAtk); + } + } + } + } + + public static void ApplyOtherAfterAttackOrClashTags(AIVirtualField field, AIVirtualAttackInfo situation) + { + if (situation == null || situation.Actor == null || situation.AttackTarget == null) + { + return; + } + AIVirtualCard actor = situation.Actor; + AIVirtualCard attackTarget = situation.AttackTarget; + if (!actor.IsDead && actor.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenAfterAttack)) + { + actor.TagCollectionContainer.AfterAttackTags.RegisterConditionPassedTags(actor, field, situation); + } + if (attackTarget != null && attackTarget.IsUnit) + { + if (!actor.IsDead && actor.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenAfterClash)) + { + actor.TagCollectionContainer.AfterClashTags.RegisterConditionPassedTags(actor, field, situation); + } + if (!attackTarget.IsDead && attackTarget.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenAfterClash)) + { + attackTarget.TagCollectionContainer.AfterClashTags.RegisterConditionPassedTags(attackTarget, field, situation); + } + } + for (int i = 0; i < field.CardListSet.BothClassAndInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.BothClassAndInplayCards[i]; + if (!aIVirtualCard.IsSameCard(situation.Actor) && aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenAfterAttack)) + { + aIVirtualCard.TagCollectionContainer.AfterAttackTags.RegisterConditionPassedTags(aIVirtualCard, field, situation); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAutoEvolutionSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIAutoEvolutionSimulationUtility.cs new file mode 100644 index 0000000..9606dd0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAutoEvolutionSimulationUtility.cs @@ -0,0 +1,87 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIAutoEvolutionSimulationUtility +{ + public static void AutoEvolution(AIVirtualField field, List targets, List playPtn, AISituationInfo situation, AIScriptTokenArgType selecyType) + { + switch (selecyType) + { + case AIScriptTokenArgType.RANDOM_SELECT: + AutoEvolveRandom(targets, field, playPtn, situation); + break; + case AIScriptTokenArgType.ALL_SELECT: + AutoEvolveAll(targets, field, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AutoEvolveTarget(situation, field, targets, selecyType); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + + private static void AutoEvolveRandom(List targets, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIVirtualCard aIVirtualCard = targets.FindMin((AIVirtualCard c) => c.EvaluateValueOnField(playPtn, situation, useStyle: true, doesUseLostLife: true, useOthersTag: true, useIgnoreInBattle: true) * (float)(c.IsAlly ? 1 : (-1))); + if (aIVirtualCard != null) + { + AutoEvolveSingle(aIVirtualCard, field, situation); + } + } + + private static void AutoEvolveAll(List targets, AIVirtualField field, AISituationInfo situation) + { + List list = null; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (!aIVirtualCard.IsEvolution && !aIVirtualCard.IsDead) + { + list = AIParamQuery.AddElementToList(aIVirtualCard, list); + } + } + if (list != null && list.Count > 0) + { + for (int j = 0; j < list.Count; j++) + { + AIVirtualEvolutionSimulator.AutoEvolve(list[j], field, situation); + } + field.AllActivateCountHolderIncrement(situation, AIPlayTagType.EvoActivateCount, list); + } + } + + private static void AutoEvolveTarget(AISituationInfo situation, AIVirtualField field, List candidates, AIScriptTokenArgType whichTarget) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + return; + } + List targets = situationTarget.Targets; + List list = null; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (candidates.Contains(aIVirtualCard) && !aIVirtualCard.IsEvolution) + { + list = AIParamQuery.AddElementToList(aIVirtualCard, list); + } + } + if (list != null && list.Count > 0) + { + AutoEvolveAll(list, field, situation); + } + } + + public static void AutoEvolveSingle(AIVirtualCard target, AIVirtualField field, AISituationInfo situation) + { + if (!target.IsEvolution && !target.IsDead) + { + AIVirtualEvolutionSimulator.AutoEvolve(target, field, situation); + field.AllActivateCountHolderIncrement(situation, AIPlayTagType.EvoActivateCount, target); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBanishAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIBanishAttachTag.cs new file mode 100644 index 0000000..cd1ada1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBanishAttachTag.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBanishAttachTag : AITargetSelectTagArgument +{ + private AIScriptTokenArgType _removeTiming; + + private readonly int REMOVE_TIMING_OFFSET = 1; + + private const int TAG_WORD_START_INDEX = 1; + + public AIPlayTag Tag { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIBanishAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + _removeTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - REMOVE_TIMING_OFFSET]); + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targetsFromField, tagOwner, Tag, _removeTiming, situation); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (Tag != null) + { + return Tag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBarrierAfterDamageStopInformation.cs b/SVSim.BattleEngine/Engine/Wizard/AIBarrierAfterDamageStopInformation.cs new file mode 100644 index 0000000..dc7b352 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBarrierAfterDamageStopInformation.cs @@ -0,0 +1,23 @@ +namespace Wizard; + +public class AIBarrierAfterDamageStopInformation : AIAfterDamageStopInformation +{ + private ulong _barrierHash; + + public AIBarrierAfterDamageStopInformation(AIBarrierStopPreprocessOption option) + : base(option.TargetCard) + { + _barrierHash = option.BarrierHash; + base.Type = AITagPreprocessInfoType.BARRIER_STOP; + } + + protected override void StopMethod() + { + base.TargetCard.BarrierInfoCollection.DepriveCertainBarrier(_barrierHash, AIBarrierStopTiming.AfterDamage); + } + + public override AITagPreprocessCreationOptionBase CreateOptionInfoForOverride(AIVirtualCard overridedTarget) + { + return new AIBarrierStopPreprocessOption(overridedTarget, _barrierHash); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBarrierLeaveStopInformation.cs b/SVSim.BattleEngine/Engine/Wizard/AIBarrierLeaveStopInformation.cs new file mode 100644 index 0000000..cc165a0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBarrierLeaveStopInformation.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBarrierLeaveStopInformation : AILeaveStopInformation +{ + private ulong _barrierHash; + + public AIBarrierLeaveStopInformation(AIBarrierStopPreprocessOption option, AIVirtualCard provider) + : base(option.TargetCard, provider) + { + _barrierHash = option.BarrierHash; + base.Type = AITagPreprocessInfoType.BARRIER_STOP; + } + + protected override void StopMethod(AISituationInfo situation) + { + base.TargetCard.BarrierInfoCollection.DepriveCertainBarrier(_barrierHash, AIBarrierStopTiming.WhenLeaveStop); + } + + protected override void PseudoStopMethodForEvalRandomMultiDamage(List barrierInfoList) + { + for (int i = 0; i < barrierInfoList.Count; i++) + { + AIBarrierPseudoSimulationInfo aIBarrierPseudoSimulationInfo = barrierInfoList[i]; + if (aIBarrierPseudoSimulationInfo.Owner.IsSameCard(base.TargetCard)) + { + aIBarrierPseudoSimulationInfo.DepriveCertainBarrier(AIBarrierStopTiming.WhenLeaveStop, _barrierHash); + } + } + } + + public override AITagPreprocessCreationOptionBase CreateOptionInfoForOverride(AIVirtualCard overridedTarget) + { + return new AIBarrierStopPreprocessOption(overridedTarget, _barrierHash); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBarrierSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIBarrierSimulationUtility.cs new file mode 100644 index 0000000..ac51aee --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBarrierSimulationUtility.cs @@ -0,0 +1,296 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIBarrierSimulationUtility +{ + public static AIScriptTokenArgType[] LegalBarrierType = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.DAMAGE_CUT, + AIScriptTokenArgType.DAMAGE_CLIP + }; + + public static AIScriptTokenArgType[] LegalDamageType = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.ALL_DAMAGE, + AIScriptTokenArgType.SKILL_DAMAGE, + AIScriptTokenArgType.ATTACK_DAMAGE, + AIScriptTokenArgType.SPELL_DAMAGE + }; + + public static AIScriptTokenArgType[] LegalStopTimingList = new AIScriptTokenArgType[7] + { + AIScriptTokenArgType.WHEN_ALLY_TURNEND, + AIScriptTokenArgType.WHEN_ALLY_TURNSTART, + AIScriptTokenArgType.WHEN_OPPONENT_TURNEND, + AIScriptTokenArgType.WHEN_OPPONENT_TURNSTART, + AIScriptTokenArgType.WHEN_DAMAGED, + AIScriptTokenArgType.WHEN_LEAVE, + AIScriptTokenArgType.NONE + }; + + public static ulong BARRIER_AMOUNT_HASH_COEFFICIENT = 137uL; + + public static ulong DAMAGE_TYPE_HASH_COEFFICIENT = 199uL; + + public static ulong BARRIER_TYPE_HASH_COEFFICIENT = 223uL; + + public static ulong DAMAGE_CLIP_RANGE_COEFFICIENT = 1109uL; + + private static readonly ulong[] STOP_TIMING_HASH_COEFFICIENT_ARRAY = new ulong[5] { 907uL, 911uL, 919uL, 929uL, 937uL }; + + public static void AddShieldToAll(List targets, AIVirtualCard tagOwner, AIVirtualField field, AIScriptTokenArgType damageTypeArgument, AIScriptTokenArgType stopTimingArgument) + { + AIDamageType damageTypeFromArgType = GetDamageTypeFromArgType(damageTypeArgument); + AIBarrierStopTiming barrierStopTimingFromArgType = GetBarrierStopTimingFromArgType(stopTimingArgument, tagOwner); + for (int i = 0; i < targets.Count; i++) + { + AddShieldToSingle(targets[i], tagOwner, field, damageTypeFromArgType, barrierStopTimingFromArgType); + } + } + + private static void AddShieldToSingle(AIVirtualCard card, AIVirtualCard tagOwner, AIVirtualField field, AIDamageType damageType, AIBarrierStopTiming stopTiming) + { + AIShieldInfo aIShieldInfo = new AIShieldInfo(damageType, stopTiming); + card.BarrierInfoCollection.AddBarrierInfo(aIShieldInfo); + RegisterBarrierStopPreprocess(card, tagOwner, field, stopTiming, aIShieldInfo.Hash); + } + + public static void AddMultipleStopTimingShieldToAll(List targets, AIVirtualCard tagOwner, AIVirtualField field, AIScriptTokenArgType damageTypeArgument, List stopTimingArgumentList) + { + AIDamageType damageTypeFromArgType = GetDamageTypeFromArgType(damageTypeArgument); + List barrierStopTimingListFromArgType = GetBarrierStopTimingListFromArgType(stopTimingArgumentList, tagOwner); + for (int i = 0; i < targets.Count; i++) + { + AddMultipleStopTimingShieldToSingle(targets[i], tagOwner, field, damageTypeFromArgType, barrierStopTimingListFromArgType); + } + } + + public static void AddMultipleStopTimingShieldToTarget(AISituationInfo situation, AIScriptTokenArgType whichTarget, AIVirtualCard tagOwner, AIVirtualField field, AIScriptTokenArgType damageTypeArgument, List stopTimingArgumentList) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("AddMultipleStopTimingShieldToTarget error!! No target!!!!!"); + } + else + { + AddMultipleStopTimingShieldToAll(situationTarget.Targets, tagOwner, field, damageTypeArgument, stopTimingArgumentList); + } + } + + private static void AddMultipleStopTimingShieldToSingle(AIVirtualCard card, AIVirtualCard tagOwner, AIVirtualField field, AIDamageType damageType, List stopTimingList) + { + AIShieldInfo aIShieldInfo = new AIShieldInfo(damageType, stopTimingList); + card.BarrierInfoCollection.AddBarrierInfo(aIShieldInfo); + if (stopTimingList != null && stopTimingList.Count > 0) + { + for (int i = 0; i < stopTimingList.Count; i++) + { + RegisterBarrierStopPreprocess(card, tagOwner, field, stopTimingList[i], aIShieldInfo.Hash); + } + } + } + + public static void PseudoAddMultipleStopTimingShieldToSingle(AIBarrierPseudoSimulationInfo info, AIDamageType damageType, List stopTimingList) + { + AIShieldInfo barrier = new AIShieldInfo(damageType, stopTimingList); + info.AddBarrierInfo(barrier); + } + + public static void AddDamageCutToAll(List targets, AIVirtualCard tagOwner, AIVirtualField field, AIScriptTokenArgType damageTypeArgument, AIScriptTokenArgType stopTimingArgument, int cutAmount) + { + AIDamageType damageTypeFromArgType = GetDamageTypeFromArgType(damageTypeArgument); + AIBarrierStopTiming barrierStopTimingFromArgType = GetBarrierStopTimingFromArgType(stopTimingArgument, tagOwner); + for (int i = 0; i < targets.Count; i++) + { + AddDamageCutToSingle(targets[i], tagOwner, field, damageTypeFromArgType, barrierStopTimingFromArgType, cutAmount); + } + } + + private static void AddDamageCutToSingle(AIVirtualCard card, AIVirtualCard tagOwner, AIVirtualField field, AIDamageType damageType, AIBarrierStopTiming stopTiming, int cutAmount) + { + AIDamageCutInfo aIDamageCutInfo = new AIDamageCutInfo(cutAmount, damageType, stopTiming); + card.BarrierInfoCollection.AddBarrierInfo(aIDamageCutInfo); + RegisterBarrierStopPreprocess(card, tagOwner, field, stopTiming, aIDamageCutInfo.Hash); + } + + public static void AddDamageClipToAll(List targets, AIVirtualCard tagOwner, AIVirtualField field, AIScriptTokenArgType damageTypeArgument, AIScriptTokenArgType stopTimingArgument, int clipAmount, int clipRange = 9999) + { + AIDamageType damageTypeFromArgType = GetDamageTypeFromArgType(damageTypeArgument); + AIBarrierStopTiming barrierStopTimingFromArgType = GetBarrierStopTimingFromArgType(stopTimingArgument, tagOwner); + for (int i = 0; i < targets.Count; i++) + { + AddDamageClipToSingle(targets[i], tagOwner, field, damageTypeFromArgType, barrierStopTimingFromArgType, clipAmount, clipRange); + } + } + + private static void AddDamageClipToSingle(AIVirtualCard card, AIVirtualCard tagOwner, AIVirtualField field, AIDamageType damageType, AIBarrierStopTiming stopTiming, int clipAmount, int clipRange) + { + AIDamageClippingInfo aIDamageClippingInfo = new AIDamageClippingInfo(clipAmount, clipRange, damageType, stopTiming); + card.BarrierInfoCollection.AddBarrierInfo(aIDamageClippingInfo); + RegisterBarrierStopPreprocess(card, tagOwner, field, stopTiming, aIDamageClippingInfo.Hash); + } + + public static void PseudoAddDamageClipToSingle(AIBarrierPseudoSimulationInfo info, AIDamageType damageType, AIBarrierStopTiming stopTiming, int clipAmount, int clipRange = 9999) + { + AIDamageClippingInfo barrier = new AIDamageClippingInfo(clipAmount, clipRange, damageType, stopTiming); + info.AddBarrierInfo(barrier); + } + + public static void AddLifeLowerLimitToAll(List targets, AIVirtualCard tagOwner, AIVirtualField field, AIScriptTokenArgType damageTypeArgToken, AIScriptTokenArgType stopTimingArgToken) + { + AIDamageType damageTypeFromArgType = GetDamageTypeFromArgType(damageTypeArgToken); + AIBarrierStopTiming barrierStopTimingFromArgType = GetBarrierStopTimingFromArgType(stopTimingArgToken, tagOwner); + for (int i = 0; i < targets.Count; i++) + { + AddLifeLowerLimitToSingle(targets[i], tagOwner, field, damageTypeFromArgType, barrierStopTimingFromArgType); + } + } + + public static void AddLifeLowerLimitToSingle(AIVirtualCard target, AIVirtualCard tagOwner, AIVirtualField field, AIDamageType damageType, AIBarrierStopTiming stopTiming) + { + AILifeLowerLimitInfo aILifeLowerLimitInfo = new AILifeLowerLimitInfo(damageType, stopTiming); + target.BarrierInfoCollection.AddBarrierInfo(aILifeLowerLimitInfo); + RegisterBarrierStopPreprocess(target, tagOwner, field, stopTiming, aILifeLowerLimitInfo.Hash); + } + + private static void RegisterBarrierStopPreprocess(AIVirtualCard target, AIVirtualCard tagOwner, AIVirtualField field, AIBarrierStopTiming stopTiming, ulong barrierHash) + { + AIBarrierStopPreprocessOption option = new AIBarrierStopPreprocessOption(target, barrierHash); + switch (stopTiming) + { + case AIBarrierStopTiming.AllyTurnEnd: + field.TagPreprocessContainer.AppendAllyTurnEndStopInfo(option); + break; + case AIBarrierStopTiming.OpponentTurnEnd: + field.TagPreprocessContainer.AppendOpponentTurnEndStopInfo(option); + break; + case AIBarrierStopTiming.AllyTurnStart: + field.TagPreprocessContainer.AppendAllyTurnStartStopInfo(option); + break; + case AIBarrierStopTiming.OpponentTurnStart: + field.TagPreprocessContainer.AppendOpponentTurnStartStopInfo(option); + break; + case AIBarrierStopTiming.WhenLeaveStop: + field.TagPreprocessContainer.AppendLeaveStopInfo(option, tagOwner); + break; + case AIBarrierStopTiming.AfterDamage: + field.TagPreprocessContainer.AppendAfterDamageStopInfo(option); + break; + } + } + + public static AIDamageType GetDamageTypeFromArgType(AIScriptTokenArgType damageTypeArgument) + { + switch (damageTypeArgument) + { + case AIScriptTokenArgType.SKILL_DAMAGE: + return AIDamageType.Skill; + case AIScriptTokenArgType.ATTACK_DAMAGE: + return AIDamageType.Attack; + case AIScriptTokenArgType.SPELL_DAMAGE: + return AIDamageType.Spell; + case AIScriptTokenArgType.ALL_DAMAGE: + return AIDamageType.All; + default: + AIConsoleUtility.LogError("AIBarrierSimulationUtility.GetDamageTypeFromArgType() error!! argument " + damageTypeArgument.ToString() + " is illegal!!!!!"); + return AIDamageType.All; + } + } + + public static List GetBarrierStopTimingListFromArgType(List arguments, AIVirtualCard tagOwner) + { + List list = null; + for (int i = 0; i < arguments.Count; i++) + { + AIBarrierStopTiming barrierStopTimingFromArgType = GetBarrierStopTimingFromArgType(arguments[i], tagOwner); + if (barrierStopTimingFromArgType != AIBarrierStopTiming.None) + { + list = AIParamQuery.AddElementToList(barrierStopTimingFromArgType, list); + } + } + return list; + } + + public static AIBarrierStopTiming GetBarrierStopTimingFromArgType(AIScriptTokenArgType argument, AIVirtualCard tagOwner) + { + switch (argument) + { + case AIScriptTokenArgType.NONE: + return AIBarrierStopTiming.None; + case AIScriptTokenArgType.WHEN_LEAVE: + return AIBarrierStopTiming.WhenLeaveStop; + case AIScriptTokenArgType.WHEN_DAMAGED: + return AIBarrierStopTiming.AfterDamage; + case AIScriptTokenArgType.WHEN_ALLY_TURNEND: + if (!tagOwner.IsAlly) + { + return AIBarrierStopTiming.OpponentTurnEnd; + } + return AIBarrierStopTiming.AllyTurnEnd; + case AIScriptTokenArgType.WHEN_OPPONENT_TURNEND: + if (!tagOwner.IsAlly) + { + return AIBarrierStopTiming.AllyTurnEnd; + } + return AIBarrierStopTiming.OpponentTurnEnd; + case AIScriptTokenArgType.WHEN_ALLY_TURNSTART: + if (!tagOwner.IsAlly) + { + return AIBarrierStopTiming.OpponentTurnStart; + } + return AIBarrierStopTiming.AllyTurnStart; + case AIScriptTokenArgType.WHEN_OPPONENT_TURNSTART: + if (!tagOwner.IsAlly) + { + return AIBarrierStopTiming.AllyTurnStart; + } + return AIBarrierStopTiming.OpponentTurnStart; + default: + AIConsoleUtility.LogError("AIBarrierSimulationUtility.GetBarrierStopTimingFromArgType() error!! argument " + argument.ToString() + " is illegal!!!!!"); + return AIBarrierStopTiming.None; + } + } + + public static ulong CalculateBarrierInfoBaseHash(AIDamageType damageType, AIBarrierType barrierType, List stopTimingList) + { + ulong num = 0uL; + num += (ulong)((long)damageType * (long)DAMAGE_TYPE_HASH_COEFFICIENT); + num += (ulong)((long)barrierType * (long)BARRIER_TYPE_HASH_COEFFICIENT); + if (stopTimingList != null && stopTimingList.Count > 0) + { + for (int i = 0; i < stopTimingList.Count; i++) + { + int num2 = i % 5; + num += (ulong)((long)stopTimingList[i] * (long)STOP_TIMING_HASH_COEFFICIENT_ARRAY[num2]); + } + } + return num; + } + + public static ulong CalculateBarrierInfoBaseHash(AIDamageType damageType, AIBarrierType barrierType, AIBarrierStopTiming stopTiming) + { + return (ulong)(0 + (long)damageType * (long)DAMAGE_TYPE_HASH_COEFFICIENT + (long)barrierType * (long)BARRIER_TYPE_HASH_COEFFICIENT + (long)stopTiming * (long)STOP_TIMING_HASH_COEFFICIENT_ARRAY[0]); + } + + public static ulong CalculateDamageCutInfoHash(AIDamageType damageType, AIBarrierType barrierType, List stopTimingList, int cutAmount) + { + return CalculateBarrierInfoBaseHash(damageType, barrierType, stopTimingList) + (ulong)((long)cutAmount * (long)BARRIER_AMOUNT_HASH_COEFFICIENT); + } + + public static ulong CalculateDamageCutInfoHash(AIDamageType damageType, AIBarrierType barrierType, AIBarrierStopTiming stopTiming, int cutAmount) + { + return CalculateBarrierInfoBaseHash(damageType, barrierType, stopTiming) + (ulong)((long)cutAmount * (long)BARRIER_AMOUNT_HASH_COEFFICIENT); + } + + public static ulong CalculateDamageClipInfoHash(AIDamageType damageType, AIBarrierType barrierType, List stopTimingList, int clipAmount, int clipRange) + { + return (ulong)((long)CalculateBarrierInfoBaseHash(damageType, barrierType, stopTimingList) + (long)clipAmount * (long)BARRIER_AMOUNT_HASH_COEFFICIENT + (long)clipRange * (long)DAMAGE_CLIP_RANGE_COEFFICIENT); + } + + public static ulong CalculateDamageClipInfoHash(AIDamageType damageType, AIBarrierType barrierType, AIBarrierStopTiming stopTiming, int clipAmount, int clipRange) + { + return (ulong)((long)CalculateBarrierInfoBaseHash(damageType, barrierType, stopTiming) + (long)clipAmount * (long)BARRIER_AMOUNT_HASH_COEFFICIENT + (long)clipRange * (long)DAMAGE_CLIP_RANGE_COEFFICIENT); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBarrierStopPreprocessOption.cs b/SVSim.BattleEngine/Engine/Wizard/AIBarrierStopPreprocessOption.cs new file mode 100644 index 0000000..9d1b2c2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBarrierStopPreprocessOption.cs @@ -0,0 +1,12 @@ +namespace Wizard; + +public class AIBarrierStopPreprocessOption : AITagPreprocessCreationOptionBase +{ + public ulong BarrierHash { get; private set; } + + public AIBarrierStopPreprocessOption(AIVirtualCard target, ulong hash) + : base(AITagPreprocessInfoType.BARRIER_STOP, target) + { + BarrierHash = hash; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBarrierTurnEndStopInformation.cs b/SVSim.BattleEngine/Engine/Wizard/AIBarrierTurnEndStopInformation.cs new file mode 100644 index 0000000..895a154 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBarrierTurnEndStopInformation.cs @@ -0,0 +1,33 @@ +namespace Wizard; + +public class AIBarrierTurnEndStopInformation : AITurnEndStopInformation +{ + private ulong _barrierHash; + + public AIBarrierTurnEndStopInformation(AIBarrierStopPreprocessOption option) + : base(option.TargetCard) + { + _barrierHash = option.BarrierHash; + base.Type = AITagPreprocessInfoType.BARRIER_STOP; + } + + protected override void RunMethod(bool isAllyTurnEnd, AIVirtualTurnEndInfo situation) + { + if (base.TargetCard != null) + { + if (isAllyTurnEnd) + { + base.TargetCard.BarrierInfoCollection.DepriveCertainBarrier(_barrierHash, AIBarrierStopTiming.AllyTurnEnd); + } + else + { + base.TargetCard.BarrierInfoCollection.DepriveCertainBarrier(_barrierHash, AIBarrierStopTiming.OpponentTurnEnd); + } + } + } + + public override AITagPreprocessCreationOptionBase CreateOptionInfoForOverride(AIVirtualCard overridedTarget) + { + return new AIBarrierStopPreprocessOption(overridedTarget, _barrierHash); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBarrierTurnStartStopInformation.cs b/SVSim.BattleEngine/Engine/Wizard/AIBarrierTurnStartStopInformation.cs new file mode 100644 index 0000000..ae98d15 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBarrierTurnStartStopInformation.cs @@ -0,0 +1,33 @@ +namespace Wizard; + +public class AIBarrierTurnStartStopInformation : AITurnStartStopInformation +{ + private ulong _barrierHash; + + public AIBarrierTurnStartStopInformation(AIBarrierStopPreprocessOption option) + : base(option.TargetCard) + { + base.Type = AITagPreprocessInfoType.BARRIER_STOP; + _barrierHash = option.BarrierHash; + } + + public override void ExecuteReservedAction(bool isAllyTurnEnd, AISituationInfo situation) + { + if (base.TargetCard != null) + { + if (isAllyTurnEnd) + { + base.TargetCard.BarrierInfoCollection.DepriveCertainBarrier(_barrierHash, AIBarrierStopTiming.AllyTurnStart); + } + else + { + base.TargetCard.BarrierInfoCollection.DepriveCertainBarrier(_barrierHash, AIBarrierStopTiming.OpponentTurnStart); + } + } + } + + public override AITagPreprocessCreationOptionBase CreateOptionInfoForOverride(AIVirtualCard overridedTarget) + { + return new AIBarrierStopPreprocessOption(overridedTarget, _barrierHash); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBattleInfoReceiver.cs b/SVSim.BattleEngine/Engine/Wizard/AIBattleInfoReceiver.cs new file mode 100644 index 0000000..345b86e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBattleInfoReceiver.cs @@ -0,0 +1,121 @@ +using System.Linq; + +namespace Wizard; + +public class AIBattleInfoReceiver +{ + private const string NOT_FOUND_INSTANCE_LOG = "AIBattleInfoReceiver.GetInstance() error. battleMgr does not have battleInfoReceiver."; + + private IEnemyAIBattleInfoRecieveDataAccessor _enemyAI; + + private AIGenerateTagOwnerTable _oprSimGenerateTagOwnerTable; + + private AIBattleInfoReceivedData _oprSimBattleInfoReceiveData; + + private bool _isExecutingOprSim; + + public bool IsNotNullOprSimCollections + { + get + { + if (_oprSimGenerateTagOwnerTable != null) + { + return _oprSimBattleInfoReceiveData != null; + } + return false; + } + } + + public static bool CheckCreatedValidEnemyAI() + { + return BattleManagerBase.GetIns().EnemyAI is IEnemyAIBattleInfoRecieveDataAccessor; + } + + public static AIBattleInfoReceiver GetInstance() + { + AIBattleInfoReceiver result = null; + BattleManagerBase ins = BattleManagerBase.GetIns(); + if (ins is SingleBattleMgr singleBattleMgr) + { + result = singleBattleMgr.BattleInfoReceiver; + } + else if (ins is AINetworkBattleManager aINetworkBattleManager) + { + result = aINetworkBattleManager.BattleInfoReceiver; + } + return result; + } + + public static void ShowNotFoundInstanceLog() + { + LocalLog.AccumulateTraceLog("AIBattleInfoReceiver.GetInstance() error. battleMgr does not have battleInfoReceiver."); + } + + public AIBattleInfoReceiver(IEnemyAI enemyAI) + { + _enemyAI = enemyAI as IEnemyAIBattleInfoRecieveDataAccessor; + } + + public void ReceiveAttachedSkillInfo(BattleCardBase skillOwner, BattleCardBase target) + { + string lastAttachedSkillHash = GetLastAttachedSkillHash(target); + if (_isExecutingOprSim && IsNotNullOprSimCollections) + { + RegisterAttachedSkillInfoToOperationSimulator(skillOwner, target, lastAttachedSkillHash); + } + else + { + RegisterAttachedSkillInfoToRealField(skillOwner, target, lastAttachedSkillHash); + } + } + + protected virtual void RegisterAttachedSkillInfoToRealField(BattleCardBase skillOwner, BattleCardBase target, string skillHash) + { + if (_enemyAI != null) + { + RegisterGenerateTagExecutingParameters(_enemyAI.GenerateTagOwnerTable, _enemyAI.BattleInfoReceivedData, skillOwner, target, skillHash); + } + } + + protected string GetLastAttachedSkillHash(BattleCardBase target) + { + AttachedSkillInformation attachedSkillsInfo = target.SkillApplyInformation.AttachedSkillsInfo; + if (attachedSkillsInfo == null || attachedSkillsInfo.AttachedSkills == null || attachedSkillsInfo.AttachedSkills.Count() <= 0) + { + return null; + } + SkillBase skillBase = attachedSkillsInfo.AttachedSkills.Get(attachedSkillsInfo.AttachedSkills.Count() - 1); + if (skillBase == null) + { + return null; + } + return CardSkillHashUtility.GetSingleSkillBaseHash(skillBase).ToString(); + } + + protected void RegisterGenerateTagExecutingParameters(AIGenerateTagOwnerTable generateTagOwnerTable, AIBattleInfoReceivedData battleInfoReceivedData, BattleCardBase skillOwner, BattleCardBase target, string skillHash) + { + battleInfoReceivedData.AttachedInfoReceiveCollection.GetInfoFromOwner(skillOwner.BaseParameter.BaseCardId, skillOwner.Index, skillOwner.IsPlayer)?.AddTargetAndSkillHash(target, skillHash); + } + + public void SetUpOprSimAccessor(AIOperationSimulatorAccessor oprSimAccessor) + { + _isExecutingOprSim = true; + _oprSimGenerateTagOwnerTable = oprSimAccessor.GenerateTagOwnerTable; + _oprSimBattleInfoReceiveData = oprSimAccessor.BattleInfoReceiveDate; + } + + public void CleanUpOprSimAccessor() + { + _isExecutingOprSim = false; + _oprSimGenerateTagOwnerTable = null; + _oprSimBattleInfoReceiveData = null; + } + + protected void RegisterAttachedSkillInfoToOperationSimulator(BattleCardBase skillOwner, BattleCardBase target, string skillHash) + { + if (IsNotNullOprSimCollections) + { + RegisterGenerateTagExecutingParameters(_oprSimGenerateTagOwnerTable, _oprSimBattleInfoReceiveData, skillOwner, target, skillHash); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBattleSimulationLauncher.cs b/SVSim.BattleEngine/Engine/Wizard/AIBattleSimulationLauncher.cs new file mode 100644 index 0000000..917a216 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBattleSimulationLauncher.cs @@ -0,0 +1,75 @@ +using System.Collections; +using System.Collections.Generic; + +namespace Wizard; + +public class AIBattleSimulationLauncher +{ + private EnemyAI _ai; + + private bool _isTimeOverLogic; + + private bool _isUseEmptyPlayPtnSimulator; + + private bool _isEvol; + + private AIVirtualField _field; + + private SimulationAdditionalActionInfoSet _additionalActions; + + public IBattleSimulationAI BattleSimAI { get; private set; } + + public AIBattleSimulationLauncher(AIVirtualField field, EnemyAI ai, bool useEvo, IBattleSimulationAI emptyPlayPtnSimulator = null, SimulationAdditionalActionInfoSet additionalActionInfoSet = null) + { + _ai = ai; + _isEvol = useEvo; + _field = field; + _additionalActions = additionalActionInfoSet; + CreateSimulator(emptyPlayPtnSimulator); + } + + private void CreateSimulator(IBattleSimulationAI emptyPlayPtnSimulator) + { + if (_ai.IsRunWeakLogic) + { + _isTimeOverLogic = true; + if (_isEvol && _ai.BestPlayPtn.Count <= 0 && emptyPlayPtnSimulator != null) + { + BattleSimAI = emptyPlayPtnSimulator; + _isUseEmptyPlayPtnSimulator = true; + } + else + { + BattleSimAI = new AITimeOverAttackSimulator(); + } + return; + } + List allMovesForFullSimulation = AISimulationUtility.GetAllMovesForFullSimulation(_field, _isEvol, _additionalActions); + if (allMovesForFullSimulation.Count <= AISimulationUtility.FULL_SIMULATION_MOVE_COUNT_TURESHOLD) + { + BattleSimAI = new FullSimulationAI(_ai, allMovesForFullSimulation); + } + else if (_isEvol && _ai.BestPlayPtn.Count <= 0 && emptyPlayPtnSimulator != null) + { + BattleSimAI = emptyPlayPtnSimulator; + _isUseEmptyPlayPtnSimulator = true; + } + else + { + BattleSimAI = new BestInPlayMoveAI(_ai); + } + } + + public IEnumerator ExecuteBattleSimulationAI(PlayPtnWithToken[] playPtnWithToken, bool checkTimeOverLogic) + { + if (!_isUseEmptyPlayPtnSimulator) + { + yield return EnemyAICoroutine.GetInstance().StartCoroutine(BattleSimAI._CrSimulate(_field, _isEvol, !_isTimeOverLogic && checkTimeOverLogic, playPtnWithToken, _additionalActions)); + if (_ai.IsRunWeakLogic && !_isTimeOverLogic && checkTimeOverLogic) + { + BattleSimAI = new AITimeOverAttackSimulator(); + yield return EnemyAICoroutine.GetInstance().StartCoroutine(BattleSimAI._CrSimulate(_field, _isEvol, checkTimeOverLogic: false, playPtnWithToken, _additionalActions)); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBattleStartData.cs b/SVSim.BattleEngine/Engine/Wizard/AIBattleStartData.cs new file mode 100644 index 0000000..7912658 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBattleStartData.cs @@ -0,0 +1,13 @@ +namespace Wizard; + +public class AIBattleStartData : HeaderData +{ + public AIBattleStartDetail Data; + + public int TurnState = -1; + + public AIBattleStartData() + { + Data = new AIBattleStartDetail(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBattleStartDetail.cs b/SVSim.BattleEngine/Engine/Wizard/AIBattleStartDetail.cs new file mode 100644 index 0000000..635aded --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBattleStartDetail.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBattleStartDetail +{ + public class UserInfo + { + public Dictionary DataDictionary; + + public UserInfo() + { + DataDictionary = new Dictionary(); + } + } + + public int AIid; + + public UserInfo SelfInfo; + + public UserInfo OppoInfo; + + public AIBattleStartDetail() + { + SelfInfo = new UserInfo(); + OppoInfo = new UserInfo(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBattleStartTask.cs b/SVSim.BattleEngine/Engine/Wizard/AIBattleStartTask.cs new file mode 100644 index 0000000..911223c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBattleStartTask.cs @@ -0,0 +1,54 @@ +using LitJson; + +namespace Wizard; + +public class AIBattleStartTask : BaseTask +{ + public AIBattleStartTask() + { + base.type = ((Data.CurrentFormat == Format.Rotation) ? ApiType.Type.AIRotationRankBattleStart : ApiType.Type.AIUnlimitedRankBattleStart); + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + Data.AIBattleStartData = new AIBattleStartData(); + Data.AIBattleStartData.Data.AIid = (jsonData.Keys.Contains("ai_id") ? jsonData["ai_id"].ToInt() : (-1)); + Data.AIBattleStartData.TurnState = (jsonData.Keys.Contains("turnState") ? jsonData["turnState"].ToInt() : (-1)); + SetAIBattleStartDetail(Data.AIBattleStartData.Data.SelfInfo, jsonData, "self_info"); + SetAIBattleStartDetail(Data.AIBattleStartData.Data.OppoInfo, jsonData, "oppo_info"); + return num; + } + + private void SetAIBattleStartDetail(AIBattleStartDetail.UserInfo info, JsonData data, string userKey) + { + JsonData jsonData = null; + if (data.Keys.Contains(userKey)) + { + jsonData = data[userKey]; + } + if (jsonData != null) + { + info.DataDictionary.Add("country_code", jsonData.Keys.Contains("country_code") ? jsonData["country_code"] : ((JsonData)"NONE")); + info.DataDictionary.Add("userName", jsonData.Keys.Contains("userName") ? jsonData["userName"] : ((JsonData)"NONE")); + info.DataDictionary.Add("sleeveId", jsonData.Keys.Contains("sleeveId") ? jsonData["sleeveId"].ToInt() : (-1)); + info.DataDictionary.Add("emblemId", jsonData.Keys.Contains("emblemId") ? jsonData["emblemId"].ToInt() : (-1)); + info.DataDictionary.Add("degreeId", jsonData.Keys.Contains("degreeId") ? jsonData["degreeId"].ToInt() : (-1)); + info.DataDictionary.Add("fieldId", jsonData.Keys.Contains("fieldId") ? jsonData["fieldId"].ToInt() : (-1)); + info.DataDictionary.Add("isOfficial", jsonData.Keys.Contains("isOfficial") ? jsonData["isOfficial"].ToInt() : (-1)); + info.DataDictionary.Add("oppoId", jsonData.Keys.Contains("oppoId") ? jsonData["oppoId"].ToInt() : (-1)); + info.DataDictionary.Add("seed", jsonData.Keys.Contains("seed") ? jsonData["seed"].ToInt() : (-1)); + info.DataDictionary.Add("rank", jsonData.Keys.Contains("rank") ? jsonData["rank"].ToInt() : (-1)); + info.DataDictionary.Add("battlePoint", jsonData.Keys.Contains("battlePoint") ? jsonData["battlePoint"].ToInt() : (-1)); + info.DataDictionary.Add("classId", jsonData.Keys.Contains("classId") ? jsonData["classId"].ToInt() : (-1)); + info.DataDictionary.Add("charaId", jsonData.Keys.Contains("charaId") ? jsonData["charaId"].ToInt() : (-1)); + info.DataDictionary.Add("isMasterRank", jsonData.Keys.Contains("isMasterRank") ? jsonData["isMasterRank"].ToInt() : (-1)); + info.DataDictionary.Add("masterPoint", jsonData.Keys.Contains("masterPoint") ? jsonData["masterPoint"].ToInt() : (-1)); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBestFusionPatternCalculator.cs b/SVSim.BattleEngine/Engine/Wizard/AIBestFusionPatternCalculator.cs new file mode 100644 index 0000000..e86f2e7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBestFusionPatternCalculator.cs @@ -0,0 +1,188 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Wizard; + +public static class AIBestFusionPatternCalculator +{ + public static AIFusionSituationInfo CalculateBestFusionPattern(AIVirtualField field, AISinglePlayptnRecord playPtnRecord) + { + AIFusionSituationInfo aIFusionSituationInfo = null; + float num = 0f; + List playPtn = playPtnRecord.PlayPtn; + List collection = CalculateAllHandBonus(field, playPtnRecord); + float num2 = 0f; + if (playPtn == null || playPtn.Count <= 0) + { + num2 -= CalculateHandOverflowPenalty(field, null, null); + } + for (int i = 0; i < field.AllyHandCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyHandCards[i]; + if (!aIVirtualCard.TagCollectionContainer.HasTag(AIPlayTagType.Fusion) || !aIVirtualCard.IsFusionable) + { + continue; + } + AIFusionSituationInfo aIFusionSituationInfo2 = CreateFusionSituation(aIVirtualCard, field, playPtn); + float value = CalculateHandBonusForFusion(aIVirtualCard, field, playPtnRecord, aIFusionSituationInfo2, isIgnoreInFusion: true); + List list = new List(collection); + list[i] = value; + float num3 = list.Sum() + num2; + List fusionCandidates = GetFusionCandidates(aIVirtualCard, field, aIFusionSituationInfo2, playPtn); + if (fusionCandidates == null || fusionCandidates.Count <= 0) + { + continue; + } + int count = fusionCandidates.Count; + int num4 = (int)Mathf.Pow(2f, count); + AISelectedTargetInfo info = null; + bool flag = false; + for (int j = 1; j < num4; j++) + { + AISelectedTargetInfo aISelectedTargetInfo = new AISelectedTargetInfo(ConvertPatternIndexToList(fusionCandidates, j), TargetSelectType.NormalRuleBase); + aIFusionSituationInfo2.SetTarget(aISelectedTargetInfo, AIScriptTokenArgType.TARGET_SELECT); + float num5 = CalculateAfterFusionHandValue(aIFusionSituationInfo2, field, playPtnRecord, list) - num3; + if (num5 > num) + { + flag = true; + num = num5; + info = aISelectedTargetInfo; + } + } + if (flag) + { + aIFusionSituationInfo = aIFusionSituationInfo2; + aIFusionSituationInfo.SetTarget(info, AIScriptTokenArgType.TARGET_SELECT); + } + } + return aIFusionSituationInfo; + } + + private static AIFusionSituationInfo CreateFusionSituation(AIVirtualCard actor, AIVirtualField field, List playPtn) + { + AIFusionSituationInfo aIFusionSituationInfo = new AIFusionSituationInfo(actor, null); + if (!aIFusionSituationInfo.InitializeFusionParameter(field, playPtn)) + { + return null; + } + return aIFusionSituationInfo; + } + + private static List GetFusionCandidates(AIVirtualCard actor, AIVirtualField field, AIFusionSituationInfo fusion, List playPtn) + { + List list = AIFilteringUtility.MultipleFiltering(field.AllyHandCards, fusion.Range, actor, playPtn, fusion); + if (list == null || list.Count <= 0) + { + return null; + } + list.Remove(actor); + return list; + } + + private static List ConvertPatternIndexToList(List candidates, int patternIndex) + { + int num = patternIndex; + List list = new List(); + int num2 = 0; + while (num > 0) + { + bool flag = num % 2 > 0; + num /= 2; + if (flag) + { + list.Add(candidates[num2]); + } + num2++; + if (num2 >= candidates.Count) + { + break; + } + } + return list; + } + + private static List CalculateAllHandBonus(AIVirtualField field, AISinglePlayptnRecord playPtnRecord) + { + List list = new List(); + for (int i = 0; i < field.AllyHandCards.Count; i++) + { + float item = CalculateHandBonusForFusion(field.AllyHandCards[i], field, playPtnRecord, null, isIgnoreInFusion: false); + list.Add(item); + } + return list; + } + + private static float CalculateAfterFusionHandValue(AIFusionSituationInfo fusion, AIVirtualField field, AISinglePlayptnRecord playPtnRecord, List allHandBonusList) + { + float num = 0f; + List playPtn = playPtnRecord.PlayPtn; + List targets = fusion.GetSituationTarget(AIScriptTokenArgType.TARGET_SELECT).Targets; + for (int i = 0; i < field.AllyHandCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyHandCards[i]; + if (!targets.Contains(aIVirtualCard)) + { + num = ((!aIVirtualCard.IsSameCard(fusion.Actor)) ? (num + allHandBonusList[i]) : (num + CalculateHandBonusForFusion(aIVirtualCard, field, playPtnRecord, fusion, isIgnoreInFusion: true))); + } + } + num += fusion.Actor.GetFusionBonus(playPtn, fusion); + if (playPtn == null || playPtn.Count <= 0) + { + num -= CalculateHandOverflowPenalty(field, targets, fusion); + } + return num; + } + + private static float CalculateHandBonusForFusion(AIVirtualCard card, AIVirtualField field, AISinglePlayptnRecord playPtnRecord, AIFusionSituationInfo fusion, bool isIgnoreInFusion) + { + List playPtn = playPtnRecord.PlayPtn; + float num = card.GetHandBonus(playPtn, fusion, isIgnoreInFusion); + bool flag = false; + float num2 = card.Cost; + int num3 = field.AllyPp; + for (int i = 0; i < playPtnRecord.PlayedCardList.Count; i++) + { + PlayedCardInfo playedCardInfo = playPtnRecord.PlayedCardList[i]; + if (playedCardInfo.Card.IsSameCard(card)) + { + flag = true; + num2 = num3 - playedCardInfo.RestPp; + break; + } + num3 = playedCardInfo.RestPp; + } + if (flag) + { + num = 2f * (num + 2f); + } + return num - Mathf.Abs(num2 - (float)field.AllyPpTotal) * 0.01f; + } + + private static float CalculateHandOverflowPenalty(AIVirtualField field, List fusionCandidates, AISituationInfo fusionSituation) + { + float num = 0f; + int num2 = field.AllyHandCards.Count; + if (fusionCandidates != null && fusionSituation != null && fusionSituation.ActionType == AIOperationType.FUSION) + { + num2 -= fusionCandidates.Count; + int fusionDrawCount = fusionSituation.Actor.GetFusionDrawCount(EnemyAI.EmptyPlayPtn, fusionSituation); + num2 += fusionDrawCount; + if (num2 > 9) + { + num += 2f * (float)(num2 - 9); + num2 = 9; + } + } + for (int i = 0; i < field.AllyInplayCards.Count; i++) + { + AIVirtualCard tagOwner = field.AllyInplayCards[i]; + num2 += tagOwner.GetHandPlusCount(EnemyAI.EmptyPlayPtn); + } + if (num2 > 8) + { + num += 2f * (float)(num2 - 8); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBonusArgumentWithIgnoreInBattle.cs b/SVSim.BattleEngine/Engine/Wizard/AIBonusArgumentWithIgnoreInBattle.cs new file mode 100644 index 0000000..576a17d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBonusArgumentWithIgnoreInBattle.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBonusArgumentWithIgnoreInBattle : AIScriptArgumentExpressions +{ + protected AIPolishConvertedExpression _bonusValueArg; + + protected int _valueIndexOffset; + + public bool IsIgnoreInBattle { get; private set; } + + public AIBonusArgumentWithIgnoreInBattle(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (!(_exprList[_exprList.Count - 1].TokenList[0] is AIScriptArgumentToken aIScriptArgumentToken) || (aIScriptArgumentToken.ArgumentType != AIScriptTokenArgType.IGNORE_IN_BATTLE && aIScriptArgumentToken.ArgumentType != AIScriptTokenArgType.IGNORE_IN_FUSION)) + { + _valueIndexOffset = 1; + IsIgnoreInBattle = false; + } + else + { + _valueIndexOffset = 2; + IsIgnoreInBattle = true; + } + _bonusValueArg = _exprList[_exprList.Count - _valueIndexOffset]; + } + + public virtual float GetBonusValue(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool useIgnoreInBattle) + { + if (tagOwner == null || (useIgnoreInBattle && IsIgnoreInBattle)) + { + return 0f; + } + return _bonusValueArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBounceDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIBounceDamage.cs new file mode 100644 index 0000000..067e2de --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBounceDamage.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBounceDamage : AITriggerAndTargetFiltersTagBase +{ + private readonly int DAMAGE_OFFSET = 1; + + private readonly int SELECT_TYPE_OFFSET = 2; + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIPolishConvertedExpression Damage { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AIBounceDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (IsLegalSelectType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], out var selectType)) + { + SelectType = selectType; + } + Damage = _exprList[_exprList.Count - DAMAGE_OFFSET]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + int damage = (int)Damage.EvalArg(tagOwner, playPtn, field, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIDamageSimulationUtility.DamageAll(targets, tagOwner, field, damage, situation); + } + else if (SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIDamageSimulationUtility.DamageRandom(targets, tagOwner, field, damage, situation); + } + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBreakAddStack.cs b/SVSim.BattleEngine/Engine/Wizard/AIBreakAddStack.cs new file mode 100644 index 0000000..0445fb6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBreakAddStack.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBreakAddStack : AITriggerAndTargetFiltersTagBase +{ + private readonly int RITUAL_COUNT_OFFSET = 1; + + public AIPolishConvertedExpression RitualCount { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => RITUAL_COUNT_OFFSET; + + public AIBreakAddStack(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + RitualCount = _exprList[_exprList.Count - RITUAL_COUNT_OFFSET]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets == null || targets.Count <= 0) + { + AIConsoleUtility.LogError("AIBreakAddStack : RunTagMethod() Error!!! Missing Target"); + } + else + { + AIWhiteRitualSimulationUtility.AddWhiteRitualSingle((int)RitualCount.EvalArg(tagOwner, playPtn, field, situation), targets); + } + } + + protected override List GetTargets(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List candidateRange = GetCandidateRange(field); + return GetFilteredTargets(candidateRange, tagOwner, playPtn, situation); + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForWhiteRitualOnly(candidates, tagOwner, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBreakAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIBreakAttachTag.cs new file mode 100644 index 0000000..02d0f77 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBreakAttachTag.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBreakAttachTag : AITriggerAndTargetFiltersTagBase +{ + private const int TIMING_OFFSET = 1; + + public AIPlayTag AttachedTag { get; private set; } + + public AIScriptTokenArgType RemoveTiming { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIBreakAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + RemoveTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + if (list.Count <= AIPlayTag.TAG_WORDS_LENTGH) + { + AttachedTag = null; + } + else + { + AttachedTag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targets, tagOwner, AttachedTag, RemoveTiming, situation); + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (AttachedTag != null) + { + return AttachedTag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBreakBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIBreakBuff.cs new file mode 100644 index 0000000..f531d13 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBreakBuff.cs @@ -0,0 +1,71 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBreakBuff : AITriggerAndTargetFiltersTagBase +{ + private readonly int LIFE_ARG_OFFSET = 1; + + private readonly int ATTACK_ARG_OFFSET = 2; + + private readonly int SELECT_TYPE_ARG_OFFSET = 3; + + public AIPolishConvertedExpression Attack { get; private set; } + + public AIPolishConvertedExpression Life { get; private set; } + + public AIScriptTokenArgType SelectType { get; protected set; } + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_ARG_OFFSET; + + public AIBreakBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Attack = _exprList[_exprList.Count - ATTACK_ARG_OFFSET]; + Life = _exprList[_exprList.Count - LIFE_ARG_OFFSET]; + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_ARG_OFFSET], base.LegalSelectTypes); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, Attack, Life); + switch (SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBuffSimulationUtility.BuffAll_old(targets, field, buffExecutingInfo_old, isTemp: false, playPtn, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIBuffSimulationUtility.BuffRandom_old(targets, field, playPtn, situation, buffExecutingInfo_old, isTemp: false); + break; + } + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool isAttackEffective = !Attack.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBreakDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIBreakDamage.cs new file mode 100644 index 0000000..55b6c7b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBreakDamage.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBreakDamage : AITriggerAndTargetFiltersTagBase +{ + private readonly int DAMAGE_OFFSET = 1; + + private readonly int SELECT_TYPE_OFFSET = 2; + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIPolishConvertedExpression Damage { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AIBreakDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIScriptTokenArgType selectType = AIScriptTokenArgType.NONE; + if (IsLegalSelectType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], out selectType)) + { + SelectType = selectType; + } + Damage = _exprList[_exprList.Count - DAMAGE_OFFSET]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + int damage = (int)Damage.EvalArg(tagOwner, playPtn, field, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIDamageSimulationUtility.DamageAll(targets, tagOwner, field, damage, situation); + } + else if (SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIDamageSimulationUtility.DamageRandom(targets, tagOwner, field, damage, situation); + } + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBreakDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AIBreakDestroy.cs new file mode 100644 index 0000000..f89ec10 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBreakDestroy.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBreakDestroy : AITriggerAndTargetFiltersTagBase +{ + private readonly int SELECT_TYPE_OFFSET = 1; + + public AIScriptTokenArgType SelectType { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AIBreakDestroy(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIScriptTokenArgType selectType = AIScriptTokenArgType.NONE; + if (IsLegalSelectType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], out selectType)) + { + SelectType = selectType; + } + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.DestroyAll(targets, field, situation); + } + else if (SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AISkillSimulationUtility.DestroyRandom(targets, tagOwner, field, playPtn, situation); + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBreakHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIBreakHeal.cs new file mode 100644 index 0000000..3f3208e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBreakHeal.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBreakHeal : AITriggerAndTargetFiltersTagBase +{ + private readonly int HEAL_AMOUNT_OFFSET = 1; + + private readonly int SELECT_TYPE_OFFSET = 2; + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIPolishConvertedExpression Heal { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AIBreakHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIScriptTokenArgType selectType = AIScriptTokenArgType.NONE; + if (IsLegalSelectType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], out selectType)) + { + SelectType = selectType; + } + Heal = _exprList[_exprList.Count - HEAL_AMOUNT_OFFSET]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + int heal = (int)Heal.EvalArg(tagOwner, playPtn, field, situation); + AIScriptTokenArgType selectType = SelectType; + if (selectType != AIScriptTokenArgType.RANDOM_SELECT && selectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targets, field, heal, playPtn, situation); + } + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBreakRecoverAttackableCount.cs b/SVSim.BattleEngine/Engine/Wizard/AIBreakRecoverAttackableCount.cs new file mode 100644 index 0000000..a25c1d7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBreakRecoverAttackableCount.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBreakRecoverAttackableCount : AITriggerAndTargetFiltersTagBase +{ + protected override int NON_FILTER_FIRST_OFFSET => 0; + + public AIBreakRecoverAttackableCount(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets == null || targets.Count <= 0) + { + return; + } + foreach (AIVirtualCard target in targets) + { + target.RecoverAttackableCount(); + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBreakRecoverPp.cs b/SVSim.BattleEngine/Engine/Wizard/AIBreakRecoverPp.cs new file mode 100644 index 0000000..b7a06bd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBreakRecoverPp.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBreakRecoverPp : AITriggerAndTargetFiltersTagBase +{ + private AIPolishConvertedExpression _recoverPpValue; + + private const int VALUE_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIBreakRecoverPp(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _recoverPpValue = _exprList[_exprList.Count - 1]; + } + + private int GetRecoverValue(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (_recoverPpValue == null) + { + return 0; + } + return (int)_recoverPpValue.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + field.RecoverPp(GetRecoverValue(tagOwner, playPtn, situation)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBreakSetLeaderMaxLife.cs b/SVSim.BattleEngine/Engine/Wizard/AIBreakSetLeaderMaxLife.cs new file mode 100644 index 0000000..3816495 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBreakSetLeaderMaxLife.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBreakSetLeaderMaxLife : AIFiltersArgument +{ + private AIScriptTokenArgType _side; + + private AIPolishConvertedExpression _life; + + private const int SIDE_OFFSET = 2; + + private const int VALUE_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIBreakSetLeaderMaxLife(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _side = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2]); + _life = _exprList[_exprList.Count - 1]; + } + + protected override void RunMethod(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int maxLife = (int)_life.EvalArg(tagOwner, playPtn, field, situation); + AISetStatusSimulationUtility.SetLeaderMaxLife(tagOwner, maxLife, _side, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffBuff.cs new file mode 100644 index 0000000..b51d478 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffBuff.cs @@ -0,0 +1,71 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBuffBuff : AITriggerAndTargetFiltersTagBase +{ + private static readonly AIScriptTokenArgType[] PermOrTempArgs = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.PERM, + AIScriptTokenArgType.TEMP + }; + + private AIScriptTokenArgType _selectType; + + private AIPolishConvertedExpression _attackBuffValue; + + private AIPolishConvertedExpression _lifeBuffValue; + + private AIScriptTokenArgType _permOrTemp; + + private const int PERM_OR_TEMP_OFFSET = 1; + + private const int LIFE_BUFF_OFFSET = 2; + + private const int ATTACK_BUFF_OFFSET = 3; + + private const int SELECT_TYPE_OFFSET = 4; + + protected override int NON_FILTER_FIRST_OFFSET => 4; + + public AIBuffBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _selectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 4], base.LegalSelectTypes); + _attackBuffValue = _exprList[_exprList.Count - 3]; + _lifeBuffValue = _exprList[_exprList.Count - 2]; + _permOrTemp = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1], PermOrTempArgs); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, _attackBuffValue, _lifeBuffValue); + bool isTemp = _permOrTemp == AIScriptTokenArgType.TEMP; + switch (_selectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBuffSimulationUtility.BuffAll_old(targets, field, buffExecutingInfo_old, isTemp, playPtn, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIBuffSimulationUtility.BuffRandom_old(targets, field, playPtn, situation, buffExecutingInfo_old, isTemp); + break; + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool isAttackEffective = !_attackBuffValue.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffDamage.cs new file mode 100644 index 0000000..780e4b0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffDamage.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBuffDamage : AITriggerAndTargetFiltersTagBase +{ + private const int DAMAGE_ARG_OFFSET = 1; + + private AIPolishConvertedExpression _damageArg; + + public AIScriptTokenArgType SelectType { get; private set; } + + protected int SELECT_TYPE_OFFSET => 2; + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIBuffDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIScriptTokenArgType selectType = AIScriptTokenArgType.NONE; + if (IsLegalSelectType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], out selectType)) + { + SelectType = selectType; + } + _damageArg = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + int damage = GetDamage(tagOwner, playPtn, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIDamageSimulationUtility.DamageAll(targets, tagOwner, field, damage, situation); + } + else if (SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIDamageSimulationUtility.DamageRandom(targets, tagOwner, field, damage, situation); + } + } + } + + private int GetDamage(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (_damageArg == null) + { + return 0; + } + return (int)_damageArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffDestroy.cs new file mode 100644 index 0000000..68b95a6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffDestroy.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBuffDestroy : AITriggerAndTargetFiltersTagBase +{ + private readonly int SELECT_TYPE_OFFSET = 1; + + public AIScriptTokenArgType SelectType { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AIBuffDestroy(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIScriptTokenArgType selectType = AIScriptTokenArgType.NONE; + if (IsLegalSelectType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], out selectType)) + { + SelectType = selectType; + } + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.DestroyAll(targets, field, situation); + } + else if (SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AISkillSimulationUtility.DestroyRandom(targets, tagOwner, field, playPtn, situation); + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffDraw.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffDraw.cs new file mode 100644 index 0000000..ad8adc7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffDraw.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBuffDraw : AIScriptArgumentExpressions +{ + private const int COUNT_ARG_INDEX = 1; + + public AIPolishConvertedExpression DrawCount { get; private set; } + + public AIBuffDraw(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + DrawCount = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (DrawCount != null) + { + int drawCount = (int)DrawCount.EvalArg(tagOwner, playPtn, field, situation); + tagOwner.SelfField.DrawCard(tagOwner.IsAlly, drawCount, playPtn, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffEvo.cs new file mode 100644 index 0000000..2ca5d3f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffEvo.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBuffEvo : AIScriptArgumentExpressions +{ + public AIBuffEvo(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + if (!tagOwner.IsEvolution) + { + AIAutoEvolutionSimulationUtility.AutoEvolveSingle(tagOwner, field, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffHeal.cs new file mode 100644 index 0000000..5b998ab --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffHeal.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBuffHeal : AITriggerAndTargetFiltersTagBase +{ + private const int HEAL_AMOUNT_ARG_OFFSET = 1; + + private AIPolishConvertedExpression _healArg; + + public AIScriptTokenArgType SelectType { get; private set; } + + protected int SELECT_TYPE_OFFSET => 2; + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIBuffHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], base.LegalSelectTypes); + _healArg = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + int heal = (int)_healArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targets, field, heal, playPtn, situation); + } + else if (SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AISkillSimulationUtility.HealSingle(targets[0], field, heal, playPtn, situation); + } + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffRecoverPp.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffRecoverPp.cs new file mode 100644 index 0000000..853c9f5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffRecoverPp.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBuffRecoverPp : AITriggerAndTargetFiltersTagBase +{ + private const int HEAL_ARG_OFFSET = 1; + + private AIPolishConvertedExpression _healArg; + + public AIBuffRecoverPp(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _healArg = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + field.RecoverPp(GetHealCount(tagOwner, playPtn, situation)); + } + + private int GetHealCount(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (_healArg == null) + { + return 0; + } + return (int)_healArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffRush.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffRush.cs new file mode 100644 index 0000000..f7c1494 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffRush.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBuffRush : AITriggerAndTargetFiltersTagBase +{ + public AIScriptTokenArgType SelectType { get; private set; } + + protected int SELECT_TYPE_OFFSET => 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIBuffRush(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIScriptTokenArgType selectType = AIScriptTokenArgType.NONE; + if (IsLegalSelectType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], out selectType)) + { + SelectType = selectType; + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0 && SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.GiveSkillToAll(targets, field, AIScriptTokenArgType.RUSH); + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.TargetFilters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffShield.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffShield.cs new file mode 100644 index 0000000..dbc9c96 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffShield.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBuffShield : AIFiltersAndSelectTypeArgument +{ + private List _stopTimingList; + + private AIScriptTokenArgType _damageType; + + private const int DEFAULT_DAMAGE_TYPE_OFFSET = 2; + + private const int STOP_TIMING_OFFSET = 1; + + private bool _isDamageTypeDefinedByMaster; + + protected override int SELECT_TYPE_OFFSET => 1 + ((!_isDamageTypeDefinedByMaster) ? 1 : 2); + + public AIBuffShield(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _stopTimingList = AIPlayTagInitializingUtility.InitializeStopTimingList(_exprList[_exprList.Count - 1]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - 2], out _isDamageTypeDefinedByMaster); + base.SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], base.LegalSelectTypes); + InitializeFilter(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIBarrierSimulationUtility.AddMultipleStopTimingShieldToAll(targetsFromField, tagOwner, field, _damageType, _stopTimingList); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffSimulationUtility.cs new file mode 100644 index 0000000..40b126f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffSimulationUtility.cs @@ -0,0 +1,110 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIBuffSimulationUtility +{ + public static void BuffAll_old(List targets, AIVirtualField field, AIBuffExecutingInfo_old buffInfo, bool isTemp, List playPtn, AISituationInfo situation) + { + if (buffInfo.IsEmpty()) + { + return; + } + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (aIVirtualCard.IsUnit) + { + aIVirtualCard.GiveBuff(situation, buffInfo, isTemp); + } + } + if (buffInfo.IsBuff()) + { + BuffActivation(targets, field, playPtn, situation); + } + } + + public static void BuffRandom_old(List candidates, AIVirtualField field, List playPtn, AISituationInfo situation, AIBuffExecutingInfo_old buffInfo, bool isTemp) + { + AIVirtualCard aIVirtualCard = AISimulationRemovalUtility.SelectWorstTargetForBuff(candidates, buffInfo); + if (aIVirtualCard != null) + { + BuffSingle_old(aIVirtualCard, field, buffInfo, isTemp, playPtn, situation); + } + } + + public static void BuffTarget_old(AISituationInfo situation, List candidates, AIVirtualField field, List playPtn, AIScriptTokenArgType whichTarget, AIBuffExecutingInfo_old buffInfo, bool isTemp) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + return; + } + List targets = situationTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (candidates.Contains(aIVirtualCard)) + { + BuffSingle_old(aIVirtualCard, field, buffInfo, isTemp, playPtn, situation); + } + } + } + + public static void BuffSingle_old(AIVirtualCard target, AIVirtualField field, AIBuffExecutingInfo_old buffInfo, bool isTemp, List playPtn, AISituationInfo situation) + { + if (!buffInfo.IsEmpty() && target.IsUnit) + { + target.GiveBuff(situation, buffInfo, isTemp); + if (buffInfo.IsBuff()) + { + BuffActivation(new List { target }, field, playPtn, situation); + } + } + } + + public static void BuffFirst_old(List targets, AIVirtualField field, AIBuffExecutingInfo_old buffInfo, bool isTemp, List playPtn, AISituationInfo situation) + { + if (targets != null && targets.Count > 0) + { + BuffSingle_old(targets[0], field, buffInfo, isTemp, playPtn, situation); + } + } + + private static void BuffActivation(List buffTargets, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (buffTargets == null || buffTargets.Count <= 0) + { + return; + } + for (int i = 0; i < buffTargets.Count; i++) + { + AIVirtualCard aIVirtualCard = buffTargets[i]; + if (!aIVirtualCard.IsDead) + { + if (aIVirtualCard.TagCollectionContainer.HasTag(AIPlayTagType.BuffBonus)) + { + field.ApplyBuffBonus(aIVirtualCard, playPtn, situation); + } + if (aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenBuff)) + { + aIVirtualCard.TagCollectionContainer.BuffTriggerTags.Execute(aIVirtualCard, aIVirtualCard, playPtn, situation); + } + } + } + field.AllActivateCountHolderIncrement(situation, AIPlayTagType.BuffActivateCounnt, buffTargets); + } + + public static AIBuffExecutingInfo_old GetBuffExecutingInfo_old(AIVirtualCard tagOwner, AIVirtualField field, AISituationInfo situation, List playPtn, AIPolishConvertedExpression attackExpression, AIPolishConvertedExpression lifeExpression) + { + int attackValue = (int)attackExpression.EvalArg(tagOwner, playPtn, field, situation); + int lifeValue = (int)lifeExpression.EvalArg(tagOwner, playPtn, field, situation); + return new AIBuffExecutingInfo_old + { + AttackValue = attackValue, + LifeValue = lifeValue, + IsMultiplyAttack = attackExpression.IsMultiplyMarked, + IsMultiplyLife = lifeExpression.IsMultiplyMarked + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffStopPreprocessOption.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffStopPreprocessOption.cs new file mode 100644 index 0000000..fe15bca --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffStopPreprocessOption.cs @@ -0,0 +1,9 @@ +namespace Wizard; + +public class AIBuffStopPreprocessOption : AITagPreprocessCreationOptionBase +{ + public AIBuffStopPreprocessOption(AIVirtualCard target) + : base(AITagPreprocessInfoType.STATUS_CHANGE_STOP, target) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffToken.cs new file mode 100644 index 0000000..838117e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffToken.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBuffToken : AIFiltersArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private int TOKEN_COUNT_INDEX_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => TOKEN_COUNT_INDEX_OFFSET; + + public AIBuffToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - TOKEN_COUNT_INDEX_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AISummonTokenUtility.ExecuteSummonToken(GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false), base.Filters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffTurnEndStopInformation.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffTurnEndStopInformation.cs new file mode 100644 index 0000000..81f6fea --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffTurnEndStopInformation.cs @@ -0,0 +1,18 @@ +namespace Wizard; + +public class AIBuffTurnEndStopInformation : AITurnEndStopInformation +{ + public AIBuffTurnEndStopInformation(AIVirtualCard card) + : base(card) + { + base.Type = AITagPreprocessInfoType.STATUS_CHANGE_STOP; + } + + protected override void RunMethod(bool isAllyTurnEnd, AIVirtualTurnEndInfo situation) + { + if (base.TargetCard != null) + { + base.TargetCard.RemoveTempBuff(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBurialRite.cs b/SVSim.BattleEngine/Engine/Wizard/AIBurialRite.cs new file mode 100644 index 0000000..87dc23e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBurialRite.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBurialRite : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression _value; + + private readonly int VALUE_INDEX; + + private readonly int TIMING_INDEX = 1; + + public AIScriptTokenArgType Timing { get; private set; } + + public AIBurialRite(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList != null && _exprList.Count >= TIMING_INDEX + 1) + { + _value = _exprList[VALUE_INDEX]; + Timing = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[TIMING_INDEX]); + if (!CheckValidTimingType(Timing)) + { + Timing = AIScriptTokenArgType.NONE; + } + } + } + + public static bool CheckValidTimingType(AIScriptTokenArgType type) + { + if (type == AIScriptTokenArgType.WHEN_PLAY || type == AIScriptTokenArgType.WHEN_EVO) + { + return true; + } + return false; + } + + public int GetBurialRiteCount(AIVirtualCard tagOwner, AIVirtualField field, AISituationInfo situation, List playPtn) + { + return (int)_value.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBurialRiteSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIBurialRiteSimulationUtility.cs new file mode 100644 index 0000000..3dae00f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBurialRiteSimulationUtility.cs @@ -0,0 +1,115 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public static class AIBurialRiteSimulationUtility +{ + public static void ExecuteBurialRite(AIVirtualField field, AISituationInfo situation, AISelectedTargetInfo burialTargetInfo) + { + List targets = burialTargetInfo.Targets; + for (int i = 0; i < targets.Count; i++) + { + targets[i].RemoveAllSkills(situation); + } + AISummonTokenUtility.ExecuteSummonCardAll(situation.Actor, field, targets, situation); + AISkillSimulationUtility.DestroyAll(targets, field, situation); + if (situation.Actor.IsAlly) + { + for (int j = 0; j < targets.Count; j++) + { + field.CardListSet.AddAllyBurialCard(targets[j]); + } + } + else + { + for (int k = 0; k < targets.Count; k++) + { + field.CardListSet.AddEnemyBurialCard(targets[k]); + } + } + } + + public static AIVirtualTargetSelectInfo GetBurialSelectInfo(this AIVirtualCard card, AIVirtualField field, AISituationInfo situation) + { + int totalBurialCount = situation.PreprocessRecorder.TotalBurialCount; + if (totalBurialCount <= 0) + { + return null; + } + if (card.IsAlly) + { + return GetAllyBurialSelectInfo(card, field, situation, totalBurialCount); + } + return GetOpponentBurialSelectInfo(card, field, situation, totalBurialCount); + } + + private static AIVirtualTargetSelectInfo GetAllyBurialSelectInfo(AIVirtualCard owner, AIVirtualField field, AISituationInfo situation, int burialCount) + { + if (5 - field.AllyInplayCards.Count < burialCount) + { + return null; + } + List burialSelectableCards = GetBurialSelectableCards(field.AllyHandCards, owner, situation.OriginalCard); + if (burialSelectableCards == null || burialSelectableCards.Count < burialCount) + { + return null; + } + burialSelectableCards = AITargetSelectFilteringUtility.ExecuteTargetFilteringTags(owner, burialSelectableCards, field.BestPlayPtn, situation, burialCount); + return new AIVirtualTargetSelectInfo(burialCount, burialSelectableCards, TargetSelectType.BurialRite, isForbiddenSelectedTarget: true); + } + + private static AIVirtualTargetSelectInfo GetOpponentBurialSelectInfo(AIVirtualCard owner, AIVirtualField field, AISituationInfo situation, int burialCount) + { + List burialSelectableCards = GetBurialSelectableCards(field.GetEnemyHandCardList(), owner, situation.OriginalCard); + if (burialSelectableCards == null || burialSelectableCards.Count < burialCount) + { + AIConsoleUtility.LogError("GetOpponentBurialSelectInfo() error!! Cannot find enough candidates!!!!!"); + return null; + } + return new AIVirtualTargetSelectInfo(burialCount, burialSelectableCards, TargetSelectType.BurialRite, isForbiddenSelectedTarget: true); + } + + public static List GetBurialSelectableCards(List candidates, AIVirtualCard burialOwner, AIVirtualCard originalBurialCard) + { + List list = null; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (aIVirtualCard.IsUnit && !aIVirtualCard.IsSameCard(burialOwner) && !aIVirtualCard.IsSameCard(originalBurialCard)) + { + list = AIParamQuery.AddElementToList(aIVirtualCard, list); + } + } + return list; + } + + public static AIVirtualCard GetBestBurialRiteTargetForOperationSimulator(AIVirtualCard burialActor, AIVirtualField field, List playPtn, AISituationInfo situation, List candidates) + { + AIScriptTokenArgType timing = AIPreprocessSimulationUtility.ConvertAIOperationTypeToTiming(situation.ActionType); + if (burialActor.GetBurialRiteCount(field, situation, playPtn, timing) <= 0) + { + return null; + } + return candidates.FindMax((AIVirtualCard card) => Mathf.Abs(field.AllyPpTotal - card.Cost)); + } + + public static int GetBurialCount(AIScriptTokenArgType burialListType, AIVirtualField field) + { + return burialListType switch + { + AIScriptTokenArgType.ALLY => field.CardListSet.AllyBurialCards.Count, + AIScriptTokenArgType.OPPONENT => field.CardListSet.EnemyBurialCards.Count, + _ => 0, + }; + } + + public static IEnumerable GetBurialSelectableCards(SkillBase skill, BattleCardBase card) + { + if (skill.IsBurialRite) + { + return SkillPreprocessBurialRite.GetBurialRiteTarget(card.SelfBattlePlayer, card); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayAttachTag.cs new file mode 100644 index 0000000..0be2b8e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayAttachTag.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangeInplayAttachTag : AIWhenChangeInplayTagArgument +{ + private AIScriptTokenArgType _removeTiming; + + private readonly int REMOVE_TIMING_OFFSET = 1; + + private const int TAG_WORD_START_INDEX = 1; + + public AIPlayTag Tag { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIChangeInplayAttachTag(string text, bool isImmediate) + : base(text, isImmediate) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + _removeTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - REMOVE_TIMING_OFFSET]); + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + protected override void ChangeInplayTagStartProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targets, tagOwner, Tag, _removeTiming, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayCannotAttack.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayCannotAttack.cs new file mode 100644 index 0000000..a954ca4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayCannotAttack.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangeInplayCannotAttack : AIWhenChangeInplayTagArgument +{ + private AICannotAttackInformation _info; + + protected override int SELECT_TYPE_OFFSET => -1; + + protected override int NON_FILTER_FIRST_OFFSET => 0; + + public AIChangeInplayCannotAttack(string text, bool isImmediate) + : base(text, isImmediate) + { + _info = null; + } + + protected override void InitSelectType() + { + base.SelectType = AIScriptTokenArgType.ALL_SELECT; + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } + + protected override void ChangeInplayTagStartProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (_info == null) + { + _info = new AICannotAttackInformation(base.Filters); + } + tagOwner.AddCannotAttackInformation(_info); + } + + protected override void ChangeInplayTagStopProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + tagOwner.RemoveCannotAttackInformation(_info); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayCannotPlay.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayCannotPlay.cs new file mode 100644 index 0000000..49be6a2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayCannotPlay.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangeInplayCannotPlay : AIWhenChangeInplayTagArgument +{ + private List _cannotPlayCardFilterList; + + public AIChangeInplayCannotPlay(string text, bool isImmediate) + : base(text, isImmediate) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + if (!AIPlayTagInitializingUtility.IsInitOfFilterSet(_exprList[0])) + { + AIConsoleUtility.LogError("AIChangeInplayCannotPlay.InitExpressions() Error!! Filters.First is not side arg!!!!!"); + return; + } + int num = -1; + for (int i = 1; i < _exprList.Count; i++) + { + if (AIPlayTagInitializingUtility.IsInitOfFilterSet(_exprList[i])) + { + num = i; + break; + } + } + if (num <= 0) + { + _cannotPlayCardFilterList = GetFilters(_exprList.GetRange(0, _exprList.Count - NON_FILTER_FIRST_OFFSET)); + base.Filters = new List(); + } + else + { + base.Filters = GetFilters(_exprList.GetRange(0, num)); + _cannotPlayCardFilterList = GetFilters(_exprList.GetRange(num, _exprList.Count - NON_FILTER_FIRST_OFFSET - num)); + } + } + + protected override void ChangeInplayTagStartProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + AICannotPlayInformation info = new AICannotPlayInformation(tagOwner, _cannotPlayCardFilterList); + field.AddCannotPlayInformation(info); + } + + protected override void ChangeInplayTagStopProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + field.RemoveCannotPlayInformation(tagOwner, _cannotPlayCardFilterList); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayFixRemoveType.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayFixRemoveType.cs new file mode 100644 index 0000000..a4eabd0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayFixRemoveType.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangeInplayFixRemoveType : AIWhenChangeInplayTagArgument +{ + private readonly FixedRemoveType _removeType; + + protected override int SELECT_TYPE_OFFSET => 0; + + public AIChangeInplayFixRemoveType(string text, FixedRemoveType type, bool isImmediate) + : base(text, isImmediate) + { + _removeType = type; + } + + protected override void InitSelectType() + { + base.SelectType = AIScriptTokenArgType.ALL_SELECT; + } + + protected override void ChangeInplayTagStartProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + for (int i = 0; i < targets.Count; i++) + { + FixRemoveType(targets[i]); + } + } + + protected override void ChangeInplayTagStopProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + for (int i = 0; i < targets.Count; i++) + { + StopFixRemoveType(targets[i]); + } + } + + private void FixRemoveType(AIVirtualCard target) + { + switch (_removeType) + { + case FixedRemoveType.RemoveByBanish: + target.GiveRemoveByBanish(); + break; + case FixedRemoveType.RemoveByDestroy: + target.GiveRemoveByDestroy(); + break; + default: + AIConsoleUtility.LogError("AIChangeInplayFixRemoveType.FixRemoveType() error!! _removeType == " + _removeType); + break; + } + } + + private void StopFixRemoveType(AIVirtualCard target) + { + switch (_removeType) + { + case FixedRemoveType.RemoveByBanish: + target.DepriveRemoveByBanish(); + break; + case FixedRemoveType.RemoveByDestroy: + target.DepriveRemoveByDestroy(); + break; + default: + AIConsoleUtility.LogError("AIChangeInplayFixRemoveType.StopFixRemoveType() error!! _removeType == " + _removeType); + break; + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateBarrierBase.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateBarrierBase.cs new file mode 100644 index 0000000..c5fa200 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateBarrierBase.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; + +namespace Wizard; + +public abstract class AIChangeInplayImmediateBarrierBase : AIWhenChangeInplayTagArgument +{ + protected AIScriptTokenArgType _stopTiming; + + protected AIScriptTokenArgType _damageType; + + protected bool _isDamageTypeDefinedByMaster; + + protected abstract int _defaultDamageTypeOffset { get; } + + protected abstract int _stopTimingOffset { get; } + + protected override int SELECT_TYPE_OFFSET => 1 + (_isDamageTypeDefinedByMaster ? _defaultDamageTypeOffset : _stopTimingOffset); + + public AIChangeInplayImmediateBarrierBase(string text) + : base(text, isImmediate: true) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - _stopTimingOffset]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - _defaultDamageTypeOffset], out _isDamageTypeDefinedByMaster); + InitSelectType(); + InitializeFilter(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override void ChangeInplayTagStartProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + GiveBarrierToAllTargets(targets, tagOwner, field, playPtn, situation); + } + } + + protected override void ChangeInplayTagStopProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + DepriveBarrierFromAllTargets(targets, tagOwner, field, playPtn, situation); + } + } + + protected abstract void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation); + + protected abstract void DepriveBarrierFromAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateDamageClip.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateDamageClip.cs new file mode 100644 index 0000000..e60633c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateDamageClip.cs @@ -0,0 +1,99 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangeInplayImmediateDamageClip : AIChangeInplayImmediateBarrierBase +{ + private AIPolishConvertedExpression _clipAmount; + + private AIPolishConvertedExpression _clipRange; + + private const int DEFAULT_CLIP_AMOUNT_OFFSET = 1; + + private bool _isClipRangeDefinedByMaster; + + protected override int _stopTimingOffset + { + get + { + if (!_isClipRangeDefinedByMaster) + { + return 2; + } + return 3; + } + } + + protected override int _defaultDamageTypeOffset + { + get + { + if (!_isClipRangeDefinedByMaster) + { + return 3; + } + return 4; + } + } + + public AIChangeInplayImmediateDamageClip(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + InitClipAmountAndClipRange(); + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - _stopTimingOffset]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - _defaultDamageTypeOffset], out _isDamageTypeDefinedByMaster); + InitSelectType(); + InitializeFilter(); + } + + private void InitClipAmountAndClipRange() + { + AIPolishConvertedExpression aIPolishConvertedExpression = _exprList[_exprList.Count - 1]; + AIPolishConvertedExpression aIPolishConvertedExpression2 = _exprList[_exprList.Count - 2]; + if (aIPolishConvertedExpression2.IsMathematicExpress()) + { + _isClipRangeDefinedByMaster = true; + _clipAmount = aIPolishConvertedExpression2; + _clipRange = aIPolishConvertedExpression; + } + else + { + _clipAmount = aIPolishConvertedExpression; + _clipRange = null; + } + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int clipAmount = (int)_clipAmount.EvalArg(tagOwner, playPtn, field, situation); + int clipRange = GetClipRange(tagOwner, field, playPtn, situation); + AIBarrierSimulationUtility.AddDamageClipToAll(targets, tagOwner, field, _damageType, _stopTiming, clipAmount, clipRange); + } + + protected override void DepriveBarrierFromAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIDamageType damageTypeFromArgType = AIBarrierSimulationUtility.GetDamageTypeFromArgType(_damageType); + AIBarrierStopTiming barrierStopTimingFromArgType = AIBarrierSimulationUtility.GetBarrierStopTimingFromArgType(_stopTiming, tagOwner); + int clipAmount = (int)_clipAmount.EvalArg(tagOwner, playPtn, field, situation); + int clipRange = GetClipRange(tagOwner, field, playPtn, situation); + ulong depriveShieldHash = AIBarrierSimulationUtility.CalculateDamageClipInfoHash(damageTypeFromArgType, AIBarrierType.DamageClipping, barrierStopTimingFromArgType, clipAmount, clipRange); + for (int i = 0; i < targets.Count; i++) + { + targets[i].BarrierInfoCollection.DepriveCertainBarrier(depriveShieldHash, barrierStopTimingFromArgType); + } + } + + private int GetClipRange(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_clipRange == null) + { + return 9999; + } + return (int)_clipRange.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateDamageCut.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateDamageCut.cs new file mode 100644 index 0000000..af9e957 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateDamageCut.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangeInplayImmediateDamageCut : AIChangeInplayImmediateBarrierBase +{ + private AIPolishConvertedExpression _cutAmount; + + private const int CUT_AMOUNT_OFFSET = 1; + + protected override int _stopTimingOffset => 2; + + protected override int _defaultDamageTypeOffset => 3; + + public AIChangeInplayImmediateDamageCut(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _cutAmount = _exprList[_exprList.Count - 1]; + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int cutAmount = (int)_cutAmount.EvalArg(tagOwner, playPtn, field, situation); + AIBarrierSimulationUtility.AddDamageCutToAll(targets, tagOwner, field, _damageType, _stopTiming, cutAmount); + } + + protected override void DepriveBarrierFromAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIDamageType damageTypeFromArgType = AIBarrierSimulationUtility.GetDamageTypeFromArgType(_damageType); + AIBarrierStopTiming barrierStopTimingFromArgType = AIBarrierSimulationUtility.GetBarrierStopTimingFromArgType(_stopTiming, tagOwner); + int cutAmount = (int)_cutAmount.EvalArg(tagOwner, playPtn, field, situation); + ulong depriveShieldHash = AIBarrierSimulationUtility.CalculateDamageCutInfoHash(damageTypeFromArgType, AIBarrierType.Shield, barrierStopTimingFromArgType, cutAmount); + for (int i = 0; i < targets.Count; i++) + { + targets[i].BarrierInfoCollection.DepriveCertainBarrier(depriveShieldHash, barrierStopTimingFromArgType); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateDamageModifier.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateDamageModifier.cs new file mode 100644 index 0000000..978ce4d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateDamageModifier.cs @@ -0,0 +1,67 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangeInplayImmediateDamageModifier : AIWhenChangeInplayTagArgument +{ + private static readonly AIScriptTokenArgType[] _legalOptionTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ADD, + AIScriptTokenArgType.SET + }; + + private AIScriptTokenArgType _modifyOption; + + private AIPolishConvertedExpression _modifyValue; + + private const int MODIFY_OPTION_ARG_OFFSET = 2; + + private const int MODIFY_VALUE_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => -1; + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIChangeInplayImmediateDamageModifier(string text) + : base(text, isImmediate: true) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _modifyOption = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], _legalOptionTypes); + _modifyValue = _exprList[_exprList.Count - 1]; + } + + protected override void InitSelectType() + { + base.SelectType = AIScriptTokenArgType.NONE; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISkillProcessInformation processInfo, AISituationInfo situation = null) + { + ChangeInplayTagStartProcess(null, field, tagOwner, playPtn, situation); + } + + public override void Stop(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISkillProcessInformation processInfo, AISituationInfo situation) + { + ChangeInplayTagStopProcess(null, field, tagOwner, playPtn, situation); + } + + protected override void ChangeInplayTagStartProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + AIDamageModifierInfo info = new AIDamageModifierInfo(tagOwner, base.Filters, _modifyOption, _modifyValue, base.TextHash); + field.DamageModifierCollection.AddDamageModifierInfo(info); + } + + protected override void ChangeInplayTagStopProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + field.DamageModifierCollection.DepriveDamageModifierInfo(tagOwner, base.TextHash); + } + + public override void ExecuteWhenRemove(AIVirtualCard tagOwner, AIVirtualField field, AIPlayTag removingTag) + { + field.DamageModifierCollection.DepriveDamageModifierInfo(tagOwner, base.TextHash); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateIndestructible.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateIndestructible.cs new file mode 100644 index 0000000..7b139e3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateIndestructible.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangeInplayImmediateIndestructible : AIWhenChangeInplayTagArgument +{ + public AIChangeInplayImmediateIndestructible(string text) + : base(text, isImmediate: true) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override void ChangeInplayTagStartProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + GiveIndestructibleToAll(targets); + } + } + + private void GiveIndestructibleToAll(List targets) + { + for (int i = 0; i < targets.Count; i++) + { + targets[i].IsIndestructible = true; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateKeywordSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateKeywordSkill.cs new file mode 100644 index 0000000..714eee2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateKeywordSkill.cs @@ -0,0 +1,86 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangeInplayImmediateKeywordSkill : AIWhenChangeInplayTagArgument +{ + protected AIScriptTokenArgType _stopTiming; + + private readonly AIScriptTokenArgType _skillType; + + private IEnumerable _giveCardList; + + protected virtual int StopTimingOffset => 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AIChangeInplayImmediateKeywordSkill(string text, AIScriptTokenArgType skill) + : base(text, isImmediate: true) + { + _skillType = skill; + base.SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], base.LegalSelectTypes); + if (!IsImplementedSelecvtType(base.SelectType)) + { + base.SelectType = AIScriptTokenArgType.ALL_SELECT; + } + List range = _exprList.GetRange(0, _exprList.Count - NON_FILTER_FIRST_OFFSET); + base.Filters = GetFilters(range); + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - StopTimingOffset]); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISkillProcessInformation processInfo, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.GiveSkillToAll(targetsFromField, field, _skillType); + } + ChangeInplayStopPreprocess(targetsFromField, field); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + private bool IsImplementedSelecvtType(AIScriptTokenArgType type) + { + return type == AIScriptTokenArgType.ALL_SELECT; + } + + protected void ChangeInplayStopPreprocess(List targets, AIVirtualField field) + { + if (targets != null && targets.Count > 0 && _stopTiming == AIScriptTokenArgType.WHEN_LEAVE) + { + WhenLeaveStop(targets, field); + } + } + + private void WhenLeaveStop(List targets, AIVirtualField field) + { + if (_skillType != AIScriptTokenArgType.UNTOUCHABLE) + { + return; + } + foreach (AIVirtualCard target in targets) + { + WhenLeaveStopUntouchable(target, field); + } + } + + private void WhenLeaveStopUntouchable(AIVirtualCard card, AIVirtualField field) + { + AIUntouchableStopPreprocessOption option = new AIUntouchableStopPreprocessOption(card); + field.TagPreprocessContainer.AppendLeaveStopInfo(option, card); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateLifeLowerLimit.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateLifeLowerLimit.cs new file mode 100644 index 0000000..b478722 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateLifeLowerLimit.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangeInplayImmediateLifeLowerLimit : AIChangeInplayImmediateBarrierBase +{ + protected override int _stopTimingOffset => 1; + + protected override int _defaultDamageTypeOffset => 2; + + public AIChangeInplayImmediateLifeLowerLimit(string text) + : base(text) + { + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIBarrierSimulationUtility.AddLifeLowerLimitToAll(targets, tagOwner, field, _damageType, _stopTiming); + } + + protected override void DepriveBarrierFromAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIDamageType damageTypeFromArgType = AIBarrierSimulationUtility.GetDamageTypeFromArgType(_damageType); + AIBarrierStopTiming barrierStopTimingFromArgType = AIBarrierSimulationUtility.GetBarrierStopTimingFromArgType(_stopTiming, tagOwner); + ulong depriveShieldHash = AIBarrierSimulationUtility.CalculateBarrierInfoBaseHash(damageTypeFromArgType, AIBarrierType.DamageClippingLifeLowerLimit, barrierStopTimingFromArgType); + for (int i = 0; i < targets.Count; i++) + { + targets[i].BarrierInfoCollection.DepriveCertainBarrier(depriveShieldHash, barrierStopTimingFromArgType); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateShield.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateShield.cs new file mode 100644 index 0000000..0ea5d1f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeInplayImmediateShield.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangeInplayImmediateShield : AIChangeInplayImmediateBarrierBase +{ + protected override int _defaultDamageTypeOffset => 2; + + protected override int _stopTimingOffset => 1; + + public AIChangeInplayImmediateShield(string text) + : base(text) + { + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIBarrierSimulationUtility.AddShieldToAll(targets, tagOwner, field, _damageType, _stopTiming); + } + + protected override void DepriveBarrierFromAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIDamageType damageTypeFromArgType = AIBarrierSimulationUtility.GetDamageTypeFromArgType(_damageType); + AIBarrierStopTiming barrierStopTimingFromArgType = AIBarrierSimulationUtility.GetBarrierStopTimingFromArgType(_stopTiming, tagOwner); + ulong depriveShieldHash = AIBarrierSimulationUtility.CalculateBarrierInfoBaseHash(damageTypeFromArgType, AIBarrierType.Shield, barrierStopTimingFromArgType); + for (int i = 0; i < targets.Count; i++) + { + targets[i].BarrierInfoCollection.DepriveCertainBarrier(depriveShieldHash, barrierStopTimingFromArgType); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangePpTotalBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangePpTotalBuff.cs new file mode 100644 index 0000000..deddcf3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangePpTotalBuff.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangePpTotalBuff : AIWhenChangeInplayTagArgument +{ + private const int LIFE_OFFSET = 1; + + private const int ATTACK_OFFSET = 2; + + public AIPolishConvertedExpression Attack { get; private set; } + + public AIPolishConvertedExpression Life { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIChangePpTotalBuff(string text, bool isImmediate) + : base(text, isImmediate) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Attack = _exprList[_exprList.Count - 2]; + Life = _exprList[_exprList.Count - 1]; + } + + private void BuffTargets(List targets, AIBuffExecutingInfo_old buffInfo, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (targets != null && targets.Count > 0) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBuffSimulationUtility.BuffAll_old(targets, field, buffInfo, isTemp: false, playPtn, situation); + } + else + { + AIConsoleUtility.LogError($"AIChangePpTotalBuff.BuffTargets(): SelectType is Ileagl [type:{base.SelectType}]"); + } + } + } + + protected override void ChangeInplayTagStartProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, Attack, Life); + BuffTargets(targets, buffExecutingInfo_old, tagOwner, field, playPtn, situation); + } + + protected override void ChangeInplayTagStopProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, Attack, Life); + if (!buffExecutingInfo_old.IsMultiplyAttack && !buffExecutingInfo_old.IsMultiplyLife) + { + buffExecutingInfo_old.AttackValue *= -1; + buffExecutingInfo_old.LifeValue *= -1; + BuffTargets(targets, buffExecutingInfo_old, tagOwner, field, playPtn, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChoiceBrave.cs b/SVSim.BattleEngine/Engine/Wizard/AIChoiceBrave.cs new file mode 100644 index 0000000..83f4542 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChoiceBrave.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChoiceBrave : AIChoiceTagArgument +{ + public AIChoiceBrave() + : base("") + { + } + + protected override void InitExpressions(string text) + { + _choiceCount = null; + _choiceIds = null; + } + + public override int GetChoiceCount(AIVirtualCard owner, AIVirtualField field, AISituationInfo situation) + { + return 1; + } + + public override List GetChoiceTargets(AIVirtualCard owner, AIVirtualField field) + { + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChoiceTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIChoiceTagArgument.cs new file mode 100644 index 0000000..ae10792 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChoiceTagArgument.cs @@ -0,0 +1,84 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChoiceTagArgument : AIScriptArgumentExpressions +{ + protected List _choiceIds; + + protected AIPolishConvertedExpression _choiceCount; + + private const int CHOICE_COUNT_OFFSET = 1; + + private List _playerChoiceFakeCards; + + private List _enemyChoiceFakeCards; + + public AIChoiceTagArgument(string text) + : base(text) + { + _playerChoiceFakeCards = null; + _enemyChoiceFakeCards = null; + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _choiceCount = _exprList[_exprList.Count - 1]; + _choiceIds = new List(); + for (int i = 0; i < _exprList.Count - 1; i++) + { + _choiceIds.Add(_exprList[i].EvalID()); + } + } + + public virtual List GetChoiceTargets(AIVirtualCard owner, AIVirtualField field) + { + if (owner.IsPlayer && _playerChoiceFakeCards == null) + { + CreateChoiceTargets(owner, field, out _playerChoiceFakeCards); + } + else if (!owner.IsPlayer && _enemyChoiceFakeCards == null) + { + CreateChoiceTargets(owner, field, out _enemyChoiceFakeCards); + } + if (!owner.IsPlayer) + { + return _enemyChoiceFakeCards; + } + return _playerChoiceFakeCards; + } + + private void CreateChoiceTargets(AIVirtualCard owner, AIVirtualField field, out List choiceFakeCards) + { + choiceFakeCards = new List(); + AITokenManager tokenManager = field.AI.tokenManager; + for (int i = 0; i < _choiceIds.Count; i++) + { + AIVirtualCard choiceTokenFromId = tokenManager.GetChoiceTokenFromId(_choiceIds[i], owner.IsAlly); + if (choiceTokenFromId == null) + { + AIConsoleUtility.LogError("GetChoiceTarget error!! choiceBaseCard is null"); + break; + } + ChoiceVirtualCard choiceVirtualCard = new ChoiceVirtualCard(choiceTokenFromId.BaseCard, owner.IsAlly, field); + choiceVirtualCard.InitializeTags(field.ParamQuery, null, null); + choiceFakeCards.Add(choiceVirtualCard); + } + } + + public virtual int GetChoiceCount(AIVirtualCard owner, AIVirtualField field, AISituationInfo situation) + { + return (int)_choiceCount.EvalArg(owner, null, field, situation); + } + + public List GetChoiceIdList() + { + return _choiceIds; + } + + protected override AITokenIdCollection CreateRegisterTokenPoolInfo(AIVirtualCard owner, List idList) + { + return AISummonTokenUtility.CreateTokenIdCollectionFromIdList(owner, AIScriptTokenArgType.ALLY, idList, AITokenType.Choice); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChoiceTransform.cs b/SVSim.BattleEngine/Engine/Wizard/AIChoiceTransform.cs new file mode 100644 index 0000000..7046e62 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChoiceTransform.cs @@ -0,0 +1,25 @@ +namespace Wizard; + +public class AIChoiceTransform : AIScriptArgumentExpressions +{ + public AIChoiceTransform(string text) + : base(text) + { + } + + public void RegisterSelfToOwner(AIVirtualCard owner, AIVirtualField field, AIConditionExpressions cond) + { + for (int i = 0; i < _exprList.Count; i++) + { + AIChoiceTransformCostInformation aIChoiceTransformCostInformation = new AIChoiceTransformCostInformation + { + Cost = _exprList[i] + }; + if (!cond.IsEmpty) + { + aIChoiceTransformCostInformation.SetCondition(cond); + } + owner.ChoiceTransformCostList = AIParamQuery.AddElementToList(aIChoiceTransformCostInformation, owner.ChoiceTransformCostList); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChoiceTransformUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIChoiceTransformUtility.cs new file mode 100644 index 0000000..5d5505b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChoiceTransformUtility.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIChoiceTransformUtility +{ + public static int GetChoiceTransformCost(AIVirtualCard card, AIVirtualField field, List playPtn) + { + if (card == null || card.ChoiceTransformCostList == null || !card.IsInHand) + { + return -1; + } + List playPtn2 = (card.IsAlly ? playPtn : null); + return field.AI.PlayPtnRecorder.GetCardPlaySimulationTypeCost(card, field, playPtn2, null, PlaySimulationType.ChoiceTransform); + } + + public static bool IsChoiceTransform(AIVirtualField field, AIVirtualTargetSelectAction situation) + { + if (situation.ActionType != AIOperationType.PLAY) + { + return false; + } + AIVirtualCard originalCard = situation.OriginalCard; + if (originalCard.ChoiceTransformCostList == null || originalCard.ChoiceTransformCostList.Count <= 0) + { + return false; + } + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + int num = (originalCard.IsAlly ? field.AllyPp : field.EnemyPp); + int num2 = -1; + for (int i = 0; i < originalCard.ChoiceTransformCostList.Count; i++) + { + AIChoiceTransformCostInformation aIChoiceTransformCostInformation = originalCard.ChoiceTransformCostList[i]; + if (aIChoiceTransformCostInformation.CheckCondition(originalCard, field, emptyPlayPtn, situation)) + { + int num3 = (int)aIChoiceTransformCostInformation.Cost.EvalArg(originalCard, emptyPlayPtn, field, situation); + if (num >= num3 && num3 > num2) + { + num2 = num3; + } + } + } + return num2 >= 0; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIClashBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIClashBuff.cs new file mode 100644 index 0000000..6c41024 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIClashBuff.cs @@ -0,0 +1,18 @@ +namespace Wizard; + +public class AIClashBuff : AIAttackBuff +{ + protected override int SELECT_TYPE_OFFSET => 0; + + protected override int NON_FILTER_FIRST_OFFSET => 3; + + public AIClashBuff(string text) + : base(text) + { + } + + protected override void InitSelectType() + { + base.SelectType = AIScriptTokenArgType.ALL_SELECT; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIClashDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIClashDamage.cs new file mode 100644 index 0000000..9cc4451 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIClashDamage.cs @@ -0,0 +1,119 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIClashDamage : AIWhenAttackOrWhenFightTagArgument +{ + private readonly int DAMAGE_ARG_OFFSET = 1; + + public AIPolishConvertedExpression Damage { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public override bool IsActivateWhenEvalInstantAttack => true; + + public AIClashDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Damage = _exprList[_exprList.Count - DAMAGE_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int damage = (int)Damage.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, damage, situation); + } + else if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, damage, situation); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + public override bool CanKillTarget(AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, AIBarrierPseudoSimulationInfo simBarrier, ref int totalDamage) + { + totalDamage += PseudoSimulateWhenAttackDamageToCertainCard(tagOwner, target, field, situation, playPtn, simBarrier); + return totalDamage >= target.Life; + } + + public override int PseudoSimulateWhenAttackDamageToCertainCard(AIVirtualCard tagOwner, AIVirtualCard damageTarget, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, AIBarrierPseudoSimulationInfo simBarrier) + { + int damageToCertainTarget = GetDamageToCertainTarget(tagOwner, situation, field, playPtn, damageTarget); + if (damageToCertainTarget <= 0) + { + return 0; + } + bool isSpell = tagOwner.IsSpell; + int result = simBarrier.SimulateDamageAmount(damageTarget.SimulateDamageShield(damageToCertainTarget, isSkillDamage: true, isSpell), isSpell); + simBarrier.DepriveBarrier(AIBarrierStopTiming.AfterDamage); + return result; + } + + private int GetDamageToCertainTarget(AIVirtualCard tagOwner, AISituationInfo situation, AIVirtualField field, List playPtn, AIVirtualCard damageTarget) + { + if (damageTarget.IsIndependent) + { + return 0; + } + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (damageTarget.IsSameCardIncluded(targetsFromField)) + { + int num = (int)Damage.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT || (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT && damageTarget.IsSameCard(AIDamageSimulationUtility.SelectDamageTarget(targetsFromField, field, playPtn, situation, num, isSpell: false, AISelectTargetPattern.Worst)))) + { + return num; + } + } + return 0; + } + + public override bool CanKillAnyTarget(AIVirtualCard tagOwner, List targetList, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, List simBarrierList, int[] realDamageList) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return false; + } + int num = (int)Damage.EvalArg(tagOwner, playPtn, field, situation); + if (num <= 0) + { + return false; + } + bool isSpell = tagOwner.IsSpell; + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard aIVirtualCard = targetList[i]; + if (aIVirtualCard.IsIndependent || !aIVirtualCard.IsSameCardIncluded(targetsFromField)) + { + continue; + } + AIBarrierPseudoSimulationInfo aIBarrierPseudoSimulationInfo = simBarrierList[i]; + int num2 = aIBarrierPseudoSimulationInfo.SimulateDamageAmount(aIVirtualCard.SimulateDamageShield(num, isSkillDamage: true, isSpell), isSpell); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT || (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT && aIVirtualCard.IsSameCard(AIDamageSimulationUtility.SelectDamageTarget(targetsFromField, field, playPtn, situation, num2, isSpell: false, AISelectTargetPattern.Worst)))) + { + aIBarrierPseudoSimulationInfo.DepriveBarrier(AIBarrierStopTiming.AfterDamage); + realDamageList[i] += num2; + if (realDamageList[i] >= aIVirtualCard.Life) + { + return true; + } + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIClashDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AIClashDestroy.cs new file mode 100644 index 0000000..375fe76 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIClashDestroy.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIClashDestroy : AIWhenAttackOrWhenFightTagArgument +{ + public override bool IsActivateWhenEvalInstantAttack => true; + + protected override int SELECT_TYPE_OFFSET => 0; + + public AIClashDestroy(string text) + : base(text) + { + } + + protected override void InitSelectType() + { + base.SelectType = AIScriptTokenArgType.ALL_SELECT; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + for (int i = 0; i < targetsFromField.Count; i++) + { + AIVirtualCard aIVirtualCard = targetsFromField[i]; + if (!aIVirtualCard.IsIndependent && !aIVirtualCard.IsDead) + { + aIVirtualCard.RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: true); + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override bool CanKillTarget(AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, AIBarrierPseudoSimulationInfo simBarrier, ref int totalDamage) + { + if (target.IsIndependent || target.IsIndestructible) + { + return false; + } + return GetTargetsFromField(tagOwner, field, playPtn, situation)?.Contains(target) ?? false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIConsoleUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIConsoleUtility.cs new file mode 100644 index 0000000..fc0f707 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIConsoleUtility.cs @@ -0,0 +1,24 @@ +using System.Text; + +namespace Wizard; + +public class AIConsoleUtility +{ + private static StringBuilder _logBuilder; + + public static void Log(string log) + { + } + + public static void LogWarning(string log) + { + } + + public static void LogError(string log) + { + } + + private static void BuildLog(string text) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AICrystalize.cs b/SVSim.BattleEngine/Engine/Wizard/AICrystalize.cs new file mode 100644 index 0000000..25181c8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AICrystalize.cs @@ -0,0 +1,28 @@ +namespace Wizard; + +public class AICrystalize : AIScriptArgumentExpressions +{ + public AICrystalize(string text) + : base(text) + { + } + + public void RegisterSelfToOwner(AIVirtualCard owner, AIVirtualField field) + { + int num = 0; + while (num < _exprList.Count) + { + AICrystalizeInformation aICrystalizeInformation = new AICrystalizeInformation(); + aICrystalizeInformation.Cost = (int)EvalArg(num, owner, EnemyAI.EmptyPlayPtn, field, null); + num++; + if (num < _exprList.Count) + { + aICrystalizeInformation.CardId = EvalID(num); + owner.CrystalizeCostList = AIParamQuery.AddElementToList(aICrystalizeInformation, owner.CrystalizeCostList); + num++; + continue; + } + break; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDamagedBonus.cs b/SVSim.BattleEngine/Engine/Wizard/AIDamagedBonus.cs new file mode 100644 index 0000000..0f46c1a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDamagedBonus.cs @@ -0,0 +1,44 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIDamagedBonus : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression _bonus; + + private const int BONUS_ARG_INDEX = 0; + + public AIDamagedBonus(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count <= 0) + { + AIConsoleUtility.LogError("DamagedBonus error!! _exprList.Count == 0"); + } + else + { + _bonus = _exprList[0]; + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + float num = CalcBonus(tagOwner, field, playPtn, situation); + field.SimulationExtraBonus += ((field.AllyClass.IsAlly == tagOwner.IsAlly) ? num : (0f - num)); + } + + private float CalcBonus(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_bonus == null) + { + return 0f; + } + return _bonus.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDamagedBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIDamagedBuff.cs new file mode 100644 index 0000000..8b44af6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDamagedBuff.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIDamagedBuff : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression _atkBuff; + + private AIPolishConvertedExpression _lifeBuff; + + private const int ATTACK_BUFF_INDEX = 0; + + private const int LIFE_BUFF_INDERX = 1; + + public AIDamagedBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count < 2) + { + AIConsoleUtility.LogError("AIDamagedBuff Argument Error!! Arg Count = " + _exprList.Count); + return; + } + _atkBuff = _exprList[0]; + _lifeBuff = _exprList[1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, _atkBuff, _lifeBuff); + AIBuffSimulationUtility.BuffSingle_old(tagOwner, field, buffExecutingInfo_old, isTemp: false, playPtn, situation); + } + + public int GetAttackBuff(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_atkBuff == null) + { + return 0; + } + if (_atkBuff.IsMultiplyMarked) + { + return 0; + } + return (int)_atkBuff.EvalArg(tagOwner, playPtn, field, situation); + } + + public int GetLifeBuff(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_lifeBuff == null) + { + return 0; + } + if (_lifeBuff.IsMultiplyMarked) + { + return 0; + } + return (int)_lifeBuff.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDamagedCantUnderAttack.cs b/SVSim.BattleEngine/Engine/Wizard/AIDamagedCantUnderAttack.cs new file mode 100644 index 0000000..a6c1f04 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDamagedCantUnderAttack.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIDamagedCantUnderAttack : AIScriptArgumentExpressions +{ + public AIDamagedCantUnderAttack(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + tagOwner.ChangeIsCantUnderAttack(isCantUnderAttack: true); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDamagedDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIDamagedDamage.cs new file mode 100644 index 0000000..419fc71 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDamagedDamage.cs @@ -0,0 +1,99 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIDamagedDamage : AIFiltersAndSelectTypeArgument +{ + private AIPolishConvertedExpression _damageValue; + + private AIPolishConvertedExpression _damageCount; + + private const int DAMAGE_VALUE_OFFSET = 2; + + private const int DAMAGE_COUNT_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIDamagedDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _damageValue = _exprList[_exprList.Count - 2]; + _damageCount = _exprList[_exprList.Count - 1]; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + List candidateRange = GetCandidateRange(field); + return GetFilteredTargets(candidateRange, owner, playPtn, situation, isBlockDead); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + int damage = GetDamage(tagOwner, field, playPtn, situation); + int count = GetCount(tagOwner, field, playPtn, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + { + for (int j = 0; j < count; j++) + { + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, damage, situation); + } + break; + } + case AIScriptTokenArgType.RANDOM_SELECT: + { + for (int i = 0; i < count; i++) + { + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, damage, situation); + } + break; + } + } + } + + private int GetDamage(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_damageValue == null) + { + AIConsoleUtility.LogError("AIDamagedDamage error!! _damageValue is null"); + return 0; + } + return (int)_damageValue.EvalArg(tagOwner, playPtn, field, situation); + } + + private int GetCount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_damageCount == null) + { + AIConsoleUtility.LogError("AIDamagedDamage error!! _damageCount is null"); + return 0; + } + return (int)_damageCount.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDamagedHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIDamagedHeal.cs new file mode 100644 index 0000000..2863fd8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDamagedHeal.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIDamagedHeal : AIFiltersAndSelectTypeArgument +{ + private const int HEAL_AMOUNT_OFFSET = 1; + + private AIPolishConvertedExpression _healAmount; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIDamagedHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _healAmount = _exprList[_exprList.Count - 1]; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + List candidateRange = GetCandidateRange(field); + return GetFilteredTargets(candidateRange, owner, playPtn, situation, isBlockDead); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int healAmount = GetHealAmount(tagOwner, field, playPtn, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targetsFromField, field, healAmount, playPtn, situation); + } + } + } + + public int GetHealAmount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_healAmount == null) + { + AIConsoleUtility.LogError("AIDamagedHeal error!! _healAmount is null!"); + return 0; + } + return (int)_healAmount.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDamagedToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIDamagedToken.cs new file mode 100644 index 0000000..7503ca2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDamagedToken.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIDamagedToken : AIFiltersArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_INDEX_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIDamagedToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AISummonTokenUtility.ExecuteSummonToken(GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false), base.Filters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDelayTurnEndTime.cs b/SVSim.BattleEngine/Engine/Wizard/AIDelayTurnEndTime.cs new file mode 100644 index 0000000..2f3aede --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDelayTurnEndTime.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class AIDelayTurnEndTime : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression _minDelayTime; + + private AIPolishConvertedExpression _maxDelayTime; + + private int MIN_DELAY_TIME_ARG_INDEX; + + private int MAX_DELAY_TIME_ARG_INDEX = 1; + + public AIDelayTurnEndTime(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count > MAX_DELAY_TIME_ARG_INDEX) + { + _minDelayTime = _exprList[MIN_DELAY_TIME_ARG_INDEX]; + _maxDelayTime = _exprList[MAX_DELAY_TIME_ARG_INDEX]; + } + } + + public float GetDelayTime(AIVirtualCard ownerCard, List playPtn) + { + if (_minDelayTime == null || _maxDelayTime == null) + { + return 0f; + } + AIVirtualField selfField = ownerCard.SelfField; + float minInclusive = _minDelayTime.EvalArg(ownerCard, playPtn, selfField); + float maxInclusive = _maxDelayTime.EvalArg(ownerCard, playPtn, selfField); + return Random.Range(minInclusive, maxInclusive); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDelayTurnEndTimePolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/AIDelayTurnEndTimePolicyCollection.cs new file mode 100644 index 0000000..68a9882 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDelayTurnEndTimePolicyCollection.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIDelayTurnEndTimePolicyCollection : AIPolicyCollection +{ + public float GetDelayTime(AIVirtualCard ownerCard, List playPtn) + { + if (!base.HasPolicy) + { + return 0f; + } + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.Argument is AIDelayTurnEndTime && aIPolicyData.CheckCondition(ownerCard, playPtn, ownerCard.SelfField, null)) + { + return (aIPolicyData.Argument as AIDelayTurnEndTime).GetDelayTime(ownerCard, playPtn); + } + } + return 0f; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDiscardDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIDiscardDamage.cs new file mode 100644 index 0000000..9ab4488 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDiscardDamage.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIDiscardDamage : AIFiltersAndSelectTypeArgument +{ + private AIPolishConvertedExpression _damageArg; + + private const int DAMAGE_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIDiscardDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _damageArg = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int damage = GetDamage(tagOwner, playPtn, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, tagOwner.SelfField, damage, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, tagOwner.SelfField, damage, situation); + break; + } + } + } + + private int GetDamage(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (_damageArg == null) + { + return 0; + } + return (int)_damageArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDiscardHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIDiscardHeal.cs new file mode 100644 index 0000000..4e236a9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDiscardHeal.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIDiscardHeal : AIFiltersAndSelectTypeArgument +{ + private AIPolishConvertedExpression _healAmount; + + private const int HEAL_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIDiscardHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _healAmount = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int heal = (int)_healAmount.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targetsFromField, field, heal, playPtn, situation); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDiscardUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIDiscardUtility.cs new file mode 100644 index 0000000..273c510 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDiscardUtility.cs @@ -0,0 +1,259 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Wizard; + +public static class AIDiscardUtility +{ + private class DiscardCandidateOrder : IComparer> + { + public enum SortType + { + Ascending, + Dscending + } + + private SortType _sortOrder; + + public DiscardCandidateOrder(SortType sortType) + { + _sortOrder = sortType; + } + + public int Compare(Tuple left, Tuple right) + { + if (left.second > right.second) + { + if (_sortOrder != SortType.Ascending) + { + return -1; + } + return 1; + } + if (left.second < right.second) + { + if (_sortOrder != SortType.Ascending) + { + return 1; + } + return -1; + } + return 0; + } + } + + private const float TURN_COST_DIFF_BONUS_RATE = 0.001f; + + public static float CalcAllDiscardedBonus(AIVirtualField field, AISituationInfo playSituation, List playPtn) + { + AIDiscardInfo discardInfo = playSituation.DiscardInfo; + if (discardInfo == null || !discardInfo.IsValuable) + { + return 0f; + } + float num = 0f; + for (int i = 0; i < discardInfo.TargetList.Count; i++) + { + num += EvaluateDiscardedBonus(discardInfo.TargetList[i], playPtn, playSituation, field, isIgnoreInBattle: false, isCalcCostDiff: false, isCalcTokenValue: false); + } + if (field.CardListSet.HasAfterDiscardTagHolder) + { + for (int j = 0; j < field.CardListSet.AfterDiscardTagHolders.Count; j++) + { + AIVirtualCard tagOwner = field.CardListSet.AfterDiscardTagHolders[j]; + num += tagOwner.GetAllyDiscardBonus(playPtn, playSituation, useIgnoreInBattle: false); + } + } + return num; + } + + public static float EvaluateDiscardedBonus(AIVirtualCard targetCard, List playPtn, AISituationInfo situation, AIVirtualField field, bool isIgnoreInBattle, bool isCalcCostDiff, bool isCalcTokenValue) + { + float num = 0f; + num += targetCard.GetDiscardedBonus(playPtn, situation, isIgnoreInBattle); + if (isCalcTokenValue) + { + num += targetCard.GetDiscardedTokenBonus(field, playPtn, situation, isIgnoreInBattle); + } + num -= targetCard.GetHandBonus(playPtn, situation, isIgnoreInFusion: false); + if (isCalcCostDiff) + { + num += (float)Mathf.Abs(targetCard.SelfField.AllyPpTotal - targetCard.Cost) * 0.001f; + } + if (playPtn != null && playPtn.Count > 0) + { + for (int i = 0; i < playPtn.Count; i++) + { + if (field.AllyHandCards[playPtn[i]].IsSameCard(targetCard)) + { + num += -1000f; + break; + } + } + } + return num; + } + + public static List GetAllDiscardedTokenIds(AIDiscardInfo discardInfo, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (discardInfo == null || !discardInfo.IsValuable) + { + return null; + } + List list = null; + for (int i = 0; i < discardInfo.TargetList.Count; i++) + { + List discardedTokenIds = discardInfo.TargetList[i].GetDiscardedTokenIds(field, playPtn, situation); + if (discardedTokenIds != null) + { + list = AIParamQuery.AddRangeToList(discardedTokenIds, list); + } + } + return list; + } + + public static List SelectBestDiscardTarget(AIVirtualCard tagOwner, AIVirtualField field, List discardCandidates, int discardCount, List playPtn, AISituationInfo situation) + { + return SelectDiscardTargets(tagOwner, field, discardCandidates, discardCount, playPtn, situation, DiscardCandidateOrder.SortType.Dscending); + } + + public static List SelectWorstDiscardTarget(AIVirtualCard tagOwner, AIVirtualField field, List discardCandidates, int discardCount, List playPtn, AISituationInfo situation) + { + return SelectDiscardTargets(tagOwner, field, discardCandidates, discardCount, playPtn, situation, DiscardCandidateOrder.SortType.Ascending); + } + + private static List SelectDiscardTargets(AIVirtualCard tagOwner, AIVirtualField field, List discardCandidates, int discardCount, List playPtn, AISituationInfo situation, DiscardCandidateOrder.SortType sortType) + { + if (discardCandidates == null) + { + return null; + } + List list; + if (discardCandidates.Count <= discardCount) + { + list = new List(discardCandidates.Count); + for (int i = 0; i < discardCandidates.Count; i++) + { + list.Add(discardCandidates[i]); + } + return list; + } + list = SortDiscardCandidats(discardCandidates, playPtn, situation, field, sortType); + return list.GetRange(0, discardCount); + } + + private static List SortDiscardCandidats(List candidates, List playPtn, AISituationInfo situation, AIVirtualField field, DiscardCandidateOrder.SortType sortType) + { + List> list = new List>(); + for (int i = 0; i < candidates.Count; i++) + { + list.Add(new Tuple + { + first = candidates[i], + second = EvaluateDiscardedBonus(candidates[i], playPtn, situation, field, isIgnoreInBattle: false, isCalcCostDiff: true, isCalcTokenValue: true) + }); + } + DiscardCandidateOrder comparer = new DiscardCandidateOrder(sortType); + list.Sort(comparer); + List list2 = new List(list.Count); + for (int j = 0; j < list.Count; j++) + { + list2.Add(list[j].first); + } + return list2; + } + + public static bool IsMatchedDiscardTarget(AIVirtualCard tagOwner, List filters, List playPtn, AISituationInfo situation) + { + if (tagOwner == null || situation == null) + { + return false; + } + AIDiscardInfo discardInfo = situation.DiscardInfo; + if (discardInfo == null || !discardInfo.IsValuable) + { + return false; + } + List targetList = discardInfo.TargetList; + for (int i = 0; i < targetList.Count; i++) + { + if (AIFilteringUtility.CheckMatchTargetFiltering(targetList[i], targetList, filters, playPtn, tagOwner, situation)) + { + return true; + } + } + return false; + } + + public static int GetDiscardCount(AIScriptTokenArgType discardListType, AIVirtualCard ownerCard, List playPtn, AISituationInfo situation) + { + AIVirtualField selfField = ownerCard.SelfField; + switch (discardListType) + { + case AIScriptTokenArgType.PLAYED: + return GetDiscardCountFromDiscardedList(selfField); + case AIScriptTokenArgType.BEFORE_PLAYPTN: + return GetDiscardCountFromBeforePlayPtnNew(ownerCard, selfField, playPtn, selfField.AI.PlayPtnRecorder); + case AIScriptTokenArgType.NOW: + { + AIDiscardInfo discardInfo = situation.DiscardInfo; + if (discardInfo == null || !discardInfo.IsValuable) + { + return 0; + } + return discardInfo.TargetList.Count; + } + default: + return 0; + } + } + + private static int GetDiscardCountFromDiscardedList(AIVirtualField field) + { + return field.AI.DiscardedCards.Count((AIVirtualCard c) => c.IsSelfTurn == field.AllyBattlePlayer.IsSelfTurn && field.AI.BattleMgr.CurrentTurn == c.DestroyedTurn); + } + + private static int GetDiscardCountFromBeforePlayPtnNew(AIVirtualCard ownerCard, AIVirtualField field, List playPtn, AIPlayptnRecorder recorder) + { + AISinglePlayptnRecord playptnRecordOnSim = field.GetPlayptnRecordOnSim(playPtn); + if (playptnRecordOnSim == null) + { + AIConsoleUtility.LogError("GetDiscardCountFromPlayPtn error!! Cannot find playPtn record!!!!!"); + return 0; + } + int num = 0; + List playedCardList = playptnRecordOnSim.PlayedCardList; + for (int i = 0; i < playedCardList.Count; i++) + { + PlayedCardInfo playedCardInfo = playedCardList[i]; + if (playedCardInfo.Card.IsSameCard(ownerCard)) + { + break; + } + if (playedCardInfo.DiscardInfo != null && playedCardInfo.DiscardInfo.TargetList != null) + { + num += playedCardInfo.DiscardInfo.TargetList.Count; + } + } + return num; + } + + public static bool CheckAttackDiscardTargetInPlayPtn(AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (situation.ActionType != AIOperationType.ATTACK) + { + return false; + } + AIVirtualCard actor = situation.Actor; + if (!actor.TagCollectionContainer.HasTag(AIPlayTagType.AttackDiscard)) + { + return false; + } + if (actor.TagCollectionContainer.AttackTags.CheckAttackDiscardTargetInPlayPtn(actor, field.AllyHandCards, playPtn, situation)) + { + return true; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDiscardedToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIDiscardedToken.cs new file mode 100644 index 0000000..9aac45d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDiscardedToken.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIDiscardedToken : AIFiltersArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_INDEX_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIDiscardedToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AISummonTokenUtility.ExecuteSummonToken(GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false), base.Filters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } + + public List GetTokenIds(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return AISummonTokenUtility.GetOwnerSideTokenIds(GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false), base.Filters, _tokenCount, AITokenType.Default, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEarthRite.cs b/SVSim.BattleEngine/Engine/Wizard/AIEarthRite.cs new file mode 100644 index 0000000..13b29c0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEarthRite.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEarthRite : AIScriptArgumentExpressions +{ + private List _earthRiteCountList; + + private static readonly int TIMING_ARG_OFFSET = 1; + + public AIScriptTokenArgType Timing { get; private set; } + + public AIEarthRite(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + int num = _exprList.Count - TIMING_ARG_OFFSET; + _earthRiteCountList = new List(); + for (int i = 0; i < num; i++) + { + _earthRiteCountList.Add(_exprList[i]); + } + Timing = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[num]); + } + + public int GetEarthRiteCount(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, int currentStackCount) + { + int num = 0; + for (int i = 0; i < _earthRiteCountList.Count; i++) + { + AIPolishConvertedExpression aIPolishConvertedExpression = _earthRiteCountList[i]; + if (aIPolishConvertedExpression.IsCertainArgumentTypeExpress(AIScriptTokenArgType.ALL)) + { + return currentStackCount; + } + int num2 = (int)aIPolishConvertedExpression.EvalArg(owner, playPtn, field, situation); + if (num2 <= currentStackCount && num2 > num) + { + num = num2; + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEmoteOnTurnTransition.cs b/SVSim.BattleEngine/Engine/Wizard/AIEmoteOnTurnTransition.cs new file mode 100644 index 0000000..952aa9d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEmoteOnTurnTransition.cs @@ -0,0 +1,56 @@ +namespace Wizard; + +public class AIEmoteOnTurnTransition : AIScriptArgumentExpressions +{ + private readonly int SIDE_INDEX; + + private readonly int EMOTE_ID_INDEX = 1; + + public AIScriptTokenArgType Side { get; private set; } + + public int EmoteId { get; private set; } + + public AIEmoteOnTurnTransition(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count <= EMOTE_ID_INDEX) + { + AIConsoleUtility.LogError($"AIEmoteOnTurnTransition Argument Error!! Arg count is not enough [count:{_exprList.Count}]"); + return; + } + AIPolishConvertedExpression arg = _exprList[SIDE_INDEX]; + if (IsSideTokenArgType(arg, out var dstTokenARgType)) + { + Side = dstTokenARgType; + } + else + { + Side = AIScriptTokenArgType.ALLY; + AIConsoleUtility.LogError("AIEmoteOnTurnTransition Side Expression Error!! SideType =" + dstTokenARgType); + } + AIPolishConvertedExpression aIPolishConvertedExpression = _exprList[EMOTE_ID_INDEX]; + if (aIPolishConvertedExpression.TokenList != null && aIPolishConvertedExpression.TokenList.Count > 0) + { + AIScriptTokenBase aIScriptTokenBase = aIPolishConvertedExpression.TokenList[0]; + EmoteId = (int)aIScriptTokenBase.Value; + } + else + { + EmoteId = -1; + } + } + + public int GetEmoteIdIfSideIsCorrect(bool isOwnerTurn) + { + if (Side == AIScriptTokenArgType.BOTH || (Side == AIScriptTokenArgType.ALLY && isOwnerTurn) || (Side == AIScriptTokenArgType.OPPONENT && !isOwnerTurn)) + { + return EmoteId; + } + return -1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEmoteUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIEmoteUtility.cs new file mode 100644 index 0000000..983036f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEmoteUtility.cs @@ -0,0 +1,9 @@ +namespace Wizard; + +public class AIEmoteUtility +{ + public static bool IsSystemEmoteKey(int emoteKey) + { + return emoteKey < 1000; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEnhance.cs b/SVSim.BattleEngine/Engine/Wizard/AIEnhance.cs new file mode 100644 index 0000000..a1c33de --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEnhance.cs @@ -0,0 +1,18 @@ +namespace Wizard; + +public class AIEnhance : AIScriptArgumentExpressions +{ + public AIEnhance(string text) + : base(text) + { + } + + public void RegisterSelfToOwner(AIVirtualCard owner, AIVirtualField field) + { + for (int i = 0; i < _exprList.Count; i++) + { + int element = (int)EvalArg(i, owner, EnemyAI.EmptyPlayPtn, field, null); + owner.EnhanceCostList = AIParamQuery.AddElementToList(element, owner.EnhanceCostList); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvaluateBonusFromOhterUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvaluateBonusFromOhterUtility.cs new file mode 100644 index 0000000..49fde75 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvaluateBonusFromOhterUtility.cs @@ -0,0 +1,259 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIEvaluateBonusFromOhterUtility +{ + private static float USE_MIN_BONUS_DEFAULT_VALUE = 10000f; + + public static float GetAllyPlayBonus(AIVirtualCard targetCard, List playPtn, AISituationInfo situation) + { + if (targetCard == null) + { + return 0f; + } + float num = 0f; + List allAllyCards = targetCard.SelfField.CardListSet.AllAllyCards; + float currentUseMinValue = USE_MIN_BONUS_DEFAULT_VALUE; + for (int i = 0; i < allAllyCards.Count; i++) + { + AIVirtualCard aIVirtualCard = allAllyCards[i]; + if (!aIVirtualCard.IsDead && !targetCard.IsSameCard(aIVirtualCard)) + { + num += aIVirtualCard.GetAllyPlayBonus(targetCard, playPtn, situation, ref currentUseMinValue); + num += aIVirtualCard.GetOtherSummonBonus(targetCard, playPtn, situation); + } + } + num += targetCard.SelfField.StyleQuery.GetAllyPlayBonus(targetCard, playPtn, situation, ref currentUseMinValue); + if (EnemyAI.IsLargerThan(USE_MIN_BONUS_DEFAULT_VALUE, currentUseMinValue)) + { + num += currentUseMinValue; + } + return num; + } + + private static float GetOtherSummonBonus(this AIVirtualCard tagOwner, AIVirtualCard targetCard, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.OtherSummonQuick)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.OtherSummonTags.GetOtherSummonBonus(targetCard, tagOwner, tagOwner.SelfField, playPtn, situation); + } + + public static float GetEnemyPlayBonus(AIVirtualCard targetCard, List playPtn, AISituationInfo situation) + { + if (targetCard == null) + { + return 0f; + } + float num = 0f; + List enemyClassAndInplayCards = targetCard.SelfField.CardListSet.EnemyClassAndInplayCards; + for (int i = 0; i < enemyClassAndInplayCards.Count; i++) + { + AIVirtualCard tagOwner = enemyClassAndInplayCards[i]; + num += tagOwner.GetEnemyPlayBonus(targetCard, playPtn, situation); + } + return num; + } + + public static float GetPlayPtnBonus(AIVirtualField field, List playPtn) + { + float num = 0f; + for (int i = 0; i < field.CardListSet.AllyClassAndInplayCards.Count; i++) + { + AIVirtualCard tagOwner = field.CardListSet.AllyClassAndInplayCards[i]; + num += tagOwner.GetPlayPtnBonus(playPtn); + } + return num; + } + + public static int GetTotalRecoverPp(AIVirtualCard playCard, List playPtn, AISituationInfo situation) + { + int num = 0; + List allyHandCards = playCard.SelfField.AllyHandCards; + for (int i = 0; i < playPtn.Count; i++) + { + AIVirtualCard aIVirtualCard = allyHandCards[playPtn[i]]; + if (aIVirtualCard.IsSameCard(playCard)) + { + num += aIVirtualCard.GerWhenPlayRecoverPp(playCard, playPtn, situation); + break; + } + num += aIVirtualCard.GetOtherPlayRecoverPp(playCard, playCard.SelfField, playPtn, situation); + } + allyHandCards = playCard.SelfField.CardListSet.AllyClassAndInplayCards; + for (int j = 0; j < allyHandCards.Count; j++) + { + AIVirtualCard aIVirtualCard2 = allyHandCards[j]; + if (!aIVirtualCard2.IsDead) + { + num += aIVirtualCard2.GetOtherPlayRecoverPp(playCard, playCard.SelfField, playPtn, situation); + } + } + return num; + } + + public static float GetOtherBattleBonus(AIVirtualCard targetCard, List playPtn) + { + float num = 0f; + AIVirtualField selfField = targetCard.SelfField; + for (int i = 0; i < selfField.CardListSet.BothClassAndInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = selfField.CardListSet.BothClassAndInplayCards[i]; + if (!aIVirtualCard.IsDead) + { + num += aIVirtualCard.GetOtherBattleBonusFromOneCard(targetCard, playPtn); + } + } + List playptnCards = selfField.GetPlayptnCards(playPtn); + if (playptnCards != null && playptnCards.Count > 0) + { + for (int j = 0; j < playptnCards.Count; j++) + { + AIVirtualCard tagOwner = playptnCards[j]; + num += tagOwner.GetOtherBattleBonusFromOneCard(targetCard, playPtn); + } + } + return num; + } + + public static float GetOtherBattleBonusRate(AIVirtualCard targetCard, List playPtn, bool useIgnoreInBattle, AISituationInfo situation) + { + float num = 1f; + AIVirtualField selfField = targetCard.SelfField; + for (int i = 0; i < selfField.CardListSet.BothClassAndInplayCards.Count; i++) + { + AIVirtualCard tagOwner = selfField.CardListSet.BothClassAndInplayCards[i]; + num *= tagOwner.GetOtherBattleBonusRateFromOneCard(targetCard, playPtn, useIgnoreInBattle, situation); + } + List playptnCards = selfField.GetPlayptnCards(playPtn); + if (playptnCards != null && playptnCards.Count > 0) + { + for (int j = 0; j < playptnCards.Count; j++) + { + AIVirtualCard tagOwner2 = playptnCards[j]; + num *= tagOwner2.GetOtherBattleBonusRateFromOneCard(targetCard, playPtn, useIgnoreInBattle, situation); + } + } + return num; + } + + public static float GetAllOtherEvoBonus(AISituationInfo situation, List playPtn) + { + return 0f + GetAllMemberEvoBonus(situation, playPtn) + GetAllEnemyEvoBonus(situation, playPtn); + } + + private static float GetAllMemberEvoBonus(AISituationInfo situation, List playPtn) + { + List list = (situation.Actor.IsAlly ? situation.Actor.SelfField.GetMemberCardList(playPtn) : situation.Actor.SelfField.CardListSet.EnemyClassAndInplayCards); + float num = 0f; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (!situation.Actor.IsSameCard(aIVirtualCard)) + { + num += aIVirtualCard.GetMemberEvoBonus(situation, playPtn); + } + } + return num; + } + + private static float GetAllEnemyEvoBonus(AISituationInfo situation, List playPtn) + { + List list = (situation.Actor.IsAlly ? situation.Actor.SelfField.CardListSet.EnemyClassAndInplayCards : situation.Actor.SelfField.GetMemberCardList(playPtn)); + float num = 0f; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard tagOwner = list[i]; + num += tagOwner.GetEnemyEvoBonus(situation, playPtn); + } + return num; + } + + public static int GetPlayPlusCount(AIVirtualField field, List playPtn) + { + int num = 0; + for (int i = 0; i < playPtn.Count; i++) + { + int num2 = playPtn[i]; + if (num2 < field.AllyHandCards.Count) + { + AIVirtualCard tagOwner = field.AllyHandCards[num2]; + num += tagOwner.GetPlayPlusCount(playPtn); + } + } + return num; + } + + public static int GetOtherPlayoutDamageBonus(AIVirtualCard target, AIVirtualField field, List playPtn) + { + int num = 0; + if (field.CardListSet.HasAllyPlayoutDamageBonusHolder) + { + for (int i = 0; i < field.CardListSet.AllyPlayoutDamageBonusHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.AllyPlayoutDamageBonusHolders[i]; + if (!aIVirtualCard.IsDead && !aIVirtualCard.IsSameCard(target)) + { + num += aIVirtualCard.GetAllyPlayoutDamageBonus(target, field, playPtn); + } + } + } + return num; + } + + public static float GetOtherBreakBonus(AIVirtualCard target, AIVirtualField field, List playPtn, bool useIgnoreInBattle) + { + if (!field.CardListSet.HasOtherBreakBonusHolder) + { + return 0f; + } + float num = 0f; + for (int i = 0; i < field.CardListSet.OtherBreakBonusHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.OtherBreakBonusHolders[i]; + if (!aIVirtualCard.IsDead && !aIVirtualCard.IsSameCard(target)) + { + num += aIVirtualCard.GetOtherBreakBonus(target, field, playPtn, useIgnoreInBattle); + } + } + return num; + } + + public static float GetOtherBanishBonus(AIVirtualCard target, AIVirtualField field, List playPtn, bool useIgnoreInBattle) + { + if (!field.CardListSet.HasOtherBanishBonusHolder) + { + return 0f; + } + float num = 0f; + for (int i = 0; i < field.CardListSet.OtherBanishBonusHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.OtherBanishBonusHolders[i]; + if (!aIVirtualCard.IsDead && !aIVirtualCard.IsSameCard(target)) + { + num += aIVirtualCard.GetOtherBanishBonus(target, field, playPtn, useIgnoreInBattle); + } + } + return num; + } + + public static float GetOtherLeaveBonus(AIVirtualCard target, AIVirtualField field, List playPtn, bool useIgnoreInBattle) + { + if (!field.CardListSet.HasOtherLeaveBonusHolder) + { + return 0f; + } + float num = 0f; + for (int i = 0; i < field.CardListSet.OtherLeaveBonusHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.OtherLeaveBonusHolders[i]; + if (!aIVirtualCard.IsDead && !aIVirtualCard.IsSameCard(target)) + { + num += aIVirtualCard.GetOtherLeaveBonus(target, field, playPtn, useIgnoreInBattle); + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoAddDeck.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoAddDeck.cs new file mode 100644 index 0000000..da62a4f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoAddDeck.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoAddDeck : AIEvoTagArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_ARG_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + protected override int SELECT_TYPE_OFFSET => -1; + + public AIEvoAddDeck(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + protected override void InitSelectType() + { + base.SelectType = AIScriptTokenArgType.ALL_SELECT; + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AddDeckAction(tagOwner, field, playPtn, situation); + } + + private void AddDeckAction(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null, bool isPseudo = false) + { + List tokenIdFromTag = GetTokenIdFromTag(tagOwner, field, playPtn, situation); + if (tokenIdFromTag != null) + { + int tokenCount = (int)_tokenCount.EvalArg(tagOwner, playPtn, field, situation); + for (int i = 0; i < tokenIdFromTag.Count; i++) + { + field.AddDeckCard(tokenIdFromTag[i].TokenId, tokenCount, tagOwner, playPtn, situation, isPseudo); + } + } + } + + private List GetTokenIdFromTag(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false); + AITokenIdCollection bothSideTokenIdListFromFilter = AISummonTokenUtility.GetBothSideTokenIdListFromFilter(tagOwner, field, targetsFromField, base.Filters, AITokenType.Default, AIScriptTokenArgType.ALLY, AIScriptTokenArgType.ALL_SELECT, 1, playPtn, situation); + if (bothSideTokenIdListFromFilter == null || !bothSideTokenIdListFromFilter.HasAllyToken) + { + return null; + } + return bothSideTokenIdListFromFilter.AllyTokenIdList; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoAddStack.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoAddStack.cs new file mode 100644 index 0000000..b547833 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoAddStack.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoAddStack : AIEvoTagArgument +{ + private AIPolishConvertedExpression _addStackCount; + + private const int ADD_STACK_COUNT_ARG_INDEX = 0; + + protected override int SELECT_TYPE_OFFSET => -1; + + protected override int NON_FILTER_FIRST_OFFSET => -1; + + public AIEvoAddStack(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + if (_exprList == null || _exprList.Count <= 0) + { + AIConsoleUtility.LogError("AIEvoAddStack error!! _exprList is null or Count==0"); + } + else + { + _addStackCount = _exprList[0]; + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIWhiteRitualSimulationUtility.AddWhiteRitualSingle(GetAddStackCount(tagOwner, field, playPtn, situation), targetsFromField); + } + } + + private int GetAddStackCount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_addStackCount == null) + { + return 0; + } + return (int)_addStackCount.EvalArg(tagOwner, playPtn, field, situation); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForWhiteRitualOnly(candidates, tagOwner, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override void CreateLegalSelectTypes() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoAttachTag.cs new file mode 100644 index 0000000..52b75c4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoAttachTag.cs @@ -0,0 +1,105 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoAttachTag : AIEvoTagArgument +{ + private AIScriptTokenArgType _removeTiming; + + private AISelectLogicArgumentBase _selectLogicArg; + + private readonly int REMOVE_TIMING_OFFSET = 1; + + private const int TAG_WORD_START_INDEX = 1; + + private const int SELECT_LOGIC_WORD_START_INDEX = 4; + + public AIPlayTag Tag { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIEvoAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + _removeTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - REMOVE_TIMING_OFFSET]); + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + if (list.Count > 4) + { + _selectLogicArg = AISelectLogicSimulationUtility.CreateSelectLogicArgument(list[4]); + } + else + { + _selectLogicArg = new AIDefaultSelectLogicArgument(null); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targetsFromField, tagOwner, Tag, _removeTiming, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + if (situation.IsTargetExists(base.SelectType)) + { + AIAttachTagSimulationUtility.SimulateAttachTagToTarget(situation, tagOwner, base.SelectType, Tag, _removeTiming); + } + else + { + AIAttachTagSimulationUtility.SimulateAttachTagToSingle(_selectLogicArg.SelectSingleTarget(targetsFromField, tagOwner, field, playPtn, situation, AISelectTargetPattern.Best), tagOwner, Tag, _removeTiming, situation); + } + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + AIDefaultSelectLogicArgument selectLogic = new AIDefaultSelectLogicArgument(null); + AIAttachTagSimulationUtility.SimulateRandomSelectAttachTag(targetsFromField, 1, tagOwner, field, playPtn, situation, Tag, _removeTiming, selectLogic); + break; + } + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (Tag != null) + { + return Tag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoAttackableCount.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoAttackableCount.cs new file mode 100644 index 0000000..efd7e18 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoAttackableCount.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoAttackableCount : AIEvoTagArgument +{ + private AIPolishConvertedExpression _attackableCount; + + private const int ATTACKABLE_COUNT_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIEvoAttackableCount(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _attackableCount = _exprList[_exprList.Count - 1]; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT + }; + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int attackableCount = (int)_attackableCount.EvalArg(tagOwner, playPtn, field, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIAttackableCountSimulationUtility.ExecuteChangeAttackableCountAll(targetsFromField, attackableCount); + break; + case AIScriptTokenArgType.TARGET_SELECT: + AIAttackableCountSimulationUtility.ExecuteChangeAttackableCountTargetSelect(attackableCount, base.SelectType, situation); + break; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoBanish.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoBanish.cs new file mode 100644 index 0000000..131ec57 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoBanish.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoBanish : AIEvoTagArgument +{ + protected override bool _isSelectCountImplemented => true; + + public AIEvoBanish(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBanishSimulationUtility.BanishAll(targetsFromField, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + AIBanishSimulationUtility.BanishRandom(targetsFromField, tagOwner, field, playPtn, situation); + break; + } + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + AIBanishSimulationUtility.ExecuteTargetSelectBanish(tagOwner, targetsFromField, field, playPtn, situation, base.SelectType, selectCount); + break; + } + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + if (candidate.IsIndependent || candidate.IsUnbanishable) + { + return false; + } + return IsCertainlyIncludeTarget(owner, candidate, situation); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Banish; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoBounce.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoBounce.cs new file mode 100644 index 0000000..612ed71 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoBounce.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoBounce : AIEvoTagArgument +{ + public AIEvoBounce(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBounceSimulationUtility.BounceAll(targetsFromField, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIBounceSimulationUtility.BounceRandom(targetsFromField, tagOwner, field, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AIBounceSimulationUtility.ExecuteTargetSelectBounce(tagOwner, targetsFromField, situation, field, playPtn, base.SelectType, GetRemovalType()); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + if (candidate.IsIndependent) + { + return false; + } + return IsCertainlyIncludeTarget(owner, candidate, situation); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Bounce; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoBuff.cs new file mode 100644 index 0000000..01d41ec --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoBuff.cs @@ -0,0 +1,88 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoBuff : AIEvoTagArgument +{ + private AIPolishConvertedExpression _attackBuffArgument; + + private AIPolishConvertedExpression _lifeBuffArgument; + + private readonly int ATTACK_BUFF_ARG_OFFSET = 3; + + private readonly int LIFE_BUFF_ARG_OFFSET = 2; + + private readonly int PERM_OR_TEMP_ARG_OFFSET = 1; + + public AIScriptTokenArgType PermOrTemp { get; private set; } + + protected override bool IsSelfTargetForbidden => false; + + protected override int SELECT_TYPE_OFFSET => 4; + + public AIEvoBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _attackBuffArgument = _exprList[_exprList.Count - ATTACK_BUFF_ARG_OFFSET]; + _lifeBuffArgument = _exprList[_exprList.Count - LIFE_BUFF_ARG_OFFSET]; + PermOrTemp = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - PERM_OR_TEMP_ARG_OFFSET], AIBuffEvaluationUtility.LEGAL_TEMP_OR_PERM_ARGUMENTS); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, _attackBuffArgument, _lifeBuffArgument); + bool isTemp = PermOrTemp == AIScriptTokenArgType.TEMP; + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBuffSimulationUtility.BuffAll_old(targetsFromField, field, buffExecutingInfo_old, isTemp, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AIBuffSimulationUtility.BuffTarget_old(situation, targetsFromField, field, playPtn, base.SelectType, buffExecutingInfo_old, isTemp); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + if (!IsCertainlyIncludeTarget(owner, candidate, situation)) + { + return false; + } + AIVirtualField selfField = owner.SelfField; + return (int)_lifeBuffArgument.EvalArg(owner, selfField.BestPlayPtn, selfField, situation) + candidate.Life <= 0; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + protected override List GetBaseFilteringCards(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead) + { + bool isAttackEffective = _attackBuffArgument != null && !_attackBuffArgument.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoChangeCost.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoChangeCost.cs new file mode 100644 index 0000000..982e0e2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoChangeCost.cs @@ -0,0 +1,86 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoChangeCost : AIEvoTagArgument +{ + private readonly AIScriptTokenArgType[] _legalCostTypeArgs = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ADD, + AIScriptTokenArgType.SET + }; + + private AIPolishConvertedExpression _costValue; + + private const int COST_VALUE_ARG_OFFSET = 1; + + private const int COST_TYPE_ARG_OFFSET = 2; + + public AIScriptTokenArgType CostVariableType { get; private set; } + + public override TargetSelectType SimulationTargetSelectType => TargetSelectType.NormalRuleBase; + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIEvoChangeCost(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _costValue = _exprList[_exprList.Count - 1]; + CostVariableType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], _legalCostTypeArgs); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int costValue = GetCostValue(tagOwner, field, playPtn, situation); + AIChangeCostSimulationUtility.ExecuteCostChange(CostVariableType, base.SelectType, costValue, tagOwner, targetsFromField, situation, field); + } + } + + public override void RegisterRuleBaseTargets(List candidates, AIVirtualCard actor, AIVirtualField field, AIVirtualTargetSelectAction situation, ref List targetList) + { + base.RegisterRuleBaseTargets(candidates, actor, field, situation, ref targetList); + AIVirtualCard aIVirtualCard = AIChangeCostSimulationUtility.SelectTargetForChangeCost(actor, candidates, AISelectTargetPattern.Best); + if (aIVirtualCard != null) + { + targetList = AIParamQuery.AddElementToList(aIVirtualCard, targetList); + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } + + private int GetCostValue(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_costValue == null) + { + AIConsoleUtility.LogError("AIEvoChangeCost.GetCostValue() error!! _costValue is null"); + return 0; + } + return (int)_costValue.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoDamage.cs new file mode 100644 index 0000000..b822713 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoDamage.cs @@ -0,0 +1,122 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoDamage : AIEvoTagArgument +{ + private AIPolishConvertedExpression _damage; + + private AIPolishConvertedExpression _count; + + private readonly int COUNT_ARG_OFFSET = 1; + + private readonly int DAMAGE_ARG_OFFSET = 2; + + private int _countTemp; + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIEvoDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _damage = _exprList[_exprList.Count - DAMAGE_ARG_OFFSET]; + _count = _exprList[_exprList.Count - COUNT_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + int num = (int)_damage.EvalArg(tagOwner, playPtn, field, situation); + int num2 = (int)_count.EvalArg(tagOwner, playPtn, field, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + { + for (int j = 0; j < num2; j++) + { + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, num, situation); + } + break; + } + case AIScriptTokenArgType.RANDOM_SELECT: + { + for (int i = 0; i < num2; i++) + { + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, num, situation); + } + break; + } + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + AIDamageSimulationUtility.DamageRandomMultiSelect(targetsFromField, tagOwner, field, num, num2, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AIDamageSimulationUtility.ExecuteTargetSelectDamage(tagOwner, targetsFromField, field, playPtn, situation, base.SelectType, num, num2); + break; + case AIScriptTokenArgType.DIVIDED_SELECT: + AIDamageSimulationUtility.DamageOldOrderedTargets(targetsFromField, num, tagOwner, field, playPtn, situation); + break; + case AIScriptTokenArgType.REVERSE_TARGET: + case AIScriptTokenArgType.FIRST_SELECT: + break; + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + if (candidate.IsIndependent) + { + return false; + } + AIVirtualField selfField = owner.SelfField; + List bestPlayPtn = selfField.BestPlayPtn; + _countTemp = (int)_count.EvalArg(owner, bestPlayPtn, selfField, situation); + if (!IsCertainlyIncludeTarget(owner, candidate, situation)) + { + return false; + } + int damageAmount = (int)_damage.EvalArg(owner, bestPlayPtn, selfField, situation); + return candidate.SimulateDamageAmount(damageAmount, isSkillDamage: true, owner.IsSpell) * _countTemp >= candidate.Life; + } + + protected override bool CheckIsCandidateSelectedBySelectType(List targets, AISituationInfo situation, AIVirtualCard candidate) + { + if (base.SelectType == AIScriptTokenArgType.RANDOM_MULTI_SELECT) + { + return targets.Count <= _countTemp; + } + return base.CheckIsCandidateSelectedBySelectType(targets, situation, candidate); + } + + protected override List GetBaseFilteringCards(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead: true); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[6] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.RANDOM_MULTI_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT, + AIScriptTokenArgType.DIVIDED_SELECT + }; + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Damage; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoDamageCut.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoDamageCut.cs new file mode 100644 index 0000000..46eb562 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoDamageCut.cs @@ -0,0 +1,65 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoDamageCut : AIEvoTagArgument +{ + private AIScriptTokenArgType _stopTiming; + + private AIScriptTokenArgType _damageType; + + private AIPolishConvertedExpression _cutAmount; + + private bool _isDamageTypeDefinedByMaster; + + private const int CUT_AMOUNT_OFFSET = 1; + + private const int STOP_TIMING_OFFSET = 2; + + private const int DEFAULT_DAMAGE_TYPE_OFFSET = 3; + + protected override int SELECT_TYPE_OFFSET => 1 + (_isDamageTypeDefinedByMaster ? 3 : 2); + + public AIEvoDamageCut(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _cutAmount = _exprList[_exprList.Count - 1]; + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - 3], out _isDamageTypeDefinedByMaster); + InitSelectType(); + InitializeFilter(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int cutAmount = (int)_cutAmount.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBarrierSimulationUtility.AddDamageCutToAll(targetsFromField, tagOwner, field, _damageType, _stopTiming, cutAmount); + } + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoDestroy.cs new file mode 100644 index 0000000..2c6d802 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoDestroy.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoDestroy : AIEvoTagArgument +{ + public AIEvoDestroy(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.DestroyAll(targetsFromField, field, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AISkillSimulationUtility.DestroyRandom(targetsFromField, tagOwner, field, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AIDestroySimulationUtility.ExecuteTargetSelectDestroy(tagOwner, targetsFromField, field, playPtn, situation, base.SelectType); + break; + default: + AIConsoleUtility.LogError("AIEvoDestroy SelectType Error!! SelectType cannot be " + base.SelectType); + break; + } + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + if (candidate.IsIndependent || candidate.IsIndestructible) + { + return false; + } + return IsCertainlyIncludeTarget(owner, candidate, situation); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Destroy; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoDiscard.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoDiscard.cs new file mode 100644 index 0000000..599f6e2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoDiscard.cs @@ -0,0 +1,77 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoDiscard : AIEvoTagArgument +{ + private AIPolishConvertedExpression _discardCountArg; + + private const int DISCARD_COUNT_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public override TargetSelectType SimulationTargetSelectType => TargetSelectType.NormalRuleBase; + + public AIEvoDiscard(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _discardCountArg = _exprList[_exprList.Count - 1]; + } + + public int GetDiscardCount(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (_discardCountArg == null) + { + return 0; + } + return (int)_discardCountArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int discardCount = GetDiscardCount(tagOwner, playPtn, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.TARGET_SELECT: + AISkillSimulationUtility.ExecuteTargetSelectDiscard(targetsFromField, discardCount, base.SelectType, tagOwner, field, playPtn, situation); + break; + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.DiscardAll(tagOwner, targetsFromField, field, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AISkillSimulationUtility.DiscardRandom(tagOwner, field, targetsFromField, discardCount, situation); + break; + } + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + public override void RegisterRuleBaseTargets(List candidates, AIVirtualCard actor, AIVirtualField field, AIVirtualTargetSelectAction situation, ref List targetList) + { + base.RegisterRuleBaseTargets(candidates, actor, field, situation, ref targetList); + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + int discardCount = GetDiscardCount(actor, emptyPlayPtn, situation); + List list = AIDiscardUtility.SelectBestDiscardTarget(actor, field, candidates, discardCount, emptyPlayPtn, situation); + if (list != null && list.Count > 0) + { + targetList = AIParamQuery.AddRangeToList(list, targetList); + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoEvo.cs new file mode 100644 index 0000000..5a32996 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoEvo.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoEvo : AIEvoTagArgument +{ + public AIEvoEvo(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && targetsFromField != null && targetsFromField.Count > 0) + { + AIAutoEvolutionSimulationUtility.AutoEvolution(field, targetsFromField, playPtn, situation, base.SelectType); + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override List GetBaseFilteringCards(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead) + { + List list = AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + list?.RemoveAll((AIVirtualCard c) => c.IsEvolution); + return list; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoGiveBasicSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoGiveBasicSkill.cs new file mode 100644 index 0000000..7532b68 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoGiveBasicSkill.cs @@ -0,0 +1,83 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public class AIEvoGiveBasicSkill : AIEvoTagArgument +{ + private readonly AIScriptTokenArgType _skillType; + + public AIEvoGiveBasicSkill(string text, AIScriptTokenArgType skillType) + : base(text) + { + _skillType = skillType; + RegisterDefaultTargetFiltersBySkillType(); + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.GiveSkillToAll(targetsFromField, field, _skillType); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + AISkillSimulationUtility.ExecuteTargetSelectGiveSkill(targetsFromField, tagOwner, field, playPtn, situation, _skillType, base.SelectType, selectCount); + break; + } + default: + AIConsoleUtility.LogError("AIEvoGiveBasicSkill SelectType Error!! SelectType cannot be " + base.SelectType); + break; + } + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + private void RegisterDefaultTargetFiltersBySkillType() + { + AIScriptTokenArgType skillType = _skillType; + if ((uint)(skillType - 33) <= 1u || skillType == AIScriptTokenArgType.GUARD) + { + AIScriptArgumentToken followerToken = new AIScriptArgumentToken(AIScriptTokenArgType.FOLLOWER, isNot: false); + if (base.Filters == null || !base.Filters.Any((AIScriptTokenBase f) => f.IsEqual(followerToken))) + { + base.Filters = AIParamQuery.AddElementToList(followerToken, base.Filters); + } + } + } + + protected override List GetBaseFilteringCards(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoHandBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoHandBuff.cs new file mode 100644 index 0000000..daa083a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoHandBuff.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoHandBuff : AIEvoTagArgument +{ + private AIPolishConvertedExpression _attackBuffArgument; + + private AIPolishConvertedExpression _lifeBuffArgument; + + private readonly int ATTACK_BUFF_ARG_OFFSET = 2; + + private readonly int LIFE_BUFF_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 3; + + public override TargetSelectType SimulationTargetSelectType => TargetSelectType.NormalRuleBase; + + public AIEvoHandBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _attackBuffArgument = _exprList[_exprList.Count - ATTACK_BUFF_ARG_OFFSET]; + _lifeBuffArgument = _exprList[_exprList.Count - LIFE_BUFF_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, _attackBuffArgument, _lifeBuffArgument); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIHandBuffSimulationUtility.ExecuteHandBuffAll(targetsFromField, buffExecutingInfo_old, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIHandBuffSimulationUtility.ExecuteHandBuffRandom(targetsFromField, buffExecutingInfo_old, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + ExecuteTargetSelectHandBuff(targetsFromField, buffExecutingInfo_old, situation); + break; + } + } + } + + private void ExecuteTargetSelectHandBuff(List candidates, AIBuffExecutingInfo_old buffInfo, AISituationInfo situation) + { + if (situation != null && situation.IsTargetExists(base.SelectType)) + { + AIHandBuffSimulationUtility.ExecuteHandBuffTargetSelect(buffInfo, base.SelectType, situation); + } + else + { + AIHandBuffSimulationUtility.ExecuteHandBuffBestTarget(candidates, buffInfo, situation); + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + public override void RegisterRuleBaseTargets(List candidates, AIVirtualCard actor, AIVirtualField field, AIVirtualTargetSelectAction situation, ref List targetList) + { + base.RegisterRuleBaseTargets(candidates, actor, field, situation, ref targetList); + AIVirtualCard aIVirtualCard = AIHandBuffSimulationUtility.SelectHandBuffTarget(candidates, AISelectTargetPattern.Best, EnemyAI.EmptyPlayPtn, situation); + if (aIVirtualCard != null) + { + targetList = AIParamQuery.AddElementToList(aIVirtualCard, targetList); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + protected override List GetBaseFilteringCards(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead) + { + List baseFilteringCards = base.GetBaseFilteringCards(candidates, tagOwner, field, playPtn, situation, isBlockDead); + baseFilteringCards?.RemoveAll((AIVirtualCard c) => !c.IsUnit); + return baseFilteringCards; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoHandMetamorphose.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoHandMetamorphose.cs new file mode 100644 index 0000000..bda4659 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoHandMetamorphose.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoHandMetamorphose : AIEvoTagArgument +{ + private readonly int METAMORPHOSE_ID_ARG_OFFSET = 1; + + public AIPolishConvertedExpression MetamorphoseId { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIEvoHandMetamorphose(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + MetamorphoseId = _exprList[_exprList.Count - METAMORPHOSE_ID_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int metamorphoseId = MetamorphoseId.EvalID(); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIMetamorphoseSimulationUtility.MetamorphoseHandAll(field, targetsFromField, metamorphoseId, tagOwner, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIMetamorphoseSimulationUtility.MetamorphoseHandRandom(field, targetsFromField, metamorphoseId, tagOwner, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AIMetamorphoseSimulationUtility.MetamorphoseHandTarget(field, targetsFromField, metamorphoseId, situation, base.SelectType); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Metamorphose; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoHandSelect.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoHandSelect.cs new file mode 100644 index 0000000..4707c52 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoHandSelect.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoHandSelect : AIEvoTagArgument +{ + public override bool IsImmediate => true; + + public AIEvoHandSelect(string text) + : base(text) + { + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoHeal.cs new file mode 100644 index 0000000..4b65ace --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoHeal.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoHeal : AIEvoTagArgument +{ + private AIPolishConvertedExpression _healAmount; + + private readonly int HEAL_VALUE_ARG_INDEX = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIEvoHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _healAmount = _exprList[_exprList.Count - HEAL_VALUE_ARG_INDEX]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int heal = (int)_healAmount.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.HealAll(targetsFromField, field, heal, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AISkillSimulationUtility.HealTarget(situation, field, base.SelectType, heal); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override List GetBaseFilteringCards(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead: true); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoMetamorphose.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoMetamorphose.cs new file mode 100644 index 0000000..24fd3fb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoMetamorphose.cs @@ -0,0 +1,75 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoMetamorphose : AIEvoTagArgument +{ + private AIPolishConvertedExpression _metamorphoseId; + + private readonly int METAMORPHOSE_ID_ARG_OFFSET = 2; + + private AIScriptTokenArgType _registerSide = AIScriptTokenArgType.BOTH; + + protected override bool _isSelectCountImplemented => true; + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIEvoMetamorphose(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _metamorphoseId = _exprList[_exprList.Count - METAMORPHOSE_ID_ARG_OFFSET]; + if (IsSideTokenArgType(_exprList[0], out var dstTokenARgType)) + { + _registerSide = dstTokenARgType; + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int metamorphoseId = _metamorphoseId.EvalID(); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIMetamorphoseSimulationUtility.MetamorphoseAll(field, targetsFromField, metamorphoseId, tagOwner, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIMetamorphoseSimulationUtility.MetamorphoseRandom(field, targetsFromField, metamorphoseId, tagOwner, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AIMetamorphoseSimulationUtility.MetamorphoseTarget(field, targetsFromField, metamorphoseId, playPtn, situation, base.SelectType, GetSelectCount(tagOwner, field, playPtn, situation)); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Metamorphose; + } + + protected override AITokenIdCollection CreateRegisterTokenPoolInfo(AIVirtualCard owner, List idList) + { + return AISummonTokenUtility.CreateTokenIdCollectionFromIdList(owner, _registerSide, idList, AITokenType.Default); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoReanimate.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoReanimate.cs new file mode 100644 index 0000000..35176f2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoReanimate.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoReanimate : AIEvoTagArgument +{ + private AIPolishConvertedExpression _costArgument; + + private const int REANIMATE_COST_ARG_INDEX = 0; + + protected override int SELECT_TYPE_OFFSET => -1; + + protected override int NON_FILTER_FIRST_OFFSET => 0; + + public AIEvoReanimate(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _costArgument = _exprList[0]; + InitializeFilter(); + } + + protected override void InitializeFilter() + { + List filterExpressionList = AIPlayTagInitializingUtility.GetFilterExpressionList(_exprList, NON_FILTER_FIRST_OFFSET); + base.Filters = new List(); + if (filterExpressionList != null) + { + base.Filters = GetFilters(filterExpressionList); + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + bool isTokenAlly; + int reanimateTokenId = AIReanimateSimulationUtility.GetReanimateTokenId(tagOwner, field, playPtn, situation, base.Filters, _costArgument, AIScriptTokenArgType.ALLY, out isTokenAlly); + if (reanimateTokenId != -1) + { + AISummonTokenUtility.CreateTokenIdCollectionForReanimate(tagOwner, reanimateTokenId, isTokenAlly).SummonAllTokenToField(field, tagOwner, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoRecoverPp.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoRecoverPp.cs new file mode 100644 index 0000000..195b190 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoRecoverPp.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoRecoverPp : AIEvoTagArgument +{ + private AIPolishConvertedExpression _recoverValue; + + private int RECOVER_VALUE_INDEX_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => -1; + + protected override int NON_FILTER_FIRST_OFFSET => -1; + + public AIEvoRecoverPp(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + if (_exprList == null || _exprList.Count <= 0) + { + AIConsoleUtility.LogError("AIEvoRecoverPp error!! _exprList is null or Count==0"); + } + else + { + _recoverValue = _exprList[_exprList.Count - RECOVER_VALUE_INDEX_OFFSET]; + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + int amount = (int)GetRecoverValue(tagOwner, field, playPtn, situation); + field.RecoverPp(amount); + } + + private float GetRecoverValue(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_recoverValue == null) + { + return 0f; + } + return _recoverValue.EvalArg(tagOwner, playPtn, field, situation); + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoSetLeaderMaxLife.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoSetLeaderMaxLife.cs new file mode 100644 index 0000000..644ccef --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoSetLeaderMaxLife.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoSetLeaderMaxLife : AIEvoTagArgument +{ + private AIScriptTokenArgType _side; + + private AIPolishConvertedExpression _life; + + private const int SIDE_OFFSET = 2; + + private const int VALUE_OFFSET = 1; + + public AIEvoSetLeaderMaxLife(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _side = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2]); + _life = _exprList[_exprList.Count - 1]; + } + + protected override void InitializeFilter() + { + base.Filters = null; + } + + protected override void InitSelectType() + { + base.SelectType = AIScriptTokenArgType.NONE; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + int maxLife = (int)_life.EvalArg(tagOwner, playPtn, field, situation); + AISetStatusSimulationUtility.SetLeaderMaxLife(tagOwner, maxLife, _side, field, situation); + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + if (!candidate.IsLeader) + { + return false; + } + if ((candidate.IsAlly == owner.IsAlly && _side == AIScriptTokenArgType.OPPONENT) || (candidate.IsAlly != owner.IsAlly && _side == AIScriptTokenArgType.ALLY)) + { + return false; + } + AIVirtualField selfField = owner.SelfField; + return (int)_life.EvalArg(owner, selfField.BestPlayPtn, selfField, situation) <= 0; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoSetStatus.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoSetStatus.cs new file mode 100644 index 0000000..631b2ea --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoSetStatus.cs @@ -0,0 +1,81 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoSetStatus : AIEvoTagArgument +{ + private AIPolishConvertedExpression _attackArgument; + + private AIPolishConvertedExpression _lifeArgument; + + private readonly int ATTACK_ARG_OFFSET = 2; + + private readonly int LIFE_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIEvoSetStatus(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _attackArgument = _exprList[_exprList.Count - ATTACK_ARG_OFFSET]; + _lifeArgument = _exprList[_exprList.Count - LIFE_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int attack = (int)_attackArgument.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + int life = (int)_lifeArgument.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.SetStatusAll(targetsFromField, attack, life, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AISkillSimulationUtility.SetStatusTarget(targetsFromField, base.SelectType, attack, life, situation); + break; + default: + AIConsoleUtility.LogError("AIEvoSetStatus Error!! SelecyType " + base.SelectType.ToString() + " is illegal!!!!!"); + break; + } + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + if (!IsCertainlyIncludeTarget(owner, candidate, situation)) + { + return false; + } + AIVirtualField selfField = owner.SelfField; + return (int)_lifeArgument.EvalArg(owner, selfField.BestPlayPtn, selfField, situation) <= 0; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + protected override List GetBaseFilteringCards(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: true, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoShield.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoShield.cs new file mode 100644 index 0000000..ce38ce9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoShield.cs @@ -0,0 +1,70 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoShield : AIEvoTagArgument +{ + private List _stopTimingList; + + private AIScriptTokenArgType _damageType; + + private const int DEFAULT_DAMAGE_TYPE_OFFSET = 2; + + private const int STOP_TIMING_OFFSET = 1; + + private bool _isDamageTypeDefinedByMaster; + + protected override int SELECT_TYPE_OFFSET => 1 + ((!_isDamageTypeDefinedByMaster) ? 1 : 2); + + public AIEvoShield(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _stopTimingList = AIPlayTagInitializingUtility.InitializeStopTimingList(_exprList[_exprList.Count - 1]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - 2], out _isDamageTypeDefinedByMaster); + base.SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], base.LegalSelectTypes); + InitializeFilter(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT + }; + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIBarrierSimulationUtility.AddMultipleStopTimingShieldToAll(targetsFromField, tagOwner, field, _damageType, _stopTimingList); + } + break; + } + case AIScriptTokenArgType.TARGET_SELECT: + AIBarrierSimulationUtility.AddMultipleStopTimingShieldToTarget(situation, base.SelectType, tagOwner, field, _damageType, _stopTimingList); + break; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoSubtractCountdown.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoSubtractCountdown.cs new file mode 100644 index 0000000..70e6d88 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoSubtractCountdown.cs @@ -0,0 +1,71 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoSubtractCountdown : AIEvoTagArgument +{ + private const int COUNTDOWN_ARG_OFFSET = 1; + + private AIPolishConvertedExpression _countDownArg; + + protected override int SELECT_TYPE_OFFSET => 2; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public AIEvoSubtractCountdown(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _countDownArg = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int num = (int)_countDownArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISubtractCountdownSimulationUtility.SubtractCountdownAll(targetsFromField, num, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AISubtractCountdownSimulationUtility.ExecuteTargetSelectSubtractCountdown(tagOwner, targetsFromField, field, playPtn, situation, base.SelectType, num); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override List GetBaseFilteringCards(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead) + { + return AIFilteringUtility.FilteringForCountdownAmuletOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.AllyInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoTagArgument.cs new file mode 100644 index 0000000..64638d2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoTagArgument.cs @@ -0,0 +1,109 @@ +using System.Collections.Generic; + +namespace Wizard; + +public abstract class AIEvoTagArgument : AITargetSelectTagArgument +{ + public virtual bool IsImmediate => false; + + protected virtual bool IsSelfTargetForbidden => true; + + public virtual TargetSelectType SimulationTargetSelectType => TargetSelectType.Default; + + public AIEvoTagArgument(string text) + : base(text) + { + } + + public abstract bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation); + + protected bool IsCertainlyIncludeTarget(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + AIVirtualField selfField = owner.SelfField; + List bestPlayPtn = selfField.BestPlayPtn; + List targetsFromField = GetTargetsFromField(owner, selfField, bestPlayPtn, situation); + if (targetsFromField != null && targetsFromField.Contains(candidate)) + { + return CheckIsCandidateSelectedBySelectType(targetsFromField, situation, candidate); + } + return false; + } + + protected virtual bool CheckIsCandidateSelectedBySelectType(List targets, AISituationInfo situation, AIVirtualCard candidate) + { + return base.SelectType switch + { + AIScriptTokenArgType.ALL_SELECT => true, + AIScriptTokenArgType.RANDOM_SELECT => targets.Count <= 1, + AIScriptTokenArgType.TARGET_SELECT => situation.IsFirstTarget(candidate), + AIScriptTokenArgType.SECOND_TARGET_SELECT => situation.IsSecondTarget(candidate), + _ => false, + }; + } + + public List GetTargetSelectCandidates(AIVirtualCard owner, AIVirtualField field, AISituationInfo situation) + { + if (base.SelectType != AIScriptTokenArgType.TARGET_SELECT && base.SelectType != AIScriptTokenArgType.SECOND_TARGET_SELECT) + { + return null; + } + return GetTargetsFromField(owner, field, field.BestPlayPtn, situation); + } + + public virtual void RegisterRuleBaseTargets(List candidates, AIVirtualCard actor, AIVirtualField field, AIVirtualTargetSelectAction situation, ref List targetList) + { + if (SimulationTargetSelectType != TargetSelectType.NormalRuleBase) + { + AIConsoleUtility.LogError("AIEvoTagArgument.RegisterRuleBaseTargets() error!! " + GetType()?.ToString() + " is not NormalRuleBase!!!!!"); + } + if (base.SelectType != AIScriptTokenArgType.TARGET_SELECT && base.SelectType != AIScriptTokenArgType.SECOND_SELECTED_TARGET) + { + AIConsoleUtility.LogError("AIEvoTagArgument.RegisterRuleBaseTargets() error!! SelectType = " + base.SelectType.ToString() + "!!!!!"); + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool flag = base.SelectType == AIScriptTokenArgType.TARGET_SELECT || base.SelectType == AIScriptTokenArgType.SECOND_TARGET_SELECT; + if (base.Filters == null || base.Filters.Count <= 0) + { + AIConsoleUtility.LogError("AIEvoTagArgument:GetTargets() Missing Target Filter Error! CardName[" + ((tagOwner != null) ? tagOwner.CardName : "") + "]"); + return null; + } + List list = GetBaseFilteringCards(candidates, tagOwner, tagOwner.SelfField, playPtn, situation, isBlockDead); + if (list == null || list.Count <= 0) + { + return null; + } + if (flag && IsSelfTargetForbidden) + { + list.Remove(tagOwner); + } + if (flag && list != null && list.Count > 0) + { + list = AITargetSelectFilteringUtility.GetLegalCandidates(tagOwner, list, 1); + } + return list; + } + + protected virtual List GetBaseFilteringCards(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead) + { + return AIFilteringUtility.MultipleFiltering(candidates, base.Filters, tagOwner, playPtn, situation, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public virtual AIRemovalType GetRemovalType() + { + return AIRemovalType.None; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoToken.cs new file mode 100644 index 0000000..7ec5b6d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoToken.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoToken : AIEvoTagArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_ARG_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + protected override int SELECT_TYPE_OFFSET => -1; + + public AIEvoToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + protected override void InitSelectType() + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AISummonTokenUtility.ExecuteSummonToken(GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false), base.Filters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } + + public int GetTokenCount(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (_tokenCount == null) + { + AIConsoleUtility.LogError("AIEvoToken error!! _tokenCount is null"); + return 0; + } + return (int)_tokenCount.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvoTokenDraw.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvoTokenDraw.cs new file mode 100644 index 0000000..0b8dc23 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvoTokenDraw.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvoTokenDraw : AIEvoTagArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_ARG_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + protected override int SELECT_TYPE_OFFSET => -1; + + public AIEvoTokenDraw(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + protected override void InitSelectType() + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AISummonTokenUtility.ExecuteDrawToken(GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false), base.Filters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvolMove.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvolMove.cs new file mode 100644 index 0000000..5962817 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvolMove.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace Wizard; + +internal class AIEvolMove : AIMove +{ + public BattleCardBase Src { get; private set; } + + public List Targets { get; private set; } + + public AIEvolMove(BattleCardBase src, List targets) + : base(AIOperationType.EVOLVE) + { + Src = src; + Targets = targets; + } + + public override void RunOperation(BattleManagerBase mgr, bool isPlayer) + { + mgr.VfxMgr.RegisterSequentialVfx(mgr.OperateMgr.EvolutionCard(Src, isPlayer, Targets)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvolveToOtherTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvolveToOtherTagArgument.cs new file mode 100644 index 0000000..7495697 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvolveToOtherTagArgument.cs @@ -0,0 +1,70 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvolveToOtherTagArgument : AIScriptArgumentExpressions +{ + private AIVirtualCard _evolveCandidate; + + public AIEvolveToOtherTagArgument(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + if (_exprList.Count <= 0) + { + AIConsoleUtility.LogError("AIEvolveToOtherTagArgument error!! argments is empty !!"); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AIVirtualCard evolveCandidates = GetEvolveCandidates(tagOwner, field, playPtn, situation); + if (evolveCandidates == null) + { + AIConsoleUtility.LogError("AIEvolveToOtherTagArgument error!! evolve target card not found!"); + return; + } + tagOwner.CreateOtherEvolveParameterFromBattleCardBase(field.AI, evolveCandidates.BaseCard, tagOwner.BaseCard, situation); + field.CardListSet.TagClassification(tagOwner); + } + + private AIVirtualCard GetEvolveCandidates(AIVirtualCard parent, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (_evolveCandidate == null) + { + int evolveCandidateId = GetEvolveCandidateId(parent, field, playPtn, situation); + if (evolveCandidateId < 10000) + { + AIConsoleUtility.LogError("AIEvolveToOtherTagArgument.GetEvolveCandidates() error!! cant get card id!"); + return null; + } + AIVirtualCard tokenFromId = field.AI.tokenManager.GetTokenFromId(evolveCandidateId, parent.IsAlly, field); + _evolveCandidate = tokenFromId; + } + return _evolveCandidate; + } + + private int GetEvolveCandidateId(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int result = -1; + AITokenIdCollection bothSideTokenIdListFromFilter = AISummonTokenUtility.GetBothSideTokenIdListFromFilter(tagOwner, field, null, _exprList[0].TokenList, AITokenType.Default, AIScriptTokenArgType.ALLY, AIScriptTokenArgType.ALL_SELECT, 1, playPtn, situation); + if (bothSideTokenIdListFromFilter != null) + { + List list = (tagOwner.IsAlly ? bothSideTokenIdListFromFilter.AllyTokenIdList : bothSideTokenIdListFromFilter.OpponentTokenIdList); + if (list == null || list.Count <= 0) + { + return result; + } + result = list[0].TokenId; + if (list.Count > 1) + { + AIConsoleUtility.LogWarning("GetEvolveCandidateId(): Multiple evolve candidate id found! Check card argments! [CardName:" + tagOwner.CardName + "]"); + } + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvolvedAttackable.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvolvedAttackable.cs new file mode 100644 index 0000000..2b3a96c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvolvedAttackable.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvolvedAttackable : AIScriptArgumentExpressions +{ + public AIEvolvedAttackable(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + tagOwner.GiveAttackable(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvolvedAttackableCount.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvolvedAttackableCount.cs new file mode 100644 index 0000000..bc77e80 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvolvedAttackableCount.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvolvedAttackableCount : AIScriptArgumentExpressions +{ + private readonly int COUNT_ARG_INDEX; + + public AIPolishConvertedExpression Count { get; private set; } + + public AIEvolvedAttackableCount(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Count = _exprList[COUNT_ARG_INDEX]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + int count = (int)Count.EvalArg(tagOwner, playPtn, field, situation); + if (tagOwner.IsEvolution) + { + tagOwner.GiveAttackableCount(count); + } + } + + public int GetAttackableCount(AIVirtualCard owner, List playPtn, AIVirtualField field, AISituationInfo situation) + { + return (int)Count.EvalArg(owner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvolvedSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvolvedSkill.cs new file mode 100644 index 0000000..6d9618c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvolvedSkill.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIEvolvedSkill : AIScriptArgumentExpressions +{ + private readonly int SKILL_TYPE_ARG_INDEX; + + public AIScriptTokenArgType SkillType { get; private set; } + + public AIEvolvedSkill(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count > 0) + { + AIScriptTokenBase aIScriptTokenBase = _exprList[SKILL_TYPE_ARG_INDEX].TokenList[0]; + if (aIScriptTokenBase is AIScriptArgumentToken) + { + SkillType = ((AIScriptArgumentToken)aIScriptTokenBase).ArgumentType; + } + else + { + SkillType = AIScriptTokenArgType.NONE; + } + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + AISkillSimulationUtility.GiveSkill(tagOwner, field, SkillType); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIFilteringActivateCountArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIFilteringActivateCountArgument.cs new file mode 100644 index 0000000..cc70ff7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIFilteringActivateCountArgument.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIFilteringActivateCountArgument : AIActivateCountTagArgument +{ + private const int MAX_ACTIVATE_COUNT_OFFSET = 4; + + public List Filters { get; private set; } + + public AIFilteringActivateCountArgument(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Filters = GetFilters(_exprList.GetRange(0, _exprList.Count - 4)); + if (_exprList[_exprList.Count - 4].TokenList[0] is AIScriptNumericToken aIScriptNumericToken) + { + base.TurnMaxActivateCount = (int)aIScriptNumericToken.Value; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIFilteringUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIFilteringUtility.cs new file mode 100644 index 0000000..ae64f9c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIFilteringUtility.cs @@ -0,0 +1,833 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public static class AIFilteringUtility +{ + public struct FilteringParameter + { + public AIScriptTokenArgType Type; + + public bool IsNot; + + public bool IsSkipNextToken; + + public int FilteringThreshold; + + public string SubParameter; + } + + public static bool CheckFilterPassOrNot(AIVirtualCard card, FilteringParameter filter, AIVirtualCard owner, List playPtn, AISituationInfo situation) + { + bool flag = true; + AIScriptTokenArgType type = filter.Type; + int filteringThreshold = filter.FilteringThreshold; + bool isNot = filter.IsNot; + switch (type) + { + case AIScriptTokenArgType.NONE: + case AIScriptTokenArgType.ALL: + case AIScriptTokenArgType.BOTH: + case AIScriptTokenArgType.ALL_SELECT: + flag = true; + break; + case AIScriptTokenArgType.TARGET_ID: + flag = card.BaseId == filteringThreshold; + break; + case AIScriptTokenArgType.SELF: + flag = card.IsAlly == owner.IsAlly && card.CardIndex == owner.CardIndex; + break; + case AIScriptTokenArgType.OTHER_FOLLOWER: + flag = card.IsFollower(playPtn) && (card.IsAlly != owner.IsAlly || card.CardIndex != owner.CardIndex); + break; + case AIScriptTokenArgType.CLASH_TARGET: + flag = situation is AIVirtualAttackInfo { AttackTarget: not null } aIVirtualAttackInfo && ((owner.IsAlly != aIVirtualAttackInfo.Actor.IsAlly) ? (owner.IsAlly == aIVirtualAttackInfo.AttackTarget.IsAlly && card.IsSameCard(aIVirtualAttackInfo.Actor)) : card.IsSameCard(aIVirtualAttackInfo.AttackTarget)); + break; + case AIScriptTokenArgType.BANISHED_TARGET: + flag = IsBanishedTarget(situation, card); + break; + case AIScriptTokenArgType.GETOFF_CARD: + flag = owner.GetOffCard != null && owner.GetOffCard.IsSameCard(card); + break; + case AIScriptTokenArgType.ATTACKER: + flag = situation != null && situation.ActionType == AIOperationType.ATTACK && situation.Actor != null && card.IsSameCard(situation.Actor); + break; + case AIScriptTokenArgType.EVOLVER: + flag = IsEvolver(card, situation); + break; + case AIScriptTokenArgType.PLAYED_CARD: + flag = situation != null && situation.ActionType == AIOperationType.PLAY && situation.Actor != null && card.IsSameCard(situation.Actor); + break; + case AIScriptTokenArgType.CHOICED_TARGET: + flag = IsChoicedTarget(situation, card); + break; + case AIScriptTokenArgType.SELECTED_TARGET: + flag = IsSelectedTarget(situation, card, isFirst: true); + break; + case AIScriptTokenArgType.SECOND_SELECTED_TARGET: + flag = IsSelectedTarget(situation, card, isFirst: false); + break; + case AIScriptTokenArgType.REVERSE_TARGET: + flag = !IsContainSelectedAllTarget(situation, card); + break; + case AIScriptTokenArgType.TRIGGER: + flag = IsTriggerdCard(situation, card); + break; + case AIScriptTokenArgType.CANDIDATE: + flag = situation.CurrentCheckCard != null && situation.CurrentCheckCard.IsSameCard(card); + break; + case AIScriptTokenArgType.ALLY: + flag = card.IsAlly == owner.IsAlly; + break; + case AIScriptTokenArgType.OPPONENT: + flag = card.IsAlly != owner.IsAlly; + break; + case AIScriptTokenArgType.CLASS: + flag = card.IsLeader; + break; + case AIScriptTokenArgType.ALLY_CLASS: + flag = card.IsLeader && card.IsAlly == owner.IsAlly; + break; + case AIScriptTokenArgType.ENEMY_CLASS: + flag = card.IsLeader && card.IsAlly != owner.IsAlly; + break; + case AIScriptTokenArgType.FOLLOWER: + flag = card.IsFollower(playPtn); + break; + case AIScriptTokenArgType.FOLLOWER_CARD_TYPE: + flag = card.IsUnit; + break; + case AIScriptTokenArgType.DAMAGED_FOLLOWER: + flag = card.IsUnit && card.MaxLife - card.Life > 0; + break; + case AIScriptTokenArgType.NO_DAMAGED_FOLLOWER: + flag = card.IsFollower(playPtn) && card.MaxLife == card.Life; + break; + case AIScriptTokenArgType.EVOLVED: + flag = card.IsEvolution; + break; + case AIScriptTokenArgType.ATTACKABLE: + flag = card.IsAttackable(playPtn); + break; + case AIScriptTokenArgType.CANT_ATTACK: + flag = card.IsCantAttackAll; + break; + case AIScriptTokenArgType.BUFFED_FOLLOWER: + flag = card.IsFollower(playPtn) && (card.Attack > card.BaseCard.BaseAtk || card.MaxLife > card.BaseCard.BaseMaxLife); + break; + case AIScriptTokenArgType.BUFFED_FOLLOWER_CARD_TYPE: + flag = card.IsUnit && (card.Attack > card.BaseCard.BaseAtk || card.MaxLife > card.BaseCard.BaseMaxLife); + break; + case AIScriptTokenArgType.PREVIOUS_TURN_ATTACKED: + flag = card.IsPreviousTurnAttacked; + break; + case AIScriptTokenArgType.ATTACKED: + flag = card.IsAttacked; + break; + case AIScriptTokenArgType.CONSUME_EP_ZERO: + flag = card.IsNotConsumeEp; + break; + case AIScriptTokenArgType.SELECTED_TARGET_ID: + flag = IsSameSelectedTargetID(card, situation); + break; + case AIScriptTokenArgType.AMULET: + flag = card.IsAmulet || card.IsCountdownAmulet || card.IsCrystalize(card.SelfField, playPtn, situation); + break; + case AIScriptTokenArgType.ALLY_AMULET: + flag = (card.IsAmulet || card.IsCountdownAmulet || card.IsCrystalize(card.SelfField, playPtn, situation)) && card.IsAlly == owner.IsAlly; + break; + case AIScriptTokenArgType.CHANT_FIELD: + flag = card.IsCountdownAmulet || card.IsCrystalize(card.SelfField, playPtn, situation); + break; + case AIScriptTokenArgType.NOT_COUNTDOWN_AMULET: + flag = card.IsAmulet && !card.IsCountdownAmulet; + break; + case AIScriptTokenArgType.CRYSTALIZE: + flag = card.IsCrystalize(card.SelfField, playPtn, situation) || card.SelfField.PlayedCardContainer.IsPlayedAsCrystalize(card); + break; + case AIScriptTokenArgType.SPELL: + flag = card.IsSpell || card.IsAccelerated(card.SelfField, playPtn, situation); + break; + case AIScriptTokenArgType.SPELL_CARD_TYPE: + flag = card.IsSpell; + break; + case AIScriptTokenArgType.ACCELERATE: + flag = card.IsAccelerated(card.SelfField, playPtn, situation) || card.SelfField.PlayedCardContainer.IsPlayedAsAccelerate(card); + break; + case AIScriptTokenArgType.BASE_COST_INF: + flag = card.BaseCost > filteringThreshold; + break; + case AIScriptTokenArgType.BASE_COST_SUP: + flag = card.BaseCost < filteringThreshold; + break; + case AIScriptTokenArgType.BASE_COST_EQL: + flag = card.BaseCost == filteringThreshold; + break; + case AIScriptTokenArgType.ATK_INF: + flag = card.Attack > filteringThreshold; + break; + case AIScriptTokenArgType.ATK_SUP: + flag = card.Attack < filteringThreshold; + break; + case AIScriptTokenArgType.ATK_EQL: + flag = card.Attack == filteringThreshold; + break; + case AIScriptTokenArgType.LIFE_INF: + flag = card.Life > filteringThreshold; + break; + case AIScriptTokenArgType.LIFE_SUP: + flag = card.Life < filteringThreshold; + break; + case AIScriptTokenArgType.LIFE_EQL: + flag = card.Life == filteringThreshold; + break; + case AIScriptTokenArgType.COUNTDOWN_EQL: + flag = card.IsCountdownAmulet && card.ChantCount == filteringThreshold; + break; + case AIScriptTokenArgType.PLAY_COUNT_EQL: + { + AIVirtualField selfField = card.SelfField; + int num4 = 0; + for (int num5 = 0; num5 < playPtn.Count; num5++) + { + if (selfField.AllyHandCards[playPtn[num5]].IsSameCard(card)) + { + num4 = num5 + 1; + break; + } + } + flag = card.SelfField.PlayedCardContainer.GetAllPlayedCountInTurn(card.IsAlly) + num4 == filteringThreshold; + break; + } + case AIScriptTokenArgType.NEUTRAL: + flag = card.Clan == CardBasePrm.ClanType.ALL; + break; + case AIScriptTokenArgType.ELF: + flag = card.Clan == CardBasePrm.ClanType.MIN; + break; + case AIScriptTokenArgType.ROYAL: + flag = card.Clan == CardBasePrm.ClanType.ROYAL; + break; + case AIScriptTokenArgType.WITCH: + flag = card.Clan == CardBasePrm.ClanType.WITCH; + break; + case AIScriptTokenArgType.DRAGON: + flag = card.Clan == CardBasePrm.ClanType.DRAGON; + break; + case AIScriptTokenArgType.NECROMANCER: + flag = card.Clan == CardBasePrm.ClanType.NECRO; + break; + case AIScriptTokenArgType.VAMPIRE: + flag = card.Clan == CardBasePrm.ClanType.VAMPIRE; + break; + case AIScriptTokenArgType.BISHOP: + flag = card.Clan == CardBasePrm.ClanType.BISHOP; + break; + case AIScriptTokenArgType.NEMESIS: + flag = card.Clan == CardBasePrm.ClanType.NEMESIS; + break; + case AIScriptTokenArgType.LEGION: + flag = card.IsTribe(CardBasePrm.TribeType.LEGION); + break; + case AIScriptTokenArgType.LORD: + flag = card.IsTribe(CardBasePrm.TribeType.LORD); + break; + case AIScriptTokenArgType.WHITE_RITUAL: + flag = card.IsTribe(CardBasePrm.TribeType.WHITE_RITUAL); + break; + case AIScriptTokenArgType.ARTIFACT: + flag = card.IsTribe(CardBasePrm.TribeType.ARTIFACT); + break; + case AIScriptTokenArgType.MACHINE: + flag = card.IsTribe(CardBasePrm.TribeType.MACHINE); + break; + case AIScriptTokenArgType.MANARIA: + flag = card.IsTribe(CardBasePrm.TribeType.MANARIA); + break; + case AIScriptTokenArgType.FOOD: + flag = card.IsTribe(CardBasePrm.TribeType.FOOD); + break; + case AIScriptTokenArgType.LEVIN: + flag = card.IsTribe(CardBasePrm.TribeType.LEVIN); + break; + case AIScriptTokenArgType.NATURE: + flag = card.IsTribe(CardBasePrm.TribeType.NATURE); + break; + case AIScriptTokenArgType.LOOT: + flag = card.IsTribe(CardBasePrm.TribeType.LOOTING); + break; + case AIScriptTokenArgType.BANQUET: + flag = card.IsTribe(CardBasePrm.TribeType.BANQUET); + break; + case AIScriptTokenArgType.HERO: + flag = card.IsTribe(CardBasePrm.TribeType.HERO); + break; + case AIScriptTokenArgType.ARMED: + flag = card.IsTribe(CardBasePrm.TribeType.ARMED); + break; + case AIScriptTokenArgType.HELLBOUND: + flag = card.IsTribe(CardBasePrm.TribeType.HELLBOUND); + break; + case AIScriptTokenArgType.SCHOOL: + flag = card.IsTribe(CardBasePrm.TribeType.SCHOOL); + break; + case AIScriptTokenArgType.CHESS: + flag = card.IsTribe(CardBasePrm.TribeType.CHESS); + break; + case AIScriptTokenArgType.ANY_TRIBE: + flag = card.HasAnyTribe(); + break; + case AIScriptTokenArgType.ALL_SPELLBOOST: + flag = card.HasSpellboost; + break; + case AIScriptTokenArgType.KILLER: + case AIScriptTokenArgType.SNEAK: + case AIScriptTokenArgType.QUICK: + case AIScriptTokenArgType.RUSH: + case AIScriptTokenArgType.DRAIN: + case AIScriptTokenArgType.GUARD: + case AIScriptTokenArgType.UNTOUCHABLE: + case AIScriptTokenArgType.FORCE_TARGETING: + case AIScriptTokenArgType.UNBANISHABLE: + case AIScriptTokenArgType.IGNORE_GUARD: + flag = AISkillSimulationUtility.HasSkill(card, type, card.SelfField.AI, playPtn, isNot); + break; + case AIScriptTokenArgType.LASTWORD: + flag = card.IsLastword; + break; + case AIScriptTokenArgType.MEDUSA: + flag = card.IsDestroyWhenAttack; + break; + case AIScriptTokenArgType.NOT_BE_ATTACKED: + flag = card.IsSkillCantUnderAnyAttack; + break; + case AIScriptTokenArgType.NO_SKILL: + flag = !card.HasAnySkill; + break; + case AIScriptTokenArgType.UNION_BURST: + flag = card.BaseCard.HasUnionBurst; + break; + case AIScriptTokenArgType.CRYSTALIZE_HOLDER: + flag = card.TagCollectionContainer.HasTag(AIPlayTagType.Crystalize); + break; + case AIScriptTokenArgType.DESTRUCTIBLE: + flag = !card.IsIndestructible && !card.IsIndependent && !card.IsDestroyByBanish; + break; + case AIScriptTokenArgType.IN_HAND: + flag = card.IsInHand; + break; + case AIScriptTokenArgType.IN_PLAY: + flag = card.IsOnField; + break; + case AIScriptTokenArgType.LAST_DRAW_CARD: + { + int num3 = card.SelfField.AllyHandCards.Count - 1; + flag = card.SelfField.AllyHandCards.FindIndex((AIVirtualCard c) => c.IsSameCard(card)) == num3; + break; + } + case AIScriptTokenArgType.NEWER: + if (owner.IsOnField && card.IsOnField) + { + int num = owner.SelfField.AllyInplayCards.FindIndex((AIVirtualCard c) => c.IsSameCard(card)); + int num2 = owner.SelfField.AllyInplayCards.FindIndex((AIVirtualCard c) => c.IsSameCard(owner)); + flag = num > num2; + } + break; + case AIScriptTokenArgType.OLDEST_FOLLOWER: + { + if (!card.IsOnField) + { + break; + } + List list2 = (card.IsAlly ? card.SelfField.AllyInplayCards : card.SelfField.EnemyInplayCards); + flag = false; + for (int j = 0; j < list2.Count; j++) + { + AIVirtualCard aIVirtualCard2 = list2[j]; + if (aIVirtualCard2.IsUnit) + { + flag = aIVirtualCard2.IsSameCard(card); + break; + } + } + break; + } + case AIScriptTokenArgType.OTHER_OLDEST_HAND_CARD_TYPE: + { + flag = false; + List list = (owner.IsAlly ? owner.SelfField.AllyHandCards : owner.SelfField.GetEnemyHandCardList()); + if (list == null || list.Count <= 0) + { + break; + } + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (!aIVirtualCard.IsSameCard(owner)) + { + flag = aIVirtualCard.IsSameCardType(card); + break; + } + } + break; + } + case AIScriptTokenArgType.SUMMON_FOLLOWER: + flag = situation.IsOwnSummonedCard(card, AIScriptTokenArgType.FOLLOWER); + break; + case AIScriptTokenArgType.SUMMON_AMULET: + flag = situation.IsOwnSummonedCard(card, AIScriptTokenArgType.AMULET); + break; + case AIScriptTokenArgType.LATEST_SUMMON_CARD: + flag = situation.IsOwnSummonedCard(card, AIScriptTokenArgType.ALL, isLatest: true); + break; + case AIScriptTokenArgType.LATEST_DRAW_CARD: + flag = situation.IsLatestOwnDrewCard(card); + break; + case AIScriptTokenArgType.ROMELIA_TARGET: + if (owner.BaseId != 121441020) + { + AIConsoleUtility.LogError("ROMELIA_TARGET filtering error!! owner.BaseId = " + owner.BaseId); + flag = false; + } + else + { + flag = situation.ActionType == AIOperationType.ATTACK && situation.IsLatestTarget(card); + } + break; + case AIScriptTokenArgType.FIRST_TURN: + flag = card.IsFirstTurn && card.IsUnit; + break; + case AIScriptTokenArgType.MIN_ATTACK: + case AIScriptTokenArgType.MAX_ATTACK: + flag = card.IsFollower(playPtn) && card.Attack == filteringThreshold; + break; + case AIScriptTokenArgType.MIN_COST: + case AIScriptTokenArgType.MAX_COST: + flag = card.Cost == filteringThreshold; + break; + case AIScriptTokenArgType.FIELD: + flag = card.IsAmulet || card.IsCountdownAmulet; + break; + case AIScriptTokenArgType.EVOLVED_FOLLOWER: + flag = card.IsUnit && card.IsEvolution; + break; + case AIScriptTokenArgType.COST_INF: + flag = card.Cost > filteringThreshold; + break; + case AIScriptTokenArgType.COST_SUP: + flag = card.Cost < filteringThreshold; + break; + case AIScriptTokenArgType.COST_EQL: + flag = card.Cost == filteringThreshold; + break; + case AIScriptTokenArgType.REAL_SKILL_TARGET: + flag = situation.IsRealSkillTarget(card, owner); + break; + case AIScriptTokenArgType.AI_TRIBE: + flag = card.CheckAITribe(card.SelfField, playPtn, situation, filter.SubParameter); + break; + case AIScriptTokenArgType.ENHANCED: + { + List obj = (card.IsAlly ? card.SelfField.AllyGameEnhancePlayCards : card.SelfField.EnemyGameEnhancePlayCards); + flag = false; + foreach (AIVirtualCard item in obj) + { + if (item.IsSameCard(card)) + { + flag = true; + break; + } + } + break; + } + case AIScriptTokenArgType.WHEN_PLAY_DAMAGE: + flag = IsHoldingWhenPlayDamageTag(card); + break; + case AIScriptTokenArgType.WHEN_PLAY_DESTROY: + flag = IsHoldingWhenPlayDestroyTag(card); + break; + case AIScriptTokenArgType.FIRST_SUMMON_FOLLOWER_IN_PLAYPTN: + { + AISinglePlayptnRecord playptnRecordOnSim = card.SelfField.GetPlayptnRecordOnSim(playPtn); + flag = playptnRecordOnSim != null && playptnRecordOnSim.FirstSummonedAllyFollower != null && playptnRecordOnSim.FirstSummonedAllyFollower.IsSameCard(card); + break; + } + default: + return false; + } + return flag ^ isNot; + } + + public static List MultipleFiltering(List targets, List argList, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDeadCard = true) where T : AIVirtualCard + { + if (targets == null || targets.Count <= 0) + { + return null; + } + List list = new List(targets); + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (aIVirtualCard.IsDead && isBlockDeadCard) + { + list.Remove(aIVirtualCard); + continue; + } + bool flag = true; + for (int j = 0; j < argList.Count; j++) + { + AIScriptTokenBase aIScriptTokenBase = argList[j]; + if (aIScriptTokenBase is AIScriptCalculationToken) + { + AIScriptCalculationToken calculation = aIScriptTokenBase as AIScriptCalculationToken; + if (!FilteringCalculationToken(aIVirtualCard, tagOwner, calculation, playPtn, situation)) + { + flag = false; + break; + } + continue; + } + AIScriptTokenBase subToken = ((j + 1 < argList.Count) ? argList[j + 1] : null); + FilteringParameter filter = CreateFilteringParameter(tagOwner, aIVirtualCard, playPtn, situation, aIScriptTokenBase, subToken, list); + if (!CheckFilterPassOrNot(aIVirtualCard, filter, tagOwner, playPtn, situation)) + { + flag = false; + break; + } + if (filter.IsSkipNextToken) + { + j++; + } + } + if (!flag) + { + list.Remove(aIVirtualCard); + } + } + return list; + } + + public static bool CheckMatchTargetFiltering(AIVirtualCard targetCard, List candidates, List filters, List playPtn, AIVirtualCard tagOwner, AISituationInfo situation) + { + for (int i = 0; i < filters.Count; i++) + { + AIScriptTokenBase aIScriptTokenBase = filters[i]; + if (aIScriptTokenBase is AIScriptCalculationToken) + { + AIScriptCalculationToken calculation = aIScriptTokenBase as AIScriptCalculationToken; + if (!FilteringCalculationToken(targetCard, tagOwner, calculation, playPtn, situation)) + { + return false; + } + continue; + } + AIScriptTokenBase subToken = ((i + 1 < filters.Count) ? filters[i + 1] : null); + FilteringParameter filter = CreateFilteringParameter(tagOwner, targetCard, playPtn, situation, aIScriptTokenBase, subToken, candidates); + if (!CheckFilterPassOrNot(targetCard, filter, tagOwner, playPtn, situation)) + { + return false; + } + if (filter.IsSkipNextToken) + { + i++; + } + } + return true; + } + + public static bool FilteringCalculationToken(AIVirtualCard candidate, AIVirtualCard owner, AIScriptCalculationToken calculation, List playPtn, AISituationInfo situation) + { + return calculation.Expression(owner, candidate, owner.SelfField, playPtn, situation) > 0f; + } + + private static FilteringParameter CreateFilteringParameter(AIVirtualCard tagOwner, AIVirtualCard currentCandidate, List playPtn, AISituationInfo situation, AIScriptTokenBase token, AIScriptTokenBase subToken, List candidates) + { + AIScriptTokenArgType aIScriptTokenArgType = AIScriptTokenArgType.NONE; + bool isNot = false; + int filteringThreshold = -1; + bool isSkipNextToken = false; + string subParameter = null; + if (token.Type == AIScriptTokenType.ID) + { + aIScriptTokenArgType = AIScriptTokenArgType.TARGET_ID; + AIScriptIDToken obj = token as AIScriptIDToken; + isNot = obj.IsNot; + filteringThreshold = obj.ID; + } + else if (token.Type == AIScriptTokenType.ARG) + { + AIScriptArgumentToken aIScriptArgumentToken = token as AIScriptArgumentToken; + aIScriptTokenArgType = aIScriptArgumentToken.ArgumentType; + isNot = aIScriptArgumentToken.IsNot; + isSkipNextToken = IsInfSupArgType(aIScriptTokenArgType); + filteringThreshold = GetThresholdOfFilterArg(tagOwner, currentCandidate, playPtn, situation, aIScriptTokenArgType, subToken, candidates, isSkipNextToken); + if (aIScriptTokenArgType == AIScriptTokenArgType.AI_TRIBE) + { + subParameter = ((AIScriptTextToken)aIScriptArgumentToken).Text; + } + } + return new FilteringParameter + { + Type = aIScriptTokenArgType, + IsNot = isNot, + FilteringThreshold = filteringThreshold, + SubParameter = subParameter, + IsSkipNextToken = isSkipNextToken + }; + } + + private static int GetThresholdOfFilterArg(AIVirtualCard tagOwner, AIVirtualCard currentCandidate, List playPtn, AISituationInfo situation, AIScriptTokenArgType argType, AIScriptTokenBase next, List candidates, bool isSkipNextToken) + { + if (isSkipNextToken) + { + if (next != null) + { + AIVirtualField selfField = tagOwner.SelfField; + if (next is AIScriptNumericToken) + { + return (int)next.Value; + } + if (next is AIScriptVariableToken) + { + AIScriptTokenBase aIScriptTokenBase = AIScriptExpressionCalculator.CalculateVariableToken(next, playPtn, tagOwner.SelfField, tagOwner, situation); + if (aIScriptTokenBase != null) + { + return (int)aIScriptTokenBase.Value; + } + } + else if (next is AIScriptCalculationToken aIScriptCalculationToken) + { + return (int)aIScriptCalculationToken.Expression(tagOwner, currentCandidate, selfField, playPtn, situation); + } + } + return -1; + } + switch (argType) + { + case AIScriptTokenArgType.MAX_ATTACK: + if (candidates != null && candidates.Count > 0) + { + return candidates.Max((AIVirtualCard c) => c.Attack); + } + return 0; + case AIScriptTokenArgType.MIN_ATTACK: + if (candidates != null && candidates.Count > 0) + { + return candidates.Min((AIVirtualCard c) => c.Attack); + } + return 0; + case AIScriptTokenArgType.MIN_COST: + if (candidates != null && candidates.Count > 0) + { + return candidates.Min((AIVirtualCard c) => c.Cost); + } + return -1; + case AIScriptTokenArgType.MAX_COST: + if (candidates != null && candidates.Count > 0) + { + return candidates.Max((AIVirtualCard c) => c.Cost); + } + return -1; + default: + return -1; + } + } + + private static bool IsContainSelectedAllTarget(AISituationInfo situation, AIVirtualCard card) + { + if (situation == null || situation.ActionTarget == null) + { + return false; + } + for (int i = 0; i < AISelectedTargetInfoSet.LENGTH; i++) + { + AISelectedTargetInfo aISelectedTargetInfo = situation.SelectedTargets.Get(i); + if (aISelectedTargetInfo == null) + { + break; + } + if (aISelectedTargetInfo.ContainsTarget(card)) + { + return true; + } + } + return false; + } + + private static bool IsSelectedTarget(AISituationInfo situation, AIVirtualCard card, bool isFirst) + { + if (situation == null || card == null || situation.ActionTarget == null) + { + return false; + } + AISelectedTargetInfo aISelectedTargetInfo = (isFirst ? situation.SelectedTargets.Get(0) : situation.SelectedTargets.Get(1)); + if (aISelectedTargetInfo != null && aISelectedTargetInfo.ContainsTarget(card)) + { + return true; + } + return false; + } + + private static bool IsChoicedTarget(AISituationInfo situation, AIVirtualCard card) + { + if (situation == null || card == null) + { + return false; + } + AISelectedTargetInfo choiceTarget = situation.GetChoiceTarget(); + if (choiceTarget != null && choiceTarget.ContainsTarget(card)) + { + return true; + } + return false; + } + + private static bool IsBanishedTarget(AISituationInfo situation, AIVirtualCard card) + { + return situation.IsSameCurrentTriggerCardAndTriggerType(card, AISituationTriggerInformation.TriggerType.Banish); + } + + private static bool IsTriggerdCard(AISituationInfo situation, AIVirtualCard targetCard) + { + return situation.IsSameCurrentTriggerCard(targetCard); + } + + private static bool IsSameSelectedTargetID(AIVirtualCard target, AISituationInfo situation) + { + if (situation == null || situation.SelectedTargets == null) + { + return false; + } + AISelectedTargetInfo aISelectedTargetInfo = situation.SelectedTargets.Get(0); + if (aISelectedTargetInfo == null || !aISelectedTargetInfo.HasTarget) + { + return false; + } + List targets = aISelectedTargetInfo.Targets; + for (int i = 0; i < targets.Count; i++) + { + if (targets[i].BaseId == target.BaseId) + { + return true; + } + } + return false; + } + + private static bool IsEvolver(AIVirtualCard card, AISituationInfo situation) + { + if (situation == null || situation.Actor == null) + { + return false; + } + if (situation.ActionType == AIOperationType.EVOLVE && card.IsSameCard(situation.Actor)) + { + return true; + } + if (situation.IsSameCurrentTriggerCardAndTriggerType(card, AISituationTriggerInformation.TriggerType.Evolver)) + { + return true; + } + return false; + } + + public static int GetCardNameCountFromList(List cardList, List filters, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation = null) + { + if (cardList == null || cardList.Count <= 0) + { + return 0; + } + List list = MultipleFiltering(cardList, filters, tagOwner, playPtn, situation, isBlockDeadCard: false); + if (list == null) + { + return 0; + } + HashSet hashSet = new HashSet(); + for (int i = 0; i < list.Count; i++) + { + hashSet.Add(list[i].BaseId); + } + return hashSet.Count; + } + + public static List FilteringForStatusEffectiveAbility(List candidates, AIVirtualCard tagOwner, List filters, List playPtn, AISituationInfo situation, bool isAttackEffective, bool isBlockDead) + { + List list = MultipleFiltering(candidates, filters, tagOwner, playPtn, situation, isBlockDead); + if (list != null) + { + list.RemoveAll((AIVirtualCard c) => c.IsAmulet); + if (isAttackEffective) + { + list.RemoveAll((AIVirtualCard c) => c.IsLeader); + } + } + return list; + } + + public static List FilteringForFollowerOnly(List candidates, AIVirtualCard tagOwner, List filters, List playPtn, AISituationInfo situation, bool isBlockDead) + { + List list = MultipleFiltering(candidates, filters, tagOwner, playPtn, situation, isBlockDead); + list?.RemoveAll((AIVirtualCard c) => !c.IsUnit); + return list; + } + + public static List FilteringForCountdownAmuletOnly(List candidates, AIVirtualCard tagOwner, List filters, List playPtn, AISituationInfo situation, bool isBlockDead) + { + List list = MultipleFiltering(candidates, filters, tagOwner, playPtn, situation, isBlockDead); + list?.RemoveAll((AIVirtualCard c) => !c.IsCountdownAmulet); + return list; + } + + public static List FilteringForSpellboost(List candidates, AIVirtualCard tagOwner, List filters, List playPtn, AISituationInfo situation) + { + List list = null; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (aIVirtualCard.HasSpellboost) + { + list = AIParamQuery.AddElementToList(aIVirtualCard, list); + } + } + if (list == null || list.Count <= 0) + { + return AIGlobalEmptyList.EmptyVirtualCardList; + } + return MultipleFiltering(list, filters, tagOwner, playPtn, situation); + } + + public static List FilteringForWhiteRitualOnly(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead) + { + if (candidates != null && candidates.Count > 0) + { + candidates.RemoveAll((AIVirtualCard c) => c.IsAlly != tagOwner.IsAlly || !c.IsTribe(AIScriptTokenArgType.WHITE_RITUAL) || !c.IsStackWhiteRitual || c.IsDead); + } + return candidates; + } + + private static bool IsHoldingWhenPlayDamageTag(AIVirtualCard card) + { + AIPlayTagType[] typeArray = new AIPlayTagType[2] + { + AIPlayTagType.FanfareDamage, + AIPlayTagType.PlayDamage + }; + return card.TagCollectionContainer.HasAnyTag(typeArray); + } + + private static bool IsHoldingWhenPlayDestroyTag(AIVirtualCard card) + { + AIPlayTagType[] typeArray = new AIPlayTagType[2] + { + AIPlayTagType.FanfareDestroy, + AIPlayTagType.PlayDestroy + }; + return card.TagCollectionContainer.HasAnyTag(typeArray); + } + + private static bool IsInfSupArgType(AIScriptTokenArgType type) + { + return type > (AIScriptTokenArgType)1000; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIFiltersAndSelectTypeArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIFiltersAndSelectTypeArgument.cs new file mode 100644 index 0000000..59a4cad --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIFiltersAndSelectTypeArgument.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIFiltersAndSelectTypeArgument : AIFiltersArgument +{ + public AIScriptTokenArgType SelectType { get; protected set; } + + public AIScriptTokenArgType ReferenceSelectedTargetType { get; protected set; } + + protected virtual int SELECT_TYPE_OFFSET => 1; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AIFiltersAndSelectTypeArgument(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count > NON_FILTER_FIRST_OFFSET) + { + InitSelectType(); + } + } + + protected virtual void InitSelectType() + { + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], base.LegalSelectTypes); + } + + protected void SetUpReferenceSelectedTargetInfoSelectType() + { + if (base.Filters == null && SelectType != AIScriptTokenArgType.ALL_SELECT) + { + ReferenceSelectedTargetType = AIScriptTokenArgType.NONE; + return; + } + for (int i = 0; i < base.Filters.Count; i++) + { + if (base.Filters[i] is AIScriptArgumentToken { ArgumentType: var argumentType }) + { + switch (argumentType) + { + case AIScriptTokenArgType.SELECTED_TARGET: + ReferenceSelectedTargetType = AIScriptTokenArgType.TARGET_SELECT; + return; + case AIScriptTokenArgType.SECOND_SELECTED_TARGET: + ReferenceSelectedTargetType = AIScriptTokenArgType.SECOND_TARGET_SELECT; + return; + } + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + List filteredTargets = base.GetFilteredTargets(candidates, tagOwner, playPtn, situation, isBlockDead); + if (filteredTargets != null && (SelectType == AIScriptTokenArgType.TARGET_SELECT || SelectType == AIScriptTokenArgType.SECOND_TARGET_SELECT)) + { + AIVirtualCard compareCard = ((tagOwner.BeforeTransformedCardForSimulation != null) ? tagOwner.BeforeTransformedCardForSimulation : tagOwner); + filteredTargets.RemoveAll((AIVirtualCard c) => c.IsSameCard(compareCard)); + } + return filteredTargets; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIFiltersArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIFiltersArgument.cs new file mode 100644 index 0000000..5f7915a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIFiltersArgument.cs @@ -0,0 +1,77 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIFiltersArgument : AIScriptArgumentExpressions +{ + public List Filters { get; protected set; } + + protected virtual int NON_FILTER_FIRST_OFFSET => 0; + + public AIFiltersArgument(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count > NON_FILTER_FIRST_OFFSET) + { + InitializeFilter(); + } + } + + public void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, List triggerCardList, AISituationInfo situation = null, bool isBlockDeadCard = true) + { + if (triggerCardList != null && triggerCardList.Count > 0) + { + List list = AIFilteringUtility.MultipleFiltering(triggerCardList, Filters, tagOwner, playPtn, situation, isBlockDeadCard); + if (list != null && list.Count > 0) + { + RunMethod(tagOwner, field, playPtn, situation); + } + } + } + + public void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AIVirtualCard triggetCard, AISituationInfo situation = null) + { + if (AIFilteringUtility.CheckMatchTargetFiltering(triggetCard, null, Filters, playPtn, tagOwner, situation)) + { + RunMethod(tagOwner, field, playPtn, situation); + } + } + + protected virtual void RunMethod(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + } + + public virtual List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + List candidateRange = GetCandidateRange(field); + return GetFilteredTargets(candidateRange, owner, playPtn, situation, isBlockDead); + } + + public virtual List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.MultipleFiltering(candidates, Filters, tagOwner, playPtn, situation, isBlockDead); + } + + protected virtual List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothClassAndInplayCards; + } + + protected virtual void InitializeFilter() + { + if (NON_FILTER_FIRST_OFFSET > 0) + { + List range = _exprList.GetRange(0, _exprList.Count - NON_FILTER_FIRST_OFFSET); + Filters = GetFilters(range); + } + else + { + Filters = GetFilters(_exprList); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIFirstMoveBonus.cs b/SVSim.BattleEngine/Engine/Wizard/AIFirstMoveBonus.cs new file mode 100644 index 0000000..4fcec04 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIFirstMoveBonus.cs @@ -0,0 +1,53 @@ +namespace Wizard; + +public class AIFirstMoveBonus : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression valueArg; + + private readonly int BONUS_VALUE_START_INDEX = 1; + + public AIScriptTokenArgType ActionArgType { get; private set; } + + public AIFirstMoveBonus(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count <= BONUS_VALUE_START_INDEX) + { + AIConsoleUtility.LogError($"AIFirstMoveBonus Argument Error!! Arg count is not enough !! [count:{_exprList.Count}]"); + return; + } + for (int i = 0; i < _exprList.Count - BONUS_VALUE_START_INDEX; i++) + { + if (IsLegalArgType(_exprList[i], out var argType)) + { + ActionArgType = argType; + } + else + { + AIConsoleUtility.LogError($"AIFirstMoveBonus ArgType Expression Error!! ArgType [{argType}] is Ilegal!"); + } + } + valueArg = _exprList[_exprList.Count - BONUS_VALUE_START_INDEX]; + } + + public float GetEvaluateValue(AIVirtualCard tagOwner, AISituationInfo situation) + { + return valueArg.EvalArg(tagOwner, EnemyAI.EmptyPlayPtn, tagOwner.SelfField, situation); + } + + private bool IsLegalArgType(AIPolishConvertedExpression arg, out AIScriptTokenArgType argType) + { + argType = GetFirstTokenArgType(arg); + AIScriptTokenArgType aIScriptTokenArgType = argType; + if (aIScriptTokenArgType == AIScriptTokenArgType.ALL || (uint)(aIScriptTokenArgType - 161) <= 1u) + { + return true; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIFunctionResultHashCalculator.cs b/SVSim.BattleEngine/Engine/Wizard/AIFunctionResultHashCalculator.cs new file mode 100644 index 0000000..d347581 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIFunctionResultHashCalculator.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIFunctionResultHashCalculator +{ + private static readonly ulong[] PLAYPTN_HASH_FACTORS = new ulong[11] + { + 251uL, 311uL, 379uL, 283uL, 113uL, 523uL, 269uL, 463uL, 911uL, 661uL, + 541uL + }; + + public static ulong GetHash(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, ulong argumentHash) + { + return 0 + owner.GetHash() + field.GetHash() + CalcPlayPtnHash(playPtn) + argumentHash; + } + + private static ulong CalcPlayPtnHash(List playPtn) + { + ulong num = 0uL; + if (playPtn == null || playPtn.Count <= 0) + { + return num; + } + int num2 = PLAYPTN_HASH_FACTORS.Length; + for (int i = 0; i < playPtn.Count; i++) + { + num += PLAYPTN_HASH_FACTORS[playPtn[i] % num2]; + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIFusion.cs b/SVSim.BattleEngine/Engine/Wizard/AIFusion.cs new file mode 100644 index 0000000..25d9246 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIFusion.cs @@ -0,0 +1,26 @@ +namespace Wizard; + +public class AIFusion : AIFiltersArgument +{ + private AIPolishConvertedExpression _priority; + + private int PRIORITY_INDEX_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => PRIORITY_INDEX_OFFSET; + + public AIFusion(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _priority = _exprList[_exprList.Count - PRIORITY_INDEX_OFFSET]; + } + + public void SetFusionSituationParameter(AIFusionSituationInfo fusion) + { + fusion.SetParameter(base.Filters, _priority); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIFusionDraw.cs b/SVSim.BattleEngine/Engine/Wizard/AIFusionDraw.cs new file mode 100644 index 0000000..3c9fe0a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIFusionDraw.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIFusionDraw : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression _drawCount; + + private const int DRAW_COUNT_ARG_INDEX = 0; + + public AIFusionDraw(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _drawCount = _exprList[0]; + } + + public int GetDrawCount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_drawCount == null) + { + AIConsoleUtility.LogError("AIFusionDraw.GetDrawCount() error!! _drawCount is null"); + return 0; + } + return (int)_drawCount.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIFusionMetamorphose.cs b/SVSim.BattleEngine/Engine/Wizard/AIFusionMetamorphose.cs new file mode 100644 index 0000000..886b9c3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIFusionMetamorphose.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIFusionMetamorphose : AIScriptArgumentExpressions +{ + private int _targetId; + + public AIFusionMetamorphose(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count <= 0 || _exprList.Count > 1) + { + _targetId = -1; + AIConsoleUtility.LogError($"AIFusionMetamorphose(): Arg count is out of range. Please check the value. count:{_exprList.Count}"); + } + else + { + _targetId = _exprList[0].EvalID(); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (situation == null || situation.ActionType != AIOperationType.FUSION) + { + AIConsoleUtility.LogError("AIFusionMetamorphose.Execute(): Situation is not FUSION action type."); + } + else if (_targetId > 0) + { + AIMetamorphoseSimulationUtility.MetamorphoseHandOnVirtualField(situation.Actor, _targetId, tagOwner, field); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIFusionMove.cs b/SVSim.BattleEngine/Engine/Wizard/AIFusionMove.cs new file mode 100644 index 0000000..ad191f5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIFusionMove.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace Wizard; + +internal class AIFusionMove : AIMove +{ + public BattleCardBase Src { get; private set; } + + public List Targets { get; private set; } + + public AIFusionMove(BattleCardBase src, List targets) + : base(AIOperationType.FUSION) + { + Src = src; + Targets = targets; + } + + public override void RunOperation(BattleManagerBase mgr, bool isPlayer) + { + mgr.VfxMgr.RegisterSequentialVfx(mgr.OperateMgr.FusionCard(Src, isPlayer, Targets)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGameStartAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIGameStartAttachTag.cs new file mode 100644 index 0000000..0346d6f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGameStartAttachTag.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIGameStartAttachTag : AIFiltersAndSelectTypeArgument +{ + private AIPlayTag _attachTag; + + private AIScriptTokenArgType _removeTiming; + + private const int REMOVE_TIMING_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIGameStartAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + _removeTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + if (list.Count <= AIPlayTag.TAG_WORDS_LENTGH) + { + AIConsoleUtility.LogError("AIGameStartAttachTag error!! Tag is not completed!!!!!"); + _attachTag = null; + } + else + { + _attachTag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (_attachTag == null) + { + return; + } + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targetsFromField, tagOwner, _attachTag, _removeTiming, situation); + } + else + { + AIConsoleUtility.LogError($"GameStartAttachTag unsupported selectType=={base.SelectType}"); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGenerateTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIGenerateTag.cs new file mode 100644 index 0000000..4856e72 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGenerateTag.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIGenerateTag : AIScriptArgumentExpressions +{ + private List _hashList; + + public AIPlayTag Tag; + + private const int REMOVE_TIMING_ARG_OFFSET = 1; + + public AIScriptTokenArgType RemoveTiming { get; private set; } + + private int HASH_ARG_END_OFFSET => 1; + + public AIGenerateTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + InitExprList(list[0]); + RemoveTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + for (int i = 0; i < _exprList.Count - HASH_ARG_END_OFFSET; i++) + { + if (_exprList[i].TokenList[0] is AIScriptTextToken aIScriptTextToken) + { + _hashList = AIParamQuery.AddElementToList(aIScriptTextToken.Text, _hashList); + } + } + if (list.Count > 3) + { + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + } + + public bool CheckMatchedHashList(List hashDiffList) + { + if (_hashList == null || _hashList.Count <= 0 || hashDiffList == null || hashDiffList.Count <= 0) + { + return false; + } + if (hashDiffList.Count < _hashList.Count) + { + return false; + } + for (int i = 0; i < _hashList.Count; i++) + { + bool flag = false; + for (int j = 0; j < hashDiffList.Count; j++) + { + if (_hashList[i].Equals(hashDiffList[j])) + { + flag = true; + break; + } + } + if (!flag) + { + return false; + } + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGetOffEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIGetOffEvo.cs new file mode 100644 index 0000000..5989a6d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGetOffEvo.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIGetOffEvo : AIFiltersAndSelectTypeArgument +{ + private AIPolishConvertedExpression _tokenId; + + protected override int SELECT_TYPE_OFFSET => 1; + + public AIGetOffEvo(string text) + : base(text) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + AIAutoEvolutionSimulationUtility.AutoEvolution(field, targetsFromField, playPtn, situation, base.SelectType); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGetOffMetamorphose.cs b/SVSim.BattleEngine/Engine/Wizard/AIGetOffMetamorphose.cs new file mode 100644 index 0000000..6b213d1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGetOffMetamorphose.cs @@ -0,0 +1,67 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIGetOffMetamorphose : AIFiltersAndSelectTypeArgument +{ + private AIPolishConvertedExpression _tokenId; + + private const int INVALID_TOKEN_ID = -1; + + private const int TOKEN_ID_ARG_OFFSET = 1; + + private AIScriptTokenArgType _registerSide = AIScriptTokenArgType.BOTH; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIGetOffMetamorphose(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenId = _exprList[_exprList.Count - 1]; + if (IsSideTokenArgType(_exprList[0], out var dstTokenARgType)) + { + _registerSide = dstTokenARgType; + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + int tokenId = GetTokenId(); + if (tokenId != -1) + { + AIMetamorphoseSimulationUtility.MetamorphoseAll(field, targetsFromField, tokenId, tagOwner, situation); + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public int GetTokenId() + { + if (_tokenId == null) + { + AIConsoleUtility.LogError("AIGetOffMetamorphose error!! _tokenId is null"); + return -1; + } + return _tokenId.EvalID(); + } + + protected override AITokenIdCollection CreateRegisterTokenPoolInfo(AIVirtualCard owner, List idList) + { + return AISummonTokenUtility.CreateTokenIdCollectionFromIdList(owner, _registerSide, idList, AITokenType.Default); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGetOn.cs b/SVSim.BattleEngine/Engine/Wizard/AIGetOn.cs new file mode 100644 index 0000000..b6ddac0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGetOn.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIGetOn : AIFiltersArgument +{ + public AIGetOn(string text) + : base(text) + { + } + + public bool CanGetOn(AIVirtualCard tagOwner, AIVirtualCard targetCard, List playPtn, AISituationInfo situation) + { + return AIFilteringUtility.CheckMatchTargetFiltering(targetCard, null, base.Filters, playPtn, tagOwner, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGetOnBanish.cs b/SVSim.BattleEngine/Engine/Wizard/AIGetOnBanish.cs new file mode 100644 index 0000000..0448a8a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGetOnBanish.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIGetOnBanish : AITriggerAndTargetFiltersTagBase +{ + private AIScriptTokenArgType _selectType; + + private const int SELECT_TYPE_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIGetOnBanish(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIPolishConvertedExpression expression = _exprList[_exprList.Count - 1]; + _selectType = AIPlayTagInitializingUtility.CreateSingleArgType(expression, base.LegalSelectTypes); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + switch (_selectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBanishSimulationUtility.BanishAll(targets, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIBanishSimulationUtility.BanishRandom(targets, tagOwner, field, playPtn, situation); + break; + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGetOnDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIGetOnDamage.cs new file mode 100644 index 0000000..780d58b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGetOnDamage.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIGetOnDamage : AITriggerAndTargetFiltersTagBase +{ + private AIPolishConvertedExpression _damageValueArg; + + public AIScriptTokenArgType SelectType; + + private const int DAMAGE_VALUE_ARG_OFFSET = 1; + + private const int SELECT_TYPE_ARG_OFFSET = 2; + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIGetOnDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], base.LegalSelectTypes); + _damageValueArg = _exprList[_exprList.Count - 1]; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + int damageValue = GetDamageValue(tagOwner, field, playPtn, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIDamageSimulationUtility.DamageAll(targets, tagOwner, field, damageValue, situation); + } + } + + private int GetDamageValue(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_damageValueArg == null) + { + return 0; + } + return (int)_damageValueArg.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGetOnEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIGetOnEvo.cs new file mode 100644 index 0000000..9f66280 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGetOnEvo.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIGetOnEvo : AITriggerAndTargetFiltersTagBase +{ + private AIScriptTokenArgType _selectType; + + private const int SELECT_TYPE_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIGetOnEvo(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _selectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1], base.LegalSelectTypes); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + AIAutoEvolutionSimulationUtility.AutoEvolution(field, targets, playPtn, situation, _selectType); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGetOnSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIGetOnSimulationUtility.cs new file mode 100644 index 0000000..c7235eb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGetOnSimulationUtility.cs @@ -0,0 +1,120 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public static class AIGetOnSimulationUtility +{ + public static void RegisterGetOnTokenInPlayPtn(EnemyAI ai) + { + List bestPlayPtn = ai.BestPlayPtn; + AIVirtualField currentVirtualField = ai.CurrentVirtualField; + if (bestPlayPtn == null || bestPlayPtn.Count <= 0 || !currentVirtualField.CardListSet.HasGetOnTagHolders) + { + return; + } + List getOnTagHolders = currentVirtualField.CardListSet.GetOnTagHolders; + bool[] array = new bool[bestPlayPtn.Count]; + if (ai.EnemyAIPlay.BestPlayPtnWithToken == null) + { + AIConsoleUtility.LogError("AIGetOnSimulationUtility.RegisterGetOnTokenInPlayPtn() error!! BestPlayPtnWithToken is null!!"); + return; + } + AISinglePlayptnRecord record = ai.EnemyAIPlay.BestPlayPtnWithToken.Record; + for (int i = 0; i < getOnTagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = getOnTagHolders[i]; + if (!aIVirtualCard.IsOnField) + { + continue; + } + GetOnTagCollection getOnTags = aIVirtualCard.TagCollectionContainer.GetOnTags; + for (int j = 0; j < bestPlayPtn.Count; j++) + { + AIVirtualCard aIVirtualCard2 = currentVirtualField.AllyHandCards[bestPlayPtn[j]]; + AIVirtualCard aIVirtualCard3 = record.FindRealActor(aIVirtualCard2); + if (!array[j] && aIVirtualCard3.IsUnit) + { + AIVirtualTargetSelectAction situation = new AIVirtualTargetSelectAction(aIVirtualCard3, aIVirtualCard2, AIOperationType.PLAY); + if (getOnTags.CanGetOn(aIVirtualCard, aIVirtualCard3, bestPlayPtn, situation)) + { + ai.tokenManager.AddTokenFromId(aIVirtualCard3.BaseId, isAlly: true); + array[j] = true; + break; + } + } + } + } + } + + public static void GetOnAtField(AIVirtualField field, AIVirtualCard summonCard, AISituationInfo situation) + { + if (summonCard == null || !summonCard.IsUnit || !field.CardListSet.HasGetOnTagHolders) + { + return; + } + List getOnTagHolders = field.CardListSet.GetOnTagHolders; + for (int i = 0; i < getOnTagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = getOnTagHolders[i]; + if (aIVirtualCard.TagCollectionContainer.GetOnTags.CanGetOn(aIVirtualCard, summonCard, field.BestPlayPtn, situation)) + { + aIVirtualCard.GetOn(summonCard, situation); + break; + } + } + } + + public static void ExecuteGetOnTriggerTags(AIVirtualCard getOnCard, AIVirtualField field, AISituationInfo situation) + { + if (getOnCard.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenGetOn)) + { + getOnCard.TagCollectionContainer.GetOnTriggerTags.RegisterPassedConditionTags(getOnCard, getOnCard, field.BestPlayPtn, situation); + } + } + + public static AIVirtualCard GetoffTokenOnVirtualField(int getOffId, AIVirtualCard tokenOwner, AIVirtualField field, AISituationInfo situation) + { + AIVirtualCard tokenFromId = field.AI.tokenManager.GetTokenFromId(getOffId, tokenOwner.IsAlly, field, needsClone: true); + if (tokenFromId == null) + { + AIConsoleUtility.LogError("GetoffTokenOnVirtualField: baseTokenCard is null"); + return null; + } + bool flag = false; + if (tokenOwner.IsAlly) + { + if (field.AllyInplayCards.Count((AIVirtualCard card) => !card.IsDead) < 5) + { + tokenFromId.InitAtSummonToken(tokenOwner, situation, isSkillSummon: false); + field.AllyInplayCards.Add(tokenFromId); + field.CardListSet.AddAllyInplayCard(tokenFromId); + field.SummonedCardContainer.AddSummonedCard(tokenFromId); + flag = true; + } + } + else if (field.EnemyInplayCards.Count((AIVirtualCard card) => !card.IsDead) < 5) + { + tokenFromId.InitAtSummonToken(tokenOwner, situation, isSkillSummon: false); + field.EnemyInplayCards.Add(tokenFromId); + field.CardListSet.AddEnemyInplayCard(tokenFromId); + field.EnemyTokenQueue.Enqueue(new Tuple(tokenOwner, tokenFromId)); + field.SummonedCardContainer.AddSummonedCard(tokenFromId); + flag = true; + } + if (flag) + { + ExecuteWhenGetOffTags(tokenOwner, field, EnemyAI.EmptyPlayPtn, situation); + return tokenFromId; + } + return null; + } + + public static void ExecuteWhenGetOffTags(AIVirtualCard tokenOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (tokenOwner.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenGetOff)) + { + tokenOwner.TagCollectionContainer.WhenGetOffTags.RegisterPaasedConditionTags(tokenOwner, field, playPtn, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGiveSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIGiveSkill.cs new file mode 100644 index 0000000..0c5f3dd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGiveSkill.cs @@ -0,0 +1,26 @@ +namespace Wizard; + +public class AIGiveSkill : AIFiltersArgument +{ + private AIScriptTokenArgType _skillType; + + public AIGiveSkill(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIPolishConvertedExpression aIPolishConvertedExpression = _exprList[0]; + if (aIPolishConvertedExpression.TokenList != null && aIPolishConvertedExpression.TokenList.Count > 0 && aIPolishConvertedExpression.TokenList[0] is AIScriptArgumentToken aIScriptArgumentToken) + { + _skillType = aIScriptArgumentToken.ArgumentType; + } + } + + public AIScriptTokenArgType GetSkillType() + { + return _skillType; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGlobalEmptyList.cs b/SVSim.BattleEngine/Engine/Wizard/AIGlobalEmptyList.cs new file mode 100644 index 0000000..274564d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGlobalEmptyList.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIGlobalEmptyList +{ + private static readonly List _emptyVirtualCardList = new List(); + + public static List EmptyVirtualCardList + { + get + { + CheckIsNotEmpty(_emptyVirtualCardList, "EmptyVirtualCardList"); + return _emptyVirtualCardList; + } + } + + private static void CheckIsNotEmpty(List targetList, string listName) + { + if (targetList.Count > 0) + { + targetList.Clear(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIHandPtnCalculator.cs b/SVSim.BattleEngine/Engine/Wizard/AIHandPtnCalculator.cs new file mode 100644 index 0000000..be71901 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIHandPtnCalculator.cs @@ -0,0 +1,145 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public static class AIHandPtnCalculator +{ + public class PriorityComparer : IComparer + { + private EnemyAI _ai; + + private List _playPtn; + + private List _priorityList; + + public PriorityComparer(EnemyAI ai, List playPtn) + { + _ai = ai; + _playPtn = new List(playPtn); + CreatePriorityList(); + } + + public int Compare(int leftIndex, int rightIndex) + { + AIVirtualCard aIVirtualCard = _ai.CurrentVirtualField.AllyHandCards[leftIndex]; + AIVirtualCard aIVirtualCard2 = _ai.CurrentVirtualField.AllyHandCards[rightIndex]; + float num = _priorityList[leftIndex]; + float num2 = _priorityList[rightIndex]; + if (num > num2) + { + return -1; + } + if (num < num2) + { + return 1; + } + int cost = aIVirtualCard.Cost; + int cost2 = aIVirtualCard2.Cost; + if (cost < cost2) + { + return -1; + } + if (cost > cost2) + { + return 1; + } + if (leftIndex >= rightIndex) + { + return 1; + } + return -1; + } + + private void CreatePriorityList() + { + List allyHandCards = _ai.CurrentVirtualField.AllyHandCards; + _priorityList = new List(); + for (int i = 0; i < allyHandCards.Count; i++) + { + AIVirtualCard card = allyHandCards[i]; + _priorityList.Add(card.GetPriority(_playPtn)); + } + } + } + + public static List>> CreateSortedPlayPtnList(EnemyAI ai) + { + List>> list = new List>>(); + int count = ai.CurrentVirtualField.AllyHandCards.Count; + int num = (int)Mathf.Pow(2f, count); + List list2 = new List(); + for (int i = 0; i < num; i++) + { + ConvertHandPtnIndexToList(i, count, list2); + PrioritySortHand(ai, list2); + Tuple> item = new Tuple> + { + first = i, + second = new List(list2) + }; + bool flag = false; + for (int j = 0; j < list.Count; j++) + { + if (list[j].second.Count > list2.Count) + { + flag = true; + list.Insert(j, item); + break; + } + } + if (!flag) + { + list.Add(item); + } + } + return list; + } + + public static void ConvertHandPtnIndexToList(int handPtnIndex, int handCount, List dstList) + { + int num = handPtnIndex; + dstList.Clear(); + for (int i = 0; i < handCount; i++) + { + int num2 = (int)Mathf.Pow(2f, handCount - i - 1); + if (num / num2 > 0) + { + num -= num2; + dstList.Add(i); + } + } + } + + public static int ConvertPlayPtnToHandPtnIndex(List playPtn, int handNum) + { + int num = 0; + for (int i = 0; i < playPtn.Count; i++) + { + int num2 = (int)Mathf.Pow(2f, handNum - playPtn[i] - 1); + num += num2; + } + return num; + } + + public static void PrioritySortHand(EnemyAI ai, List handList) + { + IComparer comparer = new PriorityComparer(ai, handList); + handList.Sort(comparer); + } + + public static ulong CalculatePlayPtnHash(AIVirtualField field, List playPtn) + { + if (playPtn == null || playPtn.Count <= 0) + { + return 0uL; + } + ulong num = 0uL; + for (int i = 0; i < playPtn.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyHandCards[playPtn[i]]; + num += (ulong)((long)aIVirtualCard.GetHash() * (long)(i + 1)); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIHealAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIHealAttachTag.cs new file mode 100644 index 0000000..cc56f70 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIHealAttachTag.cs @@ -0,0 +1,98 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIHealAttachTag : AITriggerAndTargetFiltersTagBase +{ + private AIPolishConvertedExpression _selectCountArg; + + private const int SELECT_TYPE_ARG_OFFSET = 3; + + private const int SELECT_COUNT_ARG_OFFSET = 2; + + private const int REMOVE_TIMING_ARG_OFFSET = 1; + + public AIPlayTag Tag { get; private set; } + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIScriptTokenArgType RemoveTiming { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 3; + + public AIHealAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 3], base.LegalSelectTypes); + _selectCountArg = _exprList[_exprList.Count - 2]; + RemoveTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + if (list.Count <= AIPlayTag.TAG_WORDS_LENTGH) + { + Tag = null; + } + else + { + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.RANDOM_MULTI_SELECT + }; + } + + private int GetSelectCount(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (_selectCountArg == null) + { + return 0; + } + return (int)_selectCountArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + switch (SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targets, tagOwner, Tag, RemoveTiming, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + int selectCount = GetSelectCount(tagOwner, playPtn, situation); + AIDefaultSelectLogicArgument selectLogic = new AIDefaultSelectLogicArgument(null); + AIAttachTagSimulationUtility.SimulateRandomSelectAttachTag(targets, selectCount, tagOwner, field, playPtn, situation, Tag, RemoveTiming, selectLogic); + break; + } + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (Tag != null) + { + return Tag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIHealBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIHealBuff.cs new file mode 100644 index 0000000..1be4846 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIHealBuff.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIHealBuff : AITriggerAndTargetFiltersTagBase +{ + private const int LIFE_OFFSET = 1; + + private const int ATTACK_OFFSET = 2; + + private const int SELECT_TYPE_OFFSET = 3; + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIPolishConvertedExpression Attack { get; private set; } + + public AIPolishConvertedExpression Life { get; private set; } + + public AIHealBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIPolishConvertedExpression arg = _exprList[_exprList.Count - 3]; + AIScriptTokenArgType selectType = AIScriptTokenArgType.NONE; + if (!IsLegalSelectType(arg, out selectType)) + { + SelectType = AIScriptTokenArgType.ALL_SELECT; + } + else + { + SelectType = selectType; + } + Attack = _exprList[_exprList.Count - 2]; + Life = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, Attack, Life); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBuffSimulationUtility.BuffAll_old(targets, field, buffExecutingInfo_old, isTemp: false, playPtn, situation); + } + else if (SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIBuffSimulationUtility.BuffRandom_old(targets, field, playPtn, situation, buffExecutingInfo_old, isTemp: false); + } + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool isAttackEffective = !Attack.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIHealDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIHealDamage.cs new file mode 100644 index 0000000..1e75d08 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIHealDamage.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIHealDamage : AITriggerAndTargetFiltersTagBase +{ + private const int DAMAGE_OFFSET = 1; + + private const int SELECT_TYPE_OFFSET = 2; + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIPolishConvertedExpression Damage { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIHealDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIPolishConvertedExpression arg = _exprList[_exprList.Count - 2]; + AIScriptTokenArgType selectType = AIScriptTokenArgType.NONE; + if (!IsLegalSelectType(arg, out selectType)) + { + SelectType = AIScriptTokenArgType.ALL_SELECT; + } + else + { + SelectType = selectType; + } + Damage = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + int damage = (int)Damage.EvalArg(tagOwner, playPtn, field, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIDamageSimulationUtility.DamageAll(targets, tagOwner, field, damage, situation); + } + else if (SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIDamageSimulationUtility.DamageRandom(targets, tagOwner, field, damage, situation); + } + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIHealEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIHealEvo.cs new file mode 100644 index 0000000..65d8bc6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIHealEvo.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIHealEvo : AITriggerAndTargetFiltersTagBase +{ + public AIHealEvo(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets == null || targets.Count <= 0) + { + return; + } + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard card = targets[i]; + if (tagOwner.IsSameCard(card) && !tagOwner.IsEvolution) + { + AIAutoEvolutionSimulationUtility.AutoEvolveSingle(tagOwner, field, situation); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIHealHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIHealHeal.cs new file mode 100644 index 0000000..07fc506 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIHealHeal.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIHealHeal : AITriggerAndTargetFiltersTagBase +{ + private AIPolishConvertedExpression _healValue; + + private const int SELECT_TYPE_ARG_OFFSET = 2; + + private const int HEAL_VALUE_ARG_OFFSET = 1; + + public AIScriptTokenArgType SelectType { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIHealHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], base.LegalSelectTypes); + _healValue = _exprList[_exprList.Count - 1]; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + int heal = (int)_healValue.EvalArg(tagOwner, playPtn, field, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targets, field, heal, playPtn, situation); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIHealToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIHealToken.cs new file mode 100644 index 0000000..767bab4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIHealToken.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIHealToken : AITriggerAndTargetFiltersTagBase +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_INDEX_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIHealToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + AISummonTokenUtility.ExecuteSummonToken(targets, base.TargetFilters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override List GetTargets(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return GetCandidateRange(field); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIInstantAttackUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIInstantAttackUtility.cs new file mode 100644 index 0000000..3c58c52 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIInstantAttackUtility.cs @@ -0,0 +1,391 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public static class AIInstantAttackUtility +{ + public static float EvalInstantAttack(int attack, int life, int count, List playPtn, AIVirtualCard owner, AISituationInfo situation, bool isRush = false) + { + AIVirtualField selfField = owner.SelfField; + if (selfField.IsNoInstantAttack) + { + return 0f; + } + AIFunctionResultContainer funcResultContainer = selfField.AI.FuncResultContainer; + AIScriptTokenFuncType funcType = (isRush ? AIScriptTokenFuncType.EVAL_RUSH : AIScriptTokenFuncType.EVAL_INSTANT_ATTACK); + ulong hash = AIFunctionResultHashCalculator.GetHash(owner, selfField, playPtn, null, GetArgumentHash(attack, life, count)); + if (funcResultContainer.GetContainsResultValue(funcType, hash, out var getResult)) + { + return getResult; + } + List list = selfField.CardListSet.EnemyClassAndInplayCards.FindAll((AIVirtualCard c) => c.IsUnit && !c.IsCantUnderAnyAttack()); + Dictionary savedEvaluations = CacheCardsEvaluation(list, playPtn, situation); + Dictionary savedBreakBonus = CacheCardsBreakBonus(list); + Dictionary savedLeaveBonus = CachedCardsLeaveBonus(list); + int count2 = list.Count; + List list2 = new List(); + List list3 = new List(); + for (int num = 0; num < count2; num++) + { + AIVirtualCard aIVirtualCard = list[num]; + if (aIVirtualCard.IsGuard) + { + list2.Add(aIVirtualCard); + } + else + { + list3.Add(aIVirtualCard); + } + } + int count3 = list2.Count; + int count4 = list3.Count; + AIVirtualCard aIVirtualCard2 = CreateDummyAttacker(selfField, owner, attack, life, count, isRush); + float num2 = 0f; + if (count3 > 0) + { + int num3 = (int)Mathf.Pow(2f, count3) - 1; + bool isAllGuardDestroyed = false; + float num4 = EvalInstantAttackToCertainBreakOrLeavePattern(aIVirtualCard2, list2, selfField, num3, playPtn, ref isAllGuardDestroyed, savedEvaluations, savedBreakBonus, savedLeaveBonus); + if (!isAllGuardDestroyed) + { + float num5 = 0f; + for (int num6 = num3 - 1; num6 >= 0; num6--) + { + aIVirtualCard2.AttackableCount = count; + aIVirtualCard2.Life = life; + aIVirtualCard2.Attack = attack; + float num7 = EvalInstantAttackToCertainBreakOrLeavePattern(aIVirtualCard2, list2, selfField, num6, playPtn, ref isAllGuardDestroyed, savedEvaluations, savedBreakBonus, savedLeaveBonus); + if (num7 > num5) + { + num5 = num7; + } + } + if (num5 == 0f) + { + num5 = EvalInstantAttackAgainstFollower(list2, owner, selfField, playPtn, aIVirtualCard2); + } + funcResultContainer.AddRecord(funcType, hash, num5); + RemoveDummyCardFromField(selfField); + return num5; + } + num2 = num4; + count = aIVirtualCard2.AttackableCount; + attack = aIVirtualCard2.Attack; + life = aIVirtualCard2.Life; + } + if (count > 0) + { + int num8 = (int)Mathf.Pow(2f, count4); + float num9 = 0f; + for (int num10 = 0; num10 < num8; num10++) + { + aIVirtualCard2.AttackableCount = count; + aIVirtualCard2.Attack = attack; + aIVirtualCard2.Life = life; + bool isAllGuardDestroyed2 = true; + float num11 = EvalInstantAttackToCertainBreakOrLeavePattern(aIVirtualCard2, list3, selfField, num10, playPtn, ref isAllGuardDestroyed2, savedEvaluations, savedBreakBonus, savedLeaveBonus); + if (isRush) + { + if (num11 > num9) + { + num9 = num11; + } + continue; + } + float num12 = num11 + EvalInstantAttackAgainstLeader(aIVirtualCard2, playPtn); + if (num12 > num9) + { + num9 = num12; + } + } + num2 += num9; + } + funcResultContainer.AddRecord(funcType, hash, num2); + RemoveDummyCardFromField(selfField); + return num2; + } + + private static float EvalInstantAttackAgainstFollower(List targetCards, AIVirtualCard owner, AIVirtualField field, List playPtn, AIVirtualCard attacker) + { + float num = 0f; + int num2 = attacker.AttackableCount; + int attack = attacker.Attack; + int num3 = attacker.Life; + for (int i = 0; i < targetCards.Count; i++) + { + AIVirtualCard aIVirtualCard = targetCards[i]; + AIVirtualAttackInfo aIVirtualAttackInfo = new AIVirtualAttackInfo(attacker, aIVirtualCard); + EvalInstantAttackInformation evalInstantAttackInformation = new EvalInstantAttackInformation(aIVirtualAttackInfo); + aIVirtualAttackInfo.PseudoSimulateForEvalInstantAttack(field, playPtn, evalInstantAttackInformation); + if (evalInstantAttackInformation.IsAttackerDestroyWhenAttack) + { + continue; + } + int targetLifeBuff = evalInstantAttackInformation.TargetLifeBuff; + int attackerAttackBuff = evalInstantAttackInformation.AttackerAttackBuff; + int attackerLifeBuff = evalInstantAttackInformation.AttackerLifeBuff; + AIBarrierPseudoSimulationInfo targetBarrierInfo = evalInstantAttackInformation.TargetBarrierInfo; + int damage = aIVirtualCard.SimulateDamageShield(attack + attackerAttackBuff); + damage = targetBarrierInfo.SimulateDamageAmount(damage, isSpellDamage: false, isSkillDamage: false); + float num4 = 0f; + int attackerTotalDamage = evalInstantAttackInformation.AttackerTotalDamage; + while (num2 > 0) + { + num3 += attackerLifeBuff - attackerTotalDamage; + if (num3 <= 0) + { + break; + } + damage -= targetLifeBuff; + num4 += (float)damage; + num2--; + } + if (num4 > num) + { + num = num4; + } + } + attacker.AttackableCount = num2; + attacker.Life = num3; + attacker.Attack = attack; + return num; + } + + private static float EvalInstantAttackAgainstLeader(AIVirtualCard dummyAttacker, List playPtn) + { + if (dummyAttacker.Life <= 0 || dummyAttacker.AttackableCount <= 0) + { + return 0f; + } + AIVirtualAttackInfo attackLeaderSituation = dummyAttacker.AttackLeaderSituation; + AIVirtualCard attackTarget = attackLeaderSituation.AttackTarget; + AIVirtualField selfField = dummyAttacker.SelfField; + if (attackLeaderSituation == null) + { + AIConsoleUtility.LogError("EvalInstantAttackAgainstLeader(): Leader attack situation is null!!"); + return 0f; + } + int num = attackTarget.Life; + for (int i = 0; i < dummyAttacker.AttackableCount; i++) + { + EvalInstantAttackInformation evalInstantAttackInformation = new EvalInstantAttackInformation(attackLeaderSituation); + attackLeaderSituation.PseudoSimulateForEvalInstantAttack(selfField, playPtn, evalInstantAttackInformation); + int targetLifeBuff = evalInstantAttackInformation.TargetLifeBuff; + int attackerAttackBuff = evalInstantAttackInformation.AttackerAttackBuff; + int attackerLifeBuff = evalInstantAttackInformation.AttackerLifeBuff; + int attackerTotalDamage = evalInstantAttackInformation.AttackerTotalDamage; + AIBarrierPseudoSimulationInfo targetBarrierInfo = evalInstantAttackInformation.TargetBarrierInfo; + int damage = attackTarget.SimulateDamageShield(dummyAttacker.Attack + attackerAttackBuff); + damage = targetBarrierInfo.SimulateDamageAmount(damage, isSpellDamage: false, isSkillDamage: false); + dummyAttacker.Life += attackerLifeBuff - attackerTotalDamage; + if (dummyAttacker.Life <= 0) + { + break; + } + damage -= targetLifeBuff; + num -= damage; + if (num <= 0) + { + break; + } + } + return AILeaderLifeEvaluationUtility.Evaluate(num, attackTarget.Life, attackTarget.IsAlly, dummyAttacker.IsAlly); + } + + private static Dictionary CacheCardsEvaluation(List targets, List playPtn, AISituationInfo situation, bool useStyle = true) + { + Dictionary dictionary = new Dictionary(); + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + float value = aIVirtualCard.EvaluateValueOnField(playPtn, situation, useStyle: true); + try + { + dictionary.Add(aIVirtualCard.CardIndex, value); + } + catch (ArgumentException) + { + } + } + return dictionary; + } + + private static Dictionary CacheCardsBreakBonus(List targets) + { + Dictionary dictionary = new Dictionary(); + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + float value = aIVirtualCard.EvaluateBreakValue(EnemyAI.EmptyPlayPtn, useIgnoreBreak: false); + try + { + dictionary.Add(aIVirtualCard.CardIndex, value); + } + catch (ArgumentException) + { + } + } + return dictionary; + } + + private static Dictionary CachedCardsLeaveBonus(List targets) + { + Dictionary dictionary = new Dictionary(); + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + float value = aIVirtualCard.EvaluateLeaveValue(EnemyAI.EmptyPlayPtn, useIgnoreInBattle: true); + try + { + dictionary.Add(aIVirtualCard.CardIndex, value); + } + catch (ArgumentException) + { + } + } + return dictionary; + } + + private static float EvalInstantAttackToCertainBreakOrLeavePattern(AIVirtualCard attacker, List targetCards, AIVirtualField field, int breakPtnIndex, List playPtn, ref bool isAllGuardDestroyed, Dictionary savedEvaluations, Dictionary savedBreakBonus, Dictionary savedLeaveBonus) + { + float num = 0f; + List list = new List(); + List list2 = new List(); + int count = targetCards.Count; + for (int i = 0; i < count; i++) + { + int num2 = (int)Mathf.Pow(2f, count - i - 1); + if (breakPtnIndex / num2 <= 0) + { + list.Add(i); + continue; + } + list2.Add(i); + breakPtnIndex -= num2; + } + int count2 = list2.Count; + int num3 = attacker.AttackableCount; + int attack = attacker.Attack; + int num4 = attacker.Life; + for (int j = 0; j < count2; j++) + { + if (num3 <= 0) + { + break; + } + if (num4 <= 0) + { + break; + } + int index = list2[j]; + AIVirtualCard aIVirtualCard = targetCards[index]; + AIVirtualAttackInfo aIVirtualAttackInfo = new AIVirtualAttackInfo(attacker, aIVirtualCard); + EvalInstantAttackInformation evalInstantAttackInformation = new EvalInstantAttackInformation(aIVirtualAttackInfo); + aIVirtualAttackInfo.PseudoSimulateForEvalInstantAttack(field, playPtn, evalInstantAttackInformation); + if (evalInstantAttackInformation.IsAttackerDestroyWhenAttack) + { + continue; + } + int num5 = aIVirtualCard.Life; + int targetLifeBuff = evalInstantAttackInformation.TargetLifeBuff; + int attackerAttackBuff = evalInstantAttackInformation.AttackerAttackBuff; + int attackerLifeBuff = evalInstantAttackInformation.AttackerLifeBuff; + AIBarrierPseudoSimulationInfo targetBarrierInfo = evalInstantAttackInformation.TargetBarrierInfo; + int damage = aIVirtualCard.SimulateDamageShield(attack + attackerAttackBuff); + damage = targetBarrierInfo.SimulateDamageAmount(damage, isSpellDamage: false, isSkillDamage: false); + int attackerTotalDamage = evalInstantAttackInformation.AttackerTotalDamage; + while (num5 > 0 && num3 > 0) + { + num4 += attackerLifeBuff - attackerTotalDamage; + if (num4 <= 0) + { + break; + } + num5 += targetLifeBuff; + num5 -= damage; + num3--; + if (num5 <= 0) + { + savedEvaluations.TryGetValue(aIVirtualCard.CardIndex, out var value); + savedBreakBonus.TryGetValue(aIVirtualCard.CardIndex, out var value2); + savedLeaveBonus.TryGetValue(aIVirtualCard.CardIndex, out var value3); + num += value - value2 - value3; + isAllGuardDestroyed = j == count2 - 1; + } + } + attacker.AttackableCount = num3; + attacker.Life = num4; + attacker.Attack = attack; + } + return num; + } + + public static AIVirtualCard CreateDummyAttacker(AIVirtualField field, AIVirtualCard owner, int attack, int life, int attackableCount, bool isEvalRush) + { + AIVirtualCardParameter baseParameter = new AIVirtualCardParameter(attack, life, attackableCount); + AIVirtualCard aIVirtualCard = new AIVirtualCard(field, baseParameter, owner, isEvalRush); + if (aIVirtualCard.IsAlly) + { + field.AllyInplayCards.Add(aIVirtualCard); + field.CardListSet.AddAllyInplayCard(aIVirtualCard); + } + else + { + field.EnemyInplayCards.Add(aIVirtualCard); + field.CardListSet.AddEnemyInplayCard(aIVirtualCard); + } + return aIVirtualCard; + } + + public static void RemoveDummyCardFromField(AIVirtualField field) + { + List list = null; + for (int i = 0; i < field.AllyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyInplayCards[i]; + if (IsDummyCard(aIVirtualCard)) + { + list = AIParamQuery.AddElementToList(aIVirtualCard, list); + } + } + if (list != null && list.Count > 0) + { + for (int j = 0; j < list.Count; j++) + { + AIVirtualCard aIVirtualCard2 = list[j]; + field.AllyInplayCards.Remove(aIVirtualCard2); + field.CardListSet.RemoveAllyInplayCard(aIVirtualCard2); + } + } + List list2 = null; + for (int k = 0; k < field.EnemyInplayCards.Count; k++) + { + AIVirtualCard aIVirtualCard3 = field.EnemyInplayCards[k]; + if (IsDummyCard(aIVirtualCard3)) + { + list2 = AIParamQuery.AddElementToList(aIVirtualCard3, list2); + } + } + if (list2 != null && list2.Count > 0) + { + for (int l = 0; l < list2.Count; l++) + { + AIVirtualCard aIVirtualCard4 = list2[l]; + field.EnemyInplayCards.Remove(aIVirtualCard4); + field.CardListSet.RemoveEnemyInplayCard(aIVirtualCard4); + } + } + } + + private static bool IsDummyCard(AIVirtualCard card) + { + return card.CardParameter.CardName == "Dummy"; + } + + private static ulong GetArgumentHash(int damage, int life, int count) + { + return (ulong)(0 + (long)damage * 53L + (long)life * 3L + (long)count * 313L); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordAddCemetery.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordAddCemetery.cs new file mode 100644 index 0000000..332d3b7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordAddCemetery.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordAddCemetery : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression _addCount; + + private readonly int COUNT_ARG_INDEX; + + public AILastwordAddCemetery(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _addCount = _exprList[COUNT_ARG_INDEX]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + int count = (int)_addCount.EvalArg(tagOwner, playPtn, field, situation); + field.VirtualCemetery.AddCemetery(count, tagOwner.IsAlly); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordAddDeck.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordAddDeck.cs new file mode 100644 index 0000000..33ef883 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordAddDeck.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordAddDeck : AIScriptArgumentExpressions +{ + private AIScriptIDToken _cardIdToken; + + private AIPolishConvertedExpression _addCountExpression; + + private const int ADD_CARD_ID_ARG_INDEX = 0; + + private const int ADD_COUNT_ARG_INDEX = 1; + + public AILastwordAddDeck(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _cardIdToken = _exprList[0].TokenList[0] as AIScriptIDToken; + _addCountExpression = _exprList[1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + int tokenCount = (int)_addCountExpression.EvalArg(tagOwner, playPtn, field, situation); + field.AddDeckCard(_cardIdToken.ID, tokenCount, tagOwner, playPtn, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordAttachTag.cs new file mode 100644 index 0000000..5ed2c47 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordAttachTag.cs @@ -0,0 +1,77 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordAttachTag : AIFiltersArgument +{ + private const int SELECT_TYPE_OFFSET = 2; + + private const int TIMING_OFFSET = 1; + + public AIPlayTag Tag { get; private set; } + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIScriptTokenArgType RemoveTiming { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AILastwordAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], base.LegalSelectTypes); + RemoveTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + if (list.Count <= AIPlayTag.TAG_WORDS_LENTGH) + { + Tag = null; + } + else + { + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targetsFromField, tagOwner, Tag, RemoveTiming, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + AIDefaultSelectLogicArgument selectLogic = new AIDefaultSelectLogicArgument(null); + AIAttachTagSimulationUtility.SimulateRandomSelectAttachTag(targetsFromField, 1, tagOwner, field, playPtn, situation, Tag, RemoveTiming, selectLogic); + break; + } + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (Tag != null) + { + return Tag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordBanish.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordBanish.cs new file mode 100644 index 0000000..819123b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordBanish.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordBanish : AIFiltersAndSelectTypeArgument +{ + public AILastwordBanish(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBanishSimulationUtility.BanishAll(targetsFromField, situation); + } + else if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIBanishSimulationUtility.BanishRandom(targetsFromField, tagOwner, field, playPtn, situation); + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordBuff.cs new file mode 100644 index 0000000..4f1f6b3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordBuff.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordBuff : AIFiltersAndSelectTypeArgument +{ + private const int LIFE_OFFSET = 1; + + private const int ATTACK_OFFSET = 2; + + public AIPolishConvertedExpression Attack { get; private set; } + + public AIPolishConvertedExpression Life { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 3; + + public AILastwordBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Attack = _exprList[_exprList.Count - 2]; + Life = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, Attack, Life); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBuffSimulationUtility.BuffAll_old(targetsFromField, field, buffExecutingInfo_old, isTemp: false, playPtn, situation); + } + else if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIBuffSimulationUtility.BuffRandom_old(targetsFromField, field, playPtn, situation, buffExecutingInfo_old, isTemp: false); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool isAttackEffective = !Attack.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordDamage.cs new file mode 100644 index 0000000..5a2edde --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordDamage.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordDamage : AIFiltersAndSelectTypeArgument +{ + private readonly int DAMAGE_ARG_OFFSET = 1; + + public AIPolishConvertedExpression Damage { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AILastwordDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Damage = _exprList[_exprList.Count - DAMAGE_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int damage = (int)Damage.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, damage, situation); + } + else if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, damage, situation); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordDamageClip.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordDamageClip.cs new file mode 100644 index 0000000..438e199 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordDamageClip.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordDamageClip : AIFiltersAndSelectTypeArgument +{ + private AIScriptTokenArgType _stopTiming; + + private AIScriptTokenArgType _damageType; + + private AIPolishConvertedExpression _clipAmount; + + private const int CLIP_AMOUNT_OFFSET = 1; + + private const int STOP_TIMING_OFFSET = 2; + + private const int DEFAULT_DAMAGE_TYPE_OFFSET = 3; + + protected bool _isDamageTypeDefinedByMaster; + + protected override int SELECT_TYPE_OFFSET => 1 + (_isDamageTypeDefinedByMaster ? 3 : 2); + + public AILastwordDamageClip(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _clipAmount = _exprList[_exprList.Count - 1]; + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - 3], out _isDamageTypeDefinedByMaster); + InitSelectType(); + InitializeFilter(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int clipAmount = (int)_clipAmount.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBarrierSimulationUtility.AddDamageClipToAll(targetsFromField, tagOwner, field, _damageType, _stopTiming, clipAmount); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordDestroy.cs new file mode 100644 index 0000000..4374cb8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordDestroy.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordDestroy : AIFiltersAndSelectTypeArgument +{ + public AILastwordDestroy(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, null); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.DestroyAll(targetsFromField, field, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AISkillSimulationUtility.DestroyRandom(targetsFromField, tagOwner, field, playPtn, situation); + break; + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordDraw.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordDraw.cs new file mode 100644 index 0000000..610b219 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordDraw.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordDraw : AIScriptArgumentExpressions +{ + private const int COUNT_ARG_INDEX = 1; + + public AIPolishConvertedExpression DrawCount { get; private set; } + + public AILastwordDraw(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + DrawCount = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (DrawCount != null) + { + int drawCount = (int)DrawCount.EvalArg(tagOwner, playPtn, field, situation); + tagOwner.SelfField.DrawCard(tagOwner.IsAlly, drawCount, playPtn, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordEvo.cs new file mode 100644 index 0000000..8745076 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordEvo.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordEvo : AIFiltersAndSelectTypeArgument +{ + public AILastwordEvo(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIScriptTokenArgType selectType = base.SelectType; + if ((uint)(selectType - 126) <= 1u) + { + AIAutoEvolutionSimulationUtility.AutoEvolution(field, targetsFromField, playPtn, situation, base.SelectType); + } + else + { + AIConsoleUtility.LogError("AILastwordEvo.Execute error!! SelectType == " + base.SelectType); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordHeal.cs new file mode 100644 index 0000000..bb4a99e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordHeal.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordHeal : AIFiltersAndSelectTypeArgument +{ + private readonly int HEAL_ARG_OFFSET = 1; + + public AIPolishConvertedExpression Heal { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AILastwordHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Heal = _exprList[_exprList.Count - HEAL_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int heal = (int)Heal.EvalArg(tagOwner, playPtn, field); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targetsFromField, field, heal, playPtn, situation); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordMetamorphose.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordMetamorphose.cs new file mode 100644 index 0000000..1e4db0e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordMetamorphose.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordMetamorphose : AIFiltersAndSelectTypeArgument +{ + private readonly int METAMORPHOSE_ID_ARG_OFFSET = 1; + + public AIScriptTokenArgType SideType { get; protected set; } + + public AIPolishConvertedExpression MetamorphoseID { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AILastwordMetamorphose(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + MetamorphoseID = _exprList[_exprList.Count - METAMORPHOSE_ID_ARG_OFFSET]; + AIPolishConvertedExpression arg = _exprList[0]; + AIScriptTokenArgType dstTokenARgType = AIScriptTokenArgType.NONE; + if (IsSideTokenArgType(arg, out dstTokenARgType)) + { + SideType = dstTokenARgType; + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int metamorphoseId = MetamorphoseID.EvalID(); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIMetamorphoseSimulationUtility.MetamorphoseAll(field, targetsFromField, metamorphoseId, tagOwner, situation); + } + else if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIMetamorphoseSimulationUtility.MetamorphoseRandom(field, targetsFromField, metamorphoseId, tagOwner, playPtn, situation); + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override AITokenIdCollection CreateRegisterTokenPoolInfo(AIVirtualCard owner, List idList) + { + return AISummonTokenUtility.CreateTokenIdCollectionFromIdList(owner, SideType, idList, AITokenType.Default); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordReanimate.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordReanimate.cs new file mode 100644 index 0000000..9bc45e6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordReanimate.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordReanimate : AIFiltersArgument +{ + private AIPolishConvertedExpression _costArgument; + + public AIScriptTokenArgType TokenSide; + + private const int SIDE_OFFSET = 1; + + private const int REANIMATE_COST_ARG_OFFSET = 2; + + private int _ommittedIndexOffset; + + private int _realNonFilterFirstOffset; + + protected override int NON_FILTER_FIRST_OFFSET => _realNonFilterFirstOffset; + + public AILastwordReanimate(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + InitializeSide(); + _costArgument = _exprList[_exprList.Count - (2 - _ommittedIndexOffset)]; + _realNonFilterFirstOffset = 2 - _ommittedIndexOffset; + InitializeFilter(); + } + + private void InitializeSide() + { + if (AIPlayTagInitializingUtility.TryCreateTokenSideType(_exprList[_exprList.Count - 1], out var sideType)) + { + _ommittedIndexOffset = 0; + TokenSide = sideType; + } + else + { + _ommittedIndexOffset = 1; + TokenSide = AIScriptTokenArgType.ALLY; + } + } + + protected override void InitializeFilter() + { + base.Filters = new List(); + int num = _exprList.Count - NON_FILTER_FIRST_OFFSET; + if (num > 0) + { + List range = _exprList.GetRange(0, num); + base.Filters = GetFilters(range); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + bool isTokenAlly; + int reanimateTokenId = AIReanimateSimulationUtility.GetReanimateTokenId(tagOwner, field, playPtn, situation, base.Filters, _costArgument, TokenSide, out isTokenAlly); + if (reanimateTokenId != -1) + { + AISummonTokenUtility.CreateTokenIdCollectionForReanimate(tagOwner, reanimateTokenId, isTokenAlly).SummonAllTokenToField(field, tagOwner, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordRemoveSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordRemoveSkill.cs new file mode 100644 index 0000000..30dcc96 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordRemoveSkill.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordRemoveSkill : AIFiltersAndSelectTypeArgument +{ + public AILastwordRemoveSkill(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIRemoveSkillSimulationUtility.RemoveSkillAll(targetsFromField, situation); + } + else + { + AIConsoleUtility.LogError("AILastwordRemoveSkill : ๆœชๅฏพๅฟœใฎSelectTypeใŒไฝฟ็”จใ•ใ‚Œใฆใ„ใพใ™"); + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordSetStatus.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordSetStatus.cs new file mode 100644 index 0000000..ef5230c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordSetStatus.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordSetStatus : AIFiltersAndSelectTypeArgument +{ + private AIPolishConvertedExpression _attackArgument; + + private AIPolishConvertedExpression _lifeArgument; + + private readonly int ATTACK_ARG_OFFSET = 2; + + private readonly int LIFE_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 3; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AILastwordSetStatus(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _attackArgument = _exprList[_exprList.Count - ATTACK_ARG_OFFSET]; + _lifeArgument = _exprList[_exprList.Count - LIFE_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int attack = (int)_attackArgument.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + int life = (int)_lifeArgument.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.SetStatusAll(targetsFromField, attack, life, situation); + } + else + { + AIConsoleUtility.LogError("AILastwordSetStatus Error!! SelecyType " + base.SelectType.ToString() + " is illegal!!!!!"); + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordShield.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordShield.cs new file mode 100644 index 0000000..6793fbe --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordShield.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordShield : AIFiltersAndSelectTypeArgument +{ + private AIScriptTokenArgType _stopTiming; + + private AIScriptTokenArgType _damageType; + + private const int STOP_TIMING_OFFSET = 1; + + private const int DEFAULT_DAMAGE_TYPE_OFFSET = 2; + + protected bool _isDamageTypeDefinedByMaster; + + protected override int SELECT_TYPE_OFFSET => 1 + ((!_isDamageTypeDefinedByMaster) ? 1 : 2); + + public AILastwordShield(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - 2], out _isDamageTypeDefinedByMaster); + InitSelectType(); + InitializeFilter(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBarrierSimulationUtility.AddShieldToAll(targetsFromField, tagOwner, field, _damageType, _stopTiming); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordSubtractCountdown.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordSubtractCountdown.cs new file mode 100644 index 0000000..37e2edd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordSubtractCountdown.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordSubtractCountdown : AIFiltersAndSelectTypeArgument +{ + private readonly int SUBTRACT_ARG_OFFSET = 1; + + public AIPolishConvertedExpression SubtractValue { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AILastwordSubtractCountdown(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + SubtractValue = _exprList[_exprList.Count - SUBTRACT_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int value = (int)SubtractValue.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISubtractCountdownSimulationUtility.SubtractCountdownAll(targetsFromField, value, situation); + } + else + { + AIConsoleUtility.LogError($"AILastwordSubtractCountdown.Execute(): Unsupported select type. type:{base.SelectType}"); + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForCountdownAmuletOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILastwordToken.cs b/SVSim.BattleEngine/Engine/Wizard/AILastwordToken.cs new file mode 100644 index 0000000..2895c43 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILastwordToken.cs @@ -0,0 +1,89 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILastwordToken : AIFiltersArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private AIScriptTokenArgType _tokenSide; + + private const int DEFAULT_TOKEN_COUNT_INDEX_OFFSET = 2; + + private const int TOKEN_SIDE_INDEX_OFFSET = 1; + + private int _realTokenCountIndexOffset; + + protected override int NON_FILTER_FIRST_OFFSET => _realTokenCountIndexOffset; + + public AILastwordToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + bool flag = InitializeTokenSide(); + _realTokenCountIndexOffset = 2 - ((!flag) ? 1 : 0); + InitializeFilter(); + _tokenCount = _exprList[_exprList.Count - _realTokenCountIndexOffset]; + } + + private bool InitializeTokenSide() + { + if (AIPlayTagInitializingUtility.TryCreateTokenSideType(_exprList[_exprList.Count - 1], out var sideType)) + { + _tokenSide = sideType; + return true; + } + _tokenSide = AIScriptTokenArgType.ALLY; + return false; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + int num = (int)_tokenCount.EvalArg(tagOwner, playPtn, field); + if (num > 0) + { + AITokenIdCollection bothSideTokenIdListFromFilter = AISummonTokenUtility.GetBothSideTokenIdListFromFilter(tagOwner, field, targetsFromField, base.Filters, AITokenType.Default, _tokenSide, AIScriptTokenArgType.ALL_SELECT, num, playPtn, situation); + if (bothSideTokenIdListFromFilter != null && bothSideTokenIdListFromFilter.HasToken) + { + List condList = null; + bothSideTokenIdListFromFilter.SummonAllTokenToField(field, tagOwner, situation, condList); + } + } + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public AITokenIdCollection GetBothSideTokenIds(AIVirtualCard tagOwner, List playPtn, AIVirtualField field) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, null, isBlockDead: false); + int num = (int)_tokenCount.EvalArg(tagOwner, playPtn, field); + if (num <= 0) + { + return null; + } + return AISummonTokenUtility.GetBothSideTokenIdListFromFilter(tagOwner, field, targetsFromField, base.Filters, AITokenType.Default, _tokenSide, AIScriptTokenArgType.ALL_SELECT, num, playPtn, null); + } + + public AIScriptTokenArgType GetTokenSide() + { + return _tokenSide; + } + + protected override AITokenIdCollection CreateRegisterTokenPoolInfo(AIVirtualCard owner, List idList) + { + return AISummonTokenUtility.CreateTokenIdCollectionFromIdList(owner, _tokenSide, idList, AITokenType.Default); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILeaderLifeEvaluationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AILeaderLifeEvaluationUtility.cs new file mode 100644 index 0000000..73cfcc2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILeaderLifeEvaluationUtility.cs @@ -0,0 +1,49 @@ +namespace Wizard; + +public static class AILeaderLifeEvaluationUtility +{ + private static float[] LEADER_LIFE_VALUE_20_TO_1 = new float[19] + { + 0.55f, 0.627f, 0.704f, 0.781f, 0.858f, 0.935f, 1.012f, 1.088f, 1.165f, 1.242f, + 1.319f, 1.396f, 1.473f, 1.55f, 1.627f, 1.704f, 1.781f, 1.858f, 1.935f + }; + + private static float LEADER_LIFE_VALUE_OVER_20 = 0.5f; + + private static float LETHAL_VALUE_ALLY = -10000f; + + private static float LETHAL_VALUE_OPPONENT = 1000f; + + private static float OVER_KILL_VALUE_RATE = 10f; + + public static float Evaluate(int currentLife, int defaultLife, bool isAllyLeader, bool isAllyOwner) + { + float num = 0f; + if (currentLife > 0) + { + int num2 = defaultLife; + bool flag = currentLife < defaultLife; + while (num2 != currentLife) + { + if (!flag) + { + num2++; + } + float num3 = 0f; + num3 = ((num2 <= 20) ? (num3 + LEADER_LIFE_VALUE_20_TO_1[20 - num2]) : (num3 + LEADER_LIFE_VALUE_OVER_20)); + num += num3 * (flag ? (-1f) : 1f); + if (flag) + { + num2--; + } + } + num *= (isAllyLeader ? 1f : (-1f)); + } + else + { + num += (isAllyLeader ? LETHAL_VALUE_ALLY : LETHAL_VALUE_OPPONENT); + num += (isAllyLeader ? 1f : (-1f)) * OVER_KILL_VALUE_RATE * (float)currentLife; + } + return num * (isAllyOwner ? 1f : (-1f)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILeaveAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AILeaveAttachTag.cs new file mode 100644 index 0000000..ad4d20e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILeaveAttachTag.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILeaveAttachTag : AIFiltersAndSelectTypeArgument +{ + private readonly int TAG_WORD_START_INDEX = 1; + + private readonly int REMOVE_TIMING_OFFSET = 1; + + public AIPlayTag AttachedTag { get; private set; } + + public AIScriptTokenArgType RemoveTiming { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AILeaveAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + RemoveTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - REMOVE_TIMING_OFFSET]); + AttachedTag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[TAG_WORD_START_INDEX], list[TAG_WORD_START_INDEX + 1], list[TAG_WORD_START_INDEX + 2]); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targetsFromField, tagOwner, AttachedTag, RemoveTiming, situation); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (AttachedTag != null) + { + return AttachedTag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILeaveBanish.cs b/SVSim.BattleEngine/Engine/Wizard/AILeaveBanish.cs new file mode 100644 index 0000000..21656fb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILeaveBanish.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILeaveBanish : AIFiltersAndSelectTypeArgument +{ + public AILeaveBanish(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBanishSimulationUtility.BanishAll(targetsFromField, situation); + } + else if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIBanishSimulationUtility.BanishRandom(targetsFromField, tagOwner, field, playPtn, situation); + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILeaveDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AILeaveDamage.cs new file mode 100644 index 0000000..9cc75eb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILeaveDamage.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILeaveDamage : AIFiltersAndSelectTypeArgument +{ + private AIPolishConvertedExpression _damageAmount; + + private readonly int DAMAGE_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AILeaveDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _damageAmount = _exprList[_exprList.Count - DAMAGE_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int damage = (int)_damageAmount.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, damage, situation); + } + else if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, damage, situation); + } + else + { + AIConsoleUtility.LogError("AILeaveDamage Error!! Unsupport SelectType=" + base.SelectType); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILeaveHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AILeaveHeal.cs new file mode 100644 index 0000000..7c4349e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILeaveHeal.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILeaveHeal : AIFiltersAndSelectTypeArgument +{ + private AIPolishConvertedExpression _healValue; + + private const int HEAL_VALUE_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AILeaveHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _healValue = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int healValue = GetHealValue(tagOwner, playPtn, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targetsFromField, field, healValue, playPtn, situation); + } + else + { + AIConsoleUtility.LogError("AILeaveHeal Error!! Unsupport SelectType=" + base.SelectType); + } + } + } + + public int GetHealValue(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (_healValue == null) + { + AIConsoleUtility.LogError("AILeaveHeal error!!! _healValue argument is null!!"); + return 0; + } + return (int)_healValue.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILeaveToken.cs b/SVSim.BattleEngine/Engine/Wizard/AILeaveToken.cs new file mode 100644 index 0000000..252db7f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILeaveToken.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AILeaveToken : AIFiltersArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_INDEX_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AILeaveToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AISummonTokenUtility.ExecuteSummonToken(GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false), base.Filters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } + + public List GetTokenIds(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return AISummonTokenUtility.GetOwnerSideTokenIds(GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false), base.Filters, _tokenCount, AITokenType.Default, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILethalSimulator.cs b/SVSim.BattleEngine/Engine/Wizard/AILethalSimulator.cs new file mode 100644 index 0000000..6bba56f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILethalSimulator.cs @@ -0,0 +1,321 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public class AILethalSimulator +{ + private EnemyAI _ai; + + private AIOperationSimulatorAccessor _operator; + + private AILethalPlan _resultLethalPlan; + + private bool _isForceFailedSimulation; + + public AIVirtualField CurrentField => _operator.CurrentField; + + public AIVirtualField CurrentFieldForNewSimulator { get; private set; } + + public AILethalSimulator(EnemyAI ai) + { + _ai = ai; + _operator = new AIOperationSimulatorAccessor(_ai); + CurrentFieldForNewSimulator = new AIVirtualField(_ai.CurrentVirtualField, isLatestAction: false, isPlayptnSimulation: true); + } + + public IEnumerator SimulateByAISimulator(AISinglePlayptnRecord playPtnRecord) + { + CurrentFieldForNewSimulator.BestPlayPtn = new List(playPtnRecord.PlayPtn); + CurrentFieldForNewSimulator.RegisterBestPlayPtnRecord(playPtnRecord); + _resultLethalPlan = null; + yield return AILethalSimulation(CurrentFieldForNewSimulator, playPtnRecord, null); + if (_resultLethalPlan != null) + { + _ai.OutputLethalPlan = _resultLethalPlan; + } + } + + public IEnumerator AILethalSimulation(AIVirtualField field, AISinglePlayptnRecord playptnRecord, AILethalPlan lethalPlan) + { + AISinglePlayptnRecord nextPlayptnRecord = playptnRecord; + List list = null; + AIVirtualCard aIVirtualCard = null; + AILethalPlan aILethalPlan = ((lethalPlan != null) ? lethalPlan.Clone() : new AILethalPlan()); + List list2 = field.CreatePlayCardList(playptnRecord.PlayPtn); + if (list2 != null && list2.Count > 0) + { + for (int i = 0; i < list2.Count; i++) + { + AIVirtualCard baseCard = list2[i]; + AIVirtualCard aIVirtualCard2 = field.SearchVirtualCard(baseCard); + if (aIVirtualCard2 == null) + { + AIConsoleUtility.LogError("AILethalSimulation error!! cannot find virtualPlayCard!!!!!"); + yield break; + } + List bestPlayPtn = field.BestPlayPtn; + AIVirtualCard aIVirtualCard3 = aIVirtualCard2.FindRealActor(nextPlayptnRecord); + AIVirtualTargetSelectAction aIVirtualTargetSelectAction = new AIVirtualTargetSelectAction(aIVirtualCard3, aIVirtualCard2, AIOperationType.PLAY, (AISelectedTargetInfoSet)null); + aIVirtualTargetSelectAction.forceLethalMode = true; + if (!AIPlayCardSimulationUtility.IsAbleToPlayCard(aIVirtualTargetSelectAction, field)) + { + AIConsoleUtility.LogError("AILethalSimulation error!! cannot play card " + aIVirtualCard2.CardName); + yield break; + } + list = aIVirtualCard2.GetPlaySkipInformation(bestPlayPtn, null, aIVirtualTargetSelectAction); + for (int j = 0; j < field.CardListSet.BothClassAndInplayCards.Count; j++) + { + list = field.CardListSet.BothClassAndInplayCards[j].GetPlaySkipInformation(bestPlayPtn, list, aIVirtualTargetSelectAction); + } + if (list != null) + { + aIVirtualCard = aIVirtualCard2; + break; + } + List addedCardIdsWhenPlayout = aIVirtualCard3.GetAddedCardIdsWhenPlayout(field, field.BestPlayPtn, aIVirtualTargetSelectAction); + if (AILethalTargetSelectUtility.LethalSelectTarget(field, aIVirtualTargetSelectAction, nextPlayptnRecord)) + { + aILethalPlan.AddAction(aIVirtualTargetSelectAction); + } + ProcessAfterAction(field, nextPlayptnRecord, addedCardIdsWhenPlayout, out nextPlayptnRecord, out var addedPlayCardList); + if (_isForceFailedSimulation) + { + _resultLethalPlan = null; + yield break; + } + if (addedPlayCardList != null && addedPlayCardList.Count > 0) + { + int num = i + 1; + if (num < list2.Count) + { + list2.InsertRange(num, addedPlayCardList); + } + else + { + list2.AddRange(addedPlayCardList); + } + } + if (field.IsSuccess()) + { + aILethalPlan.IsSuccess = true; + _resultLethalPlan = aILethalPlan; + yield break; + } + if (field.AllyClass.IsDead) + { + yield break; + } + } + } + List list3 = CreateEvolutionCardList(field, list); + for (int k = 0; k <= list3.Count; k++) + { + AIVirtualField aIVirtualField = new AIVirtualField(field, isLatestAction: false, isPlayptnSimulation: true); + AILethalPlan aILethalPlan2 = aILethalPlan.Clone(); + AIVirtualCard aIVirtualCard4 = ((k > 0) ? list3[k - 1] : null); + List addedPlayCardList2; + if (aIVirtualCard4 != null) + { + AIVirtualCard aIVirtualCard5 = aIVirtualField.SearchVirtualCard(aIVirtualCard4); + if (aIVirtualCard5.IsAbleEvolution()) + { + AIVirtualTargetSelectAction aIVirtualTargetSelectAction2 = new AIVirtualTargetSelectAction(aIVirtualCard5, aIVirtualCard5, AIOperationType.EVOLVE, (AISelectedTargetInfoSet)null); + aIVirtualTargetSelectAction2.forceLethalMode = true; + if (AILethalTargetSelectUtility.LethalSelectTarget(aIVirtualField, aIVirtualTargetSelectAction2, nextPlayptnRecord)) + { + aILethalPlan2.AddAction(aIVirtualTargetSelectAction2); + } + ProcessAfterAction(aIVirtualField, nextPlayptnRecord, null, out nextPlayptnRecord, out addedPlayCardList2); + if (_isForceFailedSimulation) + { + _resultLethalPlan = null; + break; + } + if (aIVirtualField.IsSuccess()) + { + aILethalPlan2.IsSuccess = true; + _resultLethalPlan = aILethalPlan2; + break; + } + if (aIVirtualField.AllyClass.IsDead) + { + continue; + } + } + } + do + { + AIVirtualAttackInfo aIVirtualAttackInfo = null; + List allyInplayCards = aIVirtualField.AllyInplayCards; + for (int l = 0; l < allyInplayCards.Count; l++) + { + AIVirtualCard aIVirtualCard6 = allyInplayCards[l]; + AIVirtualAttackInfo aIVirtualAttackInfo2 = new AIVirtualAttackInfo(aIVirtualCard6, aIVirtualField.EnemyClass); + if (AIAttackSimulationUtility.IsAttackPossible(aIVirtualField, aIVirtualAttackInfo2) && !aIVirtualAttackInfo2.WillTargetDestroyByAttackTags(aIVirtualField, nextPlayptnRecord.PlayPtn, aIVirtualCard6)) + { + aIVirtualAttackInfo = aIVirtualAttackInfo2; + break; + } + } + if (aIVirtualAttackInfo == null) + { + break; + } + AIVirtualAttackSimulator.Attack(aIVirtualAttackInfo, aIVirtualField); + aILethalPlan2.AddAction(aIVirtualAttackInfo); + ProcessAfterAction(aIVirtualField, nextPlayptnRecord, null, out nextPlayptnRecord, out addedPlayCardList2); + if (_isForceFailedSimulation) + { + _resultLethalPlan = null; + yield break; + } + if (aIVirtualField.IsSuccess()) + { + aILethalPlan2.IsSuccess = true; + _resultLethalPlan = aILethalPlan2; + yield break; + } + } + while (!aIVirtualField.AllyClass.IsDead); + if (aIVirtualField.AllyClass.IsDead) + { + continue; + } + if (aIVirtualCard != null) + { + AIVirtualCard aIVirtualCard7 = aIVirtualField.SearchVirtualCard(aIVirtualCard); + if (aIVirtualCard7 == null) + { + _isForceFailedSimulation = true; + _resultLethalPlan = null; + break; + } + AIVirtualTargetSelectAction aIVirtualTargetSelectAction3 = new AIVirtualTargetSelectAction(aIVirtualCard7.FindRealActor(nextPlayptnRecord), aIVirtualCard7, AIOperationType.PLAY, (AISelectedTargetInfoSet)null); + aIVirtualTargetSelectAction3.forceLethalMode = true; + List bestPlayPtn2 = aIVirtualField.BestPlayPtn; + List addedCardIdsWhenPlayout2 = aIVirtualCard.GetAddedCardIdsWhenPlayout(field, bestPlayPtn2, aIVirtualTargetSelectAction3); + if (AILethalTargetSelectUtility.LethalSelectTarget(aIVirtualField, aIVirtualTargetSelectAction3, nextPlayptnRecord)) + { + aILethalPlan2.AddAction(aIVirtualTargetSelectAction3); + } + else + { + int num2 = aIVirtualField.AllyHandCards.IndexOf(aIVirtualCard7); + if (num2 >= 0) + { + bestPlayPtn2.Remove(num2); + } + } + if (aIVirtualField.IsSuccess()) + { + aILethalPlan2.IsSuccess = true; + _resultLethalPlan = aILethalPlan2; + break; + } + ProcessAfterAction(aIVirtualField, nextPlayptnRecord, addedCardIdsWhenPlayout2, out var nextPlayptnRecord2, out addedPlayCardList2); + if (_isForceFailedSimulation) + { + _resultLethalPlan = null; + break; + } + yield return AILethalSimulation(aIVirtualField, nextPlayptnRecord2, aILethalPlan2); + if (_isForceFailedSimulation) + { + _resultLethalPlan = null; + } + break; + } + AIVirtualTurnEndInfo turnEndSituation = new AIVirtualTurnEndInfo(aIVirtualField.AllyClass); + BattleSequencer.ProcessAllyTurnEndToOpponentTurnStart(aIVirtualField, turnEndSituation); + if (aIVirtualField.IsSuccess()) + { + aILethalPlan2.IsSuccess = true; + _resultLethalPlan = aILethalPlan2; + break; + } + } + } + + private void ProcessAfterAction(AIVirtualField afterActionField, AISinglePlayptnRecord currentPlayptnRecord, List addCardToPlayoutPlayPtnIdList, out AISinglePlayptnRecord nextPlayptnRecord, out List addedPlayCardList) + { + addedPlayCardList = null; + _isForceFailedSimulation = afterActionField.IsRemovedPlayPtnCard; + if (_isForceFailedSimulation) + { + nextPlayptnRecord = null; + return; + } + List addedHandIndexList = null; + if (addCardToPlayoutPlayPtnIdList != null && addCardToPlayoutPlayPtnIdList.Count > 0) + { + CreateAddCardToPlayoutPlayPtnList(afterActionField, addCardToPlayoutPlayPtnIdList, currentPlayptnRecord, out addedHandIndexList, out addedPlayCardList); + } + afterActionField.UpdateBestPlayptnRecordOnSim(addedHandIndexList); + nextPlayptnRecord = afterActionField.BestPlayptnRecordOnSim; + if (nextPlayptnRecord == null) + { + _isForceFailedSimulation = true; + } + } + + private void CreateAddCardToPlayoutPlayPtnList(AIVirtualField afterActionField, List addCardToPlayoutPlayPtnIdList, AISinglePlayptnRecord currentRecord, out List addedHandIndexList, out List addedHandCardList) + { + addedHandIndexList = null; + addedHandCardList = null; + List allyHandCards = afterActionField.AllyHandCards; + int num = currentRecord.LastRestPp; + List list = null; + for (int i = 0; i < addCardToPlayoutPlayPtnIdList.Count; i++) + { + int num2 = addCardToPlayoutPlayPtnIdList[i]; + for (int j = 0; j < allyHandCards.Count; j++) + { + AIVirtualCard aIVirtualCard = allyHandCards[j]; + if ((addedHandIndexList == null || !addedHandIndexList.Contains(j)) && (afterActionField.BestPlayPtn == null || !afterActionField.BestPlayPtn.Contains(j)) && aIVirtualCard.BaseId == num2) + { + AIVirtualTargetSelectAction aIVirtualTargetSelectAction = new AIVirtualTargetSelectAction(aIVirtualCard, aIVirtualCard, AIOperationType.PLAY); + aIVirtualTargetSelectAction.forceLethalMode = true; + list = AIParamQuery.AddElementToList(j, list); + PlaySimulationType playType; + int useCost = aIVirtualCard.GetUseCost(num, list, aIVirtualTargetSelectAction, out playType); + if (0 <= useCost && useCost <= num) + { + num -= useCost; + addedHandIndexList = AIParamQuery.AddElementToList(j, addedHandIndexList); + addedHandCardList = AIParamQuery.AddElementToList(aIVirtualCard, addedHandCardList); + break; + } + } + } + } + } + + private List CreateEvolutionCardList(AIVirtualField field, List playSkipInfo) + { + List list = new List(); + for (int i = 0; i < field.AllyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyInplayCards[i]; + if (!aIVirtualCard.IsUnit || !aIVirtualCard.IsAbleEvolution()) + { + continue; + } + if (playSkipInfo == null || !playSkipInfo.Any()) + { + list.Add(aIVirtualCard); + continue; + } + for (int j = 0; j < playSkipInfo.Count; j++) + { + if (playSkipInfo[j].IsEvoCardLegal(aIVirtualCard)) + { + list.Add(aIVirtualCard); + break; + } + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIMathematicsLibrary.cs b/SVSim.BattleEngine/Engine/Wizard/AIMathematicsLibrary.cs new file mode 100644 index 0000000..d591b93 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIMathematicsLibrary.cs @@ -0,0 +1,129 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Wizard; + +public static class AIMathematicsLibrary +{ + public static Dictionary> PermListsDictionary = new Dictionary>(); + + public static IEnumerable EnumeratePermutations(List numbers) + { + return _GetPermutations(new List(), numbers); + } + + public static List EnumerateIndexListPermutations(int count) + { + if (PermListsDictionary.ContainsKey(count)) + { + return PermListsDictionary[count]; + } + List list = new List(); + for (int i = 0; i < count; i++) + { + list.Add(i); + } + List list2 = EnumeratePermutations(list).ToList(); + PermListsDictionary.Add(count, list2); + return list2; + } + + private static IEnumerable _GetPermutations(IEnumerable seq, IEnumerable numbers) + { + if (numbers.Count() == 0) + { + yield return seq.ToArray(); + yield break; + } + foreach (T number in numbers) + { + IEnumerable enumerable = _GetPermutations(seq.Concat(new T[1] { number }), numbers.Where((T x) => !x.Equals(number))); + foreach (T[] item in enumerable) + { + yield return item.ToArray(); + } + } + } + + public static IEnumerable EnumerateCombinations(List numbers, int selectCount) + { + if (numbers.Count == 0) + { + yield return numbers.ToArray(); + } + bool[] appearanceMap = new bool[numbers.Count]; + for (int i = 0; i < appearanceMap.Length; i++) + { + if (i < selectCount) + { + appearanceMap[i] = true; + } + else + { + appearanceMap[i] = false; + } + } + bool flag = true; + while (flag) + { + yield return numbers.FindAll(delegate(T n) + { + int num6 = numbers.IndexOf(n); + return appearanceMap[num6]; + }).ToArray(); + flag = false; + for (int num = 0; num < appearanceMap.Length - 1; num++) + { + if (!appearanceMap[num] || appearanceMap[num + 1]) + { + continue; + } + appearanceMap[num] = false; + appearanceMap[num + 1] = true; + int num2 = 0; + for (int num3 = 0; num3 < num; num3++) + { + if (appearanceMap[num3]) + { + num2++; + } + } + if (num2 < num) + { + for (int num4 = 0; num4 < num2; num4++) + { + appearanceMap[num4] = true; + } + for (int num5 = num2; num5 < num; num5++) + { + appearanceMap[num5] = false; + } + } + flag = true; + break; + } + } + } + + public static List GetPatternList(List candidates, int patternIndex) + { + if (patternIndex <= 0) + { + return null; + } + int num = patternIndex; + int count = candidates.Count; + List list = new List(); + for (int i = 0; i < count; i++) + { + int num2 = (int)Mathf.Pow(2f, count - i - 1); + if (num / num2 > 0) + { + num -= num2; + list.Add(candidates[i]); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIModifyValue.cs b/SVSim.BattleEngine/Engine/Wizard/AIModifyValue.cs new file mode 100644 index 0000000..e8ae919 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIModifyValue.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIModifyValue : AIFiltersArgument +{ + private AIPolishConvertedExpression _modifyValueArg; + + private const int MODIFY_VALUE_ARG_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIModifyValue(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _ = _exprList.Count; + _ = 1; + _modifyValueArg = _exprList[_exprList.Count - 1]; + } + + public int GetModifiedValue(AIVirtualCard tagOwner, AIVirtualCard targetCard, List playPtn, AISituationInfo situation, int originalValue) + { + if (!AIFilteringUtility.CheckMatchTargetFiltering(targetCard, null, base.Filters, playPtn, tagOwner, null)) + { + return originalValue; + } + return (int)_modifyValueArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIMove.cs b/SVSim.BattleEngine/Engine/Wizard/AIMove.cs new file mode 100644 index 0000000..afbea66 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIMove.cs @@ -0,0 +1,13 @@ +namespace Wizard; + +public abstract class AIMove +{ + public AIOperationType Type { get; private set; } + + protected AIMove(AIOperationType type) + { + Type = type; + } + + public abstract void RunOperation(BattleManagerBase mgr, bool isPlayer); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AINecromance.cs b/SVSim.BattleEngine/Engine/Wizard/AINecromance.cs new file mode 100644 index 0000000..81dc5e1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AINecromance.cs @@ -0,0 +1,65 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AINecromance : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression valueArg; + + private const int ValueArgIndex = 0; + + private const int TimingIndex = 1; + + public AIScriptTokenArgType Timing { get; private set; } + + public AINecromance(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count < 2) + { + return; + } + valueArg = _exprList[0]; + AIPolishConvertedExpression aIPolishConvertedExpression = _exprList[1]; + if (aIPolishConvertedExpression.TokenList[0] is AIScriptArgumentToken) + { + AIScriptArgumentToken aIScriptArgumentToken = aIPolishConvertedExpression.TokenList[0] as AIScriptArgumentToken; + if (CheckValidTimingType(aIScriptArgumentToken.ArgumentType)) + { + Timing = aIScriptArgumentToken.ArgumentType; + } + else + { + Timing = AIScriptTokenArgType.NONE; + } + } + } + + public int GetNecromanceValue(AIVirtualCard tagOwner, int currentCemetery, AIVirtualField field, AISituationInfo situation, List playPtn) + { + if (valueArg == null) + { + return 0; + } + int num = (int)valueArg.EvalArg(tagOwner, playPtn, field, situation); + if (num <= currentCemetery) + { + return num; + } + return 0; + } + + public bool CheckValidTimingType(AIScriptTokenArgType type) + { + if ((uint)(type - 60) <= 2u || (uint)(type - 65) <= 2u) + { + return true; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AINecromanceAddCemetery.cs b/SVSim.BattleEngine/Engine/Wizard/AINecromanceAddCemetery.cs new file mode 100644 index 0000000..4b40fc6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AINecromanceAddCemetery.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AINecromanceAddCemetery : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression _addCountArg; + + private const int ADD_COUNT_ARG_OFFSET = 1; + + public AINecromanceAddCemetery(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _addCountArg = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + if (_addCountArg != null) + { + int count = (int)_addCountArg.EvalArg(tagOwner, playPtn, field, situation); + field.VirtualCemetery.AddCemetery(count, tagOwner.IsAlly); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AINecromanceAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AINecromanceAttachTag.cs new file mode 100644 index 0000000..e3e93d2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AINecromanceAttachTag.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AINecromanceAttachTag : AIFiltersAndSelectTypeArgument +{ + private const int TIMING_OFFSET = 1; + + public AIPlayTag AttachedTag { get; private set; } + + public AIScriptTokenArgType RemoveTiming { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AINecromanceAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + RemoveTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + if (list.Count <= AIPlayTag.TAG_WORDS_LENTGH) + { + AttachedTag = null; + } + else + { + AttachedTag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targetsFromField, tagOwner, AttachedTag, RemoveTiming, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + AIDefaultSelectLogicArgument selectLogic = new AIDefaultSelectLogicArgument(null); + AIAttachTagSimulationUtility.SimulateRandomSelectAttachTag(targetsFromField, 1, tagOwner, field, playPtn, situation, AttachedTag, RemoveTiming, selectLogic); + break; + } + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (AttachedTag != null) + { + return AttachedTag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AINecromanceDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AINecromanceDamage.cs new file mode 100644 index 0000000..e60c5c2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AINecromanceDamage.cs @@ -0,0 +1,67 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AINecromanceDamage : AIFiltersAndSelectTypeArgument +{ + private AIPolishConvertedExpression _damageAmount; + + private const int DAMAGE_AMOUNT_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AINecromanceDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _damageAmount = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int damageAmount = GetDamageAmount(tagOwner, field, playPtn, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, damageAmount, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, damageAmount, situation); + break; + } + } + } + + private int GetDamageAmount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_damageAmount == null) + { + AIConsoleUtility.LogError("AINecromanceDamage.GetDamageAmount() error!! _damageAmount is null"); + return 0; + } + return (int)_damageAmount.EvalArg(tagOwner, playPtn, field, situation); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AINecromanceHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AINecromanceHeal.cs new file mode 100644 index 0000000..80218b4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AINecromanceHeal.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AINecromanceHeal : AIFiltersAndSelectTypeArgument +{ + private AIPolishConvertedExpression _healAmout; + + private const int HEAL_AMOUNT_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AINecromanceHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _healAmout = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int healAmount = GetHealAmount(tagOwner, field, playPtn, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targetsFromField, field, healAmount, playPtn, situation); + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + private int GetHealAmount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_healAmout == null) + { + AIConsoleUtility.LogError("AINecromanceHeal.GetHealAmount() error!! _healAmount is null"); + return 0; + } + return (int)_healAmout.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackAttachTag.cs new file mode 100644 index 0000000..ac51ff0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackAttachTag.cs @@ -0,0 +1,65 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherAttackAttachTag : AIWhenAttackSelfAndOtherTagArgument +{ + private AIScriptTokenArgType _removeTiming; + + private AIScriptTokenArgType _selectType; + + private const int REMOVE_TIMING_OFFSET = 1; + + private const int SELECT_TYPE_OFFSET = 2; + + private const int TAG_WORD_START_INDEX = 1; + + public AIPlayTag Tag { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIOtherAttackAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + _removeTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + _selectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2]); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0 && _selectType == AIScriptTokenArgType.ALL_SELECT) + { + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targets, tagOwner, Tag, _removeTiming, situation); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + List list = new List(); + list.AddRange(field.CardListSet.AllReferableCards); + list.AddRange(field.GetEnemyHandCardList()); + return list; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (Tag != null) + { + return Tag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackBuff.cs new file mode 100644 index 0000000..b8492a6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackBuff.cs @@ -0,0 +1,124 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherAttackBuff : AIWhenAttackSelfAndOtherTagArgument +{ + private AIScriptTokenArgType _selectType; + + private AIPolishConvertedExpression _attack; + + private AIPolishConvertedExpression _life; + + private AIScriptTokenArgType _tempOrPerm; + + private readonly int TEMP_OR_PERM_ARG_OFFSET = 1; + + private readonly int LIFE_ARG_OFFSET = 2; + + private readonly int ATTACK_ARG_OFFSET = 3; + + private readonly int SELECT_TYPE_OFFSET = 4; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public override bool IsActivateWhenEvalInstantAttack => true; + + public AIOtherAttackBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _selectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], base.LegalSelectTypes); + _tempOrPerm = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - TEMP_OR_PERM_ARG_OFFSET], AIBuffEvaluationUtility.LEGAL_TEMP_OR_PERM_ARGUMENTS); + _attack = _exprList[_exprList.Count - ATTACK_ARG_OFFSET]; + _life = _exprList[_exprList.Count - LIFE_ARG_OFFSET]; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool isAttackEffective = !_attack.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective, isBlockDead); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, _attack, _life); + bool isTemp = _tempOrPerm == AIScriptTokenArgType.TEMP; + if (_selectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBuffSimulationUtility.BuffAll_old(targets, field, buffExecutingInfo_old, isTemp, playPtn, situation); + } + } + } + + public void RegisterBuffInfo(AISimulationBuffInfoCollection collection, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, ulong tagHash) + { + AIVirtualCard actor = situation.Actor; + if (!CheckTriggerLegal(actor, tagOwner, playPtn, situation)) + { + return; + } + List targets = GetTargets(tagOwner, field, playPtn, situation); + if (targets != null && targets.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, _attack, _life); + if (!buffExecutingInfo_old.IsMultiplyAttack && !buffExecutingInfo_old.IsMultiplyLife) + { + bool num = _tempOrPerm == AIScriptTokenArgType.TEMP; + int attackValue = buffExecutingInfo_old.AttackValue; + int lifeValue = buffExecutingInfo_old.LifeValue; + AISimulationBuffInfo buffInfo = (num ? new AISimulationBuffInfo(attackValue, lifeValue, attackValue, lifeValue) : new AISimulationBuffInfo(0, 0, attackValue, lifeValue)); + collection.Add(tagHash, targets, buffInfo); + } + } + } + + private Tuple GetBuff(AIVirtualCard tagOwner, AIVirtualField field, AISituationInfo situation, List playPtn) + { + int first = (int)_attack.EvalArg(tagOwner, playPtn, field, situation); + int second = (int)_life.EvalArg(tagOwner, playPtn, field, situation); + return new Tuple(first, second); + } + + public override void PseudoSimulateForEvalInstantAttack(AIVirtualCard tagOwner, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, EvalInstantAttackInformation information) + { + AIVirtualCard actor = situation.Actor; + if (!CheckTriggerLegal(actor, tagOwner, playPtn, situation)) + { + return; + } + List targets = GetTargets(tagOwner, field, playPtn, situation); + if (targets == null || targets.Count <= 0) + { + return; + } + bool flag = actor.IsSameCardIncluded(targets); + bool flag2 = situation.AttackTarget.IsSameCardIncluded(targets); + if (flag || flag2) + { + if (flag) + { + int attack = (int)_attack.EvalArg(tagOwner, playPtn, field, situation); + int life = (int)_life.EvalArg(tagOwner, playPtn, field, situation); + information.AddAttackerWhenAttackBuff(attack, life); + } + if (flag2) + { + int value = (int)_life.EvalArg(tagOwner, playPtn, field, situation); + information.AddTargetLifeBuff(value); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackDamage.cs new file mode 100644 index 0000000..2d6aa8f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackDamage.cs @@ -0,0 +1,99 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherAttackDamage : AIWhenAttackSelfAndOtherTagArgument +{ + private AIScriptTokenArgType _selectType; + + private AIPolishConvertedExpression _damage; + + private readonly int DAMAGE_ARG_OFFSET = 1; + + private readonly int SELECT_TYPE_ARG_INDEX = 2; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_ARG_INDEX; + + public override bool IsActivateWhenEvalInstantAttack => true; + + public AIOtherAttackDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _damage = _exprList[_exprList.Count - DAMAGE_ARG_OFFSET]; + _selectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_ARG_INDEX], base.LegalSelectTypes); + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + int damage = (int)_damage.EvalArg(tagOwner, playPtn, field, situation); + switch (_selectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIDamageSimulationUtility.DamageAll(targets, tagOwner, field, damage, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIDamageSimulationUtility.DamageRandom(targets, tagOwner, field, damage, situation); + break; + } + } + } + + private int GetAttackDamageToCertainTarget(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AIVirtualCard damageTarget) + { + if (damageTarget.IsIndependent) + { + return 0; + } + if (!CheckTriggerLegal(situation.Actor, tagOwner, playPtn, situation)) + { + return 0; + } + List targets = GetTargets(tagOwner, field, playPtn, situation); + if (targets.Contains(damageTarget)) + { + int num = (int)_damage.EvalArg(tagOwner, playPtn, field, situation); + if (_selectType == AIScriptTokenArgType.ALL_SELECT || (_selectType == AIScriptTokenArgType.RANDOM_SELECT && damageTarget.IsSameCard(AIDamageSimulationUtility.SelectDamageTarget(targets, field, playPtn, situation, num, isSpell: false, AISelectTargetPattern.Worst)))) + { + return num; + } + } + return 0; + } + + public int PseudoSimulateDamageToTarget(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AIVirtualCard damageTarget, AIBarrierPseudoSimulationInfo simBarrier) + { + int attackDamageToCertainTarget = GetAttackDamageToCertainTarget(tagOwner, field, playPtn, situation, damageTarget); + if (attackDamageToCertainTarget > 0) + { + bool isSpell = tagOwner.IsSpell; + int result = simBarrier.SimulateDamageAmount(damageTarget.SimulateDamageShield(attackDamageToCertainTarget, isSkillDamage: true, isSpell), isSpell); + simBarrier.DepriveBarrier(AIBarrierStopTiming.AfterDamage); + return result; + } + return 0; + } + + public override void PseudoSimulateForEvalInstantAttack(AIVirtualCard tagOwner, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, EvalInstantAttackInformation information) + { + AIBarrierPseudoSimulationInfo attackerBarrierInfo = information.AttackerBarrierInfo; + AIVirtualCard actor = situation.Actor; + information.AttackerTotalDamage += PseudoSimulateDamageToTarget(tagOwner, field, playPtn, situation, actor, attackerBarrierInfo); + if (information.AttackerTotalDamage >= actor.Life) + { + information.IsAttackerDestroyWhenAttack = true; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackHeal.cs new file mode 100644 index 0000000..eebf12d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackHeal.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherAttackHeal : AIWhenAttackSelfAndOtherTagArgument +{ + private AIScriptTokenArgType _selectType; + + private AIPolishConvertedExpression _heal; + + private const int SELECT_TYPE_OFFSET = 2; + + private const int HEAL_VALUE_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIOtherAttackHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _heal = _exprList[_exprList.Count - 1]; + _selectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], base.LegalSelectTypes); + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + int heal = (int)_heal.EvalArg(tagOwner, playPtn, field, situation); + if (_selectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targets, field, heal, playPtn, situation); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackRemoveTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackRemoveTag.cs new file mode 100644 index 0000000..fed1613 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackRemoveTag.cs @@ -0,0 +1,44 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherAttackRemoveTag : AIWhenAttackSelfAndOtherTagArgument, IAIRemoveTagArgument +{ + private const int NEEDS_SPLITED_WORDS_LENGS = 3; + + private const int REMOVE_TAG_START_SPLITED_INDEX = 1; + + public AIPlayTag RemoveTag { get; private set; } + + public AIOtherAttackRemoveTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + if (list == null || list.Count < 4) + { + AIConsoleUtility.LogError("AIOtherAttackRemoveTag error!! splitedText.Length is not enough"); + return; + } + base.InitExpressions(list[0]); + RemoveTag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public void Execute(AIVirtualCard tagOwner, AIVirtualField field, AISituationInfo situation, AIPlayTag executingOwnerTag, List playPtn = null) + { + AIVirtualCard aIVirtualCard = ((situation != null && situation.ActionType == AIOperationType.ATTACK) ? situation.Actor : null); + if (aIVirtualCard != null && CheckTriggerLegal(aIVirtualCard, tagOwner, playPtn, situation)) + { + AIRemoveTagUtility.RemoveOneTag(tagOwner, field, RemoveTag, situation); + AIRemoveTagUtility.RemoveOneTag(tagOwner, field, executingOwnerTag, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackToken.cs new file mode 100644 index 0000000..d2b8d01 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherAttackToken.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherAttackToken : AIWhenAttackSelfAndOtherTagArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_INDEX_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIOtherAttackToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + AISummonTokenUtility.ExecuteSummonToken(targets, base.TargetFilters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override List GetTargets(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return GetCandidateRange(field); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherBanishAddCemetery.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherBanishAddCemetery.cs new file mode 100644 index 0000000..60bf690 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherBanishAddCemetery.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherBanishAddCemetery : AITriggerAndTargetFiltersTagBase +{ + private AIPolishConvertedExpression _addCount; + + private readonly int COUNT_ARG_INDEX = 1; + + public AIOtherBanishAddCemetery(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _addCount = _exprList[_exprList.Count - COUNT_ARG_INDEX]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + int count = (int)_addCount.EvalArg(tagOwner, playPtn, field, situation); + field.VirtualCemetery.AddCemetery(count, tagOwner.IsAlly); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherBanishToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherBanishToken.cs new file mode 100644 index 0000000..edbb0d0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherBanishToken.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherBanishToken : AITriggerAndTargetFiltersTagBase +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_INDEX_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIOtherBanishToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + AISummonTokenUtility.ExecuteSummonToken(targets, base.TargetFilters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override List GetTargets(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return GetCandidateRange(field); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherBattleBonusRate.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherBattleBonusRate.cs new file mode 100644 index 0000000..24bf4a0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherBattleBonusRate.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherBattleBonusRate : AIBonusArgumentWithIgnoreInBattle +{ + private int ValueArgumentIndexOffset = 1; + + private int MinimumArgumentCount = 2; + + public List Filters { get; private set; } + + public AIOtherBattleBonusRate(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count < MinimumArgumentCount) + { + return; + } + Filters = GetFilters(_exprList.GetRange(0, _exprList.Count - ValueArgumentIndexOffset)); + int num = -1; + for (int i = 0; i < Filters.Count; i++) + { + if (Filters[i].Type == AIScriptTokenType.ARG && ((AIScriptArgumentToken)Filters[i]).ArgumentType == AIScriptTokenArgType.NONE) + { + num = i; + break; + } + } + if (num != -1) + { + Filters = Filters.GetRange(0, num + 1); + } + } + + public float GetBonusValue(AIVirtualCard tagOwner, AIVirtualCard target, List allCandidates, AIVirtualField field, List playPtn, bool useIgnoreInBattle) + { + if (useIgnoreInBattle && base.IsIgnoreInBattle) + { + return 1f; + } + if (AIFilteringUtility.CheckMatchTargetFiltering(target, allCandidates, Filters, playPtn, tagOwner, null)) + { + return _bonusValueArg.EvalArg(tagOwner, playPtn, field); + } + return 1f; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherBreakBonus.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherBreakBonus.cs new file mode 100644 index 0000000..4841c28 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherBreakBonus.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherBreakBonus : AIBonusArgumentWithIgnoreInBattle +{ + private List _filters; + + public AIOtherBreakBonus(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + List range = _exprList.GetRange(0, _exprList.Count - _valueIndexOffset); + _filters = GetFilters(range); + } + + public float GetBonusValue(AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, List playPtn, bool useIgnoreInBattle) + { + if (useIgnoreInBattle && base.IsIgnoreInBattle) + { + return 0f; + } + if (AIFilteringUtility.CheckMatchTargetFiltering(target, field.CardListSet.AllReferableCards, _filters, playPtn, tagOwner, null)) + { + return _bonusValueArg.EvalArg(tagOwner, playPtn, field); + } + return 0f; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedBanish.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedBanish.cs new file mode 100644 index 0000000..51bf601 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedBanish.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherDamagedBanish : AITriggerAndTargetFiltersTagBase +{ + private const int SELECT_TYPE_OFFSET = 1; + + public AIScriptTokenArgType SelectType { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIOtherDamagedBanish(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1], base.LegalSelectTypes); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count != 0 && SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBanishSimulationUtility.BanishAll(targets, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedDamage.cs new file mode 100644 index 0000000..cbc0ca5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedDamage.cs @@ -0,0 +1,87 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherDamagedDamage : AITriggerAndTargetFiltersTagBase +{ + private AIPolishConvertedExpression _damage; + + private AIPolishConvertedExpression _count; + + private const int DAMAGE_INDEX_OFFSET = 2; + + private const int COUNT_INDEX_OFFSET = 1; + + private const int SELECT_TYPE_OFFSET = 3; + + protected override int NON_FILTER_FIRST_OFFSET => 3; + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIOtherDamagedDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 3], base.LegalSelectTypes); + _damage = _exprList[_exprList.Count - 2]; + _count = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets == null || targets.Count == 0) + { + return; + } + int damage = GetDamage(tagOwner, playPtn, situation); + int times = GetTimes(tagOwner, playPtn, situation); + switch (SelectType) + { + case AIScriptTokenArgType.RANDOM_SELECT: + { + for (int j = 0; j < times; j++) + { + AIDamageSimulationUtility.DamageRandom(targets, tagOwner, field, damage, situation); + } + break; + } + case AIScriptTokenArgType.ALL_SELECT: + { + for (int i = 0; i < times; i++) + { + AIDamageSimulationUtility.DamageAll(targets, tagOwner, field, damage, situation); + } + break; + } + } + } + + public int GetDamage(AIVirtualCard tagOwner, List playPtn = null, AISituationInfo situation = null) + { + return (int)_damage.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } + + public int GetTimes(AIVirtualCard tagOwner, List playPtn = null, AISituationInfo situation = null) + { + return (int)_count.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedHeal.cs new file mode 100644 index 0000000..b07c087 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedHeal.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherDamagedHeal : AITriggerAndTargetFiltersTagBase +{ + protected const int SELECT_TYPE_OFFSET = 2; + + private const int HEAL_ARG_OFFSET = 1; + + private AIPolishConvertedExpression _healArg; + + public AIScriptTokenArgType SelectType { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIOtherDamagedHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], base.LegalSelectTypes); + _healArg = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (targets != null && targets.Count > 0) + { + int heal = (int)_healArg.EvalArg(tagOwner, playPtn, field, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targets, field, heal, playPtn, situation); + } + else + { + AIConsoleUtility.LogError("not implementation : AIOtherDamagedHeal other than ALL_SELECT"); + } + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedSetLeaderMaxLife.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedSetLeaderMaxLife.cs new file mode 100644 index 0000000..defd7eb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedSetLeaderMaxLife.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherDamagedSetLeaderMaxLife : AIFiltersArgument +{ + private AIScriptTokenArgType _side; + + private AIPolishConvertedExpression _life; + + private const int SIDE_OFFSET = 2; + + private const int VALUE_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIOtherDamagedSetLeaderMaxLife(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _side = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2]); + _life = _exprList[_exprList.Count - 1]; + } + + protected override void RunMethod(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int maxLife = (int)_life.EvalArg(tagOwner, playPtn, field, situation); + AISetStatusSimulationUtility.SetLeaderMaxLife(tagOwner, maxLife, _side, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedSubtractCountdown.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedSubtractCountdown.cs new file mode 100644 index 0000000..c6c7915 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherDamagedSubtractCountdown.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherDamagedSubtractCountdown : AITriggerAndTargetFiltersTagBase +{ + private AIScriptTokenArgType _selectType; + + private AIPolishConvertedExpression _count; + + protected const int SELECT_TYPE_OFFSET = 2; + + private const int COUNT_ARG_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIOtherDamagedSubtractCountdown(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _selectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], base.LegalSelectTypes); + _count = _exprList[_exprList.Count - 1]; + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForCountdownAmuletOnly(candidates, tagOwner, base.TargetFilters, playPtn, situation, isBlockDead); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (targets != null && targets.Count > 0) + { + int value = (int)_count.EvalArg(tagOwner, playPtn, field, situation); + if (_selectType == AIScriptTokenArgType.ALL_SELECT) + { + AISubtractCountdownSimulationUtility.SubtractCountdownAll(targets, value, situation); + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoAddCemetery.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoAddCemetery.cs new file mode 100644 index 0000000..6a1169c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoAddCemetery.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoAddCemetery : AIOtherEvoTagArgument +{ + private AIPolishConvertedExpression _addCemeteryCount; + + private const int COUNT_ARG_INDEX = 1; + + protected override int SELECT_TYPE_ARG_OFFSET => -1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIOtherEvoAddCemetery(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _addCemeteryCount = _exprList[_exprList.Count - 1]; + } + + protected override void InitializeSelectType() + { + base.SelectType = AIScriptTokenArgType.ALL_SELECT; + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + int count = (int)_addCemeteryCount.EvalArg(tagOwner, playPtn, field, situation); + field.VirtualCemetery.AddCemetery(count, tagOwner.IsAlly); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoAttachTag.cs new file mode 100644 index 0000000..b904ebf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoAttachTag.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoAttachTag : AIOtherEvoTagArgument +{ + private AIScriptTokenArgType _removeTiming; + + private readonly int REMOVE_TIMING_OFFSET = 1; + + private const int TAG_WORD_START_INDEX = 1; + + public AIPlayTag Tag { get; private set; } + + protected override int SELECT_TYPE_ARG_OFFSET => 2; + + public AIOtherEvoAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + _removeTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - REMOVE_TIMING_OFFSET]); + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targets, tagOwner, Tag, _removeTiming, situation); + } + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (Tag != null) + { + return Tag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBanish.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBanish.cs new file mode 100644 index 0000000..f5ac4e4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBanish.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoBanish : AIOtherEvoTagArgument +{ + public AIOtherEvoBanish(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + if (candidate.IsIndependent || candidate.IsUnbanishable) + { + return false; + } + return IsCertainlyIncludeTarget(owner, candidate, situation); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBanishSimulationUtility.BanishAll(targets, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIBanishSimulationUtility.BanishRandom(targets, tagOwner, field, playPtn, situation); + break; + } + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Banish; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBonus.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBonus.cs new file mode 100644 index 0000000..3873186 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBonus.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoBonus : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression valueArg; + + public AIOtherEvoBonus(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + valueArg = _exprList[0]; + } + + public float GetEvaluateValue(AIVirtualCard tagOwner, AISituationInfo situation, List playPtn) + { + return valueArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBounce.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBounce.cs new file mode 100644 index 0000000..f66f36e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBounce.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoBounce : AIOtherEvoTagArgument +{ + public AIOtherEvoBounce(string text) + : base(text) + { + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + if (candidate.IsIndependent) + { + return false; + } + return IsCertainlyIncludeTarget(owner, candidate, situation); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Bounce; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBounceSimulationUtility.BounceAll(targets, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIBounceSimulationUtility.BounceRandom(targets, tagOwner, field, playPtn, situation); + break; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBuff.cs new file mode 100644 index 0000000..95a7689 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoBuff.cs @@ -0,0 +1,82 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoBuff : AIOtherEvoTagArgument +{ + private AIPolishConvertedExpression _attackBuff; + + private AIPolishConvertedExpression _lifeBuff; + + private AIScriptTokenArgType _permOrTemp; + + private const int ATTACK_BUFF_ARG_OFFSET = 3; + + private const int LIFE_BUFF_ARG_OFFSET = 2; + + private const int PERM_OR_TEMP_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_ARG_OFFSET => 4; + + public AIOtherEvoBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _attackBuff = _exprList[_exprList.Count - 3]; + _lifeBuff = _exprList[_exprList.Count - 2]; + _permOrTemp = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1], AIBuffEvaluationUtility.LEGAL_TEMP_OR_PERM_ARGUMENTS); + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + if (!IsCertainlyIncludeTarget(owner, candidate, situation)) + { + return false; + } + AIVirtualField selfField = owner.SelfField; + return GetLifeBuff(owner, selfField, selfField.BestPlayPtn, situation) + candidate.Life <= 0; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, _attackBuff, _lifeBuff); + bool isTemp = _permOrTemp == AIScriptTokenArgType.TEMP; + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBuffSimulationUtility.BuffAll_old(targets, field, buffExecutingInfo_old, isTemp, playPtn, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIBuffSimulationUtility.BuffRandom_old(targets, field, playPtn, situation, buffExecutingInfo_old, isTemp); + break; + } + } + } + + private int GetAttackBuff(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_attackBuff == null) + { + AIConsoleUtility.LogError("AIOtherEvoBuff error!!! _attackBuff is null"); + return 0; + } + return (int)_attackBuff.EvalArg(tagOwner, playPtn, field, situation); + } + + private int GetLifeBuff(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_lifeBuff == null) + { + AIConsoleUtility.LogError("AIOtherEvoBuff error!!! _lifeBuff is null"); + return 0; + } + return (int)_lifeBuff.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoDamage.cs new file mode 100644 index 0000000..5ae2d03 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoDamage.cs @@ -0,0 +1,100 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoDamage : AIOtherEvoTagArgument +{ + private AIPolishConvertedExpression _damage; + + private AIPolishConvertedExpression _count; + + private const int DAMAGE_ARG_OFFSET = 2; + + private const int COUNT_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_ARG_OFFSET => 3; + + public AIOtherEvoDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _damage = _exprList[_exprList.Count - 2]; + _count = _exprList[_exprList.Count - 1]; + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + if (candidate.IsIndependent) + { + return false; + } + AIVirtualField selfField = owner.SelfField; + List bestPlayPtn = selfField.BestPlayPtn; + if (!IsCertainlyIncludeTarget(owner, candidate, situation)) + { + return false; + } + int damage = GetDamage(owner, selfField, bestPlayPtn, situation); + int count = GetCount(owner, selfField, bestPlayPtn, situation); + return candidate.SimulateDamageAmount(damage, isSkillDamage: true, owner.IsSpell) * count >= candidate.Life; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets == null || targets.Count <= 0) + { + return; + } + int damage = GetDamage(tagOwner, field, playPtn, situation); + int count = GetCount(tagOwner, field, playPtn, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + { + for (int j = 0; j < count; j++) + { + AIDamageSimulationUtility.DamageAll(targets, tagOwner, field, damage, situation); + } + break; + } + case AIScriptTokenArgType.RANDOM_SELECT: + { + for (int i = 0; i < count; i++) + { + AIDamageSimulationUtility.DamageRandom(targets, tagOwner, field, damage, situation); + } + break; + } + } + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Damage; + } + + private int GetDamage(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_damage == null) + { + AIConsoleUtility.LogError("AIOtherEvoDamage error!! _damage is null"); + return 0; + } + return (int)_damage.EvalArg(tagOwner, playPtn, field, situation); + } + + private int GetCount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_count == null) + { + AIConsoleUtility.LogError("AIOtherEvoDamage error!! _count is null"); + return 0; + } + return (int)_count.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoDestroy.cs new file mode 100644 index 0000000..196ce5b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoDestroy.cs @@ -0,0 +1,109 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoDestroy : AIOtherEvoTagArgument +{ + private AIPolishConvertedExpression _selectCount; + + private int _expectedSelectCountArgOffset; + + private static int SELECT_COUNT_OFFSET => 1; + + protected override int SELECT_TYPE_ARG_OFFSET => _expectedSelectCountArgOffset + 1; + + public AIOtherEvoDestroy(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + InitializeSelectCount(); + InitializeFilters(); + base.SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_ARG_OFFSET], base.LegalSelectTypes); + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + if (candidate.IsIndependent || candidate.IsIndestructible) + { + return false; + } + return IsCertainlyIncludeTarget(owner, candidate, situation); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.DestroyAll(targets, field, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + AISkillSimulationUtility.DestroyRandom(targets, tagOwner, field, playPtn, situation, selectCount); + break; + } + case AIScriptTokenArgType.TARGET_SELECT: + break; + } + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Destroy; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.RANDOM_MULTI_SELECT + }; + } + + protected override bool CheckIsCandidateSelectedBySelectType(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AIVirtualCard candidate) + { + if (base.SelectType == AIScriptTokenArgType.RANDOM_MULTI_SELECT) + { + return targets.Count <= GetSelectCount(tagOwner, field, playPtn, situation); + } + return base.CheckIsCandidateSelectedBySelectType(targets, tagOwner, field, playPtn, situation, candidate); + } + + protected virtual void InitializeSelectCount() + { + _selectCount = null; + _expectedSelectCountArgOffset = SELECT_COUNT_OFFSET; + AIPolishConvertedExpression aIPolishConvertedExpression = _exprList[_exprList.Count - _expectedSelectCountArgOffset]; + if (aIPolishConvertedExpression.IsMathematicExpress()) + { + _selectCount = aIPolishConvertedExpression; + } + if (_selectCount == null) + { + _expectedSelectCountArgOffset = SELECT_COUNT_OFFSET - 1; + } + } + + private int GetSelectCount(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_selectCount == null) + { + return 1; + } + return (int)_selectCount.EvalArg(owner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoDraw.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoDraw.cs new file mode 100644 index 0000000..e328605 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoDraw.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoDraw : AIOtherEvoTagArgument +{ + private const int COUNT_ARG_INDEX = 1; + + public AIPolishConvertedExpression DrawCount { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + protected override int SELECT_TYPE_ARG_OFFSET => -1; + + public AIOtherEvoDraw(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + InitializeFilters(); + DrawCount = _exprList[_exprList.Count - 1]; + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (DrawCount != null) + { + int drawCount = (int)DrawCount.EvalArg(tagOwner, playPtn, field, situation); + field.DrawCard(tagOwner.IsAlly, drawCount, playPtn, situation); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoEvo.cs new file mode 100644 index 0000000..76fdb32 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoEvo.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoEvo : AIOtherEvoTagArgument +{ + public AIOtherEvoEvo(string text) + : base(text) + { + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null) + { + AIAutoEvolutionSimulationUtility.AutoEvolution(field, targets, playPtn, situation, base.SelectType); + } + } + + protected override List GetTargets(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List targets = base.GetTargets(tagOwner, field, playPtn, situation); + targets?.RemoveAll((AIVirtualCard c) => c.IsEvolution); + return targets; + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.TargetFilters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.AllyInplayCards; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoHeal.cs new file mode 100644 index 0000000..b77f0e8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoHeal.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoHeal : AIOtherEvoTagArgument +{ + private AIPolishConvertedExpression _heal; + + private const int HEAL_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_ARG_OFFSET => 2; + + public AIOtherEvoHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _heal = _exprList[_exprList.Count - 1]; + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + int heal = GetHeal(tagOwner, field, playPtn, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.HealAll(targets, field, heal, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AISkillSimulationUtility.HealTarget(situation, field, base.SelectType, heal); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + private int GetHeal(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_heal == null) + { + AIConsoleUtility.LogError("AIOtherEvoHeal error!! _heal is null"); + return 0; + } + return (int)_heal.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoShield.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoShield.cs new file mode 100644 index 0000000..ab203de --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoShield.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoShield : AIOtherEvoTagArgument +{ + private AIScriptTokenArgType _stopTiming; + + private AIScriptTokenArgType _damageType; + + private const int DEFAULT_DAMAGE_TYPE_OFFSET = 2; + + private const int STOP_TIMING_OFFSET = 1; + + private bool _isDamageTypeDefinedByMaster; + + protected override int SELECT_TYPE_ARG_OFFSET => 1 + ((!_isDamageTypeDefinedByMaster) ? 1 : 2); + + public AIOtherEvoShield(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - 2], out _isDamageTypeDefinedByMaster); + base.SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_ARG_OFFSET], base.LegalSelectTypes); + InitializeFilters(); + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBarrierSimulationUtility.AddShieldToAll(targets, tagOwner, field, _damageType, _stopTiming); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoSubtractCountdown.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoSubtractCountdown.cs new file mode 100644 index 0000000..81106bd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoSubtractCountdown.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoSubtractCountdown : AIOtherEvoTagArgument +{ + private AIPolishConvertedExpression _countdownAmount; + + private const int COUNTDOWN_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_ARG_OFFSET => 2; + + public AIOtherEvoSubtractCountdown(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _countdownAmount = _exprList[_exprList.Count - 1]; + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.AllyInplayCards; + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForCountdownAmuletOnly(candidates, tagOwner, base.TargetFilters, playPtn, situation, isBlockDead); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + int countdownAmount = GetCountdownAmount(tagOwner, field, playPtn, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISubtractCountdownSimulationUtility.SubtractCountdownAll(targets, countdownAmount, situation); + } + } + + private int GetCountdownAmount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_countdownAmount == null) + { + AIConsoleUtility.LogError("AIOtherEvoSubtractCountdown error!! _countdownAmount is null"); + return 0; + } + return (int)_countdownAmount.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoTagArgument.cs new file mode 100644 index 0000000..b180913 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoTagArgument.cs @@ -0,0 +1,70 @@ +using System.Collections.Generic; + +namespace Wizard; + +public abstract class AIOtherEvoTagArgument : AITriggerAndTargetFiltersTagBase +{ + public AIScriptTokenArgType SelectType { get; protected set; } + + protected virtual int SELECT_TYPE_ARG_OFFSET => 1; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_ARG_OFFSET; + + public abstract bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation); + + public AIOtherEvoTagArgument(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + InitializeSelectType(); + } + + protected bool IsCertainlyIncludeTarget(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + AIVirtualField selfField = owner.SelfField; + if (!CheckTriggerLegal(situation.Actor, owner, selfField.BestPlayPtn, situation)) + { + return false; + } + List bestPlayPtn = selfField.BestPlayPtn; + List targets = GetTargets(owner, selfField, bestPlayPtn, situation); + if (targets != null && targets.Contains(candidate)) + { + return CheckIsCandidateSelectedBySelectType(targets, owner, selfField, bestPlayPtn, situation, candidate); + } + return false; + } + + protected virtual bool CheckIsCandidateSelectedBySelectType(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AIVirtualCard candidate) + { + return SelectType switch + { + AIScriptTokenArgType.ALL_SELECT => true, + AIScriptTokenArgType.RANDOM_SELECT => targets.Count <= 1, + _ => false, + }; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + public virtual AIRemovalType GetRemovalType() + { + return AIRemovalType.None; + } + + protected virtual void InitializeSelectType() + { + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_ARG_OFFSET], base.LegalSelectTypes); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoToken.cs new file mode 100644 index 0000000..ca623cf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoToken.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoToken : AIOtherEvoTagArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_ARG_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIOtherEvoToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + InitializeFilters(); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override List GetTargets(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return GetCandidateRange(field); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + AISummonTokenUtility.ExecuteSummonToken(targets, base.TargetFilters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } + + public int GetTokenCount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_tokenCount == null) + { + AIConsoleUtility.LogError("AIOtherEvoToken error!! _tokenCount is null"); + return 0; + } + return (int)_tokenCount.EvalArg(tagOwner, playPtn, field, situation); + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoTokenDraw.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoTokenDraw.cs new file mode 100644 index 0000000..c473c16 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherEvoTokenDraw.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherEvoTokenDraw : AIOtherEvoTagArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_ARG_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + protected override int SELECT_TYPE_ARG_OFFSET => -1; + + public AIOtherEvoTokenDraw(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + protected override void InitializeSelectType() + { + base.SelectType = AIScriptTokenArgType.ALL_SELECT; + } + + public override bool IsTargetGoingToDie(AIVirtualCard owner, AIVirtualCard candidate, AISituationInfo situation) + { + return false; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override List GetTargets(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return GetCandidateRange(field); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + AISummonTokenUtility.ExecuteDrawToken(targets, base.TargetFilters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherLeaveDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherLeaveDamage.cs new file mode 100644 index 0000000..eb66520 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherLeaveDamage.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherLeaveDamage : AITriggerAndTargetFiltersTagBase +{ + private AIPolishConvertedExpression _damageAmount; + + private AIScriptTokenArgType _selectType; + + private const int DAMAGE_AMOUNT_ARG_OFFSET = 1; + + private const int SELECT_TYPE_ARG_OFFSET = 2; + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIOtherLeaveDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _damageAmount = _exprList[_exprList.Count - 1]; + _selectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], base.LegalSelectTypes); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + int damageAmount = GetDamageAmount(tagOwner, field, playPtn, situation); + switch (_selectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIDamageSimulationUtility.DamageAll(targets, tagOwner, field, damageAmount, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIDamageSimulationUtility.DamageRandom(targets, tagOwner, field, damageAmount, situation); + break; + default: + AIConsoleUtility.LogError($"AIOtherLeaveDamage()๏ผšSelectType={_selectType} ๆœชๅฏพๅฟœ"); + break; + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + private int GetDamageAmount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_damageAmount == null) + { + AIConsoleUtility.LogError("AIOtherLeaveDamage error!! _damageAmount is null"); + return 0; + } + return (int)_damageAmount.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherLeaveToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherLeaveToken.cs new file mode 100644 index 0000000..fb0b1f0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherLeaveToken.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherLeaveToken : AITriggerAndTargetFiltersTagBase +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_INDEX_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIOtherLeaveToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + AISummonTokenUtility.ExecuteSummonToken(targets, base.TargetFilters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override List GetTargets(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return GetCandidateRange(field); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherPlayBonus.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherPlayBonus.cs new file mode 100644 index 0000000..ee18936 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherPlayBonus.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherPlayBonus : AIUseMinArgument +{ + private AIPolishConvertedExpression valueArg; + + private const int MINIMUM_ARGUMENT_COUNT = 2; + + public List Filters { get; private set; } + + public AIOtherPlayBonus(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count >= 2) + { + int num = (base.IsUseMin ? (USE_MIN_INDEX_OFFSET + 1) : USE_MIN_INDEX_OFFSET); + Filters = GetFilters(_exprList.GetRange(0, _exprList.Count - num)); + valueArg = _exprList[_exprList.Count - num]; + } + } + + public float GetEvaluateValue(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + return valueArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherPlayBonusRate.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherPlayBonusRate.cs new file mode 100644 index 0000000..20dd8b8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherPlayBonusRate.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherPlayBonusRate : AIFiltersArgument +{ + private AIPolishConvertedExpression _valueArg; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIOtherPlayBonusRate(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _valueArg = _exprList[_exprList.Count - NON_FILTER_FIRST_OFFSET]; + } + + public float GetBonusRate(AIVirtualCard tagOwner, AIVirtualCard targetCard, List playPtn, AISituationInfo situation) + { + AIVirtualField selfField = tagOwner.SelfField; + _ = selfField.ParamQuery; + if (_valueArg == null || !AIFilteringUtility.CheckMatchTargetFiltering(targetCard, null, base.Filters, playPtn, tagOwner, situation)) + { + return 1f; + } + return _valueArg.EvalArg(tagOwner, playPtn, selfField, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherPlayoutDamageBonus.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherPlayoutDamageBonus.cs new file mode 100644 index 0000000..7417088 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherPlayoutDamageBonus.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherPlayoutDamageBonus : AIFiltersArgument +{ + private AIPolishConvertedExpression _value; + + private int VALUE_INDEX_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => VALUE_INDEX_OFFSET; + + public AIOtherPlayoutDamageBonus(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _value = _exprList[_exprList.Count - VALUE_INDEX_OFFSET]; + } + + public int GetPlayoutDamageBonus(AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, List playPtn) + { + if (AIFilteringUtility.CheckMatchTargetFiltering(target, field.CardListSet.AllAllyCards, base.Filters, playPtn, tagOwner, null)) + { + return (int)_value.EvalArg(tagOwner, playPtn, field); + } + return 0; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonAddCemetery.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonAddCemetery.cs new file mode 100644 index 0000000..a5e9508 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonAddCemetery.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonAddCemetery : AITriggerAndTargetFiltersTagBase +{ + private AIPolishConvertedExpression _addCemeteryCount; + + private const int ADD_CEMETERY_ARG_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIOtherSummonAddCemetery(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _addCemeteryCount = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + int count = (int)_addCemeteryCount.EvalArg(tagOwner, playPtn, field, situation); + field.VirtualCemetery.AddCemetery(count, tagOwner.IsAlly); + } + + protected override List GetTargets(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return GetCandidateRange(field); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonAttachTag.cs new file mode 100644 index 0000000..8f9f1e8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonAttachTag.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonAttachTag : AITriggerAndTargetFiltersTagBase +{ + private const int TIMING_OFFSET = 1; + + private const int SELECT_TYPE_OFFSET = 2; + + private readonly AIScriptTokenArgType[] _legalSelectTypeArgs = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.FIRST_SELECT + }; + + public AIPlayTag AttachedTag { get; private set; } + + public AIScriptTokenArgType RemoveTiming { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIScriptTokenArgType SelectTypeArg { get; private set; } + + public AIOtherSummonAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + RemoveTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + SelectTypeArg = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], _legalSelectTypeArgs); + if (SelectTypeArg != AIScriptTokenArgType.ALL_SELECT && SelectTypeArg != AIScriptTokenArgType.FIRST_SELECT) + { + AIConsoleUtility.LogError("AISummonAttachTag SelectType Error!! ALL_SELECT or FIRST_SELECT =" + SelectTypeArg); + } + if (list.Count <= AIPlayTag.TAG_WORDS_LENTGH) + { + AttachedTag = null; + } + else + { + AttachedTag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + switch (SelectTypeArg) + { + case AIScriptTokenArgType.FIRST_SELECT: + AIAttachTagSimulationUtility.SimulateAttachTagToSingle(targets[0], tagOwner, AttachedTag, RemoveTiming, situation); + break; + case AIScriptTokenArgType.ALL_SELECT: + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targets, tagOwner, AttachedTag, RemoveTiming, situation); + break; + default: + AIConsoleUtility.LogError(string.Format("AIOtherSummonAttachTag : ILlegal SelectType ({0}) owner ({1})", SelectTypeArg, (tagOwner != null) ? tagOwner.CardName : "")); + break; + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonBanish.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonBanish.cs new file mode 100644 index 0000000..a3f1f7b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonBanish.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonBanish : AITriggerAndTargetFiltersTagBase +{ + private const int SELECT_TYPE_ARG_OFFSET = 1; + + public AIScriptTokenArgType SelectType { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIOtherSummonBanish(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1], base.LegalSelectTypes); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBanishSimulationUtility.BanishAll(targets, situation); + } + else if (SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIBanishSimulationUtility.BanishRandom(targets, tagOwner, field, playPtn, situation); + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonBarrierBase.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonBarrierBase.cs new file mode 100644 index 0000000..f6f82d2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonBarrierBase.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public abstract class AIOtherSummonBarrierBase : AITriggerAndTargetFiltersTagBase +{ + private AIScriptTokenArgType _selectType; + + protected AIScriptTokenArgType _stopTiming; + + protected AIScriptTokenArgType _damageType; + + private bool _isDamageTypeDefinedByMaster; + + protected abstract int _defaultDamageTypeOffset { get; } + + protected abstract int _stopTimingOffset { get; } + + protected int SELECT_TYPE_OFFSET => 1 + (_isDamageTypeDefinedByMaster ? _defaultDamageTypeOffset : _stopTimingOffset); + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AIOtherSummonBarrierBase(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - _stopTimingOffset]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - _defaultDamageTypeOffset], out _isDamageTypeDefinedByMaster); + _selectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], base.LegalSelectTypes); + InitializeFilters(); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (_selectType == AIScriptTokenArgType.ALL_SELECT) + { + GiveBarrierToAllTargets(targets, field, tagOwner, playPtn, situation); + } + } + + protected abstract void GiveBarrierToAllTargets(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonBuff.cs new file mode 100644 index 0000000..e77d88d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonBuff.cs @@ -0,0 +1,78 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonBuff : AITriggerAndTargetFiltersTagBase +{ + private const int SELECT_TYPE_OFFSET = 4; + + private const int ATK_BUFF_OFFSET = 3; + + private const int LIFE_BUFF_OFFSET = 2; + + private const int PERM_OR_TEMP_OFFSET = 1; + + private readonly AIScriptTokenArgType[] _legalSelectTypeArgs = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.FIRST_SELECT + }; + + public AIPolishConvertedExpression AtkBuff { get; private set; } + + public AIPolishConvertedExpression LifeBuff { get; private set; } + + public bool IsTemp { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 4; + + public AIScriptTokenArgType SelectTypeArg { get; private set; } + + public AIOtherSummonBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AtkBuff = _exprList[_exprList.Count - 3]; + LifeBuff = _exprList[_exprList.Count - 2]; + AIScriptTokenArgType argumentType = ((AIScriptArgumentToken)_exprList[_exprList.Count - 1].TokenList[0]).ArgumentType; + if (argumentType != AIScriptTokenArgType.PERM) + { + _ = 138; + } + IsTemp = argumentType == AIScriptTokenArgType.TEMP; + SelectTypeArg = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 4], _legalSelectTypeArgs); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, AtkBuff, LifeBuff); + switch (SelectTypeArg) + { + case AIScriptTokenArgType.FIRST_SELECT: + AIBuffSimulationUtility.BuffFirst_old(targets, field, buffExecutingInfo_old, IsTemp, playPtn, situation); + break; + case AIScriptTokenArgType.ALL_SELECT: + AIBuffSimulationUtility.BuffAll_old(targets, field, buffExecutingInfo_old, IsTemp, playPtn, situation); + break; + default: + AIConsoleUtility.LogError(string.Format("AISummonBuff : ILlegal SelectType ({0}) owner ({1})", SelectTypeArg, (tagOwner != null) ? tagOwner.CardName : "")); + break; + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool isAttackEffective = !AtkBuff.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDamage.cs new file mode 100644 index 0000000..dbef8fe --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDamage.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonDamage : AITriggerAndTargetFiltersTagBase +{ + private const int DAMAGE_OFFSET = 1; + + private const int SELECT_TYPE_OFFSET = 2; + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIPolishConvertedExpression Damage { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIOtherSummonDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIPolishConvertedExpression arg = _exprList[_exprList.Count - 2]; + AIScriptTokenArgType selectType = AIScriptTokenArgType.NONE; + if (!IsLegalSelectType(arg, out selectType)) + { + SelectType = AIScriptTokenArgType.ALL_SELECT; + } + else + { + SelectType = selectType; + } + Damage = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + int damage = (int)Damage.EvalArg(tagOwner, playPtn, field, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIDamageSimulationUtility.DamageAll(targets, tagOwner, field, damage, situation); + } + else if (SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIDamageSimulationUtility.DamageRandom(targets, tagOwner, field, damage, situation); + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDamageClip.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDamageClip.cs new file mode 100644 index 0000000..d7c2f27 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDamageClip.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonDamageClip : AIOtherSummonBarrierBase +{ + private AIPolishConvertedExpression _clipAmount; + + private const int CLIP_AMOUNT_OFFSET = 1; + + protected override int _defaultDamageTypeOffset => 3; + + protected override int _stopTimingOffset => 2; + + public AIOtherSummonDamageClip(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _clipAmount = _exprList[_exprList.Count - 1]; + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + int clipAmount = (int)_clipAmount.EvalArg(tagOwner, playPtn, field, situation); + AIBarrierSimulationUtility.AddDamageClipToAll(targets, tagOwner, field, _damageType, _stopTiming, clipAmount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDamageCut.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDamageCut.cs new file mode 100644 index 0000000..2645bcd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDamageCut.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonDamageCut : AIOtherSummonBarrierBase +{ + private AIPolishConvertedExpression _cutAmount; + + private const int CUT_AMOUNT_OFFSET = 1; + + protected override int _defaultDamageTypeOffset => 3; + + protected override int _stopTimingOffset => 2; + + public AIOtherSummonDamageCut(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _cutAmount = _exprList[_exprList.Count - 1]; + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + int cutAmount = (int)_cutAmount.EvalArg(tagOwner, playPtn, field, situation); + AIBarrierSimulationUtility.AddDamageCutToAll(targets, tagOwner, field, _damageType, _stopTiming, cutAmount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDestroy.cs new file mode 100644 index 0000000..859feea --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDestroy.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonDestroy : AITriggerAndTargetFiltersTagBase +{ + private const int SELECT_TYPE_ARG_OFFSET = 1; + + public AIScriptTokenArgType SelectType { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIOtherSummonDestroy(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1], base.LegalSelectTypes); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + switch (SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.DestroyAll(targets, field, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AISkillSimulationUtility.DestroyRandom(targets, tagOwner, field, playPtn, situation); + break; + default: + AIConsoleUtility.LogError($"AIOtherSummonDestroy: Unsupported select type. type:{SelectType}"); + break; + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDraw.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDraw.cs new file mode 100644 index 0000000..840a345 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonDraw.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonDraw : AITriggerAndTargetFiltersTagBase +{ + private const int COUNT_ARG_INDEX = 1; + + public AIPolishConvertedExpression DrawCount { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIOtherSummonDraw(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + DrawCount = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (DrawCount != null) + { + int drawCount = (int)DrawCount.EvalArg(tagOwner, playPtn, field, situation); + field.DrawCard(tagOwner.IsAlly, drawCount, playPtn, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonEvo.cs new file mode 100644 index 0000000..90206ed --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonEvo.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonEvo : AITriggerAndTargetFiltersTagBase +{ + public AIOtherSummonEvo(string text) + : base(text) + { + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + AIAutoEvolutionSimulationUtility.AutoEvolution(field, targets, playPtn, situation, AIScriptTokenArgType.ALL_SELECT); + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.TargetFilters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.AllyInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonHeal.cs new file mode 100644 index 0000000..81b10f6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonHeal.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonHeal : AITriggerAndTargetFiltersTagBase +{ + private const int SELECT_TYPE_OFFSET = 2; + + private const int HEAL_ARG_OFFSET = 1; + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIPolishConvertedExpression Heal { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIOtherSummonHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], base.LegalSelectTypes); + Heal = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + int heal = (int)Heal.EvalArg(tagOwner, playPtn, field); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targets, field, heal, playPtn, situation); + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonKeywordSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonKeywordSkill.cs new file mode 100644 index 0000000..5580c98 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonKeywordSkill.cs @@ -0,0 +1,136 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonKeywordSkill : AITriggerAndTargetFiltersTagBase +{ + private AIScriptTokenArgType _stopTiming; + + private AIScriptTokenArgType _skillType; + + public AIScriptTokenArgType SelectType { get; protected set; } + + protected virtual int StopTimingOffset => 1; + + private int DEFAULT_SELECT_TYPE_OFFSET => 2; + + protected virtual int SELECT_TYPE_OFFSET { get; set; } + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AIOtherSummonKeywordSkill(string text, AIScriptTokenArgType skill) + : base(text) + { + _skillType = skill; + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - StopTimingOffset]); + int num = 0; + if (!IsImplementedStopTiming(_stopTiming)) + { + num = 1; + _stopTiming = AIScriptTokenArgType.NONE; + } + SELECT_TYPE_OFFSET = DEFAULT_SELECT_TYPE_OFFSET - num; + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], base.LegalSelectTypes); + if (!IsImplementedSelecvtType(SelectType)) + { + SelectType = AIScriptTokenArgType.ALL_SELECT; + } + InitializeFilters(); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + switch (SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.GiveSkillToAll(targets, field, _skillType); + break; + } + SetSkillStopPreprocess(targets, field); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + private bool IsImplementedSelecvtType(AIScriptTokenArgType type) + { + return type == AIScriptTokenArgType.ALL_SELECT; + } + + private bool IsImplementedStopTiming(AIScriptTokenArgType timing) + { + if (timing != AIScriptTokenArgType.WHEN_LEAVE) + { + return timing == AIScriptTokenArgType.NONE; + } + return true; + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + if (AISkillSimulationUtility.IsFollowerOnlySkillType(_skillType)) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.TargetFilters, playPtn, situation, isBlockDead); + } + return base.GetFilteredTargets(candidates, tagOwner, playPtn, situation, isBlockDead); + } + + public float GetQuickBonus(AIVirtualCard playCard, AIVirtualField field, List playPtn, AIVirtualCard tagOwner, AISituationInfo situation) + { + if (_skillType != AIScriptTokenArgType.QUICK) + { + return 0f; + } + if (!CheckTriggerLegal(playCard, tagOwner, playPtn, situation)) + { + return 0f; + } + if (AIFilteringUtility.CheckMatchTargetFiltering(playCard, field.AllyHandCards, base.TargetFilters, playPtn, tagOwner, situation)) + { + return AIInstantAttackUtility.EvalInstantAttack(playCard.Attack, playCard.Life, playCard.MaxAttackableCount, playPtn, playCard, situation); + } + return 0f; + } + + protected void SetSkillStopPreprocess(List targets, AIVirtualField field) + { + if (targets != null && targets.Count > 0 && _stopTiming == AIScriptTokenArgType.WHEN_LEAVE) + { + WhenLeaveStop(targets, field); + } + } + + private void WhenLeaveStop(List targets, AIVirtualField field) + { + if (_skillType != AIScriptTokenArgType.UNTOUCHABLE) + { + return; + } + foreach (AIVirtualCard target in targets) + { + WhenLeaveStopUntouchable(target, field); + } + } + + private void WhenLeaveStopUntouchable(AIVirtualCard card, AIVirtualField field) + { + AIUntouchableStopPreprocessOption option = new AIUntouchableStopPreprocessOption(card); + field.TagPreprocessContainer.AppendLeaveStopInfo(option, card); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonSubtractCountdown.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonSubtractCountdown.cs new file mode 100644 index 0000000..e047ef5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherSummonSubtractCountdown.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherSummonSubtractCountdown : AITriggerAndTargetFiltersTagBase +{ + private const int SELECT_TYPE_OFFSET = 2; + + private const int SUBTRACT_ARG_OFFSET = 1; + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIPolishConvertedExpression SubtractValue { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIOtherSummonSubtractCountdown(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], base.LegalSelectTypes); + SubtractValue = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + int value = (int)SubtractValue.EvalArg(tagOwner, playPtn, field, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISubtractCountdownSimulationUtility.SubtractCountdownAll(targets, value, situation); + } + else + { + AIConsoleUtility.LogError("AIOtherSummonSubtractCountdown.RunTagMethod(): Unsupport select type!"); + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForCountdownAmuletOnly(candidates, tagOwner, base.TargetFilters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayAttachTag.cs new file mode 100644 index 0000000..597943a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayAttachTag.cs @@ -0,0 +1,66 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherWhenPlayAttachTag : AIOtherWhenPlayTagArgument +{ + private const int TIMING_OFFSET = 1; + + public AIPlayTag Tag { get; private set; } + + public AIScriptTokenArgType RemoveTiming { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIOtherWhenPlayAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + RemoveTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], base.LegalSelectTypes); + if (list.Count <= AIPlayTag.TAG_WORDS_LENTGH) + { + AIConsoleUtility.LogError("AIOtherWhenPlayAttachTag error!! Tag is not completed!!!!!"); + Tag = null; + } + else + { + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targets, tagOwner, Tag, RemoveTiming, situation); + } + else + { + AIConsoleUtility.LogError("AIOtherWhenPlayAttachTag.Execute() Error!! SelectType=" + SelectType); + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (Tag != null) + { + return Tag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayBounce.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayBounce.cs new file mode 100644 index 0000000..f6f0d99 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayBounce.cs @@ -0,0 +1,71 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherWhenPlayBounce : AIOtherWhenPlayTagArgument +{ + public AIOtherWhenPlayBounce(string text) + : base(text) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBounceSimulationUtility.BounceAll(targets, situation); + } + else + { + AIConsoleUtility.LogError($"AIOtherWhenPlayBounce.RunTagMethod() : Unsupported SelectType {SelectType}"); + } + } + + public override void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + TargetLifePredictionForAllSelect(target, owner, field, playPtn, situation, targetLifeRecord); + } + else + { + AIConsoleUtility.LogError($"AIOtherWhenPlayBounce.TargetLifePrediction() : Unsupported SelectType {SelectType}"); + } + } + + private void TargetLifePredictionForAllSelect(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (!target.IsLeader && !target.IsIndependent && AIFilteringUtility.CheckMatchTargetFiltering(target, GetCandidateRange(field), base.TargetFilters, playPtn, owner, situation)) + { + targetLifeRecord.CurrentLife = 0; + } + } + + public override void MultipleTargetLifePrediction(List targetList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, List lifeList) + { + if (SelectType != AIScriptTokenArgType.ALL_SELECT) + { + return; + } + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard aIVirtualCard = targetList[i]; + LifeRecord lifeRecord = lifeList[i]; + if (!aIVirtualCard.IsLeader && !aIVirtualCard.IsIndependent && AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, GetCandidateRange(field), base.TargetFilters, playPtn, owner, situation)) + { + lifeRecord.CurrentLife = 0; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayBuff.cs new file mode 100644 index 0000000..6fcdd12 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayBuff.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherWhenPlayBuff : AIOtherWhenPlayTagArgument +{ + private readonly int TEMP_OR_PERM_ARG_OFFSET = 1; + + private readonly int LIFE_ARG_OFFSET = 2; + + private readonly int ATTACK_ARG_OFFSET = 3; + + public AIPolishConvertedExpression Attack { get; private set; } + + public AIPolishConvertedExpression Life { get; private set; } + + public AIScriptTokenArgType TempOrPerm { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 4; + + public AIOtherWhenPlayBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Attack = _exprList[_exprList.Count - ATTACK_ARG_OFFSET]; + Life = _exprList[_exprList.Count - LIFE_ARG_OFFSET]; + TempOrPerm = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - TEMP_OR_PERM_ARG_OFFSET], AIBuffEvaluationUtility.LEGAL_TEMP_OR_PERM_ARGUMENTS); + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, Attack, Life); + bool isTemp = TempOrPerm == AIScriptTokenArgType.TEMP; + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBuffSimulationUtility.BuffAll_old(targets, field, buffExecutingInfo_old, isTemp, playPtn, situation); + } + else + { + AIConsoleUtility.LogError($"AIOtherWhenPlayBuff.RunTagMethod() : Unsupported SelectType {SelectType}"); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (SelectType == AIScriptTokenArgType.ALL_SELECT && !IsTargetNotCandidate(target, owner, field, playPtn, situation)) + { + int num = (int)Life.EvalArg(owner, playPtn, field, situation); + targetLifeRecord.MaxLife = Math.Max(targetLifeRecord.MaxLife + num, 0); + if (targetLifeRecord.CurrentLife > targetLifeRecord.MaxLife) + { + targetLifeRecord.CurrentLife = targetLifeRecord.MaxLife; + } + } + } + + public override void MultipleTargetLifePrediction(List targetList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, List lifeList) + { + if (SelectType != AIScriptTokenArgType.ALL_SELECT) + { + return; + } + int num = (int)Life.EvalArg(owner, playPtn, field, situation); + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard target = targetList[i]; + if (!IsTargetNotCandidate(target, owner, field, playPtn, situation)) + { + LifeRecord lifeRecord = lifeList[i]; + lifeRecord.MaxLife = Math.Max(lifeRecord.MaxLife + num, 0); + if (lifeRecord.CurrentLife > lifeRecord.MaxLife) + { + lifeRecord.CurrentLife = lifeRecord.MaxLife; + } + } + } + } + + private bool IsTargetNotCandidate(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (target.IsLeader || target.IsFollower(playPtn)) + { + return !AIFilteringUtility.CheckMatchTargetFiltering(target, GetCandidateRange(field), base.TargetFilters, playPtn, owner, situation); + } + return true; + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool isAttackEffective = !Attack.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayDamage.cs new file mode 100644 index 0000000..d029b50 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayDamage.cs @@ -0,0 +1,95 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherWhenPlayDamage : AIOtherWhenPlayTagArgument +{ + private const int DAMAGE_OFFSET = 1; + + public AIPolishConvertedExpression Damage { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIOtherWhenPlayDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (IsLegalSelectType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], out var selectType)) + { + SelectType = selectType; + } + else + { + AIConsoleUtility.LogError("AIOtherWhenPlayDamage Error!!! SelectType is " + selectType); + } + Damage = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + int damage = (int)Damage.EvalArg(tagOwner, playPtn, field); + switch (SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIDamageSimulationUtility.DamageAll(targets, tagOwner, field, damage, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIDamageSimulationUtility.DamageRandom(targets, tagOwner, field, damage, situation); + break; + default: + AIConsoleUtility.LogError($"AIOtherWhenPlayDamage.RunTagMethod() : Unsupported SelectType {SelectType}"); + break; + } + } + + public override void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (SelectType == AIScriptTokenArgType.ALL_SELECT && (target.IsLeader || target.IsUnit) && AIFilteringUtility.CheckMatchTargetFiltering(target, GetCandidateRange(field), base.TargetFilters, playPtn, owner, situation)) + { + int damageAmount = (int)Damage.EvalArg(owner, playPtn, field, situation); + int num = target.SimulateDamageAmount(damageAmount, isSkillDamage: true, owner.IsSpell); + targetLifeRecord.CurrentLife -= num; + } + } + + public override void MultipleTargetLifePrediction(List targetList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, List lifeList) + { + if (SelectType != AIScriptTokenArgType.ALL_SELECT) + { + return; + } + int damageAmount = (int)Damage.EvalArg(owner, playPtn, field, situation); + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard aIVirtualCard = targetList[i]; + LifeRecord lifeRecord = lifeList[i]; + if ((!aIVirtualCard.IsLeader && !aIVirtualCard.IsUnit) || !AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, GetCandidateRange(field), base.TargetFilters, playPtn, owner, situation)) + { + continue; + } + int num = aIVirtualCard.SimulateDamageAmount(damageAmount, isSkillDamage: true, owner.IsSpell); + lifeRecord.CurrentLife -= num; + if (lifeRecord.CurrentLife <= 0) + { + if (aIVirtualCard.IsDestroyByBanish) + { + situation.RegisterOwnBanishedCard(aIVirtualCard); + } + else + { + situation.RegisterOwnDestroyedCard(aIVirtualCard); + } + } + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.TargetFilters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayDestroy.cs new file mode 100644 index 0000000..7036bdf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayDestroy.cs @@ -0,0 +1,79 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherWhenPlayDestroy : AIOtherWhenPlayTagArgument +{ + public AIOtherWhenPlayDestroy(string text) + : base(text) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.DestroyAll(targets, field, situation); + } + else + { + AIConsoleUtility.LogError($"AIOtherWhenPlayDestroy.RunTagMethod() : Unsupported SelectType {SelectType}"); + } + } + + public override void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + TargetLifePredictionForAllSelect(target, owner, field, playPtn, situation, targetLifeRecord); + } + else + { + AIConsoleUtility.LogError($"AIOtherWhenPlayDestroy.TargetLifePrediction() : Unsupported SelectType {SelectType}"); + } + } + + public override void MultipleTargetLifePrediction(List targetList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, List lifeList) + { + if (SelectType != AIScriptTokenArgType.ALL_SELECT) + { + return; + } + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard aIVirtualCard = targetList[i]; + LifeRecord lifeRecord = lifeList[i]; + if (!aIVirtualCard.IsLeader && AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, GetCandidateRange(field), base.TargetFilters, playPtn, owner, situation) && !aIVirtualCard.IsIndependent && !aIVirtualCard.IsIndestructible) + { + lifeRecord.CurrentLife = 0; + if (aIVirtualCard.IsDestroyByBanish) + { + situation.RegisterOwnBanishedCard(aIVirtualCard); + } + else + { + situation.RegisterOwnDestroyedCard(aIVirtualCard); + } + } + } + } + + private void TargetLifePredictionForAllSelect(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (!target.IsLeader && AIFilteringUtility.CheckMatchTargetFiltering(target, GetCandidateRange(field), base.TargetFilters, playPtn, owner, situation) && !target.IsIndependent && !target.IsIndestructible) + { + targetLifeRecord.CurrentLife = 0; + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayEvo.cs new file mode 100644 index 0000000..abd2283 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayEvo.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherWhenPlayEvo : AIOtherWhenPlayTagArgument +{ + public AIOtherWhenPlayEvo(string text, PlaySimulationType playType) + : base(text, playType) + { + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + AIAutoEvolutionSimulationUtility.AutoEvolution(field, targets, playPtn, situation, SelectType); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.TargetFilters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayKeywordSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayKeywordSkill.cs new file mode 100644 index 0000000..bfbf888 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayKeywordSkill.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherWhenPlayKeywordSkill : AIOtherWhenPlayTagArgument +{ + private AIScriptTokenArgType _skillType; + + public AIOtherWhenPlayKeywordSkill(string text, AIScriptTokenArgType skillType) + : base(text) + { + _skillType = skillType; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.GiveSkillToAll(targets, field, _skillType); + } + } + + protected override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + if (AISkillSimulationUtility.IsFollowerOnlySkillType(_skillType)) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.TargetFilters, playPtn, situation, isBlockDead); + } + return base.GetFilteredTargets(candidates, tagOwner, playPtn, situation, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayRecoverPp.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayRecoverPp.cs new file mode 100644 index 0000000..a7c8a64 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayRecoverPp.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherWhenPlayRecoverPp : AIOtherWhenPlayTagArgument +{ + private AIPolishConvertedExpression _recoverPpValue; + + private const int RECOVER_PP_ARG_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + protected override int SELECT_TYPE_OFFSET => -1; + + public AIOtherWhenPlayRecoverPp(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + InitializeFilters(); + _recoverPpValue = _exprList[_exprList.Count - 1]; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + int recoverPpValue = GetRecoverPpValue(tagOwner, field, playPtn, situation); + if (recoverPpValue >= 0) + { + if (tagOwner.IsAlly) + { + field.AllyPp += recoverPpValue; + } + else + { + field.EnemyPp += recoverPpValue; + } + } + } + + public int GetRecoverPpValue(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_recoverPpValue == null) + { + AIConsoleUtility.LogError("AIOtherWhenPlayRecoverPp error!! _recoverPpValue is null"); + return 0; + } + return (int)_recoverPpValue.EvalArg(tagOwner, playPtn, field, situation); + } + + public bool CheckValidPlayCard(AIVirtualCard tagOwner, AIVirtualCard playCard, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return AIFilteringUtility.CheckMatchTargetFiltering(playCard, null, base.TriggerFilters, playPtn, tagOwner, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayRemoveTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayRemoveTag.cs new file mode 100644 index 0000000..93aacfa --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayRemoveTag.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherWhenPlayRemoveTag : AIOtherWhenPlayTagArgument, IAIRemoveTagArgument +{ + private const int NEEDS_SPLITED_WORDS_LENGS = 3; + + private const int REMOVE_TAG_START_SPLITED_INDEX = 1; + + public AIPlayTag RemoveTag { get; private set; } + + public AIOtherWhenPlayRemoveTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + if (list == null || list.Count < 4) + { + AIConsoleUtility.LogError("AIOtherWhenPlayRemoveTag error!! splitedText.Length is not enough"); + return; + } + InitExprList(list[0]); + InitializeFilters(); + RemoveTag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public void Execute(AIVirtualCard tagOwner, AIVirtualField field, AISituationInfo situation, AIPlayTag executingOwnerTag, List playPtn = null) + { + AIVirtualCard aIVirtualCard = ((situation != null && situation.ActionType == AIOperationType.PLAY) ? situation.Actor : null); + if (aIVirtualCard != null && CheckTriggerLegal(aIVirtualCard, tagOwner, playPtn, situation)) + { + AIRemoveTagUtility.RemoveOneTag(tagOwner, field, RemoveTag, situation); + AIRemoveTagUtility.RemoveOneTag(tagOwner, field, executingOwnerTag, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayTagArgument.cs new file mode 100644 index 0000000..228893d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayTagArgument.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; + +namespace Wizard; + +public abstract class AIOtherWhenPlayTagArgument : AITriggerAndTargetFiltersTagBase +{ + public virtual AIScriptTokenArgType SelectType { get; protected set; } + + public PlaySimulationType RequiredPlayType { get; protected set; } + + protected virtual int SELECT_TYPE_OFFSET => 1; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AIOtherWhenPlayTagArgument(string text, PlaySimulationType playType = PlaySimulationType.Undefined) + : base(text) + { + RequiredPlayType = playType; + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (IsLegalSelectType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], out var selectType)) + { + SelectType = selectType; + } + else + { + AIConsoleUtility.LogError("AIOtherWhenPlayTagArgument Error!!! SelectType is " + selectType); + } + } + + public virtual void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + throw new NotImplementedException(); + } + + public virtual void MultipleTargetLifePrediction(List targetList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, List lifeList) + { + throw new NotImplementedException(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayToken.cs new file mode 100644 index 0000000..26df3af --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOtherWhenPlayToken.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIOtherWhenPlayToken : AIOtherWhenPlayTagArgument +{ + private AIPolishConvertedExpression _tokenCountArg; + + private AIScriptTokenArgType _sideType; + + private const int TOKEN_COUNT_ARG_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIOtherWhenPlayToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + InitializeFilters(); + _tokenCountArg = _exprList[_exprList.Count - 1]; + _sideType = AIScriptTokenArgType.ALLY; + } + + protected override void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + base.RunTagMethod(targets, field, tagOwner, playPtn, situation); + if (targets != null && targets.Count > 0) + { + int tokenCount = GetTokenCount(tagOwner, field, playPtn, situation); + AISummonTokenUtility.GetBothSideTokenIdListFromFilter(tagOwner, field, targets, base.TargetFilters, AITokenType.Default, _sideType, AIScriptTokenArgType.ALL_SELECT, tokenCount, playPtn, situation).SummonAllTokenToField(field, tagOwner, situation); + } + } + + private int GetTokenCount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_tokenCountArg == null) + { + AIConsoleUtility.LogError("AIOtherWhenPlayToken.GetTokenCount() error!! _tokenCountArg is null"); + return 0; + } + return (int)_tokenCountArg.EvalArg(tagOwner, playPtn, field, situation); + } + + protected override List GetTargets(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return GetCandidateRange(field); + } + + public List GetAllySideTokenIds(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return GetBothSideTokenIdCollection(tagOwner, field, playPtn, situation)?.AllyTokenIdList; + } + + public AITokenIdCollection GetBothSideTokenIdCollection(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List targets = GetTargets(tagOwner, field, playPtn, situation); + if (targets == null || targets.Count <= 0) + { + return null; + } + int tokenCount = GetTokenCount(tagOwner, field, playPtn, situation); + return AISummonTokenUtility.GetBothSideTokenIdListFromFilter(tagOwner, field, targets, base.TargetFilters, AITokenType.Default, _sideType, AIScriptTokenArgType.ALL_SELECT, tokenCount, playPtn, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayBreak.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayBreak.cs new file mode 100644 index 0000000..d8251a8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayBreak.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIPlayBreak : AIFiltersArgument +{ + public AIPlayBreak(string text) + : base(text) + { + } + + public bool IsPlayBreak(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (AIFilteringUtility.CheckMatchTargetFiltering(owner, field.AllyHandCards, base.Filters, playPtn, owner, situation)) + { + return true; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayCardSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayCardSimulationUtility.cs new file mode 100644 index 0000000..0629b9a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayCardSimulationUtility.cs @@ -0,0 +1,251 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIPlayCardSimulationUtility +{ + public static void ExecuteRestPlayPtnAfterAttack(AIVirtualField field, ref List moves) + { + if (field.BestPlayPtn == null || field.BestPlayPtn.Count <= 0) + { + return; + } + List bestPlayPtn = field.BestPlayPtn; + int num = field.BestPlayPtn.Count; + while (bestPlayPtn.Count > 0) + { + num--; + if (num < 0) + { + AIConsoleUtility.LogError("ExecuteRestPlayPtnAfterAttack() error!! expectedPlayPtnCount turns to -1!!!!!"); + break; + } + AIVirtualCard aIVirtualCard = field.AllyHandCards[bestPlayPtn[0]]; + AIVirtualTargetSelectAction aIVirtualTargetSelectAction = new AIVirtualTargetSelectAction(aIVirtualCard, aIVirtualCard, AIOperationType.PLAY, (AISelectedTargetInfoSet)null); + if (field.IsCannotPlayByTag(aIVirtualTargetSelectAction, bestPlayPtn)) + { + break; + } + PlaySimulationType playType; + int useCost = aIVirtualCard.GetUseCost(field.AllyPp, EnemyAI.EmptyPlayPtn, aIVirtualTargetSelectAction, out playType); + if (useCost >= 0) + { + if (playType == PlaySimulationType.ChoiceTransform) + { + AISelectedTargetInfo choiceTargets = aIVirtualCard.GetChoiceSelectInfo(field, aIVirtualTargetSelectAction).GetChoiceTargets(aIVirtualCard, field, bestPlayPtn, aIVirtualTargetSelectAction); + AIVirtualCard aIVirtualCard2 = AITokenManager.ProcessToken(choiceTargets.FirstTarget.BaseCard, field); + aIVirtualCard2.BeforeTransformedCardForSimulation = aIVirtualCard; + aIVirtualTargetSelectAction.SetActor(aIVirtualCard2); + aIVirtualTargetSelectAction.SetChoicedMultipleTargetInInfo(choiceTargets.Targets); + } + else + { + SetRealActorToPlaySituation(aIVirtualTargetSelectAction, field, useCost, playType); + } + AIVirtualCard actor = aIVirtualTargetSelectAction.Actor; + int num2 = ((actor.IsUnit || actor.IsAmulet) ? 1 : 0); + if (field.AllyInplayCards.Count + num2 > 5 || !CheckTargetSelectPlayCondition(aIVirtualTargetSelectAction, field, playType)) + { + break; + } + PlaySimulationInfo playSimulationInfo = CreatePlaySimulationInfo(actor, aIVirtualTargetSelectAction, field); + if (playSimulationInfo == null) + { + break; + } + AIVirtualActionInfo item = new AIVirtualTargetSelectAction(actor, aIVirtualCard, AIOperationType.PLAY); + moves.Insert(moves.Count - 1, item); + AIVirtualPlaySimulator.PlayCard(aIVirtualTargetSelectAction, field, playSimulationInfo); + continue; + } + break; + } + } + + public static PlaySimulationInfo CreatePlaySimulationInfo(AIVirtualCard actor, AISituationInfo situation, AIVirtualField field) + { + AIVirtualCard aIVirtualCard = ((situation != null) ? situation.OriginalCard : actor); + if (aIVirtualCard.IsAlly && !aIVirtualCard.BasePlayable()) + { + return null; + } + int restPp = (aIVirtualCard.IsAlly ? field.AllyPp : field.EnemyPp); + PlaySimulationType playType; + int useCost = aIVirtualCard.GetUseCost(restPp, null, situation, out playType); + if (useCost < 0) + { + return null; + } + if (actor.IsAlly && !actor.IsSpell && playType != PlaySimulationType.Accelerate) + { + int num = 0; + for (int i = 0; i < field.AllyInplayCards.Count; i++) + { + if (!field.AllyInplayCards[i].IsDead) + { + num++; + } + } + if (num >= 5) + { + return null; + } + } + return new PlaySimulationInfo(actor, useCost, playType); + } + + public static void UpdateFieldWhenEvaluateSpellCard(AIVirtualCard playCard, AIVirtualField field) + { + AISpellboostSimulationUtility.SpellboostWhenPlaySpellAtEvaluation(playCard, field); + field.VirtualCemetery.AddCemetery(1, playCard.IsAlly); + } + + public static bool IsAbleToPlayCard(AIVirtualTargetSelectAction play, AIVirtualField field, List playPtn = null) + { + if (play.ActionType != AIOperationType.PLAY) + { + return false; + } + AIVirtualCard actor = play.Actor; + AIVirtualCard originalCard = play.OriginalCard; + if (!actor.IsAlly || !actor.IsSelfTurn) + { + return false; + } + if (!field.AllyHandCards.Contains(originalCard)) + { + return false; + } + if (field.IsCannotPlayByTag(play, playPtn)) + { + return false; + } + if (field.AI.PlayPtnRecorder.GetFixedCostWithCheckingPlayType(originalCard, field, playPtn, out var playType) < 0) + { + return false; + } + if (!CheckTargetSelectPlayCondition(play, field, playType)) + { + return false; + } + return true; + } + + public static bool CheckTargetSelectPlayCondition(AIVirtualTargetSelectAction play, AIVirtualField field, PlaySimulationType playType) + { + AIVirtualCard actor = play.Actor; + if (!actor.IsSpell && playType != PlaySimulationType.Accelerate) + { + return true; + } + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + if (actor.TagCollectionContainer.HasTagCollection(TagCollectionType.Play)) + { + PlayTagCollection playTags = actor.TagCollectionContainer.PlayTags; + List conditionPassedTargetSelectTagList = playTags.GetConditionPassedTargetSelectTagList(actor, field, play, emptyPlayPtn); + if (conditionPassedTargetSelectTagList != null && conditionPassedTargetSelectTagList.Count > 0) + { + if (!CheckTargetSelectCandidateCount(actor, play, field, conditionPassedTargetSelectTagList)) + { + return false; + } + List conditionPassedTargetSelectTagList2 = playTags.GetConditionPassedTargetSelectTagList(actor, field, play, emptyPlayPtn, AIScriptTokenArgType.SECOND_TARGET_SELECT); + if (conditionPassedTargetSelectTagList2 != null && conditionPassedTargetSelectTagList2.Count > 0 && !CheckTargetSelectCandidateCount(actor, play, field, conditionPassedTargetSelectTagList2)) + { + return false; + } + } + } + return true; + } + + private static bool CheckTargetSelectCandidateCount(AIVirtualCard playCard, AIVirtualTargetSelectAction play, AIVirtualField field, List targetSelectTagList) + { + for (int i = 0; i < targetSelectTagList.Count; i++) + { + AIWhenPlayTagArgument obj = targetSelectTagList[i].ArgumentExpressions as AIWhenPlayTagArgument; + List targetSelectCandidates = obj.GetTargetSelectCandidates(playCard, field, play); + int selectCount = obj.GetSelectCount(playCard, field, EnemyAI.EmptyPlayPtn, play); + if (targetSelectCandidates != null && targetSelectCandidates.Count >= selectCount) + { + return true; + } + } + return false; + } + + public static void CreateWhenPlayTagExecutingQueue(AIVirtualTargetSelectAction situation, AIVirtualField field, PlaySimulationType playType) + { + AIVirtualCard actor = situation.Actor; + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + actor.EnqueueGiveSkill(field, emptyPlayPtn, situation); + field.ExecuteWhenChangeInplayTags(emptyPlayPtn, situation); + if (actor.TagCollectionContainer.HasTagCollection(TagCollectionType.Fanfare)) + { + actor.TagCollectionContainer.FanfareTags.EnqueueConditionPassedTags(situation, field, emptyPlayPtn, isRemovalCheck: false); + } + if (actor.TagCollectionContainer.HasTagCollection(TagCollectionType.Play)) + { + actor.TagCollectionContainer.PlayTags.EnqueueConditionPassedTags(situation, field, emptyPlayPtn, isRemovalCheck: false); + } + if (situation.IsChoiceBrave || field.CardListSet.OtherPlayTagHolders == null) + { + return; + } + List otherPlayTagHolders = field.CardListSet.OtherPlayTagHolders; + for (int i = 0; i < otherPlayTagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = otherPlayTagHolders[i]; + if (!aIVirtualCard.IsSameCard(actor)) + { + aIVirtualCard.TagCollectionContainer.OtherPlayTags.EnqueueConditionPassedTags(aIVirtualCard, situation, field, emptyPlayPtn, playType); + } + } + } + + public static void SetChoiceTargetAsActor(AIVirtualTargetSelectAction situation) + { + AISelectedTargetInfo choiceInfo = situation.SelectedTargets.GetChoiceInfo(); + if (choiceInfo == null) + { + AIConsoleUtility.LogError("SetChoiceTargetAsActor error!! cannot find choiceTargetInfo!!!!!"); + return; + } + AIVirtualCard firstTarget = choiceInfo.FirstTarget; + AIVirtualField selfField = situation.Actor.SelfField; + AIVirtualCard aIVirtualCard = AITokenManager.ProcessToken(firstTarget.BaseCard, selfField); + selfField.AI.tokenManager.AddTokenFromCard(aIVirtualCard); + situation.SetActor(aIVirtualCard); + } + + private static int GetTransformCardId(AIVirtualCard playCard, AIVirtualField field, List playPtn, AIVirtualTargetSelectAction situation, int usedCost, PlaySimulationType playType) + { + int result = -1; + switch (playType) + { + case PlaySimulationType.Accelerate: + result = AIAccelerateUtility.GetConditionPassedAccelerateId(playCard, field, playPtn, situation, usedCost); + break; + case PlaySimulationType.Crystalize: + result = AICrystalizeUtility.GetCrystalizeId(playCard, usedCost); + break; + } + return result; + } + + public static bool SetRealActorToPlaySituation(AIVirtualTargetSelectAction play, AIVirtualField field, int usedCost, PlaySimulationType playType) + { + List bestPlayPtn = field.BestPlayPtn; + AIVirtualCard originalCard = play.OriginalCard; + int transformCardId = GetTransformCardId(originalCard, field, bestPlayPtn, play, usedCost, playType); + if (transformCardId <= 0) + { + return false; + } + AIVirtualCard tokenFromId = field.AI.tokenManager.GetTokenFromId(transformCardId, originalCard.IsAlly, field, needsClone: true); + tokenFromId.BeforeTransformedCardForSimulation = originalCard; + play.SetActor(tokenFromId); + field.AI.tokenManager.AddTokenFromCard(tokenFromId); + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayMove.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayMove.cs new file mode 100644 index 0000000..410aa7c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayMove.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Wizard; + +internal class AIPlayMove : AIMove +{ + public BattleCardBase Src { get; private set; } + + public List Targets { get; private set; } + + public AIPlayMove(BattleCardBase src, List targets) + : base(AIOperationType.PLAY) + { + Src = src; + Targets = targets; + } + + public override void RunOperation(BattleManagerBase mgr, bool isPlayer) + { + mgr.VfxMgr.RegisterSequentialVfx(mgr.OperateMgr.InitSetCard(Src, isPlayer)); + mgr.VfxMgr.RegisterSequentialVfx(mgr.OperateMgr.PlayCard(Src, isPlayer, Targets)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayOnSkillUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayOnSkillUtility.cs new file mode 100644 index 0000000..e5d11ae --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayOnSkillUtility.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIPlayOnSkillUtility +{ + public static int GetLifePenaltyOnPlay(BattleCardBase card, EnemyAI enemyAI) + { + int num = 0; + IEnumerable selfInjurySkillsOnPlay = GetSelfInjurySkillsOnPlay(card, enemyAI); + if (selfInjurySkillsOnPlay == null) + { + return num; + } + foreach (SkillBase item in selfInjurySkillsOnPlay) + { + num += GetSelfInjurySkillDamage(card, item, isNecromance: false, enemyAI); + } + return num; + } + + private static IEnumerable GetSelfInjurySkillsOnPlay(BattleCardBase card, EnemyAI enemyAI) + { + foreach (SkillBase skill in card.Skills) + { + if (!(skill is Skill_damage) || skill.IsWhenPlaySkill) + { + continue; + } + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(enemyAI.ALLY, enemyAI.OPPONENT); + if (!skill.CheckConditionAI(playerInfoPair, new SkillConditionCheckerOption(), isPrePlay: true)) + { + continue; + } + IEnumerable selectableCards = skill.GetSelectableCards(playerInfoPair, new SkillConditionCheckerOption()); + foreach (BattleCardBase item in selectableCards) + { + if (item == enemyAI.ALLY.Class) + { + yield return skill; + break; + } + } + } + } + + private static int GetSelfInjurySkillDamage(BattleCardBase card, SkillBase skill, bool isNecromance, EnemyAI enemyAI) + { + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(enemyAI.ALLY, enemyAI.OPPONENT); + SkillCollectionBase.SetupOptionValue(skill.OptionValue, playerInfoPair, card, skill); + return skill.OptionValue.GetInt(SkillFilterCreator.ContentKeyword.damage, 0); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayOutChecker.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayOutChecker.cs new file mode 100644 index 0000000..95e6a89 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayOutChecker.cs @@ -0,0 +1,264 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public class AIPlayOutChecker +{ + public static int CalculatePlayOutDamageProspected(AIParamQuery paramQuery, AIVirtualField field, AISinglePlayptnRecord playPtnRecord, EnemyAI ai) + { + List list = ((playPtnRecord == null) ? EnemyAI.EmptyPlayPtn : playPtnRecord.PlayPtn); + if (ai.StyleQuery.IsDisableLethalCheck(field, list)) + { + return 0; + } + List allyHandCards = field.AllyHandCards; + List list2 = field.EnemyInplayCards; + AIVirtualFieldRollBackBasicProcessor aIVirtualFieldRollBackBasicProcessor = new AIVirtualFieldRollBackBasicProcessor(field); + List guardFollowers = RemoveAllGuard(list2, field, list); + if (field.IsEnemyHasGuard()) + { + list2 = GetSurvivorOfPlayptnDamageToAll(paramQuery, allyHandCards, playPtnRecord, list2); + if (list2.Any((AIVirtualCard c) => c.IsGuard)) + { + ResetGuard(guardFollowers); + return GetTotalPlayoutDamageBonus(field, list); + } + } + if (field.EnemyClass.IsAllShield) + { + ResetGuard(guardFollowers); + return 0; + } + int num = 0; + int num2 = 0; + for (int num3 = 1; num3 < field.CardListSet.AllyClassAndInplayCards.Count; num3++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.AllyClassAndInplayCards[num3]; + AIVirtualAttackInfo attackLeaderSituation = aIVirtualCard.AttackLeaderSituation; + bool flag = AIAttackSimulationUtility.IsAttackPossible(field, attackLeaderSituation, list2); + if (flag) + { + AIPreprocessSimulationUtility.SimulatePreprocess(aIVirtualCard, attackLeaderSituation, field, AIScriptTokenArgType.WHEN_ATTACK, isPseudo: true); + } + num += CalculateInplayAttack(attackLeaderSituation, field, list2, paramQuery); + num += aIVirtualCard.GetAllPlayoutDamageBonus(field, list, attackLeaderSituation); + if (field.AllyBattlePlayer.IsEvolve && aIVirtualCard.IsUnit) + { + int num4 = 0; + if (flag) + { + num4 = field.EnemyClass.SimulateDamageAmount(aIVirtualCard.EvoAttackPlus); + } + if (num2 < num4) + { + num2 = num4; + } + } + } + for (int num5 = 0; num5 < list.Count; num5++) + { + int index = list[num5]; + AIVirtualCard aIVirtualCard2 = allyHandCards[index]; + PlayedCardInfo playedCardInfo = playPtnRecord?.PlayedCardList[num5]; + AIVirtualTargetSelectAction aIVirtualTargetSelectAction = new AIVirtualTargetSelectAction(aIVirtualCard2, aIVirtualCard2, AIOperationType.PLAY, (AISelectedTargetInfoSet)null); + if (playedCardInfo == null) + { + AIPreprocessSimulationUtility.SimulatePreprocess(aIVirtualCard2, aIVirtualTargetSelectAction, field, AIScriptTokenArgType.WHEN_PLAY, isPseudo: true); + } + else + { + AIPreprocessSimulationUtility.ExecuteRecordingToPlayedCardInfo(playedCardInfo, aIVirtualCard2, field, aIVirtualTargetSelectAction, isPseudo: true); + } + int num6 = 0; + if (!field.IsNoInstantAttack) + { + num6 = CalculatePlayoutAttackBonus(aIVirtualCard2, list, aIVirtualTargetSelectAction); + } + num += num6; + int allPlayoutDamageBonus = aIVirtualCard2.GetAllPlayoutDamageBonus(field, list, aIVirtualTargetSelectAction); + num += allPlayoutDamageBonus; + if (field.AllyBattlePlayer.IsEvolve) + { + int num7 = 0; + if (aIVirtualCard2.IsUnit && num6 > 0) + { + num7 += field.EnemyClass.SimulateDamageAmount(aIVirtualCard2.EvoAttackPlus); + } + if (num2 < num7) + { + num2 = num7; + } + } + field.UpdateVirtualFieldWhenEvaluation(aIVirtualCard2, aIVirtualTargetSelectAction); + } + ResetGuard(guardFollowers); + aIVirtualFieldRollBackBasicProcessor.ResetVirtualFieldToStart(); + for (int num8 = 0; num8 < field.AllyInplayCards.Count; num8++) + { + field.AllyInplayCards[num8].AttackLeaderSituation.PreprocessRecorder.RemoveAll(); + } + num += num2; + num += field.AllyClass.GetAllPlayoutDamageBonus(field, list, null); + return num + GetEnemyTotalPlayoutDamageBonus(field, list, null); + } + + private static int GetTotalPlayoutDamageBonus(AIVirtualField field, List playPtn) + { + int num = 0; + _ = field.AI.ALLY.IsEvolve; + for (int i = 0; i < playPtn.Count; i++) + { + AIVirtualCard card = field.AllyHandCards[playPtn[i]]; + num += card.GetAllPlayoutDamageBonus(field, playPtn, null); + } + for (int j = 1; j < field.CardListSet.AllyClassAndInplayCards.Count; j++) + { + AIVirtualCard card2 = field.CardListSet.AllyClassAndInplayCards[j]; + num += card2.GetAllPlayoutDamageBonus(field, playPtn, null); + } + return num + GetEnemyTotalPlayoutDamageBonus(field, playPtn, null); + } + + private static int GetEnemyTotalPlayoutDamageBonus(AIVirtualField field, List playPtn, AISituationInfo situation) + { + int num = 0; + for (int i = 0; i < field.CardListSet.EnemyClassAndInplayCards.Count; i++) + { + AIVirtualCard card = field.CardListSet.EnemyClassAndInplayCards[i]; + num += card.GetAllPlayoutDamageBonus(field, playPtn, situation); + } + return num; + } + + private static List GetSurvivorOfPlayptnDamageToAll(AIParamQuery query, List handCards, AISinglePlayptnRecord playPtnRecord, List opponentInplayCards) + { + List list = new List(); + AIVirtualField currentVirtualField = query.enemyAI.CurrentVirtualField; + if (playPtnRecord == null) + { + return list; + } + List list2 = new List(); + for (int i = 0; i < opponentInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = opponentInplayCards[i]; + list2.Add(new LifeRecord + { + MaxLife = aIVirtualCard.MaxLife, + CurrentLife = aIVirtualCard.Life + }); + } + List playPtn = playPtnRecord.PlayPtn; + for (int j = 0; j < playPtn.Count; j++) + { + AIVirtualCard aIVirtualCard2 = handCards[playPtn[j]]; + AIVirtualCard transformCard = playPtnRecord.PlayedCardList[j].TransformCard; + AIVirtualTargetSelectAction situation = new AIVirtualTargetSelectAction((transformCard != null) ? transformCard : aIVirtualCard2, aIVirtualCard2, AIOperationType.PLAY); + AISimulationRemovalUtility.PredictSurvivorsLifeAfterCardPlay(aIVirtualCard2, opponentInplayCards, currentVirtualField, playPtn, situation, list2); + } + for (int k = 0; k < list2.Count; k++) + { + if (list2[k].CurrentLife > 0) + { + list.Add(opponentInplayCards[k]); + } + } + return list; + } + + private static List RemoveAllGuard(List inplayCards, AIVirtualField field, List playPtn) + { + if (playPtn == null || playPtn.Count <= 0) + { + return null; + } + List list = null; + List list2 = inplayCards.Where((AIVirtualCard c) => c.IsGuard).ToList(); + if (list2.Count <= 0) + { + return null; + } + for (int num = 0; num < playPtn.Count; num++) + { + AIVirtualCard aIVirtualCard = field.AllyHandCards[playPtn[num]]; + if (!aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.Fanfare)) + { + continue; + } + FanfareTagCollection fanfareTags = aIVirtualCard.TagCollectionContainer.FanfareTags; + if (!fanfareTags.HasRemoveKeywordSkillTags) + { + continue; + } + AIVirtualTargetSelectAction situation = new AIVirtualTargetSelectAction(aIVirtualCard, aIVirtualCard, AIOperationType.PLAY, (AISelectedTargetInfoSet)null); + List list3 = fanfareTags.RemoveGuardPrediction(aIVirtualCard, list2, field, playPtn, situation); + if (list3 != null) + { + list = AIParamQuery.AddRangeToList(list3, list); + list2.RemoveAll((AIVirtualCard c) => !c.IsGuard); + if (list2.Count <= 0) + { + break; + } + } + } + return list; + } + + private static void ResetGuard(List guardFollowers) + { + if (guardFollowers != null && guardFollowers.Count > 0) + { + for (int i = 0; i < guardFollowers.Count; i++) + { + guardFollowers[i].IsGuard = true; + } + } + } + + private static int CalculateInplayAttack(AIVirtualAttackInfo attackSituation, AIVirtualField field, List opponentInPlayCards, AIParamQuery paramQuery) + { + AIVirtualCard actor = attackSituation.Actor; + if (!actor.IsUnit) + { + return 0; + } + if (!AIAttackSimulationUtility.IsAttackPossible(field, attackSituation, opponentInPlayCards)) + { + return 0; + } + int attackDamageToCertainCard = AIAttackTagSimulator.GetAttackDamageToCertainCard(field, attackSituation, actor); + AISimulationBuffInfo aISimulationBuffInfo = AIAttackTagSimulator.GetBuffInfoListWhenCertainAttack(field, attackSituation)?.GetBuffInfoToCertainCard(actor); + int num = aISimulationBuffInfo?.TotalAttackBuff ?? 0; + int num2 = aISimulationBuffInfo?.TotalLifeBuff ?? 0; + int allyAttack = actor.Attack + num; + int allyLife = actor.Life + num2 - attackDamageToCertainCard; + return CalculateDamageToLeader(attackSituation, allyAttack, allyLife); + } + + private static int CalculatePlayoutAttackBonus(AIVirtualCard attacker, List playPtn, AISituationInfo playSituation) + { + AIVirtualAttackInfo attackLeaderSituation = attacker.AttackLeaderSituation; + AISimulationBuffInfo aISimulationBuffInfo = AIAttackTagSimulator.GetBuffInfoListWhenCertainAttack(attacker.SelfField, attackLeaderSituation)?.GetBuffInfoToCertainCard(attacker); + int num = aISimulationBuffInfo?.TotalAttackBuff ?? 0; + int num2 = aISimulationBuffInfo?.TotalLifeBuff ?? 0; + int allyAttack = attacker.GetPlayoutAttackBonus(playPtn, playSituation) + num; + int attackDamageToCertainCard = AIAttackTagSimulator.GetAttackDamageToCertainCard(attacker.SelfField, attackLeaderSituation, attacker); + int allyLife = attacker.Life + num2 - attackDamageToCertainCard; + return CalculateDamageToLeader(attackLeaderSituation, allyAttack, allyLife); + } + + private static int CalculateDamageToLeader(AIVirtualAttackInfo situation, int allyAttack, int allyLife) + { + if (allyAttack <= 0 || allyLife <= 0) + { + return 0; + } + if (AIAttackTagSimulator.GetAttackDamageToCertainCard(situation.Actor.SelfField, situation, situation.Actor) >= allyLife) + { + return 0; + } + return allyAttack; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayPtnUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayPtnUtility.cs new file mode 100644 index 0000000..214f884 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayPtnUtility.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIPlayPtnUtility +{ + public static bool IsInPlayPtn(AIVirtualCard card, List playPtn) + { + AIVirtualField selfField = card.SelfField; + for (int i = 0; i < playPtn.Count; i++) + { + if (selfField.AllyHandCards[playPtn[i]].IsSameCard(card)) + { + return true; + } + } + return false; + } + + public static int GetBeforePlayPtnCount(List filters, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (playPtn == null || playPtn.Count <= 0) + { + return 0; + } + int num = -1; + AIVirtualField selfField = tagOwner.SelfField; + for (int i = 0; i < playPtn.Count; i++) + { + if (selfField.AllyHandCards[playPtn[i]].IsSameCard(tagOwner)) + { + num = i; + break; + } + } + if (num == -1) + { + return 0; + } + return GetPlayPtnCardCount(filters, tagOwner, playPtn.GetRange(0, num), situation); + } + + public static int GetPlayPtnCardCount(List filters, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (playPtn == null || playPtn.Count <= 0) + { + return 0; + } + AIVirtualField selfField = tagOwner.SelfField; + List list = new List(); + for (int i = 0; i < playPtn.Count; i++) + { + list.Add(selfField.AllyHandCards[playPtn[i]]); + } + return AIFilteringUtility.MultipleFiltering(list, filters, tagOwner, playPtn, situation)?.Count ?? 0; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipIfEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipIfEvo.cs new file mode 100644 index 0000000..9000ffb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipIfEvo.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIPlaySkipIfEvo : AIPlaySkipWithFilteredTargets +{ + public AIPlaySkipIfEvo(string text) + : base(text) + { + } + + public override PlaySkipInformation CreatePlaySkipInformation(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + PlaySkipIfEvoInformation playSkipIfEvoInformation = new PlaySkipIfEvoInformation(); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null) + { + playSkipIfEvoInformation.AddEvolutionPermittedCards(targetsFromField); + } + return playSkipIfEvoInformation; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipTagArgument.cs new file mode 100644 index 0000000..e30472f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipTagArgument.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIPlaySkipTagArgument : AIScriptArgumentExpressions +{ + public AIPlaySkipTagArgument(string text) + : base(text) + { + } + + public virtual PlaySkipInformation CreatePlaySkipInformation(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return new PlaySkipInformation(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithAction.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithAction.cs new file mode 100644 index 0000000..d113035 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithAction.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIPlaySkipWithAction : AIPlaySkipTagArgument +{ + private AIScriptTokenArgType _action; + + public AIPlaySkipWithAction(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _action = AIScriptTokenArgType.NONE; + if (_exprList.Count >= 1) + { + _action = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[0]); + } + } + + public override PlaySkipInformation CreatePlaySkipInformation(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return new PlaySkipWithActionInformation(_action); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithActionIfEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithActionIfEvo.cs new file mode 100644 index 0000000..e150174 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithActionIfEvo.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIPlaySkipWithActionIfEvo : AIPlaySkipWithFilteredTargets +{ + private AIScriptTokenArgType _action; + + private readonly int ACTION_TYPE_ARG = 1; + + public AIPlaySkipWithActionIfEvo(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _action = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - ACTION_TYPE_ARG]); + base.Filters = GetFilters(_exprList.GetRange(0, _exprList.Count - ACTION_TYPE_ARG)); + } + + public override PlaySkipInformation CreatePlaySkipInformation(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + PlaySkipWithActionIfEvoInformation playSkipWithActionIfEvoInformation = new PlaySkipWithActionIfEvoInformation(_action); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null) + { + playSkipWithActionIfEvoInformation.AddEvolutionPermittedCards(targetsFromField); + } + return playSkipWithActionIfEvoInformation; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithEvo.cs new file mode 100644 index 0000000..922e7b7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithEvo.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIPlaySkipWithEvo : AIPlaySkipWithFilteredTargets +{ + public AIPlaySkipWithEvo(string text) + : base(text) + { + } + + public override PlaySkipInformation CreatePlaySkipInformation(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + PlaySkipWithEvoInformation playSkipWithEvoInformation = new PlaySkipWithEvoInformation(); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null) + { + playSkipWithEvoInformation.AddEvolutionPermittedCards(targetsFromField); + } + return playSkipWithEvoInformation; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithFilteredTargets.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithFilteredTargets.cs new file mode 100644 index 0000000..a47257a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlaySkipWithFilteredTargets.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIPlaySkipWithFilteredTargets : AIPlaySkipTagArgument +{ + public List Filters { get; protected set; } + + public AIPlaySkipWithFilteredTargets(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + InitializeFilter(); + } + + private void InitializeFilter() + { + Filters = GetFilters(_exprList); + } + + protected List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + List candidateRange = GetCandidateRange(field); + return GetFilteredTargets(candidateRange, owner, playPtn, situation, isBlockDead); + } + + private List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, Filters, playPtn, situation, isBlockDead); + } + + private List GetCandidateRange(AIVirtualField field) + { + return field.AllyInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayTagInitializingUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayTagInitializingUtility.cs new file mode 100644 index 0000000..db48da5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayTagInitializingUtility.cs @@ -0,0 +1,303 @@ +using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; +using Wizard.Battle.UI; + +namespace Wizard; + +public static class AIPlayTagInitializingUtility +{ + private static readonly AIScriptTokenArgType[] LegalClassType = new AIScriptTokenArgType[9] + { + AIScriptTokenArgType.NEUTRAL, + AIScriptTokenArgType.ELF, + AIScriptTokenArgType.ROYAL, + AIScriptTokenArgType.WITCH, + AIScriptTokenArgType.DRAGON, + AIScriptTokenArgType.NECROMANCER, + AIScriptTokenArgType.VAMPIRE, + AIScriptTokenArgType.BISHOP, + AIScriptTokenArgType.NEMESIS + }; + + private static readonly AIScriptTokenArgType[] LegalTribeType = new AIScriptTokenArgType[16] + { + AIScriptTokenArgType.LEGION, + AIScriptTokenArgType.LORD, + AIScriptTokenArgType.LEVIN, + AIScriptTokenArgType.WHITE_RITUAL, + AIScriptTokenArgType.MANARIA, + AIScriptTokenArgType.ARTIFACT, + AIScriptTokenArgType.FOOD, + AIScriptTokenArgType.LOOT, + AIScriptTokenArgType.MACHINE, + AIScriptTokenArgType.NATURE, + AIScriptTokenArgType.BANQUET, + AIScriptTokenArgType.HERO, + AIScriptTokenArgType.ARMED, + AIScriptTokenArgType.HELLBOUND, + AIScriptTokenArgType.SCHOOL, + AIScriptTokenArgType.CHESS + }; + + private static AIScriptTokenArgType[] LegalTokenSideType = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.BOTH, + AIScriptTokenArgType.ALLY, + AIScriptTokenArgType.OPPONENT, + AIScriptTokenArgType.SELECTED_TARGET_SIDE + }; + + public static List SplitTagText(string text) + { + List list = new List(); + int num = -1; + int num2 = 0; + bool flag = true; + for (int i = 0; i < text.Length; i++) + { + switch (text[i]) + { + case '{': + if (flag) + { + if (i > 0) + { + list.Add(text.Substring(0, i - 2)); + } + flag = false; + } + num2++; + if (num == -1) + { + num = i; + } + break; + case '}': + num2--; + if (num2 == 0 && num < i && num >= 0) + { + list.Add(text.Substring(num, i + 1 - num)); + num = -1; + } + break; + } + } + return list; + } + + public static string TrimAttachTagArgument(string text) + { + string pattern = "(^{ | }$|}$)"; + return Regex.Replace(text, pattern, ""); + } + + public static AIPlayTag CreateAIPlayTagFromWords(string type, string arg, string cond) + { + AIPlayTagAsset aIPlayTagAsset = new AIPlayTagAsset(); + aIPlayTagAsset.Type = TrimAttachTagArgument(type); + aIPlayTagAsset.Arg = TrimAttachTagArgument(arg); + aIPlayTagAsset.Condition = TrimAttachTagArgument(cond); + AIPlayTag aIPlayTag = new AIPlayTag(); + if (!aIPlayTag.InitFromTextAsset(aIPlayTagAsset)) + { + return null; + } + return aIPlayTag; + } + + public static AIScriptTokenArgType CreateSingleArgType(AIPolishConvertedExpression expression, AIScriptTokenArgType[] legalTypes = null) + { + if (!(expression.TokenList[0] is AIScriptArgumentToken aIScriptArgumentToken)) + { + AIConsoleUtility.LogError("CreateSingleArgType error!! arg = null!!!!!"); + return AIScriptTokenArgType.NONE; + } + if (legalTypes != null && Array.IndexOf(legalTypes, aIScriptArgumentToken.ArgumentType) < 0) + { + AIConsoleUtility.LogError("Argument is not legalTypes!! argType == " + aIScriptArgumentToken.ArgumentType); + return aIScriptArgumentToken.ArgumentType; + } + return aIScriptArgumentToken.ArgumentType; + } + + public static List CloneTagList(List src) + { + return AIParamQuery.CloneList(src); + } + + public static bool IsInitOfFilterSet(AIPolishConvertedExpression arg) + { + if (arg.TokenList != null && arg.TokenList.Count > 0 && arg.TokenList[0] is AIScriptArgumentToken { IsNot: false } aIScriptArgumentToken) + { + int argumentType = (int)aIScriptArgumentToken.ArgumentType; + if (argumentType > 83 && argumentType < 106) + { + return true; + } + } + return false; + } + + public static CardBasePrm.ClanType CreateClassType(AIPolishConvertedExpression expr) + { + return ConvertTokenArgTypeToClanType(CreateSingleArgType(expr, LegalClassType)); + } + + public static CardBasePrm.TribeType CreateTribeType(AIPolishConvertedExpression expr) + { + return AITribeSimulationUtility.ConvertTokenArgTypeToTribeType(CreateSingleArgType(expr, LegalTribeType)); + } + + public static CardBasePrm.ClanType ConvertTokenArgTypeToClanType(AIScriptTokenArgType tokenArgType) + { + return tokenArgType switch + { + AIScriptTokenArgType.NEUTRAL => CardBasePrm.ClanType.ALL, + AIScriptTokenArgType.ELF => CardBasePrm.ClanType.MIN, + AIScriptTokenArgType.ROYAL => CardBasePrm.ClanType.ROYAL, + AIScriptTokenArgType.WITCH => CardBasePrm.ClanType.WITCH, + AIScriptTokenArgType.DRAGON => CardBasePrm.ClanType.DRAGON, + AIScriptTokenArgType.NECROMANCER => CardBasePrm.ClanType.NECRO, + AIScriptTokenArgType.VAMPIRE => CardBasePrm.ClanType.VAMPIRE, + AIScriptTokenArgType.BISHOP => CardBasePrm.ClanType.BISHOP, + AIScriptTokenArgType.NEMESIS => CardBasePrm.ClanType.NEMESIS, + _ => CardBasePrm.ClanType.NONE, + }; + } + + public static AIPlayTag CreateTurnStartSubtractCountdownTagForCountdownAmulet() + { + AIPlayTagAsset aIPlayTagAsset = new AIPlayTagAsset(); + aIPlayTagAsset.Type = "turnStartSubtractCountdown"; + aIPlayTagAsset.Arg = "SELF ; ALL_SELECT ; 1 ; ALLY"; + aIPlayTagAsset.Condition = ""; + AIPlayTag aIPlayTag = new AIPlayTag(); + aIPlayTag.InitFromTextAsset(aIPlayTagAsset); + return aIPlayTag; + } + + public static AIPlayTag CreateBasicSkillTag(AIScriptTokenArgType skillType) + { + if (!GiveSkillTagCollection.IsGiveSkillManagedSkillType(skillType)) + { + AIConsoleUtility.LogError($"AIPlayTagInitializingUtility.CreateBasicSkilltag() error!! skillType:{skillType} is invalid!!"); + return null; + } + AIPlayTagAsset aIPlayTagAsset = new AIPlayTagAsset(); + aIPlayTagAsset.Type = "giveSkill"; + aIPlayTagAsset.Arg = skillType.ToString(); + aIPlayTagAsset.Condition = ""; + AIPlayTag aIPlayTag = new AIPlayTag(); + aIPlayTag.InitFromTextAsset(aIPlayTagAsset); + return aIPlayTag; + } + + public static bool TryCreateTokenSideType(AIPolishConvertedExpression expression, out AIScriptTokenArgType sideType) + { + if (expression.TokenList.Count > 1) + { + sideType = AIScriptTokenArgType.NONE; + return false; + } + if (!(expression.TokenList[0] is AIScriptArgumentToken aIScriptArgumentToken) || Array.IndexOf(LegalTokenSideType, aIScriptArgumentToken.ArgumentType) < 0) + { + sideType = AIScriptTokenArgType.NONE; + return false; + } + sideType = aIScriptArgumentToken.ArgumentType; + return true; + } + + public static bool TryCreateSelectType(AIPolishConvertedExpression expression, AIScriptTokenArgType[] legalSelectTypes, out AIScriptTokenArgType selectType) + { + if (expression.TokenList[0] is AIScriptArgumentToken aIScriptArgumentToken && Array.IndexOf(legalSelectTypes, aIScriptArgumentToken.ArgumentType) >= 0) + { + selectType = aIScriptArgumentToken.ArgumentType; + return true; + } + selectType = AIScriptTokenArgType.ALL_SELECT; + return false; + } + + public static AIScriptTokenArgType GetDamageTypeFromExprList(AIPolishConvertedExpression expression, out bool isDamageTypeDefinedByMaster) + { + isDamageTypeDefinedByMaster = false; + if (expression.TokenList[0] is AIScriptArgumentToken aIScriptArgumentToken && Array.IndexOf(AIBarrierSimulationUtility.LegalDamageType, aIScriptArgumentToken.ArgumentType) >= 0) + { + isDamageTypeDefinedByMaster = true; + return aIScriptArgumentToken.ArgumentType; + } + return AIScriptTokenArgType.ALL_DAMAGE; + } + + public static List InitializeStopTimingList(AIPolishConvertedExpression stopTimingExpresstion) + { + List list = new List(); + List tokenList = stopTimingExpresstion.TokenList; + if (tokenList == null || tokenList.Count <= 0) + { + list.Add(AIScriptTokenArgType.NONE); + return list; + } + if (tokenList.Count == 1) + { + list.Add(CreateSingleArgType(stopTimingExpresstion, AIBarrierSimulationUtility.LegalStopTimingList)); + } + else + { + for (int i = 0; i < tokenList.Count; i++) + { + AIScriptTokenBase aIScriptTokenBase = tokenList[i]; + if ((!(aIScriptTokenBase is AIScriptOperatorSymbolToken) || aIScriptTokenBase.Type != AIScriptTokenType.OR) && aIScriptTokenBase is AIScriptArgumentToken { ArgumentType: var argumentType } && Array.IndexOf(AIBarrierSimulationUtility.LegalStopTimingList, argumentType) >= 0) + { + list.Add(argumentType); + } + } + } + if (list.Count <= 0) + { + list.Add(AIScriptTokenArgType.NONE); + } + return list; + } + + public static List GetFilterExpressionList(List exprList, int nonFilterFirstOffset) + { + int num = exprList.Count - nonFilterFirstOffset; + if (num > 0) + { + return exprList.GetRange(0, num); + } + return null; + } + + public static CantAttackType CreateBanAttackType(AIPolishConvertedExpression expression) + { + if (expression.TokenList == null || expression.TokenList.Count <= 0) + { + return CantAttackType.Null; + } + if (!(expression.TokenList[0] is AIScriptArgumentToken { ArgumentType: var argumentType } aIScriptArgumentToken)) + { + return CantAttackType.Null; + } + switch (argumentType) + { + case AIScriptTokenArgType.ALL: + return CantAttackType.All; + case AIScriptTokenArgType.FOLLOWER: + return CantAttackType.Unit; + case AIScriptTokenArgType.CLASS: + return CantAttackType.Class; + case AIScriptTokenArgType.GUARD: + if (aIScriptArgumentToken.IsNot) + { + return CantAttackType.NotHasGuard; + } + return CantAttackType.Null; + default: + return CantAttackType.Null; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayTokenSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayTokenSimulationUtility.cs new file mode 100644 index 0000000..1c935ae --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayTokenSimulationUtility.cs @@ -0,0 +1,216 @@ +using System.Collections.Generic; +using Cute; + +namespace Wizard; + +public static class AIPlayTokenSimulationUtility +{ + public static List GetSingleCardAllySideWhenPlayTokenIds(AIVirtualField field, List playPtn, AISituationInfo situation) + { + List list = null; + if (situation == null || situation.ActionType != AIOperationType.PLAY) + { + AIConsoleUtility.LogError("AIPlayTokenSimulationUtility.GetSingleCardAllySideWhenPlayTokenIds() error!! situation == null or situation.ActionType != PLAY"); + return null; + } + AIVirtualCard actor = situation.Actor; + if (actor.TagCollectionContainer.HasTagCollection(TagCollectionType.Fanfare)) + { + FanfareTagCollection fanfareTags = actor.TagCollectionContainer.FanfareTags; + if (fanfareTags.HasSummonTokenTags) + { + List allySideWhenPlaySummonTokenIdList = fanfareTags.GetAllySideWhenPlaySummonTokenIdList(actor, field, playPtn, situation); + if (allySideWhenPlaySummonTokenIdList != null && allySideWhenPlaySummonTokenIdList.Count > 0) + { + list = AIParamQuery.AddRangeToList(allySideWhenPlaySummonTokenIdList, list); + } + } + } + if (actor.TagCollectionContainer.HasTagCollection(TagCollectionType.Play)) + { + PlayTagCollection playTags = actor.TagCollectionContainer.PlayTags; + if (playTags.HasSummonTokenTags) + { + List allySideWhenPlaySummonTokenIdList2 = playTags.GetAllySideWhenPlaySummonTokenIdList(actor, field, playPtn, situation); + if (allySideWhenPlaySummonTokenIdList2 != null && allySideWhenPlaySummonTokenIdList2.Count > 0) + { + list = AIParamQuery.AddRangeToList(allySideWhenPlaySummonTokenIdList2, list); + } + } + } + return list; + } + + public static List GetAllySideOtherPlayTokenIds(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.OtherPlayToken)) + { + return null; + } + return tagOwner.TagCollectionContainer.OtherPlayTags.GetAllySideTokenIds(tagOwner, field, playPtn, situation); + } + + public static AITokenIdCollection GetSingleCardBothSideWhenPlayTokenIds(AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (situation == null || situation.ActionType != AIOperationType.PLAY) + { + AIConsoleUtility.LogError("AIPlayTokenSimulationUtility.GetSingleCardBothSideWhenPlayTokenIds() error!! situation == null or situation.ActionType != PLAY"); + return null; + } + AIVirtualCard actor = situation.Actor; + AITokenIdCollection aITokenIdCollection = null; + if (actor.TagCollectionContainer.HasTagCollection(TagCollectionType.Fanfare)) + { + FanfareTagCollection fanfareTags = actor.TagCollectionContainer.FanfareTags; + if (fanfareTags.HasSummonTokenTags) + { + aITokenIdCollection = fanfareTags.GetBothSideWhenPlaySummonTokenIdList(actor, field, playPtn, situation); + } + } + if (actor.TagCollectionContainer.HasTagCollection(TagCollectionType.Play)) + { + PlayTagCollection playTags = actor.TagCollectionContainer.PlayTags; + if (playTags.HasSummonTokenTags) + { + AITokenIdCollection bothSideWhenPlaySummonTokenIdList = playTags.GetBothSideWhenPlaySummonTokenIdList(actor, field, playPtn, situation); + if (bothSideWhenPlaySummonTokenIdList != null && bothSideWhenPlaySummonTokenIdList.HasToken) + { + aITokenIdCollection = AITokenIdCollection.CombineTwoCollection(aITokenIdCollection, bothSideWhenPlaySummonTokenIdList); + } + } + } + return aITokenIdCollection; + } + + public static AITokenIdCollection GetOtherPlayTokenIdCollection(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.OtherPlayToken)) + { + return null; + } + return tagOwner.TagCollectionContainer.OtherPlayTags.GetBothSideTokenIdCollection(tagOwner, field, playPtn, situation); + } + + public static List GetAllySideTokenIdsOfPlaySituation(AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (situation == null || situation.ActionType != AIOperationType.PLAY) + { + AIConsoleUtility.LogError("AIPlayTokenSimulationUtility.GetAllySideTokenIdsOfPlaySituation() error!! situation == null or situation.ActionType != PLAY"); + return null; + } + List list = null; + List singleCardAllySideWhenPlayTokenIds = GetSingleCardAllySideWhenPlayTokenIds(field, playPtn, situation); + if (singleCardAllySideWhenPlayTokenIds != null) + { + list = AIParamQuery.AddRangeToList(singleCardAllySideWhenPlayTokenIds, list); + } + List list2 = new List(field.CardListSet.BothClassAndInplayCards); + for (int i = 0; i < playPtn.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyHandCards[playPtn[i]]; + if (aIVirtualCard.IsSameCard(situation.OriginalCard)) + { + break; + } + if (!aIVirtualCard.IsSpell && !aIVirtualCard.IsAccelerated(field, playPtn.GetRange(0, i + 1), situation)) + { + list2.Add(aIVirtualCard); + } + } + for (int j = 0; j < list2.Count; j++) + { + singleCardAllySideWhenPlayTokenIds = GetAllySideOtherPlayTokenIds(list2[j], field, playPtn, situation); + if (singleCardAllySideWhenPlayTokenIds != null && singleCardAllySideWhenPlayTokenIds.Count > 0) + { + list = AIParamQuery.AddRangeToList(singleCardAllySideWhenPlayTokenIds, list); + } + } + return list; + } + + public static AITokenIdCollection GetBothSideTokenIdsOfPlaySituation(AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (situation == null || situation.ActionType != AIOperationType.PLAY) + { + AIConsoleUtility.LogError("AIPlayTokenSimulationUtility.GetBothSideTokenIdsOfPlaySituation() error!! situation == null or situation.ActionType != PLAY"); + return null; + } + AITokenIdCollection aITokenIdCollection = GetSingleCardBothSideWhenPlayTokenIds(field, playPtn, situation); + List list = new List(field.CardListSet.BothClassAndInplayCards); + for (int i = 0; i < playPtn.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyHandCards[playPtn[i]]; + if (aIVirtualCard.IsSameCard(situation.OriginalCard)) + { + break; + } + if (!aIVirtualCard.IsSpell && !aIVirtualCard.IsAccelerated(field, playPtn.GetRange(0, i + 1), situation)) + { + list.Add(aIVirtualCard); + } + } + for (int j = 0; j < list.Count; j++) + { + AITokenIdCollection otherPlayTokenIdCollection = GetOtherPlayTokenIdCollection(list[j], field, playPtn, situation); + if (otherPlayTokenIdCollection != null && otherPlayTokenIdCollection.HasToken) + { + aITokenIdCollection = AITokenIdCollection.CombineTwoCollection(aITokenIdCollection, otherPlayTokenIdCollection); + } + } + return aITokenIdCollection; + } + + public static int GetPlayTokenCount(List filters, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (playPtn == null || playPtn.Count <= 0) + { + return 0; + } + int num = 0; + AIVirtualField selfField = tagOwner.SelfField; + AISinglePlayptnRecord playptnRecordOnSim = selfField.GetPlayptnRecordOnSim(playPtn); + for (int i = 0; i < playPtn.Count; i++) + { + if (selfField.AllyHandCards.Count <= playPtn[i]) + { + AIConsoleUtility.LogError("AIVirtualField GetPlayTokenCount Error!! AllyHandCards out of range!!!!!"); + continue; + } + AIVirtualCard aIVirtualCard = selfField.AllyHandCards[playPtn[i]]; + AIVirtualCard actor = aIVirtualCard; + if (playptnRecordOnSim != null) + { + PlayedCardInfo playedCardInfo = playptnRecordOnSim.PlayedCardList[i]; + if (playedCardInfo.TransformCard != null) + { + actor = playedCardInfo.TransformCard; + } + } + AIVirtualTargetSelectAction situation2 = new AIVirtualTargetSelectAction(actor, aIVirtualCard, AIOperationType.PLAY, situation?.SelectedTargets); + List allySideTokenIdsOfPlaySituation = GetAllySideTokenIdsOfPlaySituation(selfField, playPtn, situation2); + if (allySideTokenIdsOfPlaySituation == null) + { + continue; + } + List list = new List(); + for (int j = 0; j < allySideTokenIdsOfPlaySituation.Count; j++) + { + AIVirtualCard tokenFromId = selfField.AI.tokenManager.GetTokenFromId(allySideTokenIdsOfPlaySituation[j].TokenId, aIVirtualCard.IsAlly, selfField); + if (tokenFromId != null) + { + list.Add(tokenFromId); + } + } + list = AIFilteringUtility.MultipleFiltering(list, filters, tagOwner, playPtn, situation); + if (list.IsNotNullOrEmpty()) + { + num += allySideTokenIdsOfPlaySituation.Count; + } + if (aIVirtualCard.IsSameCard(tagOwner)) + { + break; + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayptnBaseStatsRate.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayptnBaseStatsRate.cs new file mode 100644 index 0000000..a6cf5ee --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayptnBaseStatsRate.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIPlayptnBaseStatsRate : AIFiltersArgument +{ + private AIPolishConvertedExpression _rate; + + private int RATE_INDX_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => RATE_INDX_OFFSET; + + public AIPlayptnBaseStatsRate(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _rate = _exprList[_exprList.Count - RATE_INDX_OFFSET]; + } + + public int GetRateValue(AIVirtualCard tagOwner, AIVirtualField field, List playPtn) + { + return (int)_rate.EvalArg(tagOwner, playPtn, field); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayptnBaseStatsRateUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayptnBaseStatsRateUtility.cs new file mode 100644 index 0000000..1998b59 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayptnBaseStatsRateUtility.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIPlayptnBaseStatsRateUtility +{ + public static void Execute(List srcCards, List targetCards, List playPtn) + { + for (int i = 0; i < srcCards.Count; i++) + { + AIVirtualCard aIVirtualCard = srcCards[i]; + if (!aIVirtualCard.TagCollectionContainer.HasTag(AIPlayTagType.PlayptnBaseStatsRate)) + { + continue; + } + List executeInfo = aIVirtualCard.TagCollectionContainer.PlayptnBaseStatsRateTags.GetExecuteInfo(aIVirtualCard, aIVirtualCard.SelfField, playPtn, targetCards); + if (executeInfo == null || executeInfo.Count <= 0) + { + continue; + } + for (int j = 0; j < executeInfo.Count; j++) + { + PlayptnBaseStatsRateInfo playptnBaseStatsRateInfo = executeInfo[j]; + for (int k = 0; k < playptnBaseStatsRateInfo.Targets.Count; k++) + { + AIVirtualCard aIVirtualCard2 = playptnBaseStatsRateInfo.Targets[k]; + aIVirtualCard2.MultiplyAttack(playptnBaseStatsRateInfo.Rate); + aIVirtualCard2.MultiplyLife(playptnBaseStatsRateInfo.Rate); + } + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPreprocessSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIPreprocessSimulationUtility.cs new file mode 100644 index 0000000..4617f42 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPreprocessSimulationUtility.cs @@ -0,0 +1,179 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIPreprocessSimulationUtility +{ + public static void SimulatePreprocess(AIVirtualCard activator, AISituationInfo situation, AIVirtualField field, AIScriptTokenArgType timing, bool isPseudo) + { + ExecuteEarthRite(activator, situation, field, timing, isPseudo); + ExecuteNecromance(activator, situation, field, timing, isPseudo); + ExecuteBurialRite(activator, situation, field, timing, isPseudo); + } + + public static void ResetPreprocess(AISituationInfo situation, AIVirtualField field) + { + AISimulationPreprocessRecorder preprocessRecorder = situation.PreprocessRecorder; + if (preprocessRecorder.HasRecord) + { + for (int i = 0; i < preprocessRecorder.RecordList.Count; i++) + { + ResetBySingleRecord(preprocessRecorder.RecordList[i], field); + } + preprocessRecorder.RemoveAll(); + } + } + + public static AIScriptTokenArgType ConvertAIOperationTypeToTiming(AIOperationType operationType) + { + return operationType switch + { + AIOperationType.PLAY => AIScriptTokenArgType.WHEN_PLAY, + AIOperationType.EVOLVE => AIScriptTokenArgType.WHEN_EVO, + AIOperationType.FUSION => AIScriptTokenArgType.WHEN_FUSION, + _ => AIScriptTokenArgType.NONE, + }; + } + + private static void ExecuteEarthRite(AIVirtualCard activator, AISituationInfo situation, AIVirtualField field, AIScriptTokenArgType timing, bool isPseudo) + { + int earthRiteCount = activator.GetEarthRiteCount(field, situation, timing); + if (earthRiteCount > 0) + { + AISinglePreprocessRecord record = new AISinglePreprocessRecord(activator, situation.OriginalCard, timing); + field.ExecuteEarthRite(activator.IsAlly, earthRiteCount, situation, isPseudo, record); + situation.PreprocessRecorder.AddRecord(record); + } + } + + private static void ExecuteNecromance(AIVirtualCard activator, AISituationInfo situation, AIVirtualField field, AIScriptTokenArgType timing, bool isPseudo) + { + int necromanceCountOrDefault = activator.GetNecromanceCountOrDefault(field, situation, timing); + if (necromanceCountOrDefault > 0) + { + AISinglePreprocessRecord record = new AISinglePreprocessRecord(activator, situation.OriginalCard, timing) + { + NecromanceCount = necromanceCountOrDefault + }; + SimulateNecromanceOnField(activator, situation, field, necromanceCountOrDefault, isPseudo); + situation.PreprocessRecorder.AddRecord(record); + } + } + + private static void SimulateNecromanceOnField(AIVirtualCard activator, AISituationInfo situation, AIVirtualField field, int necromanceCount, bool isPseudo) + { + field.VirtualCemetery.ExecuteNecromance(necromanceCount, activator.IsAlly, isPseudo); + if (!isPseudo) + { + ExecuteAllWhenNecromanceTags(field, situation); + if (activator.IsAlly) + { + field.AllyNecromancedCountInGame += necromanceCount; + } + else + { + field.EnemyNecromancedCountInGame += necromanceCount; + } + } + field.AllActivateCountHolderIncrement(situation, AIPlayTagType.NecromanceActivateCount, activator); + } + + private static void ExecuteBurialRite(AIVirtualCard activator, AISituationInfo situation, AIVirtualField field, AIScriptTokenArgType timing, bool isPseudo) + { + if (!AIBurialRite.CheckValidTimingType(timing)) + { + return; + } + if (isPseudo) + { + int burialRiteCount = activator.GetBurialRiteCount(field, situation, EnemyAI.EmptyPlayPtn, timing); + AISinglePreprocessRecord record = new AISinglePreprocessRecord(activator, situation.OriginalCard, timing) + { + BurialRiteCount = burialRiteCount + }; + situation.PreprocessRecorder.AddRecord(record); + return; + } + AISelectedTargetInfo burialRiteTarget = situation.GetBurialRiteTarget(); + if (burialRiteTarget != null) + { + AISinglePreprocessRecord record2 = new AISinglePreprocessRecord(activator, situation.OriginalCard, timing) + { + BurialRiteCount = burialRiteTarget.Targets.Count + }; + situation.PreprocessRecorder.AddRecord(record2); + AIBurialRiteSimulationUtility.ExecuteBurialRite(field, situation, burialRiteTarget); + } + } + + public static void ExecuteRecordingToPlayedCardInfo(PlayedCardInfo playedCardInfo, AIVirtualCard activator, AIVirtualField field, AISituationInfo situation, bool isPseudo) + { + AISimulationPreprocessRecorder preprocessRecorder = playedCardInfo.PreprocessRecorder; + if (preprocessRecorder != null && preprocessRecorder.HasRecord) + { + for (int i = 0; i < preprocessRecorder.RecordList.Count; i++) + { + ExecuteBySingleRecord(preprocessRecorder.RecordList[i], activator, field, situation, isPseudo); + } + if (playedCardInfo.HasPreDecidedSelectTargets) + { + situation.SelectedTargets = playedCardInfo.PreDecidedSelectTargets; + } + } + } + + private static void ExecuteBySingleRecord(AISinglePreprocessRecord record, AIVirtualCard activator, AIVirtualField field, AISituationInfo situation, bool isPseudo) + { + if (record.EarthRiteCount > 0) + { + field.ExecuteEarthRite(activator.IsAlly, record.EarthRiteCount, situation, isPseudo, record); + situation.PreprocessRecorder.AddRecord(record); + } + if (record.NecromanceCount > 0) + { + SimulateNecromanceOnField(activator, situation, field, record.NecromanceCount, isPseudo); + situation.PreprocessRecorder.AddRecord(record); + } + if (record.BurialRiteCount <= 0) + { + return; + } + if (isPseudo) + { + situation.PreprocessRecorder.AddRecord(record); + return; + } + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(AIScriptTokenArgType.TARGET_SELECT); + if (situationTarget != null && situationTarget.Type == TargetSelectType.BurialRite) + { + AIBurialRiteSimulationUtility.ExecuteBurialRite(field, situation, situationTarget); + situation.PreprocessRecorder.AddRecord(record); + } + } + + private static void ResetBySingleRecord(AISinglePreprocessRecord record, AIVirtualField field) + { + if (record.EarthRiteCount > 0) + { + record.RestoreAllEarthRiteCount(field); + } + if (record.NecromanceCount > 0) + { + field.VirtualCemetery.ResetNecromance(record.RealActor.IsAlly, record.NecromanceCount); + } + } + + private static void ExecuteAllWhenNecromanceTags(AIVirtualField field, AISituationInfo situation) + { + if (field.CardListSet.HasWhenNecromanceHolder) + { + List whenNecromanceTagHolders = field.CardListSet.WhenNecromanceTagHolders; + List bestPlayPtn = field.BestPlayPtn; + for (int i = 0; i < whenNecromanceTagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = whenNecromanceTagHolders[i]; + aIVirtualCard.TagCollectionContainer.NecromanceTags.Execute(aIVirtualCard, field, bestPlayPtn, situation); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIRealBattleCardSearcher.cs b/SVSim.BattleEngine/Engine/Wizard/AIRealBattleCardSearcher.cs new file mode 100644 index 0000000..5d8a185 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIRealBattleCardSearcher.cs @@ -0,0 +1,113 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public static class AIRealBattleCardSearcher +{ + public static BattleCardBase SearchBattleCardFromVirtualCard(BattlePlayerPair playerPair, AIVirtualCard virtualCard) + { + BattlePlayerBase battlePlayerBase = (virtualCard.IsAlly ? playerPair.Self : playerPair.Opponent); + if (virtualCard is ChoiceVirtualCard choiceVirtualCard) + { + return choiceVirtualCard.VirtualBattleCard; + } + BattleCardBase battleCardBase = null; + battleCardBase = ((!virtualCard.IsInHand) ? FindBattleCardFromList(virtualCard, battlePlayerBase.ClassAndInPlayCardList) : FindBattleCardFromList(virtualCard, battlePlayerBase.HandCardList)); + if (battleCardBase == null) + { + return null; + } + return battleCardBase; + } + + public static void SearchBattleCardFromSituation(BattlePlayerPair playerPair, AISituationInfo situation, out BattleCardBase actor, out List targetList) + { + actor = null; + targetList = null; + if (situation == null || situation.Actor == null) + { + AIConsoleUtility.LogError("SearchBattleCardFromSituation() error!!! situation is null"); + return; + } + AIVirtualCard actor2 = situation.Actor; + actor2.ResetPosition(situation.ActionType); + actor = SearchBattleCardFromVirtualCard(playerPair, actor2); + if (actor == null) + { + AIConsoleUtility.LogError("SearchBattleCardFromSituation() error!!! Not found actor"); + } + if (situation.SelectedTargets == null) + { + return; + } + AISelectedTargetInfoSet selectedTargets = situation.SelectedTargets; + AISelectedTargetInfo preprocessTarget = selectedTargets.PreprocessTarget; + if (preprocessTarget != null && preprocessTarget.HasTarget) + { + for (int i = 0; i < preprocessTarget.Targets.Count; i++) + { + BattleCardBase battleCardBase = SearchBattleCardFromVirtualCard(playerPair, preprocessTarget.Targets[i]); + if (battleCardBase != null) + { + targetList = AIParamQuery.AddElementToList(battleCardBase, targetList); + } + } + } + if (selectedTargets.HasChoiceTarget) + { + AISelectedTargetInfo choiceTarget = selectedTargets.ChoiceTarget; + for (int j = 0; j < choiceTarget.Targets.Count; j++) + { + BattleCardBase battleCardBase2 = SearchBattleCardFromVirtualCard(playerPair, choiceTarget.Targets[j]); + if (battleCardBase2 != null) + { + targetList = AIParamQuery.AddElementToList(battleCardBase2, targetList); + } + } + } + for (int k = 0; k < AISelectedTargetInfoSet.LENGTH; k++) + { + AISelectedTargetInfo aISelectedTargetInfo = selectedTargets.Get(k); + if (aISelectedTargetInfo == null || !aISelectedTargetInfo.HasTarget) + { + continue; + } + for (int l = 0; l < aISelectedTargetInfo.Targets.Count; l++) + { + BattleCardBase battleCardBase3 = SearchBattleCardFromVirtualCard(playerPair, aISelectedTargetInfo.Targets[l]); + if (battleCardBase3 != null) + { + targetList = AIParamQuery.AddElementToList(battleCardBase3, targetList); + } + } + } + } + + public static void SearchAttackPairFromSituation(BattlePlayerPair playerPair, AIVirtualAttackInfo attackSituation, out BattleCardBase attacker, out BattleCardBase attackTarget) + { + attacker = null; + attackTarget = null; + if (attackSituation == null || attackSituation.Actor == null || attackSituation.AttackTarget == null) + { + AIConsoleUtility.LogError("SearchAttackPairFromSituation() error!!! situation is invalid"); + return; + } + attacker = SearchBattleCardFromVirtualCard(playerPair, attackSituation.Actor); + if (attacker == null) + { + AIConsoleUtility.LogError("SearchAttackPairFromSituation() error!!! Not found attacker"); + return; + } + attackTarget = SearchBattleCardFromVirtualCard(playerPair, attackSituation.AttackTarget); + if (attackTarget == null) + { + AIConsoleUtility.LogError("SearchAttackPairFromSituation() error!!! Not found attackTarget"); + } + } + + private static BattleCardBase FindBattleCardFromList(AIVirtualCard virtualCard, List battleCardList) + { + return battleCardList.FirstOrDefault((BattleCardBase c) => c.Index == virtualCard.CardIndex); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIReincarnationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIReincarnationUtility.cs new file mode 100644 index 0000000..8ef0911 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIReincarnationUtility.cs @@ -0,0 +1,94 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public static class AIReincarnationUtility +{ + public static float CalcReincarnationValueAfterSimulation(AIVirtualField field, List playPtn, AISituationInfo situation, List selfRemainings, List opponentRemainings) + { + float result = 0f; + int count = playPtn.Count; + for (int i = 0; i < count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyHandCards[playPtn[i]]; + if (aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.Reincarnation)) + { + result = aIVirtualCard.TagCollectionContainer.ReincarnationSimulationTags.CalcReincarnationValueAfterSimulation(field.AI, playPtn, situation, selfRemainings, opponentRemainings); + } + } + return result; + } + + public static float EvalMaxReincarnationBonus(AIVirtualCard actCard, List playPtn) + { + float num = float.MinValue; + AIVirtualField selfField = actCard.SelfField; + if (!selfField.AllyInplayCards.Any((AIVirtualCard card) => card.IsUnit)) + { + num = 0f; + } + int count = selfField.CardListSet.AllyClassAndInplayCards.Count; + for (int num2 = 1; num2 < count; num2++) + { + AIVirtualCard aIVirtualCard = selfField.CardListSet.AllyClassAndInplayCards[num2]; + if (aIVirtualCard.IsUnit) + { + float num3 = CalcReincarnationValueToVirtualCard(aIVirtualCard, playPtn); + if (num3 > num) + { + num = num3; + } + } + } + int count2 = playPtn.Count; + for (int num4 = 0; num4 < count2; num4++) + { + AIVirtualCard aIVirtualCard2 = selfField.AllyHandCards[playPtn[num4]]; + if (aIVirtualCard2.IsUnit && aIVirtualCard2 != actCard) + { + float num5 = CalcReincarnationValueToVirtualCard(aIVirtualCard2, playPtn); + if (num5 > num) + { + num = num5; + } + } + } + int count3 = selfField.CardListSet.EnemyClassAndInplayCards.Count; + for (int num6 = 1; num6 < count3; num6++) + { + AIVirtualCard aIVirtualCard3 = selfField.CardListSet.EnemyClassAndInplayCards[num6]; + if (aIVirtualCard3.IsUnit) + { + float num7 = 0f - CalcReincarnationValueToVirtualCard(aIVirtualCard3, playPtn); + if (num7 > num) + { + num = num7; + } + } + } + return num; + } + + public static float CalcReincarnationValueToVirtualCard(AIVirtualCard target, List playPtn, AISituationInfo situation = null) + { + float num = 0.75f; + float num2 = target.EvaluateBreakValue(playPtn, useIgnoreBreak: false) + target.EvaluateLeaveValue(playPtn, useIgnoreInBattle: false); + float num3 = num2 - target.EvaluateValueOnField(playPtn, situation, useStyle: true); + float num4 = EvaluateFollowerPrimaryValue(target, playPtn, useStyle: true) * target.EvaluateAllBattleBonusRate(playPtn, useOthersTag: true, useIgnoreInBattle: false, situation) + target.GetFieldBonus(playPtn) + num2 * num; + return num3 + num4; + } + + public static float EvaluateFollowerPrimaryValue(AIVirtualCard targetCard, List playPtn, bool useStyle) + { + int num = 0; + int num2 = 0; + float num3 = targetCard.DefaultAttack + num + targetCard.DefaultLife + num2; + if (useStyle) + { + num3 += targetCard.SelfField.StyleQuery.GetUnitBonus(targetCard.SelfField, targetCard, playPtn); + num3 *= targetCard.SelfField.StyleQuery.GetUnitRate(targetCard.SelfField, targetCard, playPtn); + } + return num3; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIRemoveByDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AIRemoveByDestroy.cs new file mode 100644 index 0000000..a9ae5c5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIRemoveByDestroy.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIRemoveByDestroy : AIFiltersArgument +{ + public AIRemoveByDestroy(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + } + + public bool IsRemoveByDestroy(AIVirtualCard targetCard, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + return AIFilteringUtility.CheckMatchTargetFiltering(targetCard, null, base.Filters, playPtn, tagOwner, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIRemoveSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIRemoveSkill.cs new file mode 100644 index 0000000..9f35f1b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIRemoveSkill.cs @@ -0,0 +1,79 @@ +using System.Linq; + +namespace Wizard; + +public class AIRemoveSkill : AIScriptArgumentExpressions +{ + private readonly AIScriptTokenArgType[] LEGAL_TIMING_ARGS = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.WHEN_DESTROY, + AIScriptTokenArgType.WHEN_CLASH + }; + + private readonly AIScriptTokenArgType[] LEGAL_TYPE_ARGS = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL, + AIScriptTokenArgType.KILLER + }; + + public AIScriptTokenArgType Timing { get; private set; } + + public AIScriptTokenArgType RemoveSkillType { get; private set; } + + public AIRemoveSkill(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Timing = AIScriptTokenArgType.NONE; + RemoveSkillType = AIScriptTokenArgType.NONE; + int num = -1; + AIScriptTokenArgType legalType = AIScriptTokenArgType.NONE; + for (int i = 0; i < _exprList.Count; i++) + { + if (IsLegalType(_exprList[i], LEGAL_TYPE_ARGS, out legalType)) + { + num = i; + RemoveSkillType = legalType; + break; + } + } + if (num < 0) + { + return; + } + int num2 = -1; + for (int j = 0; j < _exprList.Count; j++) + { + if (IsLegalType(_exprList[j], LEGAL_TIMING_ARGS, out legalType)) + { + num2 = j; + Timing = legalType; + break; + } + } + _ = 0; + } + + private bool IsLegalType(AIPolishConvertedExpression arg, AIScriptTokenArgType[] argArray, out AIScriptTokenArgType legalType) + { + legalType = AIScriptTokenArgType.NONE; + if (arg.TokenList != null && arg.TokenList.Count > 0) + { + AIScriptTokenBase aIScriptTokenBase = arg.TokenList[0]; + if (aIScriptTokenBase is AIScriptArgumentToken) + { + AIScriptTokenArgType argumentType = ((AIScriptArgumentToken)aIScriptTokenBase).ArgumentType; + if (argArray.Contains(argumentType)) + { + legalType = argumentType; + return true; + } + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIRemoveTagUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIRemoveTagUtility.cs new file mode 100644 index 0000000..edfea4b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIRemoveTagUtility.cs @@ -0,0 +1,25 @@ +namespace Wizard; + +public static class AIRemoveTagUtility +{ + public static void RemoveTemporaryAttachedTag(AIVirtualCard owner, AIVirtualField field, AIPlayTag removingInfo, AISituationInfo situation) + { + AIAttachedTagCollection attachedTags = owner.TagCollectionContainer.AttachedTags; + if (attachedTags != null && attachedTags.HasAnyTag) + { + owner.TagCollectionContainer.RemoveOneTagWithUpdatingFieldCardList(owner, removingInfo, field); + bool needsInheritRemovedTags = situation?.IsLatestAction ?? false; + attachedTags.RemoveMatchedAttachedTagInformation(owner.IsAlly, owner.CardIndex, removingInfo, needsInheritRemovedTags); + } + } + + public static void RemoveOneTag(AIVirtualCard owner, AIVirtualField field, AIPlayTag removingTag, AISituationInfo situation) + { + owner.TagCollectionContainer.RemoveOneTagWithUpdatingFieldCardList(owner, removingTag, field); + if (situation != null && situation.IsLatestAction) + { + AIRemovedTagInformation info = new AIRemovedTagInformation(owner, removingTag); + owner.TagCollectionContainer.RemovedTagCollection.Add(info); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIResonanceDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIResonanceDamage.cs new file mode 100644 index 0000000..d76b50d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIResonanceDamage.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIResonanceDamage : AIFiltersAndSelectTypeArgument +{ + private readonly int DAMAGE_ARG_OFFSET = 1; + + public AIPolishConvertedExpression Damage { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIResonanceDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Damage = _exprList[_exprList.Count - DAMAGE_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, base.Filters, tagOwner, playPtn, situation); + if (list != null && list.Count > 0) + { + int damage = (int)Damage.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIDamageSimulationUtility.DamageAll(list, tagOwner, field, damage, situation); + } + else if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIDamageSimulationUtility.DamageRandom(list, tagOwner, field, damage, situation); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIResonanceGiveBasicSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIResonanceGiveBasicSkill.cs new file mode 100644 index 0000000..a13a0d5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIResonanceGiveBasicSkill.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIResonanceGiveBasicSkill : AIFiltersAndSelectTypeArgument +{ + private readonly AIScriptTokenArgType _skillType; + + public AIResonanceGiveBasicSkill(string text, AIScriptTokenArgType skillType) + : base(text) + { + _skillType = skillType; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.GiveSkillToAll(targetsFromField, field, _skillType); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIResonanceHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIResonanceHeal.cs new file mode 100644 index 0000000..7497f3f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIResonanceHeal.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIResonanceHeal : AIFiltersAndSelectTypeArgument +{ + private readonly int HEAL_ARG_OFFSET = 1; + + private AIPolishConvertedExpression _healValueArg { get; set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIResonanceHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _healValueArg = _exprList[_exprList.Count - HEAL_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int heal = (int)_healValueArg.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targetsFromField, field, heal, playPtn, situation); + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIRuleBaseBattleSimulator.cs b/SVSim.BattleEngine/Engine/Wizard/AIRuleBaseBattleSimulator.cs new file mode 100644 index 0000000..dece465 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIRuleBaseBattleSimulator.cs @@ -0,0 +1,103 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public class AIRuleBaseBattleSimulator +{ + private EnemyAI _ai; + + private PlayPtnWithToken[] _bestPlayPtnWithToken; + + private bool _canChangeToTimeOverLogic; + + public AIRuleBaseBattleSimulator(EnemyAI ai, PlayPtnWithToken[] bestPlayPtnWithToken, bool canChangeToTimeOverLogic) + { + _ai = ai; + _bestPlayPtnWithToken = bestPlayPtnWithToken; + _canChangeToTimeOverLogic = canChangeToTimeOverLogic; + } + + public void RunSequence(AIVirtualField originalField, int[] actionPermList, int evoIndex, List enemyTargets, SimulationResult bestRecord, SimulationAdditionalActionInfoSet additionalOptions, InplayMovePatternFilter patternFilter, bool checkActFailure = true) + { + AIVirtualField aIVirtualField = new AIVirtualField(originalField); + bool[] array = new bool[actionPermList.Length]; + for (int i = 0; i < array.Length; i++) + { + array[i] = true; + } + AIVirtualActionInfo aIVirtualActionInfo = AISimulationUtility.CreateActionInfoOnFieldFromSituation(aIVirtualField, additionalOptions?.ForceEvoAction); + List actionInfoSequence = AISimulationUtility.GetActionInfoSequence(aIVirtualField, actionPermList, array, (aIVirtualActionInfo != null) ? (-1) : evoIndex); + if (aIVirtualActionInfo != null && !actionInfoSequence.Any((AIVirtualActionInfo info) => info.ActionType == AIOperationType.EVOLVE)) + { + bool flag = false; + for (int num = 0; num < actionInfoSequence.Count; num++) + { + if (actionInfoSequence[num].Actor.IsSameCard(aIVirtualActionInfo.Actor)) + { + actionInfoSequence.Insert(num, aIVirtualActionInfo); + flag = true; + break; + } + } + if (!flag) + { + actionInfoSequence.Add(aIVirtualActionInfo); + } + } + List enemyTargetSequence = AISimulationUtility.GetEnemyTargetSequence(aIVirtualField, enemyTargets); + SimulationSetting simSetting = new SimulationSetting(isHandRemovalValid: true, useLeaderAttackPreCheck: true, aIVirtualField.IsNoSkipAttackInPlayPtn(), checkActFailure); + ExecuteSimulationWithActionSequence(aIVirtualField, actionInfoSequence, enemyTargetSequence, simSetting, bestRecord, patternFilter); + } + + public void RunPlaySkipWithActionSequence(AIVirtualField originalField, List actionSequence, List enemyTargets, SimulationResult bestRecord, SimulationAdditionalActionInfoSet additionalOptions) + { + } + + private void ExecuteSimulationWithActionSequence(AIVirtualField fieldTemp, List actionInfoSequence, List enemyTargetSequence, SimulationSetting simSetting, SimulationResult bestRecord, InplayMovePatternFilter patternFilter) + { + BattleSequencer.ExecSimulation(fieldTemp, actionInfoSequence, enemyTargetSequence, simSetting); + if (NeedsChangeToTimeOverLogic()) + { + return; + } + AIVirtualTurnEndInfo aIVirtualTurnEndInfo = new AIVirtualTurnEndInfo(fieldTemp.AllyClass); + actionInfoSequence.Add(aIVirtualTurnEndInfo); + BattleSequencer.OnAfterExecuteAttackCommon(fieldTemp, aIVirtualTurnEndInfo, ref actionInfoSequence, isAttackToLeaderAgain: true); + if (NeedsChangeToTimeOverLogic()) + { + return; + } + float num = AISimulationUtility.EvaluateField(fieldTemp, EvaluationType.SELF_TURN); + if (NeedsChangeToTimeOverLogic()) + { + return; + } + float num2 = num; + if (_bestPlayPtnWithToken == null) + { + num2 = num - (fieldTemp.EnemyClass.IsDead ? 0f : fieldTemp.EvaluateThreaten()); + } + if (AISimulationUtility.IsBestRecord(fieldTemp, num2, num, bestRecord)) + { + bestRecord.BestResultField = fieldTemp; + bestRecord.MaxFieldValue = num2; + bestRecord.ActionSequence = actionInfoSequence; + bestRecord.MaxFieldValueAtSelfTurnEnd = num; + if (fieldTemp.EnemyClass.IsDead) + { + bestRecord.MinActionLengthOfLethal = fieldTemp.ActionLength; + } + patternFilter?.ConfirmBestPattern(enemyTargetSequence); + } + } + + private bool NeedsChangeToTimeOverLogic() + { + if (_ai.IsRunWeakLogic) + { + return !_canChangeToTimeOverLogic; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIScriptArgumentToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIScriptArgumentToken.cs new file mode 100644 index 0000000..08461b2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIScriptArgumentToken.cs @@ -0,0 +1,51 @@ +namespace Wizard; + +public class AIScriptArgumentToken : AIScriptTokenBase +{ + public AIScriptTokenArgType ArgumentType; + + public bool IsNot { get; private set; } + + public AIScriptArgumentToken(AIScriptTokenArgType arg, bool isNot) + : base(AIScriptTokenType.ARG, (float)arg) + { + ArgumentType = arg; + IsNot = isNot; + } + + public override AIScriptTokenBase Clone() + { + return new AIScriptArgumentToken(ArgumentType, IsNot); + } + + public override bool IsEqual(AIScriptTokenBase token) + { + if (!(token is AIScriptArgumentToken aIScriptArgumentToken)) + { + return false; + } + if (ArgumentType == aIScriptArgumentToken.ArgumentType) + { + return IsNot == aIScriptArgumentToken.IsNot; + } + return false; + } + + public bool IsSideArgType(bool includeBoth = true) + { + switch (ArgumentType) + { + case AIScriptTokenArgType.ALLY: + case AIScriptTokenArgType.OPPONENT: + return true; + case AIScriptTokenArgType.BOTH: + if (!includeBoth) + { + return false; + } + return true; + default: + return false; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIScriptExpressionCalculator.cs b/SVSim.BattleEngine/Engine/Wizard/AIScriptExpressionCalculator.cs new file mode 100644 index 0000000..496ad8f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIScriptExpressionCalculator.cs @@ -0,0 +1,1384 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Wizard; + +public class AIScriptExpressionCalculator +{ + public static float CalculateExpression(List iPolish, List playPtn, AIVirtualField field, AIVirtualCard tagOwner, AISituationInfo situation) + { + if (iPolish == null || iPolish.Count <= 0) + { + return 0f; + } + if (iPolish.Count == 1 && iPolish[0] is AIScriptNumericToken) + { + return iPolish[0].Value; + } + if (playPtn == null) + { + playPtn = EnemyAI.EmptyPlayPtn; + } + return Calculation(iPolish, playPtn, field, tagOwner, situation); + } + + private static float Calculation(List expr, List playPtn, AIVirtualField field, AIVirtualCard tagOwner, AISituationInfo situation) + { + Stack stack = new Stack(); + int count = expr.Count; + for (int i = 0; i < count; i++) + { + AIScriptTokenBase aIScriptTokenBase = expr[i]; + if (aIScriptTokenBase is AIScriptNumericToken || aIScriptTokenBase is AIScriptArgumentToken || aIScriptTokenBase is AIScriptIDToken) + { + stack.Push(aIScriptTokenBase); + } + else if (aIScriptTokenBase is AIScriptVariableToken) + { + AIScriptTokenBase aIScriptTokenBase2 = CalculateVariableToken(aIScriptTokenBase, playPtn, field, tagOwner, situation); + if (aIScriptTokenBase2 != null) + { + stack.Push(aIScriptTokenBase2); + } + } + else if (aIScriptTokenBase is AIScriptFunctionToken) + { + int argCount = ((AIScriptFunctionToken)aIScriptTokenBase).ArgCount; + List list = new List(); + for (int j = 0; j < argCount; j++) + { + AIScriptTokenBase item = stack.Pop(); + list.Add(item); + } + stack.Push(CalculateFunctionToken(list, aIScriptTokenBase as AIScriptFunctionToken, field, playPtn, tagOwner, situation)); + } + else + { + float value = stack.Pop().Value; + float value2 = stack.Pop().Value; + float value3 = CalculateByOperatorSymbol(aIScriptTokenBase.Type, value2, value); + stack.Push(new AIScriptNumericToken(value3)); + } + } + if (stack.Count > 1 || stack.Count <= 0) + { + return 0f; + } + return stack.Pop().Value; + } + + public static float CalculateByOperatorSymbol(AIScriptTokenType symbol, float left, float right) + { + switch (symbol) + { + case AIScriptTokenType.PLUS: + return left + right; + case AIScriptTokenType.MINUS: + return left - right; + case AIScriptTokenType.MULTI: + return left * right; + case AIScriptTokenType.DIV: + return left / right; + case AIScriptTokenType.REMAIN: + return left % right; + case AIScriptTokenType.MORE_THAN: + if (!(left > right)) + { + return 0f; + } + return 1f; + case AIScriptTokenType.MORE_EQUAL: + if (!(left >= right)) + { + return 0f; + } + return 1f; + case AIScriptTokenType.LESS_THAN: + if (!(left < right)) + { + return 0f; + } + return 1f; + case AIScriptTokenType.LESS_EQUAL: + if (!(left <= right)) + { + return 0f; + } + return 1f; + case AIScriptTokenType.EQUAL: + if (left != right) + { + return 0f; + } + return 1f; + case AIScriptTokenType.MAX: + return Mathf.Max(left, right); + case AIScriptTokenType.MIN: + return Mathf.Min(left, right); + case AIScriptTokenType.OR: + if (!(left > 0f) && !(right > 0f)) + { + return 0f; + } + return 1f; + case AIScriptTokenType.AND: + if (!(left > 0f) || !(right > 0f)) + { + return 0f; + } + return 1f; + default: + return 0f; + } + } + + public static AIScriptTokenBase CalculateVariableToken(AIScriptTokenBase token, List playPtn, AIVirtualField field, AIVirtualCard tagOwner, AISituationInfo situation) + { + _ = token is AIScriptVariableToken; + switch (((AIScriptVariableToken)token).VariableType) + { + case AIScriptTokenVariableType.NOW_TURN: + return new AIScriptNumericToken(tagOwner.IsAlly ? field.AllyTurnCount : field.EnemyTurnCount); + case AIScriptTokenVariableType.COUNTDOWN: + return new AIScriptNumericToken(tagOwner.ChantCount); + case AIScriptTokenVariableType.REINCARNATION_MAX: + return new AIScriptNumericToken(AIReincarnationUtility.EvalMaxReincarnationBonus(tagOwner, playPtn)); + case AIScriptTokenVariableType.SPELLBOOST: + return new AIScriptNumericToken(tagOwner.SpellboostCount); + case AIScriptTokenVariableType.FIELD_SPACE: + return new AIScriptNumericToken(field.GetPredictiveAllyFieldSpace()); + case AIScriptTokenVariableType.ALLY_UNIT_MIN: + return new AIScriptNumericToken(field.CalcMinEvaluateValue(playPtn, isAlly: true)); + case AIScriptTokenVariableType.ALLY_UNIT_MAX: + return new AIScriptNumericToken(field.CalcMaxEvaluateValue(playPtn, isAlly: true)); + case AIScriptTokenVariableType.ALLY_ATTACKABLE_ATK_MAX: + return new AIScriptNumericToken(field.GetMaxAllyAttackableUnitAttack(playPtn, tagOwner.IsAlly)); + case AIScriptTokenVariableType.ALLY_NON_ATTACKABLE_ATK_MAX: + return new AIScriptNumericToken(field.GetMaxAllyNonAttackableUnitAttack(playPtn)); + case AIScriptTokenVariableType.ALLY_MAX_ATTACKABLE_LIFE: + return new AIScriptNumericToken(field.GetAllyMaxAttackableLife(tagOwner.IsAlly)); + case AIScriptTokenVariableType.ENEMY_UNIT_MIN: + return new AIScriptNumericToken(field.CalcMinEvaluateValue(EnemyAI.EmptyPlayPtn, isAlly: false)); + case AIScriptTokenVariableType.ENEMY_UNIT_MAX: + return new AIScriptNumericToken(field.CalcMaxEvaluateValue(EnemyAI.EmptyPlayPtn, isAlly: false)); + case AIScriptTokenVariableType.HAND_COUNT_E: + return new AIScriptNumericToken(field.AI.OPPONENT.HandCardList.Count); + case AIScriptTokenVariableType.DECK_COUNT_E: + return new AIScriptNumericToken(field.AI.PlayerPair.Opponent.DeckCardList.Count); + case AIScriptTokenVariableType.PLAYPTN_COUNT: + { + int allPlayedCountInTurn = field.PlayedCardContainer.GetAllPlayedCountInTurn(tagOwner.IsAlly); + if (playPtn != null) + { + return new AIScriptNumericToken(playPtn.Count + allPlayedCountInTurn + AIEvaluateBonusFromOhterUtility.GetPlayPlusCount(field, playPtn)); + } + return new AIScriptNumericToken(allPlayedCountInTurn); + } + case AIScriptTokenVariableType.MEMBER_MAX_LIFE: + return new AIScriptNumericToken(field.GetMemberMaxLife(playPtn, tagOwner.IsAlly)); + case AIScriptTokenVariableType.MEMBER_ATK_SUM: + return new AIScriptNumericToken(field.GetMemberAtkSum(playPtn, tagOwner.IsAlly)); + case AIScriptTokenVariableType.MEMBER_LIFE_SUM: + return new AIScriptNumericToken(field.GetMemberLifeSum(playPtn, tagOwner.IsAlly)); + case AIScriptTokenVariableType.INPLAY_ATTACK_SUM_TO_LEADER: + return new AIScriptNumericToken(field.GetInplayAttackSumToLeader(tagOwner.IsAlly)); + case AIScriptTokenVariableType.ATTACK_TARGET_ATK_MAX: + return new AIScriptNumericToken(field.GetAttackTargetMaxAtk(tagOwner)); + case AIScriptTokenVariableType.SUMMON_DRUNKEN_ATK_MAX: + return new AIScriptNumericToken(field.GetSummonDrunkenAtkMax(tagOwner)); + case AIScriptTokenVariableType.ENEMY_MIN_ATK: + return new AIScriptNumericToken(field.GetEnemyInPlayMinAttack()); + case AIScriptTokenVariableType.ENEMY_MAX_ATK: + return new AIScriptNumericToken(field.GetEnemyInPlayMaxAttack()); + case AIScriptTokenVariableType.ENEMY_ATK_SUM: + return new AIScriptNumericToken(field.GetInplayAttackSumToLeader(isAlly: false)); + case AIScriptTokenVariableType.ALLY_INPLAY_MAX_ATK: + return new AIScriptNumericToken(field.GetAllyInplayMaxAttack()); + case AIScriptTokenVariableType.GRAVE_COUNT: + return new AIScriptNumericToken(field.VirtualCemetery.GetCemeteryCount(tagOwner.IsAlly)); + case AIScriptTokenVariableType.ALLY_MAX_PP: + return new AIScriptNumericToken(tagOwner.IsAlly ? field.AllyPpTotal : field.EnemyPpTotal); + case AIScriptTokenVariableType.ENEMY_MAX_PP: + return new AIScriptNumericToken((!tagOwner.IsAlly) ? field.AllyPpTotal : field.EnemyPpTotal); + case AIScriptTokenVariableType.REST_PP: + return new AIScriptNumericToken((tagOwner != null) ? field.AI.PlayPtnRecorder.GetRestPp(playPtn, field) : 0); + case AIScriptTokenVariableType.NOW_REST_PP: + return new AIScriptNumericToken(tagOwner.IsAlly ? field.AllyPp : field.EnemyPp); + case AIScriptTokenVariableType.ALLY_EP: + return new AIScriptNumericToken(tagOwner.IsAlly ? field.AllyEvolutionCount : field.EnemyEvolutionCount); + case AIScriptTokenVariableType.ENEMY_EP: + return new AIScriptNumericToken(tagOwner.IsAlly ? field.EnemyEvolutionCount : field.AllyEvolutionCount); + case AIScriptTokenVariableType.OWN_ATK: + return new AIScriptNumericToken(tagOwner.Attack); + case AIScriptTokenVariableType.OWN_LIFE: + return new AIScriptNumericToken(tagOwner.Life); + case AIScriptTokenVariableType.OWN_COST: + return new AIScriptNumericToken(tagOwner.Cost); + case AIScriptTokenVariableType.OWN_BASE_ATK: + return new AIScriptNumericToken(tagOwner.DefaultAttack); + case AIScriptTokenVariableType.OWN_BASE_LIFE: + return new AIScriptNumericToken(tagOwner.DefaultLife); + case AIScriptTokenVariableType.KILLER_ATTACK_VALUE: + return new AIScriptNumericToken(tagOwner.EvalKillerAttackValue(playPtn, situation)); + case AIScriptTokenVariableType.ENHANCE_COST: + return new AIScriptNumericToken(AIEnhanceUtility.GetEnhanceCost(tagOwner, field, playPtn)); + case AIScriptTokenVariableType.PLAY_ACTOR_ENHANCE_COST: + if (situation == null || situation.ActionType != AIOperationType.PLAY || situation.Actor == null) + { + return new AIScriptNumericToken(-1f); + } + return new AIScriptNumericToken(AIEnhanceUtility.GetEnhanceCost(situation.Actor, field, playPtn)); + case AIScriptTokenVariableType.ACCELERATE_COST: + return new AIScriptNumericToken(AIAccelerateUtility.GetAccelerateCost(tagOwner, field, playPtn)); + case AIScriptTokenVariableType.CHOICE_TRANSFORM_COST: + return new AIScriptNumericToken(tagOwner.GetChoiceTransformCost(field, playPtn)); + case AIScriptTokenVariableType.BASE_SKILL_COUNT: + return new AIScriptNumericToken(tagOwner.GetBaseSkillCount()); + case AIScriptTokenVariableType.LAST_LIFE: + return new AIScriptNumericToken(tagOwner.LastLife); + case AIScriptTokenVariableType.MAX_ATTACKABLE_COUNT: + return new AIScriptNumericToken(tagOwner.MaxAttackableCount); + case AIScriptTokenVariableType.HAND_MIN_COST: + if (tagOwner != null && !tagOwner.IsAlly) + { + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(field.GetHandMinCost(tagOwner)); + case AIScriptTokenVariableType.HAND_MAX_COST: + if (!tagOwner.IsAlly) + { + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(field.GetHandMaxCost(tagOwner)); + case AIScriptTokenVariableType.UNION_BURST_COUNT: + { + int num3 = 0; + if (tagOwner.HasUnionBurst) + { + num3 = tagOwner.UnionBurstCount; + } + return new AIScriptNumericToken(num3); + } + case AIScriptTokenVariableType.CONSUME_EP: + return new AIScriptNumericToken((!tagOwner.IsNotConsumeEp) ? 1 : 0); + case AIScriptTokenVariableType.LAST_HEAL_AMOUNT: + return new AIScriptNumericToken(tagOwner.LastHealAmount); + case AIScriptTokenVariableType.JUST_BEFORE_TURN_DAMAGE: + return new AIScriptNumericToken(field.JustBeforeTurnLeaderDamage); + case AIScriptTokenVariableType.RALLY_COUNT: + return new AIScriptNumericToken(tagOwner.IsAlly ? field.AllyRallyCount : field.EnemyRallyCount); + case AIScriptTokenVariableType.SKYBOUND_ART_COUNT: + { + int num2 = 0; + if (tagOwner.HasSkyboundArt) + { + num2 = tagOwner.SkyboundArtCount; + } + return new AIScriptNumericToken(num2); + } + case AIScriptTokenVariableType.SUPER_SKYBOUND_ART_COUNT: + { + int num = 0; + if (tagOwner.HasSuperSkyboundArt) + { + num = tagOwner.SuperSkyboundArtCount; + } + return new AIScriptNumericToken(num); + } + case AIScriptTokenVariableType.USED_EP_COUNT: + return new AIScriptNumericToken(tagOwner.IsAlly ? field.UsedEpCount : 0); + case AIScriptTokenVariableType.USED_PP_COUNT: + return new AIScriptNumericToken(tagOwner.IsAlly ? field.UsedPpCount : 0); + case AIScriptTokenVariableType.EARTH_RITE_COUNT: + return new AIScriptNumericToken(AIGetPreprocessInformationUtility.GetEarthRiteCount(tagOwner, situation)); + case AIScriptTokenVariableType.NECROMANCE_COUNT: + return new AIScriptNumericToken(AIGetPreprocessInformationUtility.GetNecromanceCount(tagOwner, situation)); + case AIScriptTokenVariableType.USED_STACK_COUNT: + return new AIScriptNumericToken(tagOwner.IsAlly ? field.AllyGameUsedStackCount : field.EnemyGameUsedStackCount); + case AIScriptTokenVariableType.DEFAULT_DAMAGE: + return new AIScriptNumericToken(situation.GetCurrentProcessDefaultDamage()); + case AIScriptTokenVariableType.NEXT_PLAY_PRIORITY: + { + AISinglePlayptnRecord bestPlayPtnRecord = field.AI.BestPlayPtnRecord; + if (bestPlayPtnRecord == null) + { + AIConsoleUtility.LogError("NEXT_PLAY_PRIORITY: BestPlayPtnRecord is null! Wrong use timing."); + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(bestPlayPtnRecord.FirstPlayCardPriority); + } + case AIScriptTokenVariableType.NECROMANCED_COUNT_IN_GAME: + return new AIScriptNumericToken(field.GetNecromanceCountInGame(situation, tagOwner.IsAlly)); + case AIScriptTokenVariableType.IS_EVO_TURN: + return new AIScriptNumericToken((field.AI.ALLY.EvolveWaitTurnCount <= 0) ? 1f : 0f); + case AIScriptTokenVariableType.IS_ABLE_EVO: + return new AIScriptNumericToken(tagOwner.IsAbleEvolution() ? 1f : 0f); + case AIScriptTokenVariableType.IS_F_ADV: + return new AIScriptNumericToken((field.AI.FieldAdvantage >= 0f) ? 1f : 0f); + case AIScriptTokenVariableType.IS_F_DISADV: + return new AIScriptNumericToken((field.AI.FieldAdvantage < 0f) ? 1f : 0f); + case AIScriptTokenVariableType.IS_AWAKE: + return new AIScriptNumericToken(SkillConditionAwake.IsAwake(tagOwner.IsAlly ? field.AllyPpTotal : field.EnemyPpTotal) ? 1f : 0f); + case AIScriptTokenVariableType.IS_BERSERK: + return new AIScriptNumericToken(AIBerserkUtility.IsToBeBerserk(field, null, situation, tagOwner.IsAlly) ? 1f : 0f); + case AIScriptTokenVariableType.IS_TO_BE_BERSERK: + return new AIScriptNumericToken(AIBerserkUtility.IsToBeBerserk(field, playPtn, situation, tagOwner.IsAlly) ? 1f : 0f); + case AIScriptTokenVariableType.IS_ON_FIELD: + return new AIScriptNumericToken(tagOwner.IsOnField ? 1f : 0f); + case AIScriptTokenVariableType.IS_IN_HAND: + return new AIScriptNumericToken(tagOwner.IsInHand ? 1f : 0f); + case AIScriptTokenVariableType.IS_IN_PLAYPTN: + return new AIScriptNumericToken(playPtn.Contains(field.AllyHandCards.FindIndex((AIVirtualCard c) => c.CardIndex == tagOwner.CardIndex)) ? 1f : 0f); + case AIScriptTokenVariableType.IS_OWNER_TURN: + return new AIScriptNumericToken(tagOwner.IsSelfTurn ? 1f : 0f); + case AIScriptTokenVariableType.IS_ALLY: + return new AIScriptNumericToken(tagOwner.IsAlly ? 1f : 0f); + case AIScriptTokenVariableType.IS_ENEMY: + return new AIScriptNumericToken(tagOwner.IsAlly ? 0f : 1f); + case AIScriptTokenVariableType.IS_ALLY_FIRST: + return new AIScriptNumericToken(field.AI.IsAllyFirst ? 1f : 0f); + case AIScriptTokenVariableType.IS_SNEAK: + return new AIScriptNumericToken(AISkillSimulationUtility.HasSkill(tagOwner, AIScriptTokenArgType.SNEAK, tagOwner.SelfField.AI, playPtn) ? 1f : 0f); + case AIScriptTokenVariableType.IS_KILLER: + return new AIScriptNumericToken(AISkillSimulationUtility.HasSkill(tagOwner, AIScriptTokenArgType.KILLER, tagOwner.SelfField.AI, playPtn) ? 1f : 0f); + case AIScriptTokenVariableType.IS_MEDUSA: + return new AIScriptNumericToken(tagOwner.IsDestroyWhenAttack ? 1f : 0f); + case AIScriptTokenVariableType.IS_EVOLVED: + return new AIScriptNumericToken((tagOwner.IsUseEvo || tagOwner.IsEvolution) ? 1f : 0f); + case AIScriptTokenVariableType.IS_EVOLVING: + return new AIScriptNumericToken(tagOwner.IsUseEvo ? 1f : 0f); + case AIScriptTokenVariableType.IS_GUARD: + return new AIScriptNumericToken(AISkillSimulationUtility.HasSkill(tagOwner, AIScriptTokenArgType.GUARD, tagOwner.SelfField.AI, playPtn) ? 1f : 0f); + case AIScriptTokenVariableType.IS_RUSH: + return new AIScriptNumericToken(AISkillSimulationUtility.HasSkill(tagOwner, AIScriptTokenArgType.RUSH, tagOwner.SelfField.AI, playPtn) ? 1f : 0f); + case AIScriptTokenVariableType.IS_PLAYOUT_ATTACKER: + return new AIScriptNumericToken(AttackSelectControl.IsAttackPossible(tagOwner, tagOwner.SelfField.EnemyClass, tagOwner.BaseCard.OpponentBattlePlayer) ? 1f : 0f); + case AIScriptTokenVariableType.IS_ENHANCED: + return new AIScriptNumericToken(tagOwner.IsEnhanced(field, playPtn, situation) ? 1f : 0f); + case AIScriptTokenVariableType.IS_ACCELERATE: + return new AIScriptNumericToken(tagOwner.IsAccelerated(field, playPtn, situation) ? 1f : 0f); + case AIScriptTokenVariableType.IS_CRYSTALIZE: + return new AIScriptNumericToken(tagOwner.IsCrystalize(field, playPtn, situation) ? 1f : 0f); + case AIScriptTokenVariableType.IS_ATTACK_LEADER: + if (situation != null && situation is AIVirtualAttackInfo aIVirtualAttackInfo) + { + return new AIScriptNumericToken((aIVirtualAttackInfo.AttackTarget != null && aIVirtualAttackInfo.AttackTarget.IsLeader) ? 1f : 0f); + } + return new AIScriptNumericToken(0f); + case AIScriptTokenVariableType.IS_FANFARE: + return new AIScriptNumericToken(field.IsEnableIgnoreFanfareBonus(playPtn) ? 0f : 1f); + case AIScriptTokenVariableType.IS_SKILL_REMOVED: + return new AIScriptNumericToken(tagOwner.IsSkillLost ? 1f : 0f); + case AIScriptTokenVariableType.IS_BARBAROSSA: + return new AIScriptNumericToken(field.AI.IsOpponentBarbarossaDestroyed ? 1f : 0f); + case AIScriptTokenVariableType.IS_RESONANCE: + return new AIScriptNumericToken(field.IsResonance(tagOwner.IsAlly) ? 1f : 0f); + case AIScriptTokenVariableType.IS_LETHAL: + return new AIScriptNumericToken(field.AI.IsLethal(tagOwner, field, playPtn, situation) ? 1f : 0f); + case AIScriptTokenVariableType.IS_USED_EVO: + return new AIScriptNumericToken(field.AI.ALLY.NowTurnEvol ? 0f : 1f); + case AIScriptTokenVariableType.IS_FIRST_TURN: + return new AIScriptNumericToken(tagOwner.IsFirstTurn ? 1f : 0f); + case AIScriptTokenVariableType.IS_DAMAGED: + return new AIScriptNumericToken((tagOwner.MaxLife - tagOwner.Life > 0) ? 1f : 0f); + case AIScriptTokenVariableType.IS_DELAY_HEAL: + return new AIScriptNumericToken(tagOwner.IsDelayHeal(field, situation) ? 1f : 0f); + case AIScriptTokenVariableType.IS_NOT_ATTACK_YET: + return new AIScriptNumericToken(tagOwner.IsNotAttackYet ? 1f : 0f); + case AIScriptTokenVariableType.IS_LEADER: + return new AIScriptNumericToken(tagOwner.IsLeader ? 1f : 0f); + case AIScriptTokenVariableType.IS_GET_ON: + return new AIScriptNumericToken(tagOwner.IsGetOn ? 1f : 0f); + case AIScriptTokenVariableType.IS_SKILL_SUMMONED: + return new AIScriptNumericToken((tagOwner.IsOnField && tagOwner.IsSkillSummoned) ? 1f : 0f); + case AIScriptTokenVariableType.IS_UNTOUCHABLE: + return new AIScriptNumericToken(AISkillSimulationUtility.HasSkill(tagOwner, AIScriptTokenArgType.UNTOUCHABLE, tagOwner.SelfField.AI, playPtn) ? 1f : 0f); + case AIScriptTokenVariableType.IS_FORCE_TARGETING: + return new AIScriptNumericToken(AISkillSimulationUtility.HasSkill(tagOwner, AIScriptTokenArgType.FORCE_TARGETING, tagOwner.SelfField.AI, playPtn) ? 1f : 0f); + case AIScriptTokenVariableType.IS_QUICK: + return new AIScriptNumericToken(AISkillSimulationUtility.HasSkill(tagOwner, AIScriptTokenArgType.QUICK, tagOwner.SelfField.AI, playPtn) ? 1f : 0f); + case AIScriptTokenVariableType.IS_NOT_BE_ATTACKED: + return new AIScriptNumericToken(((situation != null && situation.ActionType == AIOperationType.ATTACK) ? tagOwner.IsCantUnderAttack(field.ParamQuery, situation.Actor, playPtn, field) : tagOwner.IsCantUnderAnyAttack()) ? 1f : 0f); + case AIScriptTokenVariableType.IS_IN_SIMULATION: + return new AIScriptNumericToken(field.AI.IsInVirutalSimulation ? 1f : 0f); + case AIScriptTokenVariableType.IS_IGNORE_GUARD: + return new AIScriptNumericToken(AISkillSimulationUtility.HasSkill(tagOwner, AIScriptTokenArgType.IGNORE_GUARD, tagOwner.SelfField.AI, playPtn) ? 1f : 0f); + case AIScriptTokenVariableType.IS_ATTACKED: + return new AIScriptNumericToken(tagOwner.IsAttacked ? 1f : 0f); + case AIScriptTokenVariableType.IS_ONEMORELASTWORD_TAGGED: + return new AIScriptNumericToken(AIOneMoreLastwordUtility.IsHoldingOneMoreLastword(tagOwner, field) ? 1f : 0f); + case AIScriptTokenVariableType.IS_DRAIN: + return new AIScriptNumericToken(tagOwner.IsDrain ? 1f : 0f); + default: + return null; + } + } + + public static AIScriptTokenBase CalculateFunctionToken(List argList, AIScriptFunctionToken funcToken, AIVirtualField field, List playPtn, AIVirtualCard tagOwner, AISituationInfo situation) + { + if (argList.Count != funcToken.ArgCount) + { + return null; + } + AIVirtualCard aIVirtualCard = null; + AIVirtualCard aIVirtualCard2 = null; + if (situation is AIVirtualAttackInfo aIVirtualAttackInfo) + { + aIVirtualCard2 = aIVirtualAttackInfo.AttackTarget; + aIVirtualCard = ((situation.Actor.IsAlly != tagOwner.IsAlly) ? aIVirtualAttackInfo.Actor : aIVirtualAttackInfo.AttackTarget); + } + switch (funcToken.FuncType) + { + case AIScriptTokenFuncType.MEMBER_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIFilteringUtility.MultipleFiltering(field.GetFieldCountCardList(playPtn), argList, tagOwner, playPtn, situation)?.Count ?? 0); + case AIScriptTokenFuncType.POW: + { + float value2 = argList[1].Value; + float value3 = argList[0].Value; + return new AIScriptNumericToken(Mathf.Pow(value2, value3)); + } + case AIScriptTokenFuncType.CEILING: + return new AIScriptNumericToken(Mathf.Ceil(argList[0].Value)); + case AIScriptTokenFuncType.FLOOR: + return new AIScriptNumericToken(Mathf.Floor(argList[0].Value)); + case AIScriptTokenFuncType.EVAL_RANDOM_MULTI_DAMAGE: + { + argList.Reverse(); + AIRandomMultiDamageEvaluator.CreateEvalRandomDamageArgList(argList, out var filters, out var damage6, out var count6); + return new AIScriptNumericToken(AIRandomMultiDamageEvaluator.EvaluateRandomDamageAverage(tagOwner, field, playPtn, situation, filters, damage6, count6)); + } + case AIScriptTokenFuncType.EVAL_RANDOM_MULTI_DAMAGE_MAX: + { + argList.Reverse(); + AIRandomMultiDamageEvaluator.CreateEvalRandomDamageArgList(argList, out var filters2, out var damage7, out var count7); + return new AIScriptNumericToken(AIRandomMultiDamageEvaluator.EvaluateRandomDamageMax(tagOwner, field, playPtn, filters2, situation, damage7, count7)); + } + case AIScriptTokenFuncType.EVAL_INSTANT_ATTACK: + { + int attack2 = (int)argList[2].Value; + int life2 = (int)argList[1].Value; + int count5 = (int)argList[0].Value; + return new AIScriptNumericToken(AIInstantAttackUtility.EvalInstantAttack(attack2, life2, count5, playPtn, tagOwner, situation)); + } + case AIScriptTokenFuncType.EVAL_RUSH: + { + int attack = (int)argList[2].Value; + int life = (int)argList[1].Value; + int count4 = (int)argList[0].Value; + bool isRush = true; + return new AIScriptNumericToken(AIInstantAttackUtility.EvalInstantAttack(attack, life, count4, playPtn, tagOwner, situation, isRush)); + } + case AIScriptTokenFuncType.INPLAY_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIFilteringUtility.MultipleFiltering(field.CardListSet.BothInplayCards, argList, tagOwner, playPtn, situation)?.Count ?? 0); + case AIScriptTokenFuncType.PLAYOUT_ATTACKER_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIPlayoutAttackerCountUtility.GetPlayoutAttackerCount(field, tagOwner, playPtn, argList, situation)); + case AIScriptTokenFuncType.BEFORE_PLAYPTN_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIPlayPtnUtility.GetBeforePlayPtnCount(argList, tagOwner, playPtn, situation)); + case AIScriptTokenFuncType.PLAY_TOKEN_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIPlayTokenSimulationUtility.GetPlayTokenCount(argList, tagOwner, playPtn, situation)); + case AIScriptTokenFuncType.EVO_COUNT_IN_GAME: + return new AIScriptNumericToken(field.GetEvolutionCountInGame(tagOwner, ((AIScriptArgumentToken)argList[0]).ArgumentType)); + case AIScriptTokenFuncType.EVO_COUNT_IN_PREVIOUS_TURN: + return new AIScriptNumericToken(field.GetEvolutionCountInPreviousTurn(tagOwner, ((AIScriptArgumentToken)argList[0]).ArgumentType)); + case AIScriptTokenFuncType.HAND_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIHandCountUtility.GetHandCount(field, argList, tagOwner, situation, playPtn)); + case AIScriptTokenFuncType.HAND_NAME_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIHandCountUtility.GetHandNameCount(field, argList, tagOwner, situation, playPtn)); + case AIScriptTokenFuncType.SKILL_COUNT_FROM_ID: + { + int iD6 = ((AIScriptIDToken)argList[0]).ID; + argList.RemoveAt(0); + argList.Reverse(); + return new AIScriptNumericToken(AISkillCountFromIdUtility.GetSkillCountFromID(argList, iD6, tagOwner, playPtn, situation)); + } + case AIScriptTokenFuncType.TAG_COUNT_FROM_ID: + { + int iD5 = ((AIScriptIDToken)argList[0]).ID; + argList.RemoveAt(0); + argList.Reverse(); + return new AIScriptNumericToken(AITagCountFromIdUtility.GetTagCountFromId(tagOwner, iD5, argList, field, playPtn, situation)); + } + case AIScriptTokenFuncType.EVAL_CHANT_COUNT_CHANGE: + { + int amount2 = (int)argList[0].Value; + return new AIScriptNumericToken(AICountdownChangeUtility.EvalChantCountChange(tagOwner, amount2, playPtn, isSelect: true, situation)); + } + case AIScriptTokenFuncType.EVAL_CHANT_COUNT_CHANGE_ALL: + { + int amount = (int)argList[0].Value; + return new AIScriptNumericToken(AICountdownChangeUtility.EvalChantCountChange(tagOwner, amount, playPtn, isSelect: false, situation)); + } + case AIScriptTokenFuncType.EVAL_ALL_DAMAGE: + { + List list19 = new List(); + for (int num25 = argList.Count - 1; num25 > 0; num25--) + { + list19.Add(argList[num25]); + } + int damage8 = (int)argList[0].Value; + return new AIScriptNumericToken(AIDamageSimulationUtility.EvalMultiAllDamage(tagOwner, field, list19, playPtn, situation, damage8, 1)); + } + case AIScriptTokenFuncType.EVAL_TARGETING_DAMAGE: + { + List list12 = new List(); + for (int num18 = argList.Count - 1; num18 > 0; num18--) + { + list12.Add(argList[num18]); + } + int damage3 = (int)argList[0].Value; + return new AIScriptNumericToken(AIDamageSimulationUtility.EvalTargetingDamage(tagOwner, field, list12, playPtn, situation, damage3)); + } + case AIScriptTokenFuncType.EVAL_TARGETING_AND_RANDOM_MULTI_DAMAGE: + { + if (argList.Count < 5) + { + return new AIScriptNumericToken(0f); + } + new List(); + int num12 = 0; + argList.Reverse(); + for (int num13 = 1; num13 < argList.Count; num13++) + { + if (argList[num13] is AIScriptNumericToken) + { + num12 = num13; + break; + } + } + List range3 = argList.GetRange(0, num12); + List range4 = argList.GetRange(num12 + 1, argList.Count - num12 - 3); + int targetDamage = (int)argList[num12].Value; + int randomDamage = (int)argList[argList.Count - 2].Value; + int randomDamageCount = (int)argList[argList.Count - 1].Value; + return new AIScriptNumericToken(AIDamageSimulationUtility.EvalTargetingDamageAndRandomMultiSelectDamage(tagOwner, field, range3, range4, playPtn, situation, targetDamage, randomDamage, randomDamageCount)); + } + case AIScriptTokenFuncType.EVAL_ALL_MULTI_DAMAGE: + { + List list2 = new List(); + for (int num3 = argList.Count - 2; num3 > 0; num3--) + { + list2.Add(argList[num3]); + } + int damage = (int)argList[1].Value; + int damageCount = (int)argList[0].Value; + return new AIScriptNumericToken(AIDamageSimulationUtility.EvalMultiAllDamage(tagOwner, field, list2, playPtn, situation, damage, damageCount)); + } + case AIScriptTokenFuncType.EVAL_ALL_DESTROY: + argList.Reverse(); + return new AIScriptNumericToken(AIDestroySimulationUtility.EvalAllDestroy(argList, tagOwner, playPtn, situation)); + case AIScriptTokenFuncType.EVAL_TARGETING_DESTROY: + argList.Reverse(); + return new AIScriptNumericToken(AIDestroySimulationUtility.EvalTargetingDestroy(argList, tagOwner, playPtn, situation)); + case AIScriptTokenFuncType.EVAL_TARGETING_OTHER_DESTROY: + { + AIScriptTokenBase aIScriptTokenBase = argList[0]; + argList.RemoveAt(0); + int select_count = 0; + if (aIScriptTokenBase is AIScriptNumericToken) + { + select_count = (int)(aIScriptTokenBase as AIScriptNumericToken).Value; + } + argList.Reverse(); + int num4 = 0; + int num5 = 1; + while (argList != null && num5 < argList.Count) + { + if (argList != null && argList.Count > 0 && argList[num5] is AIScriptArgumentToken aIScriptArgumentToken6 && aIScriptArgumentToken6.IsSideArgType()) + { + num4 = num5; + } + num5++; + } + List range = argList.GetRange(0, num4); + List range2 = argList.GetRange(num4, argList.Count - num4); + return new AIScriptNumericToken(AIDestroySimulationUtility.EvalTargetingOtherDestroy(range, range2, tagOwner, playPtn, situation, select_count)); + } + case AIScriptTokenFuncType.EVAL_TARGETING_MULTI_DESTROY: + { + int num29 = 0; + if (argList[0] is AIScriptNumericToken aIScriptNumericToken2) + { + num29 = (int)aIScriptNumericToken2.Value; + } + if (num29 == 0) + { + return new AIScriptNumericToken(0f); + } + argList.RemoveAt(0); + argList.Reverse(); + return new AIScriptNumericToken(AIDestroySimulationUtility.EvalTargetingMultiDestroy(argList, num29, tagOwner, playPtn, situation)); + } + case AIScriptTokenFuncType.EVAL_ALL_BOUNCE: + argList.Reverse(); + return new AIScriptNumericToken(field?.EvalAllBounce(argList, tagOwner, playPtn) ?? 0f); + case AIScriptTokenFuncType.EVAL_TARGETING_BOUNCE: + argList.Reverse(); + return new AIScriptNumericToken(field?.EvalTargetingBounce(argList, tagOwner, playPtn) ?? 0f); + case AIScriptTokenFuncType.EVAL_TARGETING_BANISH: + argList.Reverse(); + return new AIScriptNumericToken((field != null) ? AIBanishSimulationUtility.EvalTargetingBanish(argList, playPtn, field, tagOwner, situation) : 0f); + case AIScriptTokenFuncType.EVAL_RANDOM_BANISH: + { + int count3 = (int)argList[0].Value; + List list5 = new List(); + for (int num9 = argList.Count - 1; num9 > 0; num9--) + { + list5.Add(argList[num9]); + } + return new AIScriptNumericToken((field != null) ? AIBanishSimulationUtility.EvalRandomBanish(list5, tagOwner, field, playPtn, count3, situation) : 0f); + } + case AIScriptTokenFuncType.EVAL_ALL_BANISH: + argList.Reverse(); + return new AIScriptNumericToken(AIBanishSimulationUtility.EvalAllBanish(argList, tagOwner, field, playPtn, situation)); + case AIScriptTokenFuncType.EVAL_RANDOM_DESTROY: + { + int count2 = (int)argList[0].Value; + argList.RemoveAt(0); + argList.Reverse(); + return new AIScriptNumericToken(AIDestroySimulationUtility.EvalRandomDestroy(argList, count2, tagOwner, playPtn, situation)); + } + case AIScriptTokenFuncType.EVAL_RANDOM_BOUNCE: + { + int count = (int)argList[0].Value; + argList.Reverse(); + return new AIScriptNumericToken(field?.EvalRandomBounce(argList.GetRange(0, argList.Count - 1), tagOwner, field, playPtn, count) ?? 0f); + } + case AIScriptTokenFuncType.EVAL_TARGETING_HEAL: + { + List list4 = new List(); + for (int num7 = argList.Count - 1; num7 > 0; num7--) + { + list4.Add(argList[num7]); + } + int heal2 = (int)argList[0].Value; + return new AIScriptNumericToken(AIHealSimulationUtility.EvalTargetingHeal(tagOwner, list4, playPtn, heal2)); + } + case AIScriptTokenFuncType.EVAL_ALL_HEAL: + { + List list3 = new List(); + for (int num6 = argList.Count - 1; num6 > 0; num6--) + { + list3.Add(argList[num6]); + } + int heal = (int)argList[0].Value; + return new AIScriptNumericToken(AIHealSimulationUtility.EvalAllHeal(tagOwner, list3, playPtn, heal)); + } + case AIScriptTokenFuncType.EVAL_TARGETING_METAMORPHOSE: + { + List list = new List(); + for (int num2 = argList.Count - 1; num2 > 0; num2--) + { + list.Add(argList[num2]); + } + float value = 0f; + if (argList[0] is AIScriptIDToken) + { + int iD = ((AIScriptIDToken)argList[0]).ID; + value = AIMetamorphoseSimulationUtility.EvalTargetingMetamorphose(tagOwner, field, list, iD, playPtn, situation); + } + return new AIScriptNumericToken(value); + } + case AIScriptTokenFuncType.EVAL_RANDOM_METAMORPHOSE: + { + if (argList.Count < 2) + { + return new AIScriptNumericToken(0f); + } + List list18 = new List(); + for (int num24 = argList.Count - 1; num24 > 1; num24--) + { + list18.Add(argList[num24]); + } + int count8 = (int)argList[0].Value; + float value6 = 0f; + if (argList[1] is AIScriptIDToken) + { + int iD4 = ((AIScriptIDToken)argList[1]).ID; + value6 = AIMetamorphoseSimulationUtility.EvalRandomMetamorphose(tagOwner, field, list18, iD4, playPtn, count8, situation); + } + return new AIScriptNumericToken(value6); + } + case AIScriptTokenFuncType.EVAL_ALL_METAMORPHOSE: + { + List list17 = new List(); + for (int num23 = argList.Count - 1; num23 > 0; num23--) + { + list17.Add(argList[num23]); + } + float value5 = 0f; + if (argList[0] is AIScriptIDToken) + { + int iD3 = ((AIScriptIDToken)argList[0]).ID; + value5 = AIMetamorphoseSimulationUtility.EvalAllMetamorphose(tagOwner, field, list17, iD3, playPtn, situation); + } + return new AIScriptNumericToken(value5); + } + case AIScriptTokenFuncType.EVAL_ALL_BUFF: + return new AIScriptNumericToken(AIBuffEvaluationUtility.EvalAllBuff(tagOwner, field, argList, playPtn, situation)); + case AIScriptTokenFuncType.EVAL_RANDOM_BUFF: + return new AIScriptNumericToken(AIBuffEvaluationUtility.EvalRandomBuff(tagOwner, field, argList, playPtn, situation)); + case AIScriptTokenFuncType.EVAL_TARGETING_BUFF: + return new AIScriptNumericToken(AIBuffEvaluationUtility.EvalTargetingBuff(tagOwner, field, argList, playPtn, situation)); + case AIScriptTokenFuncType.EVAL_ECHO_DAMAGE: + { + List list11 = new List(); + for (int num17 = argList.Count - 1; num17 > 0; num17--) + { + list11.Add(argList[num17]); + } + int damage2 = (int)argList[0].Value; + return new AIScriptNumericToken(AIDamageSimulationUtility.EvalEchoDamage(tagOwner, field, list11, damage2, playPtn, situation)); + } + case AIScriptTokenFuncType.EVAL_LEADER_DAMAGE: + { + int damageAmount = (int)argList[0].Value; + AIScriptTokenArgType argumentType3 = ((AIScriptArgumentToken)argList[1]).ArgumentType; + AIVirtualCard aIVirtualCard4 = null; + switch (argumentType3) + { + case AIScriptTokenArgType.ENEMY_CLASS: + aIVirtualCard4 = (tagOwner.IsAlly ? field.EnemyClass : field.AllyClass); + break; + case AIScriptTokenArgType.ALLY_CLASS: + aIVirtualCard4 = (tagOwner.IsAlly ? field.AllyClass : field.EnemyClass); + break; + default: + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(AILeaderLifeEvaluationUtility.Evaluate(aIVirtualCard4.Life - aIVirtualCard4.SimulateDamageAmount(damageAmount, isSkillDamage: true, tagOwner.IsSpell), aIVirtualCard4.Life, aIVirtualCard4.IsAlly, tagOwner.IsAlly)); + } + case AIScriptTokenFuncType.EVAL_LEADER_HEAL: + { + int originalHealValue = (int)argList[0].Value; + AIScriptTokenArgType argumentType4 = ((AIScriptArgumentToken)argList[1]).ArgumentType; + AIVirtualCard aIVirtualCard5 = null; + switch (argumentType4) + { + case AIScriptTokenArgType.ENEMY_CLASS: + aIVirtualCard5 = (tagOwner.IsAlly ? field.EnemyClass : field.AllyClass); + break; + case AIScriptTokenArgType.ALLY_CLASS: + aIVirtualCard5 = (tagOwner.IsAlly ? field.AllyClass : field.EnemyClass); + break; + } + if (aIVirtualCard5 == null || aIVirtualCard5.Life <= 0) + { + return new AIScriptNumericToken(0f); + } + originalHealValue = AIHealSimulationUtility.CalcHealModifier(aIVirtualCard5, playPtn, situation, originalHealValue); + return new AIScriptNumericToken(AILeaderLifeEvaluationUtility.Evaluate(Mathf.Min(aIVirtualCard5.Life + originalHealValue, aIVirtualCard5.MaxLife), aIVirtualCard5.Life, aIVirtualCard5.IsAlly, tagOwner.IsAlly)); + } + case AIScriptTokenFuncType.DECK_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIDeckSimulationUtility.GetFilteredDeck(argList, tagOwner, field, playPtn, situation)?.Count ?? 0); + case AIScriptTokenFuncType.IS_CLASH_TARGET: + if (aIVirtualCard == null) + { + return new AIScriptNumericToken(0f); + } + argList.Reverse(); + return new AIScriptNumericToken(AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, null, argList, playPtn, tagOwner, situation) ? 1f : 0f); + case AIScriptTokenFuncType.IS_ATTACK_TARGET: + { + if (aIVirtualCard2 == null) + { + return new AIScriptNumericToken(0f); + } + AIScriptArgumentToken obj = (AIScriptArgumentToken)argList[0]; + AIScriptTokenArgType argumentType2 = obj.ArgumentType; + _ = obj.IsNot; + return new AIScriptNumericToken(AISkillSimulationUtility.HasSkill(aIVirtualCard2, argumentType2, tagOwner.SelfField.AI, playPtn) ? 1f : 0f); + } + case AIScriptTokenFuncType.IS_SELECTED_TARGET: + { + AIScriptTokenArgType aIScriptTokenArgType2 = AIScriptTokenArgType.NONE; + if (argList[0] is AIScriptArgumentToken aIScriptArgumentToken10) + { + aIScriptTokenArgType2 = aIScriptArgumentToken10.ArgumentType; + } + if (aIScriptTokenArgType2 != AIScriptTokenArgType.TARGET_SELECT && aIScriptTokenArgType2 != AIScriptTokenArgType.SECOND_TARGET_SELECT) + { + return new AIScriptNumericToken(0f); + } + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(aIScriptTokenArgType2); + if (situationTarget == null || !situationTarget.HasTarget) + { + return new AIScriptNumericToken(0f); + } + argList.RemoveAt(0); + argList.Reverse(); + List targets = situationTarget.Targets; + bool flag = false; + for (int num26 = 0; num26 < targets.Count; num26++) + { + if (AIFilteringUtility.CheckMatchTargetFiltering(targets[num26], null, argList, playPtn, tagOwner, situation)) + { + flag = true; + break; + } + } + return new AIScriptNumericToken(flag ? 1f : 0f); + } + case AIScriptTokenFuncType.IS_NEXT_PLAY: + if (playPtn == null || playPtn.Count <= 0) + { + return new AIScriptNumericToken(0f); + } + argList.Reverse(); + return new AIScriptNumericToken(AIFilteringUtility.CheckMatchTargetFiltering(field.AllyHandCards[playPtn[0]], field.AllyHandCards, argList, playPtn, tagOwner, situation) ? 1 : 0); + case AIScriptTokenFuncType.LIFE: + argList.Reverse(); + return new AIScriptNumericToken(AIGetStatusUtility.GetLife(tagOwner, field, playPtn, situation, argList)); + case AIScriptTokenFuncType.ATTACK: + argList.Reverse(); + return new AIScriptNumericToken(AIGetStatusUtility.GetAttack(tagOwner, field, playPtn, situation, argList)); + case AIScriptTokenFuncType.EVAL_RANDOM_MULTI_SELECT_DAMAGE: + { + List list16 = new List(); + for (int num20 = argList.Count - 1; num20 > 0; num20--) + { + list16.Add(argList[num20]); + } + int damage5 = (int)argList[0].Value; + int selectCount = (int)argList[1].Value; + return new AIScriptNumericToken(AIDamageSimulationUtility.EvalRandomMultiSelectDamage(tagOwner, field, list16, playPtn, situation, damage5, selectCount)); + } + case AIScriptTokenFuncType.EVAL_DIVIDED_DAMAGE: + { + AIScriptTokenBase aIScriptTokenBase4 = argList[0]; + int damage4 = (int)aIScriptTokenBase4.Value; + argList.Remove(aIScriptTokenBase4); + argList.Reverse(); + List candidates = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, argList, tagOwner, playPtn, situation); + return new AIScriptNumericToken(AIDamageSimulationUtility.EvalOldestDamage(tagOwner, candidates, field, damage4, playPtn, situation)); + } + case AIScriptTokenFuncType.DECK_NAME_COUNT: + { + argList.Reverse(); + List filteredDeck2 = AIDeckSimulationUtility.GetFilteredDeck(argList, tagOwner, field, playPtn, situation); + return new AIScriptNumericToken((filteredDeck2 != null) ? AIFilteringUtility.GetCardNameCountFromList(filteredDeck2, argList, tagOwner, playPtn, situation) : 0); + } + case AIScriptTokenFuncType.BROKEN_COUNT: + { + float num10 = 0f; + AIScriptTokenBase aIScriptTokenBase2 = argList[0]; + int num11 = (int)aIScriptTokenBase2.Value; + if (num11 == 142) + { + argList.Remove(aIScriptTokenBase2); + } + argList.Reverse(); + List list6 = AIFilteringUtility.MultipleFiltering(tagOwner.IsAlly ? field.CardListSet.AllyDestroyedCards : field.CardListSet.EnemyDestroyedCards, argList, tagOwner, playPtn, null, isBlockDeadCard: false); + if (num11 == 142) + { + if (list6 != null) + { + foreach (AIVirtualCard item in list6) + { + if (item.DeadTurn) + { + num10 += 1f; + } + } + } + return new AIScriptNumericToken(num10); + } + num10 = ((list6 != null) ? ((float)list6.Count) : 0f); + return new AIScriptNumericToken(num10); + } + case AIScriptTokenFuncType.BROKEN_NAME_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIFilteringUtility.GetCardNameCountFromList(tagOwner.IsAlly ? field.CardListSet.AllyDestroyedCards : field.CardListSet.EnemyDestroyedCards, argList, tagOwner, playPtn, situation)); + case AIScriptTokenFuncType.BROKEN_COST_SUM: + argList.Reverse(); + return new AIScriptNumericToken(AIBrokenCostSumUtility.GetBrokenCostSum(field, tagOwner, argList, playPtn, situation)); + case AIScriptTokenFuncType.LEAVE_NAME_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIFilteringUtility.GetCardNameCountFromList(tagOwner.IsAlly ? field.CardListSet.AllyLeftCards : field.CardListSet.EnemyLeftCards, argList, tagOwner, playPtn, situation)); + case AIScriptTokenFuncType.LEAVE_COUNT: + { + AIScriptTokenBase aIScriptTokenBase5 = argList[0]; + int num30 = (int)aIScriptTokenBase5.Value; + if (num30 == 142) + { + argList.Remove(aIScriptTokenBase5); + } + argList.Reverse(); + List targets2 = ((num30 != 142) ? (tagOwner.IsAlly ? field.CardListSet.AllyLeftCards : field.CardListSet.EnemyLeftCards) : (tagOwner.IsAlly ? field.CardListSet.AllyLeftCardsThisTurn : field.CardListSet.EnemyLeftCardsThisTurn)); + return new AIScriptNumericToken(AIFilteringUtility.MultipleFiltering(targets2, argList, tagOwner, playPtn, situation, isBlockDeadCard: false)?.Count ?? 0); + } + case AIScriptTokenFuncType.DESTROYED_COUNT: + { + AIScriptIDToken aIScriptIDToken2 = argList[0] as AIScriptIDToken; + float num27 = 0f; + if (aIScriptIDToken2 != null) + { + int iD7 = aIScriptIDToken2.ID; + foreach (AIVirtualCard enemyDestroyedCard in field.CardListSet.EnemyDestroyedCards) + { + if (!enemyDestroyedCard.IsUnit) + { + continue; + } + List destroyedBySkillList = enemyDestroyedCard.BaseCard.DestroyedBySkillList; + for (int num28 = 0; num28 < destroyedBySkillList.Count; num28++) + { + if (destroyedBySkillList.ElementAt(num28).BaseCardId == iD7) + { + num27 += 1f; + } + } + } + } + return new AIScriptNumericToken(num27); + } + case AIScriptTokenFuncType.IS_TRIBE: + { + AIScriptTokenArgType argumentType6 = ((AIScriptArgumentToken)argList[0]).ArgumentType; + return new AIScriptNumericToken(tagOwner.IsTribe(argumentType6) ? 1f : 0f); + } + case AIScriptTokenFuncType.PLAYED_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(field.PlayedCardContainer.GetPlayedCountInTurn(argList, tagOwner, playPtn, situation)); + case AIScriptTokenFuncType.PLAYED_COUNT_IN_GAME: + argList.Reverse(); + return new AIScriptNumericToken(field.PlayedCardContainer.GetPlayedCountInGame(argList, tagOwner, playPtn, situation)); + case AIScriptTokenFuncType.PLAYED_COUNT_IN_PREVIOUS_TURN: + argList.Reverse(); + if (argList[0] is AIScriptArgumentToken aIScriptArgumentToken9 && aIScriptArgumentToken9.IsSideArgType(includeBoth: false)) + { + bool isAllyList = tagOwner.IsAlly == (aIScriptArgumentToken9.ArgumentType == AIScriptTokenArgType.ALLY); + return new AIScriptNumericToken(field.PlayedCardContainer.GetPlayedCountInPreviousTurn(isAllyList, argList, tagOwner, playPtn, situation)); + } + AIConsoleUtility.LogError("PLAYED_COUNT_IN_PREVIOUS_TURN error!! side parameter is missing"); + return new AIScriptNumericToken(0f); + case AIScriptTokenFuncType.PLAYED_NAME_COUNT: + { + AIScriptTokenArgType turnOrGame = AIScriptTokenArgType.NONE; + if (argList[0] is AIScriptArgumentToken aIScriptArgumentToken8) + { + turnOrGame = aIScriptArgumentToken8.ArgumentType; + } + argList.RemoveAt(0); + argList.Reverse(); + return new AIScriptNumericToken(field.PlayedCardContainer.GetPlayedNameCount(argList, turnOrGame, tagOwner, playPtn, situation)); + } + case AIScriptTokenFuncType.RANDOM: + { + if (argList[0].Value == 0f) + { + return new AIScriptNumericToken(0f); + } + int num21 = field.AI.ALLY.DeckCardList.Count; + for (int num22 = 0; num22 < field.AllyHandCards.Count; num22++) + { + num21 += field.AllyHandCards[num22].BaseCost; + } + return new AIScriptNumericToken((float)num21 % argList[0].Value); + } + case AIScriptTokenFuncType.IS_REANIMATE: + { + int cost = (int)argList[0].Value; + return new AIScriptNumericToken(AIReanimateSimulationUtility.IsReanimate(tagOwner, cost) ? 1f : 0f); + } + case AIScriptTokenFuncType.DAMAGE_COUNT: + { + argList.Reverse(); + AIScriptTokenArgType argumentType5 = ((AIScriptArgumentToken)argList[0]).ArgumentType; + if (argumentType5 != AIScriptTokenArgType.TURN && argumentType5 != AIScriptTokenArgType.GAME) + { + return new AIScriptNumericToken(0f); + } + int num19 = 0; + if (argList.Count == 1) + { + num19 = AIPlayerLifeSimulationUtility.GetAllSelfTurnDamageCount(tagOwner, field, playPtn, argumentType5); + } + else + { + switch (((AIScriptArgumentToken)argList[1]).ArgumentType) + { + case AIScriptTokenArgType.PLAYED: + num19 = AIPlayerLifeSimulationUtility.GetSelfTurnDamageCountAtPlayed(tagOwner, field, playPtn, argumentType5); + break; + case AIScriptTokenArgType.PLAYPTN: + num19 = AIPlayerLifeSimulationUtility.GetSelfTurnDamageCountAtPlayPtn(tagOwner, field, playPtn); + break; + case AIScriptTokenArgType.BEFORE_PLAYPTN: + num19 = AIPlayerLifeSimulationUtility.GetSelfTurnDamageCountAtBeforePlayPtn(tagOwner, field, playPtn, argumentType5); + break; + } + } + return new AIScriptNumericToken(num19); + } + case AIScriptTokenFuncType.HEAL_COUNT: + return new AIScriptNumericToken(AIHealCountUtility.GetHealCount(tagOwner, field, situation, playPtn, argList)); + case AIScriptTokenFuncType.FORCED_EXCHANGE: + { + int attackLimit = (int)argList[0].Value; + return new AIScriptNumericToken(field.EvalForcedExchangeVirtual(attackLimit, playPtn)); + } + case AIScriptTokenFuncType.TOTAL_DAMAGE: + return new AIScriptNumericToken(field.GetTotalDamage(argList, tagOwner, situation)); + case AIScriptTokenFuncType.EVAL_REANIMATE: + return new AIScriptNumericToken(AIEvalReanimateUtility.EvalReanimate(tagOwner, playPtn, situation, argList)); + case AIScriptTokenFuncType.FUSION_COUNT: + return new AIScriptNumericToken(AIFusionCountUtility.GetFusionCount(tagOwner, argList, playPtn, situation)); + case AIScriptTokenFuncType.NOW_FUSION_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIFusionCountUtility.GetNowFusionCount(tagOwner, argList, playPtn)); + case AIScriptTokenFuncType.FUSION_COUNT_AT_ONCE: + return new AIScriptNumericToken(AIFusionCountUtility.GetFusionCountAtOnce(tagOwner, argList, playPtn, situation)); + case AIScriptTokenFuncType.FUSION_NAME_COUNT: + return new AIScriptNumericToken(AIFusionCountUtility.GetFusionNameCount(tagOwner, argList, playPtn, situation)); + case AIScriptTokenFuncType.IS_SKILL_OCCURRED: + return new AIScriptNumericToken(tagOwner.IsSkillOccurred(field, playPtn, situation, argList) ? 1f : 0f); + case AIScriptTokenFuncType.SKILL_ACTIVATE_COUNT: + return new AIScriptNumericToken(tagOwner.GetSkillActivateCount(field, playPtn, situation, argList)); + case AIScriptTokenFuncType.HAND_MAX_ATTACK: + { + argList.Reverse(); + argList.Add(new AIScriptArgumentToken(AIScriptTokenArgType.MAX_ATTACK, isNot: false)); + List list9 = AIFilteringUtility.MultipleFiltering(field.AllyHandCards, argList, tagOwner, playPtn, situation); + if (list9 == null || list9.Count <= 0) + { + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(list9[0].Attack); + } + case AIScriptTokenFuncType.DECK_MAX_COST: + { + argList.Reverse(); + List filteredDeck = AIDeckSimulationUtility.GetFilteredDeck(argList, tagOwner, field, playPtn, situation); + if (filteredDeck == null || filteredDeck.Count <= 0) + { + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(filteredDeck.Max((AIVirtualCard c) => c.BaseCost)); + } + case AIScriptTokenFuncType.INPLAY_LARGEST_LIFE: + { + argList.Reverse(); + List list7 = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothInplayCards, argList, tagOwner, playPtn, situation); + if (list7 == null || list7.Count <= 0) + { + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(list7.Max((AIVirtualCard c) => c.Life)); + } + case AIScriptTokenFuncType.LEADER_MAX_LIFE: + { + if (!(argList[0] is AIScriptArgumentToken aIScriptArgumentToken5)) + { + return new AIScriptNumericToken(0f); + } + AIVirtualCard aIVirtualCard3 = null; + if (aIScriptArgumentToken5.ArgumentType == AIScriptTokenArgType.OPPONENT) + { + aIVirtualCard3 = (tagOwner.IsAlly ? field.EnemyClass : field.AllyClass); + } + else if (aIScriptArgumentToken5.ArgumentType == AIScriptTokenArgType.ALLY) + { + aIVirtualCard3 = (tagOwner.IsAlly ? field.AllyClass : field.EnemyClass); + } + if (aIVirtualCard3 == null) + { + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(aIVirtualCard3.MaxLife); + } + case AIScriptTokenFuncType.IS_DISCARD_TARGET: + argList.Reverse(); + return new AIScriptNumericToken(AIDiscardUtility.IsMatchedDiscardTarget(tagOwner, argList, playPtn, situation) ? 1f : 0f); + case AIScriptTokenFuncType.DISCARD_COUNT: + if (!(argList[0] is AIScriptArgumentToken aIScriptArgumentToken2)) + { + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(AIDiscardUtility.GetDiscardCount(aIScriptArgumentToken2.ArgumentType, tagOwner, playPtn, situation)); + case AIScriptTokenFuncType.BOUNCE_COUNT: + if (argList[0] is AIScriptArgumentToken { ArgumentType: var argumentType }) + { + return new AIScriptNumericToken(AIBounceSimulationUtility.GetBounceCount(field, situation, argumentType)); + } + return new AIScriptNumericToken(0f); + case AIScriptTokenFuncType.EMOTE_PLAY_COUNT: + { + int category = (int)argList[0].Value; + return new AIScriptNumericToken(field.AI.EmoteMng.GetEmotePlayCount(category)); + } + case AIScriptTokenFuncType.DRAW_COUNT: + return GetDrawCountResultToken(argList, tagOwner, field, playPtn); + case AIScriptTokenFuncType.MEMBER_MAX_ATK: + argList.Reverse(); + return new AIScriptNumericToken(field.GetMemberMaxAttack(tagOwner, argList, playPtn, situation)); + case AIScriptTokenFuncType.IS_BURIAL_RITE: + argList.Reverse(); + return new AIScriptNumericToken(AIBurialUtility.IsBurialRite(situation, argList, field) ? 1f : 0f); + case AIScriptTokenFuncType.BURIAL_COUNT: + if (!(argList[0] is AIScriptArgumentToken aIScriptArgumentToken13)) + { + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(AIBurialRiteSimulationUtility.GetBurialCount(aIScriptArgumentToken13.ArgumentType, field)); + case AIScriptTokenFuncType.RESONANCE_START_COUNT: + if (!(argList[0] is AIScriptArgumentToken aIScriptArgumentToken11) || !(argList[1] is AIScriptArgumentToken aIScriptArgumentToken12)) + { + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(GetResonanceStartCount(tagOwner, field, aIScriptArgumentToken12.ArgumentType, aIScriptArgumentToken11.ArgumentType)); + case AIScriptTokenFuncType.SUMMON_COUNT: + { + if (!AISummonCountUtility.ClassificateSummonCountArgument(argList, out var filters3, out var turnOrGame2, out var playedType)) + { + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(AISummonCountUtility.GetSummonCount(tagOwner, filters3, turnOrGame2, playedType, playPtn, situation)); + } + case AIScriptTokenFuncType.BUFF_COUNT: + return new AIScriptNumericToken(AIBuffCountUtility.GetBuffCount(tagOwner, field, situation, playPtn, argList)); + case AIScriptTokenFuncType.IS_HOLDING_BATTLE_SKILL: + if (!(argList[0] is AIScriptTextToken aIScriptTextToken2)) + { + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(tagOwner.IsHoldingBattleSkill(aIScriptTextToken2.Text) ? 1 : 0); + case AIScriptTokenFuncType.IS_LEADER_HOLDING_BATTLE_SKILL: + if (!(argList[0] is AIScriptTextToken aIScriptTextToken)) + { + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(field.AllyClass.IsHoldingBattleSkill(aIScriptTextToken.Text) ? 1 : 0); + case AIScriptTokenFuncType.STACK_COUNT: + { + if (argList.Count <= 0 || !(argList[0] is AIScriptArgumentToken aIScriptArgumentToken7)) + { + return new AIScriptNumericToken(0f); + } + if (aIScriptArgumentToken7.ArgumentType != AIScriptTokenArgType.ALLY && aIScriptArgumentToken7.ArgumentType != AIScriptTokenArgType.OPPONENT) + { + return new AIScriptNumericToken(0f); + } + bool isAlly = tagOwner.IsAlly ^ (aIScriptArgumentToken7.ArgumentType == AIScriptTokenArgType.OPPONENT); + return new AIScriptNumericToken(AIStackCountUtility.GetStackCount(field, isAlly)); + } + case AIScriptTokenFuncType.OWN_DESTROY_COUNT: + { + List ownDestroyedCards = situation.GetOwnDestroyedCards(); + if (ownDestroyedCards == null) + { + return new AIScriptNumericToken(0f); + } + argList.Reverse(); + return new AIScriptNumericToken(AIFilteringUtility.MultipleFiltering(ownDestroyedCards, argList, tagOwner, playPtn, situation, isBlockDeadCard: false)?.Count ?? 0); + } + case AIScriptTokenFuncType.IS_SELECTABLE: + { + float value4 = argList[0].Value; + argList.RemoveAt(0); + argList.Reverse(); + return new AIScriptNumericToken(AIIsSelectableUtility.IsSelectable(argList, value4, tagOwner, field, playPtn, situation) ? 1 : 0); + } + case AIScriptTokenFuncType.IS_ENEMY_AI_ID: + return new AIScriptNumericToken((argList[0].Value == (float)EnemyAI.EnemyAIID) ? 1f : 0f); + case AIScriptTokenFuncType.ADD_HAND_COUNT: + { + AIScriptTokenBase aIScriptTokenBase3 = argList[0]; + AIScriptTokenArgType aIScriptTokenArgType = (AIScriptTokenArgType)aIScriptTokenBase3.Value; + if (aIScriptTokenArgType != AIScriptTokenArgType.TURN && aIScriptTokenArgType != AIScriptTokenArgType.GAME) + { + AIConsoleUtility.LogError("ADD_HAND_COUNT Arg Error : Last arg is only valid TURN or GAME"); + return new AIScriptNumericToken(0f); + } + argList.Remove(aIScriptTokenBase3); + argList.Reverse(); + List list13 = new List(); + switch (aIScriptTokenArgType) + { + case AIScriptTokenArgType.TURN: + { + List list15 = (tagOwner.IsAlly ? field.AllyTurnHandAddedCards : field.EnemyTurnHandAddedCards); + if (list15 != null && list15.Count > 0) + { + list13.AddRange(list15); + } + break; + } + case AIScriptTokenArgType.GAME: + { + List list14 = (tagOwner.IsAlly ? field.AllyGameHandAddedCards : field.EnemyGameHandAddedCards); + if (list14 != null && list14.Count > 0) + { + list13.AddRange(list14); + } + break; + } + } + return new AIScriptNumericToken(AIFilteringUtility.MultipleFiltering(list13, argList, tagOwner, playPtn, situation)?.Count ?? 0); + } + case AIScriptTokenFuncType.BASE_COST: + { + argList.Reverse(); + List list10 = AIFilteringUtility.MultipleFiltering(field.CardListSet.AllReferableCards, argList, tagOwner, playPtn, situation, isBlockDeadCard: false); + if (list10 == null || list10.Count <= 0) + { + return new AIScriptNumericToken(0f); + } + if (list10.Count > 1) + { + AIConsoleUtility.LogError("BASE_COST Func : Error!!! Multiple cards have been selected"); + } + return new AIScriptNumericToken(list10[0].BaseCost); + } + case AIScriptTokenFuncType.RECEIVED_DAMAGE_SUM: + { + argList.Reverse(); + List list8 = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, argList, tagOwner, playPtn, situation); + if (list8 == null || list8.Count <= 0) + { + return new AIScriptNumericToken(0f); + } + float num14 = 0f; + for (int num15 = 0; num15 < field.DamagedCardsByLastAction.Count; num15++) + { + Tuple tuple = field.DamagedCardsByLastAction[num15]; + for (int num16 = 0; num16 < list8.Count; num16++) + { + AIVirtualCard card = list8[num16]; + if (tuple.first.IsSameCard(card)) + { + num14 += (float)tuple.second; + } + } + } + return new AIScriptNumericToken(num14); + } + case AIScriptTokenFuncType.IS_PLAYER_CHARA_ID: + if (argList == null || argList.Count <= 0) + { + AIConsoleUtility.LogError("IS_PLAYER_CHARA_ID error!! argList is invalid"); + return new AIScriptNumericToken(0f); + } + if (argList[0] is AIScriptNumericToken aIScriptNumericToken) + { + int num8 = (int)aIScriptNumericToken.Value; + return new AIScriptNumericToken((field.AI.PlayerCharaId == num8) ? 1f : 0f); + } + return new AIScriptNumericToken(0f); + case AIScriptTokenFuncType.FUSION_COUNT_IN_GAME: + argList.Reverse(); + return new AIScriptNumericToken(AIFusionCountUtility.GetFusedCardCountInGame(tagOwner, argList, playPtn, situation, isWithoutSameId: false)); + case AIScriptTokenFuncType.FUSION_NAME_COUNT_IN_GAME: + argList.Reverse(); + return new AIScriptNumericToken(AIFusionCountUtility.GetFusedCardCountInGame(tagOwner, argList, playPtn, situation, isWithoutSameId: true)); + case AIScriptTokenFuncType.IS_PLAYER_ABILITY_ID: + if (argList != null && argList.Count > 0 && argList[0] is AIScriptIDToken { ID: var iD2 }) + { + return new AIScriptNumericToken(field.AI.HasPlayerAbilityId(iD2) ? 1f : 0f); + } + return new AIScriptNumericToken(0f); + case AIScriptTokenFuncType.BANISH_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIBanishSimulationUtility.GetInplayBanishedCount(tagOwner, field, playPtn, situation, argList)); + case AIScriptTokenFuncType.HAND_BANISH_COUNT: + argList.Reverse(); + return new AIScriptNumericToken(AIBanishSimulationUtility.GetHandBanishedCount(tagOwner, field, playPtn, situation, argList)); + case AIScriptTokenFuncType.IS_BOTH_CLASS: + { + if (argList == null || argList.Count <= 1) + { + AIConsoleUtility.LogError("IS_BOTH_CLASS error!! arg count is not enough"); + return new AIScriptNumericToken(0f); + } + argList.Reverse(); + CardBasePrm.ClanType clanType = CardBasePrm.ClanType.NONE; + CardBasePrm.ClanType clanType2 = CardBasePrm.ClanType.NONE; + if (argList[0] is AIScriptArgumentToken aIScriptArgumentToken3 && aIScriptArgumentToken3.IsSideArgType(includeBoth: false)) + { + bool num = tagOwner.IsAlly == (aIScriptArgumentToken3.ArgumentType == AIScriptTokenArgType.ALLY); + clanType = (num ? field.AllyClass.Clan : field.EnemyClass.Clan); + clanType2 = (num ? field.AI.AISubClassType : field.AI.PlayerSubClassType); + for (int i = 1; i < argList.Count; i++) + { + if (argList[i] is AIScriptArgumentToken aIScriptArgumentToken4) + { + CardBasePrm.ClanType clanType3 = AIPlayTagInitializingUtility.ConvertTokenArgTypeToClanType(aIScriptArgumentToken4.ArgumentType); + if (clanType3 != CardBasePrm.ClanType.NONE && (clanType == clanType3 || clanType2 == clanType3)) + { + return new AIScriptNumericToken(1f); + } + } + } + return new AIScriptNumericToken(0f); + } + AIConsoleUtility.LogError("IS_BOTH_CLASS error!! side parameter is invalid"); + return new AIScriptNumericToken(0f); + } + case AIScriptTokenFuncType.EVAL_ATTACK_REMOVE: + return new AIScriptNumericToken(AIEvalAttackRemoveUtility.EvalAttackRemove(tagOwner, field, playPtn, situation, argList)); + case AIScriptTokenFuncType.ADDED_DECK_COUNT_IN_GAME: + argList.Reverse(); + return new AIScriptNumericToken(AIFilteringUtility.MultipleFiltering(tagOwner.IsAlly ? field.AllyGameAddUpdateDeckCards : field.EnemyGameAddUpdateDeckCards, argList, tagOwner, playPtn, situation)?.Count ?? 0); + default: + return new AIScriptNumericToken(0f); + } + } + + private static int GetResonanceStartCount(AIVirtualCard tagOwner, AIVirtualField field, AIScriptTokenArgType side, AIScriptTokenArgType gameOrTurn) + { + if (side != AIScriptTokenArgType.ALLY) + { + _ = 85; + } + if (gameOrTurn != AIScriptTokenArgType.GAME) + { + _ = 142; + } + if ((side == AIScriptTokenArgType.ALLY && tagOwner.IsAlly) || (side == AIScriptTokenArgType.OPPONENT && !tagOwner.IsAlly)) + { + if (gameOrTurn == AIScriptTokenArgType.GAME) + { + return field.AllyGameResonanceStartCount; + } + return field.AllyTurnResonanceStartCount; + } + if (gameOrTurn == AIScriptTokenArgType.GAME) + { + return field.EnemyGameResonanceStartCount; + } + return field.EnemyTurnResonanceStartCount; + } + + private static AIScriptNumericToken GetDrawCountResultToken(List argList, AIVirtualCard owner, AIVirtualField field, List playPtn) + { + if (argList.Count <= 0 || argList.Count > 2) + { + AIConsoleUtility.LogError("DRAW_COUNT error!! argList.Count == " + argList.Count); + return new AIScriptNumericToken(0f); + } + AIScriptTokenArgType aIScriptTokenArgType = AIScriptTokenArgType.NONE; + AIScriptTokenArgType range = AIScriptTokenArgType.NONE; + if (argList[argList.Count - 1] is AIScriptArgumentToken aIScriptArgumentToken) + { + aIScriptTokenArgType = aIScriptArgumentToken.ArgumentType; + } + if (argList.Count > 1 && argList[argList.Count - 2] is AIScriptArgumentToken aIScriptArgumentToken2) + { + range = aIScriptArgumentToken2.ArgumentType; + } + if (aIScriptTokenArgType != AIScriptTokenArgType.TURN && aIScriptTokenArgType != AIScriptTokenArgType.GAME) + { + AIConsoleUtility.LogError("DRAW_COUNT error!!! period == " + aIScriptTokenArgType); + return new AIScriptNumericToken(0f); + } + return new AIScriptNumericToken(AIDrawCountUtility.GetDrawCount(owner, field, playPtn, aIScriptTokenArgType, range)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIScriptFunctionToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIScriptFunctionToken.cs new file mode 100644 index 0000000..963b0d4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIScriptFunctionToken.cs @@ -0,0 +1,33 @@ +namespace Wizard; + +public class AIScriptFunctionToken : AIScriptTokenBase +{ + public AIScriptTokenFuncType FuncType; + + public int ArgCount; + + public AIScriptFunctionToken(AIScriptTokenFuncType funcType, int refNum) + : base(AIScriptTokenType.FUNC, refNum) + { + FuncType = funcType; + ArgCount = refNum; + } + + public override AIScriptTokenBase Clone() + { + return new AIScriptFunctionToken(FuncType, ArgCount); + } + + public override bool IsEqual(AIScriptTokenBase token) + { + if (!(token is AIScriptFunctionToken aIScriptFunctionToken)) + { + return false; + } + if (FuncType == aIScriptFunctionToken.FuncType) + { + return ArgCount == aIScriptFunctionToken.ArgCount; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIScriptIDToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIScriptIDToken.cs new file mode 100644 index 0000000..16ea3d1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIScriptIDToken.cs @@ -0,0 +1,33 @@ +namespace Wizard; + +public class AIScriptIDToken : AIScriptTokenBase +{ + public int ID; + + public bool IsNot { get; private set; } + + public AIScriptIDToken(int id, bool isNot) + : base(AIScriptTokenType.ID, 0f) + { + ID = id; + IsNot = isNot; + } + + public override AIScriptTokenBase Clone() + { + return new AIScriptIDToken(ID, IsNot); + } + + public override bool IsEqual(AIScriptTokenBase token) + { + if (!(token is AIScriptIDToken aIScriptIDToken)) + { + return false; + } + if (ID == aIScriptIDToken.ID) + { + return IsNot == aIScriptIDToken.IsNot; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIScriptNumericToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIScriptNumericToken.cs new file mode 100644 index 0000000..d52b061 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIScriptNumericToken.cs @@ -0,0 +1,14 @@ +namespace Wizard; + +public class AIScriptNumericToken : AIScriptTokenBase +{ + public AIScriptNumericToken(float value) + : base(AIScriptTokenType.NUMERIC, value) + { + } + + public override AIScriptTokenBase Clone() + { + return new AIScriptNumericToken(Value); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIScriptOperatorSymbolToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIScriptOperatorSymbolToken.cs new file mode 100644 index 0000000..c17e19a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIScriptOperatorSymbolToken.cs @@ -0,0 +1,14 @@ +namespace Wizard; + +public class AIScriptOperatorSymbolToken : AIScriptTokenBase +{ + public AIScriptOperatorSymbolToken(AIScriptTokenType type) + : base(type, 0f) + { + } + + public override AIScriptTokenBase Clone() + { + return new AIScriptOperatorSymbolToken(base.Type); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIScriptParser.cs b/SVSim.BattleEngine/Engine/Wizard/AIScriptParser.cs new file mode 100644 index 0000000..b4175d0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIScriptParser.cs @@ -0,0 +1,1454 @@ +using System; + +namespace Wizard; + +public static class AIScriptParser +{ + public static int ParseInt(string num) + { + if (num == "") + { + return 0; + } + try + { + return int.Parse(num); + } + catch (Exception) + { + return 0; + } + } + + public static AIScriptTokenBase ConvertWordToToken(string word) + { + if (float.TryParse(word, out var result)) + { + return new AIScriptNumericToken(result); + } + switch (word) + { + case "+": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.PLUS); + case "-": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.MINUS); + case "*": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.MULTI); + case "/": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.DIV); + case "%": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.REMAIN); + case "(": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.LEFT_BLACKET); + case ")": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.RIGHT_BLACKET); + case ",": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.COMMA); + case ">": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.MORE_THAN); + case ">=": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.MORE_EQUAL); + case "<": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.LESS_THAN); + case "<=": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.LESS_EQUAL); + case "==": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.EQUAL); + case "max": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.MAX); + case "min": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.MIN); + case "|": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.OR); + case "&": + return new AIScriptOperatorSymbolToken(AIScriptTokenType.AND); + default: + { + bool isNot = false; + if (word.StartsWith("!")) + { + isNot = true; + word = word.Substring(1); + } + return word switch + { + "NOW_TURN" => new AIScriptVariableToken(AIScriptTokenVariableType.NOW_TURN), + "COUNTDOWN" => new AIScriptVariableToken(AIScriptTokenVariableType.COUNTDOWN), + "REINCARNATION_MAX" => new AIScriptVariableToken(AIScriptTokenVariableType.REINCARNATION_MAX), + "SPELLBOOST" => new AIScriptVariableToken(AIScriptTokenVariableType.SPELLBOOST), + "FIELD_SPACE" => new AIScriptVariableToken(AIScriptTokenVariableType.FIELD_SPACE), + "ALLY_UNIT_MIN" => new AIScriptVariableToken(AIScriptTokenVariableType.ALLY_UNIT_MIN), + "ALLY_UNIT_MAX" => new AIScriptVariableToken(AIScriptTokenVariableType.ALLY_UNIT_MAX), + "ALLY_ATTACKABLE_ATK_MAX" => new AIScriptVariableToken(AIScriptTokenVariableType.ALLY_ATTACKABLE_ATK_MAX), + "ALLY_NON_ATTACKABLE_ATK_MAX" => new AIScriptVariableToken(AIScriptTokenVariableType.ALLY_NON_ATTACKABLE_ATK_MAX), + "ALLY_MAX_ATTACKABLE_LIFE" => new AIScriptVariableToken(AIScriptTokenVariableType.ALLY_MAX_ATTACKABLE_LIFE), + "ENEMY_UNIT_MIN" => new AIScriptVariableToken(AIScriptTokenVariableType.ENEMY_UNIT_MIN), + "ENEMY_UNIT_MAX" => new AIScriptVariableToken(AIScriptTokenVariableType.ENEMY_UNIT_MAX), + "HAND_COUNT_E" => new AIScriptVariableToken(AIScriptTokenVariableType.HAND_COUNT_E), + "DECK_COUNT_E" => new AIScriptVariableToken(AIScriptTokenVariableType.DECK_COUNT_E), + "PLAYPTN_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.PLAYPTN_COUNT), + "MEMBER_ATK_SUM" => new AIScriptVariableToken(AIScriptTokenVariableType.MEMBER_ATK_SUM), + "MEMBER_MAX_LIFE" => new AIScriptVariableToken(AIScriptTokenVariableType.MEMBER_MAX_LIFE), + "MEMBER_LIFE_SUM" => new AIScriptVariableToken(AIScriptTokenVariableType.MEMBER_LIFE_SUM), + "INPLAY_ATTACK_SUM_TO_LEADER" => new AIScriptVariableToken(AIScriptTokenVariableType.INPLAY_ATTACK_SUM_TO_LEADER), + "SUMMON_DRUNKEN_ATK_MAX" => new AIScriptVariableToken(AIScriptTokenVariableType.SUMMON_DRUNKEN_ATK_MAX), + "ATTACK_TARGET_ATK_MAX" => new AIScriptVariableToken(AIScriptTokenVariableType.ATTACK_TARGET_ATK_MAX), + "ENEMY_MIN_ATK" => new AIScriptVariableToken(AIScriptTokenVariableType.ENEMY_MIN_ATK), + "ENEMY_MAX_ATK" => new AIScriptVariableToken(AIScriptTokenVariableType.ENEMY_MAX_ATK), + "ENEMY_ATK_SUM" => new AIScriptVariableToken(AIScriptTokenVariableType.ENEMY_ATK_SUM), + "ALLY_INPLAY_MAX_ATK" => new AIScriptVariableToken(AIScriptTokenVariableType.ALLY_INPLAY_MAX_ATK), + "GRAVE_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.GRAVE_COUNT), + "ALLY_MAX_PP" => new AIScriptVariableToken(AIScriptTokenVariableType.ALLY_MAX_PP), + "ENEMY_MAX_PP" => new AIScriptVariableToken(AIScriptTokenVariableType.ENEMY_MAX_PP), + "REST_PP" => new AIScriptVariableToken(AIScriptTokenVariableType.REST_PP), + "NOW_REST_PP" => new AIScriptVariableToken(AIScriptTokenVariableType.NOW_REST_PP), + "ALLY_EP" => new AIScriptVariableToken(AIScriptTokenVariableType.ALLY_EP), + "ENEMY_EP" => new AIScriptVariableToken(AIScriptTokenVariableType.ENEMY_EP), + "OWN_ATK" => new AIScriptVariableToken(AIScriptTokenVariableType.OWN_ATK), + "OWN_LIFE" => new AIScriptVariableToken(AIScriptTokenVariableType.OWN_LIFE), + "OWN_COST" => new AIScriptVariableToken(AIScriptTokenVariableType.OWN_COST), + "OWN_BASE_ATK" => new AIScriptVariableToken(AIScriptTokenVariableType.OWN_BASE_ATK), + "OWN_BASE_LIFE" => new AIScriptVariableToken(AIScriptTokenVariableType.OWN_BASE_LIFE), + "KILLER_ATTACK_VALUE" => new AIScriptVariableToken(AIScriptTokenVariableType.KILLER_ATTACK_VALUE), + "ENHANCE_COST" => new AIScriptVariableToken(AIScriptTokenVariableType.ENHANCE_COST), + "PLAY_ACTOR_ENHANCE_COST" => new AIScriptVariableToken(AIScriptTokenVariableType.PLAY_ACTOR_ENHANCE_COST), + "ACCELERATE_COST" => new AIScriptVariableToken(AIScriptTokenVariableType.ACCELERATE_COST), + "CHOICE_TRANSFORM_COST" => new AIScriptVariableToken(AIScriptTokenVariableType.CHOICE_TRANSFORM_COST), + "BASE_SKILL_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.BASE_SKILL_COUNT), + "LAST_LIFE" => new AIScriptVariableToken(AIScriptTokenVariableType.LAST_LIFE), + "MAX_ATTACKABLE_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.MAX_ATTACKABLE_COUNT), + "HAND_MIN_COST" => new AIScriptVariableToken(AIScriptTokenVariableType.HAND_MIN_COST), + "HAND_MAX_COST" => new AIScriptVariableToken(AIScriptTokenVariableType.HAND_MAX_COST), + "LEADER_DEF_LIFE" => new AIScriptVariableToken(AIScriptTokenVariableType.LEADER_DEF_LIFE), + "LEADER_CURRENT_LIFE" => new AIScriptVariableToken(AIScriptTokenVariableType.LEADER_CURRENT_LIFE), + "UNION_BURST_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.UNION_BURST_COUNT), + "CONSUME_EP" => new AIScriptVariableToken(AIScriptTokenVariableType.CONSUME_EP), + "LAST_HEAL_AMOUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.LAST_HEAL_AMOUNT), + "JUST_BEFORE_TURN_DAMAGE" => new AIScriptVariableToken(AIScriptTokenVariableType.JUST_BEFORE_TURN_DAMAGE), + "RALLY_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.RALLY_COUNT), + "SKYBOUND_ART_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.SKYBOUND_ART_COUNT), + "SUPER_SKYBOUND_ART_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.SUPER_SKYBOUND_ART_COUNT), + "USED_EP_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.USED_EP_COUNT), + "USED_PP_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.USED_PP_COUNT), + "EARTH_RITE_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.EARTH_RITE_COUNT), + "NECROMANCE_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.NECROMANCE_COUNT), + "USED_STACK_COUNT" => new AIScriptVariableToken(AIScriptTokenVariableType.USED_STACK_COUNT), + "DEFAULT_DAMAGE" => new AIScriptVariableToken(AIScriptTokenVariableType.DEFAULT_DAMAGE), + "NEXT_PLAY_PRIORITY" => new AIScriptVariableToken(AIScriptTokenVariableType.NEXT_PLAY_PRIORITY), + "NECROMANCED_COUNT_IN_GAME" => new AIScriptVariableToken(AIScriptTokenVariableType.NECROMANCED_COUNT_IN_GAME), + "IS_EVO_TURN" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_EVO_TURN), + "IS_ABLE_EVO" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_ABLE_EVO), + "IS_F_ADV" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_F_ADV), + "IS_F_DISADV" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_F_DISADV), + "IS_AWAKE" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_AWAKE), + "IS_BERSERK" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_BERSERK), + "IS_TO_BE_BERSERK" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_TO_BE_BERSERK), + "IS_ON_FIELD" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_ON_FIELD), + "IS_IN_HAND" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_IN_HAND), + "IS_IN_PLAYPTN" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_IN_PLAYPTN), + "IS_OWNER_TURN" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_OWNER_TURN), + "IS_ALLY" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_ALLY), + "IS_ENEMY" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_ENEMY), + "IS_ALLY_FIRST" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_ALLY_FIRST), + "IS_SNEAK" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_SNEAK), + "IS_EVOLVED" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_EVOLVED), + "IS_KILLER" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_KILLER), + "IS_MEDUSA" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_MEDUSA), + "IS_GUARD" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_GUARD), + "IS_RUSH" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_RUSH), + "IS_PLAYOUT_ATTACKER" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_PLAYOUT_ATTACKER), + "IS_ENHANCED" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_ENHANCED), + "IS_ACCELERATE" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_ACCELERATE), + "IS_CRYSTALIZE" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_CRYSTALIZE), + "IS_ATTACK_LEADER" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_ATTACK_LEADER), + "IS_FANFARE" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_FANFARE), + "IS_SKILL_REMOVED" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_SKILL_REMOVED), + "IS_BARBAROSSA" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_BARBAROSSA), + "IS_RESONANCE" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_RESONANCE), + "IS_LETHAL" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_LETHAL), + "IS_USED_EVO" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_USED_EVO), + "IS_FIRST_TURN" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_FIRST_TURN), + "IS_DAMAGED" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_DAMAGED), + "IS_DELAY_HEAL" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_DELAY_HEAL), + "IS_NOT_ATTACK_YET" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_NOT_ATTACK_YET), + "IS_EVOLVING" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_EVOLVING), + "IS_LEADER" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_LEADER), + "IS_GET_ON" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_GET_ON), + "IS_SKILL_SUMMONED" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_SKILL_SUMMONED), + "IS_UNTOUCHABLE" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_UNTOUCHABLE), + "IS_FORCE_TARGETING" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_FORCE_TARGETING), + "IS_QUICK" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_QUICK), + "IS_NOT_BE_ATTACKED" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_NOT_BE_ATTACKED), + "IS_IN_SIMULATION" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_IN_SIMULATION), + "IS_IGNORE_GUARD" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_IGNORE_GUARD), + "IS_ATTACKED" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_ATTACKED), + "IS_ONEMORELASTWORD_TAGGED" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_ONEMORELASTWORD_TAGGED), + "IS_DRAIN" => new AIScriptVariableToken(AIScriptTokenVariableType.IS_DRAIN), + "MEMBER_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.MEMBER_COUNT, 1), + "INPLAY_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.INPLAY_COUNT, 1), + "PLAYOUT_ATTACKER_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.PLAYOUT_ATTACKER_COUNT, 1), + "BEFORE_PLAYPTN_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.BEFORE_PLAYPTN_COUNT, 1), + "PLAY_TOKEN_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.PLAY_TOKEN_COUNT, 1), + "EVO_COUNT_IN_GAME" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVO_COUNT_IN_GAME, 1), + "EVO_COUNT_IN_PREVIOUS_TURN" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVO_COUNT_IN_PREVIOUS_TURN, 1), + "HAND_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.HAND_COUNT, 1), + "HAND_NAME_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.HAND_NAME_COUNT, 0), + "SKILL_COUNT_FROM_ID" => new AIScriptFunctionToken(AIScriptTokenFuncType.SKILL_COUNT_FROM_ID, 2), + "TAG_COUNT_FROM_ID" => new AIScriptFunctionToken(AIScriptTokenFuncType.TAG_COUNT_FROM_ID, 2), + "DECK_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.DECK_COUNT, 1), + "EVAL_RANDOM_MULTI_DAMAGE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_RANDOM_MULTI_DAMAGE, 2), + "EVAL_RANDOM_MULTI_SELECT_DAMAGE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_RANDOM_MULTI_SELECT_DAMAGE, 3), + "EVAL_RANDOM_MULTI_DAMAGE_MAX" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_RANDOM_MULTI_DAMAGE_MAX, 0), + "EVAL_INSTANT_ATTACK" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_INSTANT_ATTACK, 3), + "EVAL_RUSH" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_RUSH, 3), + "EVAL_TARGETING_DAMAGE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_TARGETING_DAMAGE, 2), + "EVAL_TARGETING_AND_RANDOM_MULTI_DAMAGE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_TARGETING_AND_RANDOM_MULTI_DAMAGE, 0), + "EVAL_TARGETING_DESTROY" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_TARGETING_DESTROY, 4), + "EVAL_TARGETING_OTHER_DESTROY" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_TARGETING_OTHER_DESTROY, 4), + "EVAL_TARGETING_MULTI_DESTROY" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_TARGETING_MULTI_DESTROY, 0), + "EVAL_TARGETING_BOUNCE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_TARGETING_BOUNCE, 4), + "EVAL_TARGETING_BANISH" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_TARGETING_BANISH, 4), + "EVAL_TARGETING_HEAL" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_TARGETING_HEAL, 0), + "EVAL_TARGETING_METAMORPHOSE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_TARGETING_METAMORPHOSE, 0), + "EVAL_TARGETING_BUFF" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_TARGETING_BUFF, 0), + "EVAL_ECHO_DAMAGE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_ECHO_DAMAGE, 2), + "EVAL_ALL_DAMAGE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_ALL_DAMAGE, 2), + "EVAL_ALL_MULTI_DAMAGE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_ALL_MULTI_DAMAGE, 3), + "EVAL_ALL_DESTROY" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_ALL_DESTROY, 4), + "EVAL_ALL_BOUNCE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_ALL_BOUNCE, 4), + "EVAL_ALL_METAMORPHOSE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_ALL_METAMORPHOSE, 0), + "EVAL_ALL_BUFF" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_ALL_BUFF, 0), + "EVAL_RANDOM_BUFF" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_RANDOM_BUFF, 0), + "EVAL_ALL_HEAL" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_ALL_HEAL, 0), + "EVAL_ALL_BANISH" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_ALL_BANISH, 0), + "EVAL_RANDOM_DESTROY" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_RANDOM_DESTROY, 3), + "EVAL_RANDOM_BOUNCE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_RANDOM_BOUNCE, 1), + "EVAL_RANDOM_BANISH" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_RANDOM_BANISH, 0), + "EVAL_RANDOM_METAMORPHOSE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_RANDOM_METAMORPHOSE, 0), + "EVAL_LEADER_DAMAGE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_LEADER_DAMAGE, 2), + "EVAL_LEADER_HEAL" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_LEADER_HEAL, 2), + "EVAL_REANIMATE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_REANIMATE, 1), + "EVAL_DIVIDED_DAMAGE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_DIVIDED_DAMAGE, 1), + "FORCED_EXCHANGE" => new AIScriptFunctionToken(AIScriptTokenFuncType.FORCED_EXCHANGE, 1), + "LIFE" => new AIScriptFunctionToken(AIScriptTokenFuncType.LIFE, 1), + "ATTACK" => new AIScriptFunctionToken(AIScriptTokenFuncType.ATTACK, 1), + "POW" => new AIScriptFunctionToken(AIScriptTokenFuncType.POW, 2), + "CEILING" => new AIScriptFunctionToken(AIScriptTokenFuncType.CEILING, 1), + "FLOOR" => new AIScriptFunctionToken(AIScriptTokenFuncType.FLOOR, 1), + "EVAL_COUNTDOWN" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_CHANT_COUNT_CHANGE, 1), + "EVAL_ALL_COUNTDOWN" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_CHANT_COUNT_CHANGE_ALL, 1), + "IS_CLASH_TARGET" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_CLASH_TARGET, 1), + "IS_ATTACK_TARGET" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_ATTACK_TARGET, 1), + "IS_SELECTED_TARGET" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_SELECTED_TARGET, 1), + "IS_NEXT_PLAY" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_NEXT_PLAY, 1), + "DECK_NAME_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.DECK_NAME_COUNT, 1), + "BROKEN_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.BROKEN_COUNT, 1), + "BROKEN_NAME_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.BROKEN_NAME_COUNT, 1), + "BROKEN_COST_SUM" => new AIScriptFunctionToken(AIScriptTokenFuncType.BROKEN_COST_SUM, 1), + "IS_TRIBE" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_TRIBE, 1), + "PLAYED_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.PLAYED_COUNT, 1), + "PLAYED_COUNT_IN_GAME" => new AIScriptFunctionToken(AIScriptTokenFuncType.PLAYED_COUNT_IN_GAME, 1), + "PLAYED_COUNT_IN_PREVIOUS_TURN" => new AIScriptFunctionToken(AIScriptTokenFuncType.PLAYED_COUNT_IN_PREVIOUS_TURN, 1), + "PLAYED_NAME_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.PLAYED_NAME_COUNT, 1), + "RANDOM" => new AIScriptFunctionToken(AIScriptTokenFuncType.RANDOM, 1), + "IS_REANIMATE" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_REANIMATE, 1), + "DAMAGE_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.DAMAGE_COUNT, 1), + "HEAL_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.HEAL_COUNT, 1), + "TOTAL_DAMAGE" => new AIScriptFunctionToken(AIScriptTokenFuncType.TOTAL_DAMAGE, 0), + "FUSION_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.FUSION_COUNT, 0), + "NOW_FUSION_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.NOW_FUSION_COUNT, 0), + "FUSION_COUNT_AT_ONCE" => new AIScriptFunctionToken(AIScriptTokenFuncType.FUSION_COUNT_AT_ONCE, 0), + "FUSION_NAME_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.FUSION_NAME_COUNT, 0), + "IS_SKILL_OCCURRED" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_SKILL_OCCURRED, 0), + "SKILL_ACTIVATE_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.SKILL_ACTIVATE_COUNT, 0), + "HAND_MAX_ATTACK" => new AIScriptFunctionToken(AIScriptTokenFuncType.HAND_MAX_ATTACK, 0), + "DECK_MAX_COST" => new AIScriptFunctionToken(AIScriptTokenFuncType.DECK_MAX_COST, 0), + "INPLAY_LARGEST_LIFE" => new AIScriptFunctionToken(AIScriptTokenFuncType.INPLAY_LARGEST_LIFE, 0), + "LEADER_MAX_LIFE" => new AIScriptFunctionToken(AIScriptTokenFuncType.LEADER_MAX_LIFE, 0), + "IS_DISCARD_TARGET" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_DISCARD_TARGET, 0), + "DISCARD_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.DISCARD_COUNT, 0), + "BOUNCE_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.BOUNCE_COUNT, 0), + "EMOTE_PLAY_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.EMOTE_PLAY_COUNT, 0), + "DRAW_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.DRAW_COUNT, 0), + "MEMBER_MAX_ATK" => new AIScriptFunctionToken(AIScriptTokenFuncType.MEMBER_MAX_ATK, 0), + "LEAVE_NAME_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.LEAVE_NAME_COUNT, 1), + "DESTROYED_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.DESTROYED_COUNT, 1), + "IS_BURIAL_RITE" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_BURIAL_RITE, 0), + "BURIAL_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.BURIAL_COUNT, 1), + "RESONANCE_START_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.RESONANCE_START_COUNT, 2), + "SUMMON_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.SUMMON_COUNT, 1), + "BUFF_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.BUFF_COUNT, 0), + "IS_HOLDING_BATTLE_SKILL" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_HOLDING_BATTLE_SKILL, 1), + "IS_LEADER_HOLDING_BATTLE_SKILL" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_LEADER_HOLDING_BATTLE_SKILL, 1), + "STACK_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.STACK_COUNT, 0), + "LEAVE_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.LEAVE_COUNT, 0), + "OWN_DESTROY_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.OWN_DESTROY_COUNT, 0), + "IS_SELECTABLE" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_SELECTABLE, 0), + "IS_ENEMY_AI_ID" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_ENEMY_AI_ID, 0), + "ADD_HAND_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.ADD_HAND_COUNT, 0), + "BASE_COST" => new AIScriptFunctionToken(AIScriptTokenFuncType.BASE_COST, 0), + "RECEIVED_DAMAGE_SUM" => new AIScriptFunctionToken(AIScriptTokenFuncType.RECEIVED_DAMAGE_SUM, 0), + "IS_PLAYER_CHARA_ID" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_PLAYER_CHARA_ID, 0), + "FUSION_COUNT_IN_GAME" => new AIScriptFunctionToken(AIScriptTokenFuncType.FUSION_COUNT_IN_GAME, 0), + "FUSION_NAME_COUNT_IN_GAME" => new AIScriptFunctionToken(AIScriptTokenFuncType.FUSION_NAME_COUNT_IN_GAME, 0), + "IS_PLAYER_ABILITY_ID" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_PLAYER_ABILITY_ID, 0), + "BANISH_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.BANISH_COUNT, 0), + "HAND_BANISH_COUNT" => new AIScriptFunctionToken(AIScriptTokenFuncType.HAND_BANISH_COUNT, 0), + "IS_BOTH_CLASS" => new AIScriptFunctionToken(AIScriptTokenFuncType.IS_BOTH_CLASS, 0), + "EVAL_ATTACK_REMOVE" => new AIScriptFunctionToken(AIScriptTokenFuncType.EVAL_ATTACK_REMOVE, 0), + "ADDED_DECK_COUNT_IN_GAME" => new AIScriptFunctionToken(AIScriptTokenFuncType.ADDED_DECK_COUNT_IN_GAME, 0), + "NONE" => new AIScriptArgumentToken(AIScriptTokenArgType.NONE, isNot), + "LEGION" => new AIScriptArgumentToken(AIScriptTokenArgType.LEGION, isNot), + "LORD" => new AIScriptArgumentToken(AIScriptTokenArgType.LORD, isNot), + "WHITE_RITUAL" => new AIScriptArgumentToken(AIScriptTokenArgType.WHITE_RITUAL, isNot), + "ARTIFACT" => new AIScriptArgumentToken(AIScriptTokenArgType.ARTIFACT, isNot), + "MANARIA" => new AIScriptArgumentToken(AIScriptTokenArgType.MANARIA, isNot), + "MACHINE" => new AIScriptArgumentToken(AIScriptTokenArgType.MACHINE, isNot), + "FOOD" => new AIScriptArgumentToken(AIScriptTokenArgType.FOOD, isNot), + "LEVIN" => new AIScriptArgumentToken(AIScriptTokenArgType.LEVIN, isNot), + "NATURE" => new AIScriptArgumentToken(AIScriptTokenArgType.NATURE, isNot), + "BANQUET" => new AIScriptArgumentToken(AIScriptTokenArgType.BANQUET, isNot), + "HERO" => new AIScriptArgumentToken(AIScriptTokenArgType.HERO, isNot), + "ARMED" => new AIScriptArgumentToken(AIScriptTokenArgType.ARMED, isNot), + "LOOT" => new AIScriptArgumentToken(AIScriptTokenArgType.LOOT, isNot), + "HELLBOUND" => new AIScriptArgumentToken(AIScriptTokenArgType.HELLBOUND, isNot), + "SCHOOL" => new AIScriptArgumentToken(AIScriptTokenArgType.SCHOOL, isNot), + "CHESS" => new AIScriptArgumentToken(AIScriptTokenArgType.CHESS, isNot), + "ANY_TRIBE" => new AIScriptArgumentToken(AIScriptTokenArgType.ANY_TRIBE, isNot), + "ALL" => new AIScriptArgumentToken(AIScriptTokenArgType.ALL, isNot), + "SPELL" => new AIScriptArgumentToken(AIScriptTokenArgType.SPELL, isNot), + "SPELL_CARD_TYPE" => new AIScriptArgumentToken(AIScriptTokenArgType.SPELL_CARD_TYPE, isNot), + "ALL_SPELLBOOST" => new AIScriptArgumentToken(AIScriptTokenArgType.ALL_SPELLBOOST, isNot), + "FIELD" => new AIScriptArgumentToken(AIScriptTokenArgType.FIELD, isNot), + "CHANT_FIELD" => new AIScriptArgumentToken(AIScriptTokenArgType.CHANT_FIELD, isNot), + "CLASS" => new AIScriptArgumentToken(AIScriptTokenArgType.CLASS, isNot), + "ALLY_CLASS" => new AIScriptArgumentToken(AIScriptTokenArgType.ALLY_CLASS, isNot), + "ENEMY_CLASS" => new AIScriptArgumentToken(AIScriptTokenArgType.ENEMY_CLASS, isNot), + "ACCELERATE" => new AIScriptArgumentToken(AIScriptTokenArgType.ACCELERATE, isNot), + "CRYSTALIZE" => new AIScriptArgumentToken(AIScriptTokenArgType.CRYSTALIZE, isNot), + "LASTWORD" => new AIScriptArgumentToken(AIScriptTokenArgType.LASTWORD, isNot), + "KILLER" => new AIScriptArgumentToken(AIScriptTokenArgType.KILLER, isNot), + "SNEAK" => new AIScriptArgumentToken(AIScriptTokenArgType.SNEAK, isNot), + "MEDUSA" => new AIScriptArgumentToken(AIScriptTokenArgType.MEDUSA, isNot), + "QUICK" => new AIScriptArgumentToken(AIScriptTokenArgType.QUICK, isNot), + "RUSH" => new AIScriptArgumentToken(AIScriptTokenArgType.RUSH, isNot), + "DRAIN" => new AIScriptArgumentToken(AIScriptTokenArgType.DRAIN, isNot), + "GUARD" => new AIScriptArgumentToken(AIScriptTokenArgType.GUARD, isNot), + "UNTOUCHABLE" => new AIScriptArgumentToken(AIScriptTokenArgType.UNTOUCHABLE, isNot), + "FORCE_TARGETING" => new AIScriptArgumentToken(AIScriptTokenArgType.FORCE_TARGETING, isNot), + "UNBANISHABLE" => new AIScriptArgumentToken(AIScriptTokenArgType.UNBANISHABLE, isNot), + "IGNORE_GUARD" => new AIScriptArgumentToken(AIScriptTokenArgType.IGNORE_GUARD, isNot), + "DAMAGE_CLIP" => new AIScriptArgumentToken(AIScriptTokenArgType.DAMAGE_CLIP, isNot), + "DAMAGE_CUT" => new AIScriptArgumentToken(AIScriptTokenArgType.DAMAGE_CUT, isNot), + "SKILL_DAMAGE" => new AIScriptArgumentToken(AIScriptTokenArgType.SKILL_DAMAGE, isNot), + "ALL_DAMAGE" => new AIScriptArgumentToken(AIScriptTokenArgType.ALL_DAMAGE, isNot), + "ATTACK_DAMAGE" => new AIScriptArgumentToken(AIScriptTokenArgType.ATTACK_DAMAGE, isNot), + "SPELL_DAMAGE" => new AIScriptArgumentToken(AIScriptTokenArgType.SPELL_DAMAGE, isNot), + "NOT_BE_ATTACKED" => new AIScriptArgumentToken(AIScriptTokenArgType.NOT_BE_ATTACKED, isNot), + "UNION_BURST" => new AIScriptArgumentToken(AIScriptTokenArgType.UNION_BURST, isNot), + "NO_SKILL" => new AIScriptArgumentToken(AIScriptTokenArgType.NO_SKILL, isNot), + "CRYSTALIZE_HOLDER" => new AIScriptArgumentToken(AIScriptTokenArgType.CRYSTALIZE_HOLDER, isNot), + "ELF" => new AIScriptArgumentToken(AIScriptTokenArgType.ELF, isNot), + "ROYAL" => new AIScriptArgumentToken(AIScriptTokenArgType.ROYAL, isNot), + "WITCH" => new AIScriptArgumentToken(AIScriptTokenArgType.WITCH, isNot), + "DRAGON" => new AIScriptArgumentToken(AIScriptTokenArgType.DRAGON, isNot), + "NECROMANCER" => new AIScriptArgumentToken(AIScriptTokenArgType.NECROMANCER, isNot), + "VAMPIRE" => new AIScriptArgumentToken(AIScriptTokenArgType.VAMPIRE, isNot), + "BISHOP" => new AIScriptArgumentToken(AIScriptTokenArgType.BISHOP, isNot), + "NEMESIS" => new AIScriptArgumentToken(AIScriptTokenArgType.NEMESIS, isNot), + "WHEN_PLAY" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_PLAY, isNot), + "WHEN_DESTROY" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_DESTROY, isNot), + "WHEN_ATTACK" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_ATTACK, isNot), + "WHEN_CLASH" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_CLASH, isNot), + "WHEN_EVO" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_EVO, isNot), + "WHEN_TURNEND" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_TURNEND, isNot), + "WHEN_ALLY_TURNEND" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_ALLY_TURNEND, isNot), + "WHEN_OPPONENT_TURNEND" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_OPPONENT_TURNEND, isNot), + "WHEN_ALLY_TURNSTART" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_ALLY_TURNSTART, isNot), + "WHEN_OPPONENT_TURNSTART" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_OPPONENT_TURNSTART, isNot), + "WHEN_NEXT_TURNEND" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_NEXT_TURNEND, isNot), + "WHEN_SUMMON" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_SUMMON, isNot), + "WHEN_HEAL" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_HEAL, isNot), + "WHEN_LEAVE" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_LEAVE, isNot), + "FIRST_TURN" => new AIScriptArgumentToken(AIScriptTokenArgType.FIRST_TURN, isNot), + "EVOLVED" => new AIScriptArgumentToken(AIScriptTokenArgType.EVOLVED, isNot), + "ATTACKABLE" => new AIScriptArgumentToken(AIScriptTokenArgType.ATTACKABLE, isNot), + "CANT_ATTACK" => new AIScriptArgumentToken(AIScriptTokenArgType.CANT_ATTACK, isNot), + "PREVIOUS_TURN_ATTACKED" => new AIScriptArgumentToken(AIScriptTokenArgType.PREVIOUS_TURN_ATTACKED, isNot), + "ATTACKED" => new AIScriptArgumentToken(AIScriptTokenArgType.ATTACKED, isNot), + "CONSUME_EP_ZERO" => new AIScriptArgumentToken(AIScriptTokenArgType.CONSUME_EP_ZERO, isNot), + "ALLY" => new AIScriptArgumentToken(AIScriptTokenArgType.ALLY, isNot), + "ENEMY" => new AIScriptArgumentToken(AIScriptTokenArgType.OPPONENT, isNot), + "BOTH" => new AIScriptArgumentToken(AIScriptTokenArgType.BOTH, isNot), + "SELECTED_TARGET_SIDE" => new AIScriptArgumentToken(AIScriptTokenArgType.SELECTED_TARGET_SIDE, isNot), + "RANDOM_SELECT" => new AIScriptArgumentToken(AIScriptTokenArgType.RANDOM_SELECT, isNot), + "ALL_SELECT" => new AIScriptArgumentToken(AIScriptTokenArgType.ALL_SELECT, isNot), + "TARGET_SELECT" => new AIScriptArgumentToken(AIScriptTokenArgType.TARGET_SELECT, isNot), + "SECOND_TARGET_SELECT" => new AIScriptArgumentToken(AIScriptTokenArgType.SECOND_TARGET_SELECT, isNot), + "RANDOM_MULTI_SELECT" => new AIScriptArgumentToken(AIScriptTokenArgType.RANDOM_MULTI_SELECT, isNot), + "REVERSE_TARGET" => new AIScriptArgumentToken(AIScriptTokenArgType.REVERSE_TARGET, isNot), + "FIRST_SELECT" => new AIScriptArgumentToken(AIScriptTokenArgType.FIRST_SELECT, isNot), + "DIVIDED_SELECT" => new AIScriptArgumentToken(AIScriptTokenArgType.DIVIDED_SELECT, isNot), + "OLDEST_SELECT" => new AIScriptArgumentToken(AIScriptTokenArgType.OLDEST_SELECT, isNot), + "FOLLOWER" => new AIScriptArgumentToken(AIScriptTokenArgType.FOLLOWER, isNot), + "FOLLOWER_CARD_TYPE" => new AIScriptArgumentToken(AIScriptTokenArgType.FOLLOWER_CARD_TYPE, isNot), + "AMULET" => new AIScriptArgumentToken(AIScriptTokenArgType.AMULET, isNot), + "NOT_COUNTDOWN_AMULET" => new AIScriptArgumentToken(AIScriptTokenArgType.NOT_COUNTDOWN_AMULET, isNot), + "DAMAGED_FOLLOWER" => new AIScriptArgumentToken(AIScriptTokenArgType.DAMAGED_FOLLOWER, isNot), + "NO_DAMAGED_FOLLOWER" => new AIScriptArgumentToken(AIScriptTokenArgType.NO_DAMAGED_FOLLOWER, isNot), + "EVOLVED_FOLLOWER" => new AIScriptArgumentToken(AIScriptTokenArgType.EVOLVED_FOLLOWER, isNot), + "BUFFED_FOLLOWER" => new AIScriptArgumentToken(AIScriptTokenArgType.BUFFED_FOLLOWER, isNot), + "OTHER_FOLLOWER" => new AIScriptArgumentToken(AIScriptTokenArgType.OTHER_FOLLOWER, isNot), + "SUMMON_FOLLOWER" => new AIScriptArgumentToken(AIScriptTokenArgType.SUMMON_FOLLOWER, isNot), + "SUMMON_AMULET" => new AIScriptArgumentToken(AIScriptTokenArgType.SUMMON_AMULET, isNot), + "LATEST_SUMMON_CARD" => new AIScriptArgumentToken(AIScriptTokenArgType.LATEST_SUMMON_CARD, isNot), + "LATEST_DRAW_CARD" => new AIScriptArgumentToken(AIScriptTokenArgType.LATEST_DRAW_CARD, isNot), + "ROMELIA_TARGET" => new AIScriptArgumentToken(AIScriptTokenArgType.ROMELIA_TARGET, isNot), + "MIN_ATTACK" => new AIScriptArgumentToken(AIScriptTokenArgType.MIN_ATTACK, isNot), + "MAX_ATTACK" => new AIScriptArgumentToken(AIScriptTokenArgType.MAX_ATTACK, isNot), + "MIN_COST" => new AIScriptArgumentToken(AIScriptTokenArgType.MIN_COST, isNot), + "MAX_COST" => new AIScriptArgumentToken(AIScriptTokenArgType.MAX_COST, isNot), + "ALLY_AMULET" => new AIScriptArgumentToken(AIScriptTokenArgType.ALLY_AMULET, isNot), + "LIFE_INF" => new AIScriptArgumentToken(AIScriptTokenArgType.LIFE_INF, isNot), + "ATK_INF" => new AIScriptArgumentToken(AIScriptTokenArgType.ATK_INF, isNot), + "COST_INF" => new AIScriptArgumentToken(AIScriptTokenArgType.COST_INF, isNot), + "LIFE_SUP" => new AIScriptArgumentToken(AIScriptTokenArgType.LIFE_SUP, isNot), + "ATK_EQL" => new AIScriptArgumentToken(AIScriptTokenArgType.ATK_EQL, isNot), + "LIFE_EQL" => new AIScriptArgumentToken(AIScriptTokenArgType.LIFE_EQL, isNot), + "ATK_SUP" => new AIScriptArgumentToken(AIScriptTokenArgType.ATK_SUP, isNot), + "COST_SUP" => new AIScriptArgumentToken(AIScriptTokenArgType.COST_SUP, isNot), + "COST_EQL" => new AIScriptArgumentToken(AIScriptTokenArgType.COST_EQL, isNot), + "BASE_COST_INF" => new AIScriptArgumentToken(AIScriptTokenArgType.BASE_COST_INF, isNot), + "BASE_COST_SUP" => new AIScriptArgumentToken(AIScriptTokenArgType.BASE_COST_SUP, isNot), + "BASE_COST_EQL" => new AIScriptArgumentToken(AIScriptTokenArgType.BASE_COST_EQL, isNot), + "COUNTDOWN_EQL" => new AIScriptArgumentToken(AIScriptTokenArgType.COUNTDOWN_EQL, isNot), + "PLAY_COUNT_EQL" => new AIScriptArgumentToken(AIScriptTokenArgType.PLAY_COUNT_EQL, isNot), + "CLASH_TARGET" => new AIScriptArgumentToken(AIScriptTokenArgType.CLASH_TARGET, isNot), + "BANISHED_TARGET" => new AIScriptArgumentToken(AIScriptTokenArgType.BANISHED_TARGET, isNot), + "GETOFF_CARD" => new AIScriptArgumentToken(AIScriptTokenArgType.GETOFF_CARD, isNot), + "ATTACKER" => new AIScriptArgumentToken(AIScriptTokenArgType.ATTACKER, isNot), + "EVOLVER" => new AIScriptArgumentToken(AIScriptTokenArgType.EVOLVER, isNot), + "PLAYED_CARD" => new AIScriptArgumentToken(AIScriptTokenArgType.PLAYED_CARD, isNot), + "TEMP" => new AIScriptArgumentToken(AIScriptTokenArgType.TEMP, isNot), + "PERM" => new AIScriptArgumentToken(AIScriptTokenArgType.PERM, isNot), + "TURN" => new AIScriptArgumentToken(AIScriptTokenArgType.TURN, isNot), + "GAME" => new AIScriptArgumentToken(AIScriptTokenArgType.GAME, isNot), + "DESTROY" => new AIScriptArgumentToken(AIScriptTokenArgType.DESTROY, isNot), + "BANISH" => new AIScriptArgumentToken(AIScriptTokenArgType.BANISH, isNot), + "TOKEN_DRAW" => new AIScriptArgumentToken(AIScriptTokenArgType.TOKEN_DRAW, isNot), + "SELF" => new AIScriptArgumentToken(AIScriptTokenArgType.SELF, isNot), + "NEUTRAL" => new AIScriptArgumentToken(AIScriptTokenArgType.NEUTRAL, isNot), + "WHEN_DAMAGED" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_DAMAGED, isNot), + "USE_MIN" => new AIScriptArgumentToken(AIScriptTokenArgType.USE_MIN, isNot), + "IGNORE_IN_BATTLE" => new AIScriptArgumentToken(AIScriptTokenArgType.IGNORE_IN_BATTLE, isNot), + "IGNORE_IN_FUSION" => new AIScriptArgumentToken(AIScriptTokenArgType.IGNORE_IN_FUSION, isNot), + "IN_HAND" => new AIScriptArgumentToken(AIScriptTokenArgType.IN_HAND, isNot), + "IN_PLAY" => new AIScriptArgumentToken(AIScriptTokenArgType.IN_PLAY, isNot), + "LAST_DRAW_CARD" => new AIScriptArgumentToken(AIScriptTokenArgType.LAST_DRAW_CARD, isNot), + "NEWER" => new AIScriptArgumentToken(AIScriptTokenArgType.NEWER, isNot), + "OLDEST_FOLLOWER" => new AIScriptArgumentToken(AIScriptTokenArgType.OLDEST_FOLLOWER, isNot), + "OTHER_OLDEST_HAND_CARD_TYPE" => new AIScriptArgumentToken(AIScriptTokenArgType.OTHER_OLDEST_HAND_CARD_TYPE, isNot), + "CHOICED_TARGET" => new AIScriptArgumentToken(AIScriptTokenArgType.CHOICED_TARGET, isNot), + "SELECTED_TARGET" => new AIScriptArgumentToken(AIScriptTokenArgType.SELECTED_TARGET, isNot), + "SECOND_SELECTED_TARGET" => new AIScriptArgumentToken(AIScriptTokenArgType.SECOND_SELECTED_TARGET, isNot), + "PLAYED" => new AIScriptArgumentToken(AIScriptTokenArgType.PLAYED, isNot), + "PLAYPTN" => new AIScriptArgumentToken(AIScriptTokenArgType.PLAYPTN, isNot), + "BEFORE_PLAYPTN" => new AIScriptArgumentToken(AIScriptTokenArgType.BEFORE_PLAYPTN, isNot), + "NOW" => new AIScriptArgumentToken(AIScriptTokenArgType.NOW, isNot), + "DESTRUCTIBLE" => new AIScriptArgumentToken(AIScriptTokenArgType.DESTRUCTIBLE, isNot), + "TRIGGER" => new AIScriptArgumentToken(AIScriptTokenArgType.TRIGGER, isNot), + "REAL_SKILL_TARGET" => new AIScriptArgumentToken(AIScriptTokenArgType.REAL_SKILL_TARGET, isNot), + "CANDIDATE" => new AIScriptArgumentToken(AIScriptTokenArgType.CANDIDATE, isNot), + "ENHANCED" => new AIScriptArgumentToken(AIScriptTokenArgType.ENHANCED, isNot), + "LEAST_VALUE" => new AIScriptArgumentToken(AIScriptTokenArgType.LEAST_VALUE, isNot), + "ALLY_ATTACK_FOLLOWER" => new AIScriptArgumentToken(AIScriptTokenArgType.ALLY_ATTACK_FOLLOWER, isNot), + "ADD" => new AIScriptArgumentToken(AIScriptTokenArgType.ADD, isNot), + "SET" => new AIScriptArgumentToken(AIScriptTokenArgType.SET, isNot), + "SELECTED_TARGET_ID" => new AIScriptArgumentToken(AIScriptTokenArgType.SELECTED_TARGET_ID, isNot), + "DEFAULT_LOGIC" => new AIScriptArgumentToken(AIScriptTokenArgType.DEFAULT_LOGIC, isNot), + "DESTROY_LOGIC" => new AIScriptArgumentToken(AIScriptTokenArgType.DESTROY_LOGIC, isNot), + "DAMAGE_LOGIC" => new AIScriptArgumentToken(AIScriptTokenArgType.DAMAGE_LOGIC, isNot), + "BANISH_LOGIC" => new AIScriptArgumentToken(AIScriptTokenArgType.BANISH_LOGIC, isNot), + "BOUNCE_LOGIC" => new AIScriptArgumentToken(AIScriptTokenArgType.BOUNCE_LOGIC, isNot), + "METAMORPHOSE_LOGIC" => new AIScriptArgumentToken(AIScriptTokenArgType.METAMORPHOSE_LOGIC, isNot), + "MAX_ATTACK_LOGIC" => new AIScriptArgumentToken(AIScriptTokenArgType.MAX_ATTACK_LOGIC, isNot), + "TYRANT_ORDER_LOGIC" => new AIScriptArgumentToken(AIScriptTokenArgType.TYRANT_ORDER_LOGIC, isNot), + "REVERSE_DISCARD_LOGIC" => new AIScriptArgumentToken(AIScriptTokenArgType.REVERSE_DISCARD_LOGIC, isNot), + "WHITEFROST_WHISPER_LOGIC" => new AIScriptArgumentToken(AIScriptTokenArgType.WHITEFROST_WHISPER_LOGIC, isNot), + "FILTER_END" => new AIScriptArgumentToken(AIScriptTokenArgType.FILTER_END, isNot), + "NEXT_PLAY" => new AIScriptArgumentToken(AIScriptTokenArgType.NEXT_PLAY, isNot), + "WHEN_PLAY_DAMAGE" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_PLAY_DAMAGE, isNot), + "WHEN_PLAY_DESTROY" => new AIScriptArgumentToken(AIScriptTokenArgType.WHEN_PLAY_DESTROY, isNot), + "FIRST_SUMMON_FOLLOWER_IN_PLAYPTN" => new AIScriptArgumentToken(AIScriptTokenArgType.FIRST_SUMMON_FOLLOWER_IN_PLAYPTN, isNot), + "DESTROYED_CARD" => new AIScriptArgumentToken(AIScriptTokenArgType.DESTROYED_CARD, isNot), + "DESTROYED_IN_CURRENT_TURN" => new AIScriptArgumentToken(AIScriptTokenArgType.DESTROYED_IN_CURRENT_TURN, isNot), + _ => ConvertWordWithSpecialMarkToToken(word, isNot), + }; + } + } + } + + public static AIScriptTokenBase ConvertWordWithSpecialMarkToToken(string word, bool isNot) + { + char c = word[0]; + string text = word.Substring(1); + switch (c) + { + case '@': + { + int result = 0; + if (int.TryParse(text, out result)) + { + return new AIScriptIDToken(result, isNot); + } + break; + } + case '#': + return new AIScriptTextToken(text, isNot); + } + return null; + } + + public static AIPlayTagType ConvertWordToTagType(string word) + { + switch (word) + { + case "playBonus": + return AIPlayTagType.PlayBonus; + case "playBonusRate": + return AIPlayTagType.PlayBonusRate; + case "fanfareBonus": + return AIPlayTagType.FanfareBonus; + case "ignoreFanfareBonus": + return AIPlayTagType.IgnoreFanfareBonus; + case "ignoreBreak": + return AIPlayTagType.IgnoreBreak; + case "evoBonus": + return AIPlayTagType.EvoBonus; + case "memberEvoBonus": + return AIPlayTagType.MemberEvoBonus; + case "enemyEvoBonus": + return AIPlayTagType.EnemyEvoBonus; + case "battleBonus": + return AIPlayTagType.BattleBonus; + case "battleBonusRate": + return AIPlayTagType.BattleBonusRate; + case "clashBonus": + return AIPlayTagType.ClashBonus; + case "clashDestroy": + return AIPlayTagType.ClashDestroy; + case "clashHeal": + return AIPlayTagType.ClashHeal; + case "clashToken": + return AIPlayTagType.ClashToken; + case "clashBanish": + return AIPlayTagType.ClashBanish; + case "clashSpellboost": + return AIPlayTagType.ClashSpellboost; + case "afterClashHeal": + return AIPlayTagType.AfterClashHeal; + case "attackDamage": + return AIPlayTagType.AttackDamage; + case "attackBreakDamage": + return AIPlayTagType.AttackBreakDamage; + case "attackBreakEvo": + return AIPlayTagType.AttackBreakEvo; + case "attackBreakRecoverPp": + return AIPlayTagType.AttackBreakRecoverPp; + case "attackBreakAttackTwice": + return AIPlayTagType.AttackBreakAttackTwice; + case "attackHeal": + return AIPlayTagType.AttackHeal; + case "attackAttackableCount": + return AIPlayTagType.AttackAttackableCount; + case "attackQuick": + return AIPlayTagType.AttackQuick; + case "afterAttackHeal": + return AIPlayTagType.AfterAttackHeal; + case "attackBonus": + return AIPlayTagType.AttackBonus; + case "clashDamage": + return AIPlayTagType.ClashDamage; + case "afterClashDamage": + return AIPlayTagType.AfterClashDamage; + case "clashRemoveSkill": + return AIPlayTagType.ClashRemoveSkill; + case "attackRemoveSkill": + return AIPlayTagType.AttackRemoveSkill; + case "playptnBonus": + return AIPlayTagType.PlayptnBonus; + case "priority": + return AIPlayTagType.Priority; + case "playoutAtkB": + return AIPlayTagType.PlayoutAttackBonus; + case "playoutDamageB": + return AIPlayTagType.PlayoutDamageBonus; + case "allyPlayoutDamageBonus": + return AIPlayTagType.AllyPlayoutDamageBonus; + case "playoutNextTurn": + return AIPlayTagType.PlayoutNextTurn; + case "costBonus": + return AIPlayTagType.CostBonus; + case "playLimit": + return AIPlayTagType.PlayLimit; + case "mlgKeep": + return AIPlayTagType.MulliganKeep; + case "mlgChange": + return AIPlayTagType.MulliganChange; + case "handPlus": + return AIPlayTagType.HandPlus; + case "playPlus": + return AIPlayTagType.PlayPlus; + case "evoHandPlus": + return AIPlayTagType.EvoHandPlus; + case "noNormalEvo": + return AIPlayTagType.NoNormalEvo; + case "evoEvo": + return AIPlayTagType.EvoEvo; + case "evoDamage": + return AIPlayTagType.EvoDamage; + case "break": + return AIPlayTagType.Break; + case "otherBreakBonus": + return AIPlayTagType.OtherBreakBonus; + case "otherBanishBonus": + return AIPlayTagType.OtherBanishBonus; + case "otherLeaveBonus": + return AIPlayTagType.OtherLeaveBonus; + case "lastwordDestroy": + return AIPlayTagType.LastwordDestroy; + case "breakDamage": + return AIPlayTagType.BreakDamage; + case "breakRecoverAttackableCount": + return AIPlayTagType.BreakRecoverAttackableCount; + case "lastwordDamage": + return AIPlayTagType.LastwordDamage; + case "lastwordHeal": + return AIPlayTagType.LastwordHeal; + case "lastwordMetamorphose": + return AIPlayTagType.LastwordMetamorphose; + case "lastwordBanish": + return AIPlayTagType.LastwordBanish; + case "lastwordDraw": + return AIPlayTagType.LastwordDraw; + case "lastwordAddDeck": + return AIPlayTagType.LastwordAddDeck; + case "lastwordSetStatus": + return AIPlayTagType.LastwordSetStatus; + case "turnEndDestroy": + return AIPlayTagType.TurnEndDestroy; + case "turnEndBanish": + return AIPlayTagType.TurnEndBanish; + case "turnEndDamage": + return AIPlayTagType.TurnEndDamage; + case "turnEndHeal": + return AIPlayTagType.TurnEndHeal; + case "turnEndSetLeaderMaxLife": + return AIPlayTagType.TurnEndSetLeaderMaxLife; + case "turnEndDiscard": + return AIPlayTagType.TurnEndDiscard; + case "turnEndBuff": + return AIPlayTagType.TurnEndBuff; + case "turnEndSubtractCountdown": + return AIPlayTagType.TurnEndSubtractCountdown; + case "turnEndToken": + return AIPlayTagType.TurnEndToken; + case "turnEndBounce": + return AIPlayTagType.TurnEndBounce; + case "turnEndAddDeck": + return AIPlayTagType.TurnEndAddDeck; + case "turnEndEvo": + return AIPlayTagType.TurnEndEvo; + case "turnEndDraw": + return AIPlayTagType.TurnEndDraw; + case "turnEndShield": + return AIPlayTagType.TurnEndShield; + case "turnEndDamageClip": + return AIPlayTagType.TurnEndDamageClip; + case "turnEndDamageCut": + return AIPlayTagType.TurnEndDamageCut; + case "turnEndGuard": + return AIPlayTagType.TurnEndGuard; + case "turnEndBanAttack": + return AIPlayTagType.TurnEndBanAttack; + case "playSkip": + return AIPlayTagType.PlaySkip; + case "playSkipWithEvo": + return AIPlayTagType.PlaySkipWithEvo; + case "playSkipIfEvo": + return AIPlayTagType.PlaySkipIfEvo; + case "playSkipWithAction": + return AIPlayTagType.PlaySkipWithAction; + case "playSkipWithActionIfEvo": + return AIPlayTagType.PlaySkipWithActionIfEvo; + case "target": + return AIPlayTagType.Target; + case "ignoreTarget": + return AIPlayTagType.IgnoreTarget; + case "memBattleB": + return AIPlayTagType.MemberBattleBonus; + case "memberBattleBonusRate": + return AIPlayTagType.MemberBattleBonusRate; + case "enemyBattleB": + return AIPlayTagType.EnemyBattleBonus; + case "enemyBattleBonusRate": + return AIPlayTagType.EnemyBattleBonusRate; + case "allyPlayB": + return AIPlayTagType.AllyPlayBonus; + case "enemyPlayBonus": + return AIPlayTagType.EnemyPlayBonus; + case "reincarnation": + return AIPlayTagType.ReincarnationSimulation; + case "attackBuff": + return AIPlayTagType.AttackBuff; + case "attackHandBuff": + return AIPlayTagType.AttackHandBuff; + case "attackDestroy": + return AIPlayTagType.AttackDestroy; + case "attackBanish": + return AIPlayTagType.AttackBanish; + case "attackEvo": + return AIPlayTagType.AttackEvo; + case "afterAttackEvo": + return AIPlayTagType.AfterAttackEvo; + case "afterAttackDraw": + return AIPlayTagType.AfterAttackDraw; + case "afterAttackBanish": + return AIPlayTagType.AfterAttackBanish; + case "breakBuff": + return AIPlayTagType.BreakBuff; + case "breakSetLeaderMaxLife": + return AIPlayTagType.BreakSetLeaderMaxLife; + case "summonBuff": + return AIPlayTagType.SummonBuff; + case "summonEvo": + return AIPlayTagType.SummonEvo; + case "summonRush": + return AIPlayTagType.SummonRush; + case "summonQuick": + return AIPlayTagType.SummonQuick; + case "summonDamage": + return AIPlayTagType.SummonDamage; + case "summonBanish": + return AIPlayTagType.SummonBanish; + case "summonHeal": + return AIPlayTagType.SummonHeal; + case "summonDestroy": + return AIPlayTagType.SummonDestroy; + case "summonBanAttack": + return AIPlayTagType.SummonBanAttack; + case "otherSummonDamage": + return AIPlayTagType.OtherSummonDamage; + case "otherSummonRush": + return AIPlayTagType.OtherSummonRush; + case "otherSummonGuard": + return AIPlayTagType.OtherSummonGuard; + case "otherSummonQuick": + return AIPlayTagType.OtherSummonQuick; + case "otherSummonKiller": + return AIPlayTagType.OtherSummonKiller; + case "otherSummonDrain": + return AIPlayTagType.OtherSummonDrain; + case "otherSummonBanish": + return AIPlayTagType.OtherSummonBanish; + case "otherSummonHeal": + return AIPlayTagType.OtherSummonHeal; + case "otherSummonBuff": + return AIPlayTagType.OtherSummonBuff; + case "otherSummonEvo": + return AIPlayTagType.OtherSummonEvo; + case "otherSummonDamageCut": + return AIPlayTagType.OtherSummonDamageCut; + case "otherSummonDamageClip": + return AIPlayTagType.OtherSummonDamageClip; + case "otherSummonSubtractCountdown": + return AIPlayTagType.OtherSummonSubtractCountdown; + case "otherSummonAddCemetery": + return AIPlayTagType.OtherSummonAddCemetery; + case "otherSummonUntouchable": + return AIPlayTagType.OtherSummonUntouchable; + case "otherSummonDestroy": + return AIPlayTagType.OtherSummonDestory; + case "otherSummonDraw": + return AIPlayTagType.OtherSummonDraw; + case "attackByLife": + return AIPlayTagType.AttackByLife; + case "attackToken": + return AIPlayTagType.AttackToken; + case "puppetAttack": + return AIPlayTagType.PuppetAttack; + case "noSkipAttack": + return AIPlayTagType.NoSkipAttack; + case "evoToken": + return AIPlayTagType.EvoToken; + case "playDestroy": + return AIPlayTagType.PlayDestroy; + case "playDamage": + return AIPlayTagType.PlayDamage; + case "fanfareDamage": + return AIPlayTagType.FanfareDamage; + case "fanfareDestroy": + return AIPlayTagType.FanfareDestroy; + case "playMetamorphose": + return AIPlayTagType.PlayMetamorphose; + case "fanfareMetamorphose": + return AIPlayTagType.FanfareMetamorphose; + case "playHandMetamorphose": + return AIPlayTagType.PlayHandMetamorphose; + case "fanfareHandMetamorphose": + return AIPlayTagType.FanfareHandMetamorphose; + case "playHeal": + return AIPlayTagType.PlayHeal; + case "fanfareHeal": + return AIPlayTagType.FanfareHeal; + case "playBanish": + return AIPlayTagType.PlayBanish; + case "fanfareBanish": + return AIPlayTagType.FanfareBanish; + case "playBounce": + return AIPlayTagType.PlayBounce; + case "fanfareBounce": + return AIPlayTagType.FanfareBounce; + case "playSubtractCountdown": + return AIPlayTagType.PlaySubtractCountdown; + case "fanfareSubtractCountdown": + return AIPlayTagType.FanfareSubtractCountdown; + case "fanfareRecoverAttackableCount": + return AIPlayTagType.FanfareRecoverAttackableCount; + case "fanfareSneak": + return AIPlayTagType.FanfareSneak; + case "playSneak": + return AIPlayTagType.PlaySneak; + case "fanfareQuick": + return AIPlayTagType.FanfareQuick; + case "playQuick": + return AIPlayTagType.PlayQuick; + case "fanfareRush": + return AIPlayTagType.FanfareRush; + case "playRush": + return AIPlayTagType.PlayRush; + case "fanfareGuard": + return AIPlayTagType.FanfareGuard; + case "playGuard": + return AIPlayTagType.PlayGuard; + case "fanfareDrain": + return AIPlayTagType.FanfareDrain; + case "playDrain": + return AIPlayTagType.PlayDrain; + case "fanfareKiller": + return AIPlayTagType.FanfareKiller; + case "playKiller": + return AIPlayTagType.PlayKiller; + case "fanfareUntouchable": + return AIPlayTagType.FanfareUntouchable; + case "playUntouchable": + return AIPlayTagType.PlayUntouchable; + case "playBonusInSimulation": + return AIPlayTagType.PlayBonusInSimulation; + case "fanfareBonusInSimulation": + return AIPlayTagType.FanfareBonusInSimulation; + case "fanfareForceTargeting": + return AIPlayTagType.FanfareForceTargeting; + case "breakFirst": + return AIPlayTagType.BreakFirst; + case "breakLast": + return AIPlayTagType.BreakLast; + case "bounceBonus": + return AIPlayTagType.BounceBonus; + case "banishBonus": + return AIPlayTagType.BanishBonus; + case "breakBeforePlay": + return AIPlayTagType.BreakBeforePlay; + case "emoOnPlay": + return AIPlayTagType.EmoteOnPlay; + case "emoOnEvo": + return AIPlayTagType.EmoteOnEvo; + case "emoOnAtk": + return AIPlayTagType.EmoteOnAtk; + case "emoOnDestroy": + return AIPlayTagType.EmoteOnDestroy; + case "forceEmoOnDestroy": + return AIPlayTagType.ForceEmoteOnDestroy; + case "emoOnTurnEnd": + return AIPlayTagType.EmoteOnTurnEnd; + case "clashKiller": + return AIPlayTagType.ClashKiller; + case "playAttachTag": + return AIPlayTagType.PlayAttachTag; + case "fanfareAttachTag": + return AIPlayTagType.FanfareAttachTag; + case "playCopyTag": + return AIPlayTagType.PlayCopyTag; + case "fanfareCopyTag": + return AIPlayTagType.FanfareCopyTag; + case "attackAttachTag": + return AIPlayTagType.AttackAttachTag; + case "lastwordAttachTag": + return AIPlayTagType.LastwordAttachTag; + case "evoAttachTag": + return AIPlayTagType.EvoAttachTag; + case "summonAttachTag": + return AIPlayTagType.SummonAttachTag; + case "otherSummonAttachTag": + return AIPlayTagType.OtherSummonAttachTag; + case "breakAttachTag": + return AIPlayTagType.BreakAttachTag; + case "necromanceAttachTag": + return AIPlayTagType.NecromanceAttachTag; + case "turnEndAttachTag": + return AIPlayTagType.TurnEndAttachTag; + case "healAttachTag": + return AIPlayTagType.HealAttachTag; + case "fanfareAttachStyle": + return AIPlayTagType.FanfareAttachStyle; + case "fanfareToken": + return AIPlayTagType.FanfareToken; + case "lastwordToken": + return AIPlayTagType.LastwordToken; + case "playToken": + return AIPlayTagType.PlayToken; + case "addCardToPlayoutPlayPtn": + return AIPlayTagType.AddCardToPlayoutPlayPtn; + case "cantBeAttacked": + return AIPlayTagType.CantBeAttacked; + case "necromance": + return AIPlayTagType.Necromance; + case "earthRite": + return AIPlayTagType.EarthRite; + case "burialRite": + return AIPlayTagType.BurialRite; + case "enhance": + return AIPlayTagType.Enhance; + case "accelerate": + return AIPlayTagType.Accelerate; + case "crystalize": + return AIPlayTagType.Crystalize; + case "choiceTransform": + return AIPlayTagType.ChoiceTransform; + case "removeSkill": + return AIPlayTagType.RemoveSkill; + case "oneMoreLastword": + return AIPlayTagType.OneMoreLastword; + case "attackableClass": + return AIPlayTagType.AttackableClass; + case "clashBuff": + return AIPlayTagType.ClashBuff; + case "playptnBaseStatsRate": + return AIPlayTagType.PlayptnBaseStatsRate; + case "playRecoverPp": + return AIPlayTagType.PlayRecoverPP; + case "fanfareRecoverPp": + return AIPlayTagType.FanfareRecoverPp; + case "buffRecoverPp": + return AIPlayTagType.BuffRecoverPP; + case "condChoice": + return AIPlayTagType.CondChoice; + case "evoChoice": + return AIPlayTagType.EvoChoice; + case "playChoice": + return AIPlayTagType.PlayChoice; + case "fanfareChoice": + return AIPlayTagType.FanfareChoice; + case "plagueCity": + return AIPlayTagType.PlagueCity; + case "breakDestroy": + return AIPlayTagType.BreakDestroy; + case "evolvedAttackable": + return AIPlayTagType.EvolvedAttackable; + case "evolvedAttackableCount": + return AIPlayTagType.EvolvedAttackableCount; + case "evolvedSkill": + return AIPlayTagType.EvolvedSkill; + case "evoDestroy": + return AIPlayTagType.EvoDestroy; + case "evoBuff": + return AIPlayTagType.EvoBuff; + case "evoHeal": + return AIPlayTagType.EvoHeal; + case "evoBanish": + return AIPlayTagType.EvoBanish; + case "evoSubtractCountdown": + return AIPlayTagType.EvoSubtractCountdown; + case "evoSetLeaderMaxLife": + return AIPlayTagType.EvoSetLeaderMaxLife; + case "evoMetamorphose": + return AIPlayTagType.EvoMetamorphose; + case "evoHandMetamorphose": + return AIPlayTagType.EvoHandMetamorphose; + case "evoBounce": + return AIPlayTagType.EvoBounce; + case "evoRush": + return AIPlayTagType.EvoRush; + case "evoQuick": + return AIPlayTagType.EvoQuick; + case "evoGuard": + return AIPlayTagType.EvoGuard; + case "evoKiller": + return AIPlayTagType.EvoKiller; + case "evoDrain": + return AIPlayTagType.EvoDrain; + case "evoShield": + return AIPlayTagType.EvoShield; + case "evoDamageCut": + return AIPlayTagType.EvoDamageCut; + case "evoReanimate": + return AIPlayTagType.EvoReanimate; + case "evoAddDeck": + return AIPlayTagType.EvoAddDeck; + case "healDamage": + return AIPlayTagType.HealDamage; + case "healBuff": + return AIPlayTagType.HealBuff; + case "healToken": + return AIPlayTagType.HealToken; + case "healHeal": + return AIPlayTagType.HealHeal; + case "healEvo": + return AIPlayTagType.HealEvo; + case "turnEndMetamorphose": + return AIPlayTagType.TurnEndMetamorphose; + case "leaveBonus": + return AIPlayTagType.LeaveBonus; + case "leaveToken": + return AIPlayTagType.LeaveToken; + case "leaveHeal": + return AIPlayTagType.LeaveHeal; + case "leaveDamage": + return AIPlayTagType.LeaveDamage; + case "leaveAttachTag": + return AIPlayTagType.LeaveAttachTag; + case "leaveBanish": + return AIPlayTagType.LeaveBanish; + case "lastwordBuff": + return AIPlayTagType.LastwordBuff; + case "firstEvo": + return AIPlayTagType.FirstEvo; + case "lastwordReanimate": + return AIPlayTagType.LastwordReanimate; + case "reanimateBonus": + return AIPlayTagType.ReanimateBonus; + case "reanimateEvo": + return AIPlayTagType.ReanimateEvo; + case "playDraw": + return AIPlayTagType.PlayDraw; + case "handBonus": + return AIPlayTagType.HandBonus; + case "fusion": + return AIPlayTagType.Fusion; + case "playReanimate": + return AIPlayTagType.PlayReanimate; + case "fanfareReanimate": + return AIPlayTagType.FanfareReanimate; + case "modifyHeal": + return AIPlayTagType.ModifyHeal; + case "evoRecoverPp": + return AIPlayTagType.EvoRecoverPp; + case "fusionBonus": + return AIPlayTagType.FusionBonus; + case "fusionDraw": + return AIPlayTagType.FusionDraw; + case "noInstantAttack": + return AIPlayTagType.NoInstantAttack; + case "giveSkill": + return AIPlayTagType.GiveSkill; + case "playDiscard": + return AIPlayTagType.PlayDiscard; + case "fanfareDiscard": + return AIPlayTagType.FanfareDiscard; + case "discardedBonus": + return AIPlayTagType.DiscardedBonus; + case "attackDiscard": + return AIPlayTagType.AttackDiscard; + case "discardedToken": + return AIPlayTagType.DiscardedToken; + case "discardDamage": + return AIPlayTagType.DiscardDamage; + case "breakHeal": + return AIPlayTagType.BreakHeal; + case "buffDamage": + return AIPlayTagType.BuffDamage; + case "buffHeal": + return AIPlayTagType.BuffHeal; + case "buffBuff": + return AIPlayTagType.BuffBuff; + case "buffEvo": + return AIPlayTagType.BuffEvo; + case "buffDestroy": + return AIPlayTagType.BuffDestroy; + case "buffToken": + return AIPlayTagType.BuffToken; + case "buffDraw": + return AIPlayTagType.BuffDraw; + case "buffShield": + return AIPlayTagType.BuffShield; + case "discardHeal": + return AIPlayTagType.DiscardHeal; + case "evoDiscard": + return AIPlayTagType.EvoDiscard; + case "allyDiscardBonus": + return AIPlayTagType.AllyDiscardBonus; + case "buffRush": + return AIPlayTagType.BuffRush; + case "banishAttachTag": + return AIPlayTagType.BanishAttachTag; + case "otherBanishToken": + return AIPlayTagType.OtherBanishToken; + case "otherBanishAddCemetery": + return AIPlayTagType.OtherBanishAddCemetery; + case "getOn": + return AIPlayTagType.GetOn; + case "getOnBanish": + return AIPlayTagType.GetOnBanish; + case "getOnDamage": + return AIPlayTagType.GetOnDamage; + case "getOnEvo": + return AIPlayTagType.GetOnEvo; + case "getOffMetamorphose": + return AIPlayTagType.GetOffMetamorphose; + case "getOffEvo": + return AIPlayTagType.GetOffEvo; + case "rallyCountPlus": + return AIPlayTagType.RallyCountPlus; + case "playActivateCount": + return AIPlayTagType.PlayActivateCount; + case "attackActivateCount": + return AIPlayTagType.AttackActivateCount; + case "breakActivateCount": + return AIPlayTagType.BreakActivateCount; + case "banishActivateCount": + return AIPlayTagType.BanishActivateCount; + case "damagedActivateCount": + return AIPlayTagType.DamagedActivateCount; + case "buffActivateCount": + return AIPlayTagType.BuffActivateCounnt; + case "turnEndActivateCount": + return AIPlayTagType.TurnEndActivateCount; + case "healActivateCount": + return AIPlayTagType.HealActivateCount; + case "evoActivateCount": + return AIPlayTagType.EvoActivateCount; + case "necromanceActivateCount": + return AIPlayTagType.NecromanceActivateCount; + case "summonActivateCount": + return AIPlayTagType.SummonActivateCount; + case "bounceDamage": + return AIPlayTagType.BounceDamage; + case "playBuff": + return AIPlayTagType.PlayBuff; + case "fanfareBuff": + return AIPlayTagType.FanfareBuff; + case "playHandBuff": + return AIPlayTagType.PlayHandBuff; + case "fanfareHandBuff": + return AIPlayTagType.FanfareHandBuff; + case "playSetMaxStatus": + return AIPlayTagType.PlaySetMaxStatus; + case "fanfareSetMaxStatus": + return AIPlayTagType.FanfareSetMaxStatus; + case "playSetLeaderMaxLife": + return AIPlayTagType.PlaySetLeaderMaxLife; + case "resonanceDamage": + return AIPlayTagType.ResonanceDamage; + case "resonanceHeal": + return AIPlayTagType.ResonanceHeal; + case "resonanceKiller": + return AIPlayTagType.ResonanceKiller; + case "forceBerserk": + return AIPlayTagType.ForceBerserk; + case "setAITribe": + return AIPlayTagType.SetAITribe; + case "playSpellboost": + return AIPlayTagType.PlaySpellboost; + case "fanfareSpellboost": + return AIPlayTagType.FanfareSpellboost; + case "playAddCemetery": + return AIPlayTagType.PlayAddCemetery; + case "necromanceAddCemetery": + return AIPlayTagType.NecromanceAddCemetery; + case "fanfareAddCemetery": + return AIPlayTagType.FanfareAddCemetery; + case "playBanAttack": + return AIPlayTagType.PlayBanAttack; + case "fanfareBanAttack": + return AIPlayTagType.FanfareBanAttack; + case "playIgnoreGuard": + return AIPlayTagType.PlayIgnoreGuard; + case "fanfareIgnoreGuard": + return AIPlayTagType.FanfareIgnoreGuard; + case "turnStartAttachTag": + return AIPlayTagType.TurnStartAttachTag; + case "turnStartSubtractCountdown": + return AIPlayTagType.TurnStartSubtractCountdown; + case "turnStartDamageCut": + return AIPlayTagType.TurnStartDamageCut; + case "turnStartShield": + return AIPlayTagType.TurnStartShield; + case "turnStartDamage": + return AIPlayTagType.TurnStartDamage; + case "generateTag": + return AIPlayTagType.GenerateTag; + case "evoTokenDraw": + return AIPlayTagType.EvoTokenDraw; + case "evoAttackableCount": + return AIPlayTagType.EvoAttackableCount; + case "evoChangeCost": + return AIPlayTagType.EvoChangeCost; + case "playTokenDraw": + return AIPlayTagType.PlayTokenDraw; + case "fanfareTokenDraw": + return AIPlayTagType.FanfareTokenDraw; + case "playSummonHandCard": + return AIPlayTagType.PlaySummonHandCard; + case "fanfareSummonHandCard": + return AIPlayTagType.FanfareSummonHandCard; + case "playChangeClass": + return AIPlayTagType.PlayChangeClass; + case "fanfareChangeClass": + return AIPlayTagType.FanfareChangeClass; + case "playChangeTribe": + return AIPlayTagType.PlayChangeTribe; + case "fanfareChangeTribe": + return AIPlayTagType.FanfareChangeTribe; + case "playChangeCost": + return AIPlayTagType.PlayChangeCost; + case "fanfareChangeCost": + return AIPlayTagType.FanfareChangeCost; + case "playSelect": + return AIPlayTagType.PlaySelect; + case "fanfareSelect": + return AIPlayTagType.FanfareSelect; + case "playHandSelect": + return AIPlayTagType.PlayHandSelect; + case "fanfareHandSelect": + return AIPlayTagType.FanfareHandSelect; + case "evoHandSelect": + return AIPlayTagType.EvoHandSelect; + case "removeByDestroy": + return AIPlayTagType.RemoveByDestroy; + case "evoHandBuff": + return AIPlayTagType.EvoHandBuff; + case "playNotBeAttacked": + return AIPlayTagType.PlayNotBeAttacked; + case "fanfareNotBeAttacked": + return AIPlayTagType.FanfareNotBeAttacked; + case "playAttackableCount": + return AIPlayTagType.PlayAttackableCount; + case "fanfareAttackableCount": + return AIPlayTagType.FanfareAttackableCount; + case "breakAddStack": + return AIPlayTagType.BreakAddStack; + case "changeInplayImmediateRemoveByBanish": + return AIPlayTagType.ChangeInplayImmediateRemoveByBanish; + case "changeInplayImmediateRemoveByDestroy": + return AIPlayTagType.ChangeInplayImmediateRemoveByDestroy; + case "changeInplayCannotPlay": + return AIPlayTagType.ChangeInplayCannotPlay; + case "changeInplayCannotAttack": + return AIPlayTagType.ChangeInplayCannotAttack; + case "changeInplayAttachTag": + return AIPlayTagType.ChangeInplayAttachTag; + case "changeInplayImmediateShield": + return AIPlayTagType.ChangeInplayImmediateShield; + case "changeInplayImmediateDamageCut": + return AIPlayTagType.ChangeInplayImmediateDamageCut; + case "changeInplayImmediateDamageClip": + return AIPlayTagType.ChangeInplayImmediateDamageClip; + case "changeInplayImmediateLifeLowerLimit": + return AIPlayTagType.ChangeInplayImmediateLifeLowerLimit; + case "changeInplayImmediateUntouchable": + return AIPlayTagType.ChangeInplayImmediateUntouchable; + case "changeInplayImmediateIndestructible": + return AIPlayTagType.ChangeInplayImmediateIndestructible; + case "changePpTotalBuff": + return AIPlayTagType.ChangePpTotalBuff; + case "changeInplayImmediateDamageModifier": + return AIPlayTagType.ChangeInplayImmediateDamageModifier; + case "evoSetStatus": + return AIPlayTagType.EvoSetStatus; + case "playRemoveSkill": + return AIPlayTagType.PlayRemoveSkill; + case "fanfareRemoveSkill": + return AIPlayTagType.FanfareRemoveSkill; + case "playModifyConsumeEp": + return AIPlayTagType.PlayModifyConsumeEp; + case "fanfareModifyConsumeEp": + return AIPlayTagType.FanfareModifyConsumeEp; + case "playEvo": + return AIPlayTagType.PlayEvo; + case "fanfareEvo": + return AIPlayTagType.FanfareEvo; + case "otherPlayEvo": + return AIPlayTagType.OtherPlayEvo; + case "otherEnhanceEvo": + return AIPlayTagType.OtherEnhanceEvo; + case "otherPlayDamage": + return AIPlayTagType.OtherPlayDamage; + case "otherPlayDestroy": + return AIPlayTagType.OtherPlayDestroy; + case "otherPlayBounce": + return AIPlayTagType.OtherPlayBounce; + case "otherPlayBuff": + return AIPlayTagType.OtherPlayBuff; + case "otherPlayToken": + return AIPlayTagType.OtherPlayToken; + case "otherPlayRemoveTag": + return AIPlayTagType.OtherPlayRemoveTag; + case "otherPlayQuick": + return AIPlayTagType.OtherPlayQuick; + case "attackSubtractCountdown": + return AIPlayTagType.AttackSubtractCountdown; + case "damagedBonus": + return AIPlayTagType.DamagedBonus; + case "damagedBuff": + return AIPlayTagType.DamagedBuff; + case "damagedDamage": + return AIPlayTagType.DamagedDamage; + case "damagedToken": + return AIPlayTagType.DamagedToken; + case "damagedHeal": + return AIPlayTagType.DamagedHeal; + case "damagedCantUnderAttack": + return AIPlayTagType.DamagedCantUnderAttack; + case "otherDamagedDamage": + return AIPlayTagType.OtherDamagedDamage; + case "otherDamagedHeal": + return AIPlayTagType.OtherDamagedHeal; + case "otherDamagedSetLeaderMaxLife": + return AIPlayTagType.OtherDamagedSetLeaderMaxLife; + case "otherDamagedSubtractCountdown": + return AIPlayTagType.OtherDamagedSubtractCountdown; + case "otherDamagedBanish": + return AIPlayTagType.OtherDamagedBanish; + case "otherAttackBuff": + return AIPlayTagType.OtherAttackBuff; + case "otherAttackDamage": + return AIPlayTagType.OtherAttackDamage; + case "otherAttackHeal": + return AIPlayTagType.OtherAttackHeal; + case "otherAttackToken": + return AIPlayTagType.OtherAttackToken; + case "otherEvoBuff": + return AIPlayTagType.OtherEvoBuff; + case "otherAttackAttachTag": + return AIPlayTagType.OtherAttackAttachTag; + case "otherAttackRemoveTag": + return AIPlayTagType.OtherAttackRemoveTag; + case "otherEvoDamage": + return AIPlayTagType.OtherEvoDamage; + case "otherEvoBanish": + return AIPlayTagType.OtherEvoBanish; + case "otherEvoSubtractCountdown": + return AIPlayTagType.OtherEvoSubtractCountdown; + case "otherEvoEvo": + return AIPlayTagType.OtherEvoEvo; + case "otherEvoToken": + return AIPlayTagType.OtherEvoToken; + case "otherEvoShield": + return AIPlayTagType.OtherEvoShield; + case "selfAndOtherEvoDamage": + return AIPlayTagType.SelfAndOtherEvoDamage; + case "selfAndOtherEvoAttachTag": + return AIPlayTagType.SelfAndOtherEvoAttachTag; + case "selfAndOtherEvoShield": + return AIPlayTagType.SelfAndOtherEvoShield; + case "selfAndOtherEvoDestroy": + return AIPlayTagType.SelfAndOtherEvoDestroy; + case "selfAndOtherEvoBounce": + return AIPlayTagType.SelfAndOtherEvoBounce; + case "selfAndOtherEvoToken": + return AIPlayTagType.SelfAndOtherEvoToken; + case "selfAndOtherEvoDraw": + return AIPlayTagType.SelfAndOtherEvoDraw; + case "selfAndOtherEvoAddCemetery": + return AIPlayTagType.SelfAndOtherEvoAddCemetery; + case "selfAndOtherEvoHeal": + return AIPlayTagType.SelfAndOtherEvoHeal; + case "selfAndOtherEvoTokenDraw": + return AIPlayTagType.SelfAndOtherEvoTokenDraw; + case "attackKiller": + return AIPlayTagType.AttackKiller; + case "lastwordEvo": + return AIPlayTagType.LastwordEvo; + case "lastwordRemoveSkill": + return AIPlayTagType.LastwordRemoveSkill; + case "lastwordAddCemetery": + return AIPlayTagType.LastwordAddCemetery; + case "lastwordDamageClip": + return AIPlayTagType.LastwordDamageClip; + case "lastwordShield": + return AIPlayTagType.LastwordShield; + case "evolveToOther": + return AIPlayTagType.EvolveToOther; + case "playShield": + return AIPlayTagType.PlayShield; + case "fanfareShield": + return AIPlayTagType.FanfareShield; + case "playDamageCut": + return AIPlayTagType.PlayDamageCut; + case "fanfareDamageCut": + return AIPlayTagType.FanfareDamageCut; + case "playDamageClip": + return AIPlayTagType.PlayDamageClip; + case "fanfareDamageClip": + return AIPlayTagType.FanfareDamageClip; + case "otherPlayRecoverPp": + return AIPlayTagType.OtherPlayRecoverPp; + case "attackShield": + return AIPlayTagType.AttackShield; + case "clashShield": + return AIPlayTagType.ClashShield; + case "attackDamageClip": + return AIPlayTagType.AttackDamageClip; + case "clashDamageClip": + return AIPlayTagType.ClashDamageClip; + case "clashRemoveTag": + return AIPlayTagType.ClashRemoveTag; + case "otherLeaveDamage": + return AIPlayTagType.OtherLeaveDamage; + case "otherLeaveToken": + return AIPlayTagType.OtherLeaveToken; + case "turnEndRemoveTag": + return AIPlayTagType.TurnEndRemoveTag; + case "otherPlayAttachTag": + return AIPlayTagType.OtherPlayAttachTag; + case "buffBonus": + return AIPlayTagType.BuffBonus; + case "necromanceDamage": + return AIPlayTagType.NecromanceDamage; + case "necromanceHeal": + return AIPlayTagType.NecromanceHeal; + case "fanfareRemoveGuard": + return AIPlayTagType.FanfareRemoveGuard; + case "attackRemoveTag": + return AIPlayTagType.AttackRemoveTag; + case "forceImmediateAttack": + return AIPlayTagType.ForceImmediateAttack; + case "stack": + return AIPlayTagType.Stack; + case "evoAddStack": + return AIPlayTagType.EvoAddStack; + case "fusionMetamorphose": + return AIPlayTagType.FusionMetamorphose; + case "lastwordSubtractCountdown": + return AIPlayTagType.LastwordSubtractCountdown; + case "attackSetStatus": + return AIPlayTagType.AttackSetStatus; + case "playAddDeck": + return AIPlayTagType.PlayAddDeck; + case "fanfareAddDeck": + return AIPlayTagType.FanfareAddDeck; + case "attackAddDeck": + return AIPlayTagType.AttackAddDeck; + case "breakRecoverPp": + return AIPlayTagType.BreakRecoverPp; + case "choiceBrave": + return AIPlayTagType.ChoiceBrave; + default: + if (!string.IsNullOrEmpty(word)) + { + AIConsoleUtility.LogError("AICardData Unknown tag : " + word); + } + return AIPlayTagType.None; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIScriptTextToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIScriptTextToken.cs new file mode 100644 index 0000000..75da007 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIScriptTextToken.cs @@ -0,0 +1,30 @@ +namespace Wizard; + +public class AIScriptTextToken : AIScriptArgumentToken +{ + public string Text { get; private set; } + + public AIScriptTextToken(string text, bool isNot) + : base(AIScriptTokenArgType.AI_TRIBE, isNot) + { + Text = text; + } + + public override AIScriptTokenBase Clone() + { + return new AIScriptTextToken(Text, base.IsNot); + } + + public override bool IsEqual(AIScriptTokenBase token) + { + if (!(token is AIScriptTextToken aIScriptTextToken)) + { + return false; + } + if (ArgumentType == aIScriptTextToken.ArgumentType && base.IsNot == aIScriptTextToken.IsNot) + { + return Text == aIScriptTextToken.Text; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIScriptVariableToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIScriptVariableToken.cs new file mode 100644 index 0000000..ec4d7aa --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIScriptVariableToken.cs @@ -0,0 +1,26 @@ +namespace Wizard; + +public class AIScriptVariableToken : AIScriptTokenBase +{ + public AIScriptTokenVariableType VariableType; + + public AIScriptVariableToken(AIScriptTokenVariableType valType) + : base(AIScriptTokenType.VARIABLE, 0f) + { + VariableType = valType; + } + + public override AIScriptTokenBase Clone() + { + return new AIScriptVariableToken(VariableType); + } + + public override bool IsEqual(AIScriptTokenBase token) + { + if (!(token is AIScriptVariableToken aIScriptVariableToken)) + { + return false; + } + return VariableType == aIScriptVariableToken.VariableType; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISelectLogicArgumentBase.cs b/SVSim.BattleEngine/Engine/Wizard/AISelectLogicArgumentBase.cs new file mode 100644 index 0000000..3357c6f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISelectLogicArgumentBase.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; + +namespace Wizard; + +public abstract class AISelectLogicArgumentBase +{ + protected List _argumentList; + + public virtual AIScriptTokenArgType LogicType { get; } + + public AISelectLogicArgumentBase(List args) + { + InitializeArgument(args); + } + + public virtual void InitializeArgument(List args) + { + if (args != null && args.Count > 0) + { + _argumentList = new List(); + for (int i = 0; i < args.Count; i++) + { + _argumentList.Add(new AIPolishConvertedExpression(args[i])); + } + } + } + + public void SetSelectTarget(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, AIScriptTokenArgType whichSelectType, List playPtn, AISituationInfo situation) + { + if (candidates == null || candidates.Count <= 0) + { + return; + } + if (selectCount <= 0) + { + AIConsoleUtility.LogError($"AISelectLogicArgumentBase error!! selectCount == {selectCount}"); + } + else if (selectCount == 1) + { + AIVirtualCard aIVirtualCard = SelectSingleTarget(candidates, tagOwner, field, playPtn, situation, AISelectTargetPattern.Best); + if (aIVirtualCard != null) + { + situation.SetSingleTargetInInfo(aIVirtualCard, TargetSelectType.Default, whichSelectType); + } + } + else + { + List list = SelectMultipleSelectedTargets(candidates, selectCount, tagOwner, field, playPtn, situation, AISelectTargetPattern.Best); + if (list != null && list.Count > 0) + { + situation.SetMultipleTargetsInInfo(list, TargetSelectType.Default, AIRemovalType.None, whichSelectType); + } + } + } + + protected void LogNotImplementMultipleSelect() + { + AIConsoleUtility.LogError($"{LogicType}: ่ค‡ๆ•ฐใ‚ฟใƒผใ‚ฒใƒƒใƒˆ้ธๆŠžใŒๆœชๅฏพๅฟœใงใ™ใ€‚"); + } + + public abstract AIVirtualCard SelectSingleTarget(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest); + + public abstract List SelectMultipleSelectedTargets(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISelectTargetPattern.cs b/SVSim.BattleEngine/Engine/Wizard/AISelectTargetPattern.cs new file mode 100644 index 0000000..5d6afea --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISelectTargetPattern.cs @@ -0,0 +1,7 @@ +namespace Wizard; + +public enum AISelectTargetPattern +{ + Worst, + Best +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISetTribe.cs b/SVSim.BattleEngine/Engine/Wizard/AISetTribe.cs new file mode 100644 index 0000000..3980a8a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISetTribe.cs @@ -0,0 +1,25 @@ +namespace Wizard; + +public class AISetTribe : AIScriptArgumentExpressions +{ + private string _tribe; + + public AISetTribe(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList != null && _exprList.Count > 0 && _exprList[0].TokenList[0] is AIScriptTextToken aIScriptTextToken) + { + _tribe = aIScriptTextToken.Text; + } + } + + public bool CheckTribe(string tribe) + { + return tribe == _tribe; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AISimulationUtility.cs new file mode 100644 index 0000000..c675fc3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISimulationUtility.cs @@ -0,0 +1,746 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Wizard; + +public static class AISimulationUtility +{ + public static int FULL_SIMULATION_MOVE_COUNT_TURESHOLD = 16; + + public static float ILLEGAL_PLAYPTN_VALUE = -1000f; + + private static readonly int[] PATTERN_GROUP_FOR_5 = new int[1] { 31 }; + + private static readonly int[] PATTERN_GROUP_FOR_4 = new int[5] { 30, 29, 27, 23, 15 }; + + private static readonly int[] PATTERN_GROUP_FOR_3 = new int[10] { 28, 26, 25, 22, 21, 19, 14, 13, 11, 7 }; + + private static readonly int[] PATTERN_GROUP_FOR_2 = new int[10] { 24, 20, 18, 17, 12, 10, 9, 6, 5, 3 }; + + private static readonly int[] PATTERN_GROUP_FOR_1 = new int[5] { 16, 8, 4, 2, 1 }; + + private static ulong[] PRIME_NUMBERS_FOR_ENEMY = new ulong[6] { 67uL, 9221uL, 181uL, 271939uL, 3001uL, 12277uL }; + + private static ulong[] PRIME_NUMBERS_FOR_ALLY = new ulong[6] { 4919uL, 11149uL, 187651uL, 139uL, 3011uL, 2003uL }; + + public static List GetActionInfoSequence(AIVirtualField field, int[] permList, bool[] isAttackFollowerFlags, int evoIndex) + { + List list = new List(); + if (permList != null && permList.Length <= field.AllyInplayCards.Count((AIVirtualCard c) => c.IsUnit) && permList.Length == isAttackFollowerFlags.Length) + { + for (int num = 0; num < permList.Length; num++) + { + int num2 = permList[num]; + AIVirtualCard originalActor = field.AllyInplayCards[num2]; + AIVirtualCard currentFieldActor = field.AllyInplayCards.FirstOrDefault((AIVirtualCard card) => card.CardIndex == originalActor.CardIndex); + if (currentFieldActor == null) + { + break; + } + if (num2 == evoIndex && !currentFieldActor.IsEvolution) + { + field.AllyInplayCards[num2].IsUseEvo = true; + if (field.CardListSet.AllyClassAndInplayCards.Any((AIVirtualCard c) => c.IsFirstEvo(currentFieldActor, field.BestPlayPtn))) + { + list.Insert(0, new AIVirtualTargetSelectAction(currentFieldActor, currentFieldActor, AIOperationType.EVOLVE)); + } + else + { + list.Add(new AIVirtualTargetSelectAction(currentFieldActor, currentFieldActor, AIOperationType.EVOLVE)); + } + } + list.Add(new AIVirtualAttackInfo(currentFieldActor, isAttackFollowerFlags[num])); + } + } + field.ActionLength = 0; + return list; + } + + public static List GetEnemyTargets(List enemyInplayCards, List targetCandidates, int breakPtnIndex, List playPtn) + { + List list = new List(); + for (int i = 0; i < targetCandidates.Count; i++) + { + int num = targetCandidates[i]; + if (!enemyInplayCards[num].IsAmulet && ((breakPtnIndex >> i) & 1) > 0) + { + AddTarget(enemyInplayCards, num, list, playPtn); + } + } + return list; + } + + private static void AddTarget(List targetCandidates, int targetIndex, List virtualCardList, List playPtn) + { + AIVirtualCard tagOwner = targetCandidates[targetIndex]; + int num = -1; + for (int i = 0; i < virtualCardList.Count; i++) + { + if (targetCandidates[virtualCardList[i]].IsBreakLast(playPtn)) + { + num = i; + break; + } + } + if (tagOwner.IsBreakFirst(playPtn)) + { + virtualCardList.Insert(0, targetIndex); + } + else if (tagOwner.IsBreakLast(playPtn)) + { + virtualCardList.Add(targetIndex); + } + else if (num >= 0) + { + virtualCardList.Insert(num, targetIndex); + } + else + { + virtualCardList.Add(targetIndex); + } + } + + public static List GetEnemyTargetSequence(AIVirtualField field, List enemyTargetIndexes) + { + List list = new List(); + for (int i = 0; i < enemyTargetIndexes.Count; i++) + { + if (enemyTargetIndexes[i] < field.EnemyInplayCards.Count && enemyTargetIndexes[i] >= 0) + { + list.Add(field.EnemyInplayCards[enemyTargetIndexes[i]]); + } + } + return list; + } + + public static bool IsValidEnemyTargetIndexes(List enemyCards, List enemyTargetIndexes) + { + if (enemyTargetIndexes.Count > enemyCards.Count) + { + return false; + } + for (int i = 0; i < enemyTargetIndexes.Count; i++) + { + if (enemyCards[enemyTargetIndexes[i]].IsAmulet) + { + return false; + } + } + return true; + } + + public static bool IsValuableEvoIndex(int evoIndex, AIVirtualField originalField) + { + if (evoIndex >= 0 && !originalField.AllyInplayCards[evoIndex].IsUnit) + { + return false; + } + if (evoIndex >= 0) + { + AIVirtualCard aIVirtualCard = originalField.AllyInplayCards[evoIndex]; + AIVirtualTargetSelectAction situation = new AIVirtualTargetSelectAction(aIVirtualCard, aIVirtualCard, AIOperationType.EVOLVE, (AISelectedTargetInfoSet)null); + if (!aIVirtualCard.IsAbleEvolution() || aIVirtualCard.CreateAIVirtualSelectInfo(originalField, situation) != null) + { + return false; + } + } + return true; + } + + public static bool IsBestRecord(AIVirtualField field, float currentFieldValue, float valueAtSelfTurnEnd, SimulationResult bestRecord) + { + if (field.EnemyClass.IsDead) + { + int actionLength = field.ActionLength; + if (actionLength < bestRecord.MinActionLengthOfLethal || (actionLength == bestRecord.MinActionLengthOfLethal && EnemyAI.IsLargerThan(currentFieldValue, bestRecord.MaxFieldValue))) + { + return true; + } + } + else + { + if (EnemyAI.IsLargerThan(currentFieldValue, bestRecord.MaxFieldValue)) + { + return true; + } + if (EnemyAI.IsSameValue(currentFieldValue, bestRecord.MaxFieldValue) && EnemyAI.IsLargerThan(valueAtSelfTurnEnd, bestRecord.MaxFieldValueAtSelfTurnEnd)) + { + return true; + } + } + return false; + } + + public static bool ExecuteVirtualAction(AIVirtualActionInfo actionInfo, AIVirtualActionInfo evolutionInfo, List enemyTargetSequence, SimulationSetting setting) + { + AIVirtualField selfField = actionInfo.Actor.SelfField; + if (actionInfo.IsAlreadyUsed) + { + _ = (actionInfo.Actor.IsPlayer ? "p" : "e") + actionInfo.Actor.CardIndex; + return false; + } + if (actionInfo.Actor.IsDead) + { + actionInfo.IsAlreadyUsed = true; + return false; + } + if (actionInfo.ActionType == AIOperationType.EVOLVE) + { + actionInfo.IsAlreadyUsed = true; + if (actionInfo.Actor.IsEvolution) + { + return false; + } + if (!actionInfo.Actor.IsUseEvo) + { + return false; + } + AIVirtualEvolutionSimulator.ManualEvolve(actionInfo, selfField); + selfField.EvoUsedCard = actionInfo.Actor; + } + else if (actionInfo is AIVirtualAttackInfo aIVirtualAttackInfo) + { + AIVirtualAttackInfo aIVirtualAttackInfo2 = aIVirtualAttackInfo; + if (aIVirtualAttackInfo.AttackTarget != null) + { + aIVirtualAttackInfo2 = new AIVirtualAttackInfo(aIVirtualAttackInfo.Actor, aIVirtualAttackInfo.IsAttackFollower, aIVirtualAttackInfo.PremiseAction); + } + AIVirtualCard aIVirtualCard = BattleSequencer.FindAttackTarget(selfField, aIVirtualAttackInfo2, enemyTargetSequence, evolutionInfo, setting.IsHandRemovalValid, setting.NoSkipAttack, aIVirtualAttackInfo2.IsAttackFollower); + bool isAttackerUsed = false; + if (aIVirtualCard != null) + { + AIAttackSimulationUtility.SimulateAttackIfValuable(aIVirtualAttackInfo2, selfField, setting.UseLeaderAttackPreCheck, ref isAttackerUsed); + if (aIVirtualCard.IsDead) + { + aIVirtualAttackInfo2.IsBreakTarget = true; + } + } + else + { + aIVirtualAttackInfo2.SetAttackTarget(null); + isAttackerUsed = true; + } + actionInfo.IsAlreadyUsed = isAttackerUsed; + if (!aIVirtualAttackInfo2.IsAttackSuccessed) + { + return false; + } + } + return true; + } + + public static float EvaluateField(AIVirtualField field, EvaluationType type) + { + switch (type) + { + case EvaluationType.FULL: + return field.EvaluateField() - (field.EnemyClass.IsDead ? 0f : field.EvaluateThreaten()); + case EvaluationType.SELF_TURN: + case EvaluationType.SIMPLE: + return field.EvaluateField(); + default: + return 0f; + } + } + + public static float EvaluateLegalPlayPtnAfterSimulation(AIVirtualField fieldTemp, List actionInfoSequence, PlayPtnWithToken[] playPtnsWithToken, int openCount, ulong[] defaultPlayptnHashs, out PlayPtnWithToken bestPlayPtnWithToken, out int bestFirstDeadActionIndex) + { + bestFirstDeadActionIndex = int.MaxValue; + bestPlayPtnWithToken = null; + ulong[] array = CalculatePlayptnWithTokenHashs(fieldTemp, playPtnsWithToken); + PlayPtnWithToken[] array2 = new PlayPtnWithToken[playPtnsWithToken.Length]; + for (int i = 0; i < playPtnsWithToken.Length; i++) + { + PlayPtnWithToken playPtnWithToken = playPtnsWithToken[i]; + if (playPtnWithToken == null || array[i] != defaultPlayptnHashs[i]) + { + array2[i] = null; + } + else + { + array2[i] = playPtnWithToken; + } + } + if (array2.Any((PlayPtnWithToken p) => p != null)) + { + return EvaluatePlayPtnValue(fieldTemp, actionInfoSequence, array2, openCount, out bestPlayPtnWithToken, out bestFirstDeadActionIndex); + } + return ILLEGAL_PLAYPTN_VALUE; + } + + private static float EvaluatePlayPtnValue(AIVirtualField fieldTemp, List actionInfoSequence, PlayPtnWithToken[] playPtnsWithToken, int openCount, out PlayPtnWithToken bestPlayPtnWithToken, out int bestFirstDeadActionIndex) + { + AIVirtualFieldRollBackBasicProcessor aIVirtualFieldRollBackBasicProcessor = new AIVirtualFieldRollBackBasicProcessor(fieldTemp); + AIStyleQuery styleQuery = fieldTemp.ParamQuery.styleQuery; + float num = float.MinValue; + bestFirstDeadActionIndex = int.MaxValue; + bestPlayPtnWithToken = null; + for (int num2 = openCount; num2 >= 0; num2--) + { + if (playPtnsWithToken[num2] != null) + { + PlayPtnWithToken playPtnWithToken = playPtnsWithToken[num2]; + if (playPtnWithToken != null) + { + List list = (fieldTemp.BestPlayPtn = playPtnWithToken.PlayPtn); + fieldTemp.UpdateBestPlayptnRecordOnSim(list); + List tokenPtn = playPtnWithToken.TokenPtn; + if (list.Count == tokenPtn.Count) + { + float num3 = float.MinValue; + for (int i = 0; i < fieldTemp.AllyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = fieldTemp.AllyInplayCards[i]; + if (aIVirtualCard.IsUnit && !aIVirtualCard.IsDead && aIVirtualCard.IsAbleEvolution()) + { + float num4 = aIVirtualCard.EvaluateAllEvoBonus(list, new AIVirtualTargetSelectAction(aIVirtualCard, aIVirtualCard, AIOperationType.EVOLVE, (AISelectedTargetInfoSet)null)); + if (num4 > num3) + { + num3 = num4; + } + } + } + float num5 = 0f; + AISinglePlayptnRecord playptnRecordOnSim = fieldTemp.GetPlayptnRecordOnSim(list); + for (int j = 0; j < tokenPtn.Count; j++) + { + TokenPlayPattern tokenPlayPattern = tokenPtn[j]; + AIVirtualCard aIVirtualCard2 = fieldTemp.AllyHandCards[list[j]]; + AIVirtualTargetSelectAction situation = new AIVirtualTargetSelectAction(aIVirtualCard2, aIVirtualCard2, AIOperationType.PLAY, (AISelectedTargetInfoSet)null); + AIPreprocessSimulationUtility.SimulatePreprocess(aIVirtualCard2, situation, fieldTemp, AIScriptTokenArgType.WHEN_PLAY, isPseudo: true); + bool flag = fieldTemp.StyleQuery.IsPlayBreak(aIVirtualCard2, list, situation); + bool flag2 = playptnRecordOnSim.PlayedCardList[j].PlayType == PlaySimulationType.Accelerate; + if (!flag && !flag2) + { + num5 += aIVirtualCard2.EvaluateValueOnField(list, null, useStyle: true); + } + num5 += aIVirtualCard2.EvaluatePlayValue(list, situation); + num5 += (aIVirtualCard2.GetAllBreakBonus(list, useIgnoreInBattle: false) + aIVirtualCard2.GetAllLeaveBonus(list, useIgnoreInBattle: false)) * (flag ? 1f : EnemyAI.BREAKBONUS_RATE_IN_HAND); + fieldTemp.UpdateVirtualFieldWhenEvaluation(aIVirtualCard2, situation); + if (tokenPlayPattern.TokenInfoPairList != null && tokenPlayPattern.TokenInfoPairList.Count > 0) + { + for (int k = 0; k < tokenPlayPattern.TokenInfoPairList.Count; k++) + { + AITokenInformation aITokenInformation = tokenPlayPattern.TokenInfoPairList[k]; + int tokenId = aITokenInformation.TokenId; + AIVirtualCard tokenFromId = fieldTemp.AI.tokenManager.GetTokenFromId(tokenId, aIVirtualCard2.IsAlly, fieldTemp); + num5 += tokenFromId.EvaluateValueOnField(list, null, useStyle: true); + num5 += (tokenFromId.GetAllBreakBonus(list, useIgnoreInBattle: false) + tokenFromId.GetAllLeaveBonus(list, useIgnoreInBattle: false)) * EnemyAI.BREAKBONUS_RATE_IN_HAND; + if (aITokenInformation.TokenType == AITokenType.Reanimate) + { + num5 += tokenFromId.GetReanimateBonus(list); + } + } + } + if (j == 0 && aIVirtualCard2.IsFollower(list) && aIVirtualCard2.IsAbleEvolution()) + { + float num6 = aIVirtualCard2.EvaluateAllEvoBonus(list, new AIVirtualTargetSelectAction(aIVirtualCard2, aIVirtualCard2, AIOperationType.EVOLVE, (AISelectedTargetInfoSet)null)); + if (num6 > num3) + { + num5 += num6; + } + } + } + aIVirtualFieldRollBackBasicProcessor.ResetVirtualFieldToStart(); + num5 += AIEvaluateBonusFromOhterUtility.GetPlayPtnBonus(fieldTemp, list) + styleQuery.GetPlayptnBonus(fieldTemp, list); + int num7 = int.MaxValue; + for (int l = 0; l < actionInfoSequence.Count; l++) + { + if (actionInfoSequence[l].Actor != null && actionInfoSequence[l].Actor.IsDead) + { + num7 = l; + break; + } + } + if (EnemyAI.IsLargerThan(num5, num) || (EnemyAI.IsSameValue(num5, num) && num7 < bestFirstDeadActionIndex)) + { + num = num5; + bestFirstDeadActionIndex = num7; + bestPlayPtnWithToken = playPtnWithToken; + } + } + } + } + } + return num; + } + + public static float CalculateMoveFirstBonusValue(List moves) + { + if (moves == null || !moves.Any()) + { + return 0f; + } + AIVirtualCard actor = moves[0].Actor; + return actor.SelfField.StyleQuery.GetFirstMoveBonus(actor, moves); + } + + public static float CalculateOneOnOneBothDeadBonus(List moves) + { + if (moves.Count <= 1 || !(moves[0] is AIVirtualAttackInfo)) + { + return 0f; + } + AIVirtualAttackInfo aIVirtualAttackInfo = moves[0] as AIVirtualAttackInfo; + if (aIVirtualAttackInfo.Actor.IsDead && aIVirtualAttackInfo.IsBreakTarget) + { + return 0.002f; + } + return 0f; + } + + public static List GetAllMovesForFullSimulation(AIVirtualField field, bool doesUseEvo, SimulationAdditionalActionInfoSet additionalActionInfoSet) + { + AIVirtualTargetSelectAction aIVirtualTargetSelectAction = null; + List extraActions = null; + AISinglePlayptnRecord playPtnRecord = null; + if (additionalActionInfoSet != null) + { + aIVirtualTargetSelectAction = additionalActionInfoSet.ForceEvoAction; + extraActions = additionalActionInfoSet.ExtraActionBaseList; + playPtnRecord = additionalActionInfoSet.PlayPtnRecord; + } + List list = null; + if (doesUseEvo) + { + list = GetAllVirtualInplayMove(field); + } + else + { + list = GetAllVirtualAttackMove(field); + if (aIVirtualTargetSelectAction != null) + { + AIVirtualActionInfo aIVirtualActionInfo = CreateActionInfoOnFieldFromSituation(field, aIVirtualTargetSelectAction); + if (aIVirtualActionInfo != null) + { + list.Add(aIVirtualActionInfo); + } + } + } + List allExtraActionList = GetAllExtraActionList(field, extraActions, playPtnRecord); + if (allExtraActionList != null && allExtraActionList.Count > 0) + { + list.AddRange(allExtraActionList); + } + list.Add(new AIVirtualTurnEndInfo(field.AllyClass)); + return list; + } + + private static List GetAllVirtualInplayMove(AIVirtualField field) + { + List list = new List(); + List allVirtualEvolMove = GetAllVirtualEvolMove(field); + List allVirtualAttackMove = GetAllVirtualAttackMove(field); + for (int i = 0; i < allVirtualEvolMove.Count; i++) + { + list.Add(allVirtualEvolMove[i]); + } + for (int j = 0; j < allVirtualAttackMove.Count; j++) + { + list.Add(allVirtualAttackMove[j]); + } + return list; + } + + private static List GetAllVirtualEvolMove(AIVirtualField field) + { + List list = new List(); + if (field.EvoUsedCard != null) + { + return list; + } + for (int i = 0; i < field.AllyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyInplayCards[i]; + if (!aIVirtualCard.IsDead) + { + AIVirtualTargetSelectAction aIVirtualTargetSelectAction = new AIVirtualTargetSelectAction(aIVirtualCard, aIVirtualCard, AIOperationType.EVOLVE); + if (aIVirtualCard.IsAbleEvolution() && aIVirtualCard.CreateAIVirtualSelectInfo(field, aIVirtualTargetSelectAction) == null) + { + list.Add(aIVirtualTargetSelectAction); + } + } + } + return list; + } + + private static List GetAllVirtualAttackMove(AIVirtualField field) + { + List list = new List(); + for (int i = 0; i < field.AllyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyInplayCards[i]; + if (aIVirtualCard.IsDead) + { + continue; + } + for (int j = 0; j < field.EnemyInplayCards.Count; j++) + { + AIVirtualCard aIVirtualCard2 = field.EnemyInplayCards[j]; + AIVirtualAttackInfo aIVirtualAttackInfo = new AIVirtualAttackInfo(aIVirtualCard, aIVirtualCard2); + if (!aIVirtualCard2.IsDead && AIAttackSimulationUtility.IsAttackPossible(field, aIVirtualAttackInfo)) + { + list.Add(aIVirtualAttackInfo); + } + } + } + for (int k = 0; k < field.AllyInplayCards.Count; k++) + { + AIVirtualCard aIVirtualCard3 = field.AllyInplayCards[k]; + if (!aIVirtualCard3.IsDead) + { + AIVirtualAttackInfo aIVirtualAttackInfo2 = new AIVirtualAttackInfo(aIVirtualCard3, field.EnemyClass); + if (!field.EnemyClass.IsDead && AIAttackSimulationUtility.IsAttackPossible(field, aIVirtualAttackInfo2)) + { + list.Add(aIVirtualAttackInfo2); + } + } + } + return list; + } + + private static List GetAllExtraActionList(AIVirtualField field, List extraActions, AISinglePlayptnRecord playPtnRecord) + { + if (extraActions == null || extraActions.Count <= 0) + { + return null; + } + List list = null; + for (int i = 0; i < extraActions.Count; i++) + { + AIVirtualActionInfo aIVirtualActionInfo = extraActions[i]; + if (aIVirtualActionInfo.ActionType != AIOperationType.PLAY || !(CreateActionInfoOnFieldFromSituation(field, aIVirtualActionInfo) is AIVirtualTargetSelectAction aIVirtualTargetSelectAction)) + { + continue; + } + List list2 = aIVirtualTargetSelectAction.Actor.CreateAIVirtualSelectInfo(field, aIVirtualTargetSelectAction); + if (list2 == null || list2.Count <= 0) + { + if (AIPlayCardSimulationUtility.IsAbleToPlayCard(aIVirtualTargetSelectAction, field, EnemyAI.EmptyPlayPtn) && field.AllyInplayCards.Count((AIVirtualCard c) => !c.IsDead) < 5) + { + list = AIParamQuery.AddElementToList(aIVirtualTargetSelectAction, list); + } + continue; + } + AISelectedTargetInfoSet preDecidedTargetSet = null; + if (aIVirtualTargetSelectAction.SelectedTargets.IsAnyTargetExists()) + { + preDecidedTargetSet = aIVirtualTargetSelectAction.SelectedTargets; + } + List allTargetSelectSimulationPattern = AIVirtualTargetSelectSimulator.GetAllTargetSelectSimulationPattern(list2, preDecidedTargetSet, aIVirtualTargetSelectAction, field, playPtnRecord); + if (allTargetSelectSimulationPattern == null || allTargetSelectSimulationPattern.Count <= 0) + { + continue; + } + for (int num = 0; num < allTargetSelectSimulationPattern.Count; num++) + { + AISelectedTargetInfoSet selectedTargetList = allTargetSelectSimulationPattern[num]; + AIVirtualTargetSelectAction aIVirtualTargetSelectAction2 = new AIVirtualTargetSelectAction(aIVirtualTargetSelectAction.Actor, aIVirtualTargetSelectAction.OriginalCard, AIOperationType.PLAY, selectedTargetList); + if (AIPlayCardSimulationUtility.IsAbleToPlayCard(aIVirtualTargetSelectAction2, field, EnemyAI.EmptyPlayPtn) && field.AllyInplayCards.Count < 5) + { + list = AIParamQuery.AddElementToList(aIVirtualTargetSelectAction2, list); + } + } + } + return list; + } + + public static float EvaluateAttackValueAfterAllSkill(AIVirtualField field, AISituationInfo situation, List allyAttackers, List enemyRemains, List playPtn) + { + for (int i = 0; i < allyAttackers.Count; i++) + { + allyAttackers[i].CalculateCardValueWhenDestroyed(playPtn, situation); + } + for (int j = 0; j < enemyRemains.Count; j++) + { + enemyRemains[j].CalculateCardValueWhenDestroyed(playPtn, situation); + } + enemyRemains.OrderBy((AIVirtualCardStatusInfo info) => info.ValueWhenDestroyed); + float num = 0f; + AIVirtualAttackInfo aIVirtualAttackInfo = new AIVirtualAttackInfo(null, null); + for (int num2 = 0; num2 < enemyRemains.Count; num2++) + { + AIVirtualCardStatusInfo aIVirtualCardStatusInfo = enemyRemains[num2]; + aIVirtualAttackInfo.SetAttackTarget(aIVirtualCardStatusInfo.BaseCard); + float num3 = 0f; + List usedAttackers = null; + int num4 = 0; + List list = null; + int num5 = (int)Mathf.Pow(2f, allyAttackers.Count); + for (int num6 = 0; num6 < num5; num6++) + { + int num7 = num6; + int num8 = 0; + int num9 = 0; + int num10 = 0; + float num11 = 0f; + float num12 = 0f; + List list2 = new List(); + List list3 = new List(); + while (num7 > 0) + { + if (num7 % 2 == 1) + { + AIVirtualCardStatusInfo aIVirtualCardStatusInfo2 = allyAttackers[num8]; + if (!aIVirtualCardStatusInfo2.BaseCard.IsAttackable(EnemyAI.EmptyPlayPtn)) + { + num8++; + num7 /= 2; + continue; + } + aIVirtualAttackInfo.SetActor(aIVirtualCardStatusInfo2.BaseCard); + list2.Add(aIVirtualCardStatusInfo2); + num9 += aIVirtualCardStatusInfo.BaseCard.SimulateDamageAmount(aIVirtualCardStatusInfo2.BaseCard.SimulateAttackAmount(aIVirtualCardStatusInfo2.Attack, aIVirtualAttackInfo)); + num10 += aIVirtualCardStatusInfo.BaseCard.SimulateDamageAmount(aIVirtualCardStatusInfo2.BaseCard.SimulateAttackAmount(aIVirtualAttackInfo)); + int num13 = aIVirtualCardStatusInfo2.BaseCard.SimulateDamageAmount(aIVirtualCardStatusInfo.BaseCard.SimulateAttackAmount(aIVirtualCardStatusInfo.Attack, aIVirtualAttackInfo)); + int num14 = aIVirtualCardStatusInfo2.BaseCard.SimulateDamageAmount(aIVirtualCardStatusInfo.BaseCard.SimulateAttackAmount(aIVirtualAttackInfo)); + list3.Add(num13); + if (num13 >= aIVirtualCardStatusInfo2.Life) + { + num11 += aIVirtualCardStatusInfo2.ValueWhenDestroyed; + } + int num15 = Mathf.Max(0, aIVirtualCardStatusInfo2.Life - num13); + int num16 = Mathf.Max(0, aIVirtualCardStatusInfo2.BaseCard.Life - num14); + num12 += (float)(num15 - num16); + } + num8++; + num7 /= 2; + } + float num17 = 0f; + num17 = ((num10 >= aIVirtualCardStatusInfo.BaseCard.Life) ? 0f : ((num9 >= aIVirtualCardStatusInfo.Life) ? (aIVirtualCardStatusInfo.ValueWhenDestroyed - num11) : 0f)); + num17 += num12; + if (num3 < num17) + { + num3 = num17; + usedAttackers = list2; + num4 = num9; + list = list3; + } + } + if (usedAttackers != null && list != null) + { + allyAttackers.RemoveAll((AIVirtualCardStatusInfo card) => usedAttackers.Contains(card)); + num += num3; + for (int num18 = 0; num18 < usedAttackers.Count; num18++) + { + AIVirtualCardStatusInfo aIVirtualCardStatusInfo3 = usedAttackers[num18]; + int num19 = list[num18]; + aIVirtualCardStatusInfo3.ModifyStatus(aIVirtualCardStatusInfo3.Attack, aIVirtualCardStatusInfo3.Life - num19); + } + aIVirtualCardStatusInfo.ModifyStatus(aIVirtualCardStatusInfo.Attack, aIVirtualCardStatusInfo.Life - num4); + } + } + return num; + } + + public static int[] GetPatternGroup(int count) + { + return count switch + { + 5 => PATTERN_GROUP_FOR_5, + 4 => PATTERN_GROUP_FOR_4, + 3 => PATTERN_GROUP_FOR_3, + 2 => PATTERN_GROUP_FOR_2, + 1 => PATTERN_GROUP_FOR_1, + _ => null, + }; + } + + public static int Factorial(int n) + { + if (n <= 1) + { + return 1; + } + return n * Factorial(n - 1); + } + + public static ulong CalculateTargetSequenceHash(int[] permList, AIVirtualField field) + { + ulong num = 0uL; + for (int i = 0; i < permList.Length; i++) + { + AIVirtualCard aIVirtualCard = field.EnemyInplayCards[permList[i]]; + num += aIVirtualCard.GetHash() * PRIME_NUMBERS_FOR_ENEMY[i]; + } + return num; + } + + public static ulong CalculateAttackSequenceHash(int[] permList, AIVirtualField field) + { + ulong num = 0uL; + for (int i = 0; i < permList.Length; i++) + { + AIVirtualCard aIVirtualCard = field.AllyInplayCards[permList[i]]; + num += aIVirtualCard.GetHash() * PRIME_NUMBERS_FOR_ALLY[i]; + } + return num; + } + + public static ulong[] CalculatePlayptnWithTokenHashs(AIVirtualField field, PlayPtnWithToken[] bestPlayptnWithTokens) + { + if (bestPlayptnWithTokens == null) + { + return null; + } + ulong[] array = new ulong[bestPlayptnWithTokens.Length]; + for (int i = 0; i < bestPlayptnWithTokens.Length; i++) + { + PlayPtnWithToken playPtnWithToken = bestPlayptnWithTokens[i]; + if (playPtnWithToken == null) + { + array[i] = 0uL; + } + else + { + array[i] = field.CalculatePlayptnHash(playPtnWithToken.PlayPtn); + } + } + return array; + } + + public static AIVirtualActionInfo CreateActionInfoOnFieldFromSituation(AIVirtualField fieldTemp, AISituationInfo situation) + { + if (situation == null || situation.Actor == null) + { + return null; + } + switch (situation.ActionType) + { + case AIOperationType.ATTACK: + { + AIVirtualAttackInfo attackInfo = situation as AIVirtualAttackInfo; + if (attackInfo != null) + { + AIVirtualCard sourceCard = fieldTemp.AllyInplayCards.Find((AIVirtualCard c) => c.IsSameCard(attackInfo.Actor)); + AIVirtualCard target = fieldTemp.CardListSet.EnemyClassAndInplayCards.Find((AIVirtualCard c) => c.IsSameCard(attackInfo.AttackTarget)); + return new AIVirtualAttackInfo(sourceCard, target); + } + return null; + } + case AIOperationType.EVOLVE: + { + AIVirtualCard aIVirtualCard2 = fieldTemp.AllyInplayCards.Find((AIVirtualCard c) => c.IsSameCard(situation.Actor)); + if (aIVirtualCard2.IsEvolution) + { + return null; + } + aIVirtualCard2.IsUseEvo = true; + AISelectedTargetInfoSet similarTargetInfoSet = situation.SelectedTargets.GetSimilarTargetInfoSet(fieldTemp); + return new AIVirtualTargetSelectAction(aIVirtualCard2, aIVirtualCard2, AIOperationType.EVOLVE, similarTargetInfoSet); + } + case AIOperationType.PLAY: + { + AIVirtualCard aIVirtualCard = fieldTemp.AllyHandCards.Find((AIVirtualCard c) => c.IsSameCard(situation.OriginalCard)); + if (aIVirtualCard == null) + { + return null; + } + return new AIVirtualTargetSelectAction(aIVirtualCard.IsSameCard(situation.Actor) ? aIVirtualCard : new AIVirtualCard(situation.Actor, fieldTemp), aIVirtualCard, AIOperationType.PLAY); + } + default: + return null; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISkillSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AISkillSimulationUtility.cs new file mode 100644 index 0000000..343fd87 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISkillSimulationUtility.cs @@ -0,0 +1,495 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AISkillSimulationUtility +{ + public static void GiveSkillToAll(List targets, AIVirtualField field, AIScriptTokenArgType skillType) + { + for (int i = 0; i < targets.Count; i++) + { + GiveSkill(targets[i], field, skillType); + } + } + + private static void GiveSkillToTarget(AISituationInfo situation, List candidates, AIVirtualField field, AIScriptTokenArgType skillType, AIScriptTokenArgType whichTarget) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("GiveSkillToTarget error!! No target!!!!!"); + return; + } + List targets = situationTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (candidates.Contains(aIVirtualCard)) + { + GiveSkill(aIVirtualCard, field, skillType); + } + } + } + + public static void GiveSkillRandom(List candidates, int selectCount, AIVirtualField field, AIScriptTokenArgType skillType) + { + if (selectCount > 1) + { + AIConsoleUtility.LogError("GiveSkillRandom(): ่ค‡ๆ•ฐ้ธๆŠžใฎใ‚ญใƒผใƒฏใƒผใƒ‰่ƒฝๅŠ›ไป˜ไธŽใฏๆœชๅฎŸ่ฃ…ใงใ™"); + return; + } + AIVirtualCard aIVirtualCard = AIBasicTargetSelectUtility.SelectSingleBasicSkillTarget(candidates, skillType, AISelectTargetPattern.Worst); + if (aIVirtualCard != null) + { + GiveSkill(aIVirtualCard, field, skillType); + } + } + + public static void ExecuteTargetSelectGiveSkill(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AIScriptTokenArgType skillType, AIScriptTokenArgType selectType, int selectCount = 1) + { + if (situation == null) + { + AIConsoleUtility.LogError("ExecuteTargetSelectGiveSkill() Error!! situation is null!!!!!"); + } + else if (situation.IsTargetExists(selectType)) + { + GiveSkillToTarget(situation, candidates, field, skillType, selectType); + } + else + { + GiveSkillToTargetPrediction(candidates, selectCount, field, situation, skillType, selectType); + } + } + + private static void GiveSkillToTargetPrediction(List candidates, int selectCount, AIVirtualField field, AISituationInfo situation, AIScriptTokenArgType skillType, AIScriptTokenArgType whichTarget) + { + if (selectCount > 1) + { + AIConsoleUtility.LogError("GiveSkillToTargetPrediction(): ่ค‡ๆ•ฐ้ธๆŠžใฎใ‚ญใƒผใƒฏใƒผใƒ‰่ƒฝๅŠ›ไป˜ไธŽใฏๆœชๅฎŸ่ฃ…ใงใ™"); + return; + } + AIVirtualCard aIVirtualCard = AIBasicTargetSelectUtility.SelectSingleBasicSkillTarget(candidates, skillType, AISelectTargetPattern.Best); + if (aIVirtualCard != null) + { + situation.SetSingleTargetInInfo(aIVirtualCard, TargetSelectType.Default, whichTarget); + GiveSkill(aIVirtualCard, field, skillType); + } + } + + public static void GiveSkill(AIVirtualCard target, AIVirtualField field, AIScriptTokenArgType skill) + { + switch (skill) + { + case AIScriptTokenArgType.KILLER: + target.IsKiller = true; + break; + case AIScriptTokenArgType.MEDUSA: + target.IsDestroyWhenAttack = true; + break; + case AIScriptTokenArgType.DRAIN: + target.IsDrain = true; + break; + case AIScriptTokenArgType.GUARD: + target.IsGuard = true; + break; + case AIScriptTokenArgType.QUICK: + AttachQuick(target, field); + break; + case AIScriptTokenArgType.RUSH: + AttachRush(target, field); + break; + case AIScriptTokenArgType.SNEAK: + target.IsSneak = true; + break; + case AIScriptTokenArgType.UNTOUCHABLE: + target.AddUntouchableCount(); + break; + case AIScriptTokenArgType.FORCE_TARGETING: + target.IsForceTargeting = true; + break; + case AIScriptTokenArgType.UNBANISHABLE: + target.IsUnbanishable = true; + break; + case AIScriptTokenArgType.IGNORE_GUARD: + target.IsIgnoreGuard = true; + break; + default: + AIConsoleUtility.LogError("ivnalid skill : tag_ClashSkill"); + break; + } + } + + public static void RemoveKeywordSkillToAll(List targets, AIScriptTokenArgType skillType) + { + for (int i = 0; i < targets.Count; i++) + { + RemoveKeywordSkill(targets[i], skillType); + } + } + + public static void RemoveKeywordSkill(AIVirtualCard target, AIScriptTokenArgType skill) + { + switch (skill) + { + case AIScriptTokenArgType.GUARD: + target.IsGuard = false; + break; + case AIScriptTokenArgType.UNTOUCHABLE: + target.SubUntouchableCount(); + break; + default: + AIConsoleUtility.LogError($"AISkillSimulationUtility.RemoveKeywordSkill(): Invalid skill type. type:{skill}"); + break; + } + } + + public static bool HasSkill(AIVirtualCard target, AIScriptTokenArgType skill, EnemyAI ai, List playPtn, bool isNot = false) + { + if (!target.IsInHand) + { + return target.IsHoldKeywordSkill(skill); + } + int num = ai.CurrentVirtualField.AllyHandCards.FindIndex((AIVirtualCard c) => c.IsSameCard(target)); + if (num < 0) + { + return false; + } + if (target.TagCollectionContainer.HasTag(AIPlayTagType.GiveSkill) && target.TagCollectionContainer.GiveSkillTags.ExecuteSkill(target, playPtn, skill)) + { + return true; + } + AIHandPlayEstimator handPlayEstimator = ai.CurrentVirtualField.AllyHandCards[num].GetHandPlayEstimator(); + if (handPlayEstimator == null || handPlayEstimator.InplayEstimations == null || handPlayEstimator.InplayEstimations.Count <= 0) + { + return false; + } + for (int num2 = 0; num2 < handPlayEstimator.InplayEstimations.Count; num2++) + { + if (HasSkill(handPlayEstimator.InplayEstimations[num2], skill, ai, EnemyAI.EmptyPlayPtn, isNot)) + { + return true; + } + } + return false; + } + + public static bool IsFollowerOnlySkillType(AIScriptTokenArgType skillType) + { + if (skillType != AIScriptTokenArgType.QUICK && skillType != AIScriptTokenArgType.RUSH && skillType != AIScriptTokenArgType.GUARD && skillType != AIScriptTokenArgType.DRAIN && skillType != AIScriptTokenArgType.KILLER && skillType != AIScriptTokenArgType.SNEAK) + { + return skillType == AIScriptTokenArgType.IGNORE_GUARD; + } + return true; + } + + public static void HealAll(List targets, AIVirtualField field, int heal, List playPtn, AISituationInfo situation) + { + List list = new List(); + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (aIVirtualCard.IsOnField && !aIVirtualCard.IsAmulet && !aIVirtualCard.IsCountdownAmulet && !aIVirtualCard.IsIndependent) + { + int healLife = AIHealSimulationUtility.CalcHealModifier(aIVirtualCard, playPtn, situation, heal); + aIVirtualCard.Heal(healLife); + list.Add(aIVirtualCard); + } + } + if (list.Count > 0) + { + HealActivation(list, field, playPtn, situation); + } + } + + public static void HealSingle(AIVirtualCard target, AIVirtualField field, int heal, List playPtn, AISituationInfo situation) + { + if (target.IsOnField && !target.IsAmulet && !target.IsCountdownAmulet && !target.IsIndependent) + { + int healLife = AIHealSimulationUtility.CalcHealModifier(target, playPtn, situation, heal); + target.Heal(healLife); + HealActivation(new List { target }, field, playPtn, situation); + } + } + + public static void HealTarget(AISituationInfo situation, AIVirtualField field, AIScriptTokenArgType whichTarget, int heal) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget != null && situationTarget.HasTarget) + { + List targets = situationTarget.Targets; + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + HealAll(targets, field, heal, emptyPlayPtn, situation); + } + } + + public static void HealTargetPrediction(AISituationInfo situation, List candidates, AIVirtualCard healOwner, AIVirtualField field, List playPtn, AIScriptTokenArgType whichTarget, int heal) + { + AIVirtualCard target = AIHealSimulationUtility.SelectBestTarget(AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(candidates, healOwner, playPtn), heal); + situation.SetSingleTargetInInfo(target, TargetSelectType.Default, whichTarget); + HealTarget(situation, field, whichTarget, heal); + } + + private static void HealActivation(List healedTargets, AIVirtualField field, List playptn, AISituationInfo situation) + { + List tagHolders = field.CardListSet.GetTagHolders(CardListsForReference.TagHolderReferenceType.WhenHeal); + if (tagHolders == null || tagHolders.Count <= 0) + { + return; + } + for (int i = 0; i < healedTargets.Count; i++) + { + AIVirtualCard healedCard = healedTargets[i]; + for (int j = 0; j < tagHolders.Count; j++) + { + AIVirtualCard aIVirtualCard = tagHolders[j]; + if (!aIVirtualCard.IsDead && aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenHeal)) + { + aIVirtualCard.TagCollectionContainer.HealTags.RegisterPassedConditionTags(aIVirtualCard, healedCard, playptn, situation); + } + } + } + field.AllActivateCountHolderIncrement(situation, AIPlayTagType.HealActivateCount, healedTargets); + } + + public static void DestroyAll(List targets, AIVirtualField field, AISituationInfo situation) + { + for (int i = 0; i < targets.Count; i++) + { + if (!targets[i].IsDead && !targets[i].IsIndependent) + { + targets[i].RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: true); + } + } + } + + public static void DestroyOldest(List targets, AIVirtualField field, AISituationInfo situation, int selectCount = 1) + { + List targets2 = ((targets.Count > selectCount) ? targets.GetRange(0, selectCount) : targets); + DestroyAll(targets2, field, situation); + } + + public static void DestroyRandom(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, int selectCount = 1) + { + if (selectCount <= 1) + { + AIVirtualCard aIVirtualCard = AISimulationRemovalUtility.SelectRemovalTarget(targets, tagOwner, field, playPtn, situation, AISelectTargetPattern.Worst, AIRemovalType.Destroy); + if (aIVirtualCard != null && !aIVirtualCard.IsDead && !aIVirtualCard.IsIndependent) + { + aIVirtualCard.RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: true); + } + } + else + { + DestroyAll(AISimulationRemovalUtility.SelectMultipleRemovalTargets(targets, tagOwner, field, playPtn, situation, AISelectTargetPattern.Worst, AIRemovalType.Destroy, selectCount), field, situation); + } + } + + public static void DestroyTarget(AISituationInfo situation, List candidates, AIScriptTokenArgType whichTarget) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("DestroyTarget error!! No target!!!!!"); + return; + } + List targets = situationTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (candidates.Contains(aIVirtualCard) && !aIVirtualCard.IsIndependent) + { + aIVirtualCard.RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: true); + } + } + } + + public static void ExecuteTargetSelectDiscard(List candidates, int discardCount, AIScriptTokenArgType selectType, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (tagOwner.IsAlly) + { + if (situation == null) + { + AIConsoleUtility.LogError("ExecuteTargetSelectDiscard() Error!! situation is null!!!!!"); + } + else if (situation.IsTargetExists(selectType)) + { + DiscardTarget(tagOwner, selectType, field, situation); + } + else + { + DiscardTargetPrediction(candidates, discardCount, tagOwner, field, playPtn, situation); + } + } + } + + private static void DiscardTarget(AIVirtualCard ownerCard, AIScriptTokenArgType selectType, AIVirtualField field, AISituationInfo situation) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(selectType); + if (situationTarget != null && situationTarget.HasTarget) + { + ExecuteDiscard(ownerCard, situationTarget.Targets, field, situation); + } + } + + private static void DiscardTargetPrediction(List candidates, int discardCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List list = AIDiscardUtility.SelectBestDiscardTarget(tagOwner, field, candidates, discardCount, tagOwner.SelfField.BestPlayPtn, situation); + if (list != null && list.Count > 0) + { + ExecuteDiscard(tagOwner, list, field, situation); + } + } + + public static void DiscardRandom(AIVirtualCard ownerCard, AIVirtualField field, List discardCandidates, int discardCount, AISituationInfo situation) + { + if (ownerCard.IsAlly) + { + List discardTargets = AIDiscardUtility.SelectWorstDiscardTarget(ownerCard, field, discardCandidates, discardCount, field.BestPlayPtn, situation); + ExecuteDiscard(ownerCard, discardTargets, field, situation); + } + } + + public static void DiscardAll(AIVirtualCard ownerCard, List discardCandidates, AIVirtualField field, AISituationInfo situation) + { + if (ownerCard.IsAlly) + { + ExecuteDiscard(ownerCard, discardCandidates, field, situation); + } + } + + public static void ExecuteDiscard(AIVirtualCard ownerCard, List discardTargets, AIVirtualField field, AISituationInfo situation) + { + if (discardTargets == null || discardTargets.Count <= 0 || field.AllyHandCards.Count <= 0) + { + return; + } + for (int i = 0; i < discardTargets.Count; i++) + { + AIVirtualCard hand = discardTargets[i]; + field.RemoveAllyHandCard(hand); + } + AIDiscardInfo discardInfo = new AIDiscardInfo(ownerCard, isSuccess: true, discardTargets); + situation.SetDiscardInfo(discardInfo); + for (int j = 0; j < discardTargets.Count; j++) + { + AIVirtualCard aIVirtualCard = discardTargets[j]; + field.SimulationExtraBonus += AIDiscardUtility.EvaluateDiscardedBonus(aIVirtualCard, field.BestPlayPtn, situation, field, isIgnoreInBattle: true, isCalcCostDiff: false, isCalcTokenValue: false); + if (aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenDiscarded)) + { + aIVirtualCard.TagCollectionContainer.DiscardedTags.RegisterPassedConditionTags(aIVirtualCard, field.BestPlayPtn, situation); + } + } + if (field.CardListSet.HasAfterDiscardTagHolder) + { + for (int k = 0; k < field.CardListSet.AfterDiscardTagHolders.Count; k++) + { + field.CardListSet.AfterDiscardTagHolders[k].TagCollectionContainer.AfterDiscardTags.RegisterPassedConditionTags(ownerCard, field.BestPlayPtn, situation); + } + } + } + + private static void AttachRush(AIVirtualCard card, AIVirtualField field) + { + if (!card.IsRush && !card.IsQuick) + { + card.IsRush = true; + card.IsSummonDrunkenness = false; + } + } + + private static void AttachQuick(AIVirtualCard card, AIVirtualField field) + { + if (!card.IsQuick) + { + card.IsQuick = true; + card.IsSummonDrunkenness = false; + } + } + + public static void SetStatusAll(List targets, int attack, int life, AISituationInfo situation) + { + if (attack < 0 || life < 0) + { + return; + } + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (aIVirtualCard.IsUnit) + { + aIVirtualCard.SetNewStatus(situation, attack, life); + } + } + } + + public static void SetStatusTarget(List candidates, AIScriptTokenArgType whichTarget, int attack, int life, AISituationInfo situation) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("SetStatusTarget error!! No target!!!!!"); + return; + } + List targets = situationTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (candidates.Contains(aIVirtualCard)) + { + SetStatusSingle(aIVirtualCard, attack, life, situation); + } + } + } + + public static void SetStatusSingle(AIVirtualCard target, int attack, int life, AISituationInfo situation) + { + if (attack >= 0 && life >= 0 && target.IsUnit) + { + target.SetNewStatus(situation, attack, life); + } + } + + public static void ModifierNotConsumeEpALL(List targets) + { + if (targets == null || targets.Count <= 0) + { + AIConsoleUtility.LogError("ModifierNotConsumeEpALL() : Target List is Missing Error !!"); + return; + } + for (int i = 0; i < targets.Count; i++) + { + ModifierNotConsumeEpSingle(targets[i]); + } + } + + public static void ModifierNotConsumeEpTargets(List candidate, AIScriptTokenArgType selectType, AISituationInfo situation) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(selectType); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("ModifierNotConsumeEpTargets() : Selected Target is Missing Error !!"); + return; + } + List targets = situationTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (candidate.Contains(aIVirtualCard)) + { + ModifierNotConsumeEpSingle(aIVirtualCard); + } + } + } + + public static void ModifierNotConsumeEpSingle(AIVirtualCard card) + { + if (card == null) + { + AIConsoleUtility.LogError("ModifierNotConsumeEpSingle() : Target card is Missing Error !!"); + } + else if (card.IsUnit && !card.IsDead) + { + card.IsNotConsumeEp = true; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIStack.cs b/SVSim.BattleEngine/Engine/Wizard/AIStack.cs new file mode 100644 index 0000000..7bc2677 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIStack.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIStack : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression _defaultStackValue; + + private const int STACK_VALUE_ARG_INDEX = 0; + + public AIStack(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList == null || _exprList.Count <= 0) + { + AIConsoleUtility.LogError("AIStack error!! exprList is null or Count == 0"); + } + else + { + _defaultStackValue = _exprList[0]; + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + int stackValue = GetStackValue(tagOwner, field, playPtn, situation); + AIWhiteRitualSimulationUtility.SimulateStack(tagOwner, field, situation, stackValue); + } + + private int GetStackValue(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_defaultStackValue == null) + { + return 0; + } + return (int)_defaultStackValue.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIStackCountUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIStackCountUtility.cs new file mode 100644 index 0000000..326dbdd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIStackCountUtility.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIStackCountUtility +{ + public static int GetStackCount(AIVirtualField field, bool isAlly) + { + List list = (isAlly ? field.AllyInplayCards : field.EnemyInplayCards); + int num = 0; + for (int i = 0; i < list.Count; i++) + { + if (!list[i].IsDead) + { + num += list[i].WhiteRitualCount; + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISummonAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AISummonAttachTag.cs new file mode 100644 index 0000000..84ae9dd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISummonAttachTag.cs @@ -0,0 +1,83 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AISummonAttachTag : AIFiltersArgument +{ + private const int TIMING_OFFSET = 1; + + private const int SELECT_TYPE_OFFSET = 2; + + private readonly AIScriptTokenArgType[] _legalSelectTypeArgs = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.FIRST_SELECT + }; + + public AIPlayTag AttachedTag { get; private set; } + + public AIScriptTokenArgType RemoveTiming { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AIScriptTokenArgType SelectTypeArg { get; private set; } + + public AISummonAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + RemoveTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + SelectTypeArg = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], _legalSelectTypeArgs); + if (SelectTypeArg != AIScriptTokenArgType.ALL_SELECT && SelectTypeArg != AIScriptTokenArgType.FIRST_SELECT) + { + AIConsoleUtility.LogError("AISummonAttachTag SelectType Error!! ALL_SELECT or FIRST_SELECT =" + SelectTypeArg); + } + if (list.Count <= AIPlayTag.TAG_WORDS_LENTGH) + { + AttachedTag = null; + } + else + { + AttachedTag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (SelectTypeArg) + { + case AIScriptTokenArgType.FIRST_SELECT: + AIAttachTagSimulationUtility.SimulateAttachTagToSingle(targetsFromField[0], tagOwner, AttachedTag, RemoveTiming, situation); + break; + case AIScriptTokenArgType.ALL_SELECT: + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targetsFromField, tagOwner, AttachedTag, RemoveTiming, situation); + break; + default: + AIConsoleUtility.LogError(string.Format("AISummonAttachTag : ILlegal SelectType ({0}) owner ({1})", SelectTypeArg, (tagOwner != null) ? tagOwner.CardName : "")); + break; + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (AttachedTag != null) + { + return AttachedTag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISummonBanAttack.cs b/SVSim.BattleEngine/Engine/Wizard/AISummonBanAttack.cs new file mode 100644 index 0000000..a34df7e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISummonBanAttack.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using Wizard.Battle.UI; + +namespace Wizard; + +public class AISummonBanAttack : AIFiltersAndSelectTypeArgument +{ + private CantAttackType _banAttackType; + + private readonly int BAN_ATTACK_TYPE_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AISummonBanAttack(string text) + : base(text) + { + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _banAttackType = AIPlayTagInitializingUtility.CreateBanAttackType(_exprList[_exprList.Count - BAN_ATTACK_TYPE_ARG_OFFSET]); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBanAttackSimulationUtility.BanAttackAll(targetsFromField, _banAttackType); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISummonBanish.cs b/SVSim.BattleEngine/Engine/Wizard/AISummonBanish.cs new file mode 100644 index 0000000..cabe56b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISummonBanish.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AISummonBanish : AIFiltersAndSelectTypeArgument +{ + private const int SELECT_TYPE_ARG_OFFSET = 1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AISummonBanish(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIScriptTokenArgType selectType = AIScriptTokenArgType.NONE; + AIPolishConvertedExpression arg = _exprList[_exprList.Count - 1]; + if (IsLegalSelectType(arg, out selectType)) + { + base.SelectType = selectType; + } + else + { + AIConsoleUtility.LogError($"AISummonBanish error!!! SelectType is {selectType}"); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBanishSimulationUtility.BanishAll(targetsFromField, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIBanishSimulationUtility.BanishRandom(targetsFromField, tagOwner, field, playPtn, situation); + break; + default: + AIConsoleUtility.LogError($"AISummonBanish error!!! SelectType is {base.SelectType}"); + break; + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISummonBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AISummonBuff.cs new file mode 100644 index 0000000..cdb81a3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISummonBuff.cs @@ -0,0 +1,89 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AISummonBuff : AIFiltersArgument +{ + private const int SELECT_TYPE_OFFSET = 4; + + private const int ATK_BUFF_OFFSET = 3; + + private const int LIFE_BUFF_OFFSET = 2; + + private const int PERM_OR_TEMP_OFFSET = 1; + + private readonly AIScriptTokenArgType[] _legalSelectTypeArgs = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.FIRST_SELECT + }; + + public AIPolishConvertedExpression AtkBuff { get; private set; } + + public AIPolishConvertedExpression LifeBuff { get; private set; } + + public bool IsTemp { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 4; + + public AIScriptTokenArgType SelectTypeArg { get; private set; } + + public AISummonBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AtkBuff = _exprList[_exprList.Count - 3]; + LifeBuff = _exprList[_exprList.Count - 2]; + AIScriptTokenArgType argumentType = ((AIScriptArgumentToken)_exprList[_exprList.Count - 1].TokenList[0]).ArgumentType; + if (argumentType != AIScriptTokenArgType.PERM) + { + _ = 138; + } + IsTemp = argumentType == AIScriptTokenArgType.TEMP; + SelectTypeArg = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 4], _legalSelectTypeArgs); + if (SelectTypeArg != AIScriptTokenArgType.ALL_SELECT && SelectTypeArg != AIScriptTokenArgType.FIRST_SELECT) + { + AIConsoleUtility.LogError("AISummonBuff SelectType Error!! ALL_SELECT or FIRST_SELECT =" + SelectTypeArg); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (situation == null || situation.Actor == null) + { + return; + } + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, AtkBuff, LifeBuff); + switch (SelectTypeArg) + { + case AIScriptTokenArgType.FIRST_SELECT: + AIBuffSimulationUtility.BuffFirst_old(targetsFromField, field, buffExecutingInfo_old, IsTemp, playPtn, situation); + break; + case AIScriptTokenArgType.ALL_SELECT: + AIBuffSimulationUtility.BuffAll_old(targetsFromField, field, buffExecutingInfo_old, IsTemp, playPtn, situation); + break; + default: + AIConsoleUtility.LogError(string.Format("AISummonBuff : ILlegal SelectType ({0}) owner ({1})", SelectTypeArg, (tagOwner != null) ? tagOwner.CardName : "")); + break; + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool isAttackEffective = !AtkBuff.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISummonDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AISummonDamage.cs new file mode 100644 index 0000000..eed21d0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISummonDamage.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AISummonDamage : AIFiltersArgument +{ + private const int DAMAGE_OFFSET = 1; + + private const int SELECT_TYPE_OFFSET = 2; + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIPolishConvertedExpression Damage { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AISummonDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIPolishConvertedExpression arg = _exprList[_exprList.Count - 2]; + AIScriptTokenArgType selectType = AIScriptTokenArgType.NONE; + if (!IsLegalSelectType(arg, out selectType)) + { + SelectType = AIScriptTokenArgType.ALL_SELECT; + } + else + { + SelectType = selectType; + } + Damage = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (situation == null || situation.Actor == null) + { + return; + } + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int damage = (int)Damage.EvalArg(tagOwner, playPtn, field, situation); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, damage, situation); + } + else if (SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, damage, situation); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISummonDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AISummonDestroy.cs new file mode 100644 index 0000000..902a75d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISummonDestroy.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AISummonDestroy : AIFiltersArgument +{ + private AIPolishConvertedExpression _destroyCount; + + private const int DESTROY_COUNT_ARG_OFFSET = 1; + + public AIScriptTokenArgType SelectType { get; private set; } + + protected int SELECT_TYPE_OFFSET => 2; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AISummonDestroy(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _destroyCount = _exprList[_exprList.Count - 1]; + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], base.LegalSelectTypes); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + int num = (int)_destroyCount.EvalArg(tagOwner, playPtn, field, situation); + if (num > 0) + { + switch (SelectType) + { + case AIScriptTokenArgType.RANDOM_SELECT: + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + AISkillSimulationUtility.DestroyRandom(targetsFromField, tagOwner, field, playPtn, situation, num); + break; + case AIScriptTokenArgType.OLDEST_SELECT: + AISkillSimulationUtility.DestroyOldest(targetsFromField, field, situation, num); + break; + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.RANDOM_MULTI_SELECT, + AIScriptTokenArgType.OLDEST_SELECT + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISummonEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AISummonEvo.cs new file mode 100644 index 0000000..c5a62c8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISummonEvo.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AISummonEvo : AIFiltersArgument +{ + public AISummonEvo(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (situation != null && situation.Actor != null) + { + List targets = new List { tagOwner }; + AIAutoEvolutionSimulationUtility.AutoEvolution(field, targets, playPtn, situation, AIScriptTokenArgType.ALL_SELECT); + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.AllyInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISummonHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AISummonHeal.cs new file mode 100644 index 0000000..d0441cc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISummonHeal.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AISummonHeal : AIFiltersArgument +{ + private const int SELECT_TYPE_OFFSET = 2; + + private const int HEAL_ARG_OFFSET = 1; + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIPolishConvertedExpression Heal { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 2; + + public AISummonHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2]); + Heal = _exprList[_exprList.Count - 1]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int heal = (int)Heal.EvalArg(tagOwner, playPtn, field); + if (SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targetsFromField, field, heal, playPtn, situation); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISummonKeywordSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AISummonKeywordSkill.cs new file mode 100644 index 0000000..ddee98c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISummonKeywordSkill.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AISummonKeywordSkill : AIFiltersArgument +{ + private readonly AIScriptTokenArgType _skillType; + + public AIScriptTokenArgType SelectType { get; protected set; } + + protected virtual int SELECT_TYPE_OFFSET => 1; + + protected override int NON_FILTER_FIRST_OFFSET => SELECT_TYPE_OFFSET; + + public AISummonKeywordSkill(string text, AIScriptTokenArgType skill) + : base(text) + { + _skillType = skill; + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SELECT_TYPE_OFFSET], base.LegalSelectTypes); + if (!IsImplementedSelecvtType(SelectType)) + { + SelectType = AIScriptTokenArgType.ALL_SELECT; + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.GiveSkillToAll(targetsFromField, field, _skillType); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + break; + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + private bool IsImplementedSelecvtType(AIScriptTokenArgType type) + { + return type == AIScriptTokenArgType.ALL_SELECT; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + if (AISkillSimulationUtility.IsFollowerOnlySkillType(_skillType)) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + return base.GetFilteredTargets(candidates, tagOwner, playPtn, situation, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISummonTokenUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AISummonTokenUtility.cs new file mode 100644 index 0000000..d18a677 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISummonTokenUtility.cs @@ -0,0 +1,520 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public static class AISummonTokenUtility +{ + private const int INPLAY_MAX_NUM = 5; + + public static void SummonAllTokenToField(this AITokenIdCollection tokenIdCollection, AIVirtualField field, AIVirtualCard owner, AISituationInfo situation, List condList = null) + { + if (tokenIdCollection == null) + { + AIConsoleUtility.LogError("AISummonTokenUtility.SummonAllTokenToField() error!! tokenIdCollection is null"); + return; + } + if (tokenIdCollection.HasAllyToken) + { + SummonTokenOnVirtualField(tokenIdCollection.AllyTokenIdList, owner, field, situation, isTokenAlly: true, isSkillSummon: true, condList); + } + if (tokenIdCollection.HasOpponentToken) + { + SummonTokenOnVirtualField(tokenIdCollection.OpponentTokenIdList, owner, field, situation, isTokenAlly: false, isSkillSummon: true, condList); + } + } + + private static void SummonTokenOnVirtualField(List tokenIdList, AIVirtualCard tokenOwner, AIVirtualField field, AISituationInfo situation, bool isTokenAlly, bool isSkillSummon, List condList = null) + { + if (situation == null) + { + return; + } + EnemyAI aI = field.AI; + List bestPlayPtn = field.BestPlayPtn; + List list = null; + for (int i = 0; i < tokenIdList.Count; i++) + { + int tokenId = tokenIdList[i].TokenId; + AITokenType tokenType = tokenIdList[i].TokenType; + AIVirtualCard tokenCard = GetTokenCard(aI, tokenOwner, field, tokenId, isTokenAlly, condList); + if (tokenCard == null) + { + continue; + } + bool flag = false; + if (isTokenAlly) + { + if (field.AllyInplayCards.Count((AIVirtualCard card) => !card.IsDead) < 5) + { + tokenCard.InitAtSummonToken(tokenOwner, situation, isSkillSummon); + if (tokenType == AITokenType.Reanimate) + { + tokenCard.Reanimate(situation); + } + field.AllyInplayCards.Add(tokenCard); + field.CardListSet.AddAllyInplayCard(tokenCard); + field.SummonedCardContainer.AddSummonedCard(tokenCard); + flag = true; + } + } + else if (field.EnemyInplayCards.Count((AIVirtualCard card) => !card.IsDead) < 5) + { + tokenCard.InitAtSummonToken(tokenOwner, situation, isSkillSummon); + field.EnemyInplayCards.Add(tokenCard); + field.CardListSet.AddEnemyInplayCard(tokenCard); + field.SummonedCardContainer.AddSummonedCard(tokenCard); + field.EnemyTokenQueue.Enqueue(new Tuple(tokenOwner, tokenCard)); + flag = true; + } + if (flag) + { + list = AIParamQuery.AddElementToList(tokenCard, list); + ExecuteSummonTags(field, tokenCard, bestPlayPtn, situation); + AIGetOnSimulationUtility.GetOnAtField(field, tokenCard, situation); + AIRallySimulationUtility.ExecuteAppendRallyCount(field, tokenCard); + field.AllActivateCountHolderIncrement(situation, AIPlayTagType.SummonActivateCount, tokenCard); + } + } + if (list != null && list.Count > 0) + { + situation.RegisterOwnSummonedCardList(list); + field.ExecuteWhenChangeInplayTags(bestPlayPtn, situation); + } + } + + public static void ExecuteSummonCardAll(AIVirtualCard tagOwner, AIVirtualField field, List candidates, AISituationInfo situation) + { + EnemyAI aI = field.AI; + List list = null; + for (int i = 0; i < candidates.Count; i++) + { + bool isUpdateTokenIndex = false; + AIVirtualCard aIVirtualCard = candidates[i]; + bool isInHand = aIVirtualCard.IsInHand; + bool isAlly = aIVirtualCard.IsAlly; + AIVirtualCard aIVirtualCard2 = aIVirtualCard; + if (!isAlly) + { + aIVirtualCard2 = new AIVirtualCard(aIVirtualCard.BaseCard, field); + } + if (aI.IsPlagueCityTagged && aIVirtualCard2.IsUnit) + { + aIVirtualCard2 = aI.tokenManager.GetZombieToken(tagOwner.IsAlly, field, needsClone: true); + isUpdateTokenIndex = true; + } + aIVirtualCard2.InitAtSummonToken(tagOwner, situation, isSkillSummon: true, isUpdateTokenIndex); + if (isAlly) + { + if (isInHand) + { + field.RemoveAllyHandCard(aIVirtualCard); + } + field.AllyInplayCards.Add(aIVirtualCard2); + field.CardListSet.AddAllyInplayCard(aIVirtualCard2); + } + else + { + if (isInHand) + { + field.RemoveEnemyHandCard(aIVirtualCard); + } + field.EnemyInplayCards.Add(aIVirtualCard2); + field.CardListSet.AddEnemyInplayCard(aIVirtualCard2); + } + field.SummonedCardContainer.AddSummonedCard(aIVirtualCard2); + list = AIParamQuery.AddElementToList(aIVirtualCard2, list); + ExecuteSummonTags(field, aIVirtualCard2, field.BestPlayPtn, situation); + AIGetOnSimulationUtility.GetOnAtField(field, aIVirtualCard2, situation); + AIRallySimulationUtility.ExecuteAppendRallyCount(field, aIVirtualCard2); + field.AllActivateCountHolderIncrement(situation, AIPlayTagType.SummonActivateCount, aIVirtualCard2); + } + situation.RegisterOwnSummonedCardList(list); + } + + public static void ExecuteTargetSelectSummonToken(AIVirtualCard tagOwner, AIVirtualField field, AIScriptTokenArgType whichTarget, AISituationInfo situation) + { + if (field.AllyInplayCards.Count < 5) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("ExecuteTargetSelectSummonToken() error!! targetInfo is null"); + } + else + { + ExecuteSummonCardAll(tagOwner, field, situationTarget.Targets, situation); + } + } + } + + public static void ExecuteSummonTags(AIVirtualField field, AIVirtualCard summonCard, List playPtn, AISituationInfo situation) + { + if (summonCard.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenSummon)) + { + summonCard.TagCollectionContainer.SummonTags.RegisterConditionPassedTag(summonCard, summonCard, playPtn, situation); + } + List otherSummonTagHolders = field.CardListSet.OtherSummonTagHolders; + if (otherSummonTagHolders == null) + { + return; + } + for (int i = 0; i < otherSummonTagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = otherSummonTagHolders[i]; + if (!aIVirtualCard.IsSameCard(summonCard)) + { + aIVirtualCard.TagCollectionContainer.OtherSummonTags.RegisterConditionPassedTag(aIVirtualCard, summonCard, playPtn, situation); + } + } + } + + public static void ExecuteSummonToken(List tokenIdholderCandidates, List filters, AIPolishConvertedExpression tokenCount, AIScriptTokenArgType tokenSide, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int num = (int)tokenCount.EvalArg(tagOwner, playPtn, field); + if (num > 0) + { + AITokenIdCollection bothSideTokenIdListFromFilter = GetBothSideTokenIdListFromFilter(tagOwner, field, tokenIdholderCandidates, filters, AITokenType.Default, tokenSide, AIScriptTokenArgType.ALL_SELECT, num, playPtn, situation); + if (bothSideTokenIdListFromFilter != null && bothSideTokenIdListFromFilter.HasToken) + { + bothSideTokenIdListFromFilter.SummonAllTokenToField(field, tagOwner, situation); + } + } + } + + public static void ExecuteDrawToken(List idHolderCandidates, List filters, AIPolishConvertedExpression tokenCount, AIScriptTokenArgType tokenSide, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int num = (int)tokenCount.EvalArg(tagOwner, playPtn, field); + if (num > 0) + { + AITokenIdCollection bothSideTokenIdListFromFilter = GetBothSideTokenIdListFromFilter(tagOwner, field, idHolderCandidates, filters, AITokenType.NONE, tokenSide, AIScriptTokenArgType.ALL_SELECT, num, playPtn, situation); + if (bothSideTokenIdListFromFilter != null && bothSideTokenIdListFromFilter.HasToken) + { + bothSideTokenIdListFromFilter.DrawAllTokenToField(field, tagOwner, situation); + } + } + } + + public static List GetOwnerSideTokenIds(List idHolderCandidates, List filters, AIPolishConvertedExpression tokenCount, AITokenType tokenType, AIScriptTokenArgType tagSideType, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int num = (int)tokenCount.EvalArg(tagOwner, playPtn, field); + if (num <= 0) + { + return null; + } + AITokenIdCollection bothSideTokenIdListFromFilter = GetBothSideTokenIdListFromFilter(tagOwner, field, idHolderCandidates, filters, tokenType, tagSideType, AIScriptTokenArgType.ALL_SELECT, num, playPtn, situation); + if (bothSideTokenIdListFromFilter != null) + { + if (tagOwner.IsAlly) + { + return bothSideTokenIdListFromFilter.AllyTokenIdList; + } + return bothSideTokenIdListFromFilter.OpponentTokenIdList; + } + return null; + } + + public static AITokenIdCollection CreateTokenIdCollectionForReanimate(AIVirtualCard owner, int tokenId, bool tokenIsAlly) + { + AITokenIdCollection aITokenIdCollection = new AITokenIdCollection(); + aITokenIdCollection.Add(tokenId, AITokenType.Reanimate, tokenIsAlly); + return aITokenIdCollection; + } + + public static AITokenIdCollection CreateTokenIdCollection(AIVirtualCard owner, List tokenIdList, bool tokenIsAlly, AITokenType tokenType) + { + AITokenIdCollection aITokenIdCollection = new AITokenIdCollection(); + for (int i = 0; i < tokenIdList.Count; i++) + { + aITokenIdCollection.Add(tokenIdList[i], tokenType, tokenIsAlly); + } + return aITokenIdCollection; + } + + public static AITokenIdCollection CreateTokenIdCollectionFromIdList(AIVirtualCard owner, AIScriptTokenArgType tokenSide, List idList, AITokenType tokenType) + { + if (idList == null || idList.Count <= 0) + { + return null; + } + AITokenIdCollection aITokenIdCollection = new AITokenIdCollection(); + for (int i = 0; i < idList.Count; i++) + { + RegisterTokenIdToCollection(aITokenIdCollection, idList[i], tokenType, tokenSide, owner); + } + return aITokenIdCollection; + } + + public static AITokenIdCollection GetBothSideTokenIdListFromFilter(AIVirtualCard owner, AIVirtualField field, List candidateRange, List filters, AITokenType tokenType, AIScriptTokenArgType tagSideType, AIScriptTokenArgType selectType, int repeatCount, List playPtn, AISituationInfo situation) + { + if (selectType == AIScriptTokenArgType.RANDOM_SELECT || selectType == AIScriptTokenArgType.RANDOM_MULTI_SELECT) + { + return null; + } + AITokenIdCollection aITokenIdCollection = new AITokenIdCollection(); + List list = null; + AIScriptTokenArgType aIScriptTokenArgType = AIScriptTokenArgType.NONE; + for (int i = 0; i < filters.Count; i++) + { + AIScriptTokenBase aIScriptTokenBase = filters[i]; + if (aIScriptTokenBase is AIScriptIDToken aIScriptIDToken) + { + RegisterTokenIdToCollection(aITokenIdCollection, aIScriptIDToken.ID, tokenType, tagSideType, owner); + } + else if (aIScriptTokenBase is AIScriptArgumentToken aIScriptArgumentToken && IsSelectedTargetArgument(aIScriptArgumentToken.ArgumentType)) + { + aIScriptTokenArgType = aIScriptArgumentToken.ArgumentType; + } + else + { + list = AIParamQuery.AddElementToList(aIScriptTokenBase, list); + } + } + if (situation == null) + { + aITokenIdCollection.MultiplyByRepeatCount(repeatCount); + return aITokenIdCollection; + } + if (list != null && list.Count > 0) + { + List list2 = AIFilteringUtility.MultipleFiltering(candidateRange, list, owner, playPtn, situation, isBlockDeadCard: false); + if (list2 != null && list2.Count > 0) + { + for (int j = 0; j < list2.Count; j++) + { + AIVirtualCard aIVirtualCard = list2[j]; + int baseId = aIVirtualCard.BaseId; + RegisterTokenIdToCollection(aITokenIdCollection, baseId, tokenType, tagSideType, owner, aIVirtualCard, isRegisterToPool: true); + } + } + } + if (aIScriptTokenArgType != AIScriptTokenArgType.NONE) + { + RegisterSelectedTargetFilterTokenIdToCollection(aITokenIdCollection, aIScriptTokenArgType, situation, owner, field, playPtn, tokenType, tagSideType); + } + aITokenIdCollection.MultiplyByRepeatCount(repeatCount); + return aITokenIdCollection; + } + + private static void RegisterSelectedTargetFilterTokenIdToCollection(AITokenIdCollection collection, AIScriptTokenArgType filter, AISituationInfo situation, AIVirtualCard owner, AIVirtualField field, List playPtn, AITokenType tokenType, AIScriptTokenArgType tagSideType) + { + List list = null; + if (filter == AIScriptTokenArgType.REAL_SKILL_TARGET) + { + if (situation.RealTargetInformationList != null && situation.RealTargetInformationList.Count > 0) + { + AIVirtualCardRealTargetInformation aIVirtualCardRealTargetInformation = situation.DequeueRealTargetInfo(owner, field); + if (aIVirtualCardRealTargetInformation != null) + { + list = aIVirtualCardRealTargetInformation.TargetList; + } + } + } + else + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(filter); + if (situationTarget != null && situationTarget.HasTarget) + { + list = situationTarget.Targets; + } + else if ((situation.ActionType == AIOperationType.PLAY || situation.ActionType == AIOperationType.EVOLVE) && situation is AIVirtualTargetSelectAction situation2 && owner.IsSameCard(situation.Actor)) + { + List list2 = owner.CreateAIVirtualSelectInfo(field, situation2); + if (list2 != null && list2.Count > 0) + { + list = GetPrespectedSelectedTargetListForSummonToken(list2, owner, field, playPtn, situation); + } + } + } + if (list != null && list.Count > 0) + { + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + int baseId = aIVirtualCard.BaseId; + RegisterTokenIdToCollection(collection, baseId, tokenType, tagSideType, owner, aIVirtualCard, isRegisterToPool: true); + } + } + } + + private static void RegisterTokenIdToCollection(AITokenIdCollection collection, int id, AITokenType tokenType, AIScriptTokenArgType sideType, AIVirtualCard tagOwner, AIVirtualCard idHolder = null, bool isRegisterToPool = false) + { + bool flag = false; + bool flag2 = false; + switch (sideType) + { + case AIScriptTokenArgType.BOTH: + flag = true; + flag2 = true; + break; + case AIScriptTokenArgType.ALLY: + flag = tagOwner.IsAlly; + flag2 = !tagOwner.IsAlly; + break; + case AIScriptTokenArgType.OPPONENT: + flag = !tagOwner.IsAlly; + flag2 = tagOwner.IsAlly; + break; + case AIScriptTokenArgType.SELECTED_TARGET_SIDE: + if (idHolder == null) + { + AIConsoleUtility.LogError("AISummonTokenUtility.RegisterTokenIdToCollection() error!! idHolder is null!!!!!"); + break; + } + flag = idHolder.IsAlly; + flag2 = !idHolder.IsAlly; + break; + } + if (flag) + { + collection.Add(id, tokenType, isAllyToken: true); + } + if (flag2) + { + collection.Add(id, tokenType, isAllyToken: false); + } + } + + private static List GetPrespectedSelectedTargetListForSummonToken(List selectInfoList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List list = null; + for (int i = 0; i < selectInfoList.Count; i++) + { + AIVirtualTargetSelectInfo aIVirtualTargetSelectInfo = selectInfoList[i]; + switch (aIVirtualTargetSelectInfo.Type) + { + case TargetSelectType.Choice: + { + AISelectedTargetInfo choiceTargets = aIVirtualTargetSelectInfo.GetChoiceTargets(owner, field, playPtn, situation); + if (choiceTargets != null && choiceTargets.HasTarget) + { + for (int k = 0; k < choiceTargets.Targets.Count; k++) + { + list = AIParamQuery.AddElementToList(choiceTargets.Targets[k], list); + } + } + break; + } + case TargetSelectType.Default: + { + List allDefaultTargetPattern = aIVirtualTargetSelectInfo.GetAllDefaultTargetPattern(); + if (aIVirtualTargetSelectInfo.RemovalType != AIRemovalType.Destroy) + { + break; + } + AISelectedTargetInfo aISelectedTargetInfo = ((!situation.IsTargetExists(AIScriptTokenArgType.TARGET_SELECT)) ? GetBestTokenPatternOfDestroySelection(allDefaultTargetPattern, playPtn, situation) : situation.GetSituationTarget(AIScriptTokenArgType.TARGET_SELECT)); + if (aISelectedTargetInfo != null && aISelectedTargetInfo.HasTarget) + { + for (int j = 0; j < aISelectedTargetInfo.Targets.Count; j++) + { + list = AIParamQuery.AddElementToList(aISelectedTargetInfo.Targets[j], list); + } + } + break; + } + } + } + return list; + } + + private static AISelectedTargetInfo GetBestTokenPatternOfDestroySelection(List allSelectPatternList, List playPtn, AISituationInfo situation) + { + if (allSelectPatternList == null || allSelectPatternList.Count <= 0) + { + return null; + } + AISelectedTargetInfo result = null; + float num = float.MinValue; + for (int i = 0; i < allSelectPatternList.Count; i++) + { + AISelectedTargetInfo aISelectedTargetInfo = allSelectPatternList[i]; + if (!aISelectedTargetInfo.HasTarget) + { + continue; + } + float num2 = 0f; + situation.SetTarget(aISelectedTargetInfo, AIScriptTokenArgType.TARGET_SELECT); + for (int j = 0; j < aISelectedTargetInfo.Targets.Count; j++) + { + AIVirtualCard aIVirtualCard = aISelectedTargetInfo.Targets[j]; + float num3 = aIVirtualCard.EvaluateValueOnField(playPtn, situation, useStyle: true); + if (!aIVirtualCard.IsIndestructible && !aIVirtualCard.IsIndependent) + { + num2 -= num3; + num2 += aIVirtualCard.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) + aIVirtualCard.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false); + } + num2 += num3; + if (!aIVirtualCard.IsAlly) + { + num2 *= -1f; + } + } + situation.SetTarget(null, AIScriptTokenArgType.TARGET_SELECT); + if (num2 > num) + { + result = aISelectedTargetInfo; + num = num2; + } + } + return result; + } + + public static AIVirtualCard FirstSummonedFollowerTokenCandidate(List tokenIdList, AIVirtualCard tokenOwner, AIVirtualField field, AISituationInfo situation, bool isTokenAlly, bool isSkillSummon, List condList = null) + { + if (situation == null || tokenIdList == null || tokenIdList.Count <= 0) + { + return null; + } + if ((isTokenAlly ? field.AllyInplayCards.Count((AIVirtualCard card) => !card.IsDead) : field.EnemyInplayCards.Count((AIVirtualCard card) => !card.IsDead)) >= 5) + { + return null; + } + EnemyAI aI = field.AI; + AIVirtualCard result = null; + for (int num = 0; num < tokenIdList.Count; num++) + { + int tokenId = tokenIdList[num].TokenId; + AIVirtualCard tokenCard = GetTokenCard(aI, tokenOwner, field, tokenId, isTokenAlly, condList); + if (tokenCard != null && tokenCard.IsUnit) + { + tokenCard.PseudoInitAtSummonToken(tokenOwner, situation, isSkillSummon); + result = tokenCard; + break; + } + } + return result; + } + + private static AIVirtualCard GetTokenCard(EnemyAI ai, AIVirtualCard parentCard, AIVirtualField field, int tokenId, bool isTokenAlly, List condList = null) + { + AIVirtualCard aIVirtualCard = ai.tokenManager.GetTokenFromId(tokenId, isTokenAlly, field, needsClone: true); + if (aIVirtualCard == null) + { + AIConsoleUtility.LogError($"AISummonTokenUtility.GetTokenCard(): tokenId={tokenId} is null"); + return null; + } + if (ai.IsPlagueCityTagged && aIVirtualCard.IsUnit) + { + aIVirtualCard = ai.tokenManager.GetZombieToken(parentCard.IsAlly, field, needsClone: true); + } + return aIVirtualCard; + } + + private static bool IsSelectedTargetArgument(AIScriptTokenArgType argType) + { + if (argType != AIScriptTokenArgType.SELECTED_TARGET && argType != AIScriptTokenArgType.SECOND_SELECTED_TARGET && argType != AIScriptTokenArgType.CHOICED_TARGET) + { + return argType == AIScriptTokenArgType.REAL_SKILL_TARGET; + } + return true; + } + + public static bool GetIsTokenAlly(AIVirtualCard tagOwner, AIScriptTokenArgType side) + { + if (tagOwner.IsAlly) + { + return side == AIScriptTokenArgType.ALLY; + } + return side != AIScriptTokenArgType.ALLY; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITargetSelectFilteringUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AITargetSelectFilteringUtility.cs new file mode 100644 index 0000000..a3a8a01 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITargetSelectFilteringUtility.cs @@ -0,0 +1,182 @@ +using System.Collections.Generic; +using System.Linq; +using Cute; + +namespace Wizard; + +public static class AITargetSelectFilteringUtility +{ + public static List FilteringWithTargetTags(this AIVirtualCard tagOwner, List candidates, List playPtn, AISituationInfo situation) + { + if (tagOwner == null) + { + return new List(); + } + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.Target)) + { + return candidates; + } + return tagOwner.TagCollectionContainer.TargetTags.FilteringTargetCards(tagOwner, candidates, playPtn, situation); + } + + public static List FilteringIgnoreTargets(AIVirtualCard tagOwner, List candidates, List playPtn, AISituationInfo situation, int selectCount) + { + if (tagOwner == null) + { + return new List(); + } + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.IgnoreTarget)) + { + return candidates; + } + return tagOwner.TagCollectionContainer.IgnoreTargetTags.FilteringIgnoreTargets(tagOwner, candidates, playPtn, situation, selectCount); + } + + public static bool IsOnlyIgnoreTarget(AIVirtualCard playCard, AIVirtualField field, List playPtn, AISinglePlayptnRecord playptnRecord) + { + AIVirtualTargetSelectAction situation = new AIVirtualTargetSelectAction(playCard.FindRealActor(playptnRecord), playCard, AIOperationType.PLAY, (AISelectedTargetInfoSet)null); + List list = playCard.CreateAIVirtualSelectInfo(field, situation); + if (list == null || list.Count <= 0) + { + return false; + } + for (int i = 0; i < list.Count; i++) + { + AIVirtualTargetSelectInfo aIVirtualTargetSelectInfo = list[i]; + if (FilteringIgnoreTargets(playCard, aIVirtualTargetSelectInfo.Candidates, playPtn, situation, aIVirtualTargetSelectInfo.Count).Count <= 0) + { + return true; + } + } + return false; + } + + public static List SelectCandidatesWithForceTargeting(List selectableCards, AIVirtualCard tagOwner, List playPtn) + { + if (selectableCards == null || selectableCards.Count <= 0) + { + return AIGlobalEmptyList.EmptyVirtualCardList; + } + List result = selectableCards; + List list = null; + for (int i = 0; i < selectableCards.Count; i++) + { + if (tagOwner.IsAlly != selectableCards[i].IsAlly && selectableCards[i].IsForceTargeting) + { + if (list == null) + { + list = new List(); + } + list.Add(selectableCards[i]); + } + } + if (list != null && list.Count > 0) + { + result = list; + } + return result; + } + + public static List ExecuteTargetFilteringTagToRealCardList(AIVirtualCard virtualActCard, IEnumerable selectableCards, AIVirtualField field, List playPtn) + { + List targets = new List(selectableCards.Select((BattleCardBase c) => field.SearchVirtualCard(c))); + return ExecuteTargetFilteringTags(virtualActCard, targets, playPtn, null); + } + + public static List ExecuteTargetFilteringTags(AIVirtualCard actCard, List targets, List playPtn, AISituationInfo situation, int selectCount = 1) + { + List candidates = targets; + List list = FilteringIgnoreTargets(actCard, candidates, playPtn, situation, selectCount); + if (list.IsNotNullOrEmpty()) + { + candidates = list; + } + return actCard.FilteringWithTargetTags(candidates, playPtn, situation); + } + + public static List GetLegalCandidates(AIVirtualCard tagOwner, List candidates, int selectCount) + { + candidates.RemoveAll((AIVirtualCard c) => c.IsAlly != tagOwner.IsAlly && c.CantBeFocusedSkill); + List list = null; + for (int num = 0; num < candidates.Count; num++) + { + AIVirtualCard aIVirtualCard = candidates[num]; + if (tagOwner.IsAlly != aIVirtualCard.IsAlly && aIVirtualCard.IsForceTargeting) + { + list = AIParamQuery.AddElementToList(aIVirtualCard, list); + } + } + if (list != null && list.Count > 0 && list.Count >= selectCount) + { + return list; + } + return candidates; + } + + public static IEnumerable RemoveDuplicatedCards(IEnumerable targetCards, IEnumerable filterCards) + { + if (!targetCards.IsNotNullOrEmpty() || !filterCards.IsNotNullOrEmpty()) + { + yield break; + } + foreach (BattleCardBase targetCard in targetCards) + { + bool flag = false; + foreach (BattleCardBase filterCard in filterCards) + { + if (filterCard != null && targetCard.IsPlayer == filterCard.IsPlayer && targetCard.Index == filterCard.Index) + { + flag = true; + break; + } + } + if (!flag) + { + yield return targetCard; + } + } + } + + public static AISelectedTargetInfo GetRuleBaseTargets(AIPlayTag rule, List candidates, AIVirtualField field, AIVirtualTargetSelectAction situation, AIRemovalType removalType) + { + List targetList = null; + AIVirtualCard actor = situation.Actor; + switch (rule.Type) + { + case AIPlayTagType.FanfareHandBuff: + case AIPlayTagType.PlayHandBuff: + case AIPlayTagType.FanfareSpellboost: + case AIPlayTagType.PlaySpellboost: + case AIPlayTagType.PlayChangeCost: + case AIPlayTagType.FanfareChangeCost: + (rule.ArgumentExpressions as AIWhenPlayTagArgument).RegisterRuleBaseTargets(candidates, actor, field, situation, ref targetList); + break; + case AIPlayTagType.EvoHandBuff: + case AIPlayTagType.EvoDiscard: + case AIPlayTagType.EvoChangeCost: + (rule.ArgumentExpressions as AIEvoTagArgument).RegisterRuleBaseTargets(candidates, actor, field, situation, ref targetList); + break; + } + if (targetList == null || targetList.Count <= 0) + { + return null; + } + return new AISelectedTargetInfo(targetList, TargetSelectType.NormalRuleBase, removalType); + } + + public static int GetForbiddenSelectedTargetFilterIndex(List filterList) + { + if (filterList == null || filterList.Count <= 0) + { + return -1; + } + for (int i = 0; i < filterList.Count; i++) + { + if (filterList[i] is AIScriptArgumentToken { ArgumentType: AIScriptTokenArgType.SELECTED_TARGET, IsNot: not false }) + { + return i; + } + } + return -1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITargetSelectTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AITargetSelectTagArgument.cs new file mode 100644 index 0000000..8dadffa --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITargetSelectTagArgument.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; + +namespace Wizard; + +public abstract class AITargetSelectTagArgument : AIFiltersAndSelectTypeArgument +{ + protected AIPolishConvertedExpression _selectCount; + + protected int _expectedSelectCountArgOffset; + + protected virtual bool _isSelectCountImplemented => false; + + public bool IsForbiddenSelectedTarget { get; private set; } + + protected virtual int SELECT_COUNT_OFFSET => 1; + + protected override int SELECT_TYPE_OFFSET => _expectedSelectCountArgOffset + 1; + + public AITargetSelectTagArgument(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + InitializeSelectCount(); + InitSelectType(); + InitializeFilter(); + SetUpReferenceSelectedTargetInfoSelectType(); + int forbiddenSelectedTargetFilterIndex = AITargetSelectFilteringUtility.GetForbiddenSelectedTargetFilterIndex(base.Filters); + if (forbiddenSelectedTargetFilterIndex >= 0) + { + IsForbiddenSelectedTarget = true; + base.Filters.RemoveAt(forbiddenSelectedTargetFilterIndex); + } + else + { + IsForbiddenSelectedTarget = false; + } + } + + protected virtual void InitializeSelectCount() + { + _selectCount = null; + if (_isSelectCountImplemented) + { + _expectedSelectCountArgOffset = SELECT_COUNT_OFFSET; + AIPolishConvertedExpression aIPolishConvertedExpression = _exprList[_exprList.Count - _expectedSelectCountArgOffset]; + if (aIPolishConvertedExpression.IsMathematicExpress()) + { + _selectCount = aIPolishConvertedExpression; + } + } + if (_selectCount == null) + { + _expectedSelectCountArgOffset = SELECT_COUNT_OFFSET - 1; + } + } + + public int GetSelectCount(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_selectCount == null) + { + return 1; + } + return (int)_selectCount.EvalArg(owner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITargetSelectUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AITargetSelectUtility.cs new file mode 100644 index 0000000..a6a897b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITargetSelectUtility.cs @@ -0,0 +1,184 @@ +using System; +using System.Collections.Generic; + +namespace Wizard; + +public static class AITargetSelectUtility +{ + public static List CreateAIVirtualSelectInfo(this AIVirtualCard owner, AIVirtualField field, AIVirtualTargetSelectAction situation) + { + List resultList = null; + AIVirtualTargetSelectInfo aIVirtualTargetSelectInfo = CreatePreprocessSelectInfo(owner, field, situation); + if (aIVirtualTargetSelectInfo != null) + { + resultList = AIParamQuery.AddElementToList(aIVirtualTargetSelectInfo, resultList); + } + switch (situation.ActionType) + { + case AIOperationType.FUSION: + { + AIVirtualTargetSelectInfo aIVirtualTargetSelectInfo2 = owner.CreateFusionSelectInfo(field, situation); + if (aIVirtualTargetSelectInfo2 != null) + { + resultList = AIParamQuery.AddElementToList(aIVirtualTargetSelectInfo2, resultList); + } + else + { + AIConsoleUtility.LogError("CreateAIVirtualSelectInfo error!! Cannot find fusion selectInfo of " + owner.CardName + " !!!!!"); + } + break; + } + case AIOperationType.EVOLVE: + RegisterEvoSelectInfo(owner, field, situation, ref resultList); + break; + case AIOperationType.PLAY: + RegisterWhenPlaySelectInfo(owner, field, situation, ref resultList); + break; + } + AIPreprocessSimulationUtility.ResetPreprocess(situation, field); + return resultList; + } + + private static AIVirtualTargetSelectInfo CreatePreprocessSelectInfo(AIVirtualCard owner, AIVirtualField field, AIVirtualTargetSelectAction situation) + { + AIScriptTokenArgType aIScriptTokenArgType = AIPreprocessSimulationUtility.ConvertAIOperationTypeToTiming(situation.ActionType); + if (aIScriptTokenArgType != AIScriptTokenArgType.NONE) + { + AIPreprocessSimulationUtility.SimulatePreprocess(situation.Actor, situation, field, aIScriptTokenArgType, isPseudo: true); + if (situation.PreprocessRecorder.TotalBurialCount > 0) + { + AIVirtualTargetSelectInfo burialSelectInfo = owner.GetBurialSelectInfo(field, situation); + if (burialSelectInfo != null) + { + return burialSelectInfo; + } + } + } + return null; + } + + private static AIVirtualTargetSelectInfo CreateFusionSelectInfo(this AIVirtualCard owner, AIVirtualField field, AIVirtualTargetSelectAction situation) + { + if (owner.TagCollectionContainer.HasTag(AIPlayTagType.Fusion)) + { + return owner.TagCollectionContainer.FusionTags.GetSelectInfo(owner, field, situation); + } + return null; + } + + private static AIVirtualTargetSelectInfo CreateChoiceSelectInfoAndGetRealActor(AIVirtualCard owner, AIVirtualField field, AIVirtualTargetSelectAction situation, out AIVirtualCard realActor) + { + realActor = owner; + AIVirtualTargetSelectInfo choiceSelectInfo = owner.GetChoiceSelectInfo(field, situation); + if (choiceSelectInfo != null) + { + if (situation.IsChoiceAndChangeActor(field)) + { + if (!situation.Actor.IsSameCard(owner)) + { + realActor = situation.Actor; + situation.SetChoicedTargetInInfo(situation.Actor); + } + else + { + AISelectedTargetInfo choiceTargets = choiceSelectInfo.GetChoiceTargets(owner, field, null, situation); + if (choiceTargets != null && choiceTargets.HasTarget) + { + AIVirtualCard firstTarget = choiceTargets.FirstTarget; + situation.SetActor(firstTarget); + situation.SetChoicedMultipleTargetInInfo(choiceTargets.Targets); + realActor = AITokenManager.ProcessToken(firstTarget.BaseCard, field); + } + } + } + } + else + { + realActor = situation.Actor; + } + return choiceSelectInfo; + } + + private static void RegisterEvoSelectInfo(AIVirtualCard actor, AIVirtualField field, AIVirtualTargetSelectAction situation, ref List resultList) + { + AIVirtualCard realActor; + AIVirtualTargetSelectInfo aIVirtualTargetSelectInfo = CreateChoiceSelectInfoAndGetRealActor(actor, field, situation, out realActor); + if (aIVirtualTargetSelectInfo != null) + { + resultList = AIParamQuery.AddElementToList(aIVirtualTargetSelectInfo, resultList); + } + if (realActor.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenEvo)) + { + ((IAITargetSelectTagCollection)realActor.TagCollectionContainer.EvoTags).AddSelectInfoToSelectInfoList(realActor, field, (AISituationInfo)situation, ref resultList); + } + } + + private static void RegisterWhenPlaySelectInfo(AIVirtualCard actor, AIVirtualField field, AIVirtualTargetSelectAction situation, ref List resultList) + { + AIVirtualCard realActor; + AIVirtualTargetSelectInfo aIVirtualTargetSelectInfo = CreateChoiceSelectInfoAndGetRealActor(actor, field, situation, out realActor); + if (aIVirtualTargetSelectInfo != null) + { + resultList = AIParamQuery.AddElementToList(aIVirtualTargetSelectInfo, resultList); + } + if (realActor.TagCollectionContainer.HasTagCollection(TagCollectionType.Fanfare)) + { + realActor.TagCollectionContainer.FanfareTags.AddSelectInfoToSelectInfoList(realActor, field, situation, ref resultList); + } + if (realActor.TagCollectionContainer.HasTagCollection(TagCollectionType.Play)) + { + realActor.TagCollectionContainer.PlayTags.AddSelectInfoToSelectInfoList(realActor, field, situation, ref resultList); + } + } + + public static List GetProspectedTargetWithPlayPtnUsableCardCheck(List candidates, AIVirtualField field, AIVirtualTargetSelectAction situation, AISinglePlayptnRecord playPtnRecord, int selectCount, Func, AIVirtualTargetSelectAction, float> skillValue, out bool isBreakPlayptn) + { + isBreakPlayptn = false; + if (candidates == null || candidates.Count <= 0) + { + return null; + } + List list = new List(); + List list2 = new List(); + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (aIVirtualCard.IsSameCard(situation.Actor) || aIVirtualCard.IsSameCard(situation.OriginalCard)) + { + continue; + } + float num = skillValue(aIVirtualCard, field, playPtnRecord.PlayPtn, situation); + if (playPtnRecord.IsUsableHandCard(aIVirtualCard)) + { + num += 100f; + } + if (list.Count < selectCount) + { + list.Add(aIVirtualCard); + list2.Add(num); + continue; + } + for (int j = 0; j < list2.Count; j++) + { + float num2 = list2[j]; + AIVirtualCard aIVirtualCard2 = list[j]; + if (num > num2) + { + list2[j] = num; + list[j] = aIVirtualCard; + num = num2; + aIVirtualCard = aIVirtualCard2; + } + } + } + if (list.Count < selectCount) + { + return null; + } + if (!playPtnRecord.IsAllTargetsUsableHandCard(list)) + { + isBreakPlayptn = true; + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITestGlobal.cs b/SVSim.BattleEngine/Engine/Wizard/AITestGlobal.cs new file mode 100644 index 0000000..961a064 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITestGlobal.cs @@ -0,0 +1,6 @@ +namespace Wizard; + +public class AITestGlobal +{ + public static int AI_MAX_LIFE = 20; +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITimeOverAttackSimulator.cs b/SVSim.BattleEngine/Engine/Wizard/AITimeOverAttackSimulator.cs new file mode 100644 index 0000000..ae05c25 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITimeOverAttackSimulator.cs @@ -0,0 +1,301 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class AITimeOverAttackSimulator : IBattleSimulationAI +{ + private const int NONE_EVOLVE_INDEX = -1; + + private AIRuleBaseBattleSimulator _ruleBaseSimulator; + + private SimulationResult _bestResult; + + private int _originalFieldInplayCount; + + private ulong[] _defaultPlayptnHashArray; + + private SimulationAdditionalActionInfoSet _simAdditionalOptions; + + public AIVirtualField Cr_MaxField + { + get + { + if (_bestResult == null) + { + return null; + } + return _bestResult.BestResultField; + } + } + + public float Cr_MaxFieldValue + { + get + { + if (_bestResult == null) + { + return 0f; + } + return _bestResult.MaxFieldValue; + } + } + + public float Cr_MaxFieldValueAtSelfTurnEnd + { + get + { + if (_bestResult == null) + { + return 0f; + } + return _bestResult.MaxFieldValueAtSelfTurnEnd; + } + } + + public List Cr_MaxActionInfoSequence => _bestResult.ActionSequence; + + public PlayPtnWithToken Cr_BestPlayPtnWithToken { get; private set; } + + public AIVirtualActionInfo Cr_FirstActionInfo { get; private set; } + + public IEnumerator _CrSimulate(AIVirtualField originalField, bool doesUseEvo, bool checkTimeOverLogic, PlayPtnWithToken[] bestPlayPtnWithToken = null, SimulationAdditionalActionInfoSet additionalActions = null) + { + originalField.AI.IsInVirutalSimulation = true; + _ruleBaseSimulator = new AIRuleBaseBattleSimulator(originalField.AI, bestPlayPtnWithToken, canChangeToTimeOverLogic: true); + _bestResult = new SimulationResult(); + _originalFieldInplayCount = originalField.AllyInplayCards.Count((AIVirtualCard c) => !c.IsDead); + _defaultPlayptnHashArray = AISimulationUtility.CalculatePlayptnWithTokenHashs(originalField, bestPlayPtnWithToken); + _simAdditionalOptions = additionalActions; + ParallelJob job = ParallelJob.Dispatch(delegate + { + try + { + AIVirtualField field = new AIVirtualField(originalField); + int[] attackerIdxList = SortByOneAttackBreak(field); + if (additionalActions != null) + { + _ = additionalActions.ForceEvoAction; + } + SimulateEvoPatternBattle(field, attackerIdxList, doesUseEvo); + if (bestPlayPtnWithToken != null && Cr_MaxField != null) + { + int num = Cr_MaxField.AllyInplayCards.Count((AIVirtualCard c) => !c.IsDead); + int num2 = Mathf.Min(Mathf.Max(0, _originalFieldInplayCount - num), bestPlayPtnWithToken.Length - 1); + Cr_BestPlayPtnWithToken = null; + for (int num3 = num2; num3 >= 0; num3--) + { + if (bestPlayPtnWithToken[num3] != null) + { + Cr_BestPlayPtnWithToken = bestPlayPtnWithToken[num3]; + break; + } + } + } + } + catch (Exception) + { + } + }); + while (!job.isDone) + { + yield return null; + } + if (Cr_MaxField != null) + { + Cr_FirstActionInfo = BattleSequencer.GetFirstActionInfo(_bestResult.ActionSequence, Cr_MaxField, Cr_MaxField.BestPlayPtn); + } + originalField.AI.IsInVirutalSimulation = false; + } + + private int[] SortByOneAttackBreak(AIVirtualField field) + { + List sortedAttackerIndexList = GetSortedAttackerIndexList(field); + int num = ((field.EnemyInplayCards != null) ? field.EnemyInplayCards.Count : 0); + if (num == 0) + { + return sortedAttackerIndexList.ToArray(); + } + List list = new List(); + List list2 = new List(); + List list3 = new List(sortedAttackerIndexList); + for (int i = 0; i < sortedAttackerIndexList.Count; i++) + { + int num2 = 0; + bool flag = false; + int num3 = 0; + for (int j = 0; j < num; j++) + { + AIVirtualCard aIVirtualCard = field.AllyInplayCards[sortedAttackerIndexList[i]]; + AIVirtualCard aIVirtualCard2 = field.EnemyInplayCards[j]; + if (!aIVirtualCard2.IsUnit) + { + continue; + } + int num4 = aIVirtualCard2.SimulateDamageAmount(aIVirtualCard.Attack); + if (aIVirtualCard2.Life <= num4) + { + num2++; + if (!flag) + { + flag = aIVirtualCard2.IsBreakFirst(field.BestPlayPtn); + } + if (aIVirtualCard2.IsBreakLast(field.BestPlayPtn)) + { + num3++; + } + break; + } + } + if (num2 > 0 && flag) + { + int item = sortedAttackerIndexList[i]; + list.Add(item); + list3.Remove(item); + } + else if (num2 == 0 || (num2 > 0 && num3 == num2)) + { + int item2 = sortedAttackerIndexList[i]; + list2.Add(item2); + list3.Remove(item2); + } + } + list.AddRange(list3); + list.AddRange(list2); + return list.ToArray(); + } + + private void SimulateEvoPatternBattle(AIVirtualField field, int[] attackerIdxList, bool useEve) + { + List sortedAttackTargetIndexList = GetSortedAttackTargetIndexList(field); + if (((_simAdditionalOptions != null) ? _simAdditionalOptions.ForceEvoAction : null) != null) + { + SimulateTargetsBreakPattern(field, attackerIdxList, -1, sortedAttackTargetIndexList); + return; + } + int num = (useEve ? field.AllyInplayCards.Count : 0); + for (int i = -1; i < num; i++) + { + if (AISimulationUtility.IsValuableEvoIndex(i, field)) + { + SimulateTargetsBreakPattern(field, attackerIdxList, i, sortedAttackTargetIndexList); + } + } + } + + private void SimulateTargetsBreakPattern(AIVirtualField field, int[] attackrIndecies, int evoIndex, List enemyAllTargets) + { + List list = new List(); + List list2 = new List(); + _ruleBaseSimulator.RunSequence(field, attackrIndecies, evoIndex, new List(), _bestResult, _simAdditionalOptions, null, checkActFailure: false); + list.Add(AISimulationUtility.CalculateTargetSequenceHash(list2.ToArray(), field)); + int num = enemyAllTargets.Count; + while (num > 0 && !field.AI.IsBattleEnd) + { + int[] patternGroup = AISimulationUtility.GetPatternGroup(num); + if (patternGroup != null) + { + for (int i = 0; i < patternGroup.Length; i++) + { + List enemyTargets = AISimulationUtility.GetEnemyTargets(field.EnemyInplayCards, enemyAllTargets, patternGroup[i], field.BestPlayPtn); + ulong item = AISimulationUtility.CalculateTargetSequenceHash(enemyTargets.ToArray(), field); + if (!list.Contains(item)) + { + AIOneMoreLastwordUtility.SortEnemyTargetByBreakBonus(field, enemyTargets); + if (!AISimulationUtility.IsValidEnemyTargetIndexes(field.EnemyInplayCards, enemyTargets)) + { + return; + } + _ruleBaseSimulator.RunSequence(field, attackrIndecies, evoIndex, enemyTargets, _bestResult, _simAdditionalOptions, null, checkActFailure: false); + list.Add(item); + } + } + } + num--; + } + } + + private List GetSortedAttackerIndexList(AIVirtualField field) + { + List list = new List(); + List list2 = new List(); + List allyInplayCards = field.AllyInplayCards; + for (int i = 0; i < allyInplayCards.Count; i++) + { + list2.Add(AIAttackSimulationUtility.IsAttackPossible(field, allyInplayCards[i].AttackLeaderSituation)); + } + for (int j = 0; j < allyInplayCards.Count; j++) + { + AIVirtualCard aIVirtualCard = allyInplayCards[j]; + if (!aIVirtualCard.IsUnit) + { + continue; + } + int num = -1; + for (int k = 0; k < list.Count; k++) + { + int index = list[k]; + AIVirtualCard aIVirtualCard2 = allyInplayCards[index]; + if (aIVirtualCard.Attack < aIVirtualCard2.Attack) + { + num = k; + break; + } + if (aIVirtualCard.Attack == aIVirtualCard2.Attack && (!list2[j] || list2[index]) && ((!list2[j] && list2[index]) || aIVirtualCard.Life < aIVirtualCard2.Life)) + { + num = k; + break; + } + } + if (num >= 0 && num < list.Count) + { + list.Insert(num, j); + } + else + { + list.Add(j); + } + } + return list; + } + + private List GetSortedAttackTargetIndexList(AIVirtualField field) + { + List list = new List(); + List list2 = new List(); + List enemyInplayCards = field.EnemyInplayCards; + for (int i = 0; i < enemyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = enemyInplayCards[i]; + if (!aIVirtualCard.IsUnit) + { + continue; + } + int num = -1; + List list3 = (aIVirtualCard.IsGuard ? list2 : list); + for (int j = 0; j < list3.Count; j++) + { + AIVirtualCard aIVirtualCard2 = enemyInplayCards[list3[j]]; + if (aIVirtualCard.Life < aIVirtualCard2.Life || (aIVirtualCard.Life == aIVirtualCard2.Life && aIVirtualCard.Attack > aIVirtualCard2.Attack)) + { + num = j; + break; + } + } + if (num >= 0 && num < list3.Count) + { + list3.Insert(num, i); + } + else + { + list3.Add(i); + } + } + list2.AddRange(list); + return list2; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITokenDrawUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AITokenDrawUtility.cs new file mode 100644 index 0000000..d4a61b1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITokenDrawUtility.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AITokenDrawUtility +{ + public static void ExecuteTokenDraw(AIVirtualCard tagOwner, AISituationInfo situation, AIVirtualField field, List tokenIds, bool isAlly) + { + List list = null; + for (int i = 0; i < tokenIds.Count; i++) + { + int tokenId = tokenIds[i].TokenId; + AIVirtualCard tokenFromId = field.AI.tokenManager.GetTokenFromId(tokenId, isAlly, field, needsClone: true); + if (tokenFromId == null) + { + AIConsoleUtility.LogError($"AITokenDrawUtility.ExecuteTokenDraw() error!! tokenCard:{tokenId} is null"); + return; + } + if (isAlly) + { + if (field.AllyHandCards.Count < 9) + { + tokenFromId.InitAtDrawToken(tagOwner, situation); + list = AIParamQuery.AddElementToList(tokenFromId, list); + } + } + else if (field.GetEnemyHandCardList().Count < 9) + { + if (field.IsLatestActionField) + { + tokenFromId.InitAtDrawToken(tagOwner, situation); + } + else + { + new EnemyHandVirtualCard(tokenFromId.BaseCard, field).InitAtDrawToken(tagOwner, situation); + } + list = AIParamQuery.AddElementToList(tokenFromId, list); + } + } + situation.RegisterOwnDrewCardList(list); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITokenIdHolderCandidateRangeInformation.cs b/SVSim.BattleEngine/Engine/Wizard/AITokenIdHolderCandidateRangeInformation.cs new file mode 100644 index 0000000..e66a119 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITokenIdHolderCandidateRangeInformation.cs @@ -0,0 +1,105 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITokenIdHolderCandidateRangeInformation +{ + private enum CandidateRange + { + AllReferableCards, + DestroyedCards, + DestroyedInCurrentTurn + } + + private AIScriptTokenArgType _side; + + private CandidateRange _range; + + public AITokenIdHolderCandidateRangeInformation(List filters) + { + _side = AIScriptTokenArgType.ALLY; + _range = CandidateRange.AllReferableCards; + InitializeFromFilters(filters); + } + + private AITokenIdHolderCandidateRangeInformation(AIScriptTokenArgType side, CandidateRange range) + { + _side = side; + _range = range; + } + + public static AITokenIdHolderCandidateRangeInformation CreateReanimateRangeInformation(AIScriptTokenArgType side) + { + return new AITokenIdHolderCandidateRangeInformation(side, CandidateRange.DestroyedCards); + } + + private void InitializeFromFilters(List filters) + { + if (filters == null || filters.Count <= 0) + { + return; + } + for (int num = filters.Count - 1; num >= 0; num--) + { + if (filters[num] is AIScriptArgumentToken aIScriptArgumentToken) + { + bool flag = true; + switch (aIScriptArgumentToken.ArgumentType) + { + case AIScriptTokenArgType.ALLY: + case AIScriptTokenArgType.OPPONENT: + _side = aIScriptArgumentToken.ArgumentType; + break; + case AIScriptTokenArgType.DESTROYED_CARD: + _range = CandidateRange.DestroyedCards; + break; + case AIScriptTokenArgType.DESTROYED_IN_CURRENT_TURN: + _range = CandidateRange.DestroyedInCurrentTurn; + break; + default: + flag = false; + break; + } + if (flag) + { + filters.RemoveAt(num); + } + } + } + } + + public List GetTokenIdHolderRange(AIVirtualField field) + { + return _range switch + { + CandidateRange.DestroyedCards => GetDestroyedCards(field), + CandidateRange.DestroyedInCurrentTurn => GetDestroyedCardsInCurrentTurn(field), + _ => field.CardListSet.AllReferableCards, + }; + } + + private List GetDestroyedCards(AIVirtualField field) + { + AIScriptTokenArgType side = _side; + if (side != AIScriptTokenArgType.ALLY && side == AIScriptTokenArgType.OPPONENT) + { + return field.CardListSet.EnemyDestroyedCards; + } + return field.CardListSet.AllyDestroyedCards; + } + + private List GetDestroyedCardsInCurrentTurn(AIVirtualField field) + { + List destroyedCards = GetDestroyedCards(field); + List list = new List(); + for (int i = 0; i < destroyedCards.Count; i++) + { + AIVirtualCard aIVirtualCard = destroyedCards[i]; + if (aIVirtualCard.DeadTurn) + { + list.Add(aIVirtualCard); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITribeSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AITribeSimulationUtility.cs new file mode 100644 index 0000000..caa3ed5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITribeSimulationUtility.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AITribeSimulationUtility +{ + public static CardBasePrm.TribeType ConvertTokenArgTypeToTribeType(AIScriptTokenArgType tokenArgType) + { + return tokenArgType switch + { + AIScriptTokenArgType.FOOD => CardBasePrm.TribeType.FOOD, + AIScriptTokenArgType.MACHINE => CardBasePrm.TribeType.MACHINE, + AIScriptTokenArgType.NATURE => CardBasePrm.TribeType.NATURE, + AIScriptTokenArgType.LEGION => CardBasePrm.TribeType.LEGION, + AIScriptTokenArgType.LORD => CardBasePrm.TribeType.LORD, + AIScriptTokenArgType.LEVIN => CardBasePrm.TribeType.LEVIN, + AIScriptTokenArgType.LOOT => CardBasePrm.TribeType.LOOTING, + AIScriptTokenArgType.WHITE_RITUAL => CardBasePrm.TribeType.WHITE_RITUAL, + AIScriptTokenArgType.MANARIA => CardBasePrm.TribeType.MANARIA, + AIScriptTokenArgType.ARTIFACT => CardBasePrm.TribeType.ARTIFACT, + AIScriptTokenArgType.BANQUET => CardBasePrm.TribeType.BANQUET, + AIScriptTokenArgType.HERO => CardBasePrm.TribeType.HERO, + AIScriptTokenArgType.ARMED => CardBasePrm.TribeType.ARMED, + AIScriptTokenArgType.HELLBOUND => CardBasePrm.TribeType.HELLBOUND, + AIScriptTokenArgType.SCHOOL => CardBasePrm.TribeType.SCHOOL, + AIScriptTokenArgType.CHESS => CardBasePrm.TribeType.CHESS, + _ => CardBasePrm.TribeType.MAX, + }; + } + + public static void ChangeTribeAll(List candidates, CardBasePrm.TribeType tribe) + { + if (candidates == null || candidates.Count <= 0) + { + return; + } + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (!aIVirtualCard.IsDead && !aIVirtualCard.IsIndependent) + { + aIVirtualCard.ChangeTribe(tribe); + } + } + } + + public static void ChangeTribeTargetSelect(CardBasePrm.TribeType tribe, AIScriptTokenArgType selectType, AISituationInfo situation) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(selectType); + if (situationTarget != null && situationTarget.HasTarget) + { + ChangeTribeAll(situationTarget.Targets, tribe); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITriggerAndTargetFiltersTagBase.cs b/SVSim.BattleEngine/Engine/Wizard/AITriggerAndTargetFiltersTagBase.cs new file mode 100644 index 0000000..9107f26 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITriggerAndTargetFiltersTagBase.cs @@ -0,0 +1,118 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITriggerAndTargetFiltersTagBase : AIScriptArgumentExpressions +{ + public List TriggerFilters { get; private set; } + + public List TargetFilters { get; protected set; } + + protected virtual int NON_FILTER_FIRST_OFFSET => 0; + + public AITriggerAndTargetFiltersTagBase(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + InitializeFilters(); + } + + protected void InitializeFilters() + { + if (_exprList.Count <= 0 || !AIPlayTagInitializingUtility.IsInitOfFilterSet(_exprList[0])) + { + return; + } + int num = -1; + for (int i = 1; i < _exprList.Count; i++) + { + if (AIPlayTagInitializingUtility.IsInitOfFilterSet(_exprList[i])) + { + num = i; + break; + } + } + if (num <= 0) + { + TriggerFilters = GetFilters(_exprList.GetRange(0, _exprList.Count - NON_FILTER_FIRST_OFFSET)); + TargetFilters = null; + } + else + { + TriggerFilters = GetFilters(_exprList.GetRange(0, num)); + TargetFilters = GetFilters(_exprList.GetRange(num, _exprList.Count - NON_FILTER_FIRST_OFFSET - num)); + } + } + + public void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AIVirtualCard triggerCard, AISituationInfo situation) + { + if (CheckTriggerLegal(triggerCard, tagOwner, playPtn, situation)) + { + List targets = GetTargets(tagOwner, field, playPtn, situation); + if (targets != null && targets.Count > 0) + { + RunTagMethod(targets, field, tagOwner, playPtn, situation); + } + } + } + + public void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, List triggerCardList, AISituationInfo situation = null, bool isBlockDeadCard = true) + { + if (CheckTriggerLegal(triggerCardList, tagOwner, playPtn, situation, isBlockDeadCard)) + { + List targets = GetTargets(tagOwner, field, playPtn, situation); + if (targets != null && targets.Count > 0) + { + RunTagMethod(targets, field, tagOwner, playPtn, situation); + } + } + } + + protected virtual void RunTagMethod(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (targets != null) + { + _ = targets.Count; + _ = 0; + } + } + + protected virtual List GetTargets(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (TargetFilters == null || TargetFilters.Count <= 0) + { + return new List { tagOwner }; + } + List candidateRange = GetCandidateRange(field); + return GetFilteredTargets(candidateRange, tagOwner, playPtn, situation); + } + + public bool CheckTriggerLegal(AIVirtualCard triggerCard, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + return AIFilteringUtility.CheckMatchTargetFiltering(triggerCard, null, TriggerFilters, playPtn, tagOwner, situation); + } + + public bool CheckTriggerLegal(List triggers, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDeadCard) + { + List list = AIFilteringUtility.MultipleFiltering(triggers, TriggerFilters, tagOwner, playPtn, situation, isBlockDeadCard); + if (list == null || list.Count == 0) + { + return false; + } + return true; + } + + protected virtual List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.MultipleFiltering(candidates, TargetFilters, tagOwner, playPtn, situation, isBlockDead); + } + + protected virtual List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothClassAndInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndAddDeck.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndAddDeck.cs new file mode 100644 index 0000000..4930b87 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndAddDeck.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndAddDeck : AIScriptArgumentExpressions, IAITurnEndArgument +{ + private AIPolishConvertedExpression _cardIdToken; + + private AIPolishConvertedExpression _addCountExpression; + + private const int ADD_CARD_ID_ARG_INDEX = 0; + + private const int ADD_COUNT_ARG_INDEX = 1; + + private const int IS_ALLY_TURN_INDEX = 2; + + public bool IsAllyTurn { get; private set; } + + public AITurnEndAddDeck(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _cardIdToken = _exprList[0]; + _addCountExpression = _exprList[1]; + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), 2); + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + int tokenId = GetTokenId(); + int addCount = GetAddCount(tagOwner, field, playPtn, situation); + field.AddDeckCard(tokenId, addCount, tagOwner, playPtn, situation); + } + + public int GetTokenId() + { + return _cardIdToken.EvalID(); + } + + public int GetAddCount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_addCountExpression == null) + { + return 0; + } + return (int)_addCountExpression.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndAttachTag.cs new file mode 100644 index 0000000..6eb1275 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndAttachTag.cs @@ -0,0 +1,89 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndAttachTag : AIFiltersArgument, IAITurnEndArgument +{ + private AIPolishConvertedExpression AttachCount; + + private const int SELECT_TYPE_OFFSET = 4; + + private const int COUNT_OFFSET = 3; + + private const int TIMING_OFFSET = 2; + + private const int IS_ALLY_TURN_OFFSET = 1; + + public AIPlayTag Tag { get; private set; } + + public AIScriptTokenArgType SelectType { get; private set; } + + public AIScriptTokenArgType RemoveTiming { get; private set; } + + public bool IsAllyTurn { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => 4; + + public AITurnEndAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + SelectType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 4], base.LegalSelectTypes); + AttachCount = _exprList[_exprList.Count - 3]; + RemoveTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2]); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - 1); + if (list.Count <= AIPlayTag.TAG_WORDS_LENTGH) + { + Tag = null; + } + else + { + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targetsFromField, tagOwner, Tag, RemoveTiming, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + int selectCount = (int)AttachCount.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + AIDefaultSelectLogicArgument selectLogic = new AIDefaultSelectLogicArgument(null); + AIAttachTagSimulationUtility.SimulateRandomSelectAttachTag(targetsFromField, selectCount, tagOwner, field, playPtn, situation, Tag, RemoveTiming, selectLogic); + break; + } + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndBanAttack.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndBanAttack.cs new file mode 100644 index 0000000..a0cabbf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndBanAttack.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; +using Wizard.Battle.UI; + +namespace Wizard; + +public class AITurnEndBanAttack : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + private CantAttackType _banAttackType; + + private readonly int IS_ALLY_TURN_OFFSET = 1; + + private readonly int BAN_ATTACK_TYPE_ARG_OFFSET = 2; + + public bool IsAllyTurn { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 3; + + public AITurnEndBanAttack(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + _banAttackType = AIPlayTagInitializingUtility.CreateBanAttackType(_exprList[_exprList.Count - BAN_ATTACK_TYPE_ARG_OFFSET]); + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIBanAttackSimulationUtility.BanAttackAll(targetsFromField, _banAttackType); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndBanish.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndBanish.cs new file mode 100644 index 0000000..11ec473 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndBanish.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndBanish : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + private readonly int IS_ALLY_TURN_OFFSET = 1; + + public bool IsAllyTurn { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AITurnEndBanish(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBanishSimulationUtility.BanishAll(targetsFromField, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIBanishSimulationUtility.BanishRandom(targetsFromField, tagOwner, field, playPtn, situation); + break; + } + } + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndBarrierBase.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndBarrierBase.cs new file mode 100644 index 0000000..c06ed76 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndBarrierBase.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; + +namespace Wizard; + +public abstract class AITurnEndBarrierBase : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + protected AIScriptTokenArgType _stopTiming; + + protected AIScriptTokenArgType _damageType; + + private const int IS_ALLY_TURN_OFFSET = 1; + + protected bool _isDamageTypeDefinedByMaster; + + public bool IsAllyTurn { get; private set; } + + protected abstract int _defaultDamageTypeOffset { get; } + + protected abstract int _stopTimingOffset { get; } + + protected override int SELECT_TYPE_OFFSET => 1 + (_isDamageTypeDefinedByMaster ? _defaultDamageTypeOffset : _stopTimingOffset); + + public AITurnEndBarrierBase(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - 1); + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - _stopTimingOffset]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - _defaultDamageTypeOffset], out _isDamageTypeDefinedByMaster); + InitSelectType(); + InitializeFilter(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + GiveBarrierToAllTargets(targetsFromField, tagOwner, field, playPtn, situation); + } + } + + protected abstract void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndBounce.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndBounce.cs new file mode 100644 index 0000000..5cd82fc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndBounce.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndBounce : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + private readonly int IS_ALLY_TURN_OFFSET = 1; + + public bool IsAllyTurn { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AITurnEndBounce(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBounceSimulationUtility.BounceAll(targetsFromField, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIBounceSimulationUtility.BounceRandom(targetsFromField, tagOwner, field, playPtn, situation); + break; + } + } + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndBuff.cs new file mode 100644 index 0000000..3da991c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndBuff.cs @@ -0,0 +1,146 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class AITurnEndBuff : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + private readonly int IS_ALLY_TURN_OFFSET = 1; + + private readonly int LIFE_OFFSET = 2; + + private readonly int ATTACK_OFFSET = 3; + + public AIPolishConvertedExpression Attack { get; private set; } + + public AIPolishConvertedExpression Life { get; private set; } + + public bool IsAllyTurn { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 4; + + public AITurnEndBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + Attack = _exprList[_exprList.Count - ATTACK_OFFSET]; + Life = _exprList[_exprList.Count - LIFE_OFFSET]; + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + AIVirtualField selfField = tagOwner.SelfField; + List targetsFromField = GetTargetsFromField(tagOwner, selfField, EnemyAI.EmptyPlayPtn, selfField.CommonAllyTurnEndSituation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return 0f; + } + float num = 0f; + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + { + for (int j = 0; j < selfField.CardListSet.BothClassAndInplayCards.Count; j++) + { + AIVirtualCard aIVirtualCard2 = selfField.CardListSet.BothClassAndInplayCards[j]; + if (targetsFromField.Contains(aIVirtualCard2)) + { + Tuple tuple2 = allInplayStatusList[j]; + int attack2 = tuple2.first; + int life2 = tuple2.second; + num += CalculateBuffThreatenToOneCard(tagOwner, aIVirtualCard2, ref attack2, ref life2); + allInplayStatusList[j].first = attack2; + allInplayStatusList[j].second = life2; + } + } + break; + } + case AIScriptTokenArgType.RANDOM_SELECT: + { + int num2 = -1; + int first = -1; + int second = -1; + num = float.MinValue; + for (int i = 0; i < selfField.CardListSet.BothClassAndInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = selfField.CardListSet.BothClassAndInplayCards[i]; + if (targetsFromField.Contains(aIVirtualCard) && !aIVirtualCard.IsLeader && !aIVirtualCard.IsAmulet) + { + Tuple tuple = allInplayStatusList[i]; + int attack = tuple.first; + int life = tuple.second; + float num3 = CalculateBuffThreatenToOneCard(tagOwner, aIVirtualCard, ref attack, ref life); + if (num3 > num) + { + num = num3; + num2 = i; + first = attack; + second = life; + } + } + } + if (num2 != -1) + { + allInplayStatusList[num2].first = first; + allInplayStatusList[num2].second = second; + } + else + { + num = 0f; + } + break; + } + } + return num; + } + + private float CalculateBuffThreatenToOneCard(AIVirtualCard tagOwner, AIVirtualCard target, ref int attack, ref int life) + { + if (!target.IsUnit || life <= 0) + { + return 0f; + } + AIVirtualField selfField = tagOwner.SelfField; + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, selfField, selfField.CommonAllyTurnEndSituation, selfField.BestPlayPtn, Attack, Life); + int num = Mathf.Max(0, attack + buffExecutingInfo_old.GetExpectedAttackBuffValue(attack)); + int num2 = Mathf.Max(0, life + buffExecutingInfo_old.GetExpectedLifeBuffValue(life)); + float result = ((num2 <= 0) ? target.Value : ((float)(life - num2 + (attack - num)))) * (float)(target.IsAlly ? 1 : (-1)); + attack = num; + life = num2; + return result; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, Attack, Life); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBuffSimulationUtility.BuffAll_old(targetsFromField, field, buffExecutingInfo_old, isTemp: false, playPtn, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIBuffSimulationUtility.BuffRandom_old(targetsFromField, field, playPtn, situation, buffExecutingInfo_old, isTemp: false); + break; + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool isAttackEffective = !Attack.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndDamage.cs new file mode 100644 index 0000000..991476b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndDamage.cs @@ -0,0 +1,193 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndDamage : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + private AIPolishConvertedExpression _damageArg; + + private AIPolishConvertedExpression _countArg; + + private readonly int DAMAGE_ARG_OFFSET = 3; + + private readonly int COUNT_ARG_OFFSET = 2; + + private readonly int IS_ALLY_TURN_OFFSET = 1; + + public bool IsAllyTurn { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 4; + + public AITurnEndDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + int count = _exprList.Count; + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + _damageArg = _exprList[count - DAMAGE_ARG_OFFSET]; + _countArg = _exprList[count - COUNT_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + int damage = GetDamage(tagOwner, playPtn); + int count = GetCount(tagOwner, playPtn); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + { + for (int j = 0; j < count; j++) + { + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, damage, situation); + } + break; + } + case AIScriptTokenArgType.RANDOM_SELECT: + { + for (int i = 0; i < count; i++) + { + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, damage, situation); + } + break; + } + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + AIDamageSimulationUtility.DamageRandomMultiSelect(targetsFromField, tagOwner, field, damage, count, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + break; + } + } + + public bool IsTarget(AIVirtualCard target, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (!target.IsAmulet) + { + return AIFilteringUtility.CheckMatchTargetFiltering(target, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, tagOwner, situation); + } + return false; + } + + public int GetDamage(AIVirtualCard tagOwner, List playPtn) + { + if (_damageArg == null) + { + return 0; + } + return (int)_damageArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + } + + public int GetCount(AIVirtualCard tagOwner, List playPtn) + { + if (_countArg == null) + { + return 0; + } + return (int)_countArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + AIVirtualField selfField = tagOwner.SelfField; + List targetsFromField = GetTargetsFromField(tagOwner, selfField, EnemyAI.EmptyPlayPtn, selfField.CommonAllyTurnEndSituation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return 0f; + } + float num = 0f; + int damage = GetDamage(tagOwner, EnemyAI.EmptyPlayPtn); + int count = GetCount(tagOwner, EnemyAI.EmptyPlayPtn); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + for (int i = 0; i < selfField.CardListSet.BothClassAndInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = selfField.CardListSet.BothClassAndInplayCards[i]; + if (targetsFromField.Contains(aIVirtualCard)) + { + Tuple tuple = allInplayStatusList[i]; + if (tuple.second > 0) + { + int life = tuple.second; + num += CalculateDamageThreatenToOneCard(aIVirtualCard, damage, count, tagOwner.IsAlly, ref life); + allInplayStatusList[i].second = life; + } + } + } + } + else if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + num = float.MinValue; + int num2 = -1; + int second = -1; + for (int j = 0; j < selfField.CardListSet.BothClassAndInplayCards.Count; j++) + { + AIVirtualCard aIVirtualCard2 = selfField.CardListSet.BothClassAndInplayCards[j]; + if (!targetsFromField.Contains(aIVirtualCard2)) + { + continue; + } + Tuple tuple2 = allInplayStatusList[j]; + if (tuple2.second > 0) + { + int life2 = tuple2.second; + float num3 = CalculateDamageThreatenToOneCard(aIVirtualCard2, damage, count, tagOwner.IsAlly, ref life2); + if (num3 >= num) + { + num = num3; + num2 = j; + second = life2; + } + } + } + if (num2 >= 0) + { + allInplayStatusList[num2].second = second; + } + } + return num; + } + + private float CalculateDamageThreatenToOneCard(AIVirtualCard target, int damage, int count, bool isTagOwnerAlly, ref int life) + { + int num = life; + float num2 = 0f; + for (int i = 0; i < count; i++) + { + if (num <= 0) + { + break; + } + int num3 = target.SimulateDamageAmount(damage, isSkillDamage: true); + num -= num3; + } + if (target.IsLeader) + { + if (num < 0) + { + num = 0; + } + num2 += AILeaderLifeEvaluationUtility.Evaluate(num, life, target.IsAlly, isTagOwnerAlly); + } + else + { + num2 = ((num > 0) ? (num2 + (float)(life - num)) : (num2 + target.Value)); + num2 *= (float)((target.IsAlly != isTagOwnerAlly) ? 1 : (-1)); + } + life = num; + return num2; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndDamageClip.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndDamageClip.cs new file mode 100644 index 0000000..3e29496 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndDamageClip.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndDamageClip : AITurnEndBarrierBase +{ + private AIPolishConvertedExpression _clipAmount; + + private const int CLIP_AMOUNT_OFFSET = 2; + + protected override int _defaultDamageTypeOffset => 4; + + protected override int _stopTimingOffset => 3; + + public AITurnEndDamageClip(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _clipAmount = _exprList[_exprList.Count - 2]; + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int clipAmount = (int)_clipAmount.EvalArg(tagOwner, playPtn, field, situation); + AIBarrierSimulationUtility.AddDamageClipToAll(targets, tagOwner, field, _damageType, _stopTiming, clipAmount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndDamageCut.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndDamageCut.cs new file mode 100644 index 0000000..7617c43 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndDamageCut.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndDamageCut : AITurnEndBarrierBase +{ + private AIPolishConvertedExpression _cutAmount; + + private const int CUT_AMOUNT_OFFSET = 2; + + protected override int _stopTimingOffset => 3; + + protected override int _defaultDamageTypeOffset => 4; + + public AITurnEndDamageCut(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _cutAmount = _exprList[_exprList.Count - 2]; + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int cutAmount = (int)_cutAmount.EvalArg(tagOwner, playPtn, field, situation); + AIBarrierSimulationUtility.AddDamageCutToAll(targets, tagOwner, field, _damageType, _stopTiming, cutAmount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndDestroy.cs new file mode 100644 index 0000000..c7fc5ce --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndDestroy.cs @@ -0,0 +1,81 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndDestroy : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + private AIPolishConvertedExpression _count; + + private readonly int IS_ALLY_TURN_OFFSET = 1; + + private readonly int COUNT_ARG_OFFSET = 2; + + public bool IsAllyTurn { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 3; + + public AITurnEndDestroy(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + _count = _exprList[_exprList.Count - COUNT_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + int num = (int)_count.EvalArg(tagOwner, playPtn, field, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + if (num > 0) + { + AISkillSimulationUtility.DestroyAll(targetsFromField, field, situation); + } + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + for (int i = 0; i < num; i++) + { + AISkillSimulationUtility.DestroyRandom(targetsFromField, tagOwner, field, playPtn, situation); + } + break; + } + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + AISkillSimulationUtility.DestroyRandom(targetsFromField, tagOwner, field, playPtn, situation, num); + break; + case AIScriptTokenArgType.TARGET_SELECT: + break; + } + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.RANDOM_MULTI_SELECT + }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndDiscard.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndDiscard.cs new file mode 100644 index 0000000..5d0881c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndDiscard.cs @@ -0,0 +1,65 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndDiscard : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + private AIPolishConvertedExpression _discardCountArg; + + private readonly int IS_ALLY_TURN_OFFSET = 1; + + private readonly int DISCARD_COUNT_ARG_OFFSET = 2; + + public bool IsAllyTurn { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 3; + + public AITurnEndDiscard(string text) + : base(text) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + _discardCountArg = _exprList[_exprList.Count - DISCARD_COUNT_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null) + { + int discardCount = (int)_discardCountArg.EvalArg(tagOwner, playPtn, field, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.DiscardAll(tagOwner, targetsFromField, field, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AISkillSimulationUtility.DiscardRandom(tagOwner, field, targetsFromField, discardCount, situation); + break; + } + } + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndDraw.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndDraw.cs new file mode 100644 index 0000000..47fec2c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndDraw.cs @@ -0,0 +1,77 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndDraw : AIScriptArgumentExpressions, IAITurnEndArgument +{ + private AIScriptTokenArgType _drawSide; + + private AIPolishConvertedExpression _drawCount; + + private const int DRAW_SIDE_INDEX = 0; + + private const int DRAW_COUNT_INDEX = 1; + + private const int IS_ALLY_TURN_INDEX = 2; + + private readonly AIScriptTokenArgType[] _legalDrawSideArgs = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALLY, + AIScriptTokenArgType.OPPONENT, + AIScriptTokenArgType.BOTH + }; + + public bool IsAllyTurn { get; private set; } + + public AITurnEndDraw(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _drawSide = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[0], _legalDrawSideArgs); + _drawCount = _exprList[1]; + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), 2); + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + int num = (int)_drawCount.EvalArg(tagOwner, playPtn, field, situation); + if (num > 0) + { + bool flag = false; + bool flag2 = false; + switch (_drawSide) + { + case AIScriptTokenArgType.ALLY: + flag = tagOwner.IsAlly; + flag2 = !tagOwner.IsAlly; + break; + case AIScriptTokenArgType.OPPONENT: + flag2 = tagOwner.IsAlly; + flag = !tagOwner.IsAlly; + break; + case AIScriptTokenArgType.BOTH: + flag = true; + flag2 = true; + break; + } + if (flag) + { + field.DrawCard(isAlly: true, num, playPtn, situation); + } + if (flag2) + { + field.DrawCard(isAlly: false, num, playPtn, situation); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndEvo.cs new file mode 100644 index 0000000..04c7f55 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndEvo.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndEvo : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + private readonly int IS_ALLY_TURN_OFFSET = 1; + + public bool IsAllyTurn { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AITurnEndEvo(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIAutoEvolutionSimulationUtility.AutoEvolution(field, targetsFromField, playPtn, situation, base.SelectType); + } + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndHeal.cs new file mode 100644 index 0000000..da9c159 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndHeal.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndHeal : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + private readonly int HEAL_AMOUNT_OFFSET = 2; + + private readonly int IS_ALLY_TURN_OFFSET = 1; + + public AIPolishConvertedExpression Heal { get; private set; } + + public bool IsAllyTurn { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 3; + + public AITurnEndHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + int count = _exprList.Count; + Heal = _exprList[count - HEAL_AMOUNT_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int heal = (int)Heal.EvalArg(tagOwner, playPtn, field, situation); + AIScriptTokenArgType selectType = base.SelectType; + if (selectType != AIScriptTokenArgType.RANDOM_SELECT && selectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targetsFromField, field, heal, playPtn, situation); + } + } + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndKeywordSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndKeywordSkill.cs new file mode 100644 index 0000000..9598224 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndKeywordSkill.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndKeywordSkill : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + private readonly AIScriptTokenArgType _skillType; + + private AIPolishConvertedExpression _count; + + private readonly int IS_ALLY_TURN_OFFSET = 1; + + private readonly int COUNT_ARG_OFFSET = 2; + + public bool IsAllyTurn { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 3; + + public AITurnEndKeywordSkill(string text, AIScriptTokenArgType skill) + : base(text) + { + _skillType = skill; + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + _count = _exprList[_exprList.Count - COUNT_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.GiveSkillToAll(targetsFromField, field, _skillType); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + int selectCount = (int)_count.EvalArg(tagOwner, playPtn, field, situation); + AISkillSimulationUtility.GiveSkillRandom(targetsFromField, selectCount, field, _skillType); + break; + } + default: + AIConsoleUtility.LogError("AITurnEndKeywordSkill.Execute(): Unexcepted select type."); + break; + } + } + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndMetamorphose.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndMetamorphose.cs new file mode 100644 index 0000000..2f09961 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndMetamorphose.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndMetamorphose : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + private readonly int METAMORPHOSE_ID_OFFSET = 2; + + private readonly int IS_ALLY_TURN_OFFSET = 1; + + public int MetamorphoseCardId { get; private set; } + + public bool IsAllyTurn { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 3; + + public AITurnEndMetamorphose(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + MetamorphoseCardId = _exprList[_exprList.Count - METAMORPHOSE_ID_OFFSET].EvalID(); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIMetamorphoseSimulationUtility.MetamorphoseAll(field, targetsFromField, MetamorphoseCardId, tagOwner, situation); + } + else if (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT) + { + AIMetamorphoseSimulationUtility.MetamorphoseRandom(field, targetsFromField, MetamorphoseCardId, tagOwner, playPtn, situation); + } + } + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndRemoveTag.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndRemoveTag.cs new file mode 100644 index 0000000..08f1aca --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndRemoveTag.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndRemoveTag : AIScriptArgumentExpressions, IAITurnEndArgument, IAIRemoveTagArgument +{ + private const int NEEDS_SPLITED_WORDS_LENGS = 4; + + private const int REMOVE_TAG_START_SPLITED_INDEX = 1; + + private const int IS_ALLY_TURN_ARG_OFFSET = 1; + + public AIPlayTag RemoveTag { get; private set; } + + public bool IsAllyTurn { get; private set; } + + public AITurnEndRemoveTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + if (list == null || list.Count < 4) + { + AIConsoleUtility.LogError("AITurnEndRemoveTag error!! splitedText.Length is not enough"); + return; + } + RemoveTag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + base.InitExpressions(list[0]); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - 1); + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allyInplayStatusList) + { + return 0f; + } + + public void Execute(AIVirtualCard tagOwner, AIVirtualField field, AISituationInfo situation, AIPlayTag executingOwnerTag, List playPtn = null) + { + AIAttachedTagStopPreprocessOption option = new AIAttachedTagStopPreprocessOption(tagOwner) + { + TargetTag = RemoveTag + }; + AIAttachedTagStopPreprocessOption option2 = new AIAttachedTagStopPreprocessOption(tagOwner) + { + TargetTag = executingOwnerTag + }; + if (situation.Actor.IsAlly) + { + field.TagPreprocessContainer.AppendAllyTurnEndStopInfo(option); + field.TagPreprocessContainer.AppendAllyTurnEndStopInfo(option2); + } + else + { + field.TagPreprocessContainer.AppendOpponentTurnEndStopInfo(option); + field.TagPreprocessContainer.AppendOpponentTurnEndStopInfo(option2); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndSetLeaderMaxLife.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndSetLeaderMaxLife.cs new file mode 100644 index 0000000..fcebb16 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndSetLeaderMaxLife.cs @@ -0,0 +1,88 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndSetLeaderMaxLife : AIScriptArgumentExpressions, IAITurnEndArgument +{ + private readonly int IS_ALLY_TURN_OFFSET = 1; + + private readonly int VALUE_OFFSET = 2; + + private readonly int SIDE_OFFSET = 3; + + private AIScriptTokenArgType _side; + + private AIPolishConvertedExpression _life; + + public bool IsAllyTurn { get; private set; } + + public AITurnEndSetLeaderMaxLife(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + _side = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SIDE_OFFSET]); + _life = _exprList[_exprList.Count - VALUE_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + int maxLife = (int)_life.EvalArg(tagOwner, playPtn, field, situation); + AISetStatusSimulationUtility.SetLeaderMaxLife(tagOwner, maxLife, _side, field, situation); + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + AIVirtualField selfField = tagOwner.SelfField; + (AIVirtualCard, AIVirtualCard) targetSideLeaders = AISetStatusSimulationUtility.GetTargetSideLeaders(tagOwner, selfField); + if (targetSideLeaders.Item1 == null || targetSideLeaders.Item2 == null) + { + AIConsoleUtility.LogError("AITurnEndSetLeaderMaxLife.CalculateThreaten(): Failed to get the leader."); + return 0f; + } + int changeLife = (int)_life.EvalArg(tagOwner, EnemyAI.EmptyPlayPtn, selfField); + float num = 0f; + switch (_side) + { + case AIScriptTokenArgType.ALLY: + num += CalculateTargetLeader(tagOwner, targetSideLeaders.Item1, selfField, changeLife, ref allInplayStatusList); + break; + case AIScriptTokenArgType.OPPONENT: + num += CalculateTargetLeader(tagOwner, targetSideLeaders.Item2, selfField, changeLife, ref allInplayStatusList); + break; + case AIScriptTokenArgType.BOTH: + num += CalculateTargetLeader(tagOwner, targetSideLeaders.Item1, selfField, changeLife, ref allInplayStatusList); + num += CalculateTargetLeader(tagOwner, targetSideLeaders.Item2, selfField, changeLife, ref allInplayStatusList); + break; + default: + AIConsoleUtility.LogError($"AITurnEndSetLeaderMaxLife.CalculateThreaten(): Unexpected side type. type:{_side}"); + break; + } + return num; + } + + private float CalculateTargetLeader(AIVirtualCard tagOwner, AIVirtualCard leader, AIVirtualField field, int changeLife, ref Tuple[] allInplayStatusList) + { + int num = field.CardListSet.BothClassAndInplayCards.IndexOf(leader); + int second = allInplayStatusList[num].second; + if (second <= 0) + { + return 0f; + } + if (changeLife < 0) + { + changeLife = 0; + } + float result = 0f; + if (changeLife < second) + { + result = AILeaderLifeEvaluationUtility.Evaluate(changeLife, second, leader.IsAlly, tagOwner.IsAlly); + allInplayStatusList[num].second = changeLife; + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndShield.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndShield.cs new file mode 100644 index 0000000..f96366d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndShield.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndShield : AITurnEndBarrierBase +{ + protected override int _defaultDamageTypeOffset => 3; + + protected override int _stopTimingOffset => 2; + + public AITurnEndShield(string text) + : base(text) + { + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIBarrierSimulationUtility.AddShieldToAll(targets, tagOwner, field, _damageType, _stopTiming); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndSubtractCountdown.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndSubtractCountdown.cs new file mode 100644 index 0000000..623a0a8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndSubtractCountdown.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndSubtractCountdown : AIFiltersAndSelectTypeArgument, IAITurnEndArgument +{ + private readonly int COUNT_ARG_OFFSET = 2; + + private readonly int IS_ALLY_TURN_OFFSET = 1; + + public AIPolishConvertedExpression CountDown { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 3; + + public bool IsAllyTurn { get; private set; } + + public AITurnEndSubtractCountdown(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - IS_ALLY_TURN_OFFSET); + CountDown = _exprList[_exprList.Count - COUNT_ARG_OFFSET]; + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + base.Execute(tagOwner, field, playPtn, situation); + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int value = (int)CountDown.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + AISubtractCountdownSimulationUtility.SubtractCountdownAll(targetsFromField, value, situation); + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForCountdownAmuletOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.AllyInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndToken.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndToken.cs new file mode 100644 index 0000000..4a51893 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndToken.cs @@ -0,0 +1,72 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnEndToken : AIFiltersArgument, IAITurnEndArgument +{ + private AIScriptTokenArgType _tokenSide; + + private AIPolishConvertedExpression _tokenCount; + + private const int DEFAULT_TOKEN_COUNT_INDEX_OFFSET = 3; + + private const int DEFAULT_IS_ALLY_TURN_OFFSET = 2; + + private const int TOKEN_SIDE_INDEX_OFFSET = 1; + + private int _realTokenCountIndexOffset; + + public bool IsAllyTurn { get; private set; } + + protected override int NON_FILTER_FIRST_OFFSET => _realTokenCountIndexOffset; + + public AITurnEndToken(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + int num = 0; + if (AIPlayTagInitializingUtility.TryCreateTokenSideType(_exprList[_exprList.Count - 1], out var sideType)) + { + _tokenSide = sideType; + } + else + { + _tokenSide = AIScriptTokenArgType.ALLY; + num = 1; + } + int num2 = 2 - num; + IsAllyTurn = TurnEndTagCollection.IsAllyTurn(_exprList, GetType(), _exprList.Count - num2); + _realTokenCountIndexOffset = 3 - num; + _tokenCount = _exprList[_exprList.Count - _realTokenCountIndexOffset]; + InitializeFilter(); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AISummonTokenUtility.ExecuteSummonToken(GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false), base.Filters, _tokenCount, _tokenSide, tagOwner, field, playPtn, situation); + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList) + { + return 0f; + } + + protected override AITokenIdCollection CreateRegisterTokenPoolInfo(AIVirtualCard owner, List idList) + { + return AISummonTokenUtility.CreateTokenIdCollectionFromIdList(owner, _tokenSide, idList, AITokenType.Default); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnStartAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnStartAttachTag.cs new file mode 100644 index 0000000..bb98562 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnStartAttachTag.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnStartAttachTag : AITurnStartTagArgument +{ + private AIPolishConvertedExpression _selectCountArg; + + private const int SELECT_COUNT_OFFSET = 3; + + private const int REMOVE_TIMING_OFFSET = 2; + + private const int TAG_WORD_START_INDEX = 1; + + public AIScriptTokenArgType RemoveTiming { get; private set; } + + public AIPlayTag Tag { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 4; + + public AITurnStartAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + RemoveTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2]); + _selectCountArg = _exprList[_exprList.Count - 3]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targetsFromField, tagOwner, Tag, RemoveTiming, situation); + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (Tag != null) + { + return Tag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnStartBarrierBase.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnStartBarrierBase.cs new file mode 100644 index 0000000..e2be084 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnStartBarrierBase.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; + +namespace Wizard; + +public abstract class AITurnStartBarrierBase : AITurnStartTagArgument +{ + protected AIScriptTokenArgType _stopTiming; + + protected AIScriptTokenArgType _damageType; + + private bool _isDamageTypeDefinedByMaster; + + protected abstract int _defaultDamageTypeOffset { get; } + + protected abstract int _stopTimingOffset { get; } + + protected override int SELECT_TYPE_OFFSET => 1 + (_isDamageTypeDefinedByMaster ? _defaultDamageTypeOffset : _stopTimingOffset); + + public AITurnStartBarrierBase(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - _stopTimingOffset]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - _defaultDamageTypeOffset], out _isDamageTypeDefinedByMaster); + InitSelectType(); + InitializeFilter(); + InitSideType(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + GiveBarrierToAllTargets(targetsFromField, tagOwner, field, playPtn, situation); + } + } + + protected abstract void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnStartDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnStartDamage.cs new file mode 100644 index 0000000..084d287 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnStartDamage.cs @@ -0,0 +1,87 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnStartDamage : AITurnStartTagArgument +{ + private AIPolishConvertedExpression _damageAmount; + + private AIPolishConvertedExpression _damageCount; + + private const int DAMAGE_AMOUNT_ARG_OFFSET = 3; + + private const int DAMAGE_COUNT_ARG_OFFSET = 2; + + protected override int SELECT_TYPE_OFFSET => 4; + + public AITurnStartDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _damageAmount = _exprList[_exprList.Count - 3]; + _damageCount = _exprList[_exprList.Count - 2]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + int damageAmount = GetDamageAmount(tagOwner, field, playPtn, situation); + int damageCount = GetDamageCount(tagOwner, field, playPtn, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + { + for (int j = 0; j < damageCount; j++) + { + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, damageAmount, situation); + } + break; + } + case AIScriptTokenArgType.RANDOM_SELECT: + { + for (int i = 0; i < damageCount; i++) + { + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, damageAmount, situation); + } + break; + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT + }; + } + + private int GetDamageAmount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_damageAmount == null) + { + AIConsoleUtility.LogError("AITurnStartDamage.GetDamageAmount() error!! _damageAmount is null"); + return 0; + } + return (int)_damageAmount.EvalArg(tagOwner, playPtn, field, situation); + } + + private int GetDamageCount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_damageAmount == null) + { + AIConsoleUtility.LogError("AITurnStartDamage.GetDamageCount() error!! _damageAmount is null"); + return 0; + } + return (int)_damageCount.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnStartDamageCut.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnStartDamageCut.cs new file mode 100644 index 0000000..010965d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnStartDamageCut.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnStartDamageCut : AITurnStartBarrierBase +{ + private AIPolishConvertedExpression _cutAmount; + + private const int CUT_AMOUNT_OFFSET = 2; + + protected override int _stopTimingOffset => 3; + + protected override int _defaultDamageTypeOffset => 4; + + public AITurnStartDamageCut(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _cutAmount = _exprList[_exprList.Count - 2]; + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int cutAmount = (int)_cutAmount.EvalArg(tagOwner, playPtn, field, situation); + AIBarrierSimulationUtility.AddDamageCutToAll(targets, tagOwner, field, _damageType, _stopTiming, cutAmount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnStartShield.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnStartShield.cs new file mode 100644 index 0000000..0e35d7e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnStartShield.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnStartShield : AITurnStartBarrierBase +{ + protected override int _stopTimingOffset => 2; + + protected override int _defaultDamageTypeOffset => 3; + + public AITurnStartShield(string text) + : base(text) + { + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIBarrierSimulationUtility.AddShieldToAll(targets, tagOwner, field, _damageType, _stopTiming); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnStartSubtractCountdown.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnStartSubtractCountdown.cs new file mode 100644 index 0000000..fef55fc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnStartSubtractCountdown.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITurnStartSubtractCountdown : AITurnStartTagArgument +{ + private readonly int COUNT_ARG_OFFSET = 2; + + public AIPolishConvertedExpression CountDown { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 3; + + public AITurnStartSubtractCountdown(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + CountDown = _exprList[_exprList.Count - COUNT_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int value = (int)CountDown.EvalArg(tagOwner, playPtn, field); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISubtractCountdownSimulationUtility.SubtractCountdownAll(targetsFromField, value, situation); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnStartTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnStartTagArgument.cs new file mode 100644 index 0000000..ce02079 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnStartTagArgument.cs @@ -0,0 +1,42 @@ +namespace Wizard; + +public class AITurnStartTagArgument : AIFiltersAndSelectTypeArgument +{ + private AIScriptTokenArgType _sideType; + + private readonly int SIDETYPE_OFFSET = 1; + + private readonly AIScriptTokenArgType[] _legalSideTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.BOTH, + AIScriptTokenArgType.ALLY, + AIScriptTokenArgType.OPPONENT + }; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AITurnStartTagArgument(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + InitSideType(); + } + + protected virtual void InitSideType() + { + _sideType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - SIDETYPE_OFFSET], _legalSideTypes); + } + + public bool CheckTurnStartSide(AIScriptTokenArgType turnStartSide) + { + if (_sideType == AIScriptTokenArgType.BOTH) + { + return true; + } + return _sideType == turnStartSide; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIUnknownAction.cs b/SVSim.BattleEngine/Engine/Wizard/AIUnknownAction.cs new file mode 100644 index 0000000..4200213 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIUnknownAction.cs @@ -0,0 +1,9 @@ +namespace Wizard; + +public class AIUnknownAction : AISituationInfo +{ + public AIUnknownAction(AIVirtualCard actor) + : base(actor, null, null, AIOperationType.UNKNOWN) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIUntouchableLeaveStopInformation.cs b/SVSim.BattleEngine/Engine/Wizard/AIUntouchableLeaveStopInformation.cs new file mode 100644 index 0000000..4a06566 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIUntouchableLeaveStopInformation.cs @@ -0,0 +1,15 @@ +namespace Wizard; + +public class AIUntouchableLeaveStopInformation : AILeaveStopInformation +{ + public AIUntouchableLeaveStopInformation(AITagPreprocessCreationOptionBase option, AIVirtualCard provider) + : base(option.TargetCard, provider) + { + base.Type = AITagPreprocessInfoType.UNTOUCHABLE_STOP; + } + + protected override void StopMethod(AISituationInfo situation) + { + base.TargetCard.SubUntouchableCount(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIUseMinArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIUseMinArgument.cs new file mode 100644 index 0000000..fe11864 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIUseMinArgument.cs @@ -0,0 +1,30 @@ +namespace Wizard; + +public class AIUseMinArgument : AIScriptArgumentExpressions +{ + public bool IsUseMin { get; private set; } + + protected virtual int USE_MIN_INDEX_OFFSET => 1; + + public AIUseMinArgument(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + AIPolishConvertedExpression aIPolishConvertedExpression = _exprList[_exprList.Count - USE_MIN_INDEX_OFFSET]; + if (aIPolishConvertedExpression.TokenList[0] is AIScriptArgumentToken && aIPolishConvertedExpression.TokenList.Count < 2) + { + if ((aIPolishConvertedExpression.TokenList[0] as AIScriptArgumentToken).ArgumentType == AIScriptTokenArgType.USE_MIN) + { + IsUseMin = true; + } + else + { + IsUseMin = false; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualAttackSimulator.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualAttackSimulator.cs new file mode 100644 index 0000000..98c049a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualAttackSimulator.cs @@ -0,0 +1,151 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIVirtualAttackSimulator +{ + public static void Attack(AIVirtualAttackInfo situation, AIVirtualField field) + { + situation.IsAttackSuccessed = false; + if (situation.ActionType == AIOperationType.ATTACK && AIAttackSimulationUtility.IsAttackPossible(field, situation)) + { + AIVirtualCard actor = situation.Actor; + _ = situation.AttackTarget; + actor.AttackableCount--; + field.ActionLength++; + situation.IsAttackSuccessed = true; + field.ApplyAttackBonus(situation); + field.ApplyClashBonus(situation); + AIPreprocessSimulationUtility.SimulatePreprocess(actor, situation, field, AIScriptTokenArgType.WHEN_ATTACK, isPseudo: false); + SimulateSkillsBeforeAttackCalculation(situation, field); + field.AllActivateCountHolderIncrement(situation, AIPlayTagType.AttackActivateCount, actor); + situation.ProcessCollection.CombinePreprocessToProcessQueue(); + situation.ExecuteAllSkillProcess(); + if (field.AllyClass.Life > 0 && field.EnemyClass.Life > 0) + { + ApplyAttackActionToTargetAndAttacker(situation, field); + } + } + } + + private static void ApplyAttackActionToTargetAndAttacker(AIVirtualAttackInfo situation, AIVirtualField field) + { + if (situation.AttackTarget.IsLeader) + { + AttackLeaderDamageCalculation(situation, field); + } + else + { + AttackFollowerDamageCalculation(situation, field); + } + } + + private static void AttackFollowerDamageCalculation(AIVirtualAttackInfo situation, AIVirtualField field) + { + AIVirtualCard actor = situation.Actor; + AIVirtualCard attackTarget = situation.AttackTarget; + _ = field.BestPlayPtn; + if (!actor.IsDead && !attackTarget.IsDead) + { + int attackerAtk = actor.Attack; + int targetAtk = attackTarget.Attack; + AIAttackTagSimulator.ExecuteAttackByLife(field, actor, attackTarget, ref attackerAtk, ref targetAtk); + attackerAtk = actor.SimulateAttackAmount(situation); + targetAtk = attackTarget.SimulateAttackAmount(situation); + int attackDamage = attackTarget.AddDamage(situation, attackerAtk, isSkillDamage: false); + int defendDamage = actor.AddDamage(situation, targetAtk, isSkillDamage: false); + situation.ExecuteAllSkillProcess(); + if (attackTarget.IsDead) + { + attackTarget.RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: false); + } + if (actor.IsDead) + { + actor.RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: false); + } + ExecAfterClashSkills(situation, field, attackDamage, defendDamage); + situation.ExecuteAllSkillProcess(); + } + } + + private static void AttackLeaderDamageCalculation(AIVirtualAttackInfo situation, AIVirtualField field) + { + AIVirtualCard actor = situation.Actor; + AIVirtualCard attackTarget = situation.AttackTarget; + List bestPlayPtn = field.BestPlayPtn; + if (actor.Life <= 0) + { + return; + } + int baseDamage = actor.SimulateAttackAmount(situation); + actor.DepriveSneakWithGiveSneakTag(); + int damage = attackTarget.AddDamage(situation, baseDamage, isSkillDamage: false); + if (attackTarget.IsDead) + { + attackTarget.RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: false); + } + if (field.AllyClass.Life > 0 && field.EnemyClass.Life > 0) + { + actor.DealDamageDrain(damage, bestPlayPtn, situation); + situation.ExecuteAllSkillProcess(); + if (actor.Life <= 0) + { + actor.RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: false); + } + if (!actor.IsDead) + { + AIAttackTagSimulator.ApplyOtherAfterAttackOrClashTags(field, situation); + situation.ExecuteAllSkillProcess(); + } + } + } + + private static void SimulateWhenAttackAndWhenFightSkills(AIVirtualAttackInfo situation, AIVirtualField field) + { + AIVirtualCard actor = situation.Actor; + actor.IsNotAttackYet = false; + if (actor.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenAttack)) + { + actor.TagCollectionContainer.AttackTags.RegisterConditionPassedTagProgress(field, actor, situation); + } + AIVirtualCard attackTarget = situation.AttackTarget; + if (attackTarget.IsUnit && attackTarget.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenAttack)) + { + AttackTagCollection attackTags = attackTarget.TagCollectionContainer.AttackTags; + if (attackTags.HasClashTag) + { + attackTags.RegisterConditionPassedTagProgress(field, attackTarget, situation); + } + } + } + + private static void SimulateWhenAttackSelfAndOtherSkills(AIVirtualAttackInfo situation, AIVirtualField field) + { + field.RegisterOtherCardAttackTags(situation); + } + + public static void SimulateSkillsBeforeAttackCalculation(AIVirtualAttackInfo situation, AIVirtualField field) + { + AIVirtualCard actor = situation.Actor; + AIVirtualCard attackTarget = situation.AttackTarget; + if (!actor.IsDead && !attackTarget.IsDead && situation.ActionType == AIOperationType.ATTACK) + { + SimulateWhenAttackAndWhenFightSkills(situation, field); + SimulateWhenAttackSelfAndOtherSkills(situation, field); + if (attackTarget.IsUnit && actor.SelfField.AllyClass.Life > 0 && actor.SelfField.EnemyClass.Life > 0) + { + _ = attackTarget.IsDead; + } + } + } + + private static void ExecAfterClashSkills(AIVirtualAttackInfo situation, AIVirtualField field, int attackDamage, int defendDamage) + { + AIVirtualCard actor = situation.Actor; + AIVirtualCard attackTarget = situation.AttackTarget; + List bestPlayPtn = field.BestPlayPtn; + actor.AfterClash(attackTarget, attackDamage, isAttacker: true, bestPlayPtn, situation); + attackTarget.AfterClash(actor, defendDamage, isAttacker: false, bestPlayPtn, situation); + AIAttackTagSimulator.ApplyOtherAfterAttackOrClashTags(field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualCardStatusInfo.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualCardStatusInfo.cs new file mode 100644 index 0000000..59346e5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualCardStatusInfo.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIVirtualCardStatusInfo +{ + public AIVirtualCard BaseCard { get; private set; } + + public int Attack { get; private set; } + + public int Life { get; private set; } + + public float ValueWhenDestroyed { get; private set; } + + public AIVirtualCardStatusInfo(AIVirtualCard card, int attack, int life) + { + BaseCard = card; + Attack = attack; + Life = life; + ValueWhenDestroyed = 0f; + } + + public void CalculateCardValueWhenDestroyed(List playPtn, AISituationInfo situation) + { + int attack = BaseCard.Attack; + int life = BaseCard.Life; + BaseCard.Attack = Attack; + BaseCard.Life = Life; + ValueWhenDestroyed = BaseCard.EvaluateValueOnField(playPtn, situation, useStyle: true) - BaseCard.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) - BaseCard.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false); + BaseCard.Attack = attack; + BaseCard.Life = life; + } + + public void ModifyStatus(int attack, int life) + { + Attack = attack; + Life = life; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualEvolutionSimulator.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualEvolutionSimulator.cs new file mode 100644 index 0000000..9887375 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualEvolutionSimulator.cs @@ -0,0 +1,82 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIVirtualEvolutionSimulator +{ + private static int EVOLUTION_ACTION_LENGTH_BONUS = 3; + + public static void AutoEvolve(AIVirtualCard evolver, AIVirtualField field, AISituationInfo situation) + { + evolver.EvolveStatusUp(); + List bestPlayPtn = field.BestPlayPtn; + evolver.EnqueueGiveSkill(field, bestPlayPtn, situation); + field.ExecuteWhenChangeInplayTags(bestPlayPtn, situation); + field.ApplyOtherEvolveTags(situation, evolver); + if (evolver.TagCollectionContainer.HasTagCollection(TagCollectionType.EvolvedResident)) + { + evolver.TagCollectionContainer.EvolvedResidentTags.Execute(evolver, situation); + } + IncrementEvolutionCount(field, evolver); + if (evolver.IsNotAttackYet) + { + field.EvoBonus += AIEvaluateBonusFromOhterUtility.GetAllOtherEvoBonus(situation, bestPlayPtn); + } + } + + public static void ManualEvolve(AIVirtualActionInfo situation, AIVirtualField field) + { + AIVirtualCard actor = situation.Actor; + List bestPlayPtn = field.BestPlayPtn; + actor.PreparateOtherToEvolve(field, bestPlayPtn, situation); + AIPreprocessSimulationUtility.SimulatePreprocess(actor, situation, field, AIScriptTokenArgType.WHEN_EVO, isPseudo: false); + if (actor.IsAlly) + { + field.EpValue = field.StyleQuery.GetEpValue(situation, bestPlayPtn); + field.EvoHandPlus = actor.GetEvoHandPlusCount(field, bestPlayPtn, situation); + if (!actor.IsNotConsumeEp) + { + field.AllyEvolutionCount--; + field.UsedEpCount++; + } + } + actor.EvolveStatusUp(); + actor.SelfField.IsLeftTurnEvol = false; + actor.EnqueueGiveSkill(field, bestPlayPtn, situation); + if (actor.IsAlly && actor.IsNotAttackYet) + { + field.EvoBonus += actor.GetEvoBonus(field.BestPlayPtn, situation); + field.EvoBonus += AIEvaluateBonusFromOhterUtility.GetAllOtherEvoBonus(situation, field.BestPlayPtn); + } + field.ExecuteWhenChangeInplayTags(bestPlayPtn, situation); + if (actor.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenEvo)) + { + actor.TagCollectionContainer.EvoTags.Execute(field, actor, actor, situation); + } + situation.ProcessCollection.CombinePreprocessToProcessQueue(); + field.ApplyOtherEvolveTags(situation, actor); + if (actor.TagCollectionContainer.HasTagCollection(TagCollectionType.EvolvedResident)) + { + actor.TagCollectionContainer.EvolvedResidentTags.Execute(actor, situation); + } + field.AllActivateCountHolderIncrement(situation, AIPlayTagType.EvoActivateCount, actor); + situation.ExecuteAllSkillProcess(); + IncrementEvolutionCount(field, actor); + if (actor.IsAlly) + { + field.ActionLength += EVOLUTION_ACTION_LENGTH_BONUS; + } + } + + private static void IncrementEvolutionCount(AIVirtualField field, AIVirtualCard evolver) + { + if (evolver.IsAlly) + { + field.AllyEvolvedCountInGame++; + } + else + { + field.EnemyEvolvedCountInGame++; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualPlaySimulator.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualPlaySimulator.cs new file mode 100644 index 0000000..25638bb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualPlaySimulator.cs @@ -0,0 +1,103 @@ +namespace Wizard; + +public static class AIVirtualPlaySimulator +{ + public static void PlayCard(AIVirtualTargetSelectAction situation, AIVirtualField field, PlaySimulationInfo playInfo) + { + if (situation.ActionType != AIOperationType.PLAY) + { + AIConsoleUtility.LogError("AIVirtualPlaySimulator:PlayCard() error!! situation is not [PLAY] ActionType!!!!!"); + return; + } + if (playInfo == null) + { + AIConsoleUtility.LogError($"AIVirtualPlaySimulator:PlayCard() error!! PlayInfo is null!\nMaybe field does not have enough cost!!!!! PlayCardName:{situation.Actor.CardName} PlayCardId:{situation.Actor.BaseId}"); + return; + } + AIVirtualCard originalCard = situation.OriginalCard; + int useCost = playInfo.UseCost; + if (playInfo.Type == PlaySimulationType.ChoiceTransform) + { + AIPlayCardSimulationUtility.SetChoiceTargetAsActor(situation); + } + originalCard.PlayedCost = useCost; + if (originalCard.IsAlly) + { + field.AllyPp -= useCost; + field.UsedPpCount += useCost; + } + else + { + field.EnemyPp -= useCost; + } + bool isChoiceBrave = situation.IsChoiceBrave; + AIVirtualCard summonedCard = null; + if (!isChoiceBrave) + { + SimulatePlayCardNormal(situation, field, out summonedCard); + } + AIPreprocessSimulationUtility.SimulatePreprocess(situation.Actor, situation, field, AIScriptTokenArgType.WHEN_PLAY, isPseudo: false); + AIPlayCardSimulationUtility.CreateWhenPlayTagExecutingQueue(situation, field, playInfo.Type); + situation.ProcessCollection.CombinePreprocessToProcessQueue(); + if (summonedCard != null) + { + AISummonTokenUtility.ExecuteSummonTags(field, summonedCard, field.BestPlayPtn, situation); + AIGetOnSimulationUtility.GetOnAtField(field, summonedCard, situation); + field.AllActivateCountHolderIncrement(situation, AIPlayTagType.SummonActivateCount, summonedCard); + } + if (!isChoiceBrave) + { + field.AllActivateCountHolderIncrement(situation, AIPlayTagType.PlayActivateCount, originalCard); + } + situation.ExecuteAllSkillProcess(); + } + + private static void SimulatePlayCardNormal(AISituationInfo play, AIVirtualField field, out AIVirtualCard summonedCard) + { + AIVirtualCard originalCard = play.OriginalCard; + if (originalCard.IsAlly) + { + field.RemoveAllyHandCard(originalCard, isRemoveByPlay: true); + } + else + { + field.RemoveEnemyHandCard(originalCard); + } + AIVirtualCard actor = play.Actor; + field.PlayedCardContainer.AddPlayedCard(actor); + if (actor.IsUnit || actor.IsAmulet) + { + if (actor.IsAlly) + { + actor.NormalPlay(); + field.AllyInplayCards.Add(actor); + field.CardListSet.AddAllyInplayCard(actor); + field.SummonedCardContainer.AddSummonedCard(actor); + } + else + { + AIVirtualCard aIVirtualCard; + if (actor is EnemyHandVirtualCard) + { + aIVirtualCard = new AIVirtualCard(actor.BaseCard, field); + aIVirtualCard.InitializeTags(field.ParamQuery, actor.TagCollectionContainer.AttachedTags, actor.TagCollectionContainer.RemovedTagCollection); + } + else + { + aIVirtualCard = actor; + } + aIVirtualCard.NormalPlay(); + field.EnemyInplayCards.Add(aIVirtualCard); + field.CardListSet.AddEnemyInplayCard(aIVirtualCard); + field.SummonedCardContainer.AddSummonedCard(actor); + play.SetActor(aIVirtualCard); + } + summonedCard = actor; + } + else + { + AISpellboostSimulationUtility.SpellboostWhenPlaySpell(actor, field); + summonedCard = null; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualTargetSelectSimulationInfo.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualTargetSelectSimulationInfo.cs new file mode 100644 index 0000000..766c7f7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualTargetSelectSimulationInfo.cs @@ -0,0 +1,105 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIVirtualTargetSelectSimulationInfo +{ + public AIVirtualCard OriginalActor; + + public AIVirtualCard RealActor; + + public List SelectInfoList; + + public AIOperationType OperationType; + + public PlayedCardInfo NextPlayCardInfo; + + public AISelectedTargetInfoSet FirstActionTargetTemp; + + public bool IsFirstAction; + + public AISelectedTargetInfoSet CurrentSimulationBestTargetTemp; + + public float FieldValueAfterFirstSelectCardPlay; + + public float CurrentSimulationBestTargetTempValue; + + public bool IsRecentlyUpdatedCurrentSimulationBestTargetTempValue; + + private bool _isNextPlay; + + public float PrevRemovalBonus; + + public bool IsInterruptedNextPlay { get; private set; } + + public AIVirtualTargetSelectSimulationInfo() + { + FieldValueAfterFirstSelectCardPlay = float.MinValue; + CurrentSimulationBestTargetTempValue = float.MinValue; + IsRecentlyUpdatedCurrentSimulationBestTargetTempValue = false; + } + + public AIVirtualTargetSelectAction CreateSituationForTargetSelectSimulation() + { + return new AIVirtualTargetSelectAction(RealActor, OriginalActor, OperationType); + } + + public AIVirtualTargetSelectSimulationInfo CreateNextPlayCardTargetSelectSimulationInfo(AIVirtualField field, float prevRemovalBonus) + { + if (NextPlayCardInfo == null) + { + return null; + } + AIVirtualCard aIVirtualCard = field.SearchVirtualCard(NextPlayCardInfo.Card); + if (aIVirtualCard == null) + { + return null; + } + AIVirtualCard aIVirtualCard2 = NextPlayCardInfo.TransformCard ?? aIVirtualCard; + AIVirtualTargetSelectAction aIVirtualTargetSelectAction = new AIVirtualTargetSelectAction(aIVirtualCard2, aIVirtualCard, AIOperationType.PLAY, (AISelectedTargetInfoSet)null); + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + int playSpaceRequired = field.GetPlaySpaceRequired(aIVirtualCard, emptyPlayPtn, aIVirtualTargetSelectAction, needsTokenCount: false); + if (!aIVirtualCard.IsAbleToPlay(emptyPlayPtn, aIVirtualTargetSelectAction) || field.AllyInplayCards.Count + playSpaceRequired > 5) + { + return null; + } + List list = aIVirtualCard2.CreateAIVirtualSelectInfo(field, aIVirtualTargetSelectAction); + if (list == null || list.Count <= 0) + { + return null; + } + return new AIVirtualTargetSelectSimulationInfo + { + OriginalActor = aIVirtualCard, + RealActor = aIVirtualCard2, + SelectInfoList = list, + OperationType = AIOperationType.PLAY, + NextPlayCardInfo = null, + FirstActionTargetTemp = FirstActionTargetTemp, + IsFirstAction = false, + _isNextPlay = true, + PrevRemovalBonus = prevRemovalBonus + }; + } + + public void IsCurrentSimulationBestTargetTempNeedsToUpdated(float maxFieldValue) + { + if (EnemyAI.IsLargerThan(maxFieldValue, CurrentSimulationBestTargetTempValue)) + { + CurrentSimulationBestTargetTempValue = maxFieldValue; + IsRecentlyUpdatedCurrentSimulationBestTargetTempValue = true; + } + else + { + IsRecentlyUpdatedCurrentSimulationBestTargetTempValue = false; + } + } + + public void ForceStopNextPlay() + { + if (_isNextPlay) + { + IsInterruptedNextPlay = true; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualTargetSelectSimulator.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualTargetSelectSimulator.cs new file mode 100644 index 0000000..550763c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualTargetSelectSimulator.cs @@ -0,0 +1,469 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public static class AIVirtualTargetSelectSimulator +{ + public static IEnumerator ExecuteTargetSelect(AIVirtualTargetSelectSimulationInfo simulationInfo, AIVirtualField field, AISinglePlayptnRecord playPtnRecord) + { + SimulationResult result = new SimulationResult(); + yield return EnemyAICoroutine.GetInstance().StartCoroutine(SimulateTargetSelect(simulationInfo, field, playPtnRecord, result, isBattleSim: false)); + AIVirtualCard originalActor = simulationInfo.OriginalActor; + AIOperationType operationType = simulationInfo.OperationType; + field.AI.OprTargetSelect(originalActor, result.SelectedTargets, operationType); + } + + public static IEnumerator SimulateTargetSelect(AIVirtualTargetSelectSimulationInfo simulationInfo, AIVirtualField field, AISinglePlayptnRecord playPtnRecord, SimulationResult result, bool isBattleSim) + { + List selectInfoList = simulationInfo.SelectInfoList; + if (selectInfoList == null || selectInfoList.Count <= 0) + { + simulationInfo.ForceStopNextPlay(); + AIConsoleUtility.LogError("SimulateTargetSelect error!! no candidates!!!!!"); + yield break; + } + AIVirtualTargetSelectAction action = simulationInfo.CreateSituationForTargetSelectSimulation(); + AISelectedTargetInfoSet preDecidedTargets = field.AI.PreDecidedTargets; + List allTargetPattern = GetAllTargetSelectSimulationPattern(selectInfoList, preDecidedTargets, action, field, playPtnRecord); + if (allTargetPattern == null || allTargetPattern.Count <= 0) + { + simulationInfo.ForceStopNextPlay(); + yield break; + } + bool isSecondTargetForbbidenSelectedTarget = selectInfoList.Count > 1 && selectInfoList[1].IsForbiddenSelectedTarget; + for (int i = 0; i < allTargetPattern.Count; i++) + { + AISelectedTargetInfoSet currentPattern = allTargetPattern[i]; + AISelectedTargetInfoSet previousBestPattern; + if (simulationInfo.IsFirstAction) + { + simulationInfo.FirstActionTargetTemp = currentPattern; + previousBestPattern = result.SelectedTargets; + } + else + { + previousBestPattern = simulationInfo.CurrentSimulationBestTargetTemp; + } + if (!IsAbleToReplaceDummyTarget(currentPattern, previousBestPattern, isSecondTargetForbbidenSelectedTarget)) + { + continue; + } + if (!currentPattern.IsTargetExist(0) && currentPattern.IsTargetExist(1)) + { + AIConsoleUtility.LogError("currentPattern.firstTarget is null & secondTaget is not null"); + continue; + } + AIVirtualField aIVirtualField = new AIVirtualField(field) + { + BestPlayPtn = new List(playPtnRecord.PlayPtn) + }; + AIVirtualCard aIVirtualCard = aIVirtualField.SearchVirtualCard(action.OriginalCard); + AIVirtualCard actor = action.Actor; + AIVirtualTargetSelectAction action2 = new AIVirtualTargetSelectAction(actor.IsSameCard(aIVirtualCard) ? aIVirtualCard : new AIVirtualCard(actor, aIVirtualField), selectedTargetList: currentPattern.GetSimilarTargetInfoSet(aIVirtualField), original: aIVirtualCard, operationType: action.ActionType); + yield return SimulateSinglePattern(action2, simulationInfo, aIVirtualField, result, playPtnRecord, isBattleSim); + if (result.IsRecentlyUpdated) + { + result.SelectedTargets = simulationInfo.FirstActionTargetTemp; + simulationInfo.CurrentSimulationBestTargetTemp = currentPattern; + if (result.IsLethalPlan) + { + break; + } + } + else if (simulationInfo.IsRecentlyUpdatedCurrentSimulationBestTargetTempValue) + { + simulationInfo.CurrentSimulationBestTargetTemp = currentPattern; + } + } + } + + private static IEnumerator SimulateSinglePattern(AIVirtualTargetSelectAction action, AIVirtualTargetSelectSimulationInfo simulationInfo, AIVirtualField field, SimulationResult result, AISinglePlayptnRecord playPtnRecord, bool isBattleSim) + { + AIVirtualTargetSelectAction aIVirtualTargetSelectAction = null; + switch (action.ActionType) + { + case AIOperationType.EVOLVE: + if (!isBattleSim) + { + AIVirtualEvolutionSimulator.ManualEvolve(action, field); + } + else + { + aIVirtualTargetSelectAction = action; + } + break; + case AIOperationType.PLAY: + { + PlaySimulationInfo playInfo = AIPlayCardSimulationUtility.CreatePlaySimulationInfo(action.OriginalCard, action, field); + AIVirtualPlaySimulator.PlayCard(action, field, playInfo); + break; + } + default: + throw new NotImplementedException(); + } + float removalBonus = GetRemovalBonus(action.SelectedTargets) + simulationInfo.PrevRemovalBonus; + if (!isBattleSim && field.EnemyClass.Life <= 0) + { + result.MaxFieldValue = EnemyAI_Skill.PLAYOUT_VALUE; + result.IsLethalPlan = true; + result.MaxFieldValueAtSelfTurnEnd = result.MaxFieldValue; + result.MaxFieldValueFirstSkill = result.MaxFieldValue; + result.IsRecentlyUpdated = true; + result.FirstActionInfo = new AIVirtualTargetSelectAction(action.Actor, action.OriginalCard, action.ActionType, action.SelectedTargets); + result.BestResultField = field; + yield break; + } + EnemyAI ai = field.AI; + result.IsRecentlyUpdated = false; + SimulationAdditionalActionInfoSet additionalActionInfoSet = new SimulationAdditionalActionInfoSet + { + ForceEvoAction = aIVirtualTargetSelectAction, + ExtraActionBaseList = null, + PlayPtnRecord = playPtnRecord + }; + AIBattleSimulationLauncher battleSimLauncher = new AIBattleSimulationLauncher(field, ai, aIVirtualTargetSelectAction == null, null, additionalActionInfoSet); + yield return battleSimLauncher.ExecuteBattleSimulationAI(null, checkTimeOverLogic: true); + IBattleSimulationAI battleSimulationAI = battleSimLauncher.BattleSimAI; + float valueWithBonusPoint = battleSimulationAI.Cr_MaxFieldValue + removalBonus; + AIVirtualTargetSelectSimulationInfo nextPlayCardSimulationInfo = (field.AI.IsRunWeakLogic ? null : simulationInfo.CreateNextPlayCardTargetSelectSimulationInfo(field, removalBonus)); + if (nextPlayCardSimulationInfo != null) + { + nextPlayCardSimulationInfo.FieldValueAfterFirstSelectCardPlay = valueWithBonusPoint; + AISinglePlayptnRecord aISinglePlayptnRecord = ai.PlayPtnRecorder.CreateRecordForNextPlayTargetSelectSimulation(action, playPtnRecord, field); + if (aISinglePlayptnRecord == null) + { + simulationInfo.IsCurrentSimulationBestTargetTempNeedsToUpdated(valueWithBonusPoint); + yield break; + } + yield return SimulateTargetSelect(nextPlayCardSimulationInfo, field, aISinglePlayptnRecord, result, isBattleSim: false); + if (nextPlayCardSimulationInfo.IsInterruptedNextPlay) + { + UpdateSimulationResultAfterBattle(result, battleSimulationAI, valueWithBonusPoint, simulationInfo); + } + else + { + simulationInfo.IsCurrentSimulationBestTargetTempNeedsToUpdated(valueWithBonusPoint); + } + } + else + { + UpdateSimulationResultAfterBattle(result, battleSimulationAI, valueWithBonusPoint, simulationInfo); + } + } + + private static void UpdateSimulationResultAfterBattle(SimulationResult result, IBattleSimulationAI battleSimulationAI, float valueWithBonus, AIVirtualTargetSelectSimulationInfo simulationInfo) + { + if (IsBetterThanCurrentBestResult(valueWithBonus, simulationInfo.FieldValueAfterFirstSelectCardPlay, battleSimulationAI, result)) + { + result.IsLethalPlan = battleSimulationAI.Cr_MaxField.EnemyClass.IsDead; + result.MaxFieldValue = valueWithBonus; + result.MaxFieldValueAtSelfTurnEnd = battleSimulationAI.Cr_MaxFieldValueAtSelfTurnEnd; + result.MaxFieldValueFirstSkill = simulationInfo.FieldValueAfterFirstSelectCardPlay; + result.FirstActionInfo = battleSimulationAI.Cr_FirstActionInfo; + result.BestResultField = battleSimulationAI.Cr_MaxField; + result.IsRecentlyUpdated = true; + } + simulationInfo.IsCurrentSimulationBestTargetTempNeedsToUpdated(valueWithBonus); + } + + private static bool IsBetterThanCurrentBestResult(float finalValue, float valueAfterFirstCardPlay, IBattleSimulationAI simulator, SimulationResult bestRecord) + { + if (EnemyAI.IsLargerThan(finalValue, bestRecord.MaxFieldValue)) + { + return true; + } + if (EnemyAI.IsSameValue(finalValue, bestRecord.MaxFieldValue) && (EnemyAI.IsLargerThan(valueAfterFirstCardPlay, bestRecord.MaxFieldValueFirstSkill) || EnemyAI.IsLargerThan(simulator.Cr_MaxFieldValueAtSelfTurnEnd, bestRecord.MaxFieldValueAtSelfTurnEnd))) + { + return true; + } + return false; + } + + public static List GetAllTargetSelectSimulationPattern(List selectInfoList, AISelectedTargetInfoSet preDecidedTargetSet, AIVirtualTargetSelectAction situation, AIVirtualField field, AISinglePlayptnRecord playPtnRecord) + { + if (selectInfoList.Count > 2) + { + throw new Exception("GetAllTargetSelectSimulationPattern error!! selectInfoList.Count == " + selectInfoList.Count); + } + if (selectInfoList.Count == 1) + { + return GetAllSingleTargetSelectSimulationPattern(selectInfoList[0], preDecidedTargetSet, situation, field, playPtnRecord); + } + return GetAllMultipleTargetSelectSimulationpattern(selectInfoList[0], selectInfoList[1], preDecidedTargetSet, situation, field, playPtnRecord); + } + + private static List GetAllSingleTargetSelectSimulationPattern(AIVirtualTargetSelectInfo selectInfo, AISelectedTargetInfoSet preDecidedTargetSet, AIVirtualTargetSelectAction situation, AIVirtualField field, AISinglePlayptnRecord playPtnRecord) + { + List list = new List(); + if (preDecidedTargetSet != null && preDecidedTargetSet.IsAnyTargetExists() && CheckWhenBurialRiteIsDefault(preDecidedTargetSet, selectInfo)) + { + list.Add(preDecidedTargetSet); + } + else + { + List allTargetPatternList = GetAllTargetPatternList(selectInfo, situation, field, playPtnRecord); + if (allTargetPatternList == null || allTargetPatternList.Count <= 0) + { + return null; + } + bool isReplacedFirstInfoByBurialOrChoice = selectInfo.Type == TargetSelectType.BurialRite || selectInfo.Type == TargetSelectType.Choice; + for (int i = 0; i < allTargetPatternList.Count; i++) + { + AISelectedTargetInfoSet item = CreateTargetInfoSet(allTargetPatternList[i], null, isReplacedFirstInfoByBurialOrChoice); + list.Add(item); + } + } + return list; + } + + private static bool CheckWhenBurialRiteIsDefault(AISelectedTargetInfoSet targetInfo, AIVirtualTargetSelectInfo selectInfo) + { + if (targetInfo.PreprocessTarget != null && targetInfo.PreprocessTarget.Type == TargetSelectType.BurialRite && selectInfo.Type == TargetSelectType.Default) + { + return false; + } + return true; + } + + private static List GetAllMultipleTargetSelectSimulationpattern(AIVirtualTargetSelectInfo firstSelectInfo, AIVirtualTargetSelectInfo secondSelectInfo, AISelectedTargetInfoSet preDecidedTargetSet, AIVirtualTargetSelectAction situation, AIVirtualField field, AISinglePlayptnRecord playPtnRecord) + { + List list = null; + List list2 = null; + bool flag = false; + if (preDecidedTargetSet != null) + { + if (firstSelectInfo.Type == TargetSelectType.BurialRite && preDecidedTargetSet.PreprocessTarget != null && preDecidedTargetSet.PreprocessTarget.HasTarget) + { + list = AIParamQuery.AddElementToList(preDecidedTargetSet.PreprocessTarget, list); + flag = true; + } + if (preDecidedTargetSet.HasChoiceTarget) + { + list = AIParamQuery.AddElementToList(preDecidedTargetSet.ChoiceTarget, list); + flag = true; + } + if (preDecidedTargetSet.IsTargetExist(0)) + { + AISelectedTargetInfo element = preDecidedTargetSet.Get(0); + if (flag) + { + list2 = AIParamQuery.AddElementToList(element, list2); + } + else + { + list = AIParamQuery.AddElementToList(element, list); + if (preDecidedTargetSet.IsTargetExist(1)) + { + list2 = AIParamQuery.AddElementToList(preDecidedTargetSet.Get(1), list2); + } + } + } + } + if (list == null) + { + list = GetAllTargetPatternList(firstSelectInfo, situation, field, playPtnRecord); + } + if (list2 == null) + { + list2 = GetAllTargetPatternList(secondSelectInfo, situation, field, playPtnRecord); + } + if (list == null || list.Count <= 0 || list2 == null || list2.Count <= 0) + { + return null; + } + List list3 = new List(); + AISelectedTargetInfo aISelectedTargetInfo = list2[0]; + List list4 = new List(); + for (int i = 0; i < list.Count; i++) + { + AISelectedTargetInfo aISelectedTargetInfo2 = list[i]; + if (secondSelectInfo.IsForbiddenSelectedTarget && aISelectedTargetInfo2.IsSelectedSameTarget(aISelectedTargetInfo)) + { + list4.Add(aISelectedTargetInfo2); + continue; + } + AISelectedTargetInfoSet item = CreateTargetInfoSet(aISelectedTargetInfo2, aISelectedTargetInfo, flag); + list3.Add(item); + } + for (int j = 1; j < list2.Count; j++) + { + AISelectedTargetInfo aISelectedTargetInfo3 = list2[j]; + AISelectedTargetInfoSet item2 = CreateTargetInfoSet(null, aISelectedTargetInfo3, flag); + list3.Add(item2); + if (list4.Count <= 0) + { + continue; + } + for (int k = 0; k < list4.Count; k++) + { + AISelectedTargetInfo aISelectedTargetInfo4 = list4[k]; + if (!secondSelectInfo.IsForbiddenSelectedTarget || !aISelectedTargetInfo4.IsSelectedSameTarget(aISelectedTargetInfo3)) + { + AISelectedTargetInfoSet item3 = CreateTargetInfoSet(aISelectedTargetInfo4, aISelectedTargetInfo3, flag); + list3.Add(item3); + } + } + } + return list3; + } + + private static List ConvertTargetPatternArrayToInfoList(List targetPatternArray, TargetSelectType targetSelectType, AIRemovalType removalType) + { + List list = new List(); + for (int i = 0; i < targetPatternArray.Count; i++) + { + AISelectedTargetInfo aISelectedTargetInfo = new AISelectedTargetInfo(targetSelectType, removalType); + AIVirtualCard[] array = targetPatternArray[i]; + foreach (AIVirtualCard target in array) + { + aISelectedTargetInfo.AddTarget(target); + } + list.Add(aISelectedTargetInfo); + } + return list; + } + + private static List GetAllTargetPatternList(AIVirtualTargetSelectInfo selectInfo, AIVirtualTargetSelectAction situation, AIVirtualField field, AISinglePlayptnRecord playPtnRecord) + { + AIVirtualCard actor = situation.Actor; + List playPtn = ((playPtnRecord == null) ? EnemyAI.EmptyPlayPtn : playPtnRecord.PlayPtn); + List list = new List(); + switch (selectInfo.Type) + { + case TargetSelectType.Choice: + { + AISelectedTargetInfo choiceTargets = selectInfo.GetChoiceTargets(actor, field, playPtn, situation); + if (choiceTargets != null) + { + list.Add(choiceTargets); + } + break; + } + case TargetSelectType.BurialRite: + { + bool isBreakPlayptn; + AISelectedTargetInfo burialSelectTargets = selectInfo.GetBurialSelectTargets(situation, field, selectInfo, playPtnRecord, out isBreakPlayptn); + if (burialSelectTargets != null) + { + list.Add(burialSelectTargets); + } + break; + } + case TargetSelectType.NormalRuleBase: + { + AISelectedTargetInfo ruleBaseTargets = selectInfo.GetRuleBaseTargets(situation, field); + if (ruleBaseTargets != null) + { + list.Add(ruleBaseTargets); + } + break; + } + case TargetSelectType.Default: + { + List list2 = AIMathematicsLibrary.EnumerateCombinations(selectInfo.Candidates, selectInfo.Count).ToList(); + if (list2 != null && list2.Count > 0) + { + list = ConvertTargetPatternArrayToInfoList(list2, selectInfo.Type, selectInfo.RemovalType); + } + break; + } + } + return list; + } + + private static AISelectedTargetInfoSet CreateTargetInfoSet(AISelectedTargetInfo firstTarget, AISelectedTargetInfo secondTarget, bool isReplacedFirstInfoByBurialOrChoice) + { + AISelectedTargetInfoSet aISelectedTargetInfoSet = new AISelectedTargetInfoSet(); + if (isReplacedFirstInfoByBurialOrChoice) + { + if (firstTarget != null) + { + if (firstTarget.Type == TargetSelectType.BurialRite) + { + aISelectedTargetInfoSet.SetPreprocessTarget(firstTarget); + } + else if (firstTarget.Type == TargetSelectType.Choice) + { + aISelectedTargetInfoSet.SetChoiceTarget(firstTarget); + } + } + aISelectedTargetInfoSet.Set(secondTarget, 0); + } + else + { + aISelectedTargetInfoSet.Set(firstTarget, 0); + aISelectedTargetInfoSet.Set(secondTarget, 1); + } + return aISelectedTargetInfoSet; + } + + public static bool IsAbleToReplaceDummyTarget(AISelectedTargetInfoSet currentPattern, AISelectedTargetInfoSet previousBestPattern, bool isSecondTargetForbbidenSelectedTarget) + { + if (previousBestPattern == null) + { + return true; + } + if (previousBestPattern.PreprocessTarget != null && currentPattern.PreprocessTarget == null) + { + currentPattern.SetPreprocessTarget(previousBestPattern.PreprocessTarget); + return true; + } + if (previousBestPattern.ChoiceTarget != null && currentPattern.ChoiceTarget == null) + { + currentPattern.SetChoiceTarget(previousBestPattern.ChoiceTarget); + return true; + } + if (!currentPattern.IsTargetExist(0)) + { + AISelectedTargetInfo aISelectedTargetInfo = previousBestPattern.Get(0); + if (!isSecondTargetForbbidenSelectedTarget || !currentPattern.Get(1).IsSelectedSameTarget(aISelectedTargetInfo)) + { + currentPattern.Set(aISelectedTargetInfo, 0); + return true; + } + return false; + } + return true; + } + + private static float GetRemovalBonus(AISelectedTargetInfoSet selectedTargetInfoSet) + { + float num = 0f; + for (int i = 0; i < AISelectedTargetInfoSet.LENGTH; i++) + { + AISelectedTargetInfo aISelectedTargetInfo = selectedTargetInfoSet.Get(i); + if (aISelectedTargetInfo != null) + { + AIRemovalType removalType = aISelectedTargetInfo.RemovalType; + List targets = aISelectedTargetInfo.Targets; + for (int j = 0; j < targets.Count; j++) + { + num += GetTargetRemovalBonus(targets[j], removalType); + } + } + } + return num; + } + + private static float GetTargetRemovalBonus(AIVirtualCard target, AIRemovalType removalType) + { + float num = 0f; + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + switch (removalType) + { + case AIRemovalType.Banish: + num += (float)((!target.IsAlly) ? 1 : (-1)) * (target.EvaluateBreakValue(emptyPlayPtn, useIgnoreBreak: true) - target.GetAllBanishBonus(emptyPlayPtn, useIgnoreInBattle: true) - target.EvaluateLeaveValue(emptyPlayPtn, useIgnoreInBattle: true)); + break; + case AIRemovalType.Bounce: + num += (float)(target.IsAlly ? 1 : (-1)) * (target.GetBounceBonus() + target.EvaluateLeaveValue(emptyPlayPtn, useIgnoreInBattle: true)); + break; + case AIRemovalType.Metamorphose: + num += (float)((!target.IsAlly) ? 1 : (-1)) * (target.EvaluateBreakValue(emptyPlayPtn, useIgnoreBreak: true) + target.GetAllBanishBonus(emptyPlayPtn, useIgnoreInBattle: true)); + break; + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualTurnEndSimulator.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualTurnEndSimulator.cs new file mode 100644 index 0000000..b6b5ecc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualTurnEndSimulator.cs @@ -0,0 +1,23 @@ +namespace Wizard; + +public static class AIVirtualTurnEndSimulator +{ + public static void TurnEnd(AIVirtualTurnEndInfo situation, AIVirtualField field) + { + if (situation.ActionType != AIOperationType.TURNEND) + { + AIConsoleUtility.LogError("AIVirtualTurnEndSimulator:TurnEnd() error!! situation is not [TURNEND] ActionType!!!!!"); + return; + } + for (int i = 0; i < field.CardListSet.BothClassAndInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.BothClassAndInplayCards[i]; + if (!aIVirtualCard.IsDead) + { + aIVirtualCard.CallOnAfterBattleSimulation(situation); + } + } + situation.ExecuteAllSkillProcess(); + field.TagPreprocessContainer.SimulateAllTurnEndInfo(situation.Actor.IsAlly, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenAttackOrWhenFightTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenAttackOrWhenFightTagArgument.cs new file mode 100644 index 0000000..967ae9e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenAttackOrWhenFightTagArgument.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenAttackOrWhenFightTagArgument : AIFiltersAndSelectTypeArgument +{ + public virtual bool IsActivateWhenEvalInstantAttack => false; + + public AIWhenAttackOrWhenFightTagArgument(string text) + : base(text) + { + } + + public virtual bool CanKillTarget(AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, AIBarrierPseudoSimulationInfo simBarrier, ref int totalDamage) + { + return false; + } + + public virtual bool CanKillAnyTarget(AIVirtualCard tagOwner, List targetList, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, List simBarrierList, int[] realDamageList) + { + return false; + } + + public virtual int PseudoSimulateWhenAttackDamageToCertainCard(AIVirtualCard tagOwner, AIVirtualCard damageTarget, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, AIBarrierPseudoSimulationInfo simBarrier) + { + return 0; + } + + public virtual void PseudoSimulateForEvalInstantAttack(AIVirtualCard tagOwner, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, EvalInstantAttackInformation information) + { + AIBarrierPseudoSimulationInfo attackerBarrierInfo = information.AttackerBarrierInfo; + int totalDamage = information.AttackerTotalDamage; + if (CanKillTarget(tagOwner, situation.Actor, field, situation, playPtn, attackerBarrierInfo, ref totalDamage)) + { + information.IsAttackerDestroyWhenAttack = true; + information.AttackerTotalDamage = totalDamage; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenAttackSelfAndOtherTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenAttackSelfAndOtherTagArgument.cs new file mode 100644 index 0000000..29566c0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenAttackSelfAndOtherTagArgument.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenAttackSelfAndOtherTagArgument : AITriggerAndTargetFiltersTagBase +{ + public virtual bool IsActivateWhenEvalInstantAttack => false; + + public AIWhenAttackSelfAndOtherTagArgument(string text) + : base(text) + { + } + + public virtual void PseudoSimulateForEvalInstantAttack(AIVirtualCard tagOwner, AIVirtualField field, AIVirtualAttackInfo situation, List playPtn, EvalInstantAttackInformation information) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenChangeInplayTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenChangeInplayTagArgument.cs new file mode 100644 index 0000000..d0cbc18 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenChangeInplayTagArgument.cs @@ -0,0 +1,76 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenChangeInplayTagArgument : AIFiltersAndSelectTypeArgument +{ + public bool IsImmediate { get; protected set; } + + public int TextHash { get; private set; } + + public AIWhenChangeInplayTagArgument(string text, bool isImmediate) + : base(text) + { + IsImmediate = isImmediate; + TextHash = text.GetHashCode(); + } + + public virtual void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISkillProcessInformation processInfo, AISituationInfo situation = null) + { + List targets = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targets == null || targets.Count <= 0) + { + return; + } + if (IsImmediate) + { + ChangeInplayTagStartProcess(targets, field, tagOwner, playPtn, situation); + return; + } + if (situation == null) + { + AIConsoleUtility.LogWarning("AIWhenChangeInplayTagArgument.Execute() error!! situation == null!!!!!"); + return; + } + if (processInfo == null) + { + AIConsoleUtility.LogError("AIWhenChangeInplayTagArgument.Execute() error!! processInfo == null!!!!!"); + return; + } + processInfo.AddExecutingAction(delegate + { + ChangeInplayTagStartProcess(targets, field, tagOwner, playPtn, situation); + }); + } + + public virtual void Stop(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISkillProcessInformation processInfo, AISituationInfo situation) + { + List targets = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targets == null || targets.Count <= 0) + { + return; + } + if (IsImmediate) + { + ChangeInplayTagStopProcess(targets, field, tagOwner, playPtn, situation); + return; + } + if (processInfo == null) + { + AIConsoleUtility.LogError("AIWhenChangeInplayTagArgument.Stop() error!! processInfo == null!!!!!"); + return; + } + processInfo.AddExecutingAction(delegate + { + ChangeInplayTagStopProcess(targets, field, tagOwner, playPtn, situation); + }); + } + + protected virtual void ChangeInplayTagStartProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + } + + protected virtual void ChangeInplayTagStopProcess(List targets, AIVirtualField field, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAddCemetery.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAddCemetery.cs new file mode 100644 index 0000000..2fab568 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAddCemetery.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayAddCemetery : AIWhenPlayTagArgument +{ + private AIPolishConvertedExpression _addCount; + + private readonly int COUNT_ARG_INDEX; + + public AIWhenPlayAddCemetery(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + base.SelectType = AIScriptTokenArgType.NONE; + base.Filters = null; + _addCount = _exprList[COUNT_ARG_INDEX]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + int count = (int)_addCount.EvalArg(tagOwner, playPtn, field, situation); + field.VirtualCemetery.AddCemetery(count, tagOwner.IsAlly); + } + + public override void ExecuteForPlayPtnEvaluation(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + Execute(owner, field, playPtn, situation); + } + + public override void PseudoExecute(AIVirtualField field, AISinglePlayptnRecord record, PlayedCardInfo playInfo, AIVirtualTargetSelectAction situation) + { + Execute(playInfo.Card, field, record.PlayPtn, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAddDeck.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAddDeck.cs new file mode 100644 index 0000000..071098e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAddDeck.cs @@ -0,0 +1,72 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayAddDeck : AIWhenPlayTagArgument +{ + private AIPolishConvertedExpression _addCount; + + private readonly int COUNT_ARG_INDEX = 1; + + public AIWhenPlayAddDeck(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + InitializeFilter(); + base.SelectType = AIScriptTokenArgType.ALL_SELECT; + _addCount = _exprList[_exprList.Count - COUNT_ARG_INDEX]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AddDeckAction(tagOwner, field, playPtn, situation); + } + + public override void ExecuteForPlayPtnEvaluation(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AddDeckAction(owner, field, playPtn, situation, isPseudo: true); + } + + public override void PseudoExecute(AIVirtualField field, AISinglePlayptnRecord record, PlayedCardInfo playInfo, AIVirtualTargetSelectAction situation) + { + AddDeckAction(playInfo.Card, field, record.PlayPtn, situation, isPseudo: true); + } + + private void AddDeckAction(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null, bool isPseudo = false) + { + List tokenIdFromTag = GetTokenIdFromTag(tagOwner, field, playPtn, situation); + if (tokenIdFromTag != null) + { + int tokenCount = (int)_addCount.EvalArg(tagOwner, playPtn, field, situation); + for (int i = 0; i < tokenIdFromTag.Count; i++) + { + field.AddDeckCard(tokenIdFromTag[i].TokenId, tokenCount, tagOwner, playPtn, situation, isPseudo); + } + } + } + + private List GetTokenIdFromTag(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false); + AITokenIdCollection bothSideTokenIdListFromFilter = AISummonTokenUtility.GetBothSideTokenIdListFromFilter(tagOwner, field, targetsFromField, base.Filters, AITokenType.Default, AIScriptTokenArgType.ALLY, AIScriptTokenArgType.ALL_SELECT, 1, playPtn, situation); + if (bothSideTokenIdListFromFilter == null || !bothSideTokenIdListFromFilter.HasAllyToken) + { + return null; + } + return bothSideTokenIdListFromFilter.AllyTokenIdList; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAttachStyle.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAttachStyle.cs new file mode 100644 index 0000000..460a33e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAttachStyle.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayAttachStyle : AIWhenPlayTagArgument +{ + private readonly char[] POLICY_TRIM_CHARS = new char[3] { '{', '}', ' ' }; + + public AIPolicyData Policy { get; private set; } + + public AIWhenPlayAttachStyle(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.SelectType = AIScriptTokenArgType.NONE; + base.Filters = null; + string[] words = SplitTextToWords(text); + InitializePolicyFromWords(words); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (field.IsLatestActionField) + { + field.StyleQuery.ExecuteAttachStyle(Policy); + } + } + + private void InitializePolicyFromWords(string[] words) + { + AIPolicyDataAsset aIPolicyDataAsset = new AIPolicyDataAsset(); + aIPolicyDataAsset.Category = words[0].Trim(POLICY_TRIM_CHARS); + if (int.TryParse(words[1].Trim(POLICY_TRIM_CHARS), out var result)) + { + aIPolicyDataAsset.Priority = result; + } + else + { + AIConsoleUtility.LogError("AIWhenPlayAttachStyle Priority Argument Error!! " + words[1]); + aIPolicyDataAsset.Priority = 0; + } + aIPolicyDataAsset.Type = words[2].Trim(POLICY_TRIM_CHARS); + aIPolicyDataAsset.Arg = words[3].Trim(POLICY_TRIM_CHARS); + aIPolicyDataAsset.Cond = words[4].Trim(POLICY_TRIM_CHARS); + aIPolicyDataAsset.ID = -1; + Policy = new AIPolicyData(aIPolicyDataAsset); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAttachTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAttachTag.cs new file mode 100644 index 0000000..f06035e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAttachTag.cs @@ -0,0 +1,143 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayAttachTag : AIWhenPlayTagArgument +{ + private AISelectLogicArgumentBase _selectLogicArg; + + private const int REMOVE_TIMING_OFFSET = 1; + + private const int TAG_WORD_START_INDEX = 1; + + private const int SELECT_LOGIC_WORD_START_INDEX = 4; + + public AIPlayTag Tag { get; private set; } + + public AIScriptTokenArgType RemoveTiming { get; private set; } + + protected override bool _isSelectCountImplemented => true; + + protected override int SELECT_TYPE_OFFSET => 3; + + protected override int SELECT_COUNT_OFFSET => 2; + + public AIWhenPlayAttachTag(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + base.InitExpressions(list[0]); + RemoveTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 1]); + Tag = AIPlayTagInitializingUtility.CreateAIPlayTagFromWords(list[1], list[2], list[3]); + if (list.Count > 4) + { + _selectLogicArg = AISelectLogicSimulationUtility.CreateSelectLogicArgument(list[4]); + } + else + { + _selectLogicArg = new AIDefaultSelectLogicArgument(null); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIAttachTagSimulationUtility.SimulateAttachTagToAll(targetsFromField, tagOwner, Tag, RemoveTiming, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + if (selectCount > 0) + { + AIAttachTagSimulationUtility.SimulateRandomSelectAttachTag(targetsFromField, selectCount, tagOwner, field, playPtn, situation, Tag, RemoveTiming, _selectLogicArg); + } + break; + } + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + { + if (situation.IsTargetExists(base.SelectType)) + { + AIAttachTagSimulationUtility.SimulateAttachTagToTarget(situation, tagOwner, base.SelectType, Tag, RemoveTiming); + break; + } + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + if (selectCount > 0) + { + SimulateTargetSelectAttachTag(targetsFromField, selectCount, tagOwner, field, playPtn, situation); + } + break; + } + } + } + + private void SimulateTargetSelectAttachTag(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (candidates == null || candidates.Count <= 0) + { + return; + } + if (selectCount == candidates.Count) + { + AIAttachTagSimulationUtility.SimulateAttachTagToAll(candidates, tagOwner, Tag, RemoveTiming, situation); + } + else + { + if (selectCount > candidates.Count) + { + return; + } + if (selectCount == 1) + { + AIAttachTagSimulationUtility.SimulateAttachTagToSingle(_selectLogicArg.SelectSingleTarget(candidates, tagOwner, field, playPtn, situation, AISelectTargetPattern.Best), tagOwner, Tag, RemoveTiming, situation); + return; + } + List list = _selectLogicArg.SelectMultipleSelectedTargets(candidates, selectCount, tagOwner, field, playPtn, situation, AISelectTargetPattern.Best); + if (list != null && list.Count > 0) + { + AIAttachTagSimulationUtility.SimulateAttachTagToAll(list, tagOwner, Tag, RemoveTiming, situation); + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[5] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.RANDOM_MULTI_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + List list = new List(); + list.AddRange(field.CardListSet.AllReferableCards); + list.AddRange(field.GetEnemyHandCardList()); + return list; + } + + public override AITokenIdCollection GetAllRegisterTokenPoolInfo(AIVirtualCard owner) + { + if (Tag != null) + { + return Tag.ArgumentExpressions.GetAllRegisterTokenPoolInfo(owner); + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAttackableCount.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAttackableCount.cs new file mode 100644 index 0000000..b761c3f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayAttackableCount.cs @@ -0,0 +1,65 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayAttackableCount : AIWhenPlayTagArgument +{ + private AIPolishConvertedExpression _countArg; + + private const int SELECT_TYPE_ARG_OFFSET = 2; + + private const int ATTACKABLE_COUNT_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIWhenPlayAttackableCount(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _countArg = _exprList[_exprList.Count - 1]; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT + }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int attackableCount = (int)_countArg.EvalArg(tagOwner, playPtn, field, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIAttackableCountSimulationUtility.ExecuteChangeAttackableCountAll(targetsFromField, attackableCount); + break; + case AIScriptTokenArgType.TARGET_SELECT: + AIAttackableCountSimulationUtility.ExecuteChangeAttackableCountTargetSelect(attackableCount, base.SelectType, situation); + break; + default: + AIConsoleUtility.LogError(string.Format("AIWhenPlayAttackableCount.Execute() Error!! SelectType={0} cardName={1}", base.SelectType, (tagOwner != null) ? tagOwner.CardName : "")); + break; + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBanAttack.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBanAttack.cs new file mode 100644 index 0000000..401347b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBanAttack.cs @@ -0,0 +1,84 @@ +using System.Collections.Generic; +using Wizard.Battle.UI; + +namespace Wizard; + +public class AIWhenPlayBanAttack : AIWhenPlayTagArgument +{ + private readonly int BAN_ATTACK_TYPE_ARG_OFFSET = 1; + + private CantAttackType _banAttackType; + + protected override bool _isSelectCountImplemented => true; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIWhenPlayBanAttack(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _banAttackType = AIPlayTagInitializingUtility.CreateBanAttackType(_exprList[_exprList.Count - BAN_ATTACK_TYPE_ARG_OFFSET]); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBanAttackSimulationUtility.BanAttackAll(targetsFromField, _banAttackType); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + AIBanAttackSimulationUtility.BanAttackRandom(targetsFromField, _banAttackType, selectCount); + break; + } + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + ExecuteTargetSelectBanAttack(tagOwner, targetsFromField, situation, field, playPtn); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + private void ExecuteTargetSelectBanAttack(AIVirtualCard owner, List targets, AISituationInfo situation, AIVirtualField field, List playPtn) + { + if (situation != null) + { + if (!situation.IsTargetExists(base.SelectType)) + { + int selectCount = GetSelectCount(owner, field, playPtn, situation); + AIBanAttackSimulationUtility.BanAttackTargetPrediction(AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(targets, owner, playPtn), _banAttackType, selectCount); + } + else + { + AIBanAttackSimulationUtility.BanAttackTarget(situation, _banAttackType, base.SelectType); + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBanish.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBanish.cs new file mode 100644 index 0000000..19dd881 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBanish.cs @@ -0,0 +1,112 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayBanish : AIWhenPlayTagArgument +{ + protected override bool _isSelectCountImplemented => true; + + public AIWhenPlayBanish(string text) + : base(text) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + UpdateSituationRemovalType(situation); + AIBanishSimulationUtility.BanishAll(targetsFromField, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + AIBanishSimulationUtility.BanishRandom(targetsFromField, tagOwner, field, playPtn, situation, selectCount); + break; + } + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AIBanishSimulationUtility.ExecuteTargetSelectBanish(tagOwner, targetsFromField, field, playPtn, situation, base.SelectType, GetSelectCount(tagOwner, field, playPtn, situation)); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + public override void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + TargetLifePredictionForAllSelect(target, owner, field, playPtn, situation, targetLifeRecord); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + TargetLifePredictionForRandomSelect(target, owner, field, playPtn, situation, targetLifeRecord); + break; + } + } + + private void TargetLifePredictionForAllSelect(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (!target.IsLeader && AIFilteringUtility.CheckMatchTargetFiltering(target, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, owner, situation) && !target.IsIndependent) + { + targetLifeRecord.CurrentLife = 0; + } + } + + private void TargetLifePredictionForRandomSelect(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (!target.IsIndependent) + { + List targetsFromField = GetTargetsFromField(owner, field, playPtn, situation); + int selectCount = GetSelectCount(owner, field, playPtn, situation); + if (targetsFromField.Count <= selectCount && targetsFromField.Contains(target)) + { + targetLifeRecord.CurrentLife = 0; + } + } + } + + public override void MultipleTargetLifePrediction(List targetList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, List lifeList) + { + if (base.SelectType != AIScriptTokenArgType.ALL_SELECT) + { + return; + } + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard aIVirtualCard = targetList[i]; + LifeRecord lifeRecord = lifeList[i]; + if (!aIVirtualCard.IsLeader && AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, owner, situation) && !aIVirtualCard.IsIndependent) + { + lifeRecord.CurrentLife = 0; + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Banish; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBarrierBase.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBarrierBase.cs new file mode 100644 index 0000000..bfd20d3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBarrierBase.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +namespace Wizard; + +public abstract class AIWhenPlayBarrierBase : AIWhenPlayTagArgument +{ + protected AIScriptTokenArgType _stopTiming; + + protected AIScriptTokenArgType _damageType; + + protected bool _isDamageTypeDefinedByMaster; + + protected abstract int _defaultDamageTypeOffset { get; } + + protected abstract int _stopTimingOffset { get; } + + protected override int SELECT_TYPE_OFFSET => 1 + (_isDamageTypeDefinedByMaster ? _defaultDamageTypeOffset : _stopTimingOffset); + + public AIWhenPlayBarrierBase(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _stopTiming = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - _stopTimingOffset]); + _damageType = AIPlayTagInitializingUtility.GetDamageTypeFromExprList(_exprList[_exprList.Count - _defaultDamageTypeOffset], out _isDamageTypeDefinedByMaster); + InitSelectType(); + InitializeFilter(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + GiveBarrierToAllTargets(targetsFromField, tagOwner, field, playPtn, situation); + } + } + + protected abstract void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBonusInSimulation.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBonusInSimulation.cs new file mode 100644 index 0000000..41f9f83 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBonusInSimulation.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayBonusInSimulation : AIWhenPlayTagArgument +{ + public AIWhenPlayBonusInSimulation(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.SelectType = AIScriptTokenArgType.NONE; + base.Filters = null; + InitExprList(text); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + field.SimulationExtraBonus += EvalArg(0, tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBounce.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBounce.cs new file mode 100644 index 0000000..26e89bb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBounce.cs @@ -0,0 +1,112 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayBounce : AIWhenPlayTagArgument +{ + protected override bool _isSelectCountImplemented => true; + + public AIWhenPlayBounce(string text) + : base(text) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + UpdateSituationRemovalType(situation); + AIBounceSimulationUtility.BounceAll(targetsFromField, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + AIBounceSimulationUtility.BounceRandom(targetsFromField, tagOwner, field, playPtn, situation, selectCount); + break; + } + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AIBounceSimulationUtility.ExecuteTargetSelectBounce(tagOwner, targetsFromField, situation, field, playPtn, base.SelectType, GetRemovalType(), GetSelectCount(tagOwner, field, playPtn, situation)); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + public override void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + TargetLifePredictionForAllSelect(target, owner, field, playPtn, situation, targetLifeRecord); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + TargetLifePredictionForRandomSelect(target, owner, field, playPtn, situation, targetLifeRecord); + break; + } + } + + private void TargetLifePredictionForAllSelect(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (!target.IsLeader && AIFilteringUtility.CheckMatchTargetFiltering(target, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, owner, situation) && !target.IsIndependent) + { + targetLifeRecord.CurrentLife = 0; + } + } + + private void TargetLifePredictionForRandomSelect(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (!target.IsIndependent) + { + List targetsFromField = GetTargetsFromField(owner, field, playPtn, situation); + int selectCount = GetSelectCount(owner, field, playPtn, situation); + if (targetsFromField.Count <= selectCount && targetsFromField.Contains(target)) + { + targetLifeRecord.CurrentLife = 0; + } + } + } + + public override void MultipleTargetLifePrediction(List targetList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, List lifeList) + { + if (base.SelectType != AIScriptTokenArgType.ALL_SELECT) + { + return; + } + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard aIVirtualCard = targetList[i]; + LifeRecord lifeRecord = lifeList[i]; + if (!aIVirtualCard.IsLeader && AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, owner, situation) && !aIVirtualCard.IsIndependent) + { + lifeRecord.CurrentLife = 0; + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Bounce; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBuff.cs new file mode 100644 index 0000000..83065c6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayBuff.cs @@ -0,0 +1,155 @@ +using System; +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayBuff : AIWhenPlayTagArgument +{ + private readonly int TEMP_OR_PERM_ARG_OFFSET = 1; + + private readonly int LIFE_ARG_OFFSET = 2; + + private readonly int ATTACK_ARG_OFFSET = 3; + + public AIPolishConvertedExpression Attack { get; private set; } + + public AIPolishConvertedExpression Life { get; private set; } + + public AIScriptTokenArgType TempOrPerm { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 4; + + public AIWhenPlayBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Attack = _exprList[_exprList.Count - ATTACK_ARG_OFFSET]; + Life = _exprList[_exprList.Count - LIFE_ARG_OFFSET]; + TempOrPerm = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - TEMP_OR_PERM_ARG_OFFSET], AIBuffEvaluationUtility.LEGAL_TEMP_OR_PERM_ARGUMENTS); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, Attack, Life); + bool isTemp = TempOrPerm == AIScriptTokenArgType.TEMP; + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIBuffSimulationUtility.BuffAll_old(targetsFromField, field, buffExecutingInfo_old, isTemp, playPtn, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + ExecuteRandomSelectBuff(tagOwner, targetsFromField, situation, field, playPtn, buffExecutingInfo_old, isTemp); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + ExecuteTargetSelectBuff(targetsFromField, situation, field, playPtn, buffExecutingInfo_old, isTemp); + break; + default: + AIConsoleUtility.LogError("AIWhenPlayBuff.Execute() Error!! SelectType=" + base.SelectType); + break; + } + } + } + + private void ExecuteTargetSelectBuff(List targets, AISituationInfo situation, AIVirtualField field, List playPtn, AIBuffExecutingInfo_old buffInfo, bool isTemp) + { + if (situation == null) + { + AIConsoleUtility.LogError("AIWhenPlayBuff.ExecuteTargetSelectBuff() Error!! situation is null!!!!!"); + return; + } + if (situation.IsTargetExists(base.SelectType)) + { + AIBuffSimulationUtility.BuffTarget_old(situation, targets, field, playPtn, base.SelectType, buffInfo, isTemp); + return; + } + AIVirtualCard aIVirtualCard = AISimulationRemovalUtility.SelectBestTargetForBuff(targets, buffInfo); + if (aIVirtualCard != null) + { + AIBuffSimulationUtility.BuffSingle_old(aIVirtualCard, field, buffInfo, isTemp, playPtn, situation); + } + } + + private void ExecuteRandomSelectBuff(AIVirtualCard tagOwner, List targets, AISituationInfo situation, AIVirtualField field, List playPtn, AIBuffExecutingInfo_old buffInfo, bool isTemp) + { + AIVirtualCardRealTargetInformation aIVirtualCardRealTargetInformation = situation.DequeueRealTargetInfo(tagOwner, field); + if (aIVirtualCardRealTargetInformation == null || aIVirtualCardRealTargetInformation.TargetList.Count <= 0) + { + AIBuffSimulationUtility.BuffRandom_old(targets, field, playPtn, situation, buffInfo, isTemp); + return; + } + AIVirtualCard aIVirtualCard = aIVirtualCardRealTargetInformation.TargetList[0]; + for (int i = 0; i < targets.Count; i++) + { + if (targets[i].IsSameCard(aIVirtualCard)) + { + AIBuffSimulationUtility.BuffSingle_old(aIVirtualCard, field, buffInfo, isTemp, playPtn, situation); + break; + } + } + } + + public override void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT && AIFilteringUtility.CheckMatchTargetFiltering(target, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, owner, situation)) + { + int num = (int)Life.EvalArg(owner, playPtn, field, situation); + targetLifeRecord.MaxLife = Math.Max(targetLifeRecord.MaxLife + num, 0); + if (targetLifeRecord.CurrentLife > targetLifeRecord.MaxLife) + { + targetLifeRecord.CurrentLife = targetLifeRecord.MaxLife; + } + } + } + + public override void MultipleTargetLifePrediction(List targetList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, List lifeList) + { + if (base.SelectType != AIScriptTokenArgType.ALL_SELECT) + { + return; + } + int num = (int)Life.EvalArg(owner, playPtn, field, situation); + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard targetCard = targetList[i]; + LifeRecord lifeRecord = lifeList[i]; + if (AIFilteringUtility.CheckMatchTargetFiltering(targetCard, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, owner, situation)) + { + lifeRecord.MaxLife = Math.Max(lifeRecord.MaxLife + num, 0); + if (lifeRecord.CurrentLife > lifeRecord.MaxLife) + { + lifeRecord.CurrentLife = lifeRecord.MaxLife; + } + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool isAttackEffective = !Attack.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayChangeClass.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayChangeClass.cs new file mode 100644 index 0000000..19cb8b3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayChangeClass.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayChangeClass : AIWhenPlayTagArgument +{ + private CardBasePrm.ClanType _classType; + + private const int CLASS_TYPE_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIWhenPlayChangeClass(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _classType = AIPlayTagInitializingUtility.CreateClassType(_exprList[_exprList.Count - 1]); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIChangeClassSimulationUtility.ChangeClassAll(targetsFromField, _classType); + break; + case AIScriptTokenArgType.TARGET_SELECT: + ExecuteTargetSelectChangeClass(targetsFromField, situation); + break; + } + } + } + + private void ExecuteTargetSelectChangeClass(List candidates, AISituationInfo situation) + { + if (situation != null && situation.IsTargetExists(base.SelectType)) + { + AIChangeClassSimulationUtility.ChangeClassTarget(candidates, _classType, base.SelectType, situation); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayChangeCost.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayChangeCost.cs new file mode 100644 index 0000000..d043e79 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayChangeCost.cs @@ -0,0 +1,102 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayChangeCost : AIWhenPlayTagArgument +{ + private AIPolishConvertedExpression _costValue; + + private const int COST_VALUE_ARG_OFFSET = 1; + + private const int COST_TYPE_ARG_OFFSET = 2; + + private readonly AIScriptTokenArgType[] _legalCostTypeArgs = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ADD, + AIScriptTokenArgType.SET + }; + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIScriptTokenArgType CostVariableType { get; private set; } + + public AIWhenPlayChangeCost(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _costValue = _exprList[_exprList.Count - 1]; + CostVariableType = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2], _legalCostTypeArgs); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override TargetSelectType GetTargetSelectType() + { + return TargetSelectType.NormalRuleBase; + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + List candidateRange = GetCandidateRange(field); + return GetFilteredTargets(candidateRange, owner, playPtn, situation, isBlockDead); + } + + public override void ExecuteForPlayPtnEvaluation(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + Execute(owner, field, playPtn, situation); + } + + public override void PseudoExecute(AIVirtualField field, AISinglePlayptnRecord record, PlayedCardInfo playInfo, AIVirtualTargetSelectAction situation) + { + Execute(playInfo.Card, field, record.PlayPtn, situation); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + AIConsoleUtility.Log("AIWhenPlayChangeCost: filtered target is nothing"); + return; + } + int costValue = GetCostValue(tagOwner, field, playPtn, situation); + AIChangeCostSimulationUtility.ExecuteCostChange(CostVariableType, base.SelectType, costValue, tagOwner, targetsFromField, situation, field); + } + + public override void RegisterRuleBaseTargets(List candidates, AIVirtualCard actor, AIVirtualField field, AIVirtualTargetSelectAction situation, ref List targetList) + { + base.RegisterRuleBaseTargets(candidates, actor, field, situation, ref targetList); + AIVirtualCard aIVirtualCard = AIChangeCostSimulationUtility.SelectTargetForChangeCost(actor, candidates, AISelectTargetPattern.Best); + if (aIVirtualCard != null) + { + targetList = AIParamQuery.AddElementToList(aIVirtualCard, targetList); + } + } + + public int GetCostValue(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_costValue == null) + { + AIConsoleUtility.LogError("AIWhenPlayChangeCost.GetCostValue() error!! _costValue is null"); + return 0; + } + return (int)_costValue.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayChangeTribe.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayChangeTribe.cs new file mode 100644 index 0000000..09b4d47 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayChangeTribe.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayChangeTribe : AIWhenPlayTagArgument +{ + private CardBasePrm.TribeType _tribeType = CardBasePrm.TribeType.MAX; + + private const int TRIBE_TYPE_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIWhenPlayChangeTribe(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tribeType = AIPlayTagInitializingUtility.CreateTribeType(_exprList[_exprList.Count - 1]); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AITribeSimulationUtility.ChangeTribeAll(targetsFromField, _tribeType); + break; + case AIScriptTokenArgType.TARGET_SELECT: + ExecuteTargetSelect(situation); + break; + } + } + } + + private void ExecuteTargetSelect(AISituationInfo situation) + { + if (situation != null && situation.IsTargetExists(base.SelectType)) + { + AITribeSimulationUtility.ChangeTribeTargetSelect(_tribeType, base.SelectType, situation); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayCopyTag.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayCopyTag.cs new file mode 100644 index 0000000..b7e54c7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayCopyTag.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayCopyTag : AIWhenPlayTagArgument +{ + private List _timingList; + + private List _receiverFilterList; + + protected override int SELECT_TYPE_OFFSET => _timingList.Count + 1; + + public AIWhenPlayCopyTag(string text) + : base(text) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT + }; + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + InitTimingListAndSelectType(); + InitializeFilter(); + _receiverFilterList = new List(); + AIScriptArgumentToken item = new AIScriptArgumentToken(AIScriptTokenArgType.SELF, isNot: false); + _receiverFilterList.Add(item); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AICopyTagSimulationUtility.ExecuteCopyAndAttachTagToAll(tagOwner, targetsFromField, _timingList, field, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + AICopyTagSimulationUtility.ExecuteCopyAndAttachTagToSelectedTarget(tagOwner, targetsFromField, _timingList, base.SelectType, field, playPtn, situation); + break; + } + } + } + + private void InitTimingListAndSelectType() + { + _timingList = new List(); + for (int num = _exprList.Count - 1; num >= 0; num--) + { + AIPolishConvertedExpression aIPolishConvertedExpression = _exprList[num]; + if (aIPolishConvertedExpression.TokenList == null || aIPolishConvertedExpression.TokenList.Count <= 0) + { + break; + } + if (aIPolishConvertedExpression.TokenList[0] is AIScriptArgumentToken { ArgumentType: var argumentType }) + { + if (Array.IndexOf(base.LegalSelectTypes, argumentType) >= 0) + { + base.SelectType = argumentType; + break; + } + _timingList.Add(argumentType); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamage.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamage.cs new file mode 100644 index 0000000..29bb2c8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamage.cs @@ -0,0 +1,155 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayDamage : AIWhenPlayTagArgument +{ + private AIPolishConvertedExpression _damageArg; + + private AIPolishConvertedExpression _countArg; + + private readonly int EXECUTE_COUNT_ARG_OFFSET = 1; + + private readonly int DAMAGE_ARG_OFFSET = 2; + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIWhenPlayDamage(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _damageArg = _exprList[_exprList.Count - DAMAGE_ARG_OFFSET]; + _countArg = _exprList[_exprList.Count - EXECUTE_COUNT_ARG_OFFSET]; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[6] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT, + AIScriptTokenArgType.DIVIDED_SELECT, + AIScriptTokenArgType.RANDOM_MULTI_SELECT + }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + int num = (int)_damageArg.EvalArg(tagOwner, playPtn, field, situation); + int num2 = (int)_countArg.EvalArg(tagOwner, playPtn, field, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + { + UpdateSituationRemovalType(situation); + for (int j = 0; j < num2; j++) + { + AIDamageSimulationUtility.DamageAll(targetsFromField, tagOwner, field, num, situation); + } + break; + } + case AIScriptTokenArgType.RANDOM_SELECT: + { + for (int k = 0; k < num2; k++) + { + AIDamageSimulationUtility.DamageRandom(targetsFromField, tagOwner, field, num, situation); + } + break; + } + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AIDamageSimulationUtility.ExecuteTargetSelectDamage(tagOwner, targetsFromField, field, playPtn, situation, base.SelectType, num, num2); + break; + case AIScriptTokenArgType.DIVIDED_SELECT: + { + for (int i = 0; i < num2; i++) + { + AIDamageSimulationUtility.DamageOldOrderedTargets(targetsFromField, num, tagOwner, field, playPtn, situation); + } + break; + } + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + AIDamageSimulationUtility.DamageRandomMultiSelect(targetsFromField, tagOwner, field, num, num2, situation); + break; + default: + AIConsoleUtility.LogError("AIPlayDamage.Execute() Error!! SelectType=" + base.SelectType); + break; + } + } + + public override void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (base.SelectType != AIScriptTokenArgType.ALL_SELECT || (!target.IsLeader && !target.IsUnit) || !AIFilteringUtility.CheckMatchTargetFiltering(target, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, owner, situation)) + { + return; + } + int damageAmount = (int)_damageArg.EvalArg(owner, playPtn, field, situation); + int num = (int)_countArg.EvalArg(owner, playPtn, field, situation); + for (int i = 0; i < num; i++) + { + int num2 = target.SimulateDamageAmount(damageAmount, isSkillDamage: true, owner.IsSpell); + targetLifeRecord.CurrentLife -= num2; + if (targetLifeRecord.CurrentLife <= 0) + { + break; + } + } + } + + public override void MultipleTargetLifePrediction(List targetList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, List lifeList) + { + if (base.SelectType != AIScriptTokenArgType.ALL_SELECT) + { + return; + } + int damageAmount = (int)_damageArg.EvalArg(owner, playPtn, field, situation); + int num = (int)_countArg.EvalArg(owner, playPtn, field, situation); + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard aIVirtualCard = targetList[i]; + LifeRecord lifeRecord = lifeList[i]; + if ((!aIVirtualCard.IsLeader && !aIVirtualCard.IsUnit) || !AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, owner, situation)) + { + continue; + } + for (int j = 0; j < num; j++) + { + int num2 = aIVirtualCard.SimulateDamageAmount(damageAmount, isSkillDamage: true, owner.IsSpell); + lifeRecord.CurrentLife -= num2; + if (lifeRecord.CurrentLife <= 0) + { + if (aIVirtualCard.IsDestroyByBanish) + { + situation.RegisterOwnBanishedCard(aIVirtualCard); + } + else + { + situation.RegisterOwnDestroyedCard(aIVirtualCard); + } + break; + } + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Damage; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamageClip.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamageClip.cs new file mode 100644 index 0000000..03d47f6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamageClip.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayDamageClip : AIWhenPlayBarrierBase +{ + private AIPolishConvertedExpression _clipAmount; + + private const int CLIP_AMOUNT_OFFSET = 1; + + protected override int _defaultDamageTypeOffset => 3; + + protected override int _stopTimingOffset => 2; + + public AIWhenPlayDamageClip(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _clipAmount = _exprList[_exprList.Count - 1]; + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int clipAmount = (int)_clipAmount.EvalArg(tagOwner, playPtn, field, situation); + AIBarrierSimulationUtility.AddDamageClipToAll(targets, tagOwner, field, _damageType, _stopTiming, clipAmount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamageCut.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamageCut.cs new file mode 100644 index 0000000..d1f336d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDamageCut.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayDamageCut : AIWhenPlayBarrierBase +{ + private AIPolishConvertedExpression _cutAmount; + + private const int CUT_AMOUNT_OFFSET = 1; + + protected override int _defaultDamageTypeOffset => 3; + + protected override int _stopTimingOffset => 2; + + public AIWhenPlayDamageCut(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _cutAmount = _exprList[_exprList.Count - 1]; + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int cutAmount = (int)_cutAmount.EvalArg(tagOwner, playPtn, field, situation); + AIBarrierSimulationUtility.AddDamageCutToAll(targets, tagOwner, field, _damageType, _stopTiming, cutAmount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDestroy.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDestroy.cs new file mode 100644 index 0000000..43046e4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDestroy.cs @@ -0,0 +1,131 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayDestroy : AIWhenPlayTagArgument +{ + protected override bool _isSelectCountImplemented => true; + + public AIWhenPlayDestroy(string text) + : base(text) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[5] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT, + AIScriptTokenArgType.OLDEST_SELECT + }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + UpdateSituationRemovalType(situation); + AISkillSimulationUtility.DestroyAll(targetsFromField, field, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + AISkillSimulationUtility.DestroyRandom(targetsFromField, tagOwner, field, playPtn, situation, selectCount); + break; + } + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + AIDestroySimulationUtility.ExecuteTargetSelectDestroy(tagOwner, targetsFromField, field, playPtn, situation, base.SelectType, selectCount); + break; + } + case AIScriptTokenArgType.OLDEST_SELECT: + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + AISkillSimulationUtility.DestroyOldest(targetsFromField, field, situation, selectCount); + break; + } + default: + AIConsoleUtility.LogError("AIWhenPlayDestroy.Execute() Error!! SelectType=" + base.SelectType); + break; + } + } + } + + public override void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + TargetLifePredictionForAllSelect(target, owner, field, playPtn, situation, targetLifeRecord); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + TargetLifePredictionForRandomSelect(target, owner, field, playPtn, situation, targetLifeRecord); + break; + } + } + + public override void MultipleTargetLifePrediction(List targetList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, List lifeList) + { + if (base.SelectType != AIScriptTokenArgType.ALL_SELECT) + { + return; + } + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard aIVirtualCard = targetList[i]; + LifeRecord lifeRecord = lifeList[i]; + if (!aIVirtualCard.IsLeader && AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, owner, situation) && !aIVirtualCard.IsIndependent && !aIVirtualCard.IsIndestructible) + { + lifeRecord.CurrentLife = 0; + if (aIVirtualCard.IsDestroyByBanish) + { + situation.RegisterOwnBanishedCard(aIVirtualCard); + } + else + { + situation.RegisterOwnDestroyedCard(aIVirtualCard); + } + } + } + } + + private void TargetLifePredictionForAllSelect(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (!target.IsLeader && AIFilteringUtility.CheckMatchTargetFiltering(target, field.CardListSet.BothClassAndInplayCards, base.Filters, playPtn, owner, situation) && !target.IsIndependent && !target.IsIndestructible) + { + targetLifeRecord.CurrentLife = 0; + } + } + + private void TargetLifePredictionForRandomSelect(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + if (!target.IsIndependent && !target.IsIndestructible) + { + List targetsFromField = GetTargetsFromField(owner, field, playPtn, situation); + int selectCount = GetSelectCount(owner, field, playPtn, situation); + if (targetsFromField.Count <= selectCount && targetsFromField.Contains(target)) + { + targetLifeRecord.CurrentLife = 0; + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Destroy; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDiscard.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDiscard.cs new file mode 100644 index 0000000..6251eaf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayDiscard.cs @@ -0,0 +1,132 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayDiscard : AIWhenPlayTagArgument +{ + protected override bool _isSelectCountImplemented => true; + + public AIWhenPlayDiscard(string text) + : base(text) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT + }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.TARGET_SELECT: + AISkillSimulationUtility.ExecuteTargetSelectDiscard(targetsFromField, selectCount, base.SelectType, tagOwner, field, playPtn, situation); + break; + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.DiscardAll(tagOwner, targetsFromField, field, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AISkillSimulationUtility.DiscardRandom(tagOwner, field, targetsFromField, selectCount, situation); + break; + } + } + } + + public override void PseudoExecute(AIVirtualField field, AISinglePlayptnRecord record, PlayedCardInfo playInfo, AIVirtualTargetSelectAction situation) + { + AIDiscardInfo aIDiscardInfo; + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + aIDiscardInfo = GetPseudoAllSelectDiscardInfo(record, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + aIDiscardInfo = GetPseudoRandomSelectDiscardInfo(record, field, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + aIDiscardInfo = GetPseudoTargetSelectDiscardInfo(record, field, situation); + break; + default: + AIConsoleUtility.LogError("AIWhenPlayDiscard error!! SelectType == " + base.SelectType); + return; + } + playInfo.SetDiscardInfo(aIDiscardInfo, base.SelectType); + record.CheckRegisteredDiscardInfo(aIDiscardInfo); + } + + private AIDiscardInfo GetPseudoAllSelectDiscardInfo(AISinglePlayptnRecord record, AIVirtualTargetSelectAction situation) + { + List restHandCardList = record.RestHandCardList; + AIVirtualCard actor = situation.Actor; + List playPtn = record.PlayPtn; + List filteredTargets = GetFilteredTargets(restHandCardList, actor, playPtn, situation); + if (filteredTargets == null || filteredTargets.Count <= 0) + { + return new AIDiscardInfo(actor, isSuccess: false, filteredTargets); + } + if (!record.IsAllTargetsUsableHandCard(filteredTargets)) + { + AIDiscardInfo aIDiscardInfo = new AIDiscardInfo(actor, isSuccess: true, filteredTargets); + aIDiscardInfo.MarkAsNG(); + return aIDiscardInfo; + } + return new AIDiscardInfo(actor, isSuccess: true, filteredTargets); + } + + private AIDiscardInfo GetPseudoRandomSelectDiscardInfo(AISinglePlayptnRecord record, AIVirtualField field, AIVirtualTargetSelectAction situation) + { + List restHandCardList = record.RestHandCardList; + AIVirtualCard actor = situation.Actor; + List playPtn = record.PlayPtn; + List filteredTargets = GetFilteredTargets(restHandCardList, actor, playPtn, situation); + if (filteredTargets == null || filteredTargets.Count <= 0) + { + return new AIDiscardInfo(actor, isSuccess: false, filteredTargets); + } + if (!record.IsAllTargetsUsableHandCard(filteredTargets)) + { + AIDiscardInfo aIDiscardInfo = new AIDiscardInfo(actor, isSuccess: true, null); + aIDiscardInfo.MarkAsNG(); + return aIDiscardInfo; + } + int selectCount = GetSelectCount(actor, actor.SelfField, playPtn, situation); + List targets = AIDiscardUtility.SelectWorstDiscardTarget(actor, field, filteredTargets, selectCount, playPtn, situation); + return new AIDiscardInfo(actor, isSuccess: true, targets); + } + + private AIDiscardInfo GetPseudoTargetSelectDiscardInfo(AISinglePlayptnRecord record, AIVirtualField field, AIVirtualTargetSelectAction situation) + { + List restHandCardList = record.RestHandCardList; + AIVirtualCard actor = situation.Actor; + List playPtn = record.PlayPtn; + List filteredTargets = GetFilteredTargets(restHandCardList, actor, playPtn, situation); + int selectCount = GetSelectCount(actor, actor.SelfField, playPtn, situation); + if (filteredTargets == null || filteredTargets.Count < selectCount) + { + return new AIDiscardInfo(actor, isSuccess: false, filteredTargets); + } + bool isBreakPlayptn; + List prospectedTargetWithPlayPtnUsableCardCheck = AITargetSelectUtility.GetProspectedTargetWithPlayPtnUsableCardCheck(filteredTargets, field, situation, record, selectCount, (AIVirtualCard card, AIVirtualField field2, List playPtn2, AIVirtualTargetSelectAction situation2) => AIDiscardUtility.EvaluateDiscardedBonus(card, playPtn2, situation2, field2, isIgnoreInBattle: false, isCalcCostDiff: true, isCalcTokenValue: true), out isBreakPlayptn); + AIDiscardInfo aIDiscardInfo = new AIDiscardInfo(actor, isSuccess: true, prospectedTargetWithPlayPtnUsableCardCheck); + if (isBreakPlayptn) + { + aIDiscardInfo.MarkAsNG(); + } + return aIDiscardInfo; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayEvo.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayEvo.cs new file mode 100644 index 0000000..149508f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayEvo.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayEvo : AIWhenPlayTagArgument +{ + protected override bool _isSelectCountImplemented => true; + + public AIWhenPlayEvo(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIAutoEvolutionSimulationUtility.AutoEvolution(field, targetsFromField, playPtn, situation, base.SelectType); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHandBuff.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHandBuff.cs new file mode 100644 index 0000000..5aac324 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHandBuff.cs @@ -0,0 +1,104 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayHandBuff : AIWhenPlayTagArgument +{ + private AIPolishConvertedExpression _attackBuff; + + private AIPolishConvertedExpression _lifeBuff; + + private const int ATK_BUFF_ARG_OFFSET = 2; + + private const int LIFE_BUFF_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIWhenPlayHandBuff(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _attackBuff = _exprList[_exprList.Count - 2]; + _lifeBuff = _exprList[_exprList.Count - 1]; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT + }; + } + + public override TargetSelectType GetTargetSelectType() + { + return TargetSelectType.NormalRuleBase; + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + List candidateRange = GetCandidateRange(field); + return GetFilteredTargets(candidateRange, owner, playPtn, situation, isBlockDead); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + List filteredTargets = base.GetFilteredTargets(candidates, tagOwner, playPtn, situation, isBlockDead); + filteredTargets?.RemoveAll((AIVirtualCard c) => !c.IsInHand || c.IsSameCard(tagOwner) || !c.IsUnit); + return filteredTargets; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + AIBuffExecutingInfo_old buffExecutingInfo_old = AIBuffSimulationUtility.GetBuffExecutingInfo_old(tagOwner, field, situation, playPtn, _attackBuff, _lifeBuff); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIHandBuffSimulationUtility.ExecuteHandBuffAll(targetsFromField, buffExecutingInfo_old, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIHandBuffSimulationUtility.ExecuteHandBuffRandom(targetsFromField, buffExecutingInfo_old, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + ExecuteTargetSelectHandBuff(targetsFromField, buffExecutingInfo_old, situation); + break; + } + } + } + + public override void RegisterRuleBaseTargets(List candidates, AIVirtualCard actor, AIVirtualField field, AIVirtualTargetSelectAction situation, ref List targetList) + { + base.RegisterRuleBaseTargets(candidates, actor, field, situation, ref targetList); + AIVirtualCard aIVirtualCard = AIHandBuffSimulationUtility.SelectHandBuffTarget(candidates, AISelectTargetPattern.Best, EnemyAI.EmptyPlayPtn, situation); + if (aIVirtualCard != null) + { + targetList = AIParamQuery.AddElementToList(aIVirtualCard, targetList); + } + } + + private void ExecuteTargetSelectHandBuff(List candidates, AIBuffExecutingInfo_old buffInfo, AISituationInfo situation) + { + if (situation != null && situation.IsTargetExists(base.SelectType)) + { + AIHandBuffSimulationUtility.ExecuteHandBuffTargetSelect(buffInfo, base.SelectType, situation); + } + else + { + AIHandBuffSimulationUtility.ExecuteHandBuffBestTarget(candidates, buffInfo, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHandMetamorphose.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHandMetamorphose.cs new file mode 100644 index 0000000..3f51ebe --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHandMetamorphose.cs @@ -0,0 +1,90 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayHandMetamorphose : AIWhenPlayTagArgument +{ + private readonly int METAMORPHOSE_ID_ARG_OFFSET = 1; + + public AIPolishConvertedExpression MetamorphoseId { get; private set; } + + protected override int SELECT_TYPE_OFFSET => METAMORPHOSE_ID_ARG_OFFSET + 1; + + public AIWhenPlayHandMetamorphose(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + MetamorphoseId = _exprList[_exprList.Count - METAMORPHOSE_ID_ARG_OFFSET]; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + int metamorphoseId = MetamorphoseId.EvalID(); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIMetamorphoseSimulationUtility.MetamorphoseHandAll(field, targetsFromField, metamorphoseId, tagOwner, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIMetamorphoseSimulationUtility.MetamorphoseHandRandom(field, targetsFromField, metamorphoseId, tagOwner, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + if (!situation.IsTargetExists(base.SelectType)) + { + AIConsoleUtility.LogError("AIWhenPlayHandMetamorphose.Execute() Error!! Targets of " + base.SelectType.ToString() + " is not exist!!!!!"); + } + else + { + AIMetamorphoseSimulationUtility.MetamorphoseHandTarget(field, targetsFromField, metamorphoseId, situation, base.SelectType); + } + break; + default: + AIConsoleUtility.LogError("AIWhenPlayHandMetamorphose.Execute() Error!! SelectType=" + base.SelectType); + break; + } + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + List candidateRange = GetCandidateRange(field); + return GetFilteredTargets(candidateRange, owner, playPtn, situation, isBlockDead); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + List filteredTargets = base.GetFilteredTargets(candidates, tagOwner, playPtn, situation, isBlockDead); + filteredTargets?.RemoveAll((AIVirtualCard c) => !c.IsInHand || c.IsSameCard(tagOwner)); + return filteredTargets; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Metamorphose; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHandSelect.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHandSelect.cs new file mode 100644 index 0000000..92f9260 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHandSelect.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayHandSelect : AIWhenPlaySelect +{ + public AIWhenPlayHandSelect(string text) + : base(text) + { + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHeal.cs new file mode 100644 index 0000000..b15164f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayHeal.cs @@ -0,0 +1,117 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class AIWhenPlayHeal : AIWhenPlayTagArgument +{ + private readonly int HEAL_ARG_OFFSET = 1; + + public AIPolishConvertedExpression Heal { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIWhenPlayHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Heal = _exprList[_exprList.Count - HEAL_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + int heal = (int)Heal.EvalArg(tagOwner, playPtn, field, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.HealAll(targetsFromField, field, heal, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + if (situation == null || !situation.IsTargetExists(base.SelectType)) + { + AISkillSimulationUtility.HealTargetPrediction(situation, targetsFromField, tagOwner, field, playPtn, base.SelectType, heal); + } + else + { + AISkillSimulationUtility.HealTarget(situation, field, base.SelectType, heal); + } + break; + case AIScriptTokenArgType.RANDOM_SELECT: + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + + public bool IsDelayHeal(AIVirtualCard tagOwner, AIVirtualField field, AISituationInfo situation) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, field.BestPlayPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int num = (int)Heal.EvalArg(tagOwner, field.BestPlayPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.TARGET_SELECT) + { + float num2 = float.MinValue; + AIVirtualCard aIVirtualCard = null; + float num3 = float.MinValue; + AIVirtualCard aIVirtualCard2 = null; + for (int i = 0; i < targetsFromField.Count; i++) + { + AIVirtualCard aIVirtualCard3 = targetsFromField[i]; + if (!aIVirtualCard3.IsDead) + { + float num4 = (float)Mathf.Min(num, aIVirtualCard3.MaxLife - aIVirtualCard3.Life) * (aIVirtualCard3.IsAlly ? 1f : (-1f)); + if (num2 < num4) + { + num2 = num4; + aIVirtualCard = aIVirtualCard3; + } + float num5 = AIHealSimulationUtility.CalcEvalHealAfterAttack(aIVirtualCard3, num); + if (num3 < num5) + { + num3 = num5; + aIVirtualCard2 = aIVirtualCard3; + } + } + } + num2 = ((aIVirtualCard == null) ? 0f : num2); + num3 = ((aIVirtualCard2 == null) ? 0f : num3); + return num3 > num2; + } + } + return false; + } + + public override void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + } + + public override void MultipleTargetLifePrediction(List targetList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, List lifeList) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayKeywordSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayKeywordSkill.cs new file mode 100644 index 0000000..2f59dc1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayKeywordSkill.cs @@ -0,0 +1,67 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayKeywordSkill : AIWhenPlayTagArgument +{ + private readonly AIScriptTokenArgType _skillType; + + protected override bool _isSelectCountImplemented => true; + + public AIWhenPlayKeywordSkill(string text, AIScriptTokenArgType skill) + : base(text) + { + _skillType = skill; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.GiveSkillToAll(targetsFromField, field, _skillType); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + AISkillSimulationUtility.GiveSkillRandom(targetsFromField, selectCount, field, _skillType); + break; + } + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AISkillSimulationUtility.ExecuteTargetSelectGiveSkill(targetsFromField, tagOwner, field, playPtn, situation, _skillType, base.SelectType, GetSelectCount(tagOwner, field, playPtn, situation)); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + if (AISkillSimulationUtility.IsFollowerOnlySkillType(_skillType)) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + return base.GetFilteredTargets(candidates, tagOwner, playPtn, situation, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayMetamorphose.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayMetamorphose.cs new file mode 100644 index 0000000..f9d9a90 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayMetamorphose.cs @@ -0,0 +1,80 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayMetamorphose : AIWhenPlayTagArgument +{ + private readonly int METAMORPHOSE_ID_ARG_OFFSET = 1; + + private AIScriptTokenArgType _registerSide = AIScriptTokenArgType.BOTH; + + public AIPolishConvertedExpression MetamorphoseId { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIWhenPlayMetamorphose(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + MetamorphoseId = _exprList[_exprList.Count - METAMORPHOSE_ID_ARG_OFFSET]; + if (IsSideTokenArgType(_exprList[0], out var dstTokenARgType)) + { + _registerSide = dstTokenARgType; + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[4] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int metamorphoseId = MetamorphoseId.EvalID(); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + UpdateSituationRemovalType(situation); + AIMetamorphoseSimulationUtility.MetamorphoseAll(field, targetsFromField, metamorphoseId, tagOwner, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIMetamorphoseSimulationUtility.MetamorphoseRandom(field, targetsFromField, metamorphoseId, tagOwner, playPtn, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AIMetamorphoseSimulationUtility.MetamorphoseTarget(field, targetsFromField, metamorphoseId, playPtn, situation, base.SelectType, GetSelectCount(tagOwner, field, playPtn, situation)); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override AIRemovalType GetRemovalType() + { + return AIRemovalType.Metamorphose; + } + + protected override AITokenIdCollection CreateRegisterTokenPoolInfo(AIVirtualCard owner, List idList) + { + return AISummonTokenUtility.CreateTokenIdCollectionFromIdList(owner, _registerSide, idList, AITokenType.Default); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayModifyConsumeEp.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayModifyConsumeEp.cs new file mode 100644 index 0000000..a3e7828 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayModifyConsumeEp.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayModifyConsumeEp : AIWhenPlayTagArgument +{ + protected override bool _isSelectCountImplemented => true; + + public AIWhenPlayModifyConsumeEp(string text) + : base(text) + { + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISkillSimulationUtility.ModifierNotConsumeEpALL(targetsFromField); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AISkillSimulationUtility.ModifierNotConsumeEpTargets(targetsFromField, base.SelectType, situation); + break; + default: + AIConsoleUtility.LogError("AIWhenPlayModifyConsumeEp.Execute() : Ileagal SelectType [" + base.SelectType.ToString() + "] Error!"); + break; + } + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayNotBeAttacked.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayNotBeAttacked.cs new file mode 100644 index 0000000..6b47f6c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayNotBeAttacked.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayNotBeAttacked : AIWhenPlayTagArgument +{ + protected override bool _isSelectCountImplemented => true; + + public AIWhenPlayNotBeAttacked(string text) + : base(text) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT + }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AINotBeAttackedSimulationUtility.GiveNotBeAttackedToAll(targetsFromField); + break; + case AIScriptTokenArgType.TARGET_SELECT: + AINotBeAttackedSimulationUtility.GiveNotBeAttackedToTargeted(situation, base.SelectType); + break; + default: + AIConsoleUtility.LogError("AIWhenPlayNotBeAttacked.Execute() Ileagal SelectType:" + base.SelectType.ToString() + " tagOwner:" + tagOwner.CardName); + break; + } + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayReanimate.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayReanimate.cs new file mode 100644 index 0000000..61e13ca --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayReanimate.cs @@ -0,0 +1,66 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayReanimate : AIWhenPlayTokenArgumentBase +{ + private AIPolishConvertedExpression _costArgument; + + private const int REANIMATE_COST_ARG_OFFSET = 2; + + protected override int SELECT_COUNT_OFFSET => -1; + + protected override int SELECT_TYPE_OFFSET => -1; + + public AIWhenPlayReanimate(string text) + : base(text, AITokenType.Reanimate) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + InitializeSide(); + _costArgument = _exprList[_exprList.Count - (2 - _ommittedIndexOffset)]; + _realNonFilterFirstOffset = 2 - _ommittedIndexOffset; + InitSelectType(); + InitializeFilter(); + } + + protected override void InitSelectType() + { + base.SelectType = AIScriptTokenArgType.RANDOM_SELECT; + } + + protected override void InitializeFilter() + { + List filterExpressionList = AIPlayTagInitializingUtility.GetFilterExpressionList(_exprList, NON_FILTER_FIRST_OFFSET); + base.Filters = new List(); + if (filterExpressionList != null) + { + base.Filters = GetFilters(filterExpressionList); + } + _candidateRangeInfo = CreateCandidateRangeInfo(); + } + + protected override AITokenIdHolderCandidateRangeInformation CreateCandidateRangeInfo() + { + return AITokenIdHolderCandidateRangeInformation.CreateReanimateRangeInformation(SideType); + } + + protected override AITokenIdCollection GetBothSideTokenIdCollectionFromTag(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + bool isTokenAlly; + int reanimateTokenId = AIReanimateSimulationUtility.GetReanimateTokenId(tagOwner, field, playPtn, situation, base.Filters, _costArgument, SideType, out isTokenAlly); + if (reanimateTokenId == -1) + { + return null; + } + return AISummonTokenUtility.CreateTokenIdCollectionForReanimate(tagOwner, reanimateTokenId, isTokenAlly); + } + + public override List GetAllyTokenIdList(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return GetBothSideTokenIdCollection(tagOwner, field, playPtn, situation)?.AllyTokenIdList; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRecoverAttackableCount.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRecoverAttackableCount.cs new file mode 100644 index 0000000..cb148fa --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRecoverAttackableCount.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayRecoverAttackableCount : AIWhenPlayTagArgument +{ + protected override bool _isSelectCountImplemented => true; + + public AIWhenPlayRecoverAttackableCount(string text) + : base(text) + { + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothClassAndInplayCards; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.TARGET_SELECT) + { + ExecuteTargetSelectRecoverAttackableCount(targetsFromField, tagOwner, field, playPtn, situation); + } + } + + private void ExecuteTargetSelectRecoverAttackableCount(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (situation != null && situation.IsTargetExists(base.SelectType)) + { + AIRecoverAttackableCountUtility.RecoverAttackableCountTarget(base.SelectType, situation); + return; + } + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + AIRecoverAttackableCountUtility.RecoverAttackableCountTargetPrediction(targets, selectCount); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.TARGET_SELECT }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRecoverPp.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRecoverPp.cs new file mode 100644 index 0000000..32ef4b7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRecoverPp.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayRecoverPp : AIWhenPlayTagArgument +{ + private readonly int NUM_ARG_OFFSET = 1; + + private AIPolishConvertedExpression _numberArgument; + + public AIWhenPlayRecoverPp(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _numberArgument = _exprList[_exprList.Count - NUM_ARG_OFFSET]; + } + + protected override void InitializeFilter() + { + base.Filters = null; + } + + protected override void InitSelectType() + { + base.SelectType = AIScriptTokenArgType.NONE; + } + + public int GetPlayRecoverPp(AIVirtualCard tagOwner, List playPtn, AIVirtualField field, AISituationInfo situation) + { + return (int)_numberArgument.EvalArg(tagOwner, playPtn, field, situation); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (situation == null || situation.ActionType != AIOperationType.PLAY || situation.Actor == null) + { + return; + } + int playRecoverPp = GetPlayRecoverPp(tagOwner, playPtn, field, situation); + if (playRecoverPp >= 0) + { + if (tagOwner.IsAlly) + { + field.AllyPp += playRecoverPp; + } + else + { + field.EnemyPp += playRecoverPp; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRemoveKeywordSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRemoveKeywordSkill.cs new file mode 100644 index 0000000..0c8e104 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRemoveKeywordSkill.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayRemoveKeywordSkill : AIWhenPlayTagArgument +{ + private readonly AIScriptTokenArgType _skillType; + + public AIWhenPlayRemoveKeywordSkill(string text, AIScriptTokenArgType skill) + : base(text) + { + _skillType = skill; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0 && base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.RemoveKeywordSkillToAll(targetsFromField, _skillType); + } + } + + public List RemoveGuardPredictionInPlayOut(List targetList, AIVirtualCard owner, List playPtn, AISituationInfo situation) + { + if (_skillType != AIScriptTokenArgType.GUARD || base.SelectType != AIScriptTokenArgType.ALL_SELECT) + { + return null; + } + List filteredTargets = GetFilteredTargets(targetList, owner, playPtn, situation); + if (filteredTargets == null || filteredTargets.Count <= 0) + { + return null; + } + filteredTargets.RemoveAll((AIVirtualCard c) => !c.IsGuard); + AISkillSimulationUtility.RemoveKeywordSkillToAll(filteredTargets, _skillType); + return filteredTargets; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForFollowerOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.ALL_SELECT }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRemoveSkill.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRemoveSkill.cs new file mode 100644 index 0000000..26ee984 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayRemoveSkill.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayRemoveSkill : AIWhenPlayTagArgument +{ + public AIWhenPlayRemoveSkill(string text) + : base(text) + { + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AIRemoveSkillSimulationUtility.RemoveSkillAll(targetsFromField, situation); + break; + case AIScriptTokenArgType.RANDOM_SELECT: + AIRemoveSkillSimulationUtility.RemoveSkillRandom(targetsFromField, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + if (situation != null && situation.IsTargetExists(base.SelectType)) + { + AIRemoveSkillSimulationUtility.RemoveSkillTargetSelect(base.SelectType, situation); + } + else + { + AIConsoleUtility.LogError("playRemoveSkillใฏplaySkipไธญใฎTARGET_SELECTๆœชๅฏพๅฟœใงใ™"); + } + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySelect.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySelect.cs new file mode 100644 index 0000000..a4329d2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySelect.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlaySelect : AIWhenPlayTagArgument +{ + private AISelectLogicArgumentBase _selectLogicArg; + + protected override bool _isSelectCountImplemented => true; + + public override bool IsImmediate => true; + + protected override int SELECT_COUNT_OFFSET => 1; + + public AIWhenPlaySelect(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + List list = AIPlayTagInitializingUtility.SplitTagText(text); + if (list.Count == 0) + { + AIConsoleUtility.LogError($"{GetType()} ใฎargใŒไธ่ถณใ—ใฆใ„ใพใ™ใ€‚/n{text}"); + base.InitExpressions(text); + } + else + { + base.InitExpressions(list[0]); + _selectLogicArg = AISelectLogicSimulationUtility.CreateSelectLogicArgument(list[1]); + } + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (situation != null && situation.IsTargetExists(base.SelectType)) + { + return; + } + if (_selectLogicArg == null) + { + AIConsoleUtility.LogError($"{GetType()} error!! _selectLogicArg is null"); + return; + } + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + _selectLogicArg.SetSelectTarget(targetsFromField, selectCount, tagOwner, field, base.SelectType, playPtn, situation); + } + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySetLeaderMaxLife.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySetLeaderMaxLife.cs new file mode 100644 index 0000000..f0f1b0e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySetLeaderMaxLife.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlaySetLeaderMaxLife : AIWhenPlayTagArgument +{ + private AIScriptTokenArgType _side; + + private AIPolishConvertedExpression _life; + + private const int SIDE_OFFSET = 2; + + private const int VALUE_OFFSET = 1; + + public AIWhenPlaySetLeaderMaxLife(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + _side = AIPlayTagInitializingUtility.CreateSingleArgType(_exprList[_exprList.Count - 2]); + _life = _exprList[_exprList.Count - 1]; + } + + protected override void InitializeFilter() + { + base.Filters = null; + } + + protected override void InitSelectType() + { + base.SelectType = AIScriptTokenArgType.NONE; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + int maxLife = (int)_life.EvalArg(tagOwner, playPtn, field, situation); + AISetStatusSimulationUtility.SetLeaderMaxLife(tagOwner, maxLife, _side, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySetMaxStatus.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySetMaxStatus.cs new file mode 100644 index 0000000..7a7c47d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySetMaxStatus.cs @@ -0,0 +1,120 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class AIWhenPlaySetMaxStatus : AIWhenPlayTagArgument +{ + private readonly int LIFE_ARG_OFFSET = 1; + + private readonly int ATTACK_ARG_OFFSET = 2; + + public AIPolishConvertedExpression Attack { get; private set; } + + public AIPolishConvertedExpression Life { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIWhenPlaySetMaxStatus(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + Attack = _exprList[_exprList.Count - ATTACK_ARG_OFFSET]; + Life = _exprList[_exprList.Count - LIFE_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField == null || targetsFromField.Count <= 0) + { + return; + } + int attackValue = GetAttackValue(tagOwner, playPtn, field, situation); + int lifeValue = GetLifeValue(tagOwner, playPtn, field, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISetStatusSimulationUtility.SetMaxStatusToAll(targetsFromField, attackValue, lifeValue, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + if (!situation.IsTargetExists(base.SelectType)) + { + SetMaxStatusToPredictedTarget(targetsFromField, attackValue, lifeValue, situation); + } + else + { + AISetStatusSimulationUtility.SetMaxStatusToTarget(situation, attackValue, lifeValue, base.SelectType); + } + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + + private int GetAttackValue(AIVirtualCard tagOwner, List playPtn, AIVirtualField field, AISituationInfo situation) + { + if (Attack.IsCertainArgumentTypeExpress(AIScriptTokenArgType.NONE)) + { + return -1; + } + return (int)Attack.EvalArg(tagOwner, playPtn, field, situation); + } + + private int GetLifeValue(AIVirtualCard tagOwner, List playPtn, AIVirtualField field, AISituationInfo situation) + { + if (Life.IsCertainArgumentTypeExpress(AIScriptTokenArgType.NONE)) + { + return -1; + } + return (int)Life.EvalArg(tagOwner, playPtn, field, situation); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + bool isAttackEffective = !Attack.IsZeroOrNone(); + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.AllReferableCards; + } + + private void SetMaxStatusToPredictedTarget(List candidates, int attack, int life, AISituationInfo situation) + { + int num = int.MinValue; + int num2 = int.MinValue; + AIVirtualCard target = null; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + int num3 = attack - aIVirtualCard.Attack; + int num4 = Mathf.Min(aIVirtualCard.Life, life) - aIVirtualCard.Life; + int num5 = num3 + num4; + if (num5 > num || (num5 == num && num3 > num2)) + { + num = num5; + num2 = num3; + target = aIVirtualCard; + } + } + situation.SetSingleTargetInInfo(target, TargetSelectType.Default, base.SelectType); + AISetStatusSimulationUtility.SetMaxStatusToTarget(situation, attack, life, base.SelectType); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayShield.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayShield.cs new file mode 100644 index 0000000..88704a3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayShield.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayShield : AIWhenPlayBarrierBase +{ + protected override int _defaultDamageTypeOffset => 2; + + protected override int _stopTimingOffset => 1; + + public AIWhenPlayShield(string text) + : base(text) + { + } + + protected override void GiveBarrierToAllTargets(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AIBarrierSimulationUtility.AddShieldToAll(targets, tagOwner, field, _damageType, _stopTiming); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySpellboost.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySpellboost.cs new file mode 100644 index 0000000..b602e26 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySpellboost.cs @@ -0,0 +1,141 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlaySpellboost : AIWhenPlayTagArgument +{ + private AIPolishConvertedExpression _boostCount; + + private readonly int BOOST_COUNT_ARG_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIWhenPlaySpellboost(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _boostCount = _exprList[_exprList.Count - BOOST_COUNT_ARG_OFFSET]; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + ExecuteSpellboost(tagOwner, field, targetsFromField, playPtn, situation); + } + } + + private void ExecuteSpellboost(AIVirtualCard tagOwner, AIVirtualField field, List targets, List playPtn, AISituationInfo situation) + { + if (targets != null && targets.Count > 0) + { + int boostCount = GetBoostCount(tagOwner, playPtn, field, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISpellboostSimulationUtility.SpellboostAll(targets, boostCount); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + ExecuteTargetSelectSpellboost(tagOwner, boostCount, targets, situation, field, playPtn); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + private void ExecuteTargetSelectSpellboost(AIVirtualCard owner, int boostCount, List targets, AISituationInfo situation, AIVirtualField field, List playPtn) + { + if (situation != null) + { + if (situation.IsTargetExists(base.SelectType)) + { + AISpellboostSimulationUtility.SpellboostTarget(situation, boostCount, targets, base.SelectType); + } + else + { + SpellboostTargetPrediction(owner, boostCount, targets, situation, field, playPtn); + } + } + } + + private void SpellboostTargetPrediction(AIVirtualCard owner, int boostCount, List targets, AISituationInfo situation, AIVirtualField field, List playPtn) + { + List candidates = AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(targets, owner, playPtn); + SelectBestTargetToSpellboost(candidates, field, situation, boostCount, base.SelectType); + } + + private void SelectBestTargetToSpellboost(List candidates, AIVirtualField field, AISituationInfo situation, int boostCount, AIScriptTokenArgType whichTarget) + { + AIVirtualCard target = AISpellboostSimulationUtility.SelectBestTargetForSpellboost(field, boostCount, candidates); + situation.SetSingleTargetInInfo(target, TargetSelectType.Default, whichTarget); + AISpellboostSimulationUtility.SpellboostTarget(situation, boostCount, candidates, whichTarget); + } + + public override void ExecuteForPlayPtnEvaluation(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List targetsFromField = GetTargetsFromField(owner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + ExecuteSpellboost(owner, field, targetsFromField, playPtn, situation); + } + } + + public override void PseudoExecute(AIVirtualField field, AISinglePlayptnRecord record, PlayedCardInfo playInfo, AIVirtualTargetSelectAction situation) + { + AIVirtualCard card = playInfo.Card; + List playPtn = record.PlayPtn; + List targetsFromField = GetTargetsFromField(card, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + ExecuteSpellboost(card, field, targetsFromField, playPtn, situation); + } + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForSpellboost(candidates, tagOwner, base.Filters, playPtn, situation); + } + + public override TargetSelectType GetTargetSelectType() + { + return TargetSelectType.NormalRuleBase; + } + + public override void RegisterRuleBaseTargets(List candidates, AIVirtualCard actor, AIVirtualField field, AIVirtualTargetSelectAction situation, ref List targetList) + { + base.RegisterRuleBaseTargets(candidates, actor, field, situation, ref targetList); + int boostCount = GetBoostCount(actor, null, field, situation); + AIVirtualCard aIVirtualCard = AISpellboostSimulationUtility.SelectBestTargetForSpellboost(field, boostCount, candidates); + if (aIVirtualCard != null) + { + targetList = AIParamQuery.AddElementToList(aIVirtualCard, targetList); + } + } + + public int GetBoostCount(AIVirtualCard tagOwner, List playPtn, AIVirtualField field, AISituationInfo situation) + { + return (int)_boostCount.EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySubtractCountdown.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySubtractCountdown.cs new file mode 100644 index 0000000..f3027f5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySubtractCountdown.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlaySubtractCountdown : AIWhenPlayTagArgument +{ + private readonly int COUNT_CHANGE_ARG_OFFSET = 1; + + public AIPolishConvertedExpression CountChange { get; private set; } + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIWhenPlaySubtractCountdown(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + CountChange = _exprList[_exprList.Count - COUNT_CHANGE_ARG_OFFSET]; + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.TARGET_SELECT, + AIScriptTokenArgType.SECOND_TARGET_SELECT + }; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int num = (int)CountChange.EvalArg(tagOwner, playPtn, field, situation); + switch (base.SelectType) + { + case AIScriptTokenArgType.ALL_SELECT: + AISubtractCountdownSimulationUtility.SubtractCountdownAll(targetsFromField, num, situation); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + AISubtractCountdownSimulationUtility.ExecuteTargetSelectSubtractCountdown(tagOwner, targetsFromField, field, playPtn, situation, base.SelectType, num); + break; + case AIScriptTokenArgType.RANDOM_MULTI_SELECT: + break; + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForCountdownAmuletOnly(candidates, tagOwner, base.Filters, playPtn, situation, isBlockDead); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySummonHandCard.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySummonHandCard.cs new file mode 100644 index 0000000..4e397f2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySummonHandCard.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlaySummonHandCard : AIWhenPlayTagArgument +{ + public AIWhenPlaySummonHandCard(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[1] { AIScriptTokenArgType.TARGET_SELECT }; + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.GetSimulationHandCards(); + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + List candidateRange = GetCandidateRange(field); + return GetFilteredTargets(candidateRange, owner, playPtn, situation); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (base.SelectType == AIScriptTokenArgType.TARGET_SELECT) + { + ExecuteTargetSelect(tagOwner, field, playPtn, situation); + } + } + + private void ExecuteTargetSelect(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (situation != null && situation.IsTargetExists(base.SelectType)) + { + AISummonTokenUtility.ExecuteTargetSelectSummonToken(tagOwner, field, base.SelectType, situation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySummonToken.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySummonToken.cs new file mode 100644 index 0000000..bb1f177 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlaySummonToken.cs @@ -0,0 +1,67 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlaySummonToken : AIWhenPlayTokenArgumentBase +{ + protected override bool _isSelectCountImplemented => true; + + protected override int SELECT_COUNT_OFFSET => 2; + + protected override int SELECT_TYPE_OFFSET => 3; + + public AIWhenPlaySummonToken(string text) + : base(text, AITokenType.Default) + { + } + + protected override AITokenIdCollection GetBothSideTokenIdCollectionFromTag(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false); + int selectCount = GetSelectCount(tagOwner, field, playPtn, situation); + return AISummonTokenUtility.GetBothSideTokenIdListFromFilter(tagOwner, field, targetsFromField, base.Filters, AITokenType.Default, SideType, base.SelectType, selectCount, playPtn, situation); + } + + public override List GetAllyTokenIdList(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AITokenIdCollection bothSideTokenIdCollection = GetBothSideTokenIdCollection(tagOwner, field, playPtn, situation); + if (bothSideTokenIdCollection == null || !bothSideTokenIdCollection.HasAllyToken) + { + return null; + } + return bothSideTokenIdCollection.AllyTokenIdList; + } + + protected override void InitializeSelectCount() + { + int num = (_expectedSelectCountArgOffset = SELECT_COUNT_OFFSET - _ommittedIndexOffset); + AIPolishConvertedExpression aIPolishConvertedExpression = _exprList[_exprList.Count - num]; + if (aIPolishConvertedExpression.IsMathematicExpress()) + { + _selectCount = aIPolishConvertedExpression; + return; + } + AIConsoleUtility.LogError("AIWhenPlaySummonToken.InitializeSelectCount error!! Cannot find _selectCount from argument expression!!!!!"); + _ommittedIndexOffset++; + } + + protected override void InitSelectType() + { + int num = SELECT_TYPE_OFFSET - _ommittedIndexOffset; + if (AIPlayTagInitializingUtility.TryCreateSelectType(_exprList[_exprList.Count - num], base.LegalSelectTypes, out var selectType)) + { + base.SelectType = selectType; + } + else + { + _ommittedIndexOffset++; + base.SelectType = AIScriptTokenArgType.ALL_SELECT; + } + _realNonFilterFirstOffset = SELECT_TYPE_OFFSET - _ommittedIndexOffset; + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayTagArgument.cs new file mode 100644 index 0000000..a0071bc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayTagArgument.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayTagArgument : AITargetSelectTagArgument +{ + public virtual bool IsImmediate => false; + + public AIWhenPlayTagArgument(string text) + : base(text) + { + } + + public virtual void ExecuteForPlayPtnEvaluation(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + } + + public virtual void PseudoExecute(AIVirtualField field, AISinglePlayptnRecord record, PlayedCardInfo playInfo, AIVirtualTargetSelectAction situation) + { + } + + public virtual void TargetLifePrediction(AIVirtualCard target, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLifeRecord) + { + throw new NotImplementedException(); + } + + public virtual void MultipleTargetLifePrediction(List targetList, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, List lifeList) + { + throw new NotImplementedException(); + } + + public List GetTargetSelectCandidates(AIVirtualCard owner, AIVirtualField field, AISituationInfo situation) + { + if (base.SelectType != AIScriptTokenArgType.TARGET_SELECT && base.SelectType != AIScriptTokenArgType.SECOND_TARGET_SELECT) + { + return null; + } + List list = GetTargetsFromField(owner, field, null, situation); + if (list != null && list.Count > 0) + { + int selectCount = GetSelectCount(owner, owner.SelfField, null, situation); + list = AITargetSelectFilteringUtility.GetLegalCandidates(owner, list, selectCount); + } + return list; + } + + public virtual TargetSelectType GetTargetSelectType() + { + return TargetSelectType.Default; + } + + public virtual AIRemovalType GetRemovalType() + { + return AIRemovalType.None; + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + List candidateRange = GetCandidateRange(field); + if (candidateRange == null || candidateRange.Count <= 0) + { + return null; + } + List list = new List(candidateRange); + int num; + if (base.SelectType != AIScriptTokenArgType.TARGET_SELECT) + { + num = ((base.SelectType == AIScriptTokenArgType.SECOND_TARGET_SELECT) ? 1 : 0); + if (num == 0) + { + goto IL_006d; + } + } + else + { + num = 1; + } + AIVirtualCard compareCard = ((owner.BeforeTransformedCardForSimulation != null) ? owner.BeforeTransformedCardForSimulation : owner); + list.RemoveAll((AIVirtualCard c) => c.IsSameCard(compareCard)); + goto IL_006d; + IL_006d: + List list2 = GetFilteredTargets(list, owner, playPtn, situation, isBlockDead); + if (num != 0 && list2 != null && list2.Count > 0) + { + int selectCount = GetSelectCount(owner, field, playPtn, situation); + list2 = AITargetSelectFilteringUtility.GetLegalCandidates(owner, list2, selectCount); + } + return list2; + } + + public virtual void RegisterRuleBaseTargets(List candidates, AIVirtualCard actor, AIVirtualField field, AIVirtualTargetSelectAction situation, ref List targetList) + { + if (GetTargetSelectType() != TargetSelectType.NormalRuleBase) + { + AIConsoleUtility.LogError("AIWhenPlayTagArgument.GetRuleBaseTargets() error!! " + GetType()?.ToString() + " is not NormalRuleBase!!!!!"); + } + if (base.SelectType != AIScriptTokenArgType.TARGET_SELECT && base.SelectType != AIScriptTokenArgType.SECOND_SELECTED_TARGET) + { + AIConsoleUtility.LogError("AIWhenPlayTagArgument.GetRuleBaseTargets() error!! SelectType = " + base.SelectType.ToString() + "!!!!!"); + } + } + + public void UpdateSituationRemovalType(AISituationInfo situation) + { + if (situation != null && situation.SelectedTargets != null) + { + AIRemovalType removalType = GetRemovalType(); + if (base.ReferenceSelectedTargetType != AIScriptTokenArgType.NONE && removalType != AIRemovalType.None) + { + situation.SelectedTargets.UpdateRemovalType(base.ReferenceSelectedTargetType, removalType); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayTokenArgumentBase.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayTokenArgumentBase.cs new file mode 100644 index 0000000..d898542 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayTokenArgumentBase.cs @@ -0,0 +1,119 @@ +using System.Collections.Generic; + +namespace Wizard; + +public abstract class AIWhenPlayTokenArgumentBase : AIWhenPlayTagArgument +{ + private AITokenType _tokenType; + + protected AITokenIdHolderCandidateRangeInformation _candidateRangeInfo; + + private const int SIDE_OFFSET = 1; + + protected int _ommittedIndexOffset; + + protected int _realNonFilterFirstOffset; + + public virtual AIScriptTokenArgType SideType { get; protected set; } + + protected override int SELECT_TYPE_OFFSET => -1; + + protected override int NON_FILTER_FIRST_OFFSET => _realNonFilterFirstOffset; + + public AIWhenPlayTokenArgumentBase(string text, AITokenType tokenType) + : base(text) + { + _tokenType = tokenType; + } + + protected override void InitExpressions(string text) + { + InitExprList(text); + InitializeSide(); + InitializeSelectCount(); + InitSelectType(); + InitializeFilter(); + } + + protected virtual void InitializeSide() + { + if (AIPlayTagInitializingUtility.TryCreateTokenSideType(_exprList[_exprList.Count - 1], out var sideType)) + { + _ommittedIndexOffset = 0; + SideType = sideType; + } + else + { + _ommittedIndexOffset = 1; + SideType = AIScriptTokenArgType.ALLY; + } + } + + protected override void InitializeFilter() + { + base.InitializeFilter(); + _candidateRangeInfo = CreateCandidateRangeInfo(); + } + + protected virtual AITokenIdHolderCandidateRangeInformation CreateCandidateRangeInfo() + { + return new AITokenIdHolderCandidateRangeInformation(base.Filters); + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AITokenIdCollection bothSideTokenIdCollection = GetBothSideTokenIdCollection(tagOwner, field, playPtn, situation); + if (bothSideTokenIdCollection != null && bothSideTokenIdCollection.HasToken) + { + bothSideTokenIdCollection.SummonAllTokenToField(field, tagOwner, situation); + } + } + + public override void PseudoExecute(AIVirtualField field, AISinglePlayptnRecord record, PlayedCardInfo playInfo, AIVirtualTargetSelectAction situation) + { + if (record == null || record.FirstSummonedAllyFollower != null || base.SelectType == AIScriptTokenArgType.RANDOM_SELECT || base.SelectType == AIScriptTokenArgType.RANDOM_MULTI_SELECT) + { + return; + } + AIVirtualCard card = playInfo.Card; + List playPtn = record.PlayPtn; + List allyTokenIdList = GetAllyTokenIdList(card, field, playPtn, situation); + if (allyTokenIdList != null && allyTokenIdList.Count > 0) + { + AIVirtualCard aIVirtualCard = AISummonTokenUtility.FirstSummonedFollowerTokenCandidate(allyTokenIdList, card, field, situation, isTokenAlly: true, isSkillSummon: true); + if (aIVirtualCard != null) + { + record.FirstSummonedAllyFollower = aIVirtualCard; + } + } + } + + public virtual AITokenIdCollection GetBothSideTokenIdCollection(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (situation.IsLatestAction && (base.SelectType == AIScriptTokenArgType.RANDOM_SELECT || base.SelectType == AIScriptTokenArgType.RANDOM_MULTI_SELECT)) + { + return GetBothSideTokenIdCollectionFromRealTargetInformation(tagOwner, field, playPtn, situation); + } + return GetBothSideTokenIdCollectionFromTag(tagOwner, field, playPtn, situation); + } + + protected virtual AITokenIdCollection GetBothSideTokenIdCollectionFromRealTargetInformation(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + bool isTokenAlly = AISummonTokenUtility.GetIsTokenAlly(tagOwner, SideType); + List tokenIdListFromDequeuedRealTargetInfo = situation.GetTokenIdListFromDequeuedRealTargetInfo(tagOwner, _tokenType); + if (tokenIdListFromDequeuedRealTargetInfo == null || tokenIdListFromDequeuedRealTargetInfo.Count <= 0) + { + return null; + } + return AISummonTokenUtility.CreateTokenIdCollection(tagOwner, tokenIdListFromDequeuedRealTargetInfo, isTokenAlly, _tokenType); + } + + protected abstract AITokenIdCollection GetBothSideTokenIdCollectionFromTag(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation); + + public abstract List GetAllyTokenIdList(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation); + + protected override List GetCandidateRange(AIVirtualField field) + { + return _candidateRangeInfo.GetTokenIdHolderRange(field); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayTokenDraw.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayTokenDraw.cs new file mode 100644 index 0000000..08eb6ef --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhenPlayTokenDraw.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhenPlayTokenDraw : AIWhenPlayTagArgument +{ + private AIPolishConvertedExpression _tokenCount; + + private const int TOKEN_COUNT_OFFSET = 1; + + protected override int SELECT_TYPE_OFFSET => -1; + + protected override int NON_FILTER_FIRST_OFFSET => 1; + + public AIWhenPlayTokenDraw(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _tokenCount = _exprList[_exprList.Count - 1]; + } + + protected override void InitSelectType() + { + base.SelectType = AIScriptTokenArgType.ALL_SELECT; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + AISummonTokenUtility.ExecuteDrawToken(GetTargetsFromField(tagOwner, field, playPtn, situation, isBlockDead: false), base.Filters, _tokenCount, AIScriptTokenArgType.ALLY, tagOwner, field, playPtn, situation); + } + + protected override List GetCandidateRange(AIVirtualField field) + { + return field.CardListSet.BothInplayCards; + } + + public override List GetTargetsFromField(AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return GetCandidateRange(field); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AchievementImpl.cs b/SVSim.BattleEngine/Engine/Wizard/AchievementImpl.cs new file mode 100644 index 0000000..76050a6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AchievementImpl.cs @@ -0,0 +1,391 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using UnityEngine.SocialPlatforms; + +namespace Wizard; + +public class AchievementImpl : MonoBehaviour +{ + public enum eAchievementID + { + ELF10, + ELF25, + ELF40, + RYL10, + RYL25, + RYL40, + WCH10, + WCH25, + WCH40, + DGN10, + DGN25, + DGN40, + NCR10, + NCR25, + NCR40, + VMP10, + VMP25, + VMP40, + BSP10, + BSP25, + BSP40, + ARISA_CLR, + ERIKA_CLR, + ISABELLE_CLR, + ROWEN_CLR, + LUNA_CLR, + URIAS_CLR, + ERIS_CLR, + ALLSTORY_CLR, + RANK_D, + RANK_C, + RANK_B, + RANK_A, + NEM10, + NEM25, + NEM40 + } + + public class AchievementCallbackImpl : IAchievementCallback + { + private bool _bShowAchievementAfterSignIn; + + public bool bShowAchievementAfterSignIn + { + set + { + _bShowAchievementAfterSignIn = value; + } + } + + public void OnSignIn(bool success) + { + if (success) + { + instance.mIsSignIn = true; + if (_bShowAchievementAfterSignIn) + { + AchievementManager.ShowAchievementsUI(); + } + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SOCIAL_ACHIEVEMENT_SIGNIN, flag: true); + } + else + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SOCIAL_ACHIEVEMENT_SIGNIN, flag: false); + } + _bShowAchievementAfterSignIn = false; + } + + public void OnSignOut() + { + instance.mIsSignIn = false; + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SOCIAL_ACHIEVEMENT_SIGNIN, flag: false); + } + + public void OnReleaseAchievement(bool success) + { + } + + public void OnProceedAchievement(bool success) + { + } + + public void OnLoadAchievements(IAchievement[] achievements) + { + } + + public void OnLoadAchievementDescriptions(IAchievementDescription[] descriptions) + { + } + } + + private readonly string[] mszAchievementID = new string[36] + { + "CgkIz8_azvQHEAIQAQ", "CgkIz8_azvQHEAIQAg", "CgkIz8_azvQHEAIQAw", "CgkIz8_azvQHEAIQBA", "CgkIz8_azvQHEAIQBQ", "CgkIz8_azvQHEAIQBg", "CgkIz8_azvQHEAIQBw", "CgkIz8_azvQHEAIQCA", "CgkIz8_azvQHEAIQCQ", "CgkIz8_azvQHEAIQCg", + "CgkIz8_azvQHEAIQCw", "CgkIz8_azvQHEAIQDA", "CgkIz8_azvQHEAIQDQ", "CgkIz8_azvQHEAIQDg", "CgkIz8_azvQHEAIQDw", "CgkIz8_azvQHEAIQEA", "CgkIz8_azvQHEAIQEQ", "CgkIz8_azvQHEAIQEg", "CgkIz8_azvQHEAIQEw", "CgkIz8_azvQHEAIQFA", + "CgkIz8_azvQHEAIQFQ", "CgkIz8_azvQHEAIQFg", "CgkIz8_azvQHEAIQFw", "CgkIz8_azvQHEAIQGA", "CgkIz8_azvQHEAIQGQ", "CgkIz8_azvQHEAIQGg", "CgkIz8_azvQHEAIQGw", "CgkIz8_azvQHEAIQHA", "CgkIz8_azvQHEAIQHQ", "CgkIz8_azvQHEAIQHg", + "CgkIz8_azvQHEAIQHw", "CgkIz8_azvQHEAIQIA", "CgkIz8_azvQHEAIQIQ", "CgkIz8_azvQHEAIQJA", "CgkIz8_azvQHEAIQJQ", "CgkIz8_azvQHEAIQJg" + }; + + private const int LEVEL_10 = 10; + + private const int LEVEL_25 = 25; + + private const int LEVEL_40 = 40; + + private const int RANK_ID_D0 = 5; + + private const int RANK_ID_C0 = 9; + + private const int RANK_ID_B0 = 13; + + private const int RANK_ID_A0 = 17; + + private bool mIsSignIn; + + private AchievementCallbackImpl mCallbackImpl; + + public static AchievementImpl instance; + + private void Awake() + { + Initialize(); + } + + public void Initialize() + { + if (mCallbackImpl == null) + { + mCallbackImpl = new AchievementCallbackImpl(); + } + AchievementManager.Initialize(mCallbackImpl); + instance = this; + } + + public void SignIn(Action callback = null) + { + if (mCallbackImpl != null) + { + mCallbackImpl.bShowAchievementAfterSignIn = false; + } + StartCoroutine(SocialServiceUtility.Instance.SignIn(delegate(bool success) + { + if (mCallbackImpl != null) + { + mCallbackImpl.OnSignIn(success); + } + if (callback != null) + { + callback(success); + } + })); + } + + public void SignOut(Action callback = null) + { + SocialServiceUtility.Instance.SignOut(delegate + { + if (mCallbackImpl != null) + { + mCallbackImpl.OnSignOut(); + } + if (callback != null) + { + callback(); + } + }); + mIsSignIn = false; + } + + public void ShowAchievements(Action callback = null) + { + if (mCallbackImpl != null) + { + mCallbackImpl.bShowAchievementAfterSignIn = true; + } + StartCoroutine(SocialServiceUtility.Instance.SignIn(delegate(bool success) + { + if (success) + { + ReleaseAchievementShouldBeReleased(); + } + if (mCallbackImpl != null) + { + mCallbackImpl.OnSignIn(success); + } + if (callback != null) + { + callback(success); + } + })); + } + + public void ReleaseAchievement(eAchievementID id) + { + if (mIsSignIn) + { + AchievementManager.ReleaseAchievement(mszAchievementID[(int)id]); + } + } + + public void ReleaseAchievement(string id) + { + if (mIsSignIn) + { + AchievementManager.ReleaseAchievement(id); + ReleaseAchievementShouldBeReleased(); + } + } + + private void ReleaseAchievementShouldBeReleased() + { + for (int i = 1; i < 9; i++) + { + ClassCharaPrm classPrm = GameMgr.GetIns().GetDataMgr().GetClassPrm(i); + Dictionary achievementIDsByClass = getAchievementIDsByClass((CardBasePrm.ClanType)i); + int classCharaLv = classPrm.GetClassCharaLv(); + if (classCharaLv >= 10) + { + ReleaseAchievement(achievementIDsByClass[10]); + } + if (classCharaLv >= 25) + { + ReleaseAchievement(achievementIDsByClass[25]); + } + if (classCharaLv >= 40) + { + ReleaseAchievement(achievementIDsByClass[40]); + } + } + for (int j = 0; j < 2; j++) + { + int num = PlayerStaticData.UserRank((Format)j); + if (num >= 5) + { + ReleaseAchievement(eAchievementID.RANK_D); + } + if (num >= 9) + { + ReleaseAchievement(eAchievementID.RANK_C); + } + if (num >= 13) + { + ReleaseAchievement(eAchievementID.RANK_B); + } + if (num >= 17) + { + ReleaseAchievement(eAchievementID.RANK_A); + } + } + } + + private Dictionary getAchievementIDsByClass(CardBasePrm.ClanType type) + { + return type switch + { + CardBasePrm.ClanType.MIN => new Dictionary + { + { + 10, + eAchievementID.ELF10 + }, + { + 25, + eAchievementID.ELF25 + }, + { + 40, + eAchievementID.ELF40 + } + }, + CardBasePrm.ClanType.ROYAL => new Dictionary + { + { + 10, + eAchievementID.RYL10 + }, + { + 25, + eAchievementID.RYL25 + }, + { + 40, + eAchievementID.RYL40 + } + }, + CardBasePrm.ClanType.WITCH => new Dictionary + { + { + 10, + eAchievementID.WCH10 + }, + { + 25, + eAchievementID.WCH25 + }, + { + 40, + eAchievementID.WCH40 + } + }, + CardBasePrm.ClanType.DRAGON => new Dictionary + { + { + 10, + eAchievementID.DGN10 + }, + { + 25, + eAchievementID.DGN25 + }, + { + 40, + eAchievementID.DGN40 + } + }, + CardBasePrm.ClanType.NECRO => new Dictionary + { + { + 10, + eAchievementID.NCR10 + }, + { + 25, + eAchievementID.NCR25 + }, + { + 40, + eAchievementID.NCR40 + } + }, + CardBasePrm.ClanType.VAMPIRE => new Dictionary + { + { + 10, + eAchievementID.VMP10 + }, + { + 25, + eAchievementID.VMP25 + }, + { + 40, + eAchievementID.VMP40 + } + }, + CardBasePrm.ClanType.BISHOP => new Dictionary + { + { + 10, + eAchievementID.BSP10 + }, + { + 25, + eAchievementID.BSP25 + }, + { + 40, + eAchievementID.BSP40 + } + }, + CardBasePrm.ClanType.NEMESIS => new Dictionary + { + { + 10, + eAchievementID.NEM10 + }, + { + 25, + eAchievementID.NEM25 + }, + { + 40, + eAchievementID.NEM40 + } + }, + _ => throw new Exception("bad ClanType: " + type), + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AllLabelColorChanger.cs b/SVSim.BattleEngine/Engine/Wizard/AllLabelColorChanger.cs new file mode 100644 index 0000000..f702409 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AllLabelColorChanger.cs @@ -0,0 +1,221 @@ +using System.Collections.Generic; +using UnityEngine; +using Wizard.Bingo; + +namespace Wizard; + +public class AllLabelColorChanger +{ + public struct ColorSet + { + public Color32 FontColor { get; private set; } + + public Color32 FrameColor { get; private set; } + + public UILabel.Effect Effect { get; private set; } + + public Vector2 EffectDistance { get; private set; } + + public Color32? ButtonFontColor { get; private set; } + + public bool DontChangeEffect { get; private set; } + + public ColorSet(Color32 fontColor, Color32 frameColor, UILabel.Effect effect, Vector2 effectDistance, Color32? buttonFontColor = null) + { + FontColor = fontColor; + FrameColor = frameColor; + Effect = effect; + EffectDistance = effectDistance; + DontChangeEffect = false; + ButtonFontColor = buttonFontColor; + } + + public ColorSet(Color32 fontColor) + { + FontColor = fontColor; + DontChangeEffect = true; + FrameColor = fontColor; + Effect = UILabel.Effect.None; + EffectDistance = Vector2.zero; + ButtonFontColor = null; + } + } + + private static bool deactivateTextColorChange = false; + + private static Dictionary COLOR_TABLE = new Dictionary + { + { + LabelDefine.TEXT_COLOR_NORMAL, + new ColorSet(FromHexRGB(14182531), FromHexRGB(16777215), UILabel.Effect.None, new Vector2(2f, 2f)) + }, + { + LabelDefine.TEXT_COLOR_CREAM, + new ColorSet(FromHexRGB(14182531), new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, 0), UILabel.Effect.None, Vector2.zero) + }, + { + LabelDefine.TEXT_COLOR_BUTTON_DISABLE, + new ColorSet(FromHexRGB(11838375), FromHexRGB(7171180), UILabel.Effect.None, new Vector2(2f, 2f), FromHexRGB(6106424)) + }, + { + LabelDefine.TEXT_COLOR_KEYWORD, + new ColorSet(FromHexRGB(13803266), FromHexRGB(16777215), UILabel.Effect.None, Vector2.zero) + }, + { + LabelDefine.TEXT_COLOR_ORANGE, + new ColorSet(FromHexRGB(16777215), FromHexRGB(16777215), UILabel.Effect.None, Vector2.zero) + } + }; + + public static Dictionary COLOR_TABLE_DETAIL = new Dictionary + { + { + LabelDefine.TEXT_COLOR_NORMAL, + new ColorSet(FromHexRGB(14182531), FromHexRGB(16777215), UILabel.Effect.None, new Vector2(2f, 2f)) + }, + { + LabelDefine.TEXT_COLOR_CREAM, + new ColorSet(FromHexRGB(11892614), new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, 0), UILabel.Effect.None, Vector2.zero) + }, + { + LabelDefine.TEXT_COLOR_BUTTON_DISABLE, + new ColorSet(FromHexRGB(6106424), FromHexRGB(7171180), UILabel.Effect.Outline8, new Vector2(2f, 2f)) + } + }; + + public static Dictionary COLOR_TABLE_DECK_SELECTION_ROTATION_UNLIMITED = new Dictionary { + { + LabelDefine.TEXT_COLOR_NORMAL, + new ColorSet(FromHexRGB(16777215), FromHexRGB(16777215), UILabel.Effect.None, new Vector2(2f, 2f)) + } }; + + public static Dictionary COLOR_TABLE_DECK_SELECTION = new Dictionary + { + { + LabelDefine.TEXT_COLOR_NORMAL, + new ColorSet(FromHexRGB(16777215), FromHexRGB(14182531), UILabel.Effect.None, new Vector2(2f, 2f)) + }, + { + LabelDefine.TEXT_COLOR_ORANGE, + new ColorSet(FromHexRGB(16777215), FromHexRGB(16777215), UILabel.Effect.None, Vector2.zero) + } + }; + + public static Dictionary COLOR_TABLE_QUEST_BUTTON = new Dictionary + { + { + LabelDefine.TEXT_COLOR_NORMAL, + new ColorSet(FromHexRGB(16777201)) + }, + { + LabelDefine.TEXT_COLOR_ORANGE, + new ColorSet(FromHexRGB(16777215), FromHexRGB(16777215), UILabel.Effect.None, Vector2.zero) + } + }; + + private static Dictionary COLOR_TABLE_BINGO = new Dictionary(); + + private static Dictionary COLOR_TABLE_BINGO_BUTTON = new Dictionary + { + { + LabelDefine.TEXT_COLOR_NORMAL, + new ColorSet(FromHexRGB(4599345), FromHexRGB(16777215), UILabel.Effect.None, new Vector2(2f, 2f)) + }, + { + LabelDefine.TEXT_COLOR_BUTTON_DISABLE, + new ColorSet(FromHexRGB(4599345), FromHexRGB(16777215), UILabel.Effect.None, new Vector2(2f, 2f)) + } + }; + + private static Color32 FromHexRGB(int hex) + { + byte r = (byte)((hex & 0xFF0000) >> 16); + byte g = (byte)((hex & 0xFF00) >> 8); + byte b = (byte)(hex & 0xFF); + return new Color32(r, g, b, byte.MaxValue); + } + + public static void ChangeAllLabel(GameObject root, Dictionary colorDict = null) + { + if (deactivateTextColorChange) + { + return; + } + if (colorDict == null) + { + colorDict = COLOR_TABLE; + } + if (root.GetComponentInChildren(includeInactive: true) != null) + { + colorDict = COLOR_TABLE_DECK_SELECTION; + } + if (root.GetComponent() != null) + { + colorDict = COLOR_TABLE_QUEST_BUTTON; + } + if (root.GetComponent() != null) + { + colorDict = COLOR_TABLE_DETAIL; + } + if (root.GetComponent() != null) + { + colorDict = COLOR_TABLE_BINGO; + } + if (colorDict == COLOR_TABLE_DETAIL && (root.name == "CardTexture" || root.name == "CardText")) + { + return; + } + UILabel[] components = root.GetComponents(); + foreach (UILabel uILabel in components) + { + bool flag = false; + bool flag2 = false; + ColorOverwrite component = uILabel.GetComponent(); + if (component != null) + { + if (component.ColorChange == ColorOverwrite.Change.No) + { + continue; + } + if (component.ColorChange == ColorOverwrite.Change.UseDeckColorSet) + { + colorDict = COLOR_TABLE_DECK_SELECTION; + } + else if (component.ColorChange == ColorOverwrite.Change.UseBingoButtonSet) + { + colorDict = COLOR_TABLE_BINGO_BUTTON; + } + flag2 = component.DontChangeEffectDistance; + flag = component.DontChangeEffectStyle; + } + if (uILabel.GetComponent() != null || !colorDict.TryGetValue(uILabel.color, out var value)) + { + continue; + } + if ((bool)uILabel.gameObject.GetComponentInParent(includeInactive: true) && (uILabel.color == LabelDefine.TEXT_COLOR_NORMAL || uILabel.color == LabelDefine.TEXT_COLOR_BUTTON_DISABLE) && value.ButtonFontColor.HasValue) + { + uILabel.color = value.ButtonFontColor.Value; + } + else + { + uILabel.color = value.FontColor; + } + if (!value.DontChangeEffect) + { + uILabel.effectColor = value.FrameColor; + if (!flag) + { + uILabel.effectStyle = value.Effect; + } + if (!flag2) + { + uILabel.effectDistance = value.EffectDistance; + } + } + } + for (int j = 0; j < root.transform.childCount; j++) + { + ChangeAllLabel(root.transform.GetChild(j).gameObject, colorDict); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AllyPlayBonusPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/AllyPlayBonusPolicyCollection.cs new file mode 100644 index 0000000..6eedb5d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AllyPlayBonusPolicyCollection.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AllyPlayBonusPolicyCollection : AIPolicyCollection +{ + public float GetAllyPlayBonus(AIVirtualCard playCard, List playPtn, AISituationInfo situation, ref float currentUseMinValue) + { + if (!base.HasPolicy) + { + return 0f; + } + float num = 0f; + AIVirtualField selfField = playCard.SelfField; + AIVirtualCard allyClass = selfField.AllyClass; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.PolicyType != AIPolicyType.AllyPlayBonus || !(aIPolicyData.Argument is AIOtherPlayBonus) || !aIPolicyData.CheckCondition(allyClass, playPtn, selfField, situation)) + { + continue; + } + AIOtherPlayBonus aIOtherPlayBonus = aIPolicyData.Argument as AIOtherPlayBonus; + if (!AIFilteringUtility.CheckMatchTargetFiltering(playCard, null, aIOtherPlayBonus.Filters, playPtn, allyClass, situation)) + { + continue; + } + if (aIOtherPlayBonus.IsUseMin) + { + float evaluateValue = aIOtherPlayBonus.GetEvaluateValue(allyClass, playPtn, situation); + if (EnemyAI.IsLargerThan(currentUseMinValue, evaluateValue)) + { + currentUseMinValue = evaluateValue; + } + } + else + { + num += aIOtherPlayBonus.GetEvaluateValue(allyClass, playPtn, situation); + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AllyPlayBonusRatePolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/AllyPlayBonusRatePolicyCollection.cs new file mode 100644 index 0000000..c1b7a2a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AllyPlayBonusRatePolicyCollection.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AllyPlayBonusRatePolicyCollection : AIPolicyCollection +{ + public float GetAllyPlayBonusRate(AIVirtualCard playCard, List playPtn, AISituationInfo situation) + { + if (!base.HasPolicy) + { + return 1f; + } + float num = 1f; + AIVirtualField selfField = playCard.SelfField; + AIVirtualCard allyClass = selfField.AllyClass; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.Argument is AIOtherPlayBonusRate && aIPolicyData.CheckCondition(allyClass, playPtn, selfField, situation)) + { + AIOtherPlayBonusRate aIOtherPlayBonusRate = aIPolicyData.Argument as AIOtherPlayBonusRate; + num *= aIOtherPlayBonusRate.GetBonusRate(allyClass, playCard, playPtn, situation); + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AreaSelectClearReward.cs b/SVSim.BattleEngine/Engine/Wizard/AreaSelectClearReward.cs new file mode 100644 index 0000000..5c9633b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AreaSelectClearReward.cs @@ -0,0 +1,296 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +internal class AreaSelectClearReward : MonoBehaviour +{ + private class TextureTransformParam + { + public int Width { get; private set; } + + public int Height { get; private set; } + + public Vector3 Position { get; private set; } + + public Quaternion Rotation { get; private set; } + + public TextureTransformParam(int width, int height, Vector3 position, Quaternion rotation) + { + Width = width; + Height = height; + Position = position; + Rotation = rotation; + } + } + + private readonly Dictionary USERGOODS_TEXTURE_LAYOUT_DICT = new Dictionary + { + { + UserGoods.Type.Item, + new TextureTransformParam(80, 80, Vector3.zero, Quaternion.identity) + }, + { + UserGoods.Type.Sleeve, + new TextureTransformParam(80, 108, new Vector3(12f, 12f, 0f), Quaternion.Euler(0f, 0f, -15f)) + }, + { + UserGoods.Type.Emblem, + new TextureTransformParam(80, 80, Vector3.zero, Quaternion.identity) + }, + { + UserGoods.Type.Degree, + new TextureTransformParam(169, 43, new Vector3(44f, -10f, 0f), Quaternion.identity) + }, + { + UserGoods.Type.Skin, + new TextureTransformParam(100, 80, Vector3.zero, Quaternion.identity) + } + }; + + private readonly Quaternion CARDOBJECT_ROTATION_QUATERNION = new Quaternion(0f, 0f, 0f, 0f); + + private const int MASK_DEPTHOFFSET_FROM_FRAME = -1; + + private const int CARD_DEPTHOFFSET_FROM_FRAME = -2; + + private readonly Color32 ACQUIRED_GRAY_COLOR = new Color32(144, 144, 144, byte.MaxValue); + + private readonly Vector3 DEFAULT_NUM_POSITION = new Vector3(48f, -25f, 0f); + + private readonly Vector3 CARD_NUM_POSITION = new Vector3(66f, -25f, 0f); + + [SerializeField] + private GameObject _objLayoutCard; + + [SerializeField] + private GameObject _objAttachCard; + + [SerializeField] + private UISprite _spriteCardAcquiredMask; + + [SerializeField] + private GameObject _objLayoutSprite; + + [SerializeField] + private UISprite _spriteGoods; + + [SerializeField] + private GameObject _objLayoutTexture; + + [SerializeField] + private UITexture _textureGoods; + + [SerializeField] + private UILabel _labelNum; + + private List _cardObjList; + + private GameObject _cardObjEvacuationRoot; + + private GameObject _displayedCardObj; + + public UserGoods.Type RewardGoodsType { get; private set; } + + public void Init(List cardObjList, GameObject cardObjEvacuationRoot) + { + _cardObjList = cardObjList; + _cardObjEvacuationRoot = cardObjEvacuationRoot; + HideAllLayout(); + } + + public void ShowReward(UserGoods.Type goodsType, long goodsId, int goodsCount, bool isAcquired) + { + HideAllLayout(); + switch (goodsType) + { + case UserGoods.Type.Card: + ShowCard((int)goodsId, goodsCount, isAcquired); + break; + case UserGoods.Type.RedEther: + case UserGoods.Type.Rupy: + ShowSprite(goodsType, goodsCount, isAcquired); + break; + case UserGoods.Type.Item: + case UserGoods.Type.Sleeve: + case UserGoods.Type.Emblem: + case UserGoods.Type.Degree: + case UserGoods.Type.Skin: + ShowTexture(goodsType, goodsId, goodsCount, isAcquired); + break; + } + RewardGoodsType = goodsType; + } + + public Transform GetRewardTransform() + { + switch (RewardGoodsType) + { + case UserGoods.Type.Card: + return _objAttachCard.transform; + case UserGoods.Type.RedEther: + case UserGoods.Type.Rupy: + return _spriteGoods.transform; + case UserGoods.Type.Item: + case UserGoods.Type.Sleeve: + case UserGoods.Type.Emblem: + case UserGoods.Type.Degree: + case UserGoods.Type.Skin: + return _textureGoods.transform; + default: + return null; + } + } + + private void HideAllLayout() + { + _objLayoutCard.SetActive(value: false); + _objLayoutSprite.SetActive(value: false); + _objLayoutTexture.SetActive(value: false); + } + + private void ShowCard(int cardId, int cardCount, bool isAcquired) + { + if (_displayedCardObj != null) + { + _displayedCardObj.SetActive(value: false); + _displayedCardObj.transform.SetParent(_cardObjEvacuationRoot.transform); + } + _objLayoutCard.SetActive(value: true); + UIBase_CardManager.CardObjData cardObjData = GetCardObjData(cardId); + if (cardObjData == null) + { + _objLayoutCard.SetActive(value: false); + return; + } + _displayedCardObj = cardObjData.CardObj; + _displayedCardObj.transform.SetParent(_objAttachCard.transform); + _displayedCardObj.transform.localPosition = Vector3.zero; + _displayedCardObj.transform.localScale = Vector3.one; + _displayedCardObj.transform.rotation = CARDOBJECT_ROTATION_QUATERNION; + _displayedCardObj.SetActive(value: true); + CardListTemplate component = _displayedCardObj.GetComponent(); + component._newLabel.gameObject.SetActive(value: false); + _labelNum.text = Data.SystemText.Get("Common_0040", cardCount.ToString()); + _labelNum.transform.localPosition = CARD_NUM_POSITION; + _labelNum.gameObject.SetActive(value: true); + _spriteCardAcquiredMask.gameObject.SetActive(isAcquired); + UIManager.SetObjectToGrey(_displayedCardObj, isAcquired); + if (isAcquired) + { + _spriteCardAcquiredMask.depth = component._frameSprite.depth + -1; + component._cardTexture.depth = component._frameSprite.depth + -2; + _displayedCardObj.GetComponent().enabled = true; + } + } + + private UIBase_CardManager.CardObjData GetCardObjData(int cardId) + { + for (int i = 0; i < _cardObjList.Count; i++) + { + UIBase_CardManager.CardObjData cardObjData = _cardObjList[i]; + if (cardObjData != null && cardObjData.ids == cardId) + { + return cardObjData; + } + } + return null; + } + + private void ShowSprite(UserGoods.Type goodsType, int goodsCount, bool isAcquired) + { + _objLayoutSprite.SetActive(value: true); + _spriteGoods.spriteName = AreaSelInfo.GetPresentItemSpriteName((int)goodsType); + _spriteGoods.gameObject.SetActive(value: true); + _labelNum.text = Data.SystemText.Get("Common_0040", goodsCount.ToString()); + _labelNum.transform.localPosition = DEFAULT_NUM_POSITION; + _labelNum.gameObject.SetActive(value: true); + _spriteGoods.color = GetAcquiredColor(isAcquired); + } + + private void ShowTexture(UserGoods.Type goodsType, long goodsId, int goodsCount, bool isAcquired) + { + _objLayoutTexture.SetActive(value: true); + InitializeGoodsTexture(_textureGoods, goodsType, goodsId); + TextureTransformParam textureTransformParam = USERGOODS_TEXTURE_LAYOUT_DICT[goodsType]; + _textureGoods.width = textureTransformParam.Width; + _textureGoods.height = textureTransformParam.Height; + _textureGoods.transform.localPosition = textureTransformParam.Position; + _textureGoods.transform.localRotation = textureTransformParam.Rotation; + if (goodsType == UserGoods.Type.Item) + { + _labelNum.text = Data.SystemText.Get("Common_0040", goodsCount.ToString()); + _labelNum.transform.localPosition = DEFAULT_NUM_POSITION; + _labelNum.gameObject.SetActive(value: true); + } + else + { + _labelNum.gameObject.SetActive(value: false); + } + _textureGoods.color = GetAcquiredColor(isAcquired); + } + + private void InitializeGoodsTexture(UITexture texture, UserGoods.Type goodsType, long goodsId) + { + string text = string.Empty; + switch (goodsType) + { + default: + return; + case UserGoods.Type.Sleeve: + { + long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(goodsId); + text = Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture, isfetch: true); + break; + } + case UserGoods.Type.Emblem: + text = Toolbox.ResourcesManager.GetAssetTypePath(goodsId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true); + break; + case UserGoods.Type.Degree: + DegreeHelper.InitializeDegree(texture, goodsId, DegreeHelper.DegreeType.SMALL); + break; + case UserGoods.Type.Skin: + text = Toolbox.ResourcesManager.GetAssetTypePath(goodsId.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail, isfetch: true); + break; + case UserGoods.Type.Item: + { + Item item = Data.Master.ItemList.Find((Item data) => data.UserGoodsId == goodsId); + if (item == null) + { + return; + } + text = Toolbox.ResourcesManager.GetAssetTypePath(item.thumbnail, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + break; + } + case UserGoods.Type.Card: + case UserGoods.Type.Rupy: + return; + } + if (string.IsNullOrEmpty(text)) + { + return; + } + texture.mainTexture = Toolbox.ResourcesManager.LoadObject(text); + _textureGoods.material = null; + _textureGoods.gameObject.SetActive(value: true); + if (goodsType == UserGoods.Type.Sleeve) + { + long existingSleeveId2 = Toolbox.ResourcesManager.GetExistingSleeveId(goodsId); + Sleeve sleeve = Data.Master.SleeveMgr.Get(existingSleeveId2); + if (sleeve.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().SetSleeveTexture(_textureGoods, sleeve.sleeve_id); + } + } + } + + private Color32 GetAcquiredColor(bool isAcquired) + { + if (isAcquired) + { + return ACQUIRED_GRAY_COLOR; + } + return Color.white; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ArenaConfigDialog.cs b/SVSim.BattleEngine/Engine/Wizard/ArenaConfigDialog.cs new file mode 100644 index 0000000..c516673 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ArenaConfigDialog.cs @@ -0,0 +1,235 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ArenaConfigDialog : MonoBehaviour +{ + [SerializeField] + private UITexture[] _sleeveTextureListTwoPick; + + [SerializeField] + private UIButton _sleeveChangeButtonTwoPick; + + [SerializeField] + private UIToggle _usePremiumCardToggleTwoPick; + + [SerializeField] + private FilteringSleeveSelection _sleeveSelectionPrefab; + + private const int SLEEVE_SELECTION_DIALOG_DEPTH = 400; + + private const long INVALID_SLEEVE_ID = -1L; + + private List _loadedSleeveIdList = new List(); + + private List _loadedSleeveTexturePathList = new List(); + + private FilteringImageSelection _sleeveSelection; + + private long _oldSleeveId = -1L; + + private bool _startUsePremiumCardToggleTwoPick; + + private bool _isFirstToggleChange = true; + + public void Initialize() + { + UIManager.GetInstance().createInSceneCenterLoading(); + bool twoPickSleeveLoading = true; + UIEventListener.Get(_sleeveChangeButtonTwoPick.gameObject).onClick = OnClickSleeveChangeButtonTwoPick; + _isFirstToggleChange = true; + _usePremiumCardToggleTwoPick.value = Data.Load.data._challengeConfig.UseTwoPickPremiumCard; + _usePremiumCardToggleTwoPick.onChange.Add(new EventDelegate(OnChangePremiumCardToggle)); + _startUsePremiumCardToggleTwoPick = Data.Load.data._challengeConfig.UseTwoPickPremiumCard; + UIManager.SetObjectToGrey(_usePremiumCardToggleTwoPick.gameObject, Data.ArenaData.TwoPickData.isJoin); + LoadSleeve(GetCurrentSleeveId(DataMgr.BattleType.ColosseumTwoPick), delegate + { + StartCoroutine(UpdateSleeveTexture(DataMgr.BattleType.ColosseumTwoPick)); + twoPickSleeveLoading = false; + if (!twoPickSleeveLoading) + { + UIManager.GetInstance().closeInSceneCenterLoading(); + } + }); + InitSleeveSelection(); + } + + public void Final() + { + if (_startUsePremiumCardToggleTwoPick != Data.Load.data._challengeConfig.UseTwoPickPremiumCard) + { + ArenaConfigUpdateTask arenaConfigUpdateTask = new ArenaConfigUpdateTask(); + arenaConfigUpdateTask.SetParameter(Data.Load.data._challengeConfig.UseTwoPickPremiumCard, Data.Load.data._challengeConfig.TwoPickSleeveId); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(arenaConfigUpdateTask)); + } + UnloadAllSleeves(); + } + + private void OnClickSleeveChangeButtonTwoPick(GameObject g) + { + OnClickSleeveChangeButton(DataMgr.BattleType.ColosseumTwoPick); + } + + private void OnClickSleeveChangeButton(DataMgr.BattleType type) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OpenSleeveSelectionDialog(type); + } + + private void OnChangePremiumCardToggle() + { + if (!_isFirstToggleChange) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(_usePremiumCardToggleTwoPick.value ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF); + } + _isFirstToggleChange = false; + Data.Load.data._challengeConfig.UseTwoPickPremiumCard = _usePremiumCardToggleTwoPick.value; + } + + private void LoadSleeve(long sleeveId, Action onFinish = null) + { + List first = CollectSleeveResourcePaths(sleeveId); + List loadPathList = first.Except(_loadedSleeveTexturePathList).ToList(); + if (loadPathList.Count == 0) + { + onFinish.Call(); + return; + } + StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadPathList, delegate + { + _loadedSleeveIdList.Add(sleeveId); + _loadedSleeveTexturePathList.AddRange(loadPathList); + onFinish.Call(); + })); + } + + private void UnloadAllSleeves() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedSleeveTexturePathList); + _loadedSleeveIdList.Clear(); + _loadedSleeveTexturePathList.Clear(); + } + + private List CollectSleeveResourcePaths(long sleeveId) + { + sleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(sleeveId); + string path = sleeveId.ToString(); + List loadPath = new List(); + loadPath.Add(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.SleeveTexture)); + Sleeve sleeve = Data.Master.SleeveMgr.Get(sleeveId); + if (sleeve.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref loadPath, sleeve); + } + return loadPath; + } + + private void InitSleeveSelection() + { + _sleeveSelection = NGUITools.AddChild(base.gameObject, _sleeveSelectionPrefab.gameObject).GetComponent(); + _sleeveSelection.gameObject.SetActive(value: false); + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + List acquiredList = Data.Master.SleeveMgr.GetAcquiredList(); + List list = Data.Master.SleeveCategoryIdDic.Values.OrderBy((SleeveCategory category) => category.Id).ToList(); + _sleeveSelection.Initialize(acquiredList.Count, list.Count); + foreach (SleeveCategory item in list) + { + _sleeveSelection.AddSeries(item.Id, item.Name); + } + foreach (Sleeve sleeve in acquiredList) + { + string key = sleeve.sleeve_id.ToString(); + long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(sleeve.sleeve_id); + Sleeve sleeve2 = Data.Master.SleeveMgr.Get(existingSleeveId); + List loadPath = new List(); + loadPath.Add(resourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture)); + if (sleeve2.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref loadPath, sleeve2); + } + _sleeveSelection.AddItem(key, sleeve._categoryId, isSelectable: true, loadPath, null, isDisplaySprite: false, sleeve.sleeve_name, null, () => sleeve.IsNew, delegate + { + Data.Master.SleeveMgr.UnsetNew(sleeve.sleeve_id); + }, null, null, sleeve.IsFavorite); + } + } + + private void OpenSleeveSelectionDialog(DataMgr.BattleType type) + { + _oldSleeveId = GetCurrentSleeveId(type); + _sleeveSelection.SelectItemWithKey(GetCurrentSleeveId(type).ToString()); + UIManager.GetInstance().createInSceneCenterLoading(); + DialogBase dialogBase = DialogBase.CreateFilteringImageSelectionDialog(_sleeveSelection, "Card_0146"); + dialogBase.SetPanelDepth(400); + dialogBase.onPushButton1 = (Action)Delegate.Combine(dialogBase.onPushButton1, (Action)delegate + { + if (long.TryParse(_sleeveSelection.GetSelectedItemKey(), out var id) && id != _oldSleeveId) + { + LoadSleeve(id); + SleeveConfigUpdate(type, id, delegate(NetworkTask.ResultCode code) + { + OnSuccessChangeSleeve(code, type, id); + }); + } + }); + } + + private void SleeveConfigUpdate(DataMgr.BattleType type, long id, Action callBack = null) + { + ArenaConfigUpdateTask arenaConfigUpdateTask = new ArenaConfigUpdateTask(); + long useChallenge2pickSleeveId = ((type == DataMgr.BattleType.ColosseumTwoPick) ? id : Data.Load.data._challengeConfig.TwoPickSleeveId); + arenaConfigUpdateTask.SetParameter(Data.Load.data._challengeConfig.UseTwoPickPremiumCard, useChallenge2pickSleeveId); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(arenaConfigUpdateTask, callBack)); + } + + private void OnSuccessChangeSleeve(NetworkTask.ResultCode code, DataMgr.BattleType type, long id) + { + SetCurrentSleeveId(type, id); + StartCoroutine(UpdateSleeveTexture(type)); + } + + private IEnumerator UpdateSleeveTexture(DataMgr.BattleType battleType) + { + long sleeveId = GetCurrentSleeveId(battleType); + while (!_loadedSleeveIdList.Contains(sleeveId)) + { + yield return null; + } + UITexture[] currentSleeveTextureList = GetCurrentSleeveTextureList(battleType); + for (int i = 0; i < currentSleeveTextureList.Length; i++) + { + UIManager.GetInstance().getUIBase_CardManager().SetSleeveTextureWithoutPremium(currentSleeveTextureList[i], sleeveId); + } + } + + private long GetCurrentSleeveId(DataMgr.BattleType battleType) + { + if (battleType == DataMgr.BattleType.ColosseumTwoPick) + { + return Data.Load.data._challengeConfig.TwoPickSleeveId; + } + return -1L; + } + + private void SetCurrentSleeveId(DataMgr.BattleType battleType, long sleeveId) + { + if (battleType == DataMgr.BattleType.ColosseumTwoPick) + { + Data.Load.data._challengeConfig.TwoPickSleeveId = sleeveId; + } + } + + private UITexture[] GetCurrentSleeveTextureList(DataMgr.BattleType battleType) + { + if (battleType == DataMgr.BattleType.ColosseumTwoPick) + { + return _sleeveTextureListTwoPick; + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AvatarBattleAllInfo.cs b/SVSim.BattleEngine/Engine/Wizard/AvatarBattleAllInfo.cs new file mode 100644 index 0000000..03e9105 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AvatarBattleAllInfo.cs @@ -0,0 +1,103 @@ +using System; +using System.Collections.Generic; +using LitJson; +using UnityEngine; + +namespace Wizard; + +public class AvatarBattleAllInfo +{ + public class PeriodData + { + public DateTime BeginTime = DateTime.MaxValue; + + public DateTime EndTime = DateTime.MinValue; + + public double StartUnixTime { get; set; } + + public double EndUnixTime { get; set; } + } + + private Dictionary _avatarBattleDictionary = new Dictionary(); + + public PeriodData FreeMatchPeriod = new PeriodData(); + + public PeriodData GatheringPeriod = new PeriodData(); + + private bool _avatarBattleScheduleExist; + + private float _receiveSinceTime; + + private double _receiveServerUnixTime; + + public List AvatarBattleInfoList { get; } = new List(); + + public bool IsWithinFreeMatchPeriod => IsWithinPeriod(FreeMatchPeriod); + + public bool IsWithinGatheringPeriod => IsWithinPeriod(GatheringPeriod); + + public void Parse(JsonData json, JsonData headerData) + { + JsonData jsonData = json["abilities"]; + foreach (string key in jsonData.Keys) + { + AvatarBattleInfo avatarBattleInfo = new AvatarBattleInfo(jsonData[key]); + _avatarBattleDictionary[avatarBattleInfo.LeaderSkinId] = avatarBattleInfo; + avatarBattleInfo.SetAbility(jsonData[avatarBattleInfo.LeaderSkinId]); + AvatarBattleInfoList.Add(avatarBattleInfo); + } + JsonData jsonData2 = json["schedules"]; + if (jsonData2.IsObject) + { + if (jsonData2.TryGetValue("free_battle", out var value)) + { + SetPeriodData(FreeMatchPeriod, value); + _avatarBattleScheduleExist = true; + _receiveSinceTime = Time.realtimeSinceStartup; + _receiveServerUnixTime = headerData["servertime"].ToDouble(); + } + if (jsonData2.TryGetValue("gathering", out var value2)) + { + SetPeriodData(GatheringPeriod, value2); + _avatarBattleScheduleExist = true; + _receiveSinceTime = Time.realtimeSinceStartup; + _receiveServerUnixTime = headerData["servertime"].ToDouble(); + } + } + } + + public AvatarBattleInfo Get(string id) + { + if (string.IsNullOrEmpty(id)) + { + return null; + } + if (_avatarBattleDictionary.TryGetValue(id, out var value)) + { + return value; + } + return null; + } + + private void SetPeriodData(PeriodData period, JsonData jsonData) + { + period.BeginTime = DateTime.Parse(jsonData["begin_time"].ToString()); + period.EndTime = DateTime.Parse(jsonData["end_time"].ToString()); + period.StartUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(jsonData["begin_time"].ToString())); + period.EndUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(jsonData["end_time"].ToString())); + } + + private bool IsWithinPeriod(PeriodData period) + { + if (!_avatarBattleScheduleExist) + { + return false; + } + double num = _receiveServerUnixTime + (double)Time.realtimeSinceStartup - (double)_receiveSinceTime; + if (num > period.EndUnixTime) + { + return false; + } + return num > period.StartUnixTime; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BarrierBonusPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/BarrierBonusPolicyCollection.cs new file mode 100644 index 0000000..d80c089 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BarrierBonusPolicyCollection.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class BarrierBonusPolicyCollection : AIPolicyCollection +{ + public float GetBarrierBonus(AIVirtualCard card) + { + if (card == null || card.IsDead || !base.HasPolicy) + { + return 0f; + } + float num = 0f; + AIVirtualField selfField = card.SelfField; + List bestPlayPtn = selfField.BestPlayPtn; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(card, bestPlayPtn, selfField, null)) + { + num += aIPolicyData.EvalArg(card, bestPlayPtn, selfField); + } + } + return num * (float)card.BarrierInfoCollection.BarrierCount; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BaseProductDetail.cs b/SVSim.BattleEngine/Engine/Wizard/BaseProductDetail.cs new file mode 100644 index 0000000..1fbad16 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BaseProductDetail.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public abstract class BaseProductDetail : MonoBehaviour +{ + [SerializeField] + protected UITexture _texProductImg; + + [SerializeField] + private UIScrollView _scrollView; + + [SerializeField] + private SupplyLabelPlateListUI _supplyLabelPlateList; + + [SerializeField] + private GameObject _parentDetailList; + + [SerializeField] + private UILabel _labelDescription; + + [SerializeField] + private UIGrid _gridDescriptionLines; + + [SerializeField] + private GameObject _lineTemplate; + + protected float TailPosY; + + public void ResetPositionScrollView() + { + _scrollView.ResetPosition(); + } + + protected void SetProductDetail(Texture textureProductImage, List rewardInfoList, string descriptionText = null) + { + _texProductImg.mainTexture = textureProductImage; + TailPosY = _supplyLabelPlateList.transform.localPosition.y; + TailPosY -= _supplyLabelPlateList.SetSupplyList(rewardInfoList); + if (descriptionText != null) + { + _parentDetailList.SetActive(value: true); + _parentDetailList.transform.localPosition = Vector3.up * TailPosY; + string text = ""; + text = Global.GetConvertWrapText(_labelDescription, descriptionText); + for (int i = 0; i < text.Length; i++) + { + if (text[i] == '\n') + { + NGUITools.AddChild(_gridDescriptionLines.gameObject, _lineTemplate); + } + } + _labelDescription.text = text; + _gridDescriptionLines.Reposition(); + } + else if (_parentDetailList != null) + { + _parentDetailList.SetActive(value: false); + } + ResetPositionScrollView(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BaseShopPurchasePage.cs b/SVSim.BattleEngine/Engine/Wizard/BaseShopPurchasePage.cs new file mode 100644 index 0000000..ea80ad7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BaseShopPurchasePage.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class BaseShopPurchasePage : UIBase +{ + private const int PRODUCT_SCROLL_OBJECT_NUM = 4; + + protected const int MAX_SERIES_CACHE_NUM = 4; + + [SerializeField] + private UITexture _bgTexture; + + [SerializeField] + protected UITexture _titleLogoTexture; + + [SerializeField] + protected UILabel _labelSeriesDescription; + + [SerializeField] + protected UIScrollView _scrollView; + + [SerializeField] + protected UIWrapContent _wrapContent; + + [SerializeField] + protected GameObject _productPlateOriginal; + + protected List _cacheSeriesIdList; + + protected List _cacheRefCountList; + + protected List _cacheResourceList; + + protected List _loadedResourceList; + + protected List _drumrollSeriesImageList = new List(); + + protected List _seriesTitleImageList = new List(); + + public override void onFirstStart() + { + _cacheSeriesIdList = new List(4); + _cacheRefCountList = new List(4); + _cacheResourceList = new List(); + _loadedResourceList = new List(); + SetupScrollView(); + base.IsShowFooterMenu = true; + _bgTexture.gameObject.layer = LayerMask.NameToLayer("FrontUI"); + base.onFirstStart(); + } + + protected virtual void SetupScrollView() + { + for (int i = 0; i < 4; i++) + { + NGUITools.AddChild(_wrapContent.gameObject, _productPlateOriginal); + } + _productPlateOriginal.gameObject.SetActive(value: false); + _wrapContent.onInitializeItem = OnInitializeItem; + _wrapContent.minIndex = 0; + } + + protected void CreateTopBar(string title, Action onFinishChangeView) + { + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.MyPageMenuIndex = 5; + changeViewSceneParam.IsCutCardMotion = true; + changeViewSceneParam.OnFinishChangeView = onFinishChangeView; + UIManager.GetInstance().CreateTopBar(base.gameObject, title, UIManager.ViewScene.MyPage, MoneyDraw: true, changeViewSceneParam).gameObject.layer = LayerMask.NameToLayer("MyPage"); + } + + protected IEnumerator loadSeriesImages(ResourcesManager.AssetLoadPathType assetPathType, List seriesIdList, Dictionary seriesMasterDic, Action callBack = null) + { + List assetList = new List(); + for (int i = 0; i < seriesIdList.Count; i++) + { + BaseSeriesData baseSeriesData = seriesMasterDic[seriesIdList[i]]; + assetList.Add(Toolbox.ResourcesManager.GetAssetTypePath(baseSeriesData.DrumrollPath, assetPathType)); + assetList.Add(Toolbox.ResourcesManager.GetAssetTypePath(baseSeriesData.TitlePath, assetPathType)); + } + assetList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_shop_icon_1", ResourcesManager.AssetLoadPathType.Effect2D)); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(assetList, null)); + _loadedResourceList.AddRange(assetList); + _drumrollSeriesImageList.Clear(); + _seriesTitleImageList.Clear(); + for (int j = 0; j < seriesIdList.Count; j++) + { + BaseSeriesData baseSeriesData2 = seriesMasterDic[seriesIdList[j]]; + Texture item = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(baseSeriesData2.DrumrollPath, assetPathType, isfetch: true)) as Texture; + _drumrollSeriesImageList.Add(item); + Texture item2 = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(baseSeriesData2.TitlePath, assetPathType, isfetch: true)) as Texture; + _seriesTitleImageList.Add(item2); + } + callBack.Call(); + } + + protected override void onClose() + { + AllDeleteCacheSeries(); + if (_loadedResourceList.Count > 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList); + _loadedResourceList.Clear(); + } + base.onClose(); + } + + private void AllDeleteCacheSeries() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_cacheResourceList); + _cacheSeriesIdList.Clear(); + _cacheRefCountList.Clear(); + _cacheResourceList.Clear(); + } + + protected virtual void ResetProductListScroll(int productCount) + { + _wrapContent.maxIndex = productCount - 1; + _wrapContent.SortBasedOnScrollMovement(); + _scrollView.ResetPosition(); + _wrapContent.WrapContent(); + } + + protected virtual void OnInitializeItem(GameObject go, int wrapIndex, int realIndex) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattleMenuUserPanel.cs b/SVSim.BattleEngine/Engine/Wizard/BattleMenuUserPanel.cs new file mode 100644 index 0000000..98ddc3a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattleMenuUserPanel.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace Wizard; + +public class BattleMenuUserPanel : MonoBehaviour +{ + [SerializeField] + private UISprite _officialUserIconSprite; + + public void SetActiveOfficialUserIconSprite(bool isActive) + { + _officialUserIconSprite.gameObject.SetActive(isActive); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattlePassGaugeInfo.cs b/SVSim.BattleEngine/Engine/Wizard/BattlePassGaugeInfo.cs new file mode 100644 index 0000000..30f8ba4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattlePassGaugeInfo.cs @@ -0,0 +1,91 @@ +using LitJson; + +namespace Wizard; + +public class BattlePassGaugeInfo +{ + public int CurrentPoint { get; private set; } + + public int CurrentLevel { get; private set; } + + public BattlePassLevelInfo BattlePassLevelInfo => Data.Load.data.BattlePassLevelInfoList[CurrentLevel]; + + public bool IsMaxPoint => CurrentPoint >= BattlePassUtility.BattlePassMaxPoint; + + public int BeforeCurrentPoint { get; private set; } + + public int BeforeCurrentLevel { get; private set; } + + public BattlePassLevelInfo BeforeBattlePassLevelInfo => Data.Load.data.BattlePassLevelInfoList[BeforeCurrentLevel]; + + public bool IsBeforeMaxPoint => BeforeCurrentPoint >= BattlePassUtility.BattlePassMaxPoint; + + public int PointAdd { get; private set; } + + public int DailryMissionPoint { get; private set; } + + public int BattlePassMissionPoint { get; private set; } + + public int BattleResultPoint { get; private set; } + + public int WeeklyBattlePassPoint { get; private set; } + + public int WeeklyLimitPoint { get; private set; } + + public bool IsPremium { get; private set; } + + public bool IsLevelChange => CurrentLevel != BeforeCurrentLevel; + + public float BeforeGaugeValue => (float)(BeforeCurrentPoint - BeforeBattlePassLevelInfo.RequiredPoint) / (float)BattlePassUtility.NextLevelRequiredPoint(BeforeCurrentLevel); + + public int NextLevelRequiredPoint + { + get + { + if (!IsMaxPoint) + { + return Data.Load.data.BattlePassLevelInfoList[CurrentLevel + 1].RequiredPoint - CurrentPoint; + } + return 0; + } + } + + public int BeforeLevelNextLevelRequiredPoint + { + get + { + if (!IsBeforeMaxPoint) + { + return Data.Load.data.BattlePassLevelInfoList[BeforeCurrentLevel + 1].RequiredPoint - BeforeCurrentPoint; + } + return 0; + } + } + + public BattlePassGaugeInfo(JsonData jsonData) + { + CurrentPoint = jsonData["current_point"].ToInt(); + CurrentLevel = jsonData["current_level"].ToInt(); + if (jsonData.Keys.Contains("point_add")) + { + BeforeCurrentPoint = jsonData["before_current_point"].ToInt(); + BeforeCurrentLevel = jsonData["before_target_level"].ToInt(); + DailryMissionPoint = jsonData["daily_mission_point"].ToInt(); + BattlePassMissionPoint = jsonData["battle_pass_mission_point"].ToInt(); + BattleResultPoint = jsonData["battle_result_point"].ToInt(); + IsPremium = jsonData["is_premium"].ToBoolean(); + PointAdd = jsonData["point_add"].ToInt(); + } + WeeklyBattlePassPoint = jsonData.GetValueOrDefault("weekly_battle_pass_point", 0); + WeeklyLimitPoint = jsonData.GetValueOrDefault("weekly_limit_point", 0); + } + + public float CurrentGaugeValue() + { + if (IsMaxPoint) + { + return 1f; + } + return (float)(CurrentPoint - BattlePassLevelInfo.RequiredPoint) / (float)BattlePassUtility.NextLevelRequiredPoint(CurrentLevel); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattlePassGuage.cs b/SVSim.BattleEngine/Engine/Wizard/BattlePassGuage.cs new file mode 100644 index 0000000..25db2cf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattlePassGuage.cs @@ -0,0 +1,158 @@ +using System.Collections; +using UnityEngine; + +namespace Wizard; + +public class BattlePassGuage : MonoBehaviour +{ + [SerializeField] + public ParticleSystem GaugeEfc; + + [SerializeField] + private UIGauge _uIGauge; + + [SerializeField] + private UILabel _nextLevelTitleLabel; + + [SerializeField] + private UILabel _nextLevelPoint; + + [SerializeField] + private UILabel _level; + + [SerializeField] + private UISprite _battlePassIcon; + + private BattlePassGaugeInfo _battlePassGaugeInfo; + + private const float GAUGEUP_DURATION = 0.3f; + + private const float GAUGEUP_DELAY = 1f; + + private const float GAUGE_SIZE = 1.15f; + + private const int GAUGEUP_SE_CNT = 6; + + private int _nowLevel; + + private int _nowNextLevelPoint; + + public bool IsAnimationComplete { get; private set; } + + public void Initialize(BattlePassGaugeInfo battlePassGaugeInfo) + { + _uIGauge.Value = battlePassGaugeInfo.CurrentGaugeValue(); + _nextLevelTitleLabel.text = Data.SystemText.Get("BattlePass_0009"); + _nextLevelPoint.text = battlePassGaugeInfo.NextLevelRequiredPoint.ToString(); + _level.text = battlePassGaugeInfo.CurrentLevel.ToString(); + } + + public void LvUpInitialize(BattlePassGaugeInfo battlePassGaugeInfo) + { + _battlePassGaugeInfo = battlePassGaugeInfo; + _battlePassIcon.spriteName = (battlePassGaugeInfo.IsPremium ? "icon_battlepass_premium" : "icon_battlepass_normal"); + _uIGauge.Value = battlePassGaugeInfo.BeforeGaugeValue; + _nextLevelTitleLabel.text = Data.SystemText.Get("BattlePass_0009"); + _nowNextLevelPoint = battlePassGaugeInfo.BeforeLevelNextLevelRequiredPoint; + _nextLevelPoint.text = _nowNextLevelPoint.ToString(); + _level.text = battlePassGaugeInfo.BeforeCurrentLevel.ToString(); + } + + public void AddBattlePassPoint() + { + _nowLevel = _battlePassGaugeInfo.BeforeCurrentLevel; + StartCoroutine(AddBattlePassPointCor()); + } + + private IEnumerator AddBattlePassPointCor() + { + yield return new WaitForSeconds(0.5f); + if (_battlePassGaugeInfo.IsLevelChange) + { + SetGaugeAniamtion(_uIGauge.Value, 1f, "LvUp"); + } + else + { + SetGaugeAniamtion(_uIGauge.Value, _battlePassGaugeInfo.CurrentGaugeValue(), "LvupComplete"); + } + } + + private void LvUp() + { + _nowLevel++; + _level.text = _nowLevel.ToString(); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_LEVELUP); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_LVUP_1, _battlePassIcon.transform.position) + .gameObject.SetLayer(LayerMask.NameToLayer("SystemUI"), isSetChildren: true); + Effect effect = GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_GAUGE_2, _uIGauge.GetTransformGaugeStartEdge().position); + if (effect != null) + { + effect.transform.localScale = Vector3.one * 1.15f; + effect.gameObject.SetLayer(LayerMask.NameToLayer("SystemUI"), isSetChildren: true); + } + if (_nowLevel == BattlePassUtility.BattlePassMaxLevel) + { + LvupComplete(); + } + else if (_nowLevel < _battlePassGaugeInfo.CurrentLevel) + { + SetGaugeAniamtion(0f, 1f, "LvUp"); + } + else + { + SetGaugeAniamtion(0f, _battlePassGaugeInfo.CurrentGaugeValue(), "LvupComplete"); + } + } + + private void SetGaugeAniamtion(float from, float to, string oncomp = "") + { + iTween.ValueTo(base.gameObject, iTween.Hash("from", from, "to", to, "time", 0.3f, "delay", 0.1f, "onstart", "StartBattlePassPoint", "onupdate", "UpdateBattlePassPoint", "oncomplete", oncomp, "easetype", iTween.EaseType.easeOutQuad)); + } + + private void StartBattlePassPoint() + { + PlayGaugeUpSE(); + GaugeEfc.gameObject.SetActive(value: true); + GaugeEfc.Play(); + } + + private void PlayGaugeUpSE() + { + StartCoroutine(GaugeUpSECoroutine()); + } + + private IEnumerator GaugeUpSECoroutine() + { + for (int i = 0; i < 6; i++) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP); + yield return new WaitForSeconds(0.05f); + } + } + + private void UpdateBattlePassPoint(float num) + { + _uIGauge.Value = num; + int num2 = BattlePassUtility.NextLevelRequiredPoint(_nowLevel); + _nowNextLevelPoint = num2 - (int)((float)num2 * num); + _nextLevelPoint.text = _nowNextLevelPoint.ToString(); + } + + private void CompleteBattlePassPoint() + { + GaugeEfc.Stop(); + } + + private void LvupComplete() + { + _nextLevelPoint.text = _battlePassGaugeInfo.NextLevelRequiredPoint.ToString(); + StartCoroutine(SetLvupCompletAnimation()); + } + + private IEnumerator SetLvupCompletAnimation() + { + yield return new WaitForSeconds(0.1f); + CompleteBattlePassPoint(); + IsAnimationComplete = true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattlePassLevelInfo.cs b/SVSim.BattleEngine/Engine/Wizard/BattlePassLevelInfo.cs new file mode 100644 index 0000000..08320a0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattlePassLevelInfo.cs @@ -0,0 +1,16 @@ +using LitJson; + +namespace Wizard; + +public class BattlePassLevelInfo +{ + public int Level { get; private set; } + + public int RequiredPoint { get; private set; } + + public BattlePassLevelInfo(JsonData jsonData) + { + Level = jsonData["level"].ToInt(); + RequiredPoint = jsonData["required_point"].ToInt(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattlePassMonthlyMission.cs b/SVSim.BattleEngine/Engine/Wizard/BattlePassMonthlyMission.cs new file mode 100644 index 0000000..fe91d9c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattlePassMonthlyMission.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class BattlePassMonthlyMission +{ + public class MissionDetail + { + public class RewardInfo + { + public UserGoods UserGoods { get; private set; } + + public int Number { get; private set; } + + public RewardInfo(UserGoods.Type rewardType, long rewardDetailId, int rewardNumber) + { + UserGoods = new UserGoods(rewardType, rewardDetailId); + Number = rewardNumber; + } + } + + public string Name { get; private set; } + + public bool IsCleared { get; private set; } + + public int BattlePassPoint { get; private set; } + + public int RequireNumber { get; private set; } + + public int DoneNumber { get; private set; } + + public RewardInfo Reward { get; private set; } + + public MissionDetail(JsonData jsonMissionData) + { + Name = jsonMissionData["name"].ToString(); + IsCleared = jsonMissionData["is_cleared"].ToBoolean(); + BattlePassPoint = jsonMissionData["battle_pass_point"].ToInt(); + RequireNumber = jsonMissionData["require_number"].ToInt(); + DoneNumber = jsonMissionData["done_number"].ToInt(); + if (jsonMissionData.Keys.Contains("reward_info")) + { + JsonData jsonData = jsonMissionData["reward_info"]; + int rewardType = jsonData["reward_type"].ToInt(); + long rewardDetailId = jsonData["reward_detail_id"].ToLong(); + int rewardNumber = jsonData["reward_number"].ToInt(); + Reward = new RewardInfo((UserGoods.Type)rewardType, rewardDetailId, rewardNumber); + } + else + { + Reward = null; + } + } + } + + public DateTime StartDate { get; private set; } + + public string EndDate { get; private set; } + + public List MissionList { get; private set; } + + public BattlePassMonthlyMission(JsonData jsonBattlePassMonthlyMission) + { + StartDate = DateTime.Parse(jsonBattlePassMonthlyMission["start_date"].ToString()); + EndDate = jsonBattlePassMonthlyMission["end_date"].ToString(); + JsonData jsonData = jsonBattlePassMonthlyMission["mission_list"]; + MissionList = new List(); + foreach (JsonData item in (IEnumerable)jsonData) + { + MissionList.Add(new MissionDetail(item)); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattlePassResultPanel.cs b/SVSim.BattleEngine/Engine/Wizard/BattlePassResultPanel.cs new file mode 100644 index 0000000..f0f89bc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattlePassResultPanel.cs @@ -0,0 +1,173 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class BattlePassResultPanel : MonoBehaviour +{ + [SerializeField] + private BattlePassGuage _battlePassGuage; + + [SerializeField] + private UIButton _tapTrriger; + + [SerializeField] + private ParticleSystem _lineEfc; + + [Header("ใƒฉใƒ™ใƒซ")] + [SerializeField] + private GameObject _battleWin; + + [SerializeField] + private UILabel _battleWinLabel; + + [SerializeField] + private UILabel _battleWinPointLabel; + + [SerializeField] + private GameObject _missionClear; + + [SerializeField] + private UILabel _missionClearLabel; + + [SerializeField] + private UILabel _missionClearPointLabel; + + [SerializeField] + private GameObject _battleMissionClear; + + [SerializeField] + private UILabel _battleMissionClearLabel; + + [SerializeField] + private UILabel _battleMissionClearPointLabel; + + [SerializeField] + private UILabel _weeklyGetLimitLabel; + + [SerializeField] + private UILabel _weeklyGetLimitPointLabel; + + [SerializeField] + private UIGrid _uiGrid; + + private float GAUGEUP_LABEL_DURATION = 0.5f; + + private float GAUGEUP_LABEL_MOVE_DISTANCE = 50f; + + private BattlePassGaugeInfo _battlePassGaugeInfo; + + private List _loadedEffectResources = new List(); + + private Action _closeAction; + + private bool _isClosePanel; + + public void Initialize(BattlePassGaugeInfo battlePassGaugeInfo) + { + _battlePassGuage.LvUpInitialize(battlePassGaugeInfo); + _tapTrriger.onClick.Add(new EventDelegate(Close)); + base.gameObject.SetActive(value: false); + _battleWinLabel.text = Data.SystemText.Get("BattlePass_0014"); + _battleWin.SetActive(value: false); + _battleWinPointLabel.text = "+" + battlePassGaugeInfo.BattleResultPoint; + _missionClearLabel.text = Data.SystemText.Get("BattlePass_0015"); + _missionClear.SetActive(value: false); + _missionClearPointLabel.text = "+" + battlePassGaugeInfo.DailryMissionPoint; + _battleMissionClearLabel.text = Data.SystemText.Get("BattlePass_0016"); + _battleMissionClear.SetActive(value: false); + _battleMissionClearPointLabel.text = "+" + battlePassGaugeInfo.BattlePassMissionPoint; + _weeklyGetLimitLabel.text = Data.SystemText.Get("BattlePass_0017"); + _weeklyGetLimitPointLabel.text = battlePassGaugeInfo.WeeklyBattlePassPoint + "/" + battlePassGaugeInfo.WeeklyLimitPoint; + _battlePassGaugeInfo = battlePassGaugeInfo; + } + + public void SetPointupAnimation(Action closeAction) + { + _closeAction = closeAction; + List list = new List(); + list.Add(_lineEfc.gameObject); + list.Add(_battlePassGuage.GaugeEfc.gameObject); + _loadedEffectResources.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list, delegate + { + base.gameObject.SetActive(value: true); + StartCoroutine(FadeAction(isIn: true)); + _lineEfc.gameObject.SetActive(value: true); + _lineEfc.Play(); + _battlePassGuage.AddBattlePassPoint(); + StartCoroutine(SetLvupAnimation()); + })); + } + + private IEnumerator SetLvupAnimation() + { + _battleWin.SetActive(_battlePassGaugeInfo.BattleResultPoint != 0); + _missionClear.SetActive(_battlePassGaugeInfo.DailryMissionPoint != 0); + _battleMissionClear.SetActive(_battlePassGaugeInfo.BattlePassMissionPoint != 0); + _uiGrid.Reposition(); + _battleWin.SetActive(value: false); + _missionClear.SetActive(value: false); + _battleMissionClear.SetActive(value: false); + yield return new WaitForSeconds(0.5f); + if (_battlePassGaugeInfo.BattleResultPoint != 0) + { + _battleWin.SetActive(value: true); + TextAnimation(_battleWinLabel.gameObject); + TextAnimation(_battleWinPointLabel.gameObject); + } + if (_battlePassGaugeInfo.DailryMissionPoint != 0) + { + _missionClear.SetActive(value: true); + TextAnimation(_missionClearLabel.gameObject); + TextAnimation(_missionClearPointLabel.gameObject); + } + if (_battlePassGaugeInfo.BattlePassMissionPoint != 0) + { + _battleMissionClear.SetActive(value: true); + TextAnimation(_battleMissionClearLabel.gameObject); + TextAnimation(_battleMissionClearPointLabel.gameObject); + } + } + + private void Close() + { + if (_battlePassGuage.IsAnimationComplete && !_isClosePanel) + { + _isClosePanel = true; + _lineEfc.Clear(); + StartCoroutine(FadeAction(isIn: false, delegate + { + base.gameObject.SetActive(value: false); + UnLoadEffect(); + _closeAction(); + })); + } + } + + private void UnLoadEffect() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedEffectResources); + _loadedEffectResources.Clear(); + } + + private void TextAnimation(GameObject label) + { + label.SetActive(value: true); + TweenAlpha.Begin(label.gameObject, GAUGEUP_LABEL_DURATION, 1f); + iTween.MoveFrom(label, iTween.Hash("x", label.transform.localPosition.x - GAUGEUP_LABEL_MOVE_DISTANCE, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + public IEnumerator FadeAction(bool isIn, Action fadeEndAction = null) + { + float num = 0.2f; + float alpha = (isIn ? 0f : 1f); + float alpha2 = (isIn ? 1f : 0f); + TweenAlpha.Begin(base.gameObject, 0f, alpha); + TweenAlpha.Begin(base.gameObject, num, alpha2); + yield return new WaitForSeconds(num); + fadeEndAction.Call(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattleSequencer.cs b/SVSim.BattleEngine/Engine/Wizard/BattleSequencer.cs new file mode 100644 index 0000000..1b00e51 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattleSequencer.cs @@ -0,0 +1,305 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public static class BattleSequencer +{ + public static void ExecSimulation(AIVirtualField field, List actionInfoSequence, List enemyTargetSequence, SimulationSetting setting) + { + AIVirtualActionInfo aIVirtualActionInfo = actionInfoSequence.FirstOrDefault((AIVirtualActionInfo a) => a.ActionType == AIOperationType.EVOLVE); + AIVirtualActionInfo aIVirtualActionInfo2 = null; + while (actionInfoSequence.Any((AIVirtualActionInfo a) => !a.IsAlreadyUsed)) + { + field.EnemyTokenQueue.Clear(); + int num = -1; + for (int num2 = 0; num2 < actionInfoSequence.Count; num2++) + { + AIVirtualActionInfo aIVirtualActionInfo3 = actionInfoSequence[num2]; + if (!aIVirtualActionInfo3.IsAlreadyUsed) + { + aIVirtualActionInfo2 = aIVirtualActionInfo3; + num = num2; + break; + } + } + if (aIVirtualActionInfo2 != null) + { + if (aIVirtualActionInfo2 == aIVirtualActionInfo) + { + aIVirtualActionInfo = null; + } + bool flag = AISimulationUtility.ExecuteVirtualAction(aIVirtualActionInfo2, aIVirtualActionInfo, enemyTargetSequence, setting); + if (num == 0 && !flag && setting.CheckFirstActionFailure) + { + return; + } + } + if (field.EnemyClass.IsDead || field.AllyClass.IsDead) + { + return; + } + List bestPlayPtn = field.BestPlayPtn; + for (int num3 = 0; num3 < field.AllyInplayCards.Count; num3++) + { + AIVirtualCard aIVirtualCard = field.AllyInplayCards[num3]; + if (!aIVirtualCard.IsAttackable(bestPlayPtn)) + { + continue; + } + bool flag2 = false; + for (int num4 = 0; num4 < actionInfoSequence.Count; num4++) + { + if (actionInfoSequence[num4].Actor.CardIndex == aIVirtualCard.CardIndex) + { + flag2 = true; + break; + } + } + if (!flag2) + { + actionInfoSequence.Insert(num + 1, new AIVirtualAttackInfo(aIVirtualCard, isAttackFollower: true, aIVirtualActionInfo2)); + } + } + while (field.EnemyTokenQueue.Count > 0) + { + Tuple tuple = field.EnemyTokenQueue.Dequeue(); + AIVirtualCard first = tuple.first; + AIVirtualCard second = tuple.second; + int num5 = enemyTargetSequence.IndexOf(first); + if (num5 >= 0 && (IsToBeKilled(field) || second.IsGuard)) + { + enemyTargetSequence.Insert(num5 + 1, second); + if (first.IsMetamorphosed) + { + enemyTargetSequence.Remove(first); + } + } + } + if (aIVirtualActionInfo2 != null && aIVirtualActionInfo2 is AIVirtualAttackInfo { IsAttackSuccessed: not false } && field.AllyInplayCards.Count((AIVirtualCard card) => !card.IsDead) < 5 && aIVirtualActionInfo2.Actor.TagCollectionContainer.HasTag(AIPlayTagType.PuppetAttack)) + { + aIVirtualActionInfo2.Actor.TagCollectionContainer.PuppetAttackTags.ExecutePuppetAttack(aIVirtualActionInfo2.Actor, aIVirtualActionInfo2, actionInfoSequence); + } + } + field.CallAfterLeaderAttackSimulation(); + } + + public static AIVirtualCard FindAttackTarget(AIVirtualField field, AIVirtualAttackInfo attack, List enemyTargetSequence, AIVirtualActionInfo evolutionInfo, bool isHandAllRemovalValid, bool isNoSkipAttack, bool isAttackFollower) + { + AIVirtualCard aIVirtualCard = null; + if (isAttackFollower) + { + for (int i = 0; i < enemyTargetSequence.Count; i++) + { + AIVirtualCard aIVirtualCard2 = enemyTargetSequence[i]; + attack.SetAttackTarget(aIVirtualCard2); + if (AIAttackSimulationUtility.IsAttackPossible(field, attack)) + { + AIVirtualCard nextTarget = ((enemyTargetSequence.Count > i + 1) ? enemyTargetSequence[i + 1] : field.EnemyClass); + if (isNoSkipAttack || !IsSkipAttack(field, attack, nextTarget, evolutionInfo, isHandAllRemovalValid)) + { + aIVirtualCard = aIVirtualCard2; + break; + } + } + } + } + if (aIVirtualCard == null) + { + attack.SetAttackTarget(field.EnemyClass); + if (AIAttackSimulationUtility.IsAttackPossible(field, attack)) + { + aIVirtualCard = field.EnemyClass; + } + else + { + attack.SetAttackTarget(null); + } + } + else + { + attack.SetAttackTarget(aIVirtualCard); + } + return aIVirtualCard; + } + + private static bool IsSkipAttack(AIVirtualField field, AIVirtualAttackInfo situation, AIVirtualCard nextTarget, AIVirtualActionInfo evolutionInfo, bool isHandAllRemovalValid) + { + AIVirtualCard actor = situation.Actor; + AIVirtualCard attackTarget = situation.AttackTarget; + if (!attackTarget.IsGuard && AISimulationRemovalUtility.WillDieBySkillPrediction(attackTarget, field, field.BestPlayPtn, situation, isHandAllRemovalValid)) + { + return true; + } + if (evolutionInfo != null && !attackTarget.IsGuard && !attackTarget.IsIndependent && !attackTarget.IsIndestructible && field.CheckDestroyByEvoTags(evolutionInfo, attackTarget)) + { + return true; + } + AIVirtualAttackInfo aIVirtualAttackInfo = new AIVirtualAttackInfo(actor, nextTarget); + if (!attackTarget.IsGuard && !attackTarget.IsIndependent && aIVirtualAttackInfo.WillTargetDestroyByAttackTags(field, field.BestPlayPtn, attackTarget)) + { + return true; + } + if (situation.WillTargetDestroyByAttackTags(field, field.BestPlayPtn, attackTarget)) + { + return true; + } + if (situation.WillAnyOtherAttackerDestroyed(field, field.BestPlayPtn)) + { + return true; + } + return false; + } + + public static void OnAfterExecuteAttackCommon(AIVirtualField field, AIVirtualTurnEndInfo turnEndSituation, ref List moves, bool isAttackToLeaderAgain = false) + { + if (moves == null || moves.Count <= 0) + { + AIConsoleUtility.LogError("OnAfterExecuteAttackCommon error!! moves is empty!!!!!"); + return; + } + List beforeCards = new List(field.AllyInplayCards); + AIPlayCardSimulationUtility.ExecuteRestPlayPtnAfterAttack(field, ref moves); + if (isAttackToLeaderAgain) + { + AttackToLeaderByNewInplayCards(field, beforeCards); + } + ProcessAllyTurnEndToOpponentTurnStart(field, turnEndSituation); + } + + public static void ProcessAllyTurnEndToOpponentTurnStart(AIVirtualField field, AIVirtualTurnEndInfo turnEndSituation) + { + AIVirtualTurnEndSimulator.TurnEnd(turnEndSituation, field); + AIVirtualTurnStartInfo situation = new AIVirtualTurnStartInfo(field.EnemyClass); + AIVirtualTurnStartSimulator.TurnStart(situation, field); + field.DrawCard(isAlly: false, 1, EnemyAI.EmptyPlayPtn, situation); + } + + private static void AttackToLeaderByNewInplayCards(AIVirtualField currentField, List beforeCards) + { + if (currentField.AllyInplayCards.Count <= beforeCards.Count) + { + return; + } + AIVirtualCard enemyClass = currentField.EnemyClass; + int actionLength = currentField.ActionLength; + for (int i = beforeCards.Count; i < currentField.AllyInplayCards.Count; i++) + { + AIVirtualAttackInfo aIVirtualAttackInfo = new AIVirtualAttackInfo(currentField.AllyInplayCards[i], enemyClass); + if (AIAttackSimulationUtility.IsAttackPossible(currentField, aIVirtualAttackInfo)) + { + bool isAttackerUsed = false; + AIAttackSimulationUtility.SimulateAttackIfValuable(aIVirtualAttackInfo, currentField, useAttackLeaderPreCheck: false, ref isAttackerUsed); + if (enemyClass.IsDead) + { + currentField.ActionLength -= actionLength; + break; + } + } + } + } + + private static bool IsToBeKilled(AIVirtualField field) + { + int life = field.AllyClass.Life; + int num = field.GetInplayAttackSumToLeader(isAlly: false); + if (field.AI.OPPONENT.IsEvolve) + { + num += field.EnemyInplayCards.Max((AIVirtualCard card) => card.EvolutionAttack - card.Attack); + } + return num - life >= 0; + } + + public static AIVirtualActionInfo GetFirstActionInfo(List actionInfoSequence, AIVirtualField field, List playPtn) + { + AIVirtualActionInfo aIVirtualActionInfo = null; + int num = 0; + while (num < actionInfoSequence.Count) + { + AIVirtualActionInfo aIVirtualActionInfo2 = actionInfoSequence[num]; + int nextIndexInFindingFirstAction = GetNextIndexInFindingFirstAction(actionInfoSequence, aIVirtualActionInfo2, num); + if (aIVirtualActionInfo2.ActionType == AIOperationType.PLAY || aIVirtualActionInfo2.ActionType == AIOperationType.TURNEND) + { + aIVirtualActionInfo = aIVirtualActionInfo2; + break; + } + AIVirtualCard actor = aIVirtualActionInfo2.Actor; + List list = (actor.IsAlly ? field.AllyInplayCards : field.EnemyInplayCards); + bool flag = false; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (actor.CardIndex == aIVirtualCard.CardIndex) + { + flag = true; + break; + } + } + if (!flag) + { + num = nextIndexInFindingFirstAction; + continue; + } + if (aIVirtualActionInfo2.ActionType == AIOperationType.EVOLVE) + { + aIVirtualActionInfo = aIVirtualActionInfo2; + break; + } + if (aIVirtualActionInfo2.ActionType == AIOperationType.ATTACK) + { + if (!(aIVirtualActionInfo2 is AIVirtualAttackInfo { AttackTarget: var attackTarget } aIVirtualAttackInfo)) + { + AIConsoleUtility.LogError("GetFirstAction() error!! candidate is not virtualAttackInfo"); + continue; + } + if (attackTarget == null) + { + num = nextIndexInFindingFirstAction; + continue; + } + if (!aIVirtualAttackInfo.IsAttackSuccessed) + { + num = nextIndexInFindingFirstAction; + continue; + } + if (attackTarget.IsBreakLast(playPtn) && !attackTarget.IsGuard) + { + if (aIVirtualActionInfo == null) + { + aIVirtualActionInfo = aIVirtualActionInfo2; + } + num = nextIndexInFindingFirstAction; + continue; + } + List list2 = (attackTarget.IsAlly ? field.CardListSet.AllyClassAndInplayCards : field.CardListSet.EnemyClassAndInplayCards); + bool flag2 = false; + for (int j = 0; j < list2.Count; j++) + { + AIVirtualCard aIVirtualCard2 = list2[j]; + if (attackTarget.CardIndex == aIVirtualCard2.CardIndex) + { + flag2 = true; + break; + } + } + if (flag2) + { + aIVirtualActionInfo = aIVirtualActionInfo2; + break; + } + } + num = nextIndexInFindingFirstAction; + } + return aIVirtualActionInfo; + } + + private static int GetNextIndexInFindingFirstAction(List actionInfoSequence, AIVirtualActionInfo candidate, int currentIndex) + { + int result = currentIndex + 1; + for (int i = currentIndex + 1; i < actionInfoSequence.Count && actionInfoSequence[i].PremiseAction == candidate; i++) + { + result = i; + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattleStartUserPanel.cs b/SVSim.BattleEngine/Engine/Wizard/BattleStartUserPanel.cs new file mode 100644 index 0000000..3cb225a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattleStartUserPanel.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace Wizard; + +public class BattleStartUserPanel : MonoBehaviour +{ + [SerializeField] + private UISprite _officialUserIconSprite; + + public void SetActiveOfficialUserIconSprite(bool isActive) + { + _officialUserIconSprite.gameObject.SetActive(isActive); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BestInPlayMoveAI.cs b/SVSim.BattleEngine/Engine/Wizard/BestInPlayMoveAI.cs new file mode 100644 index 0000000..2a3d3c7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BestInPlayMoveAI.cs @@ -0,0 +1,215 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; + +namespace Wizard; + +public class BestInPlayMoveAI : IBattleSimulationAI +{ + private EnemyAI AI; + + private InplayMovePatternFilter _patternFilter; + + private AIRuleBaseBattleSimulator _ruleBaseSimulator; + + private SimulationResult BestRecord; + + private SimulationAdditionalActionInfoSet _simAdditionalOptions; + + public AIVirtualField Cr_MaxField => BestRecord.BestResultField; + + public float Cr_MaxFieldValue => BestRecord.MaxFieldValue; + + public float Cr_MaxFieldValueAtSelfTurnEnd => BestRecord.MaxFieldValueAtSelfTurnEnd; + + public AIVirtualActionInfo Cr_FirstActionInfo { get; private set; } + + public List Cr_MaxActionInfoSequence => BestRecord.ActionSequence; + + public int Cr_minimumActionLengthOnWinPlan => BestRecord.MinActionLengthOfLethal; + + public BestInPlayMoveAI(EnemyAI ai) + { + AI = ai; + _patternFilter = new InplayMovePatternFilter(); + } + + public IEnumerator _CrSimulate(AIVirtualField originalField, bool doesUseEvo, bool checkTimeOverLogic, PlayPtnWithToken[] bestPlayPtnsWithToken = null, SimulationAdditionalActionInfoSet additionalActions = null) + { + AI.IsInVirutalSimulation = true; + _ruleBaseSimulator = new AIRuleBaseBattleSimulator(AI, bestPlayPtnsWithToken, canChangeToTimeOverLogic: false); + BestRecord = new SimulationResult(); + _simAdditionalOptions = additionalActions; + ParallelJob job = ParallelJob.Dispatch(delegate + { + try + { + RunSimulation(originalField, doesUseEvo); + } + catch (Exception) + { + } + }); + while (!job.isDone) + { + yield return null; + if (checkTimeOverLogic && AI.IsRunWeakLogic) + { + AI.IsInVirutalSimulation = false; + yield break; + } + } + if (Cr_MaxField == null) + { + AI.IsInVirutalSimulation = false; + yield break; + } + if (Cr_MaxActionInfoSequence.Count > 0) + { + Cr_FirstActionInfo = BattleSequencer.GetFirstActionInfo(Cr_MaxActionInfoSequence, Cr_MaxField, Cr_MaxField.BestPlayPtn); + } + AI.IsInVirutalSimulation = false; + } + + private void RunSimulation(AIVirtualField originalField, bool doesUseEvo) + { + AIVirtualField originalField2 = new AIVirtualField(originalField); + List enemyFollowers = GetEnemyFollowers(originalField2); + RunAllBreakPattern(originalField2, enemyFollowers, doesUseEvo); + } + + private void RunAllBreakPattern(AIVirtualField originalField, List enemyFollowers, bool doesUseEvo) + { + RunOnePattern(doesUseEvo, new List(), originalField, enemyFollowers); + List list = new List(); + int num = enemyFollowers.Count; + while (num > 0 && !AI.IsBattleEnd && !AI.IsRunWeakLogic) + { + int[] patternGroup = AISimulationUtility.GetPatternGroup(num); + if (patternGroup != null) + { + for (int i = 0; i < patternGroup.Length; i++) + { + if (AI.IsBattleEnd) + { + break; + } + if (AI.IsRunWeakLogic) + { + break; + } + List enemyTargets = AISimulationUtility.GetEnemyTargets(originalField.EnemyInplayCards, enemyFollowers, patternGroup[i], originalField.BestPlayPtn); + ulong item = AISimulationUtility.CalculateTargetSequenceHash(enemyTargets.ToArray(), originalField); + if (!list.Contains(item)) + { + _patternFilter.CheckBreakPatternCondition(originalField, enemyTargets); + AIOneMoreLastwordUtility.SortEnemyTargetByBreakBonus(originalField, enemyTargets); + RunOnePattern(doesUseEvo, enemyTargets, originalField, enemyFollowers); + list.Add(item); + if (_patternFilter.IsBestBreakPattern) + { + return; + } + } + } + } + num--; + } + } + + private void RunOnePattern(bool doesUseEvo, List enemyTargets, AIVirtualField originalField, List enemyFollowers) + { + if (!AISimulationUtility.IsValidEnemyTargetIndexes(originalField.EnemyInplayCards, enemyTargets)) + { + return; + } + int num = (doesUseEvo ? originalField.AllyInplayCards.Count : 0); + for (int i = -1; i < num; i++) + { + if (AISimulationUtility.IsValuableEvoIndex(i, originalField)) + { + MostValuableAttackPattern(originalField, BestRecord, i, enemyTargets); + } + } + } + + private void MostValuableAttackPattern(AIVirtualField originalField, SimulationResult bestRecord, int evoIndex, List enemyTargets) + { + List attackerSequencePermLists = AIMathematicsLibrary.EnumeratePermutations(GetAllyInplayIndexLIst(originalField)).ToList(); + AIVirtualField dontUseHandAllRemovalFieldSub = null; + if (originalField.IsHandAllRemovalWaiting()) + { + dontUseHandAllRemovalFieldSub = new AIVirtualField(originalField); + } + ExecuteAttackSequenceForAllFields(originalField, dontUseHandAllRemovalFieldSub, enemyTargets, attackerSequencePermLists, evoIndex, bestRecord); + } + + private void ExecuteAttackSequenceForAllFields(AIVirtualField originalField, AIVirtualField DontUseHandAllRemovalFieldSub, List enemyTargets, List attackerSequencePermLists, int evoIndex, SimulationResult bestRecord) + { + List list = new List(); + int count = attackerSequencePermLists.Count; + for (int i = 0; i < count; i++) + { + if (AI.IsRunWeakLogic) + { + break; + } + int[] array = attackerSequencePermLists[i]; + ulong item = AISimulationUtility.CalculateAttackSequenceHash(array, originalField); + if (!list.Contains(item)) + { + _ruleBaseSimulator.RunSequence(originalField, array, evoIndex, enemyTargets, bestRecord, _simAdditionalOptions, _patternFilter); + if (DontUseHandAllRemovalFieldSub != null) + { + _ruleBaseSimulator.RunSequence(DontUseHandAllRemovalFieldSub, array, evoIndex, enemyTargets, bestRecord, _simAdditionalOptions, _patternFilter); + } + list.Add(item); + } + } + } + + private List GetEnemyFollowers(AIVirtualField originalField) + { + List list = new List(); + for (int i = 0; i < originalField.EnemyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = originalField.EnemyInplayCards[i]; + if (!aIVirtualCard.IsUnit) + { + continue; + } + bool flag = false; + for (int j = 0; j < list.Count; j++) + { + AIVirtualCard aIVirtualCard2 = originalField.EnemyInplayCards[list[j]]; + if (EnemyAI.IsLargerThan(aIVirtualCard.Value, aIVirtualCard2.Value)) + { + list.Insert(j, i); + flag = true; + break; + } + } + if (!flag) + { + list.Add(i); + } + } + return list; + } + + private List GetAllyInplayIndexLIst(AIVirtualField originalField) + { + List list = new List(); + for (int i = 0; i < originalField.AllyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = originalField.AllyInplayCards[i]; + if (aIVirtualCard.IsUnit && !aIVirtualCard.IsDead && aIVirtualCard.AttackableCount > 0) + { + list.Add(i); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BestOpenSpaceAttackAI.cs b/SVSim.BattleEngine/Engine/Wizard/BestOpenSpaceAttackAI.cs new file mode 100644 index 0000000..76f4958 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BestOpenSpaceAttackAI.cs @@ -0,0 +1,204 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; + +namespace Wizard; + +public class BestOpenSpaceAttackAI +{ + private EnemyAI AI; + + public AIVirtualActionInfo Cr_FirstActionInfo; + + public PlayPtnWithToken Cr_BestPlayPtnWithToken; + + private ulong[] _defaultPlayptnHashArray; + + public BestOpenSpaceAttackAI(EnemyAI ai) + { + AI = ai; + } + + public IEnumerator _CrSimulate(AIVirtualField originalField, PlayPtnWithToken[] bestPlayPtnsWithToken) + { + AI.IsInVirutalSimulation = true; + float maxFieldValue = float.MinValue; + int bestFirstDeadActionIndex = int.MaxValue; + List bestActionInfoSequence = null; + AIVirtualField bestField = originalField; + Cr_BestPlayPtnWithToken = null; + Cr_FirstActionInfo = null; + _defaultPlayptnHashArray = AISimulationUtility.CalculatePlayptnWithTokenHashs(originalField, bestPlayPtnsWithToken); + ParallelJob job = ParallelJob.Dispatch(delegate + { + try + { + int count = originalField.AllyInplayCards.Count; + List list = new List(); + for (int i = 0; i < originalField.AllyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = originalField.AllyInplayCards[i]; + int num = 0; + for (num = 0; num < list.Count && !(aIVirtualCard.Value < originalField.AllyInplayCards[list[num]].Value); num++) + { + } + list.Insert(num, i); + } + int num2 = (1 << originalField.AllyInplayCards.Count) - 1; + List list2 = new List(); + for (int j = 0; j <= num2; j++) + { + if (IsValidBreakIndex(originalField.AllyInplayCards, list, j)) + { + if (AI.IsBattleEnd || AI.IsRunWeakLogic) + { + break; + } + int[] allyAttackers = GetAllyAttackers(originalField, list, j); + ulong item = AISimulationUtility.CalculateAttackSequenceHash(allyAttackers, originalField); + if (!list2.Contains(item)) + { + List list3 = new List(); + for (int k = 0; k < originalField.EnemyInplayCards.Count; k++) + { + if (originalField.EnemyInplayCards[k].IsUnit) + { + list3.Add(k); + } + } + if (AI.IsRunWeakLogic) + { + break; + } + List list4 = AIMathematicsLibrary.EnumeratePermutations(list3).ToList(); + List list5 = new List(); + for (int l = 0; l < list4.Count; l++) + { + List enemyTargetIndexes = list4[l].ToList(); + if (AISimulationUtility.IsValidEnemyTargetIndexes(originalField.EnemyInplayCards, enemyTargetIndexes)) + { + ulong item2 = AISimulationUtility.CalculateTargetSequenceHash(list4[l], originalField); + if (!list5.Contains(item2)) + { + int num3 = (1 << allyAttackers.Length) - 1; + for (int m = 0; m <= num3; m++) + { + if (AI.IsRunWeakLogic) + { + return; + } + bool[] attackLeaderOrFollowerFlags = GetAttackLeaderOrFollowerFlags(m, allyAttackers.Length); + AIVirtualField aIVirtualField = new AIVirtualField(originalField); + List actionInfoSequence = AISimulationUtility.GetActionInfoSequence(aIVirtualField, allyAttackers, attackLeaderOrFollowerFlags, -1); + List enemyTargetSequence = AISimulationUtility.GetEnemyTargetSequence(aIVirtualField, enemyTargetIndexes); + BattleSequencer.ExecSimulation(aIVirtualField, actionInfoSequence, enemyTargetSequence, new SimulationSetting(isHandRemovalValid: true, useLeaderAttackPreCheck: false, noSkipAttack: true)); + _ = aIVirtualField.EnemyClass.IsDead; + if (AI.IsRunWeakLogic) + { + return; + } + float num4 = AISimulationUtility.EvaluateField(aIVirtualField, EvaluationType.SIMPLE); + if (AI.IsRunWeakLogic) + { + return; + } + int openCount = count - aIVirtualField.AllyInplayCards.Count((AIVirtualCard c) => !c.IsDead); + PlayPtnWithToken bestPlayPtnWithToken = null; + int bestFirstDeadActionIndex2 = int.MaxValue; + float num5 = AISimulationUtility.EvaluateLegalPlayPtnAfterSimulation(aIVirtualField, actionInfoSequence, bestPlayPtnsWithToken, openCount, _defaultPlayptnHashArray, out bestPlayPtnWithToken, out bestFirstDeadActionIndex2); + float num6 = num4 + num5; + if (AI.IsRunWeakLogic) + { + return; + } + if (EnemyAI.IsLargerThan(num6, maxFieldValue) || (EnemyAI.IsSameValue(num6, maxFieldValue) && bestFirstDeadActionIndex2 < bestFirstDeadActionIndex)) + { + maxFieldValue = num6; + bestFirstDeadActionIndex = bestFirstDeadActionIndex2; + Cr_BestPlayPtnWithToken = bestPlayPtnWithToken; + bestActionInfoSequence = actionInfoSequence; + bestField = aIVirtualField; + } + } + list5.Add(item2); + } + } + } + list2.Add(item); + } + } + } + } + catch (Exception) + { + } + }); + while (!job.isDone) + { + yield return null; + if (AI.IsRunWeakLogic) + { + AI.IsInVirutalSimulation = false; + yield break; + } + } + if (AI.IsBattleEnd) + { + AI.IsInVirutalSimulation = false; + yield break; + } + if (bestActionInfoSequence.Count > 0) + { + Cr_FirstActionInfo = BattleSequencer.GetFirstActionInfo(bestActionInfoSequence, bestField, Cr_BestPlayPtnWithToken.PlayPtn); + } + AI.IsInVirutalSimulation = false; + } + + private bool IsValidBreakIndex(List allyCards, List sortedInplayIndex, int sortedBreakIndex) + { + for (int i = 0; i < allyCards.Count; i++) + { + if (((sortedBreakIndex >> i) & 1) > 0) + { + AIVirtualCard aIVirtualCard = allyCards[sortedInplayIndex[i]]; + if (aIVirtualCard.IsAmulet || aIVirtualCard.AttackableCount <= 0) + { + return false; + } + } + } + return true; + } + + private int[] GetAllyAttackers(AIVirtualField field, List sortedInplayIndex, int sortedBreakIndex) + { + List list = new List(); + for (int i = 0; i < sortedInplayIndex.Count; i++) + { + if (!field.AllyInplayCards[sortedInplayIndex[i]].IsAmulet && ((sortedBreakIndex >> i) & 1) > 0) + { + list.Add(sortedInplayIndex[i]); + } + } + return list.ToArray(); + } + + private bool[] GetAttackLeaderOrFollowerFlags(int index, int attackerCount) + { + bool[] array = new bool[attackerCount]; + for (int i = 0; i < attackerCount; i++) + { + if (((index >> i) & 1) > 0) + { + array[i] = true; + } + else + { + array[i] = false; + } + } + return array; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BrowserURL.cs b/SVSim.BattleEngine/Engine/Wizard/BrowserURL.cs new file mode 100644 index 0000000..c567f5e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BrowserURL.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +namespace Wizard; + +public static class BrowserURL +{ + public static void Open(string url) + { + Application.OpenURL(url); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CampaignBattleWin.cs b/SVSim.BattleEngine/Engine/Wizard/CampaignBattleWin.cs new file mode 100644 index 0000000..16c8168 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CampaignBattleWin.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class CampaignBattleWin +{ + public enum eBoxGrade + { + None, + One, + Two, + Three, + Four, + Five, + Six + } + + public enum eBoxStatus + { + NO_GET, + ACTIVE, + ALREADY_GET + } + + public bool IsInSessionCampaign { get; private set; } + + public bool IsHaveSpecialWinReward { get; private set; } + + public int EndUnixTime { get; private set; } + + public int MaxBoxNum { get; private set; } + + public int GetBoxNum { get; private set; } + + public eBoxGrade BoxGrade { get; private set; } + + public eBoxStatus BoxStatus { get; private set; } + + public List RewardList { get; private set; } + + public SpecialTreasureInfo SpecialTreasureInfo { get; private set; } + + public void Parse(JsonData json) + { + IsInSessionCampaign = true; + GetBoxNum = json["daily_box_got_num"].ToInt(); + MaxBoxNum = json["max_daily_box_got_num"].ToInt(); + BoxGrade = (eBoxGrade)json["grade_id"].ToInt(); + BoxStatus = (eBoxStatus)json["daily_rare_box_state"].ToInt(); + EndUnixTime = (int)ConvertTime.DateTimeToUnixTime(DateTime.Parse(json["end_time"].ToString())); + RewardList = new List(); + JsonData jsonData = json["limited_reward_info"]; + for (int i = 0; i < jsonData.Count; i++) + { + RewardList.Add(new CampaignRewardInfo(jsonData[i])); + } + if (json.Keys.Contains("special_treasure_info")) + { + IsHaveSpecialWinReward = true; + SpecialTreasureInfo = new SpecialTreasureInfo(json["special_treasure_info"]); + } + } + + public void Clear() + { + IsInSessionCampaign = false; + IsHaveSpecialWinReward = false; + RewardList = new List(); + } + + public void OnFinishCanpaignTime() + { + Clear(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CampaignRewardInfo.cs b/SVSim.BattleEngine/Engine/Wizard/CampaignRewardInfo.cs new file mode 100644 index 0000000..bc0348a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CampaignRewardInfo.cs @@ -0,0 +1,22 @@ +using LitJson; + +namespace Wizard; + +public class CampaignRewardInfo +{ + public UserGoods.Type Type { get; private set; } + + public long GoodsId { get; private set; } + + public int GoodsCount { get; private set; } + + public bool IsReceived { get; private set; } + + public CampaignRewardInfo(JsonData json) + { + Type = (UserGoods.Type)json["reward_type"].ToInt(); + GoodsId = json["reward_detail_id"].ToLong(); + GoodsCount = json["reward_num"].ToInt(); + IsReceived = json["is_received"].ToBoolean(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CardCreateTask.cs b/SVSim.BattleEngine/Engine/Wizard/CardCreateTask.cs new file mode 100644 index 0000000..5a0704e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CardCreateTask.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class CardCreateTask : BaseTask +{ + public class CardCreateTaskParam : BaseParam + { + public string card_id_number_array; + } + + public CardCreateTask() + { + base.type = ApiType.Type.CardCreate; + } + + public void SetParameter(IDictionary card_id_number_dict) + { + CardCreateTaskParam cardCreateTaskParam = new CardCreateTaskParam(); + cardCreateTaskParam.card_id_number_array = JsonMapper.ToJson(card_id_number_dict); + base.Params = cardCreateTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CardDestructTask.cs b/SVSim.BattleEngine/Engine/Wizard/CardDestructTask.cs new file mode 100644 index 0000000..fbd2c9c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CardDestructTask.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class CardDestructTask : BaseTask +{ + public class CardDestructTaskParam : BaseParam + { + public string card_id_number_array; + } + + public CardDestructTask() + { + base.type = ApiType.Type.CardDestruct; + } + + public void SetParameter(IDictionary card_id_number_dict) + { + CardDestructTaskParam cardDestructTaskParam = new CardDestructTaskParam(); + cardDestructTaskParam.card_id_number_array = JsonMapper.ToJson(card_id_number_dict); + base.Params = cardDestructTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CardMasterLocalFileUtility.cs b/SVSim.BattleEngine/Engine/Wizard/CardMasterLocalFileUtility.cs new file mode 100644 index 0000000..4324f6d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CardMasterLocalFileUtility.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Cute; +using UnityEngine; + +namespace Wizard; + +public static class CardMasterLocalFileUtility +{ + private static readonly string CARDMASTER_DIRECTORY_NAME = "cardmaster"; + + private static string CardMasterDirPath => Path.Combine(Application.persistentDataPath, CARDMASTER_DIRECTORY_NAME); + + private static string GetCardMasterFilePath(CardMaster.CardMasterId cardMasterId) + { + return Path.Combine(CardMasterDirPath, $"card_master_{(int)cardMasterId}"); + } + + public static string GetCardMasterHash() + { + string cardMasterFilePath = GetCardMasterFilePath(CardMaster.CardMasterId.Default); + string result = string.Empty; + try + { + if (!File.Exists(cardMasterFilePath)) + { + return result; + } + using StreamReader streamReader = new StreamReader(cardMasterFilePath); + result = CryptAES.decryptForNode(streamReader.ReadLine()); + } + catch (Exception ex) + { + WriteClientInfoLog("CardMasater: \"" + cardMasterFilePath + "\" ใฎ่ชญใฟ่พผใฟใซๅคฑๆ•—\n" + ex); + result = string.Empty; + } + return result; + } + + public static bool ReadLocalCardMasterCSV(out Dictionary dictCardMasterCsv) + { + dictCardMasterCsv = new Dictionary(); + foreach (CardMaster.CardMasterId value in Enum.GetValues(typeof(CardMaster.CardMasterId))) + { + string cardMasterFilePath = GetCardMasterFilePath(value); + if (!File.Exists(cardMasterFilePath)) + { + continue; + } + try + { + using StreamReader streamReader = new StreamReader(cardMasterFilePath); + if (value == CardMaster.CardMasterId.Default) + { + streamReader.ReadLine(); + } + dictCardMasterCsv[value] = CryptAES.decryptForNode(streamReader.ReadToEnd()); + } + catch (Exception ex) + { + WriteClientInfoLog("CardMasater: \"" + cardMasterFilePath + "\" ใฎ่ชญใฟ่พผใฟใซๅคฑๆ•—\n" + ex); + CreateMasterReadErrorDialog(); + return false; + } + } + return true; + } + + private static void CreateMasterReadErrorDialog() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("System_0055")); + dialogBase.SetText(Data.SystemText.Get("System_0056")); + DeleteAllCardMasterLocalFile(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BackToTitleBtn); + dialogBase.SetFadeButtonEnabled(flag: false); + } + + public static void WriteAllCardMasterLocalFile(Dictionary dictCardMasterCSV, string cardMasterHash) + { + DeleteAllCardMasterLocalFile(); + Directory.CreateDirectory(CardMasterDirPath); + foreach (KeyValuePair item in dictCardMasterCSV) + { + CardMaster.CardMasterId key = item.Key; + string value = item.Value; + if (!(value == "")) + { + string text = null; + if (key == CardMaster.CardMasterId.Default) + { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.AppendLine(CryptAES.encryptForNode(cardMasterHash)); + stringBuilder.AppendLine(CryptAES.encryptForNode(value)); + text = stringBuilder.ToString(); + } + else + { + text = CryptAES.encryptForNode(value); + } + WriteCardMasterLocalFile(key, text); + } + } + } + + private static void WriteCardMasterLocalFile(CardMaster.CardMasterId cardMasterId, string writeStr) + { + string cardMasterFilePath = GetCardMasterFilePath(cardMasterId); + try + { + File.WriteAllText(cardMasterFilePath, writeStr); + } + catch (Exception ex) + { + WriteClientInfoLog("CardMasater: \"" + cardMasterFilePath + "\" ใฎๆ›ธใ่พผใฟใซๅคฑๆ•—\n" + ex); + DeleteAllCardMasterLocalFile(); + } + } + + public static void DeleteAllCardMasterLocalFile() + { + try + { + if (Directory.Exists(CardMasterDirPath)) + { + Directory.Delete(CardMasterDirPath, recursive: true); + } + } + catch (Exception ex) + { + WriteClientInfoLog("CardMasaterใƒ‡ใ‚ฃใƒฌใ‚ฏใƒˆใƒช: \"" + CardMasterDirPath + "\" ใฎๅ‰Š้™คใซๅคฑๆ•—\n" + ex); + } + } + + private static void WriteClientInfoLog(string log) + { + LocalLog.AccumulateTraceLog(log); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CardProtectTask.cs b/SVSim.BattleEngine/Engine/Wizard/CardProtectTask.cs new file mode 100644 index 0000000..9a41b83 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CardProtectTask.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class CardProtectTask : BaseTask +{ + public class CardProtectTaskParam : BaseParam + { + public int card_id; + + public bool is_protected; + } + + private CardProtectTaskParam _param; + + public CardProtectTask() + { + base.type = ApiType.Type.CardProtect; + } + + public void SetParameter(int card_id, bool is_protected) + { + _param = new CardProtectTaskParam(); + _param.card_id = card_id; + _param.is_protected = is_protected; + base.Params = _param; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + List favoriteCardList = GameMgr.GetIns().GetDataMgr().FavoriteCardList; + if (_param.is_protected) + { + favoriteCardList.Add(_param.card_id); + } + else + { + favoriteCardList.Remove(_param.card_id); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CardSelectListConfirmPagerView.cs b/SVSim.BattleEngine/Engine/Wizard/CardSelectListConfirmPagerView.cs new file mode 100644 index 0000000..fa87074 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CardSelectListConfirmPagerView.cs @@ -0,0 +1,402 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class CardSelectListConfirmPagerView : MonoBehaviour +{ + private const float CARD_SCALE = 0.55f; + + private const int CARD_NUM_PER_PAGE = 8; + + private const float DRAG_VALUE = 70f; + + [SerializeField] + private UIButton _buttonNext; + + [SerializeField] + private UIButton _buttonPrev; + + [SerializeField] + private GameObject _pagingDragPanel; + + [SerializeField] + private UIGrid _gridCardList; + + [SerializeField] + protected GameObject _cardObjPool; + + [SerializeField] + private UIToggle _indicatorBase; + + [SerializeField] + private GameObject _cardInfoTextOriginal; + + private List _loadedAssetPathList = new List(); + + protected List _cardObjList = new List(); + + private List _removedCardObjList = new List(); + + private Dictionary> _dictPageCardObj = new Dictionary>(); + + private Dictionary _dictCardIdNum = new Dictionary(); + + public Action OnCallbackRemoveCard; + + protected int _currentPage; + + private List _indicatorList = new List(); + + protected CardDetailUI _cardDetailUI; + + private CardMaster.CardMasterId _cardMasterId; + + protected bool _isInit; + + private bool _isDrag; + + public List LoadedAssetPathList => _loadedAssetPathList; + + public Dictionary DictCardIdNum + { + get + { + return _dictCardIdNum; + } + private set + { + _dictCardIdNum = value; + } + } + + private void Start() + { + UIEventListener.Get(_pagingDragPanel).onDrag = OnDrag; + UIEventListener.Get(_pagingDragPanel).onDragEnd = OnDragEnd; + } + + private void OnDrag(GameObject obj, Vector2 dir) + { + if (!_isDrag && Mathf.Abs(dir.x) >= 70f) + { + _isDrag = true; + if (dir.x < 0f) + { + OnNextButton(); + } + else + { + OnPrevButton(); + } + } + } + + private void OnDragEnd(GameObject obj) + { + _isDrag = false; + } + + public void Init(Dictionary cardIdDict, CardDetailUI cardDetailUI, Action callback, CardMaster.CardMasterId cardMasterId) + { + _cardMasterId = cardMasterId; + DictCardIdNum = cardIdDict; + List cardIdList = new List(DictCardIdNum.Keys); + _cardDetailUI = cardDetailUI; + _cardInfoTextOriginal.SetActive(value: false); + LoadCardList(cardIdList, delegate + { + _currentPage = 1; + UpdateCardListView(); + _isInit = true; + callback.Call(); + }); + } + + public void UpdateCardListView() + { + DividCardObjListEachPages(_cardObjList); + CreateIndicator(); + ViewCardList(_currentPage); + } + + public void DecrementCardNum(int cardId, int num) + { + if (!DictCardIdNum.ContainsKey(cardId)) + { + return; + } + int num2 = DictCardIdNum[cardId]; + if (num2 >= num) + { + UIBase_CardManager.CardObjData cardObjData = _cardObjList.Find((UIBase_CardManager.CardObjData data) => data.ids == cardId); + DictCardIdNum[cardId] = num2 - num; + if (DictCardIdNum[cardId] <= 0) + { + DictCardIdNum.Remove(cardId); + _cardObjList.Remove(cardObjData); + _removedCardObjList.Add(cardObjData); + cardObjData.CardObj.transform.parent = _cardObjPool.transform; + cardObjData.CardObj.transform.localPosition = Vector3.zero; + } + else + { + cardObjData.CardObj.GetComponent().SetNum(DictCardIdNum[cardId]); + } + } + UpdateCardListView(); + } + + public void IncrementCardNum(int cardId, int num) + { + if (DictCardIdNum.ContainsKey(cardId)) + { + int num2 = DictCardIdNum[cardId]; + DictCardIdNum[cardId] = num2 + num; + _cardObjList.Find((UIBase_CardManager.CardObjData data) => data.ids == cardId).CardObj.GetComponent().SetNum(DictCardIdNum[cardId]); + } + else + { + UIBase_CardManager.CardObjData cardObjData = _removedCardObjList.Find((UIBase_CardManager.CardObjData data) => data.ids == cardId); + DictCardIdNum.Add(cardId, num); + _cardObjList.Add(cardObjData); + _removedCardObjList.Remove(cardObjData); + cardObjData.CardObj.GetComponent().SetNum(DictCardIdNum[cardId]); + cardObjData.CardObj.transform.parent = _cardObjPool.transform; + cardObjData.CardObj.transform.localPosition = Vector3.zero; + } + UpdateCardListView(); + } + + public void OnCloseView() + { + if (_loadedAssetPathList != null && _loadedAssetPathList.Count > 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedAssetPathList); + _loadedAssetPathList.Clear(); + } + } + + private void ViewCardList(int page) + { + if (page > _dictPageCardObj.Count) + { + page = 1; + } + _currentPage = page; + if (page > 1) + { + _buttonPrev.gameObject.SetActive(value: true); + } + else + { + _buttonPrev.gameObject.SetActive(value: false); + } + if (page < _dictPageCardObj.Count) + { + _buttonNext.gameObject.SetActive(value: true); + } + else + { + _buttonNext.gameObject.SetActive(value: false); + } + if (_indicatorList.Count > 1) + { + _indicatorList[page - 1].value = true; + } + RemoveCardObjFromGrid(_gridCardList); + AddCardObjToGrid(_dictPageCardObj[page]); + } + + private void CreateIndicator() + { + GameObject gameObject = _indicatorBase.transform.parent.gameObject; + if (_dictPageCardObj.Count <= 1) + { + gameObject.SetActive(value: false); + return; + } + gameObject.SetActive(value: true); + if (_indicatorList.Count > 0) + { + for (int i = 0; i < _indicatorList.Count; i++) + { + if (i >= _dictPageCardObj.Count) + { + _indicatorList[i].gameObject.SetActive(value: false); + continue; + } + _indicatorList[i].gameObject.SetActive(value: true); + _indicatorList[i].Set(state: false); + } + } + else + { + _indicatorList.Add(_indicatorBase); + for (int j = 1; j < _dictPageCardObj.Count; j++) + { + _indicatorList.Add(NGUITools.AddChild(gameObject, _indicatorBase.gameObject).GetComponent()); + } + } + gameObject.GetComponent().Reposition(); + } + + private void LoadCardList(List cardIdList, Action callback = null) + { + Toolbox.ResourcesManager.CardListAssetPathList.Clear(); + UIManager.GetInstance().CardLoadSelect(base.gameObject, cardIdList, 24, is2D: true, delegate + { + _cardObjList = UIManager.GetInstance().getCardList2DObjs(); + _loadedAssetPathList.AddRange(Toolbox.ResourcesManager.CardListAssetPathList); + string text = Data.SystemText.Get("System_0022"); + for (int i = 0; i < _cardObjList.Count; i++) + { + GameObject cardObj = _cardObjList[i].CardObj; + int ids = _cardObjList[i].ids; + CardListTemplate component = cardObj.GetComponent(); + component.SetNum(DictCardIdNum[ids]); + cardObj.AddComponent().size = component._cardTexture.localSize; + UIEventListener uIEventListener = UIEventListener.Get(cardObj); + uIEventListener.onClick = _cardDetailUI.OnPushCardDetailOn; + uIEventListener.onDrag = OnDrag; + uIEventListener.onDragEnd = OnDragEnd; + if (GameMgr.GetIns().GetDataMgr().IsMaintenanceCard(ids)) + { + SetBlackOutCardInfoText(cardObj, text); + } + else if (IsNotCraftDestructCard(ids)) + { + string text2 = string.Empty; + CardParameter cardParameterFromId = CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(ids); + if (cardParameterFromId.IsBasicCard) + { + text2 = Data.SystemText.Get("Card_0160"); + } + if (cardParameterFromId.IsPreReleaseCard) + { + text2 = Data.SystemText.Get("Card_0245"); + } + SetBlackOutCardInfoText(cardObj, text2); + } + cardObj.transform.parent = _cardObjPool.transform; + cardObj.transform.localPosition = Vector3.zero; + cardObj.SetActive(value: false); + cardObj.SetActive(value: true); + } + callback.Call(); + }, isDefaultSleeve: true); + } + + private void SetBlackOutCardInfoText(GameObject cardObj, string text) + { + GameObject obj = UnityEngine.Object.Instantiate(_cardInfoTextOriginal); + obj.gameObject.SetActive(value: true); + obj.transform.parent = cardObj.transform; + obj.transform.localPosition = Vector3.zero; + obj.transform.localRotation = Quaternion.identity; + obj.transform.localScale = Vector3.one; + obj.GetComponent().text = text; + } + + public void OnNextButton() + { + if (_isInit && !_cardDetailUI.GetIsDetailOn() && _currentPage < _dictPageCardObj.Count) + { + ViewCardList(++_currentPage); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + } + } + + public void OnPrevButton() + { + if (_isInit && !_cardDetailUI.GetIsDetailOn() && _currentPage > 1) + { + ViewCardList(--_currentPage); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + } + } + + private void DividCardObjListEachPages(List cardObjList) + { + _dictPageCardObj.Clear(); + List list = new List(); + int num = 0; + int num2 = 1; + List list2 = cardObjList.ConvertAll((UIBase_CardManager.CardObjData conv) => conv.ids); + SortCardIdList(list2); + cardObjList = list2.ConvertAll((int conv) => cardObjList.Find((UIBase_CardManager.CardObjData find) => find.ids == conv)); + for (int num3 = 0; num3 < cardObjList.Count; num3++) + { + if (num >= 8) + { + num = 0; + _dictPageCardObj.Add(num2, list); + list = new List(); + num2++; + } + list.Add(cardObjList[num3]); + num++; + } + _dictPageCardObj.Add(num2, list); + } + + private List SortCardIdList(List idList) + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + List list = new List(); + List list2 = new List(); + List list3 = new List(); + for (int i = 0; i < idList.Count; i++) + { + int num = idList[i]; + if (dataMgr.IsMaintenanceCard(num)) + { + list.Add(num); + } + else if (IsNotCraftDestructCard(num)) + { + list2.Add(num); + } + else + { + list3.Add(num); + } + } + list = UIManager.GetInstance().getUIBase_CardManager().SortIDList(list, _cardMasterId); + list2 = UIManager.GetInstance().getUIBase_CardManager().SortIDList(list2, _cardMasterId); + list3 = UIManager.GetInstance().getUIBase_CardManager().SortIDList(list3, _cardMasterId); + idList.Clear(); + idList.AddRange(list); + idList.AddRange(list2); + idList.AddRange(list3); + return idList; + } + + private bool IsNotCraftDestructCard(int cardId) + { + return CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(cardId).IsNotCraftDestruct; + } + + private void RemoveCardObjFromGrid(UIGrid gridObj) + { + List childList = gridObj.GetChildList(); + for (int i = 0; i < childList.Count; i++) + { + childList[i].transform.parent = _cardObjPool.transform; + childList[i].transform.localPosition = Vector3.zero; + } + } + + private void AddCardObjToGrid(List cardObjList) + { + for (int i = 0; i < cardObjList.Count; i++) + { + GameObject cardObj = cardObjList[i].CardObj; + _gridCardList.AddChild(cardObj.transform); + cardObj.transform.localScale = Vector3.one * 0.55f; + cardObj.SetActive(value: true); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CardSkillHashUtility.cs b/SVSim.BattleEngine/Engine/Wizard/CardSkillHashUtility.cs new file mode 100644 index 0000000..df54df0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CardSkillHashUtility.cs @@ -0,0 +1,92 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class CardSkillHashUtility +{ + public static int NEWEST_CARD_SKILL_HASH_VERSION = 1; + + public static ulong GetSkillHash(BattleCardBase card, int skillHashVersion) + { + return 0 + GetSkillCollectionHash(card.Skills) * 2591 + GetSkillApplyInformationHash(card.SkillApplyInformation, skillHashVersion) * 131; + } + + private static ulong GetSkillCollectionHash(SkillCollectionBase skillCollection) + { + ulong num = 0uL; + foreach (SkillBase item in skillCollection) + { + num += GetSingleSkillBaseHash(item); + } + return num; + } + + public static List GetSingleSkillHashStringList(SkillCollectionBase skillCollection) + { + List list = null; + foreach (SkillBase item in skillCollection) + { + list = AIParamQuery.AddElementToList(GetSingleSkillBaseHash(item).ToString(), list); + } + return list; + } + + public static ulong GetSingleSkillBaseHash(SkillBase skill) + { + ulong num = 0uL; + SkillCreator.SkillBuildInfo buildInfo = skill.SkillPrm.buildInfo; + num += (ulong)((long)buildInfo._type.GetHashCode() * 6007L); + num += (ulong)((long)buildInfo._timing.GetHashCode() * 17L); + num += (ulong)((long)buildInfo._option.GetHashCode() * 47L); + string text = ""; + for (int i = 0; i < buildInfo._parsedConditionNew.Count; i++) + { + string text2 = buildInfo._parsedConditionNew[i]; + if (i > 0) + { + text += "&"; + } + text += text2; + } + num += (ulong)((long)text.GetHashCode() * 107L); + string text3 = ""; + for (int j = 0; j < buildInfo._parsedTargetNew.Count; j++) + { + string text4 = buildInfo._parsedTargetNew[j]; + if (j > 0) + { + text3 += "&"; + } + text3 += text4; + } + return num + (ulong)((long)text3.GetHashCode() * 227L); + } + + private static ulong GetSkillApplyInformationHash(ISkillApplyInformation skillApplyInformation, int version) + { + ulong num = 0uL; + if (version >= 1) + { + num += GetRepeatSkillTimingInfoHash(skillApplyInformation.RepeatSkillTimingList); + } + return num; + } + + private static ulong GetRepeatSkillTimingInfoHash(List repeatSkillInfoList) + { + ulong num = 0uL; + if (repeatSkillInfoList == null || repeatSkillInfoList.Count <= 0) + { + return num; + } + for (int i = 0; i < repeatSkillInfoList.Count; i++) + { + RepeatSkillInfo repeatSkillInfo = repeatSkillInfoList[i]; + num += (ulong)((long)repeatSkillInfo.Timing.GetHashCode() * 37L); + num += (ulong)((long)repeatSkillInfo.Target.GetHashCode() * 67L); + num += GetSingleSkillBaseHash(repeatSkillInfo.Skill); + num += (ulong)(repeatSkillInfo.IsRemoveReservation ? 127 : 0); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChaosUtil.cs b/SVSim.BattleEngine/Engine/Wizard/ChaosUtil.cs new file mode 100644 index 0000000..48ea571 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChaosUtil.cs @@ -0,0 +1,19 @@ +namespace Wizard; + +public static class ChaosUtil +{ + public static string GetDeckName(int chaosId, int chaosNum) + { + return Data.SystemText.Get($"Chaos_DeckName_{chaosId:0000}_{chaosNum}"); + } + + public static string GetDeckDesc(int chaosId, int chaosNum) + { + return Data.SystemText.Get($"Chaos_DeckDesc_{chaosId:0000}_{chaosNum}"); + } + + public static string GetRoomDeckDesc(int chaosId, int chaosNum) + { + return Data.SystemText.Get($"Chaos_RoomDeckDesc_{chaosId:0000}_{chaosNum}"); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChapterObjectCenteringSupporter.cs b/SVSim.BattleEngine/Engine/Wizard/ChapterObjectCenteringSupporter.cs new file mode 100644 index 0000000..292062c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChapterObjectCenteringSupporter.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace Wizard; + +public class ChapterObjectCenteringSupporter : MonoBehaviour +{ + [SerializeField] + public Transform _targetTransform; +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CheckSpecialTitleTask.cs b/SVSim.BattleEngine/Engine/Wizard/CheckSpecialTitleTask.cs new file mode 100644 index 0000000..73b0f33 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CheckSpecialTitleTask.cs @@ -0,0 +1,40 @@ +using LitJson; + +namespace Wizard; + +public class CheckSpecialTitleTask : BaseTask +{ + public CheckSpecialTitleTask() + { + base.type = ApiType.Type.CheckSpecialTitle; + } + + public int ParseTitleCheckData() + { + int num = Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + string text = "0"; + dataMgr.TitleId = "0"; + if (jsonData.Keys.Contains("title_image_id")) + { + text = jsonData["title_image_id"].ToString(); + } + if (text != "0" && text != "1") + { + if (SpecialTitleAssetBundle.IsAvailableTitleAssetBundle(text)) + { + dataMgr.TitleId = text; + } + } + else + { + dataMgr.TitleId = text; + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CheckTimeSlipRotationPeriodTask.cs b/SVSim.BattleEngine/Engine/Wizard/CheckTimeSlipRotationPeriodTask.cs new file mode 100644 index 0000000..45764d5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CheckTimeSlipRotationPeriodTask.cs @@ -0,0 +1,9 @@ +namespace Wizard; + +public class CheckTimeSlipRotationPeriodTask : BaseTask +{ + public CheckTimeSlipRotationPeriodTask() + { + base.type = ApiType.Type.CheckTimeSlipRotationPeriod; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChoiceVirtualCard.cs b/SVSim.BattleEngine/Engine/Wizard/ChoiceVirtualCard.cs new file mode 100644 index 0000000..cdd8bbf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChoiceVirtualCard.cs @@ -0,0 +1,51 @@ +namespace Wizard; + +public class ChoiceVirtualCard : AIVirtualCard +{ + public BattleCardBase VirtualBattleCard { get; private set; } + + public ChoiceVirtualCard(BattleCardBase card, bool isAlly, AIVirtualField field) + { + VirtualBattleCard = card; + base.IsAlly = isAlly; + _field = field; + InitializeFromBattleCardBase(card); + } + + protected override void InitializeFromBattleCardBase(BattleCardBase origin) + { + InitializeFromBattleCardBaseBasic(origin); + Cost = origin.Cost; + base.CardIndex = origin.BaseParameter.BaseCardId; + IsPlayer = origin.IsPlayer; + base.TagCollectionContainer = new AITagCollectionContainer(); + BarrierInfoCollection = new AIBarrierInfoCollection(); + if (origin.Tribe != null && origin.Tribe.Count > 0) + { + for (int i = 0; i < origin.Tribe.Count; i++) + { + AppendTribe(origin.Tribe[i]); + } + } + } + + public override ulong GetHash() + { + ulong num = 0uL; + num += (ulong)((long)base.Attack * 6337L); + num += (ulong)((long)base.Life * 11383L); + num += (ulong)((long)base.DefLife * 173L); + num += (ulong)((long)base.EvolutionAttack * 1488017L); + num += (ulong)((long)base.EvolutionLife * 937477L); + num += (ulong)((long)Cost * 14401L); + num += PRIME_NUMBERS_FOR_CLAN[(int)base.Clan % PRIME_NUMBERS_FOR_CLAN.Length]; + if (_tribeList != null) + { + for (int i = 0; i < _tribeList.Count; i++) + { + num += PRIME_NUMBERS_FOR_TRIBE[(int)_tribeList[i] % PRIME_NUMBERS_FOR_TRIBE.Length]; + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ClassInfomationOrder.cs b/SVSim.BattleEngine/Engine/Wizard/ClassInfomationOrder.cs new file mode 100644 index 0000000..21393bb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ClassInfomationOrder.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public class ClassInfomationOrder : Master.ReadFromCsv +{ + public int ChaosId; + + public List ClassIds; + + public void ReadCsvColumns(string[] columns) + { + int.TryParse(columns[0], out ChaosId); + ClassIds = columns[1].Split('|').Select(int.Parse).ToList(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ClassSelectionButton.cs b/SVSim.BattleEngine/Engine/Wizard/ClassSelectionButton.cs new file mode 100644 index 0000000..c1bd3a1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ClassSelectionButton.cs @@ -0,0 +1,56 @@ +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ClassSelectionButton : MonoBehaviour +{ + public delegate void OnClickClassButton(ClassSelectionButton classSelectionButton); + + public const string CLASS_SELECT_BUTTON_EMPTY = "empty"; + + [SerializeField] + private UITexture _texture; + + [SerializeField] + private UIButton _button; + + [SerializeField] + private UILabel _storyClearLabel; + + [SerializeField] + private UILabel _usedLabel; + + [SerializeField] + private GameObject _notificationIcon; + + public ClassCharacterMasterData ClassCharacterMasterData { get; private set; } + + private void Start() + { + _notificationIcon.SetActive(value: false); + } + + public void Init(ClassCharacterMasterData classCharacterMasterData, Texture texture, OnClickClassButton onClick, bool isShowStoryClearLabel, bool isShowUsedLabel, bool showNotificationIcon) + { + ClassCharacterMasterData = classCharacterMasterData; + _texture.mainTexture = texture; + UIEventListener.Get(_button.gameObject).onClick = delegate + { + onClick(this); + }; + _storyClearLabel.gameObject.SetActive(isShowStoryClearLabel); + _usedLabel.gameObject.SetActive(isShowUsedLabel); + UIManager.SetObjectToGrey(_texture.gameObject, isShowUsedLabel); + _notificationIcon.SetActive(showNotificationIcon); + } + + public void InitEmpty() + { + _texture.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("empty", ResourcesManager.AssetLoadPathType.ClassCharaButton, isfetch: true)); + _button.isEnabled = false; + _storyClearLabel.gameObject.SetActive(value: false); + _usedLabel.gameObject.SetActive(value: false); + UIManager.SetObjectToGrey(_texture.gameObject, b: false); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ClassSkinDetailWindow.cs b/SVSim.BattleEngine/Engine/Wizard/ClassSkinDetailWindow.cs new file mode 100644 index 0000000..16be6bd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ClassSkinDetailWindow.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.SkinPurchase; + +namespace Wizard; + +public class ClassSkinDetailWindow : MonoBehaviour +{ + [SerializeField] + private SkinProductDetail _skinProductDetail; + + [SerializeField] + private UILabel _labelSingleProductName; + + [SerializeField] + private UILabel _labelMultiProductName; + + [SerializeField] + private UISprite _spriteClassColorIcon; + + [SerializeField] + private UILabel _labelCV; + + [SerializeField] + private UIButton _buttonVoice; + + public void SetMultiData(SkinSeriesPurchaseInfo seriesInfo) + { + _skinProductDetail.SetMultiProductDetail(seriesInfo); + _labelSingleProductName.gameObject.SetActive(value: false); + _labelMultiProductName.gameObject.SetActive(value: true); + _labelCV.gameObject.SetActive(value: false); + _labelMultiProductName.text = seriesInfo.saleInfo.name; + } + + public void SetSingleData(SkinProductInfo productInfo, List loadedVoiceList) + { + _skinProductDetail.SetSingleProductDetail(productInfo, productInfo.description); + _labelSingleProductName.gameObject.SetActive(value: true); + _labelMultiProductName.gameObject.SetActive(value: false); + _labelCV.gameObject.SetActive(value: true); + ClassCharacterMasterData charaPrmBySkinId = GameMgr.GetIns().GetDataMgr().GetCharaPrmBySkinId(productInfo.leader_skin_id); + _labelSingleProductName.text = productInfo.saleInfo.name; + ClassCharaPrm.SetClassLabelSetting(_labelSingleProductName, charaPrmBySkinId.ClassColorId); + _spriteClassColorIcon.spriteName = ClassCharaPrm.GetIconSpriteName(charaPrmBySkinId.clan); + _labelCV.text = productInfo.cv_name; + _buttonVoice.onClick.Clear(); + _buttonVoice.onClick.Add(new EventDelegate(delegate + { + if (Data.Master._emotionDic.ContainsKey(productInfo.leader_skin_id.ToString())) + { + GameMgr.GetIns().GetSoundMgr().PlayVoice(ClassCharaPrm.EmotionType.LEADER_SELECT, productInfo.leader_skin_id, loadedVoiceList); + } + })); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ClassUtil.cs b/SVSim.BattleEngine/Engine/Wizard/ClassUtil.cs new file mode 100644 index 0000000..b6eda3e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ClassUtil.cs @@ -0,0 +1,21 @@ +namespace Wizard; + +public class ClassUtil +{ + public static ClassType GetClassType(CardParameter cardParam, Format format, ClassSet classSet) + { + if (classSet == null || classSet.SubClass == CardBasePrm.ClanType.NONE || !FormatBehaviorManager.GetDefaultBehaviour(format).UseSubClass) + { + return ClassType.None; + } + if (format == Format.Crossover) + { + if (cardParam.Clan != classSet.SubClass) + { + return ClassType.MainClass; + } + return ClassType.SubClass; + } + return ClassType.None; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ColorCode.cs b/SVSim.BattleEngine/Engine/Wizard/ColorCode.cs new file mode 100644 index 0000000..b8d6870 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ColorCode.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public static class ColorCode +{ + public const string MASTER_NAME = "color_code"; + + private const char INFO_DELIMITER = ':'; + + private static Dictionary _colorCodeDic = new Dictionary(); + + public static void BuildData() + { + string[] array = (Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("color_code", ResourcesManager.AssetLoadPathType.MasterEtc, isfetch: true)) as TextAsset).text.Trim().Replace("\r", "").Split('\n'); + for (int i = 0; i < array.Length; i++) + { + string[] array2 = array[i].Split(':'); + if (Enum.TryParse(array2[0], out var result)) + { + ColorUtility.TryParseHtmlString(array2[1], out var color); + _colorCodeDic[result] = color; + } + } + } + + public static Color GetWithString(string id) + { + if (Enum.TryParse(id, out var result)) + { + return Get(result); + } + return Color.red; + } + + public static Color Get(eColorCodeId id) + { + if (_colorCodeDic.TryGetValue(id, out var value)) + { + return value; + } + return Color.red; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CompetitionBattleFinish.cs b/SVSim.BattleEngine/Engine/Wizard/CompetitionBattleFinish.cs new file mode 100644 index 0000000..1dbd798 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CompetitionBattleFinish.cs @@ -0,0 +1,11 @@ +namespace Wizard; + +public class CompetitionBattleFinish : HeaderData +{ + public CompetitionBattleFinishDetail DetailData { get; } + + public CompetitionBattleFinish() + { + DetailData = new CompetitionBattleFinishDetail(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CompetitionBattleFinishDetail.cs b/SVSim.BattleEngine/Engine/Wizard/CompetitionBattleFinishDetail.cs new file mode 100644 index 0000000..1cabeb2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CompetitionBattleFinishDetail.cs @@ -0,0 +1,6 @@ +namespace Wizard; + +public class CompetitionBattleFinishDetail : MatchFinishBase +{ + public bool IsChampion { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CompetitionResultAnimationAgent.cs b/SVSim.BattleEngine/Engine/Wizard/CompetitionResultAnimationAgent.cs new file mode 100644 index 0000000..3ba2a1f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CompetitionResultAnimationAgent.cs @@ -0,0 +1,187 @@ +using System.Collections; +using UnityEngine; + +namespace Wizard; + +public class CompetitionResultAnimationAgent : ResultAnimationAgent +{ + private const float OBJECT_APPEAR_MOVE_SEC = 0.5f; + + private const float RESULT_TITLE_DELAY_SEC = 0f; + + private const float CLASS_CHAR_DELAY_SEC = 0.1f; + + private const float CLASS_INFO_DELAY_SEC = 0.3f; + + private const float GAUGE_WAIT_SEC = 0.5f; + + public override IEnumerator RunUI(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin) + { + m_BattleCamera.m_CutInCamera.gameObject.SetActive(value: false); + if (battleResultControl.IsDraw) + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleDraw.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 48, 16, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + else if (isWin) + { + battleResultControl.TitleWin.gameObject.SetActive(value: true); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleWin.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.alpha = 0f; + battleResultControl.Bg.color = new Color32(32, 24, 0, 0); + battleResultControl.ResultTitle.spriteName = "result_top_win"; + } + else + { + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleLose.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleLose.alpha = 0f; + battleResultControl.Bg.color = new Color32(0, 24, 48, 0); + battleResultControl.ResultTitle.spriteName = "result_top_lose"; + } + battleResultControl.MainPanel.alpha = 1f; + yield return new WaitForSeconds(0.1f); + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + else if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOUWIN); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_WIN); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 1f); + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE); + } + TweenAlpha.Begin(battleResultControl.Bg.gameObject, 0.5f, 0.75f); + yield return new WaitForSeconds(0.2f); + TweenAlpha.Begin(battleResultControl.ArcaneIn.gameObject, 0.5f, 1f); + TweenAlpha.Begin(battleResultControl.ArcaneOut.gameObject, 0.5f, 1f); + iTween.ScaleTo(battleResultControl.ArcaneIn.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(battleResultControl.ArcaneOut.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + if (battleResultControl.IsDraw) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_3, Vector3.zero); + battleResultControl.TitleDraw.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else if (isWin) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_1, Vector3.zero); + battleResultControl.TitleWin.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_2, Vector3.zero); + battleResultControl.TitleLose.transform.localScale = Vector3.one; + iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + HideEmotionMessage(); + if (battleResultControl.ResultMsgWindowFlag) + { + StartCoroutine(battleResultControl.ShowSpecialResultInfo()); + } + yield return new WaitForSeconds(2f); + if (battleResultControl.IsDraw) + { + TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_3, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + if (ShowRewardDialog(battleResultControl)) + { + while (battleResultControl.IsRewardWait) + { + yield return null; + } + } + if (isWin) + { + TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 0f); + iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 3f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_1, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + else + { + TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 0f); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_2, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject); + } + } + yield return new WaitForSeconds(0.2f); + if (isWin) + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_WIN_LOOP); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_LOSE_LOOP); + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_WINDOW_APPER); + iTween.MoveTo(battleResultControl.ClassCharObj.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassCharObj"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ResultTitle.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ResultTitle"], "time", 0.5f, "delay", 0f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(battleResultControl.ClassInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassInfo"], "time", 0.5f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(1f); + if (isWin) + { + PlayWinVoice(); + } + if (battleResultControl.AddClassExp > 0) + { + battleResultControl.SettingAddClassExpTextAnimation(); + yield return new WaitForSeconds(0.5f); + yield return PlayGaugeUpSe(); + yield return new WaitForSeconds(0.5f); + } + if (Data.CompetitionBattleFinish.DetailData.IsChampion) + { + yield return PlayCompetitionChampionAnimationCoroutine(battleResultControl); + } + battleResultControl.SetBattlePassGauge(delegate + { + nextSceneSelector.Show(); + battleResultControl.PrepareAchievementLog(); + battleResultControl.FinishResult(); + battleResultControl.GreySpriteBGVisible = false; + }); + } + + private IEnumerator PlayGaugeUpSe() + { + SoundMgr soundMgr = GameMgr.GetIns().GetSoundMgr(); + int i = 0; + while (i < 10) + { + soundMgr.PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP); + yield return new WaitForSeconds(0.05f); + int num = i + 1; + i = num; + } + } + + private IEnumerator PlayCompetitionChampionAnimationCoroutine(BattleResultUIController controller) + { + controller.TitleMatch.spriteName = "colosseum_battle_title_03"; + StartCoroutine(controller.RunMatch()); + yield return new WaitForSeconds(3f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CompetitionResultAnimationHandler.cs b/SVSim.BattleEngine/Engine/Wizard/CompetitionResultAnimationHandler.cs new file mode 100644 index 0000000..e1ab610 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CompetitionResultAnimationHandler.cs @@ -0,0 +1,24 @@ +using UnityEngine; + +namespace Wizard; + +public class CompetitionResultAnimationHandler : IResultAnimationHandler +{ + private readonly GameObject _resultAnimationAgentObj; + + private readonly CompetitionResultAnimationAgent _resultAnimationAgentIns; + + public ResultAnimationAgent m_resultAnimationAgent => _resultAnimationAgentIns; + + public CompetitionResultAnimationHandler(BattleCamera battleCamera) + { + _resultAnimationAgentObj = new GameObject(); + _resultAnimationAgentIns = _resultAnimationAgentObj.AddComponent(); + _resultAnimationAgentIns.GetComponent().SetBattleCamera(battleCamera); + } + + public void Destroy() + { + Object.Destroy(_resultAnimationAgentObj); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CompetitionResultReporter.cs b/SVSim.BattleEngine/Engine/Wizard/CompetitionResultReporter.cs new file mode 100644 index 0000000..4c2f47c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CompetitionResultReporter.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; +using LitJson; +using Wizard.Lottery; + +namespace Wizard; + +public class CompetitionResultReporter : IBattleResultReporter +{ + public bool IsEnd => Data.CompetitionBattleFinish.DetailData != null; + + public int ClassExp => GetClassExp(); + + public List UserAchievement => GetUserAchievementList(); + + public List UserMission => GetUserMissionList(); + + public List MissionRewards => Data.CompetitionBattleFinish.DetailData._missionRewards; + + public List VictoryRewards => null; + + public LotteryApplyData LotteryData => LotteryApplyData.EmptyData(); + + public bool IsDataExist + { + get + { + if (Data.CompetitionBattleFinish.DetailData != null) + { + return Data.CompetitionBattleFinish.DetailData.IsProcessed; + } + return false; + } + } + + public MyPageHomeDialogData HomeDialogData => null; + + public void Report(bool isWin) + { + } + + public void Destroy() + { + } + + public JsonData GetFinishResponseData() + { + return Data.CompetitionBattleFinish.DetailData._responseData; + } + + public List GetUserAchievementList() + { + return Data.CompetitionBattleFinish.DetailData.achieved_achievement_list; + } + + public List GetUserMissionList() + { + return Data.CompetitionBattleFinish.DetailData.achieved_mission_list; + } + + public int GetClassExp() + { + return Data.CompetitionBattleFinish.DetailData.get_class_chara_experience; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CompleteDeckDecideDialog.cs b/SVSim.BattleEngine/Engine/Wizard/CompleteDeckDecideDialog.cs new file mode 100644 index 0000000..2bf99cc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CompleteDeckDecideDialog.cs @@ -0,0 +1,89 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class CompleteDeckDecideDialog +{ + private const string DECK_DECISION_PATH = "UI/DeckList/DeckDecision"; + + private const int DECK_SELECT_DIALOG_PANEL_DEPTH = 15; + + public DialogBase Dialog { get; private set; } + + public DeckDecisionUI DecisionUI { get; private set; } + + public static CompleteDeckDecideDialog CreateForSingleDeck(DialogBase dialogDeckList, DeckData deck, bool showSimpleStageOption, Action onDecide, ConventionDeckList conventionDeckList = null) + { + CompleteDeckDecideDialog completeDeckDecideDialog = new CompleteDeckDecideDialog(showSimpleStageOption); + completeDeckDecideDialog.InitializeForSingleDeck(dialogDeckList, deck, onDecide, conventionDeckList); + return completeDeckDecideDialog; + } + + public static CompleteDeckDecideDialog CreateForMultiDeck(DialogBase dialogDeckList, string textBody, bool showSimpleStageOption, Action onDecide, Action onCancel) + { + CompleteDeckDecideDialog completeDeckDecideDialog = new CompleteDeckDecideDialog(showSimpleStageOption); + completeDeckDecideDialog.InitializeForMultiDeck(dialogDeckList, textBody, onDecide, onCancel); + return completeDeckDecideDialog; + } + + private CompleteDeckDecideDialog(bool showSimpleStageOption) + { + CreateDialogBase(showSimpleStageOption); + } + + private void CreateDialogBase(bool showSimpleStageOption) + { + Dialog = UIManager.GetInstance().CreateDialogClose(); + Dialog.SetTitleLabel(Data.SystemText.Get("Dia_DeckSelect_001_Title")); + Dialog.SetPanelDepth(15); + DecisionUI = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject("UI/DeckList/DeckDecision", isServerResources: false)); + DecisionUI.IsShowSimpleStageOption = showSimpleStageOption; + Dialog.SetObj(DecisionUI.gameObject); + } + + private void InitializeForSingleDeck(DialogBase dialogDeckList, DeckData deck, Action onDecide, ConventionDeckList conventionDeckList = null) + { + Dialog.SetButtonText(Data.SystemText.Get("Common_0004"), Data.SystemText.Get("Card_0083")); + Dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_GrayBtn); + Dialog.ClickSe_Btn1 = Se.TYPE.NONE; + DecisionUI.SetDeckData(deck, conventionDeckList); + DecisionUI.DeckName = deck.GetDeckName(); + Dialog.onPushButton2 = DecisionUI.OnClickCreateCardList; + Dialog.ClickSe_Btn2 = Se.TYPE.SYS_BTN_DECIDE; + Dialog.isNotCloseWindowButton2 = true; + Dialog.onPushButton1 = delegate + { + Dialog.button1.isEnabled = false; + if (dialogDeckList != null) + { + dialogDeckList.CloseWithoutSelect(); + } + onDecide.Call(); + }; + } + + private void InitializeForMultiDeck(DialogBase dialogDeckList, string textBody, Action onDecide, Action onCancel) + { + Dialog.SetButtonText(Data.SystemText.Get("Common_0004")); + Dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + Dialog.ClickSe_Btn1 = Se.TYPE.NONE; + DecisionUI.SetText(textBody, string.Empty); + Dialog.onPushButton1 = delegate + { + Dialog.button1.isEnabled = false; + dialogDeckList.CloseWithoutSelect(); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + onDecide(); + }; + Dialog.onPushButton2 = delegate + { + onCancel(); + }; + Dialog.onCloseWithoutSelect = delegate + { + onCancel(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ConventionInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard/ConventionInfoTask.cs new file mode 100644 index 0000000..f61c162 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ConventionInfoTask.cs @@ -0,0 +1,23 @@ +namespace Wizard; + +public class ConventionInfoTask : BaseTask +{ + public ConventionList OfflineConventionList { get; private set; } + + public ConventionInfoTask() + { + base.type = ApiType.Type.ConventionInfo; + OfflineConventionList = new ConventionList(); + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + OfflineConventionList.Parse(base.ResponseData["data"]["tournament_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ConvertTime.cs b/SVSim.BattleEngine/Engine/Wizard/ConvertTime.cs new file mode 100644 index 0000000..972edfc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ConvertTime.cs @@ -0,0 +1,141 @@ +using System; +using System.Globalization; + +namespace Wizard; + +public class ConvertTime +{ + public enum FORMAT + { + TIME_DATE_LONG, + TIME_DATE_SHORT, + DATE_LONG, + DATE_SHORT, + TIME, + YEAR_MONTH, + TIME_DATE_LONG_SPECIAL + } + + private static string[] FORMAT_TEXT_ID = new string[7] { "System_TimeDateLong", "System_TimeDateShort", "System_DateLong", "System_DateShort", "System_Time", "System_YearMonth", "System_0068" }; + + public const string CULTURE_INFO_ID = "System_CultureInfo"; + + private static string ToLocal(DateTime dateTime, string outputFormat) + { + TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); + DateTime dateTime2 = dateTime + utcOffset; + CultureInfo cultureInfo = new CultureInfo(Data.SystemText.Get("System_CultureInfo"), useUserOverride: false); + return dateTime2.ToString(outputFormat, cultureInfo); + } + + public static DateTime LocalToUtc(DateTime localTime) + { + return TimeZoneInfo.ConvertTimeToUtc(localTime); + } + + public static DateTime ToLocalByDateTime(DateTime dateTime) + { + TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); + return dateTime + utcOffset; + } + + public static string ToLocal(DateTime dateTime, FORMAT outputFormat = FORMAT.TIME_DATE_LONG) + { + return ToLocal(dateTime, Data.SystemText.Get(FORMAT_TEXT_ID[(int)outputFormat])).Replace("12:00 AM", "12 midnight").Replace("12:00 PM", "12 noon").Replace("AM", "a.m.") + .Replace("PM", "p.m."); + } + + public static string ToLocal(string dateTime, FORMAT outputFormat = FORMAT.TIME_DATE_LONG) + { + string[] formats = new string[2] { "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd" }; + return ToLocal(DateTime.ParseExact(dateTime, formats, CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault), outputFormat); + } + + public static string ToLocal(DateTime beginDateTime, DateTime endDateTime, FORMAT outputFormat = FORMAT.TIME_DATE_LONG) + { + string text = ToLocal(beginDateTime, outputFormat); + string text2 = ToLocal(endDateTime, outputFormat); + return Data.SystemText.Get("System_Between", text, text2); + } + + public static string GetLocalPeriod(DateTime beginDateTime, string endDateTime, FORMAT outputFormat = FORMAT.TIME_DATE_LONG) + { + string text = ToLocal(beginDateTime, outputFormat); + string text2 = endDateTime; + if (DateTime.TryParse(endDateTime, out var result)) + { + text2 = ToLocal(result, outputFormat); + return Data.SystemText.Get("System_Between", text, text2); + } + return Data.SystemText.Get("System_0064", text, text2); + } + + public static DateTime UnixTimeToDateTime(int unixTime) + { + return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(unixTime); + } + + public static double DateTimeToUnixTime(DateTime dateTime) + { + DateTime value = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + return dateTime.Subtract(value).TotalSeconds; + } + + public static string DateTimeToAgoText(DateTime pastLocalTime) + { + TimeSpan timeSpan = PlayerStaticData.UserTime.GetNowTime() - pastLocalTime; + SystemText systemText = Data.SystemText; + if (timeSpan >= TimeSpan.FromDays(1.0)) + { + return systemText.Get("OtherFriend_0010", timeSpan.Days.ToString()); + } + if (timeSpan >= TimeSpan.FromHours(1.0)) + { + return systemText.Get("OtherFriend_0009", timeSpan.Hours.ToString()); + } + if (timeSpan > TimeSpan.Zero) + { + return systemText.Get("OtherFriend_0008", timeSpan.Minutes.ToString()); + } + return systemText.Get("OtherFriend_0008", TimeSpan.Zero.Minutes.ToString()); + } + + public static DateTime? GetDateTime(string endDateTime) + { + if (DateTime.TryParse(endDateTime, out var result)) + { + return result; + } + return null; + } + + public static TimeSpan GetTimeSpan(long startUnixTime, DateTime endDate) + { + long num = (long)DateTimeToUnixTime(endDate); + if (num < startUnixTime) + { + num = startUnixTime; + } + return TimeSpan.FromSeconds(num - startUnixTime); + } + + public static string GetRemainingTime(TimeSpan timeSpan) + { + string empty = string.Empty; + if (timeSpan.Days >= 1) + { + return Data.SystemText.Get("Mission_0061", timeSpan.Days.ToString()); + } + if (timeSpan.Hours >= 1) + { + return Data.SystemText.Get("Mission_0060", timeSpan.Hours.ToString()); + } + if (timeSpan.Minutes >= 59) + { + return Data.SystemText.Get("Mission_0060", "1"); + } + int minutes = timeSpan.Minutes; + minutes++; + return Data.SystemText.Get("Mission_0062", minutes.ToString()); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CrossOverClassInfomationOrder.cs b/SVSim.BattleEngine/Engine/Wizard/CrossOverClassInfomationOrder.cs new file mode 100644 index 0000000..416e1db --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CrossOverClassInfomationOrder.cs @@ -0,0 +1,14 @@ +namespace Wizard; + +public class CrossOverClassInfomationOrder : Master.ReadFromCsv +{ + public string KeyClassIds; + + public string ValueClassIds; + + public void ReadCsvColumns(string[] columns) + { + KeyClassIds = columns[0]; + ValueClassIds = columns[1]; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Crossover.cs b/SVSim.BattleEngine/Engine/Wizard/Crossover.cs new file mode 100644 index 0000000..7ea112a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Crossover.cs @@ -0,0 +1,164 @@ +using System; +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class Crossover +{ + public class PeriodData + { + public DateTime BeginTime = DateTime.MaxValue; + + public DateTime EndTime = DateTime.MinValue; + } + + public const int MAIN_CLASS_CARD_MIN_NUM = 24; + + public const int SUB_CLASS_CARD_MIN_NUM = 9; + + public const int AUTO_CREATE_NEUTRAL_MAX = 7; + + public PeriodData RankMatchPeriod = new PeriodData(); + + public PeriodData FreeMatchPeriod = new PeriodData(); + + public PeriodData GatheringPeriod = new PeriodData(); + + public PeriodData PracticePeriod = new PeriodData(); + + public List CardSetIdList = new List(); + + public List ReprintedBaseCardIds = new List(); + + public CrossoverRestrictedCard RestrictedCard = new CrossoverRestrictedCard(); + + private int _startRankId; + + private int _maxRankId; + + private Dictionary UserRankData = new Dictionary(); + + private List _userRankList = new List(); + + public static int AUTO_CREATE_MAIN_AND_NEUTRAL_MAX => 31; + + public static int AUTO_CREATE_SUB_AND_NEUTRAL_MAX => 16; + + public bool IsWithinAnyPeriod + { + get + { + if (!IsWithinGatheringPeriod && !IsWithinFreeMatchPeriod && !IsWithinRankMatchPeriod) + { + return IsWithinPracticePeriod; + } + return true; + } + } + + public bool IsWithinGatheringPeriod => IsWithinPeriod(GatheringPeriod); + + public bool IsWithinFreeMatchPeriod => IsWithinPeriod(FreeMatchPeriod); + + public bool IsWithinRankMatchPeriod => IsWithinPeriod(RankMatchPeriod); + + public bool IsWithinPracticePeriod => IsWithinPeriod(PracticePeriod); + + private bool IsWithinPeriod(PeriodData period) + { + DateTime nowTime_UTC = PlayerStaticData.UserTime.GetNowTime_UTC(); + if (nowTime_UTC >= period.BeginTime) + { + return nowTime_UTC <= period.EndTime; + } + return false; + } + + public void Parse(JsonData data) + { + JsonData data2 = data["schedules"]; + if (data2.TryGetValue("rank_battle", out var value)) + { + SetPeriodData(RankMatchPeriod, value); + } + if (data2.TryGetValue("free_battle", out var value2)) + { + SetPeriodData(FreeMatchPeriod, value2); + } + if (data2.TryGetValue("gathering", out var value3)) + { + SetPeriodData(GatheringPeriod, value3); + } + if (data2.TryGetValue("practice", out var value4)) + { + SetPeriodData(PracticePeriod, value4); + } + if (data.TryGetValue("card_set_id_list", out var value5)) + { + for (int i = 0; i < value5.Count; i++) + { + CardSetIdList.Add(value5[i].ToInt()); + } + } + if (data.TryGetValue("reprinted_base_card_ids", out var value6)) + { + for (int j = 0; j < value6.Count; j++) + { + ReprintedBaseCardIds.Add(value6[j].ToInt()); + } + } + if (data.TryGetValue("restricted_base_card_id_list", out var value7)) + { + RestrictedCard.Parse(value7); + } + ParseRankData(data); + } + + public void ParseRankData(JsonData data) + { + JsonData jsonData = data["rank_info"]; + _startRankId = int.MaxValue; + _maxRankId = int.MinValue; + for (int i = 0; i < jsonData.Count; i++) + { + RankInfo rankInfo = new RankInfo(jsonData[i]); + _userRankList.Add(rankInfo); + UserRankData[rankInfo.RankId] = rankInfo; + if (rankInfo.RankId < _startRankId) + { + _startRankId = rankInfo.RankId; + } + if (rankInfo.RankId > _maxRankId) + { + _maxRankId = rankInfo.RankId; + } + } + } + + public RankInfo GetRankInfo(int rankId) + { + return UserRankData[rankId]; + } + + public bool IsStartRank(int rankId) + { + return rankId == _startRankId; + } + + public bool IsMaxRank(int rankId) + { + return rankId == _maxRankId; + } + + public List GetRankInfoRawList() + { + return _userRankList; + } + + private void SetPeriodData(PeriodData period, JsonData jsonData) + { + period.BeginTime = DateTime.Parse(jsonData["begin_time"].ToString()); + period.EndTime = DateTime.Parse(jsonData["end_time"].ToString()); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CrossoverPortalParam.cs b/SVSim.BattleEngine/Engine/Wizard/CrossoverPortalParam.cs new file mode 100644 index 0000000..70945df --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CrossoverPortalParam.cs @@ -0,0 +1,18 @@ +namespace Wizard; + +public class CrossoverPortalParam +{ + private const int IS_SKIP_FIRST_TIPS_STATUS = 1; + + public bool IsSkipFirstTips { get; set; } + + public static CrossoverPortalParam CreateParam(int? status) + { + CrossoverPortalParam crossoverPortalParam = new CrossoverPortalParam(); + if (status.HasValue && status.Value == 1) + { + crossoverPortalParam.IsSkipFirstTips = true; + } + return crossoverPortalParam; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CrossoverRestrictedCard.cs b/SVSim.BattleEngine/Engine/Wizard/CrossoverRestrictedCard.cs new file mode 100644 index 0000000..5435f51 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CrossoverRestrictedCard.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class CrossoverRestrictedCard +{ + public class Data + { + public readonly int BaseCardId; + + public readonly int Count; + + public Data(int baseCardId, int count) + { + BaseCardId = baseCardId; + Count = count; + } + } + + private readonly List _mainClassDataList = new List(); + + private readonly List _subClassDataList = new List(); + + public void Parse(JsonData jsonData) + { + if (jsonData.TryGetValue("main_class", out var value) && value.IsObject) + { + foreach (string key in value.Keys) + { + if (int.TryParse(key, out var result)) + { + _mainClassDataList.Add(new Data(result, value[key].ToInt())); + } + } + } + if (!jsonData.TryGetValue("sub_class", out var value2) || !value2.IsObject) + { + return; + } + foreach (string key2 in value2.Keys) + { + if (int.TryParse(key2, out var result2)) + { + _subClassDataList.Add(new Data(result2, value2[key2].ToInt())); + } + } + } + + public int GetRestrictedCountOrDefault(int baseCardId, ClassType classType, int defaultCount) + { + List list = ((classType == ClassType.MainClass) ? _mainClassDataList : _subClassDataList); + int num = list.FindIndex((Data data) => data.BaseCardId == baseCardId); + if (num >= 0) + { + return list[num].Count; + } + return defaultCount; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CrossoverRewardInfo.cs b/SVSim.BattleEngine/Engine/Wizard/CrossoverRewardInfo.cs new file mode 100644 index 0000000..b51db85 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CrossoverRewardInfo.cs @@ -0,0 +1,35 @@ +using LitJson; + +namespace Wizard; + +public class CrossoverRewardInfo +{ + public enum RewardStatus + { + NotAchieved, + NotReceived, + Received + } + + public int RewardId; + + public int Rank; + + public int RewardType; + + public int RewardDetailId; + + public int RewardCount; + + public RewardStatus Status; + + public CrossoverRewardInfo(JsonData data) + { + RewardId = data["reward_id"].ToInt(); + Rank = data["rank"].ToInt(); + RewardType = data["reward_type"].ToInt(); + RewardDetailId = data["reward_detail_id"].ToInt(); + RewardCount = data["reward_count"].ToInt(); + Status = (RewardStatus)data["status"].ToInt(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CsvColumns.cs b/SVSim.BattleEngine/Engine/Wizard/CsvColumns.cs new file mode 100644 index 0000000..38dd4f2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CsvColumns.cs @@ -0,0 +1,25 @@ +namespace Wizard; + +public class CsvColumns +{ + private int _index = -1; + + private string[] _columnArray; + + private string _fileName; + + public string NextValue + { + get + { + _index++; + return _columnArray[_index]; + } + } + + public CsvColumns(string[] columns, string fileName) + { + _columnArray = columns; + _fileName = fileName; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Data.cs b/SVSim.BattleEngine/Engine/Wizard/Data.cs new file mode 100644 index 0000000..93fcfd0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Data.cs @@ -0,0 +1,448 @@ +using System.Collections.Generic; +using DeckBuilder; +using LitJson; +using UnityEngine; +using Wizard.Scripts.Network.Data.TableData.Ranking; +using Wizard.Scripts.Network.Data.TaskData; +using Wizard.Scripts.Network.Data.TaskData.Arena; +using Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick; +using Wizard.Scripts.Network.Data.TaskData.Battle; +using Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase; +using Wizard.Scripts.Network.Data.TaskData.ItemPurchase; +using Wizard.Scripts.Network.Data.TaskData.Ranking; +using Wizard.Scripts.Network.Data.TaskData.SkinPurchase; +using Wizard.Scripts.Network.Data.TaskData.SleevePurchase; +using Wizard.Story; + +namespace Wizard; + +public static class Data +{ + private static Format _currentFormat; + + public const int SERVER_FORMAT_NONE = 0; + + public const int SERVER_FORMAT_ROTATION = 1; + + public const int SERVER_FORMAT_UNLIMITED = 2; + + public const int SERVER_FORMAT_PRE_ROTATION = 3; + + public const int SERVER_FORMAT_CROSSOVER = 4; + + public const int SERVER_FORMAT_TWO_PICK = 10; + + public const int SERVER_FORMAT_SEALED = 20; + + public const int SERVER_FORMAT_HOF = 31; + + public const int SERVER_FORMAT_WIND_FALL = 33; + + public static Master Master { get; set; } + + public static Mastershop ShopMaster { get; set; } + + public static SystemText SystemText { get; set; } + + public static EncryptData EncryptData { get; set; } + + public static Load Load { get; set; } + + public static MyPage MyPage { get; set; } + + public static MyPageNotifications MyPageNotifications { get; set; } + + public static RankMatchFinish RankMatchFinish { get; set; } + + public static FreeMatchFinish FreeMatchFinish { get; set; } + + public static ColosseumBattleFinish ColosseumBattleFinish { get; set; } + + public static CompetitionBattleFinish CompetitionBattleFinish { get; set; } + + public static RedEtherCampaignResultData RedEtherCampaignResultData { get; set; } + + public static DoMatchingData DoMatchingDetail { get; set; } + + public static AIBattleStartData AIBattleStartData { get; set; } + + public static RoomMatchFinish RoomMatchFinish { get; set; } + + public static string LastRoomBattleId { get; set; } + + public static RoomBattleMatching RoomBattleMatching { get; set; } + + public static SelectedStoryInfo SelectedStoryInfo { get; set; } + + public static StoryWorldDataManager StoryWorldDataManager { get; set; } + + public static StoryInfo StoryInfo { get; set; } + + public static StoryFinish StoryFinish { get; set; } + + public static StoryLeaderSelect StoryLeaderSelect { get; set; } + + public static QuestMissionInfo QuestMissionInfo { get; set; } + + public static QuestFinish QuestFinish { get; set; } + + public static ArenaData ArenaData { get; set; } + + public static MailTop MailTop { get; set; } + + public static ReadMail ReadMail { get; set; } + + public static PackInfo PackInfo { get; set; } + + public static PackOpen PackOpen { get; set; } + + public static SleevePurchaseInfo SleevePurchaseInfo { get; set; } + + public static SkinPurchaseInfo SkinPurchaseInfo { get; set; } + + public static BuildDeckPurchaseInfo BuildDeckPurchaseInfo { get; set; } + + public static ItemPurchaseInfo ItemPurchaseInfo { get; set; } + + public static EmptyDeckInfo EmptyDeckInfo { get; set; } + + public static MissionInfo MissionInfo { get; set; } + + public static AchievementInfo AchievementInfo { get; set; } + + public static User User { get; set; } + + public static UserConfig UserConfig { get; set; } + + public static UserTutorial UserTutorial { get; set; } + + public static FriendInfo FriendInfo { get; set; } + + public static PlayedTogetherInfo PlayedTogetherInfo { get; set; } + + public static ReceiveFriendApplyInfo ReceiveFriendApplyInfo { get; set; } + + public static SendFriendApplyInfo SendFriendApplyInfo { get; set; } + + public static EmblemInfo EmblemInfo { get; set; } + + public static DegreeInfo DegreeInfo { get; set; } + + public static SearchUserInfo SearchUserInfo { get; set; } + + public static RankingPeriodList RankingPeriodList { get; set; } + + public static Dictionary RankingRankMatchClassInfo { get; set; } + + public static Dictionary RankingMasterInfo { get; set; } + + public static MonthlyRanking RankingTwoPickInfo { get; set; } + + public static MonthlyRanking RankingSealedInfo { get; set; } + + public static Dictionary RankingMasterMyHistories { get; set; } + + public static TwoPickInfo TwoPickInfo { get; set; } + + public static Entry TwoPickEntry { get; set; } + + public static RoomTwoPickInfo RoomTwoPickInfo { get; set; } + + public static RoomTwoPickBeforeBattleInfo RoomTwoPickBeforeBattleInfo { get; set; } + + public static RoomTwoPickMultiDeckInfo RoomTwoPickMultiDeckInfo { get; set; } + + public static DoMatchingResponse TwoPickDoMatching { get; set; } + + public static Finish ArenaBattleFinish { get; set; } + + public static ItemAcquireHistoryInfo ItemAcquireHistoryInfo { get; set; } + + public static PracticeDataMgr PracticeDataMgr { get; set; } + + public static PracticeFinish PracticeFinish { get; set; } + + public static PracticePuzzleFinishData PracticePuzzleFinishData { get; set; } + + public static GenerateDeckCode GenerateDeckCode { get; set; } + + public static GetDeckDataFromCode DeckDataFromDeckCode { get; set; } + + public static InviteFriendBattle InviteFriendBattle { get; set; } + + public static InitializeRoomBattle InitializeRoomBattle { get; set; } + + public static ReplayInfo ReplayInfo { get; set; } + + public static ReplayDetailInfo ReplayBattleInfo { get; set; } + + public static BattleRecoveryInfo BattleRecoveryInfo { get; set; } + + public static VoteData VoteInfo { get; set; } + + public static List DeckGroupDataBase { get; set; } = new List(); + + public static List MaintenanceCodeList { get; private set; } = null; + + public static Crossover Crossover { get; private set; } = null; + + public static MyRotationAllInfo MyRotationAllInfo { get; set; } = null; + + public static AvatarBattleAllInfo AvatarBattleAllInfo { get; set; } = null; + + public static TreasureBoxCp TreasureBoxCp { get; set; } = null; + + public static Format CurrentFormat + { + get + { + return _currentFormat; + } + set + { + if (value == Format.Hof) + { + _currentFormat = Format.Max; + } + else + { + _currentFormat = value; + } + } + } + + public static bool IsBattlePassPeriod { get; private set; } + + public static void Initialize() + { + Master = new Master(); + ShopMaster = new Mastershop(); + SystemText = new SystemText(); + Load = new Load(); + MyPage = new MyPage(); + MyPageNotifications = new MyPageNotifications(); + RankMatchFinish = new RankMatchFinish(); + FreeMatchFinish = new FreeMatchFinish(); + DoMatchingDetail = new DoMatchingData(); + AIBattleStartData = new AIBattleStartData(); + ColosseumBattleFinish = new ColosseumBattleFinish(); + CompetitionBattleFinish = new CompetitionBattleFinish(); + RoomMatchFinish = new RoomMatchFinish(); + RoomBattleMatching = new RoomBattleMatching(); + SelectedStoryInfo = null; + StoryWorldDataManager = new StoryWorldDataManager(); + StoryInfo = new StoryInfo(); + StoryFinish = new StoryFinish(); + StoryLeaderSelect = new StoryLeaderSelect(); + QuestMissionInfo = new QuestMissionInfo(); + QuestFinish = new QuestFinish(); + ArenaData = new ArenaData(); + MailTop = new MailTop(); + ReadMail = new ReadMail(); + PackInfo = new PackInfo(); + PackOpen = new PackOpen(); + SleevePurchaseInfo = new SleevePurchaseInfo(); + SkinPurchaseInfo = new SkinPurchaseInfo(); + BuildDeckPurchaseInfo = new BuildDeckPurchaseInfo(); + ItemPurchaseInfo = new ItemPurchaseInfo(); + EmptyDeckInfo = new EmptyDeckInfo(); + FriendInfo = new FriendInfo(); + PlayedTogetherInfo = new PlayedTogetherInfo(); + ReceiveFriendApplyInfo = new ReceiveFriendApplyInfo(); + SendFriendApplyInfo = new SendFriendApplyInfo(); + User = new User(); + UserConfig = new UserConfig(); + UserTutorial = new UserTutorial(); + MissionInfo = new MissionInfo(); + AchievementInfo = new AchievementInfo(); + EmblemInfo = new EmblemInfo(); + DegreeInfo = new DegreeInfo(); + SearchUserInfo = new SearchUserInfo(); + RankingRankMatchClassInfo = new Dictionary(); + RankingMasterInfo = new Dictionary(); + RankingMasterMyHistories = new Dictionary(); + TwoPickInfo = new TwoPickInfo(); + TwoPickEntry = new Entry(); + TwoPickDoMatching = new DoMatchingResponse(); + ArenaBattleFinish = new Finish(); + RoomTwoPickInfo = new RoomTwoPickInfo(); + RoomTwoPickBeforeBattleInfo = new RoomTwoPickBeforeBattleInfo(); + RoomTwoPickMultiDeckInfo = new RoomTwoPickMultiDeckInfo(); + PracticeDataMgr = new PracticeDataMgr(null); + PracticeFinish = new PracticeFinish(); + PracticePuzzleFinishData = new PracticePuzzleFinishData(); + ItemAcquireHistoryInfo = new ItemAcquireHistoryInfo(); + GenerateDeckCode = new GenerateDeckCode(); + DeckDataFromDeckCode = new GetDeckDataFromCode(); + InviteFriendBattle = new InviteFriendBattle(); + InitializeRoomBattle = new InitializeRoomBattle(); + ReplayInfo = new ReplayInfo(); + CurrentFormat = Format.Max; + MaintenanceCodeList = null; + DeckGroupDataBase = new List(); + Crossover = new Crossover(); + MyRotationAllInfo = new MyRotationAllInfo(); + TreasureBoxCp = new TreasureBoxCp(); + } + + public static void Clear() + { + Master = null; + ShopMaster = null; + SystemText = null; + Load = null; + MyPage = null; + MyPageNotifications = null; + RankMatchFinish = null; + FreeMatchFinish = null; + AIBattleStartData = null; + DoMatchingDetail = null; + SelectedStoryInfo = null; + StoryWorldDataManager = null; + StoryInfo = null; + StoryFinish = null; + QuestMissionInfo = null; + QuestFinish = null; + ArenaData = null; + MailTop = null; + ReadMail = null; + PackInfo = null; + PackOpen = null; + SleevePurchaseInfo = null; + SkinPurchaseInfo = null; + BuildDeckPurchaseInfo = null; + ItemPurchaseInfo = null; + EmptyDeckInfo = null; + FriendInfo = null; + PlayedTogetherInfo = null; + ReceiveFriendApplyInfo = null; + SendFriendApplyInfo = null; + User = null; + UserConfig = null; + UserTutorial = null; + MissionInfo = null; + AchievementInfo = null; + EmblemInfo = null; + DegreeInfo = null; + SearchUserInfo = null; + RankingPeriodList = null; + RankingRankMatchClassInfo = null; + RankingMasterInfo = null; + RankingTwoPickInfo = null; + RankingSealedInfo = null; + RankingMasterMyHistories = null; + TwoPickInfo = null; + TwoPickEntry = null; + TwoPickDoMatching = null; + ArenaBattleFinish = null; + RoomTwoPickInfo = null; + RoomTwoPickBeforeBattleInfo = null; + RoomTwoPickMultiDeckInfo = null; + ItemAcquireHistoryInfo = null; + PracticeDataMgr = null; + PracticeFinish = null; + PracticePuzzleFinishData = null; + InitializeRoomBattle = null; + ReplayInfo = null; + CurrentFormat = Format.Max; + BattleRecoveryInfo = null; + MaintenanceCodeList = null; + DeckGroupDataBase = new List(); + Crossover = null; + MyRotationAllInfo = null; + TreasureBoxCp = null; + CardMaster.DeleteAllInstance(); + PlayerStaticData.Clear(); + Prerelease.Clear(); + DeckGroupDataBase.Clear(); + } + + public static int FormatConvertApi(Format format) + { + switch (format) + { + case Format.Rotation: + case Format.Max: + return 1; + case Format.Unlimited: + return 2; + case Format.PreRotation: + return 3; + case Format.Crossover: + return 4; + case Format.Sealed: + return 20; + case Format.TwoPick: + return 10; + case Format.Hof: + return 31; + case Format.All: + return 0; + case Format.Windfall: + return 33; + case Format.MyRotation: + case Format.Avatar: + return (int)format; + default: + UnityEngine.Debug.LogWarning("ไธๆ˜Žใชใƒ•ใ‚ฉใƒผใƒžใƒƒใƒˆใŒๆŒ‡ๅฎšใ•ใ‚Œใฆใ„ใพใ™๏ผš" + format); + return 1; + } + } + + public static Format ParseApiFormat(int format) + { + switch (format) + { + case 1: + return Format.Rotation; + case 2: + return Format.Unlimited; + case 3: + return Format.PreRotation; + case 4: + return Format.Crossover; + case 10: + return Format.TwoPick; + case 20: + return Format.Sealed; + case 31: + return Format.Hof; + case 33: + return Format.Windfall; + case 5: + case 39: + return (Format)format; + case 0: + return Format.Max; + default: + UnityEngine.Debug.LogWarning("ไธๆ˜Žใชใƒ•ใ‚ฉใƒผใƒžใƒƒใƒˆใŒๆŒ‡ๅฎšใ•ใ‚Œใฆใ„ใพใ™๏ผš" + format); + return Format.Max; + } + } + + public static void ParseMaintenance(JsonData mentenanceList) + { + MaintenanceCodeList = new List(); + for (int i = 0; i < mentenanceList.Count; i++) + { + MaintenanceCodeList.Add((NetworkDefine.MAINTENANCE_TYPE)mentenanceList[i].ToInt()); + } + } + + public static void UpdateMaintenance(List checkList, List maintenanceList) + { + for (int i = 0; i < checkList.Count; i++) + { + MaintenanceCodeList.Remove(checkList[i]); + if (maintenanceList.Contains(checkList[i])) + { + MaintenanceCodeList.Add(checkList[i]); + } + } + } + + public static void ParseIsBattlePassPeriod(JsonData data) + { + IsBattlePassPeriod = data["is_battle_pass_period"].ToBoolean(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckAutoCreateTask.cs b/SVSim.BattleEngine/Engine/Wizard/DeckAutoCreateTask.cs new file mode 100644 index 0000000..559d15a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckAutoCreateTask.cs @@ -0,0 +1,77 @@ +using LitJson; + +namespace Wizard; + +public class DeckAutoCreateTask : BaseTask +{ + public class DeckAutoCreateTaskParam : BaseParam + { + public int deck_format; + + public int class_id; + + public int[] chosen_card_ids; + + public int tournament_id; + + public string rotation_id; + } + + public class DeckAutoCreateUseSubClassTaskParam : BaseParam + { + public int deck_format; + + public int class_id; + + public int sub_class_id; + + public int[] chosen_card_ids; + + public int tournament_id; + } + + public int[] _autoDeckCreateCardList; + + public DeckAutoCreateTask() + { + base.type = ApiType.Type.DeckAutoCreate; + } + + public void SetParameter(Format format, int classId, int tournamentId, int[] deckCards, MyRotationInfo myRotationInfo) + { + DeckAutoCreateTaskParam deckAutoCreateTaskParam = new DeckAutoCreateTaskParam(); + deckAutoCreateTaskParam.deck_format = Data.FormatConvertApi(format); + deckAutoCreateTaskParam.class_id = classId; + deckAutoCreateTaskParam.chosen_card_ids = deckCards; + deckAutoCreateTaskParam.tournament_id = tournamentId; + deckAutoCreateTaskParam.rotation_id = ((myRotationInfo != null) ? myRotationInfo.Id : ""); + base.Params = deckAutoCreateTaskParam; + } + + public void SetParameter(Format format, int classId, int subClassId, int tournamentId, int[] deckCards) + { + DeckAutoCreateUseSubClassTaskParam deckAutoCreateUseSubClassTaskParam = new DeckAutoCreateUseSubClassTaskParam(); + deckAutoCreateUseSubClassTaskParam.deck_format = Data.FormatConvertApi(format); + deckAutoCreateUseSubClassTaskParam.class_id = classId; + deckAutoCreateUseSubClassTaskParam.sub_class_id = subClassId; + deckAutoCreateUseSubClassTaskParam.chosen_card_ids = deckCards; + deckAutoCreateUseSubClassTaskParam.tournament_id = tournamentId; + base.Params = deckAutoCreateUseSubClassTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + _autoDeckCreateCardList = new int[jsonData.Count]; + for (int i = 0; i < jsonData.Count; i++) + { + _autoDeckCreateCardList[i] = jsonData[i].ToInt(); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckBuildShortageCardView.cs b/SVSim.BattleEngine/Engine/Wizard/DeckBuildShortageCardView.cs new file mode 100644 index 0000000..346f7be --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckBuildShortageCardView.cs @@ -0,0 +1,212 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class DeckBuildShortageCardView : MonoBehaviour +{ + [SerializeField] + private CardSelectListConfirmPagerView _cardListView; + + [SerializeField] + private GameObject _parentCraftUI; + + [SerializeField] + private GameObject _parentNotCraftUI; + + [SerializeField] + private UILabel _labelExplain_1; + + [SerializeField] + private UILabel _labelExplain_2; + + [SerializeField] + private GameObject _iconExplainRedether; + + [SerializeField] + private UILabel _labelHaveRedetherNum; + + [SerializeField] + private UILabel _labelBeforeRedetherNum; + + [SerializeField] + private UILabel _labelAfterRedetherNum; + + private Dictionary _dictCreateCardIdNum = new Dictionary(); + + private Action _onCraftCardAllCallback; + + protected DialogBase _dialog; + + private CardDetailUI _cardDetailUI; + + private CardMaster.CardMasterId _cardMasterId; + + public void Init(List cardIdList, CardDetailUI cardDetailUI, DialogBase dialog, Action callback, Action onCraftCardALL, CardMaster.CardMasterId cardMasterId, Action onClose) + { + _cardMasterId = cardMasterId; + _cardDetailUI = cardDetailUI; + _dialog = dialog; + _onCraftCardAllCallback = onCraftCardALL; + Dictionary dictionary = new Dictionary(); + for (int i = 0; i < cardIdList.Count; i++) + { + int key = cardIdList[i]; + if (dictionary.ContainsKey(key)) + { + dictionary[key]++; + } + else + { + dictionary.Add(key, 1); + } + } + foreach (KeyValuePair item in dictionary) + { + bool flag = GameMgr.GetIns().GetDataMgr().IsMaintenanceCard(item.Key); + if (!CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(item.Key).IsNotCraftDestruct && !flag) + { + _dictCreateCardIdNum.Add(item.Key, item.Value); + } + } + _cardListView.Init(dictionary, cardDetailUI, delegate + { + UpdateExplainText(); + callback.Call(); + }, _cardMasterId); + _dialog.OnClose = delegate + { + _cardListView.OnCloseView(); + onClose.Call(); + }; + } + + public void RemoveCardNum(int cardId, int num) + { + if (_dictCreateCardIdNum.ContainsKey(cardId)) + { + int num2 = _dictCreateCardIdNum[cardId]; + if (num2 >= num) + { + _dictCreateCardIdNum[cardId] = num2 - num; + } + } + _cardListView.DecrementCardNum(cardId, num); + if (IsExistCreateCardId()) + { + return; + } + if (_cardDetailUI.GetIsDetailOn()) + { + _cardDetailUI.OnClose = delegate + { + _dialog.Close(); + _cardDetailUI.OnClose = null; + }; + } + else + { + _dialog.Close(); + } + } + + public void AddCardNum(int cardId, int num) + { + if (_dictCreateCardIdNum.ContainsKey(cardId)) + { + int num2 = _dictCreateCardIdNum[cardId]; + _dictCreateCardIdNum[cardId] = num2 + num; + } + _cardListView.IncrementCardNum(cardId, num); + if (_cardDetailUI.OnClose != null) + { + _cardDetailUI.OnClose = null; + } + } + + public void UpdateExplainText() + { + int num = CalculateTotalUseRedetherNum(); + int userRedEtherCount = PlayerStaticData.UserRedEtherCount; + if (!IsExistCreateCardId()) + { + _parentCraftUI.SetActive(value: false); + _parentNotCraftUI.SetActive(value: true); + _labelExplain_1.text = Data.SystemText.Get("Card_0159"); + _labelExplain_2.text = Data.SystemText.Get("Card_0158"); + _iconExplainRedether.SetActive(value: false); + _labelHaveRedetherNum.text = userRedEtherCount.ToString(); + _dialog.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + _dialog.onPushButton1 = null; + } + else if (num <= userRedEtherCount) + { + _parentCraftUI.SetActive(value: true); + _parentNotCraftUI.SetActive(value: false); + _labelExplain_1.text = Data.SystemText.Get("Card_0154", num.ToString()); + _labelExplain_2.text = Data.SystemText.Get("Card_0155"); + _iconExplainRedether.SetActive(value: true); + _labelBeforeRedetherNum.text = userRedEtherCount.ToString(); + _labelAfterRedetherNum.text = Data.SystemText.Get("Shop_0045", (userRedEtherCount - num).ToString()); + _dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + _dialog.SetButtonText(Data.SystemText.Get("Dia_DeckEdit_014_Button")); + _dialog.SetButtonDelegate(StartCreateShortageCard); + } + else + { + _parentCraftUI.SetActive(value: false); + _parentNotCraftUI.SetActive(value: true); + int num2 = num - userRedEtherCount; + _labelExplain_1.text = Data.SystemText.Get("Card_0157", num2.ToString()); + _labelExplain_2.text = Data.SystemText.Get("Card_0158"); + _iconExplainRedether.SetActive(value: true); + _labelHaveRedetherNum.text = userRedEtherCount.ToString(); + _dialog.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + _dialog.onPushButton1 = null; + } + } + + private bool IsExistCreateCardId() + { + foreach (KeyValuePair item in _dictCreateCardIdNum) + { + if (item.Value > 0) + { + return true; + } + } + return false; + } + + private int CalculateTotalUseRedetherNum() + { + int num = 0; + foreach (KeyValuePair item in _dictCreateCardIdNum) + { + int key = item.Key; + int value = item.Value; + int useRedEther = CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(key).UseRedEther; + num += useRedEther * value; + } + return num; + } + + private void StartCreateShortageCard() + { + if (!IsExistCreateCardId()) + { + _onCraftCardAllCallback.Call(); + return; + } + UIManager.GetInstance().createInSceneCenterLoading(); + CardMake component = base.gameObject.GetComponent(); + component.OnCardBuy = delegate + { + _onCraftCardAllCallback.Call(); + UIManager.GetInstance().closeInSceneCenterLoading(); + }; + component.StartCraftAll(_dictCreateCardIdNum); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckCopyDialog.cs b/SVSim.BattleEngine/Engine/Wizard/DeckCopyDialog.cs new file mode 100644 index 0000000..f6e7da2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckCopyDialog.cs @@ -0,0 +1,122 @@ +using UnityEngine; +using Wizard.DeckCardEdit; +using Wizard.Dialog.Setting; + +namespace Wizard; + +public class DeckCopyDialog : MonoBehaviour +{ + [SerializeField] + private UILabel _textLabel; + + [SerializeField] + private ItemToggle _sleeveAndLeaderSkinRootItemToggle; + + [SerializeField] + private ItemToggle _subClassOptionRootItemToggle; + + [SerializeField] + private ItemToggle _foilPreferredItemToggle; + + [SerializeField] + private ItemToggle _prizePreferredItemToggle; + + [SerializeField] + private ClassInfoParts _selectClassInfo; + + [SerializeField] + private CenteringUIWidget _centeringUIWidget; + + [SerializeField] + private FlexibleGrid _flexibleGrid; + + private void Start() + { + if (_sleeveAndLeaderSkinRootItemToggle != null) + { + _sleeveAndLeaderSkinRootItemToggle.SetTitleLabel(Data.SystemText.Get("Card_0181")); + _sleeveAndLeaderSkinRootItemToggle.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SLEEVE_AND_SKIN)); + _sleeveAndLeaderSkinRootItemToggle.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.IS_COPY_SLEEVE_AND_SKIN, _sleeveAndLeaderSkinRootItemToggle.GetValue()); + }); + } + if (_subClassOptionRootItemToggle != null) + { + _subClassOptionRootItemToggle.SetTitleLabel("Card_0281"); + _subClassOptionRootItemToggle.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS)); + _subClassOptionRootItemToggle.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS, _subClassOptionRootItemToggle.GetValue()); + }); + } + if (_foilPreferredItemToggle != null) + { + _foilPreferredItemToggle.SetValue(Data.Load.data._userConfig.IsFoilPreferred); + _foilPreferredItemToggle.AddChangeCallback(delegate + { + DeckCardEditUI.SendConfigUpdateFoilPreferred(_foilPreferredItemToggle.GetValue()); + }); + } + if (_prizePreferredItemToggle != null) + { + _prizePreferredItemToggle.SetValue(Data.Load.data._userConfig.IsPrizePreferred); + _prizePreferredItemToggle.AddChangeCallback(delegate + { + DeckCardEditUI.SendConfigUpdatePrizePreferred(_prizePreferredItemToggle.GetValue()); + }); + } + } + + private void SetText(string text) + { + _textLabel.text = text; + } + + private void SetClassesIconAndName(DeckData scrDeck) + { + if (!(_selectClassInfo == null) && !(_flexibleGrid == null) && !(_centeringUIWidget == null)) + { + int skinId = scrDeck.GetSkinId(); + _selectClassInfo.InitBySkinId(skinId); + _selectClassInfo.SetSubClass((CardBasePrm.ClanType)scrDeck.GetDeckSubClassID()); + _flexibleGrid.Reposition(); + _centeringUIWidget.Reposition(); + StartCoroutine(_flexibleGrid.RepositionNextFrame()); + } + } + + private static DialogBase CreateDialog(DeckCopyDialog dialogParts, DeckData srcDeck) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogParts.SetText(systemText.Get("Card_0112", srcDeck.GetDeckName())); + dialogBase.SetTitleLabel(systemText.Get("Card_0121")); + dialogBase.SetObj(dialogParts.gameObject); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("Card_0122")); + return dialogBase; + } + + public static DialogBase CreateDeckCopyDialog(DeckCopyDialog deckCopyDialogPrefab, DeckData srcDeck) + { + return CreateDialog(Object.Instantiate(deckCopyDialogPrefab.gameObject).GetComponent(), srcDeck); + } + + public static DialogBase CreateDeckCopyDialogForMyRotation(DeckCopyDialog deckCopyDialogPrefab, DeckData srcDeck) + { + DeckCopyDialog component = Object.Instantiate(deckCopyDialogPrefab.gameObject).GetComponent(); + DialogBase result = CreateDialog(component, srcDeck); + component.SetText(Data.SystemText.Get("MyRotation_ID_06", srcDeck.GetDeckName())); + return result; + } + + public static DialogBase CreateDeckCopyDialogUseSubClass(DeckCopyDialog useSubClassDeckCopyDialogPrefab, DeckData srcDeck) + { + DeckCopyDialog component = Object.Instantiate(useSubClassDeckCopyDialogPrefab.gameObject).GetComponent(); + DialogBase dialogBase = CreateDialog(component, srcDeck); + component.SetClassesIconAndName(srcDeck); + dialogBase.SetSize(DialogBase.Size.M); + return dialogBase; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard/DeckInfoTask.cs new file mode 100644 index 0000000..4d7b9f6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckInfoTask.cs @@ -0,0 +1,62 @@ +namespace Wizard; + +public class DeckInfoTask : BaseTask +{ + public class DeckInfoTaskParam : BaseParam + { + public int deck_format; + } + + public class DeckInfoTaskParamForCopySrcGet : BaseParam + { + public int deck_format; + + public int create_deck_format; + } + + private Format _format; + + public DeckGroupListData DeckGroupListData { get; private set; } + + public DeckInfoTask(bool isRoom = false) + { + if (isRoom) + { + base.type = ApiType.Type.OpenRoomDeckInfo; + } + else + { + base.type = ApiType.Type.DeckInfo; + } + } + + public void SetParameter(Format format) + { + DeckInfoTaskParam deckInfoTaskParam = new DeckInfoTaskParam(); + deckInfoTaskParam.deck_format = Data.FormatConvertApi(format); + base.Params = deckInfoTaskParam; + _format = format; + } + + public void SetParameterForCopySrcGet(Format format, Format copyTargetFormat) + { + DeckInfoTaskParamForCopySrcGet deckInfoTaskParamForCopySrcGet = new DeckInfoTaskParamForCopySrcGet(); + deckInfoTaskParamForCopySrcGet.deck_format = Data.FormatConvertApi(format); + deckInfoTaskParamForCopySrcGet.create_deck_format = Data.FormatConvertApi(copyTargetFormat); + base.Params = deckInfoTaskParamForCopySrcGet; + _format = format; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + GameMgr.GetIns().GetDataMgr().SetMaintenanceCardIds(base.ResponseData["data"]["maintenance_card_list"]); + DeckGroupListData = new DeckGroupListData(base.ResponseData["data"], _format); + GameMgr.GetIns().GetDataMgr().CurrentDeckListParamData = DeckGroupListData; + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckListUtility.cs b/SVSim.BattleEngine/Engine/Wizard/DeckListUtility.cs new file mode 100644 index 0000000..acf1844 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckListUtility.cs @@ -0,0 +1,329 @@ +using System.Collections.Generic; +using System.Linq; +using LitJson; + +namespace Wizard; + +public static class DeckListUtility +{ + private static List DeckGroupDataBase => Data.DeckGroupDataBase; + + public static List DeckGroupDataBaseClone() + { + List deckGroups = new List(); + DeckGroupDataBase.ForEach(delegate(DeckGroup dg) + { + deckGroups.Add(dg.Clone()); + }); + return deckGroups; + } + + public static List ParseDeckInfoResponceData(JsonData jsonData, Format requestFormat) + { + if (jsonData.Keys.Contains("user_leader_skin_setting_list")) + { + SetLeaderSkinSetting(jsonData["user_leader_skin_setting_list"]); + } + bool flag = false; + bool flag2 = false; + bool flag3 = false; + if (requestFormat == Format.All) + { + if (jsonData.Keys.Contains("user_deck_rotation")) + { + DeckListUpdate(CreateDeckGroup(jsonData["user_deck_rotation"], Format.Rotation, DeckAttributeType.CustomDeck)); + } + if (jsonData.Keys.Contains("user_deck_unlimited")) + { + DeckListUpdate(CreateDeckGroup(jsonData["user_deck_unlimited"], Format.Unlimited, DeckAttributeType.CustomDeck)); + } + if (jsonData.Keys.Contains("user_deck_pre_rotation")) + { + DeckListUpdate(CreateDeckGroup(jsonData["user_deck_pre_rotation"], Format.PreRotation, DeckAttributeType.CustomDeck)); + } + if (jsonData.TryGetValue("user_deck_crossover", out var value)) + { + DeckListUpdate(CreateDeckGroup(value, Format.Crossover, DeckAttributeType.CustomDeck)); + } + else + { + flag = true; + } + if (jsonData.TryGetValue("user_deck_my_rotation", out var value2)) + { + DeckListUpdate(CreateDeckGroup(value2, Format.MyRotation, DeckAttributeType.CustomDeck)); + } + else + { + flag2 = true; + } + if (jsonData.TryGetValue("user_deck_avatar", out var value3)) + { + DeckListUpdate(CreateDeckGroup(value3, Format.Avatar, DeckAttributeType.CustomDeck)); + } + else + { + flag3 = true; + } + } + else if (jsonData.Keys.Contains("user_deck_list")) + { + DeckListUpdate(CreateDeckGroup(jsonData["user_deck_list"], requestFormat, DeckAttributeType.CustomDeck)); + } + List list = DeckGroupDataBaseClone(); + if (flag) + { + RemoveDeckListGroup(list, Format.Crossover, DeckAttributeType.CustomDeck); + } + if (flag2) + { + RemoveDeckListGroup(list, Format.MyRotation, DeckAttributeType.CustomDeck); + } + if (flag3) + { + RemoveDeckListGroup(list, Format.Avatar, DeckAttributeType.CustomDeck); + } + if (jsonData.Keys.Contains("trial_deck_list")) + { + Format format = ((requestFormat != Format.Rotation) ? Format.Max : Format.Rotation); + list.Add(CreateDeckGroup(jsonData["trial_deck_list"], format, DeckAttributeType.TrialDeck)); + } + if (jsonData.TryGetValue("crossover_trial_deck_list", out var value4)) + { + list.Add(CreateDeckGroup(value4, Format.Crossover, DeckAttributeType.SampleDeck)); + } + if (jsonData.Keys.Contains("build_deck_list")) + { + list.Add(CreateDeckGroup(jsonData["build_deck_list"], Format.Max, DeckAttributeType.BuildDeck)); + } + if (jsonData.Keys.Contains("default_deck_list")) + { + Format format2 = ((requestFormat == Format.All) ? Format.Max : requestFormat); + list.Add(CreateDeckGroup(jsonData["default_deck_list"], format2, DeckAttributeType.DefaultDeck)); + } + return list; + } + + public static void SetDeckListDataWithLodeIndex() + { + LoadDetail data = Data.Load.data; + DeckListUpdate(CreateDeckGroup(data.UserDeckListUnlimited, Format.Unlimited, DeckAttributeType.CustomDeck)); + DeckListUpdate(CreateDeckGroup(data.UserDeckListRotation, Format.Rotation, DeckAttributeType.CustomDeck)); + if (data.UserDeckListPreRotation != null) + { + DeckListUpdate(CreateDeckGroup(data.UserDeckListPreRotation, Format.PreRotation, DeckAttributeType.CustomDeck)); + } + if (data.UserDeckListCrossover != null) + { + DeckListUpdate(CreateDeckGroup(data.UserDeckListCrossover, Format.Crossover, DeckAttributeType.CustomDeck)); + } + if (data.UserDeckListMyRotation != null) + { + DeckListUpdate(CreateDeckGroup(data.UserDeckListMyRotation, Format.MyRotation, DeckAttributeType.CustomDeck)); + } + } + + private static void DeckListUpdate(DeckGroup receiveDeckGroup) + { + DeckGroup deckGroup = DeckGroupDataBase.FirstOrDefault((DeckGroup d) => d.DeckFormat == receiveDeckGroup.DeckFormat && d.AttributeType == receiveDeckGroup.AttributeType); + if (receiveDeckGroup.DeckDataList.Count() == 0) + { + deckGroup?.MaintenanceCardCheack(); + return; + } + if (deckGroup != null) + { + DeckGroupDataBase.Remove(deckGroup); + } + DeckGroupDataBase.Add(receiveDeckGroup); + } + + private static void RemoveDeckListGroup(List deckGroups, Format format, DeckAttributeType attributeType) + { + DeckGroup deckGroup = deckGroups.FirstOrDefault((DeckGroup d) => d.DeckFormat == format && d.AttributeType == attributeType); + if (deckGroup != null) + { + deckGroups.Remove(deckGroup); + } + } + + public static DeckGroup CreateDeckGroup(JsonData deckListJson, Format format, DeckAttributeType deckAttributeType) + { + return new DeckGroup(ParseDeckListJson(deckListJson, format, deckAttributeType), format, deckAttributeType); + } + + public static List ParseDeckListJson(JsonData responseData, Format format, DeckAttributeType deckAttributeType) + { + List list = new List(); + for (int i = 0; i < responseData.Count; i++) + { + JsonData deckData = responseData[i]; + DeckData deckData2 = new DeckData(format, deckAttributeType); + deckData2.Initialize(deckData); + list.Add(deckData2); + } + return list; + } + + public static string DeckListHeader(DeckAttributeType deckAttributeType, int pageNum) + { + return deckAttributeType switch + { + DeckAttributeType.DefaultDeck => Data.SystemText.Get("Card_0004"), + DeckAttributeType.TrialDeck => Data.SystemText.Get("Card_0255") + pageNum, + DeckAttributeType.BuildDeck => Data.SystemText.Get("Story_0056") + pageNum, + DeckAttributeType.CustomDeck => Data.SystemText.Get("Card_0005") + pageNum, + DeckAttributeType.SampleDeck => Data.SystemText.Get("Card_0293"), + DeckAttributeType.QuestSecretBoss => Data.SystemText.Get("BossRush_0041"), + _ => string.Empty, + }; + } + + public static void DeckUpdate(JsonData jsonData, Format format, DeckAttributeType deckAttributeType) + { + DeckData deckData = new DeckData(format, deckAttributeType); + deckData.Initialize(jsonData); + DeckGroup deckGroup = DeckGroupDataBase.FirstOrDefault((DeckGroup d) => d.DeckFormat == format && d.AttributeType == deckAttributeType); + DeckData deckData2 = deckGroup?.DeckDataList.FirstOrDefault((DeckData d) => d.GetDeckID() == deckData.GetDeckID()); + if (deckData2 == null) + { + Debug.LogError("ๆ›ดๆ–ฐๅฏพ่ฑกใƒ‡ใƒƒใ‚ญใŒใ‚ใ‚Šใพใ›ใ‚“"); + return; + } + deckGroup.DeckDataList.Insert(deckGroup.DeckDataList.IndexOf(deckData2), deckData); + deckGroup.DeckDataList.Remove(deckData2); + } + + public static void DataMgrSaveLastSelectDeckData(DeckData deckData) + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + dataMgr.SetSelectDeckId(deckData.GetDeckID()); + dataMgr.SetPlayerCharaIdBySkinId(deckData.GetSkinId()); + dataMgr.SetCurrentDeckData(deckData.GetCardIdList()); + dataMgr.SetPlayerSubClassID(deckData.GetDeckSubClassID()); + dataMgr.SetPlayerMyRotationInfo(deckData.MyRotationId); + dataMgr.SetPlayerSleeveId(deckData.GetDeckSleeveID()); + dataMgr.LastSelectDeckAttributeType = deckData.DeckAttributeType; + dataMgr.SetSelectDeckFormat(deckData.Format); + } + + public static void SaveLastSelectDeck(int deckId, bool isDefaultDeck, bool isTrialDeck, Format format) + { + if (FormatBehaviorManager.GetDefaultBehaviour(format).IsSavableLastSelectDeck) + { + switch (format) + { + case Format.Rotation: + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.LAST_SELECT_IS_DEFDECK_ROTATION, isDefaultDeck); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_ROTATION, deckId); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.LAST_BATTLE_IS_TRIALDECK, isTrialDeck); + break; + case Format.Unlimited: + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.LAST_SELECT_IS_DEFDECK_UNLIMITED, isDefaultDeck); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_UNLIMITED, deckId); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.LAST_BATTLE_IS_TRIALDECK, isTrialDeck); + break; + case Format.PreRotation: + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_PRE_ROTATION, deckId); + break; + case Format.Crossover: + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_CROSSOVER, deckId); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.LAST_BATTLE_IS_TRIALDECK, isTrialDeck); + break; + case Format.MyRotation: + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_MY_ROTATION, deckId); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.LAST_BATTLE_IS_TRIALDECK, isTrialDeck); + break; + case Format.Avatar: + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_AVATAR, deckId); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.LAST_BATTLE_IS_TRIALDECK, isTrialDeck); + break; + } + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_FORMAT, (int)format); + } + } + + public static void ClearLastSelectDeck(Format format) + { + switch (format) + { + case Format.Rotation: + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.LAST_SELECT_IS_DEFDECK_ROTATION, flag: false); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_ROTATION, -1); + break; + case Format.Unlimited: + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.LAST_SELECT_IS_DEFDECK_UNLIMITED, flag: false); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_UNLIMITED, -1); + break; + case Format.Crossover: + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_CROSSOVER, -1); + break; + case Format.MyRotation: + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_MY_ROTATION, -1); + break; + case Format.Avatar: + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_AVATAR, -1); + break; + } + } + + public static List ConvertSkinOverrideDeckGroupList(List deckGroupList, Dictionary dictDeckSkinIdOverride) + { + List list = new List(); + foreach (DeckGroup deckGroup in deckGroupList) + { + List list2 = new List(); + foreach (DeckData deckData in deckGroup.DeckDataList) + { + list2.Add(CopyAndReplaceDeckSkinOverride(deckData, dictDeckSkinIdOverride)); + } + list.Add(new DeckGroup(list2, deckGroup.DeckFormat, deckGroup.AttributeType)); + } + return list; + } + + private static DeckData CopyAndReplaceDeckSkinOverride(DeckData deck, Dictionary dictDeckSkinIdOverride) + { + DeckData deckData = deck.Clone(); + if (deckData.IsNoCard()) + { + return deckData; + } + int deckClassID = deckData.GetDeckClassID(); + if (dictDeckSkinIdOverride.TryGetValue(deckClassID, out var value)) + { + deckData.SetSkinId(value); + } + deckData.IsReplaceDeckSkin = true; + return deckData; + } + + private static void SetLeaderSkinSetting(JsonData jsonData) + { + for (int i = 0; i < jsonData.Count; i++) + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + int classId = jsonData[i]["class_id"].ToInt(); + ClassCharaPrm classPrm = dataMgr.GetClassPrm(classId); + classPrm.IsRandomLeaderSkin = jsonData[i]["is_random_leader_skin"].ToBoolean(); + int skinId = jsonData[i]["leader_skin_id"].ToInt(); + ClassCharacterMasterData charaPrmBySkinId = dataMgr.GetCharaPrmBySkinId(skinId); + classPrm.SetCurrentCharaId(charaPrmBySkinId.chara_id); + } + } + + public static List StoryDeckSelectClass(List deckGroups, int classId) + { + List list = new List(); + foreach (DeckGroup deckGroup in deckGroups) + { + List list2 = deckGroup.DeckDataList; + if (deckGroup.AttributeType == DeckAttributeType.BuildDeck || deckGroup.AttributeType == DeckAttributeType.TrialDeck) + { + list2 = list2.Where((DeckData d) => d.GetDeckClassID() == classId || d.IsNoCard()).ToList(); + } + list.Add(new DeckGroup(list2, deckGroup.DeckFormat, deckGroup.AttributeType)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckSelectUI.cs b/SVSim.BattleEngine/Engine/Wizard/DeckSelectUI.cs new file mode 100644 index 0000000..50e8e6e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckSelectUI.cs @@ -0,0 +1,471 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.DeckSelect.FirstDisplayPageIndexGetter; + +namespace Wizard; + +public class DeckSelectUI : MonoBehaviour +{ + public class InitOptions + { + public Action OnUpdateDeckUICustomize { get; set; } + + public Action OnClickInfoButton { get; set; } + + public DeckData PrimaryFirstDisplayDeck { get; set; } + + public bool CanUseNonPossessionCard { get; set; } + + public IFirstDisplayPageIndexGetter FirstDisplayPageIndexGetter { get; set; } + + public int? LongTextTitlePosition { get; set; } + } + + private enum ChangeMoveDirection + { + NONE, + RIGHT, + LEFT + } + + public class PageData + { + public Format Format { get; private set; } + + public DeckAttributeType AttributeType { get; private set; } + + public string GroupName { get; private set; } + + public List DeckViewList { get; private set; } + + public static List CreatePageList(List deckGroupList, bool isVisibleCreateNew) + { + List list = new List(); + foreach (DeckGroup deckGroup in deckGroupList) + { + List list2 = DeckUI.DeckViewData.CreateDeckViewList(deckGroup.DeckDataList, isVisibleCreateNew); + if (!list2.Any((DeckUI.DeckViewData d) => d.ViewType != DeckUI.eViewType.Empty)) + { + continue; + } + int num = 0; + for (int num2 = 0; num2 < list2.Count; num2++) + { + if (num2 % 9 == 0) + { + if (list2[num2].ViewType == DeckUI.eViewType.Empty) + { + break; + } + num++; + string groupName = DeckListUtility.DeckListHeader(deckGroup.AttributeType, num); + list.Add(new PageData(new List(), deckGroup.DeckFormat, deckGroup.AttributeType, groupName)); + } + list.Last().AddDeckViewList(list2[num2]); + } + } + return list; + } + + private PageData(List deckViewList, Format format, DeckAttributeType attributeType, string groupName) + { + DeckViewList = deckViewList; + Format = format; + AttributeType = attributeType; + GroupName = groupName; + } + + private void AddDeckViewList(DeckUI.DeckViewData deckViewData) + { + DeckViewList.Add(deckViewData); + } + } + + private class DeckTable + { + private List _deckUIList = new List(); + + private Action _onUpdateDeckUICustomize; + + public GameObject Obj { get; private set; } + + public DeckTable(UIGrid uiGrid, DeckUI originalDeckUI, Action onClick, Action onDrag, Action onUpdateDeckUICustomize) + { + _onUpdateDeckUICustomize = onUpdateDeckUICustomize; + for (int i = 0; i < 9; i++) + { + DeckUI component = NGUITools.AddChild(uiGrid.gameObject, originalDeckUI.gameObject).GetComponent(); + component.Initialize(onClick); + UIEventListener uIEventListener = UIEventListener.Get(component.gameObject); + uIEventListener.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener.onDrag, (UIEventListener.VectorDelegate)delegate(GameObject g, Vector2 v) + { + onDrag.Call(v); + }); + _deckUIList.Add(component); + component.gameObject.SetActive(value: false); + } + uiGrid.repositionNow = true; + Obj = uiGrid.gameObject; + Obj.SetActive(value: true); + } + + public void UpdateDeckViewList(List deckViewList, bool canUseNonPossessionCard) + { + for (int i = 0; i < _deckUIList.Count; i++) + { + if (deckViewList.Count > i) + { + DeckUI deckUI = _deckUIList[i]; + deckUI.gameObject.SetActive(value: true); + deckUI.UpdateView(deckViewList[i], canUseNonPossessionCard); + _onUpdateDeckUICustomize.Call(deckUI); + } + else + { + _deckUIList[i].gameObject.SetActive(value: false); + } + } + } + } + + private const int MAXNUM_DECK_PER_TABLE = 9; + + private const float DRAG_DEGREE = 70f; + + private const float PAGE_INTERVAL = 1400f; + + private const float MOVE_PAGE_DURATION = 0.2f; + + private static readonly Vector3 VIEW_PAGE_POSITION = Vector3.zero; + + private static readonly Vector3 OUTSIDE_RIGHT_PAGE_POSITION = VIEW_PAGE_POSITION + Vector3.right * 1400f; + + private static readonly Vector3 OUTSIDE_LEFT_PAGE_POSITION = VIEW_PAGE_POSITION + Vector3.left * 1400f; + + [SerializeField] + private DeckUI _deckFrameOriginal; + + [SerializeField] + private UILabel _titleLabel; + + [SerializeField] + private GameObject _deckTableRoot; + + [SerializeField] + private UIPageIndicator _pageIndicatorOriginal; + + private UIPageIndicator _pageIndicator; + + [SerializeField] + private GameObject _pageIndicatorRoot; + + [SerializeField] + private UIButton _leftButton; + + [SerializeField] + private UIButton _rightButton; + + [SerializeField] + private BoxCollider _flickCollider; + + [SerializeField] + private UILabel _noDeckText; + + [SerializeField] + private UILabel _cautionLabel; + + [SerializeField] + private UIGrid[] _deckTableGrids = new UIGrid[2]; + + [SerializeField] + private UIPanel _panel; + + [SerializeField] + private UIButton _infoButton; + + private DeckTable[] _deckTables = new DeckTable[2]; + + private int _deckTableIndex; + + private Action OnSelectDeck; + + private Action OnChangePage; + + private bool _isOnDestroy; + + private List _resourcePathList; + + private int _currentPageIndex; + + private List _pageList; + + private bool _isInitialized; + + private bool _canUseNonPossessionCard; + + public bool IsPageMoving { get; private set; } + + public void Initialize(List deckGroupList, Format format, bool isVisibleCreateNew, Action onSelectDeck, Action onChangePage, Action onInitializeFinish, InitOptions initOptions = null) + { + if (initOptions == null) + { + initOptions = new InitOptions(); + } + _infoButton.gameObject.SetActive(initOptions.OnClickInfoButton != null); + _canUseNonPossessionCard = initOptions.CanUseNonPossessionCard; + UIEventListener uIEventListener = UIEventListener.Get(_flickCollider.gameObject); + uIEventListener.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener.onDrag, (UIEventListener.VectorDelegate)delegate(GameObject g, Vector2 v) + { + OnDragPanel(v); + }); + UIEventListener uIEventListener2 = UIEventListener.Get(_rightButton.gameObject); + uIEventListener2.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener2.onClick, (UIEventListener.VoidDelegate)delegate + { + NextPage(); + }); + UIEventListener uIEventListener3 = UIEventListener.Get(_leftButton.gameObject); + uIEventListener3.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener3.onClick, (UIEventListener.VoidDelegate)delegate + { + PrevPage(); + }); + if (initOptions.OnClickInfoButton != null) + { + UIEventListener uIEventListener4 = UIEventListener.Get(_infoButton.gameObject); + uIEventListener4.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener4.onClick, (UIEventListener.VoidDelegate)delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + initOptions.OnClickInfoButton.Call(); + }); + } + OnSelectDeck = onSelectDeck; + OnChangePage = onChangePage; + _deckTables[0] = new DeckTable(_deckTableGrids[0], _deckFrameOriginal, OnClickDeck, OnDragPanel, initOptions.OnUpdateDeckUICustomize); + _deckTables[1] = new DeckTable(_deckTableGrids[1], _deckFrameOriginal, OnClickDeck, OnDragPanel, initOptions.OnUpdateDeckUICustomize); + _cautionLabel.gameObject.SetActive(value: false); + Action onSettingDeckListFinish = delegate + { + _isInitialized = true; + onInitializeFinish.Call(); + }; + UpdateDeckView(deckGroupList, format, isVisibleCreateNew, onSettingDeckListFinish, initOptions.PrimaryFirstDisplayDeck, initOptions.FirstDisplayPageIndexGetter); + } + + public void UpdateDeckView(List deckGroupList, Format format, bool isVisibleCreateNew, Action onSettingDeckListFinish = null, DeckData primaryFirstDisplayDeck = null, IFirstDisplayPageIndexGetter firstDisplayPageIndexGetter = null) + { + List list = new List(); + foreach (DeckGroup deckGroup in deckGroupList) + { + list.AddRange(deckGroup.DeckDataList); + } + LoadResources(list, delegate + { + if (!_isOnDestroy) + { + if (firstDisplayPageIndexGetter == null) + { + firstDisplayPageIndexGetter = new DefaultFirstDisplayPageIndexGetter(); + } + CreateDeckGroupPages(deckGroupList, isVisibleCreateNew, format, primaryFirstDisplayDeck, firstDisplayPageIndexGetter); + onSettingDeckListFinish.Call(); + } + }); + } + + public void ShowCautionText(string cautionText) + { + _cautionLabel.gameObject.SetActive(cautionText != string.Empty); + _cautionLabel.text = cautionText; + } + + public void UpdateAllDeckUICurrentPage() + { + _deckTables[_deckTableIndex].UpdateDeckViewList(_pageList[_currentPageIndex].DeckViewList, _canUseNonPossessionCard); + } + + private void OnClickDeck(DeckUI deckUI) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + OnSelectDeck.Call(deckUI.Deck); + } + + private void OnDragPanel(Vector2 dir) + { + if (dir.x >= 70f) + { + PrevPage(); + } + else if (dir.x <= -70f) + { + NextPage(); + } + } + + private void NextPage() + { + if (_pageList.Count > 1) + { + ChangePage(_currentPageIndex + 1, ChangeMoveDirection.RIGHT); + } + } + + private void PrevPage() + { + if (_pageList.Count > 1) + { + ChangePage(_currentPageIndex - 1, ChangeMoveDirection.LEFT); + } + } + + private void LoadResources(List deckDataList, Action onFinish) + { + if (_isInitialized) + { + DeleteResource(); + } + _resourcePathList = new List(); + List list = new List(deckDataList.Count); + List list2 = new List(deckDataList.Count); + foreach (DeckData deckData in deckDataList) + { + if (deckData.IsNoCard()) + { + continue; + } + int skinId = deckData.GetSkinId(); + if (!list.Contains(skinId)) + { + list.Add(skinId); + _resourcePathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(deckData.GetSkinId().ToString(), ResourcesManager.AssetLoadPathType.DeckListTexture)); + } + long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(deckData.GetDeckSleeveID()); + if (!list2.Contains(existingSleeveId)) + { + list2.Add(existingSleeveId); + _resourcePathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture)); + Sleeve sleeve = Data.Master.SleeveMgr.Get(existingSleeveId); + if (sleeve.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref _resourcePathList, sleeve); + } + } + } + UIManager.GetInstance().createInSceneCenterLoading(); + UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_resourcePathList, delegate + { + UIManager.GetInstance().closeInSceneCenterLoading(); + onFinish.Call(); + })); + } + + private void CreateDeckGroupPages(List deckGroupList, bool isVisibleCreateNew, Format format, DeckData primaryFirstDisplayDeck, IFirstDisplayPageIndexGetter firstDisplayPageIndexGetter) + { + _pageList = PageData.CreatePageList(deckGroupList, isVisibleCreateNew); + bool flag = _pageList.Count > 0; + _deckTableRoot.SetActive(flag); + _noDeckText.gameObject.SetActive(!flag); + _titleLabel.gameObject.SetActive(flag); + _pageIndicatorOriginal.gameObject.SetActive(value: false); + _pageIndicatorRoot.gameObject.SetActive(flag); + if (flag) + { + if (_isInitialized && _pageIndicator != null) + { + UnityEngine.Object.Destroy(_pageIndicator.gameObject); + } + _pageIndicator = NGUITools.AddChild(_pageIndicatorRoot, _pageIndicatorOriginal.gameObject).GetComponent(); + _pageIndicator.gameObject.SetActive(value: true); + } + _flickCollider.gameObject.SetActive(flag); + _rightButton.gameObject.SetActive(_pageList.Count > 1); + _leftButton.gameObject.SetActive(_pageList.Count > 1); + if (flag) + { + _currentPageIndex = firstDisplayPageIndexGetter.Get(_pageList, format, primaryFirstDisplayDeck, _canUseNonPossessionCard); + _pageIndicator.Init(_pageList.Count, _currentPageIndex + 1); + ChangePage(_currentPageIndex, ChangeMoveDirection.NONE); + } + else + { + OnChangePage.Call(format); + } + } + + private void ChangePage(int nextPageIndex, ChangeMoveDirection moveDirection) + { + if (!IsPageMoving && IsValidPageIndex(nextPageIndex)) + { + PageData pageData = _pageList[nextPageIndex]; + _currentPageIndex = nextPageIndex; + _titleLabel.text = pageData.GroupName; + ChangeDeckTable(pageData, moveDirection); + _pageIndicator.UpdateIndicator(_currentPageIndex + 1); + _leftButton.gameObject.SetActive(0 < nextPageIndex); + _rightButton.gameObject.SetActive(nextPageIndex < _pageList.Count - 1); + OnChangePage.Call(pageData.Format); + } + } + + private bool IsValidPageIndex(int pageIndex) + { + if (_pageList.Count <= pageIndex) + { + return false; + } + if (pageIndex < 0) + { + return false; + } + return true; + } + + private void ChangeDeckTable(PageData nextPageData, ChangeMoveDirection moveDirection) + { + if (IsPageMoving) + { + return; + } + DeckTable deckTable = _deckTables[_deckTableIndex]; + _deckTableIndex = 1 - _deckTableIndex; + DeckTable deckTable2 = _deckTables[_deckTableIndex]; + deckTable2.UpdateDeckViewList(nextPageData.DeckViewList, _canUseNonPossessionCard); + if (moveDirection == ChangeMoveDirection.NONE) + { + deckTable2.Obj.transform.localPosition = VIEW_PAGE_POSITION; + deckTable.Obj.transform.localPosition = OUTSIDE_RIGHT_PAGE_POSITION; + return; + } + bool flag = moveDirection == ChangeMoveDirection.RIGHT; + deckTable.Obj.transform.localPosition = VIEW_PAGE_POSITION; + deckTable2.Obj.transform.localPosition = (flag ? OUTSIDE_RIGHT_PAGE_POSITION : OUTSIDE_LEFT_PAGE_POSITION); + IsPageMoving = true; + TweenPosition.Begin(deckTable.Obj, 0.2f, flag ? OUTSIDE_LEFT_PAGE_POSITION : OUTSIDE_RIGHT_PAGE_POSITION); + TweenPosition.Begin(deckTable2.Obj, 0.2f, VIEW_PAGE_POSITION).SetOnFinished(delegate + { + IsPageMoving = false; + }); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + } + + private void OnDestroy() + { + _isOnDestroy = true; + DeleteResource(); + } + + private void DeleteResource() + { + if (_resourcePathList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_resourcePathList); + _resourcePathList.Clear(); + } + } + + public void SetPanelDepth(int depth) + { + _panel.depth = depth; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckSelectUIDialog.cs b/SVSim.BattleEngine/Engine/Wizard/DeckSelectUIDialog.cs new file mode 100644 index 0000000..e6abeed --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckSelectUIDialog.cs @@ -0,0 +1,282 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class DeckSelectUIDialog +{ + public enum eFormatChangeUIType + { + SingleFormat, + NormalFormatOnly, + WithPrerotation, + WithCrossover, + WithMyRotation, + WithAvatar, + UseOtherCategory + } + + private const string PATH_DECK_LIST_PREFAB = "UI/DeckList/DeckSelectUI/DeckSelectUI"; + + private static readonly Vector2 FORMAT_CHANGE_UI_POSITION = new Vector3(-508f, 65f); + + private DeckSelectUIDialogTitle _deckSelectDialogTitleUI; + + private DeckGroupListData _deckGroupListData; + + private bool _isVisibleCreateNew; + + private DeckSelectUI _deckSelectUI; + + private static readonly Format[] OTHER_CATEGORY_FORMATS = new Format[5] + { + Format.Crossover, + Format.PreRotation, + Format.MyRotation, + Format.Avatar, + Format.Max + }; + + private static readonly Dictionary FORMAT_CATEGORY_TO_FORMAT = new Dictionary + { + { + FormatChangeUI.FormatCategory.Rotation, + Format.Rotation + }, + { + FormatChangeUI.FormatCategory.Unlimited, + Format.Unlimited + }, + { + FormatChangeUI.FormatCategory.PreRotation, + Format.PreRotation + }, + { + FormatChangeUI.FormatCategory.Crossover, + Format.Crossover + }, + { + FormatChangeUI.FormatCategory.Other, + Format.Max + }, + { + FormatChangeUI.FormatCategory.Hof, + Format.Hof + }, + { + FormatChangeUI.FormatCategory.Windfall, + Format.Windfall + }, + { + FormatChangeUI.FormatCategory.MyRotation, + Format.MyRotation + }, + { + FormatChangeUI.FormatCategory.Avatar, + Format.Avatar + } + }; + + public DialogBase Dialog { get; private set; } + + public static DeckSelectUIDialog Create(string dialogTitle, DeckGroupListData deckGroupListData, Format defaultFormat, eFormatChangeUIType formatChangeUIType, bool isVisibleCreateNew, Action OnSelectDeck, DeckSelectUI.InitOptions initOptions = null) + { + if (defaultFormat == Format.All) + { + defaultFormat = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_FORMAT); + } + if (formatChangeUIType == eFormatChangeUIType.UseOtherCategory && IsIncludeInOtherCategory(defaultFormat)) + { + defaultFormat = Format.Max; + bool num = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.LAST_BATTLE_IS_TRIALDECK); + bool flag = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.LAST_BATTLE_IS_DEFDECK); + if (!num && !flag) + { + Format[] oTHER_CATEGORY_FORMATS = OTHER_CATEGORY_FORMATS; + foreach (Format format in oTHER_CATEGORY_FORMATS) + { + if (deckGroupListData.IsExistDeckListByFormat(format)) + { + defaultFormat = format; + break; + } + } + } + } + if (formatChangeUIType != eFormatChangeUIType.SingleFormat && !deckGroupListData.IsExistDeckListByFormat(defaultFormat)) + { + defaultFormat = deckGroupListData.DeckGroupList.FirstOrDefault((DeckGroup deckGroup) => deckGroup.DeckDataList.Any((DeckData deck) => !deck.IsNoCard()))?.DeckFormat ?? Format.Rotation; + } + FormatChangeUI.FormatCategory formatCategoryByFormat = GetFormatCategoryByFormat(defaultFormat, formatChangeUIType == eFormatChangeUIType.UseOtherCategory); + DeckSelectUIDialog deckSelectUIDialog = new DeckSelectUIDialog(dialogTitle, deckGroupListData, defaultFormat, formatCategoryByFormat, formatChangeUIType, isVisibleCreateNew, OnSelectDeck, initOptions); + deckSelectUIDialog.CreateFormatChangeUI(formatCategoryByFormat, formatChangeUIType); + return deckSelectUIDialog; + } + + private DeckSelectUIDialog(string dialogTitle, DeckGroupListData deckGroupListData, Format format, FormatChangeUI.FormatCategory formatCategory, eFormatChangeUIType formatChangeUIType, bool isVisibleCreateNew, Action OnSelectDeck, DeckSelectUI.InitOptions initOptions) + { + DeckSelectUIDialog deckSelectUIDialog = this; + _isVisibleCreateNew = isVisibleCreateNew; + _deckGroupListData = deckGroupListData; + Dialog = UIManager.GetInstance().CreateDialogClose(); + Dialog.SetTitleLabel(dialogTitle); + Dialog.SetSize(DialogBase.Size.XL); + Dialog.SetButtonLayout(DialogBase.ButtonLayout.NONE); + Dialog.SetActive(inActive: false); + int? longTextPositionOverride = initOptions?.LongTextTitlePosition; + _deckSelectDialogTitleUI = DeckSelectUIDialogTitle.Create(Dialog, dialogTitle, format, formatChangeUIType != eFormatChangeUIType.SingleFormat, longTextPositionOverride); + List deckGroupList = GetDeckGroupList(formatCategory); + GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/DeckList/DeckSelectUI/DeckSelectUI")) as GameObject; + _deckSelectUI = gameObject.GetComponent(); + _deckSelectUI.gameObject.SetActive(value: false); + _deckSelectUI.Initialize(deckGroupList, format, isVisibleCreateNew, delegate(DeckData deck) + { + OnSelectDeck.Call(deckSelectUIDialog.Dialog, deck); + }, delegate(Format changeFormat) + { + deckSelectUIDialog._deckSelectDialogTitleUI.UpdateFormatObj(changeFormat); + }, delegate + { + deckSelectUIDialog.Dialog.SetActive(inActive: true); + deckSelectUIDialog._deckSelectUI.gameObject.SetActive(value: true); + }, initOptions); + Dialog.SetObj(_deckSelectUI.gameObject); + _deckSelectUI.gameObject.GetComponent().alpha = 1f; + } + + public void Close() + { + if (Dialog != null) + { + Dialog.Close(); + } + } + + public static string GetTitleByBattleType(DataMgr.BattleType battleType) + { + string result = string.Empty; + switch (battleType) + { + case DataMgr.BattleType.FreeBattle: + result = Data.SystemText.Get("Battle_0005"); + break; + case DataMgr.BattleType.RankBattle: + result = Data.SystemText.Get("Battle_0006"); + break; + case DataMgr.BattleType.RoomBattle: + case DataMgr.BattleType.RoomTwoPick: + result = Data.SystemText.Get("Battle_0007"); + break; + case DataMgr.BattleType.ColosseumNormal: + case DataMgr.BattleType.ColosseumHof: + result = Data.SystemText.Get("Battle_0488"); + break; + } + return result; + } + + public void UpdateAllDeckUICurrentPage() + { + _deckSelectUI.UpdateAllDeckUICurrentPage(); + } + + public void ShowCautionText(string cautionText) + { + _deckSelectUI.ShowCautionText(cautionText); + } + + public void SetPanelDepth(int depth) + { + Dialog.SetPanelDepth(depth); + _deckSelectUI.GetComponent().depth = ++depth; + } + + private void CreateFormatChangeUI(FormatChangeUI.FormatCategory defaultFormatCategory, eFormatChangeUIType formatChangeUIType) + { + if (formatChangeUIType != eFormatChangeUIType.SingleFormat) + { + FormatChangeUI.FormatCategory anotherFormatCategory = FormatChangeUI.FormatCategory.Invalid; + switch (formatChangeUIType) + { + case eFormatChangeUIType.NormalFormatOnly: + anotherFormatCategory = FormatChangeUI.FormatCategory.Invalid; + break; + case eFormatChangeUIType.UseOtherCategory: + anotherFormatCategory = FormatChangeUI.FormatCategory.Other; + break; + case eFormatChangeUIType.WithPrerotation: + anotherFormatCategory = FormatChangeUI.FormatCategory.PreRotation; + break; + case eFormatChangeUIType.WithCrossover: + anotherFormatCategory = FormatChangeUI.FormatCategory.Crossover; + break; + case eFormatChangeUIType.WithMyRotation: + anotherFormatCategory = FormatChangeUI.FormatCategory.MyRotation; + break; + } + FormatChangeUI formatChangeUI = FormatChangeUI.Create(defaultFormatCategory, anotherFormatCategory, OnClickChangeFormatBtn); + Dialog.AttachObjToTitleLabel(formatChangeUI.gameObject, FORMAT_CHANGE_UI_POSITION); + } + } + + private void OnClickChangeFormatBtn(FormatChangeUI.FormatCategory formatCategory) + { + Format formatByFormatCategory = GetFormatByFormatCategory(formatCategory); + _deckSelectUI.gameObject.SetActive(value: false); + List deckGroupList = GetDeckGroupList(formatCategory); + _deckSelectUI.UpdateDeckView(deckGroupList, formatByFormatCategory, _isVisibleCreateNew, delegate + { + _deckSelectUI.gameObject.SetActive(value: true); + }); + } + + private List GetDeckGroupList(FormatChangeUI.FormatCategory formatCategory) + { + List list = new List(); + if (formatCategory == FormatChangeUI.FormatCategory.Other) + { + Format[] oTHER_CATEGORY_FORMATS = OTHER_CATEGORY_FORMATS; + foreach (Format format in oTHER_CATEGORY_FORMATS) + { + list.AddRange(_deckGroupListData.SelectDeckGroupList(format)); + } + } + else + { + Format formatByFormatCategory = GetFormatByFormatCategory(formatCategory); + list.AddRange(_deckGroupListData.SelectDeckGroupList(formatByFormatCategory)); + } + return list; + } + + private static Format GetFormatByFormatCategory(FormatChangeUI.FormatCategory formatCategory) + { + return FORMAT_CATEGORY_TO_FORMAT[formatCategory]; + } + + private static FormatChangeUI.FormatCategory GetFormatCategoryByFormat(Format format, bool useOtherCategory) + { + if (useOtherCategory && IsIncludeInOtherCategory(format)) + { + return FormatChangeUI.FormatCategory.Other; + } + FormatChangeUI.FormatCategory result = FormatChangeUI.FormatCategory.Invalid; + foreach (KeyValuePair item in FORMAT_CATEGORY_TO_FORMAT) + { + if (item.Value == format) + { + result = item.Key; + break; + } + } + return result; + } + + private static bool IsIncludeInOtherCategory(Format format) + { + return OTHER_CATEGORY_FORMATS.Any((Format f) => f == format); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckSelectUIDialogTitle.cs b/SVSim.BattleEngine/Engine/Wizard/DeckSelectUIDialogTitle.cs new file mode 100644 index 0000000..6f233da --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckSelectUIDialogTitle.cs @@ -0,0 +1,194 @@ +using System.Collections; +using UnityEngine; + +namespace Wizard; + +public class DeckSelectUIDialogTitle : MonoBehaviour +{ + private const string PATH_DECK_SELECT_UI_DIALOG_TITLE_PREFAB = "UI/DeckList/DeckSelectUI/DeckSelectUIDialogTitle"; + + private const string FORMAT_ICON_ROTATION = "icon_timesliprotation_s"; + + private const string FORMAT_ICON_UNLIMITED = "icon_unlimited_s"; + + private const string FORMAT_ICON_PRE_ROTATION = "icon_prerotation_s"; + + private const string FORMAT_ICON_CROSSOVER = "icon_crossover_s"; + + private const string FORMAT_ICON_MYROTATION = "icon_myrotation_s"; + + private const string FORMAT_ICON_AVATAR = "icon_heroesbattle_s"; + + private static readonly Color32 FORMAT_COLOR_ROTATION = new Color32(43, 39, 144, byte.MaxValue); + + private static readonly Color32 FORMAT_COLOR_UNLIMITED = new Color32(125, 60, 37, byte.MaxValue); + + private static readonly Color32 FORMAT_COLOR_PRE_ROTATION = new Color32(23, 111, 40, byte.MaxValue); + + private static readonly Color32 FORMAT_COLOR_CROSSOVER = new Color32(156, 55, 140, byte.MaxValue); + + private static readonly Color32 FORMAT_COLOR_MYROTATION = new Color32(184, 25, 70, byte.MaxValue); + + private static readonly Color32 FORMAT_COLOR_AVATAR = new Color32(147, 140, 19, byte.MaxValue); + + [SerializeField] + private GameObject _titleUIRoot; + + [SerializeField] + private UILabel _deckListTitleLabel; + + [SerializeField] + private UITable _formatTable; + + [SerializeField] + private UILabel _formatLabel; + + [SerializeField] + private UISprite _formatIcon; + + [SerializeField] + private UISprite _formatDecorationSprite; + + [SerializeField] + private int _tableBorderLine; + + private Format _format; + + private Vector3 _tableFirstPosition; + + private bool _isFirstUpdateTablePosition = true; + + private int? _longTextPositionOverride; + + private bool _isExistFormatChangeUI; + + public static DeckSelectUIDialogTitle Create(DialogBase dialog, string titleText, Format defaultFormat, bool isExistFormatChangeUI, int? longTextPositionOverride) + { + DeckSelectUIDialogTitle component = (Object.Instantiate(Resources.Load("UI/DeckList/DeckSelectUI/DeckSelectUIDialogTitle")) as GameObject).GetComponent(); + component.Initialize(dialog, titleText, defaultFormat, isExistFormatChangeUI, longTextPositionOverride); + return component; + } + + private void Initialize(DialogBase dialog, string titleText, Format defaultFormat, bool isExistFormatChangeUI, int? longTextPositionOverride) + { + _longTextPositionOverride = longTextPositionOverride; + _isExistFormatChangeUI = isExistFormatChangeUI; + _deckListTitleLabel.InitializeFont(); + _formatLabel.InitializeFont(); + _deckListTitleLabel.text = titleText; + dialog.AttachObjToTitleLabel(_titleUIRoot, Vector3.zero); + dialog.SetTitleLabelActive(active: false); + UpdateFormatObj(defaultFormat); + } + + public void UpdateFormatObj(Format format) + { + _format = format; + switch (format) + { + case Format.Rotation: + SetActiveFormatObjs(isActive: true); + _formatIcon.spriteName = "icon_timesliprotation_s"; + _formatLabel.text = Data.SystemText.Get("Common_0154"); + _formatDecorationSprite.color = FORMAT_COLOR_ROTATION; + break; + case Format.PreRotation: + SetActiveFormatObjs(isActive: true); + _formatIcon.spriteName = "icon_prerotation_s"; + _formatLabel.text = Data.SystemText.Get("Common_0163"); + _formatDecorationSprite.color = FORMAT_COLOR_PRE_ROTATION; + break; + case Format.Unlimited: + SetActiveFormatObjs(isActive: true); + _formatIcon.spriteName = "icon_unlimited_s"; + _formatLabel.text = Data.SystemText.Get("Common_0155"); + _formatDecorationSprite.color = FORMAT_COLOR_UNLIMITED; + break; + case Format.Crossover: + SetActiveFormatObjs(isActive: true); + _formatIcon.spriteName = "icon_crossover_s"; + _formatLabel.text = Data.SystemText.Get("Common_0166"); + _formatDecorationSprite.color = FORMAT_COLOR_CROSSOVER; + break; + case Format.MyRotation: + SetActiveFormatObjs(isActive: true); + _formatIcon.spriteName = "icon_myrotation_s"; + _formatLabel.text = Data.SystemText.Get("Common_0178"); + _formatDecorationSprite.color = FORMAT_COLOR_MYROTATION; + break; + case Format.Avatar: + SetActiveFormatObjs(isActive: true); + _formatIcon.spriteName = "icon_heroesbattle_s"; + _formatLabel.text = Data.SystemText.Get("HeroesBattle_0001"); + _formatDecorationSprite.color = FORMAT_COLOR_AVATAR; + break; + default: + SetActiveFormatObjs(isActive: false); + break; + } + _formatTable.Reposition(); + if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.QuestSelectionPage)) + { + _deckListTitleLabel.color = LabelDefine.TEXT_COLOR_NORMAL; + _formatLabel.color = LabelDefine.TEXT_COLOR_NORMAL; + if (format == Format.Unlimited || format == Format.Rotation) + { + AllLabelColorChanger.ChangeAllLabel(_formatTable.gameObject, AllLabelColorChanger.COLOR_TABLE_DECK_SELECTION_ROTATION_UNLIMITED); + } + else + { + AllLabelColorChanger.ChangeAllLabel(_formatTable.gameObject); + } + } + UpdateTablePosition(); + } + + private IEnumerator UpdateTableCoroutine() + { + yield return null; + UpdateTablePosition(); + } + + [ContextMenu("UpdateTablePosition")] + public void UpdateTablePosition() + { + Bounds bounds = NGUIMath.CalculateRelativeWidgetBounds(_formatTable.transform); + if (bounds.size.x < 1f) + { + UIManager.GetInstance().StartCoroutine(UpdateTableCoroutine()); + return; + } + if (_isFirstUpdateTablePosition) + { + _isFirstUpdateTablePosition = false; + _tableFirstPosition = _formatTable.transform.localPosition; + } + _formatTable.transform.localPosition = _tableFirstPosition; + if (!_isExistFormatChangeUI) + { + return; + } + if ((int)bounds.size.x <= _tableBorderLine) + { + if (_longTextPositionOverride.HasValue && _format == Format.Rotation) + { + _formatTable.transform.localPosition = new Vector3(_longTextPositionOverride.Value, _tableFirstPosition.y, _tableFirstPosition.z); + } + } + else if (_longTextPositionOverride.HasValue) + { + _formatTable.transform.localPosition = new Vector3(_longTextPositionOverride.Value, _tableFirstPosition.y, _tableFirstPosition.z); + } + else + { + _formatTable.transform.localPosition = _tableFirstPosition + new Vector3(bounds.size.x - (float)_tableBorderLine, 0f, 0f); + } + } + + private void SetActiveFormatObjs(bool isActive) + { + _formatIcon.gameObject.SetActive(isActive); + _formatLabel.gameObject.SetActive(isActive); + _formatDecorationSprite.gameObject.SetActive(isActive); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DegreeHelper.cs b/SVSim.BattleEngine/Engine/Wizard/DegreeHelper.cs new file mode 100644 index 0000000..4dc18b7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DegreeHelper.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class DegreeHelper +{ + public enum DegreeType + { + SMALL, + MIDDLE + } + + private static ResourcesManager.AssetLoadPathType GetResourceType(DegreeType type) + { + if (type == DegreeType.SMALL) + { + return ResourcesManager.AssetLoadPathType.Degree_S; + } + return ResourcesManager.AssetLoadPathType.Degree_M; + } + + private static ResourcesManager.AssetLoadPathType GetMaterialType(DegreeType type) + { + if (type == DegreeType.SMALL) + { + return ResourcesManager.AssetLoadPathType.DegreeMaterial_S; + } + return ResourcesManager.AssetLoadPathType.DegreeMaterial_M; + } + + public static List GetDegreeResourceList(long id, DegreeType type, bool isFetch) + { + List list = new List(); + list.Add(GetDegreePath(id, type, isFetch)); + if (Data.Master.DegreeMgr.Get((int)id).IsPremium) + { + list.Add(GetDegreeMaterialPath(id, type, isFetch)); + list.Add(GetMaskPath(id, isFetch)); + } + return list; + } + + private static string GetDegreePath(long id, DegreeType type, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(id.ToString("0000"), GetResourceType(type), isFetch); + } + + private static string GetDegreeMaterialPath(long id, DegreeType type, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(id.ToString("0000"), GetMaterialType(type), isFetch); + } + + private static string GetMaskPath(long id, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(id.ToString("0000"), ResourcesManager.AssetLoadPathType.DegreeMask, isFetch); + } + + public static void InitializeDegree(UITexture texture, long id, DegreeType type) + { + string degreePath = GetDegreePath(id, type, isFetch: true); + texture.mainTexture = Toolbox.ResourcesManager.LoadObject(degreePath); + if (Data.Master.DegreeMgr.Get((int)id).IsPremium) + { + string degreeMaterialPath = GetDegreeMaterialPath(id, type, isFetch: true); + texture.material = Toolbox.ResourcesManager.LoadObject(degreeMaterialPath); + Texture value = Toolbox.ResourcesManager.LoadObject(GetMaskPath(id, isFetch: true)); + texture.material.SetTexture("_MaskTex", value); + } + else + { + texture.material = null; + } + } + + public static void LoadInstant(UITexture texture, long id, DegreeType type, Action> onFinish) + { + List path = GetDegreeResourceList(id, type, isFetch: false); + UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupSync(path, delegate + { + InitializeDegree(texture, id, type); + onFinish(path); + })); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DialogCreator.cs b/SVSim.BattleEngine/Engine/Wizard/DialogCreator.cs new file mode 100644 index 0000000..3f0b08c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DialogCreator.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.Lottery; +using Wizard.Scripts.Network.Data.TaskData.Arena; + +namespace Wizard; + +public static class DialogCreator +{ + public static DialogBase CreateRewardReceiveDialog(List rewardList) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetLayer("Loading"); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("Mail_0021")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + RewardBase component = NGUITools.AddChild(dialogBase.gameObject, Resources.Load("UI/layoutParts/StoryRewardPanel")).GetComponent(); + for (int i = 0; i < rewardList.Count; i++) + { + component.AddReward(rewardList[i]); + } + component.EndCreate(); + dialogBase.SetObj(component.gameObject); + dialogBase.OnClose = delegate + { + List cardListAssetPathList = Toolbox.ResourcesManager.CardListAssetPathList; + if (cardListAssetPathList.Count > 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(cardListAssetPathList); + cardListAssetPathList.Clear(); + } + }; + return dialogBase; + } + + public static DialogBase CreateSupplyReceiveDialog(List supplyList) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_BuyCard_004_Title")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + RewardBase component = NGUITools.AddChild(dialogBase.gameObject, Resources.Load("UI/layoutParts/StoryRewardPanel")).GetComponent(); + for (int i = 0; i < supplyList.Count; i++) + { + component.AddReward(supplyList[i]); + } + component.EndCreate(); + dialogBase.SetObj(component.gameObject); + return dialogBase; + } + + public static CardDetailUI CreateCardDetailDialog(GameObject rootObject, string layerName) + { + CardDetailUI component = NGUITools.AddChild(rootObject, Resources.Load("UI/CardDetail")).GetComponent(); + component.Initialize(LayerMask.NameToLayer(layerName), CardMaster.CardMasterId.Default); + return component; + } + + public static UICardList CreateDeckViewerDialog(GameObject rootObject) + { + CardDetailUI cardDetailUI = CreateCardDetailDialog(rootObject, "Detail"); + cardDetailUI.gameObject.SetActive(value: false); + UICardList deckViewerDialog = NGUITools.AddChild(rootObject, Resources.Load("UI/UICardList")).GetComponent(); + deckViewerDialog.Init(rootObject, cardDetailUI, string.Empty, delegate + { + deckViewerDialog.SetActive(in_Active: false); + }, "Detail", in_DetailCameraUse: true); + deckViewerDialog.SetActive(in_Active: false); + return deckViewerDialog; + } + + public static DialogBase CreateStageSelectDialog() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Common_0021")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetObj(NGUITools.AddChild(dialogBase.gameObject, Resources.Load("UI/DeckList/StageSelect"))); + return dialogBase; + } + + public static void ShowCpAppliedDialog(LotteryApplyData lotteryData, Action onFinish) + { + if (!lotteryData.IsEnable) + { + onFinish.Call(); + return; + } + UIManager.GetInstance().LoadingViewManager.CreateInSceneCenter(); + string path = LotteryApplyDialog.GetLotteryTexturePath(lotteryData, isFetch: false); + UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetAsync(path, delegate + { + UIManager.GetInstance().closeInSceneCenterLoading(); + LotteryApplyDialog.Create(lotteryData, autoClose: false).OnClose = delegate + { + onFinish.Call(); + Toolbox.ResourcesManager.RemoveAsset(path); + }; + })); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DialogItemPurchase.cs b/SVSim.BattleEngine/Engine/Wizard/DialogItemPurchase.cs new file mode 100644 index 0000000..2b5f209 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DialogItemPurchase.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace Wizard; + +public class DialogItemPurchase : MonoBehaviour +{ + [SerializeField] + private ItemPurchase itemPurchaseOriginal; + + public void CreateItemPurcahseDialog() + { + ItemPurchase itemPurchase = Object.Instantiate(itemPurchaseOriginal); + itemPurchase.Init(delegate + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetObj(itemPurchase.gameObject); + dialogBase.SetTitleLabel(Data.SystemText.Get("Shop_0128")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + }); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DialogSubText.cs b/SVSim.BattleEngine/Engine/Wizard/DialogSubText.cs new file mode 100644 index 0000000..174e2ff --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DialogSubText.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +namespace Wizard; + +public class DialogSubText : MonoBehaviour +{ + [SerializeField] + private UILabel _labelSubText; + + public UILabel LabelSubText => _labelSubText; + + public void SetSubText(string text) + { + _labelSubText.text = text; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DisableLethalCheckPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/DisableLethalCheckPolicyCollection.cs new file mode 100644 index 0000000..19e2ae2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DisableLethalCheckPolicyCollection.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class DisableLethalCheckPolicyCollection : AIPolicyCollection +{ + public bool IsDisableLethalCheck(AIVirtualField field, List playPtn) + { + if (!base.HasPolicy) + { + return false; + } + AIVirtualCard allyClass = field.AllyClass; + for (int i = 0; i < base.PolicyList.Count; i++) + { + if (base.PolicyList[i].CheckCondition(allyClass, playPtn, field, null)) + { + return true; + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DiscardedVirtualCard.cs b/SVSim.BattleEngine/Engine/Wizard/DiscardedVirtualCard.cs new file mode 100644 index 0000000..31ddf3b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DiscardedVirtualCard.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class DiscardedVirtualCard : AIVirtualCard +{ + public DiscardedVirtualCard(BattleCardBase card, AIVirtualField field) + { + _field = field; + base.IsAlly = true; + InitializeFromBattleCardBase(card); + } + + public override bool IsFollower(List playPtn) + { + return IsUnit; + } + + protected override void InitializeFromBattleCardBase(BattleCardBase origin) + { + InitializeFromBattleCardBaseBasic(origin); + Cost = origin.Cost; + IsPlayer = origin.IsPlayer; + IsLeader = false; + IsSelfTurn = origin.IsSelfTurn; + base.DestroyedTurn = origin.DestroyedTurn; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DrumrollDialog.cs b/SVSim.BattleEngine/Engine/Wizard/DrumrollDialog.cs new file mode 100644 index 0000000..4e6c491 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DrumrollDialog.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class DrumrollDialog : UIBase +{ + [SerializeField] + private UtilityDrumrollScroll _drumroll; + + public int CurrentIndex => _drumroll.CurrentIndex; + + public static DialogBase Create(List textList, int defaultIndex, Action selectCallback, Action createCallback = null, Action decideCallBack = null, string dialogTitle = "") + { + return Create(UnityEngine.Object.Instantiate(UIManager.GetInstance().DrumrollDialogPrefab), textList, defaultIndex, selectCallback, createCallback, decideCallBack, dialogTitle); + } + + public static DialogBase Create(DrumrollDialog drumroll, List textList, int defaultIndex, Action selectCallback, Action createCallback = null, Action decideCallBack = null, string dialogTitle = "") + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + if (dialogTitle.IsNotNullOrEmpty()) + { + dialogBase.SetTitleLabel(dialogTitle); + } + dialogBase.SetObj(drumroll.gameObject); + drumroll.CreateDrumroll(textList, defaultIndex, selectCallback, createCallback); + dialogBase.onPushButton1 = delegate + { + decideCallBack.Call(drumroll.CurrentIndex); + }; + return dialogBase; + } + + private void CreateDrumroll(List textList, int defaultIndex, Action selectCallback, Action createCallback = null) + { + StartCoroutine(_drumroll.CreateDrumrollScroll_Coroutine(textList, defaultIndex, selectCallback, createCallback)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/EffectUtility.cs b/SVSim.BattleEngine/Engine/Wizard/EffectUtility.cs new file mode 100644 index 0000000..70a90ea --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/EffectUtility.cs @@ -0,0 +1,21 @@ +using Cute; +using UnityEngine; + +namespace Wizard; + +public static class EffectUtility +{ + public static GameObject CreateEffect2D(Effect2dCreateParam param) + { + GameObject prefab = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(param.EffectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject; + GameObject gameObject = NGUITools.AddChild(param.Parent, prefab); + gameObject.transform.localScale /= UIManager.GetInstance().UIManagerRoot.transform.localScale.x; + if (param.ColorCode.HasValue) + { + MotionUtils.ChangeParticleSystemColor(gameObject, ColorCode.Get(param.ColorCode.Value)); + } + param.UnloadAssetList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(gameObject, param.MaterialSetEndCallback)); + gameObject.SetActive(param.InitActive); + return gameObject; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/EmoOnLeaderDamagedPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/EmoOnLeaderDamagedPolicyCollection.cs new file mode 100644 index 0000000..024161e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/EmoOnLeaderDamagedPolicyCollection.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class EmoOnLeaderDamagedPolicyCollection : AIPolicyCollection +{ + public int GetEmoOnLeaderDamaged(AIVirtualField field) + { + if (!base.HasPolicy) + { + return -1; + } + AIVirtualCard allyClass = field.AllyClass; + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(allyClass, emptyPlayPtn, field, null)) + { + int num = (int)aIPolicyData.EvalArg(allyClass, emptyPlayPtn, field); + if (num >= 0) + { + return num; + } + } + } + return -1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/EmoOnTurnEndPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/EmoOnTurnEndPolicyCollection.cs new file mode 100644 index 0000000..ac875ec --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/EmoOnTurnEndPolicyCollection.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class EmoOnTurnEndPolicyCollection : AIPolicyCollection +{ + public int GetEmoOnTurnEnd(AIVirtualField field, bool isAllyTurn) + { + if (base.HasPolicy) + { + AIVirtualCard allyClass = field.AllyClass; + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(allyClass, emptyPlayPtn, field, null)) + { + int emoteIdIfSideIsCorrect = (aIPolicyData.Argument as AIEmoteOnTurnTransition).GetEmoteIdIfSideIsCorrect(isAllyTurn); + if (emoteIdIfSideIsCorrect >= 0) + { + return emoteIdIfSideIsCorrect; + } + } + } + } + return -1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/EmoOnTurnStartPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/EmoOnTurnStartPolicyCollection.cs new file mode 100644 index 0000000..cf62c14 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/EmoOnTurnStartPolicyCollection.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class EmoOnTurnStartPolicyCollection : AIPolicyCollection +{ + public int GetEmoOnTurnStart(AIVirtualField field, bool isAllyTurn) + { + if (!base.HasPolicy) + { + return -1; + } + AIVirtualCard allyClass = field.AllyClass; + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(allyClass, emptyPlayPtn, field, null)) + { + int emoteIdIfSideIsCorrect = (aIPolicyData.Argument as AIEmoteOnTurnTransition).GetEmoteIdIfSideIsCorrect(isAllyTurn); + if (emoteIdIfSideIsCorrect >= 0) + { + return emoteIdIfSideIsCorrect; + } + } + } + return -1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/EmptyDeckInfo.cs b/SVSim.BattleEngine/Engine/Wizard/EmptyDeckInfo.cs new file mode 100644 index 0000000..1c19086 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/EmptyDeckInfo.cs @@ -0,0 +1,18 @@ +namespace Wizard; + +public class EmptyDeckInfo +{ + public int EmptyDeckID { get; set; } + + public bool CanDeckCreate + { + get + { + if (EmptyDeckID <= 0) + { + return false; + } + return true; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/EncryptData.cs b/SVSim.BattleEngine/Engine/Wizard/EncryptData.cs new file mode 100644 index 0000000..b0ed341 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/EncryptData.cs @@ -0,0 +1,5 @@ +namespace Wizard; + +public class EncryptData +{ +} diff --git a/SVSim.BattleEngine/Engine/Wizard/EnemyAINull.cs b/SVSim.BattleEngine/Engine/Wizard/EnemyAINull.cs new file mode 100644 index 0000000..2e30043 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/EnemyAINull.cs @@ -0,0 +1,83 @@ +using System.Collections.Generic; +using Wizard.Battle.View.Vfx; + +namespace Wizard; + +public class EnemyAINull : IEnemyAI +{ + public bool IsStackAction => false; + + public bool IsConnectNetwork => false; + + public bool IsAIExecution => false; + + public void ExecuteEnemyAI(bool useWait) + { + } + + public void StopEnemyAI() + { + } + + public void InitOnGame(BattlePlayerBase selfBattlePlayer, BattlePlayerBase opponentBattlePlayer) + { + } + + public void Mulligan(List dstList, BattlePlayerBase selfBattlePlayer, BattlePlayerBase opponentBattlePlayer) + { + } + + public void SelectSkillTarget(AIVirtualCard actCard, AIOperationType operationType, AISinglePlayptnRecord playptnRecord) + { + } + + public float CalcFieldAdvantage() + { + return 0f; + } + + public float Atk_EvaluateBattleCardOnErase(BattleCardBase card, List playPtn, bool useStyle) + { + return 0f; + } + + public float Atk_EvaluateBattleCardOnReturn(BattleCardBase card, List playPtn, int restPp, bool useStyle) + { + return 0f; + } + + public IAIEmoteCtrl EmoteCtrl() + { + return new AIEmoteCtrlNull(); + } + + public void TurnEnd() + { + } + + public void Retire() + { + } + + public void Disconnect() + { + } + + public void Reconnect() + { + } + + public void CleanupStackedAction() + { + } + + public bool SetUpBattleState(int classId, AI_LOGIC_LV logicLv, string deckName, string styleName, string emoteName, int enemyAiID = -1) + { + return true; + } + + public VfxBase GetEmote(AIEmoteCmdType cmdType, AISituationInfo situation = null, ClassCharaPrm.EmotionType receivedEmoteType = ClassCharaPrm.EmotionType.NULL, int emoteInput = -1) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/EnemyAIUtil.cs b/SVSim.BattleEngine/Engine/Wizard/EnemyAIUtil.cs new file mode 100644 index 0000000..513a5bc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/EnemyAIUtil.cs @@ -0,0 +1,409 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard.Battle; + +namespace Wizard; + +internal static class EnemyAIUtil +{ + private class SelectableInfo + { + public List Cards; + + public int Count; + + public SelectableInfo(List cards, int count) + { + Cards = cards; + Count = count; + } + } + + public const int TempDeckNo = 36; + + public const int SERIES_ID = 25; + + private const int RETRY_MAX = 100; + + private const int LOOP_MAX = 10; + + private static System.Random _rnd = new System.Random(); + + public static bool IsSameVirtualCardList(List right, List left) + { + if (right.Count != left.Count) + { + return false; + } + for (int i = 0; i < right.Count; i++) + { + if (!right[i].IsSameCard(left[i])) + { + return false; + } + } + return true; + } + + public static List GetAllMoves(BattlePlayerPair pair) + { + List list = new List(); + List playMoves = GetPlayMoves(pair); + List attackMoves = GetAttackMoves(pair); + List evolveMoves = GetEvolveMoves(pair); + List fusionMoves = GetFusionMoves(pair); + for (int i = 0; i < playMoves.Count; i++) + { + list.Add(playMoves[i]); + } + for (int j = 0; j < attackMoves.Count; j++) + { + list.Add(attackMoves[j]); + } + for (int k = 0; k < evolveMoves.Count; k++) + { + list.Add(evolveMoves[k]); + } + for (int l = 0; l < fusionMoves.Count; l++) + { + list.Add(fusionMoves[l]); + } + list.Add(new AITurnEndMove()); + return list; + } + + public static List GetFusionMoves(BattlePlayerPair pair) + { + List list = new List(); + foreach (BattleCardBase handCard in pair.Self.HandCardList) + { + if (!handCard.IsFusionable) + { + continue; + } + List> targetsList = GetTargetsList(handCard.GetSelectTypeSkill(isEvolve: false, isFusion: true), pair, handCard, isFusion: true); + if (targetsList != null) + { + for (int i = 0; i < targetsList.Count; i++) + { + List targets = targetsList[i]; + list.Add(new AIFusionMove(handCard, targets)); + } + } + } + return list; + } + + public static List GetEvolveMoves(BattlePlayerPair pair) + { + List list = new List(); + foreach (BattleCardBase inPlayCard in pair.Self.InPlayCards) + { + if (!inPlayCard.IsUnit || !inPlayCard.CanEvolution(isSkill: false, isSelfBattlePlayer: true)) + { + continue; + } + List> targetsList = GetTargetsList(inPlayCard.EvolutionSkills, pair, inPlayCard); + if (targetsList != null) + { + for (int i = 0; i < targetsList.Count; i++) + { + List targets = targetsList[i]; + list.Add(new AIEvolMove(inPlayCard, targets)); + } + } + else + { + list.Add(new AIEvolMove(inPlayCard, null)); + } + } + return list; + } + + public static List GetAttackMoves(BattlePlayerPair pair) + { + List list = new List(); + foreach (BattleCardBase inPlayCard in pair.Self.InPlayCards) + { + if (!inPlayCard.Attackable) + { + continue; + } + foreach (BattleCardBase classAndInPlayCard in pair.Opponent.ClassAndInPlayCardList) + { + if (AttackSelectControl.CanCardAttackTarget(inPlayCard, classAndInPlayCard, pair.Opponent.InPlayCards)) + { + list.Add(new AIAttackMove(inPlayCard, classAndInPlayCard)); + } + } + } + return list; + } + + public static List GetPlayMoves(BattlePlayerPair pair, bool isCheckOnDraw = true) + { + List list = new List(); + foreach (BattleCardBase handCard in pair.Self.HandCardList) + { + if (!handCard.Movable(isCheckOnDraw)) + { + continue; + } + IEnumerable enumerable = null; + if (handCard.IsMutationPlayPp(handCard.SelfBattlePlayer.Pp)) + { + Skill_transform accelerateOrCrystallizeTransformSkill = handCard.GetAccelerateOrCrystallizeTransformSkill(); + if (accelerateOrCrystallizeTransformSkill != null) + { + enumerable = handCard.SelfBattlePlayer.BattleMgr.CreateTransformCardRegisterVfx(accelerateOrCrystallizeTransformSkill.SkillPrm.ownerCard, accelerateOrCrystallizeTransformSkill.TransformId, accelerateOrCrystallizeTransformSkill.SkillPrm.ownerCard.IsPlayer).GetSelectTypeSkill(); + } + } + if (enumerable == null) + { + enumerable = handCard.GetSelectTypeSkill(); + } + List> targetsList = GetTargetsList(enumerable, pair, handCard); + if (targetsList != null) + { + for (int i = 0; i < targetsList.Count; i++) + { + List targets = targetsList[i]; + list.Add(new AIPlayMove(handCard, targets)); + } + } + else + { + list.Add(new AIPlayMove(handCard, null)); + } + } + return list; + } + + private static List> GetTargetsList(IEnumerable skills, BattlePlayerPair pair, BattleCardBase card, bool isFusion = false) + { + List selectablesList = GetSelectablesList(skills, pair, card); + Dictionary> dictionary = new Dictionary>(); + foreach (SkillBase skill in skills) + { + if (!skill.IsChoiceType || !card.Skills.HaveChoiceTransformSkill()) + { + continue; + } + IEnumerable skillUserSelectableTargets = ActionProcessor.GetSkillUserSelectableTargets(skill, pair); + if (skillUserSelectableTargets == null) + { + continue; + } + foreach (BattleCardBase item in skillUserSelectableTargets) + { + dictionary[item.Index] = GetSelectablesList(item.GetSelectTypeSkill(), pair, item); + } + } + if (selectablesList.Count > 0) + { + List> list = new List>(); + SetupTargetsList(0, new List(), selectablesList, dictionary, list, isFusion); + return list; + } + return null; + } + + private static List GetSelectablesList(IEnumerable skills, BattlePlayerPair pair, BattleCardBase card) + { + List list = new List(); + foreach (SkillBase skill in skills) + { + if (skill.IsBurialRite) + { + List burialRiteTarget = SkillPreprocessBurialRite.GetBurialRiteTarget(card.SelfBattlePlayer, card); + if (burialRiteTarget != null && burialRiteTarget.Count > 0) + { + list.Add(new SelectableInfo(burialRiteTarget, 1)); + } + } + if (skill.IsUserSelectType) + { + IEnumerable skillUserSelectableTargets = ActionProcessor.GetSkillUserSelectableTargets(skill, pair); + int num = 1; + if (skillUserSelectableTargets != null) + { + num = Mathf.Min(skill.GetSkillSelectCount(), skillUserSelectableTargets.Count()); + list.Add(new SelectableInfo(new List(skillUserSelectableTargets), num)); + } + } + if (!skill.IsChoiceType) + { + continue; + } + IEnumerable skillUserSelectableTargets2 = ActionProcessor.GetSkillUserSelectableTargets(skill, pair); + if (skillUserSelectableTargets2 == null) + { + continue; + } + List list2 = new List(); + foreach (BattleCardBase item in skillUserSelectableTargets2) + { + card = card.SelfBattlePlayer.BattleMgr.CreateTransformCardRegisterVfx(card, item.CardId, card.SelfBattlePlayer.IsPlayer); + list2.Add(card); + } + int count = 1; + if (skill.ApplySelectFilter is SkillChoiceSelectFilter) + { + count = Math.Max(1, skill.ApplySelectFilter.CalcCount(skill.OptionValue)); + } + list.Add(new SelectableInfo(list2, count)); + } + return list; + } + + private static void SetupTargetsList(int depth, List currentList, List selectablesList, Dictionary> choiceSelectableList, List> out_targetsList, bool isFusion = false) + { + if (depth == selectablesList.Count) + { + out_targetsList.Add(new List(currentList)); + return; + } + SelectableInfo selectableInfo = selectablesList[depth]; + if (isFusion) + { + int num = (1 << selectableInfo.Cards.Count) - 1; + for (int i = 1; i <= num; i++) + { + int num2 = i; + int num3 = 0; + for (int j = 0; j < selectableInfo.Cards.Count; j++) + { + BattleCardBase item = selectableInfo.Cards[j]; + if (((num2 >> j) & 1) > 0) + { + currentList.Add(item); + num3++; + } + } + SetupTargetsList(depth + 1, currentList, selectablesList, choiceSelectableList, out_targetsList, isFusion: true); + for (int k = 0; k < num3; k++) + { + currentList.RemoveAt(currentList.Count - 1); + } + } + return; + } + List list = new List(); + for (int l = 0; l < selectableInfo.Cards.Count; l++) + { + list.Add(l); + } + foreach (int[] item2 in AIMathematicsLibrary.EnumerateCombinations(list, selectableInfo.Count)) + { + BattleCardBase firstCard = selectableInfo.Cards[item2[0]]; + bool flag = true; + for (int m = 0; m < item2.Length; m++) + { + BattleCardBase card = selectableInfo.Cards[item2[m]]; + if (currentList.Any((BattleCardBase c) => c.Index == card.Index && c.IsPlayer == card.IsPlayer)) + { + flag = false; + } + currentList.Add(card); + } + if (flag) + { + if (choiceSelectableList != null && choiceSelectableList.Any((KeyValuePair> p) => p.Key == firstCard.Index)) + { + if (choiceSelectableList[firstCard.Index] != null) + { + SetupTargetsList(0, currentList, choiceSelectableList[firstCard.Index], null, out_targetsList); + } + } + else + { + SetupTargetsList(depth + 1, currentList, selectablesList, choiceSelectableList, out_targetsList); + } + } + for (int num4 = 0; num4 < item2.Length; num4++) + { + currentList.RemoveAt(currentList.Count - 1); + } + } + } + + public static void TurnEnd(BattleManagerBase mgr, bool isPlayer) + { + if (isPlayer) + { + mgr.VfxMgr.RegisterSequentialVfx(mgr.OperateMgr.PlayerTurnEnd()); + } + else + { + mgr.VfxMgr.RegisterSequentialVfx(mgr.OperateMgr.TurnEndOperation(isPlayer)); + } + } + + public static void SetupPlayCardSkillOptionValue(BattleCardBase playCard, BattlePlayerPair pair) + { + IEnumerable selectTypeSkill = playCard.GetSelectTypeSkill(); + if (selectTypeSkill == null) + { + return; + } + foreach (SkillBase item in selectTypeSkill) + { + SkillCollectionBase.SetupOptionValue(item.OptionValue, pair, playCard, item); + } + } + + public static List GetRandomDeck(CardBasePrm.ClanType clan, int seriesRangeStart = 0, int seriesRangeEnd = 25) + { + int num = 0; + int num2 = 0; + int num3 = 40; + List deck = new List(); + IEnumerable allParameters = CardMaster.GetInstanceForBattle().GetAllParameters(); + while (true) + { + for (int i = 0; i < num3; i++) + { + CardBasePrm.ClanType card_clan = clan; + if (num2 < 10) + { + if (_rnd.Next(9) == 0) + { + card_clan = CardBasePrm.ClanType.ALL; + } + } + else if (_rnd.Next(9) != 0) + { + card_clan = CardBasePrm.ClanType.ALL; + } + IEnumerable source = allParameters.Where((CardParameter p) => p.Clan == card_clan && seriesRangeStart <= p.BaseCardId / 1000000 % 100 && p.BaseCardId / 1000000 % 100 <= seriesRangeEnd && p.BaseCardId / 100000000 % 10 == 1 && deck.Count((int id) => id == p.BaseCardId) < 3 && !GameMgr.GetIns().GetDataMgr().IsMaintenanceCard(p.CardId) && !GameMgr.GetIns().GetDataMgr().IsMaintenanceCard(p.BaseCardId)); + if (source.Count() == 0) + { + num++; + if (num >= 100) + { + break; + } + i--; + } + else + { + CardParameter cardParameter = source.ElementAt(_rnd.Next(source.Count())); + deck.Add(cardParameter.BaseCardId); + } + } + if (deck.Count == 40) + { + break; + } + if (num2 >= 100) + { + throw new Exception($"ใƒ‡ใƒƒใ‚ญๆง‹็ฏ‰ใ™ใ‚‹ใŸใ‚ใฎไฝฟ็”จๅฏ่ƒฝใช{clan}ใ‚ซใƒผใƒ‰ใŒไธ่ถณใ—ใฆใ„ใ‚‹ๅฏ่ƒฝๆ€งใŒใ‚ใ‚Šใพใ™ใ€‚ใ‚ซใƒผใƒ‰ๆœชๅฎŸ่ฃ…ใƒ•ใƒฉใ‚ฐใ‚’่งฃ้™คใ™ใ‚‹ใ‹ใ€ๅฎŸ่ฃ…ใŒ้€ฒใ‚“ใงใ‹ใ‚‰ๅ†ๅบฆใŠ่ฉฆใ—ใใ ใ•ใ„ใ€‚"); + } + num2++; + num3 = 40 - deck.Count; + } + return deck; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/EnemyHandVirtualCard.cs b/SVSim.BattleEngine/Engine/Wizard/EnemyHandVirtualCard.cs new file mode 100644 index 0000000..32dc220 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/EnemyHandVirtualCard.cs @@ -0,0 +1,86 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class EnemyHandVirtualCard : AIVirtualCard +{ + public EnemyHandVirtualCard(BattleCardBase card, AIVirtualField field) + { + _field = field; + base.IsInHand = true; + base.IsOnField = false; + base.IsAlly = false; + InitializeFromBattleCardBase(card); + base.TagCollectionContainer = new AIEnemyHandTagCollectionContainer(); + base.FusionIngredients = new AIVirtualFusionIngredientsInfo(); + if (card.SkillApplyInformation.FusionIngredients != null && card.SkillApplyInformation.FusionIngredients.Count > 0) + { + base.FusionIngredients.CopyFusionIngredientsFromBattleCard(card.SkillApplyInformation.FusionIngredients, _field); + } + } + + public EnemyHandVirtualCard(EnemyHandVirtualCard original, AIVirtualField field) + { + base.BaseCard = original.BaseCard; + _field = field; + base.IsInHand = true; + base.IsOnField = false; + base.IsAlly = false; + base.CardIndex = original.CardIndex; + base.BaseId = original.BaseId; + base.Clan = original.Clan; + IsPlayer = original.IsPlayer; + IsUnit = original.IsUnit; + IsSpell = original.IsSpell; + IsAmulet = original.IsAmulet; + IsCountdownAmulet = original.IsCountdownAmulet; + base.TagCollectionContainer = new AIEnemyHandTagCollectionContainer(original.TagCollectionContainer, this); + if (original._tribeList != null) + { + _tribeList = new List(original._tribeList); + } + if (original.FusionIngredients != null) + { + base.FusionIngredients = new AIVirtualFusionIngredientsInfo(original.FusionIngredients); + } + } + + protected override void InitializeFromBattleCardBase(BattleCardBase origin) + { + InitializeFromBattleCardBaseBasic(origin); + Cost = origin.Cost; + base.CardIndex = origin.Index; + IsPlayer = origin.IsPlayer; + base.BattleSkills = origin.Skills; + base.BattleSkillHashList = CardSkillHashUtility.GetSingleSkillHashStringList(base.BattleSkills); + IsUnit = origin.IsUnit; + IsSpell = origin.IsSpell; + IsAmulet = origin.IsField; + IsCountdownAmulet = origin.IsChantField; + if (origin.Tribe != null && origin.Tribe.Count > 0) + { + for (int i = 0; i < origin.Tribe.Count; i++) + { + AppendTribe(origin.Tribe[i]); + } + } + } + + public override void InitializeTags(AIParamQuery query, AIAttachedTagCollection attachedTagCollection, AIRemovedTagCollection removedTagCollection) + { + base.TagCollectionContainer.InitTags(this, query); + } + + public override bool IsFollower(List playPtn) + { + if (IsUnit) + { + if (!this.IsAccelerated(_field, null)) + { + return !this.IsCrystalize(_field, null); + } + return false; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/EpValuePolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/EpValuePolicyCollection.cs new file mode 100644 index 0000000..7c90c44 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/EpValuePolicyCollection.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class EpValuePolicyCollection : AIPolicyCollection +{ + public float GetEpValue(AISituationInfo situation, List playPtn) + { + if (!base.HasPolicy) + { + return 0f; + } + float num = 0f; + AIVirtualCard actor = situation.Actor; + AIVirtualField selfField = actor.SelfField; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(actor, playPtn, selfField, situation)) + { + num += aIPolicyData.EvalArg(actor, playPtn, selfField, situation); + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/EvaluationType.cs b/SVSim.BattleEngine/Engine/Wizard/EvaluationType.cs new file mode 100644 index 0000000..77f2396 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/EvaluationType.cs @@ -0,0 +1,8 @@ +namespace Wizard; + +public enum EvaluationType +{ + FULL, + SELF_TURN, + SIMPLE +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ExchangeConfirmDialog.cs b/SVSim.BattleEngine/Engine/Wizard/ExchangeConfirmDialog.cs new file mode 100644 index 0000000..ffb8011 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ExchangeConfirmDialog.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +namespace Wizard; + +public class ExchangeConfirmDialog : MonoBehaviour +{ + [SerializeField] + private UILabel _exchangeConfirmLabelMainFirst; + + [SerializeField] + private UILabel _exchangeConfirmLabelMainSecond; + + [SerializeField] + private UILabel _exchangeConfirmLabelSub; + + public void SetText(string mainTextFirst, string mainTextSecond, string subText) + { + _exchangeConfirmLabelMainFirst.text = mainTextFirst; + _exchangeConfirmLabelMainSecond.text = mainTextSecond; + _exchangeConfirmLabelSub.text = subText; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field1005.cs b/SVSim.BattleEngine/Engine/Wizard/Field1005.cs new file mode 100644 index 0000000..ad3513f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field1005.cs @@ -0,0 +1,71 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field1005 : BackGroundBase +{ + public override int FieldId => 1005; + + public Field1005(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_1005_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles1005").gameObject; + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1005, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1005_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(-2305f, -1938f, -227f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-42f, 90f, -90f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(332f, 300f, -218f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-42f, 112f, -104f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field1006.cs b/SVSim.BattleEngine/Engine/Wizard/Field1006.cs new file mode 100644 index 0000000..d533b58 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field1006.cs @@ -0,0 +1,143 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field1006 : BackGroundBase +{ + public override int FieldId => 1006; + + public Field1006(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_1006_root").gameObject; + _fieldObjDictionary.Add("main", _fieldModel.transform.Find("md_bf_1006_01_monitor_main").gameObject); + _fieldObjDictionary.Add("sub", _fieldModel.transform.Find("md_bf_1006_01_monitor_sub").gameObject); + _fieldObjDictionary.Add("noise", _fieldModel.transform.Find("md_bf_1006_01_noise").gameObject); + _fieldObjDictionary.Add("screen_01", _fieldModel.transform.Find("md_bf_1006_01_screen_01").gameObject); + _fieldObjDictionary.Add("screen_02", _fieldModel.transform.Find("md_bf_1006_01_screen_02").gameObject); + _fieldObjDictionary.Add("screen_03", _fieldModel.transform.Find("md_bf_1006_01_screen_03").gameObject); + _fieldObjDictionary.Add("screen_04", _fieldModel.transform.Find("md_bf_1006_01_screen_04").gameObject); + m_FieldAnimatorDictionary.Add("main", _fieldObjDictionary["main"].GetComponent()); + m_FieldAnimatorDictionary.Add("sub", _fieldObjDictionary["sub"].GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: true); + _fieldObjDictionary["noise"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_02"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_03"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_04"].gameObject.SetActive(value: false); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1006, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1006_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["main"].SetTrigger("opening"); + m_FieldAnimatorDictionary["sub"].SetTrigger("opening"); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: true); + _fieldObjDictionary["noise"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_02"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_03"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_04"].gameObject.SetActive(value: false); + _battleCamera.Camera.transform.localPosition = new Vector3(7f, -650f, -699f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-74.1f, -179.8f, 179.8f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-871f, -736f, -139f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-36f, 109f, -107f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + int num = Random.Range(0, 3); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_field_1006_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + switch (num) + { + case 0: + m_FieldAnimatorDictionary["sub"].SetTrigger("tap"); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: false); + _fieldObjDictionary["noise"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(0.3f); + _fieldObjDictionary["noise"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_02"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(2f); + _fieldObjDictionary["screen_02"].gameObject.SetActive(value: false); + _fieldObjDictionary["noise"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(0.3f); + _fieldObjDictionary["noise"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: true); + _gimicCntDictionary[obj.tag]--; + break; + case 1: + m_FieldAnimatorDictionary["sub"].SetTrigger("tap"); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: false); + _fieldObjDictionary["noise"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(0.3f); + _fieldObjDictionary["noise"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_03"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(2f); + _fieldObjDictionary["screen_03"].gameObject.SetActive(value: false); + _fieldObjDictionary["noise"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(0.3f); + _fieldObjDictionary["noise"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: true); + _gimicCntDictionary[obj.tag]--; + break; + case 2: + m_FieldAnimatorDictionary["sub"].SetTrigger("tap"); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: false); + _fieldObjDictionary["noise"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(0.3f); + _fieldObjDictionary["noise"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_04"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(2f); + _fieldObjDictionary["screen_04"].gameObject.SetActive(value: false); + _fieldObjDictionary["noise"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(0.3f); + _fieldObjDictionary["noise"].gameObject.SetActive(value: false); + _fieldObjDictionary["screen_01"].gameObject.SetActive(value: true); + _gimicCntDictionary[obj.tag]--; + break; + } + _gimicCntDictionary[obj.tag] = 0; + } + yield return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field1007.cs b/SVSim.BattleEngine/Engine/Wizard/Field1007.cs new file mode 100644 index 0000000..86d94ad --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field1007.cs @@ -0,0 +1,80 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field1007 : BackGroundBase +{ + public override int FieldId => 1007; + + public Field1007(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_1007_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles1007").gameObject; + _fieldParticleSystemDictionary.Add("start", _fieldParticles.transform.Find("start").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1007, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1007_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1007_2, pos); + break; + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["start"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(-2454f, 22f, -1f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-0.5f, 93f, -90f)); + Vector3[] bezierQuad = MotionUtils.GetBezierQuad(new Vector3(-2454f, 22f, -1f), new Vector3(-800f, 29f, -4f), new Vector3(66f, 8f, -992f), 10); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierQuad, "movetopath", false, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-0.45f, 113f, -90f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field1008.cs b/SVSim.BattleEngine/Engine/Wizard/Field1008.cs new file mode 100644 index 0000000..df56ee4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field1008.cs @@ -0,0 +1,172 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class Field1008 : BackGroundBase +{ + private readonly string[] MONITOR_OBJECT_PATH_LIST = new string[4] { "md_bf_1008_01_main/monitor/monitor000__combine_freeze_/monitor000_monitor", "md_bf_1008_01_main/monitor/monitor000__combine_freeze_/monitor000_monitor_L", "md_bf_1008_01_main/monitor/monitor000__combine_freeze_/monitor000_monitor_R", "md_bf_1008_01_monitor_2/monitor002" }; + + private const string MONITOR_TEXTURE_NAME = "tx_bf_1008_01_monitor_d"; + + public override int FieldId => 1008; + + public Field1008(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override List CollectAdditionalAssets() + { + return new List { Toolbox.ResourcesManager.GetAssetTypePath("tx_bf_1008_01_monitor_d", ResourcesManager.AssetLoadPathType.Uilang3DField) }; + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_1008_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles1008").gameObject; + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("base", _fieldParticles.transform.Find("base").GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + _fieldObjDictionary.Add("monitor_1", _fieldModel.transform.Find("md_bf_1008_01_monitor_1").gameObject); + _fieldObjDictionary.Add("monitor_2", _fieldModel.transform.Find("md_bf_1008_01_monitor_2").gameObject); + _fieldObjDictionary.Add("monitor_3", _fieldModel.transform.Find("md_bf_1008_01_monitor_3").gameObject); + _fieldObjDictionary.Add("monitor_4", _fieldModel.transform.Find("md_bf_1008_01_monitor_4").gameObject); + _fieldObjDictionary.Add("monitor_5", _fieldModel.transform.Find("md_bf_1008_01_monitor_5").gameObject); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("tx_bf_1008_01_monitor_d", ResourcesManager.AssetLoadPathType.Uilang3DField, isfetch: true); + Texture texture = Toolbox.ResourcesManager.LoadObject(assetTypePath) as Texture; + if (texture != null) + { + for (int i = 0; i < MONITOR_OBJECT_PATH_LIST.Length; i++) + { + MeshRenderer component = _fieldModel.transform.Find(MONITOR_OBJECT_PATH_LIST[i]).GetComponent(); + if (component != null) + { + component.material.SetTexture("_MainTex", texture); + } + } + } + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int j = 0; j < _fieldObjDictionary.Count; j++) + { + list2.Add(_fieldObjDictionary[list[j]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + _fieldParticleSystemDictionary["base"].Play(); + _fieldObjDictionary["monitor_1"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_2"].gameObject.SetActive(value: true); + _fieldObjDictionary["monitor_3"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_4"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_5"].gameObject.SetActive(value: false); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1008, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + if (areaId == 1) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1008_1, pos); + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _fieldParticleSystemDictionary["base"].Play(); + _fieldObjDictionary["monitor_1"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_2"].gameObject.SetActive(value: true); + _fieldObjDictionary["monitor_3"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_4"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_5"].gameObject.SetActive(value: false); + _battleCamera.Camera.transform.localPosition = new Vector3(3564f, -1182f, -224f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-18f, -88f, 94.4f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(197f, -103f, -224f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-18f, -88f, 94.4f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + int num = Random.Range(0, 2); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_field_1008_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + switch (num) + { + case 0: + _fieldObjDictionary["monitor_2"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_5"].gameObject.SetActive(value: true); + _fieldParticleSystemDictionary["base"].Clear(); + _fieldParticleSystemDictionary["base"].Stop(); + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(0.3f); + _fieldObjDictionary["monitor_5"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_1"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(2f); + _fieldObjDictionary["monitor_1"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_5"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(0.3f); + _fieldObjDictionary["monitor_5"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_2"].gameObject.SetActive(value: true); + _fieldParticleSystemDictionary["base"].Play(); + _gimicCntDictionary[obj.tag]--; + break; + case 1: + _fieldObjDictionary["monitor_2"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_5"].gameObject.SetActive(value: true); + _fieldParticleSystemDictionary["base"].Clear(); + _fieldParticleSystemDictionary["base"].Stop(); + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(0.3f); + _fieldObjDictionary["monitor_5"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_3"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(2f); + _fieldObjDictionary["monitor_3"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_5"].gameObject.SetActive(value: true); + yield return new WaitForSeconds(0.3f); + _fieldObjDictionary["monitor_5"].gameObject.SetActive(value: false); + _fieldObjDictionary["monitor_2"].gameObject.SetActive(value: true); + _fieldParticleSystemDictionary["base"].Play(); + _gimicCntDictionary[obj.tag]--; + break; + } + _gimicCntDictionary[obj.tag] = 0; + } + yield return null; + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["base"].Clear(); + _fieldParticleSystemDictionary["base"].Stop(); + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(3f); + _fieldParticleSystemDictionary["base"].Play(); + yield return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field1009.cs b/SVSim.BattleEngine/Engine/Wizard/Field1009.cs new file mode 100644 index 0000000..a4a1b2a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field1009.cs @@ -0,0 +1,96 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class Field1009 : BackGroundBase +{ + private const string MONITOR_TEXTURE_NAME = "tx_bf_1009_01_monitor_d"; + + private readonly string[] MONITOR_OBJECT_PATH_LIST = new string[6] { "md_bf_1009_01_main/monitor_set/monitor08", "md_bf_1009_01_main/monitor_set/monitor09", "md_bf_1009_01_main/monitor_set/monitor10", "md_bf_1009_01_main/monitor_set/monitor11", "md_bf_1009_01_main/monitor_set/monitor12", "md_bf_1009_01_main/monitor_set/monitor13" }; + + public override int FieldId => 1009; + + public Field1009(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override List CollectAdditionalAssets() + { + return new List { Toolbox.ResourcesManager.GetAssetTypePath("tx_bf_1009_01_monitor_d", ResourcesManager.AssetLoadPathType.Uilang3DField) }; + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_1009_root").gameObject; + _fieldObjDictionary.Add("door", _fieldModel.transform.Find("md_bf_1009_01_door").gameObject); + m_FieldAnimatorDictionary.Add("door", _fieldObjDictionary["door"].GetComponent()); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("tx_bf_1009_01_monitor_d", ResourcesManager.AssetLoadPathType.Uilang3DField, isfetch: true); + Texture texture = Toolbox.ResourcesManager.LoadObject(assetTypePath) as Texture; + if (texture != null) + { + for (int i = 0; i < MONITOR_OBJECT_PATH_LIST.Length; i++) + { + MeshRenderer component = _fieldModel.transform.Find(MONITOR_OBJECT_PATH_LIST[i]).GetComponent(); + if (component != null) + { + component.material.SetTexture("_MainTex", texture); + } + } + } + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int j = 0; j < _fieldObjDictionary.Count; j++) + { + list2.Add(_fieldObjDictionary[list[j]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1009, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + if (areaId == 1) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1009_1, pos); + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["door"].SetTrigger("Open"); + _battleCamera.Camera.transform.localPosition = new Vector3(1885f, 0f, -150f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(0f, -85f, 90f)); + Vector3[] bezierQuad = MotionUtils.GetBezierQuad(new Vector3(1885f, 0f, -150f), new Vector3(300f, 0f, 100f), new Vector3(-596f, 0f, -170f), 10); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierQuad, "movetopath", false, "time", 1.7f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(0f, -103f, 90f), "time", 1.7f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + yield return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field1010.cs b/SVSim.BattleEngine/Engine/Wizard/Field1010.cs new file mode 100644 index 0000000..0e6b6d4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field1010.cs @@ -0,0 +1,77 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field1010 : BackGroundBase +{ + public override int FieldId => 1010; + + public Field1010(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_1010_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles1010").gameObject; + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + _fieldObjDictionary.Add("main", _fieldModel.transform.Find("md_bf_1010_01_main").gameObject); + _fieldObjDictionary.Add("move", _fieldModel.transform.Find("md_bf_1010_01_move").gameObject); + _fieldObjDictionary.Add("volume", _fieldModel.transform.Find("md_bf_1010_01_volume").gameObject); + m_FieldAnimatorDictionary.Add("volume", _fieldObjDictionary["volume"].GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1010, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + if (areaId == 1) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1010_1, pos); + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(0f, 0f, -750f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(0f, 0f, 0f)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + m_FieldAnimatorDictionary["volume"].SetTrigger("shake"); + yield return new WaitForSeconds(3f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field1011.cs b/SVSim.BattleEngine/Engine/Wizard/Field1011.cs new file mode 100644 index 0000000..badb9b4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field1011.cs @@ -0,0 +1,99 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field1011 : BackGroundBase +{ + public override int FieldId => 1011; + + public Field1011(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_1011_01_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles1011").gameObject; + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldObjDictionary.Add("lotuscenter", _fieldModel.transform.Find("md_bf_1011_01_lotuscenter").gameObject); + m_FieldAnimatorDictionary.Add("lotuscenter", _fieldObjDictionary["lotuscenter"].GetComponent()); + _fieldObjDictionary.Add("lotus_1", _fieldModel.transform.Find("md_bf_1011_01_lotuscenter/root/pibot/md_bf_1011_01_lotus_1").gameObject); + m_FieldAnimatorDictionary.Add("lotus_1", _fieldObjDictionary["lotus_1"].GetComponent()); + _fieldObjDictionary.Add("lotus_2", _fieldModel.transform.Find("md_bf_1011_01_lotuscenter/root/pibot/md_bf_1011_01_lotus_2").gameObject); + m_FieldAnimatorDictionary.Add("lotus_2", _fieldObjDictionary["lotus_2"].GetComponent()); + _fieldObjDictionary.Add("flower", _fieldModel.transform.Find("md_bf_1011_01_flower").gameObject); + m_FieldAnimatorDictionary.Add("flower", _fieldObjDictionary["flower"].GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1011, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + if (areaId == 1) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1011_1, pos); + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(2078.8f, -637f, 5.5f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-18.9f, -87.8f, 88.9f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(55.6f, 28.2f, -121.5f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-17.2f, -106.5f, 94.9f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["flower"].SetTrigger("tap"); + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(2f); + _gimicCntDictionary[obj.tag] = 0; + } + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + m_FieldAnimatorDictionary["lotus_1"].SetTrigger("shake"); + m_FieldAnimatorDictionary["lotus_2"].SetTrigger("shake"); + m_FieldAnimatorDictionary["flower"].SetTrigger("shake"); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field1012.cs b/SVSim.BattleEngine/Engine/Wizard/Field1012.cs new file mode 100644 index 0000000..1e41585 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field1012.cs @@ -0,0 +1,78 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field1012 : BackGroundBase +{ + public override int FieldId => 1012; + + public Field1012(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_1012_01_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles1012").gameObject; + _fieldParticleSystemDictionary.Add("base", _fieldParticles.transform.Find("base").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1012, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + if (areaId == 1) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1012_1, pos); + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["base"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(-678f, -2223f, -8.5f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-69.4f, 54.5f, -56.56f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-380f, -1292f, -8.5f), "time", 1.5f, "islocal", true, "easetype", iTween.EaseType.easeInQuart)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-69.4f, 54.5f, -56.56f), "time", 1.5f, "islocal", true, "easetype", iTween.EaseType.easeInQuart)); + yield return new WaitForSeconds(1.5f); + _battleCamera.Camera.transform.localPosition = new Vector3(-380f, -1292f, -8.5f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-69.4f, 54.5f, -56.56f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-132.6f, -553.3f, -8.5f), "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-69.4f, 54.5f, -56.56f), "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad)); + yield return new WaitForSeconds(0.5f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field51.cs b/SVSim.BattleEngine/Engine/Wizard/Field51.cs new file mode 100644 index 0000000..1867608 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field51.cs @@ -0,0 +1,125 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field51 : BackGroundBase +{ + public override int FieldId => 51; + + public Field51(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_0051_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles51").gameObject; + _fieldParticleSystemDictionary.Add("light", _fieldModel.transform.Find("md_bf_0051_01_movebranchlight_r/position/root/joint1/joint2/joint3/light").GetComponent()); + _fieldParticleSystemDictionary.Add("light_gimic", _fieldModel.transform.Find("md_bf_0051_01_movebranchlight_r/position/root/joint1/joint2/joint3/light_gimic").GetComponent()); + _fieldParticleSystemDictionary.Add("light_shake", _fieldModel.transform.Find("md_bf_0051_01_movebranchlight_r/position/root/joint1/joint2/joint3/light_shake").GetComponent()); + _fieldParticleSystemDictionary.Add("light_l", _fieldModel.transform.Find("md_bf_0051_01_movebranchlight_l/position/root/joint1/joint2/joint3/light_l").GetComponent()); + _fieldParticleSystemDictionary.Add("light_shake_l", _fieldModel.transform.Find("md_bf_0051_01_movebranchlight_l/position/root/joint1/joint2/joint3/light_shake_l").GetComponent()); + _fieldObjDictionary.Add("movebranch_a", _fieldModel.transform.Find("md_bf_0051_01_movebranch_a").gameObject); + _fieldObjDictionary.Add("movebranch_b", _fieldModel.transform.Find("md_bf_0051_01_movebranch_b").gameObject); + _fieldObjDictionary.Add("movebranch_c", _fieldModel.transform.Find("md_bf_0051_01_movebranch_c").gameObject); + _fieldObjDictionary.Add("movebranch_d", _fieldModel.transform.Find("md_bf_0051_01_movebranch_d").gameObject); + _fieldObjDictionary.Add("movebranch_e", _fieldModel.transform.Find("md_bf_0051_01_movebranch_e").gameObject); + _fieldObjDictionary.Add("movebranch_f", _fieldModel.transform.Find("md_bf_0051_01_movebranch_f").gameObject); + _fieldObjDictionary.Add("movebranchlight_l", _fieldModel.transform.Find("md_bf_0051_01_movebranchlight_l").gameObject); + _fieldObjDictionary.Add("movebranchlight_r", _fieldModel.transform.Find("md_bf_0051_01_movebranchlight_r").gameObject); + m_FieldAnimatorDictionary.Add("movebranch_a", _fieldObjDictionary["movebranch_a"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranch_b", _fieldObjDictionary["movebranch_b"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranch_c", _fieldObjDictionary["movebranch_c"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranch_d", _fieldObjDictionary["movebranch_d"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranch_e", _fieldObjDictionary["movebranch_e"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranch_f", _fieldObjDictionary["movebranch_f"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranchlight_l", _fieldObjDictionary["movebranchlight_l"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranchlight_r", _fieldObjDictionary["movebranchlight_r"].GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_51, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_51_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["light"].Play(); + _fieldParticleSystemDictionary["light_l"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(3322f, -1847f, 36f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-84f, -90f, 90f)); + Vector3[] bezierQuad = MotionUtils.GetBezierQuad(new Vector3(3322f, -1847f, 36f), new Vector3(2800f, 40f, 36f), new Vector3(1036f, -27.7f, 0f), 10); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierQuad, "movetopath", false, "time", 1.5f, "islocal", true, "easetype", iTween.EaseType.easeInSine)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-8f, -90f, 90f), "time", 1.5f, "islocal", true, "easetype", iTween.EaseType.easeInSine)); + yield return new WaitForSeconds(1.5f); + _battleCamera.Camera.transform.localPosition = new Vector3(1036f, -27.7f, 0f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-8f, -90f, 90f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-323f, -19f, -18f), "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-1f, -90f, 90f), "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad)); + yield return new WaitForSeconds(0.5f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _gimicCntDictionary[obj.tag]++; + m_FieldAnimatorDictionary["movebranchlight_r"].SetTrigger("tap"); + _fieldParticleSystemDictionary["light"].Stop(); + _fieldParticleSystemDictionary["light_gimic"].Play(); + yield return new WaitForSeconds(2f); + _fieldParticleSystemDictionary["light"].Play(); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + m_FieldAnimatorDictionary["movebranch_a"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranch_b"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranch_c"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranch_d"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranch_e"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranch_f"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranchlight_l"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranchlight_r"].SetTrigger("shake"); + _fieldParticleSystemDictionary["shake"].Play(); + _fieldParticleSystemDictionary["light_shake"].Play(); + _fieldParticleSystemDictionary["light_shake_l"].Play(); + yield return new WaitForSeconds(3f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field52.cs b/SVSim.BattleEngine/Engine/Wizard/Field52.cs new file mode 100644 index 0000000..0529eaa --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field52.cs @@ -0,0 +1,126 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field52 : BackGroundBase +{ + public override int FieldId => 52; + + public Field52(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_0052_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles52").gameObject; + _fieldParticleSystemDictionary.Add("light", _fieldModel.transform.Find("md_bf_0052_01_movebranchlight_r/position/root/joint1/joint2/joint3/light").GetComponent()); + _fieldParticleSystemDictionary.Add("light_gimic", _fieldModel.transform.Find("md_bf_0052_01_movebranchlight_r/position/root/joint1/joint2/joint3/light_gimic").GetComponent()); + _fieldParticleSystemDictionary.Add("light_shake", _fieldModel.transform.Find("md_bf_0052_01_movebranchlight_r/position/root/joint1/joint2/joint3/light_shake").GetComponent()); + _fieldParticleSystemDictionary.Add("light_l", _fieldModel.transform.Find("md_bf_0052_01_movebranchlight_l/position/root/joint1/joint2/joint3/light_l").GetComponent()); + _fieldParticleSystemDictionary.Add("light_shake_l", _fieldModel.transform.Find("md_bf_0052_01_movebranchlight_l/position/root/joint1/joint2/joint3/light_shake_l").GetComponent()); + AddParticleToFieldObjDictionary("base/emitter_T/ef_dust1_mlt_inv_1"); + AddParticleToFieldObjDictionary("base/emitter_B/ef_dust1_mlt_inv_1"); + AddParticleToFieldObjDictionary("base/emitter_L/ef_dust1_mlt_inv_1"); + AddParticleToFieldObjDictionary("shake/ef_dust1_mlt_inv_1"); + _fieldObjDictionary.Add("movebranch_a", _fieldModel.transform.Find("md_bf_0052_01_movebranch_a").gameObject); + _fieldObjDictionary.Add("movebranch_b", _fieldModel.transform.Find("md_bf_0052_01_movebranch_b").gameObject); + _fieldObjDictionary.Add("movebranch_c", _fieldModel.transform.Find("md_bf_0052_01_movebranch_c").gameObject); + _fieldObjDictionary.Add("movebranch_d", _fieldModel.transform.Find("md_bf_0052_01_movebranch_d").gameObject); + _fieldObjDictionary.Add("movebranch_e", _fieldModel.transform.Find("md_bf_0052_01_movebranch_e").gameObject); + _fieldObjDictionary.Add("movebranchlight_l", _fieldModel.transform.Find("md_bf_0052_01_movebranchlight_l").gameObject); + _fieldObjDictionary.Add("movebranchlight_r", _fieldModel.transform.Find("md_bf_0052_01_movebranchlight_r").gameObject); + m_FieldAnimatorDictionary.Add("movebranch_a", _fieldObjDictionary["movebranch_a"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranch_b", _fieldObjDictionary["movebranch_b"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranch_c", _fieldObjDictionary["movebranch_c"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranch_d", _fieldObjDictionary["movebranch_d"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranch_e", _fieldObjDictionary["movebranch_e"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranchlight_l", _fieldObjDictionary["movebranchlight_l"].GetComponent()); + m_FieldAnimatorDictionary.Add("movebranchlight_r", _fieldObjDictionary["movebranchlight_r"].GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_52, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_52_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["light"].Play(); + _fieldParticleSystemDictionary["light_l"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(3322f, -1847f, 36f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-84f, -90f, 90f)); + Vector3[] bezierQuad = MotionUtils.GetBezierQuad(new Vector3(3322f, -1847f, 36f), new Vector3(2800f, 40f, 36f), new Vector3(1036f, -27.7f, 0f), 10); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierQuad, "movetopath", false, "time", 1.5f, "islocal", true, "easetype", iTween.EaseType.easeInSine)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-8f, -90f, 90f), "time", 1.5f, "islocal", true, "easetype", iTween.EaseType.easeInSine)); + yield return new WaitForSeconds(1.5f); + _battleCamera.Camera.transform.localPosition = new Vector3(1036f, -27.7f, 0f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-8f, -90f, 90f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-323f, -19f, -18f), "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-1f, -90f, 90f), "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad)); + yield return new WaitForSeconds(0.5f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _gimicCntDictionary[obj.tag]++; + m_FieldAnimatorDictionary["movebranchlight_r"].SetTrigger("tap"); + _fieldParticleSystemDictionary["light"].Stop(); + _fieldParticleSystemDictionary["light_gimic"].Play(); + yield return new WaitForSeconds(2f); + _fieldParticleSystemDictionary["light"].Play(); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + m_FieldAnimatorDictionary["movebranch_a"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranch_b"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranch_c"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranch_d"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranch_e"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranchlight_l"].SetTrigger("shake"); + m_FieldAnimatorDictionary["movebranchlight_r"].SetTrigger("shake"); + _fieldParticleSystemDictionary["shake"].Play(); + _fieldParticleSystemDictionary["light_shake"].Play(); + _fieldParticleSystemDictionary["light_shake_l"].Play(); + yield return new WaitForSeconds(3f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field61.cs b/SVSim.BattleEngine/Engine/Wizard/Field61.cs new file mode 100644 index 0000000..c0f571d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field61.cs @@ -0,0 +1,98 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field61 : BackGroundBase +{ + public override int FieldId => 61; + + public Field61(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_0061_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles61").gameObject; + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + _fieldObjDictionary.Add("monster", _fieldModel.transform.Find("md_bf_0061_01_monster").gameObject); + m_FieldAnimatorDictionary.Add("monster", _fieldObjDictionary["monster"].GetComponent()); + _fieldObjDictionary.Add("monster_2", _fieldModel.transform.Find("md_bf_0061_01_monster_2").gameObject); + m_FieldAnimatorDictionary.Add("monster_2", _fieldObjDictionary["monster_2"].GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_61, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_61_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_61_2, pos); + break; + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _battleCamera.Camera.transform.localPosition = new Vector3(0f, -3032f, -194f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-58f, 0f, 0f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(0f, -790f, -633f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-90f, 0f, 0f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _gimicCntDictionary[obj.tag]++; + m_FieldAnimatorDictionary["monster"].SetTrigger("monster"); + m_FieldAnimatorDictionary["monster_2"].SetTrigger("monster"); + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(10f); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(3f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field62.cs b/SVSim.BattleEngine/Engine/Wizard/Field62.cs new file mode 100644 index 0000000..6cfccc1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field62.cs @@ -0,0 +1,89 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field62 : BackGroundBase +{ + public override int FieldId => 62; + + public Field62(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_0062_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles62").gameObject; + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_62, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + if (areaId == 1) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_62_1, pos); + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(0f, -3032f, -194f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-58f, 0f, 0f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(0f, -790f, -633f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-90f, 0f, 0f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(2f); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field71.cs b/SVSim.BattleEngine/Engine/Wizard/Field71.cs new file mode 100644 index 0000000..b614a69 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field71.cs @@ -0,0 +1,88 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field71 : BackGroundBase +{ + public override int FieldId => 71; + + public Field71(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + _fieldModel = base.Field.transform.Find("md_bf_0071_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles71").gameObject; + AddParticleToFieldObjDictionary("gimic_1/Null_Adjust/ef_circle4_mlt_inv_1"); + AddParticleToFieldObjDictionary("shake/Null_Adjust/ef_bird2_mlt_inv_1"); + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_71, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + if (areaId == 1) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_71_1, pos); + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _battleCamera.Camera.transform.localPosition = new Vector3(2127f, -563f, -362f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-16f, -47f, 80f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-308f, 102f, -142f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-20f, -88f, 89.3f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _gimicCntDictionary[obj.tag]++; + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(5f); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field72.cs b/SVSim.BattleEngine/Engine/Wizard/Field72.cs new file mode 100644 index 0000000..0a1838b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field72.cs @@ -0,0 +1,83 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field72 : BackGroundBase +{ + public override int FieldId => 72; + + public Field72(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + _fieldModel = base.Field.transform.Find("md_bf_0072_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles72").gameObject; + _fieldObjDictionary.Add("fence", _fieldModel.transform.Find("md_bf_0072_01_fence").gameObject); + m_FieldAnimatorDictionary.Add("fence", _fieldObjDictionary["fence"].GetComponent()); + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_72, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + if (areaId == 1) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_72_1, pos); + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(2508f, -1012f, -111f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-22.5f, -80f, 86f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(-25f, 27f, -439f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-23f, -90f, 90f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(0.3f); + m_FieldAnimatorDictionary["fence"].SetTrigger("Open"); + yield return new WaitForSeconds(1.7f); + m_FieldAnimatorDictionary["fence"].SetTrigger("Close"); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field73.cs b/SVSim.BattleEngine/Engine/Wizard/Field73.cs new file mode 100644 index 0000000..eb9afc9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field73.cs @@ -0,0 +1,91 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field73 : BackGroundBase +{ + public override int FieldId => 73; + + public Field73(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + _fieldModel = base.Field.transform.Find("md_bf_0073_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles73").gameObject; + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("shake_1", _fieldParticles.transform.Find("shake_1").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_10, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + switch (areaId) + { + case 1: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_10_1, pos); + break; + case 2: + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_10_2, pos); + break; + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _battleCamera.Camera.transform.localPosition = new Vector3(-510f, 140f, -55f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-11f, -113f, 95f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(15f, -95f, -150f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-21f, -87f, 90f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _gimicCntDictionary[obj.tag]++; + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(6f); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake_1"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field74.cs b/SVSim.BattleEngine/Engine/Wizard/Field74.cs new file mode 100644 index 0000000..8babf64 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field74.cs @@ -0,0 +1,76 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field74 : BackGroundBase +{ + public override int FieldId => 74; + + public Field74(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + _fieldModel = base.Field.transform.Find("md_bf_0074_01").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles74").gameObject; + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_74, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + if (areaId == 1) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_74_1, pos); + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(-20f, 80f, 700f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-10f, 0f, 0f)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field75.cs b/SVSim.BattleEngine/Engine/Wizard/Field75.cs new file mode 100644 index 0000000..6ddb40b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field75.cs @@ -0,0 +1,104 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field75 : BackGroundBase +{ + public override int FieldId => 75; + + public Field75(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + _fieldModel = base.Field.transform.Find("md_bf_0075_root").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles75").gameObject; + _fieldObjDictionary.Add("gate", _fieldModel.transform.Find("md_bf_0075_01_gate").gameObject); + m_FieldAnimatorDictionary.Add("gate", _fieldObjDictionary["gate"].GetComponent()); + _fieldObjDictionary.Add("tub", _fieldModel.transform.Find("md_bf_0075_01_tub").gameObject); + m_FieldAnimatorDictionary.Add("tub", _fieldObjDictionary["tub"].GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_2", _fieldParticles.transform.Find("gimic_2").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_41, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + if (areaId == 1) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_41_1, pos); + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + m_FieldAnimatorDictionary["gate"].SetTrigger("Open"); + _battleCamera.Camera.transform.localPosition = new Vector3(1742f, -485f, 51f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-12f, -90f, 90f)); + Vector3[] bezierQuad = MotionUtils.GetBezierQuad(new Vector3(1742f, -485f, 51f), new Vector3(900f, -285f, 18f), new Vector3(184f, 81f, -14f), 10); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierQuad, "movetopath", false, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-8f, -97f, 90.5f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutSine)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + int num = Random.Range(1, 3); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_{num}", "se_field_" + _str3DFieldNo, 0f, 0L); + switch (num) + { + case 1: + m_FieldAnimatorDictionary["tub"].SetTrigger("tap"); + yield return new WaitForSeconds(3f); + break; + case 2: + m_FieldAnimatorDictionary["tub"].SetTrigger("fall"); + _fieldParticleSystemDictionary["gimic_2"].Play(); + yield return new WaitForSeconds(6f); + break; + } + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + m_FieldAnimatorDictionary["tub"].SetTrigger("tap"); + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Field76.cs b/SVSim.BattleEngine/Engine/Wizard/Field76.cs new file mode 100644 index 0000000..4b97a01 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Field76.cs @@ -0,0 +1,93 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class Field76 : BackGroundBase +{ + public override int FieldId => 76; + + public Field76(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + _fieldModel = base.Field.transform.Find("md_bf_gate_01").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles76").gameObject; + AddParticleToFieldObjDictionary("gimic_1/Null_Adjust/ef_nemesis1_add_nor_1/ef_nemesis1_mlt_inv_1"); + AddParticleToFieldObjDictionary("gimic_1/Null_Adjust/ef_nemesis1_add_nor_1/ef_circle4_mlt_inv_1"); + AddParticleToFieldObjDictionary("gimic_1/Null_Adjust/ef_nemesis1_add_nor_1/ef_radial15_add_nor_1/ef_circle9_mlt_inv_1"); + AddParticleToFieldObjDictionary("gimic_1/Null_Adjust/ef_nemesis1_add_nor_1/ef_nemesis1_add_nor_1/ef_nemesis1_mlt_inv_1"); + AddParticleToFieldObjDictionary("shake/Null_Adjust/ef_circle4_mlt_inv_1"); + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_76, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + if (areaId == 1) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_76_1, pos); + } + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(0f, -20f, -1330f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-3f, 0f, 0f)); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(0f, 0f, -700f), "time", 1.7f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuart)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(0f, 0f, 0f), "time", 1.7f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuart)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _gimicCntDictionary[obj.tag]++; + _fieldParticleSystemDictionary["gimic_1"].Play(); + yield return new WaitForSeconds(3f); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/FilteringSleeveSelection.cs b/SVSim.BattleEngine/Engine/Wizard/FilteringSleeveSelection.cs new file mode 100644 index 0000000..822fee3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/FilteringSleeveSelection.cs @@ -0,0 +1,77 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class FilteringSleeveSelection : FilteringImageSelection +{ + [Header("Objects")] + [SerializeField] + private UITexture _zoomTexture; + + [SerializeField] + private UIPanel _zoomPanel; + + private const float ZOOM_DURATION = 0.3f; + + protected override FavoriteTask.Kind TaskKind => FavoriteTask.Kind.SLEEVE; + + protected override string SelectionButtonTextId => "Profile_0046"; + + public override void Initialize(int itemMax, int seriesMax) + { + base.Initialize(itemMax, seriesMax); + EventDelegate.Add(_selectedItemTexture.gameObject.AddMissingComponent().onClick, OpenZoom); + EventDelegate.Add(_zoomTexture.gameObject.AddMissingComponent().onClick, CloseZoom); + } + + private void OpenZoom() + { + _soundManager.PlaySe(Se.TYPE.SYS_CARD_INFO); + _zoomPanel.gameObject.SetActive(value: true); + iTween.Stop(_zoomTexture.gameObject); + _zoomTexture.transform.localScale = Vector3.zero; + iTween.ScaleTo(_zoomTexture.gameObject, iTween.Hash("islocal", true, "scale", Vector3.one, "time", 0.3f, "easetype", iTween.EaseType.easeOutExpo)); + } + + private void CloseZoom() + { + iTween.Stop(_zoomTexture.gameObject); + _soundManager.PlaySe(Se.TYPE.SYS_BTN_CANCEL); + _zoomPanel.gameObject.SetActive(value: false); + } + + protected override void SetSelectedDisplay(ItemData data) + { + if (_selectedItemTexture != null && long.TryParse(data._key, out var result)) + { + result = Toolbox.ResourcesManager.GetExistingSleeveId(result); + _uiManager.getUIBase_CardManager().SetSleeveTexture(_zoomTexture, result); + _uiManager.getUIBase_CardManager().SetSleeveTexture(_selectedItemTexture, result); + _selectedItemTexture.enabled = true; + } + if (_selectedItemNameLabel != null) + { + _selectedItemNameLabel.SetWrapText(data._name); + } + UpdateToggleFavoriteButton(data.IsFavorite); + } + + protected override void UpdateFavoriteFlag(IEnumerable added, IEnumerable removed) + { + foreach (long item in added) + { + Data.Master.SleeveMgr.SetFavorite(item, b: true); + } + foreach (long item2 in removed) + { + Data.Master.SleeveMgr.SetFavorite(item2, b: false); + } + } + + protected override IEnumerable GetFavorites() + { + return Data.Master.SleeveMgr.GetFavorites(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/FirstTips.cs b/SVSim.BattleEngine/Engine/Wizard/FirstTips.cs new file mode 100644 index 0000000..eb5b8b6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/FirstTips.cs @@ -0,0 +1,362 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class FirstTips : MonoBehaviour +{ + public enum TipsType + { + Deck = 0, + CardCreate = 1, + ChallengeTwoPick = 2, + SoroPlay = 3, + Battle = 4, + Card = 5, + VideoSharing = 6, + VideoRecordingIosJpn = 7, + VideoRecordingIosEng = 8, + VideoRecordingAndroidEng = 9, + ShopCardPack = 10, + CardDestruct = 11, + Convention = 12, + BattleBeforeFormatUser = 13, + DeckBeforeFormatUser = 14, + DeckAfterFormatUser = 15, + Colosseum = 16, + ColosseumInfo = 17, + Challenge = 18, + Sealed = 19, + GuildNotJoining = 20, + GuildJoining = 21, + SoroPlayOnlydAssist = 22, + SpotCardExchange = 23, + GachaPointExchange = 24, + Quest = 25, + AdditionalPuzzle = 26, + Competition = 27, + Crossover = 28, + Bingo = 29, + NeutralPopularityVote = 30, + LeaderPopularityVote = 31, + CompetitionVer2 = 32, + MyRotationDeck = 33, + BossRush = 34, + CompetitionTwoPick = 35, + RedEtherCampaign = 36, + SoroPlay2 = 37, + ResurgentCard = 38, + ColosseumWindFall = 39, + HeroesFreeMatch = 40, + HeroesGrandPrix = 41, + TimeslipResurgentCard = 42, + Colosseum2PickChaos = 43, + ChallengeTwoPickCube = 44, + ChallengeTwoPickChaos = 45, + Max = 46, + MyPage = 1001, + BattlePathSeason = 1002 + } + + protected enum Csv + { + TipsType, + TextId, + Mask, + PrefabName, + ImageName + } + + public const float TWEEN_ALPHA_TIME = 0.5f; + + [SerializeField] + private UITexture m_ImageTex; + + [SerializeField] + private UILabel m_WindowLabel; + + [SerializeField] + private GameObject m_NextTextMarkObject; + + [SerializeField] + private GameObject m_MaskObject; + + [SerializeField] + private TweenAlpha m_TweenAlpha; + + [SerializeField] + private UIPanel _panel; + + private ArrayList m_Csv; + + private List m_TipsData; + + private IEnumerable _tipsTypes; + + private int m_PageNo; + + private int m_PageMaxNo; + + private GameObject m_TipsPrefab; + + private bool m_DestoryFlg; + + private bool _isResourceLoadFinish; + + private int _startPage; + + private List m_AssetFileList = new List(); + + private ResourcesManager.AssetLoadPathType m_AssetType = ResourcesManager.AssetLoadPathType.FirstTips; + + private bool _isEnableBackKeyChange = true; + + private Action _onFinish; + + private int _seasonId; + + private const string TIPS_CSV_NAME = "firsttips"; + + public bool IsEnableBackKeyChange + { + get + { + return _isEnableBackKeyChange; + } + set + { + _isEnableBackKeyChange = value; + } + } + + public void CreateTips(TipsType in_TipsType, Action onFinish) + { + CreateTips(new TipsType[1] { in_TipsType }, onFinish); + } + + public void CreateTips(IEnumerable tipsTypes, Action onFinish, int startPage = 0, int seasonId = 0) + { + _startPage = startPage; + _onFinish = onFinish; + _panel.alpha = 0f; + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = false; + m_TweenAlpha.enabled = false; + m_AssetFileList.Clear(); + _tipsTypes = tipsTypes; + _seasonId = seasonId; + List list = new List(); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("firsttips", ResourcesManager.AssetLoadPathType.Master); + list.Add(assetTypePath); + m_AssetFileList.Add(assetTypePath); + UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(list, _CsvLoadEnd)); + } + + protected void _CsvLoadEnd() + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("etc/firsttips", ResourcesManager.AssetLoadPathType.Master, isfetch: true); + TextAsset textAsset = Toolbox.ResourcesManager.LoadObject(assetTypePath); + m_Csv = Utility.ConvertCSV(textAsset.text); + m_TipsData = new List(); + foreach (TipsType tipsType in _tipsTypes) + { + foreach (ArrayList item in m_Csv) + { + string[] array = (string[])item.ToArray(typeof(string)); + if (int.Parse(array[0]) == (int)tipsType) + { + m_TipsData.Add(array); + } + } + } + m_PageMaxNo = m_TipsData.Count; + List list = new List(); + foreach (string[] tipsDatum in m_TipsData) + { + if (tipsDatum[4] != "") + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(tipsDatum[4], m_AssetType); + assetTypePath2 = ConvertSeasonImageFileName((TipsType)int.Parse(tipsDatum[0]), assetTypePath2); + if (!list.Contains(assetTypePath2)) + { + list.Add(assetTypePath2); + m_AssetFileList.Add(assetTypePath2); + } + } + if (tipsDatum[3] != "") + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(tipsDatum[3], m_AssetType); + if (!list.Contains(assetTypePath2)) + { + list.Add(assetTypePath2); + m_AssetFileList.Add(assetTypePath2); + } + } + } + UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(list, _ResourceLoadEnd)); + } + + protected void _ResourceLoadEnd() + { + _isResourceLoadFinish = true; + m_TweenAlpha.enabled = true; + _PageSet(_startPage); + } + + public void TipsClickCallBack() + { + if (_isResourceLoadFinish && !m_DestoryFlg) + { + m_PageNo++; + if (m_PageMaxNo > m_PageNo) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_FEED_TEXT); + _PageSet(m_PageNo); + } + else if (m_PageNo == m_PageMaxNo) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL); + m_TweenAlpha.PlayReverse(); + m_DestoryFlg = true; + StartCoroutine(Destroy()); + } + } + } + + protected void _PageSet(int in_PageNo) + { + m_PageNo = in_PageNo; + SystemText systemText = Data.SystemText; + m_WindowLabel.SetWrapText(systemText.Get(m_TipsData[m_PageNo][1])); + if (m_PageMaxNo != 1) + { + m_NextTextMarkObject.SetActive(value: true); + } + else + { + m_NextTextMarkObject.SetActive(value: false); + } + if ("1" == m_TipsData[m_PageNo][2]) + { + m_MaskObject.SetActive(value: true); + } + else + { + m_MaskObject.SetActive(value: false); + } + string text = m_TipsData[m_PageNo][4]; + if (text != "") + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(text, m_AssetType, isfetch: true); + assetTypePath = ConvertSeasonImageFileName((TipsType)int.Parse(m_TipsData[m_PageNo][0]), assetTypePath); + Texture mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath); + m_ImageTex.mainTexture = mainTexture; + } + string path = m_TipsData[m_PageNo][3]; + if (m_TipsData[m_PageNo][3] != "") + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(path, m_AssetType, isfetch: true); + m_TipsPrefab = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + m_TipsPrefab = UnityEngine.Object.Instantiate(m_TipsPrefab); + m_TipsPrefab.transform.parent = m_ImageTex.gameObject.transform; + m_TipsPrefab.transform.localPosition = Vector3.zero; + m_TipsPrefab.transform.localScale = Vector3.one; + } + else if (m_TipsPrefab != null) + { + UnityEngine.Object.Destroy(m_TipsPrefab); + m_TipsPrefab = null; + } + } + + private static bool IsAllwaysDispaly(TipsType in_TipsType) + { + if (in_TipsType > TipsType.Max) + { + return true; + } + return false; + } + + private string ConvertSeasonImageFileName(TipsType tipsType, string imagePath) + { + if (tipsType == TipsType.BattlePathSeason || tipsType == TipsType.Colosseum2PickChaos || tipsType == TipsType.ChallengeTwoPickChaos) + { + return string.Format(imagePath, _seasonId); + } + return imagePath; + } + + public static bool IsFirstTipsOpen(TipsType in_TipsType) + { + if (IsAllwaysDispaly(in_TipsType)) + { + return true; + } + if (in_TipsType == TipsType.ColosseumInfo) + { + return true; + } + if ((Fix(long.Parse(PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.FIRST_TIPS))) & (1L << (int)in_TipsType)) != 0L) + { + return false; + } + return true; + } + + private IEnumerator Destroy() + { + float time = 0f; + while (time < 0.5f) + { + time += Time.deltaTime; + yield return null; + } + foreach (TipsType tipsType in _tipsTypes) + { + SaveFinishFirstTips(tipsType); + } + _onFinish.Call(); + UnityEngine.Object.Destroy(base.gameObject); + } + + public static void ClearTipsFlag() + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.FIRST_TIPS, 0.ToString()); + } + + public static void SaveFinishFirstTips(TipsType tips) + { + if (!IsAllwaysDispaly(tips)) + { + long value = long.Parse(PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.FIRST_TIPS)); + value = Fix(value); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.FIRST_TIPS, (value | (1L << (int)tips)).ToString()); + } + } + + protected void OnDestroy() + { + if (m_AssetFileList.Count != 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(m_AssetFileList); + } + if (IsEnableBackKeyChange) + { + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = true; + } + } + + public static long Fix(long value) + { + if (value < 0) + { + long num = Convert.ToInt64("0x00000000ffffffff", 16); + value &= num; + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.FIRST_TIPS, value.ToString()); + } + return value; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/FixedRemoveType.cs b/SVSim.BattleEngine/Engine/Wizard/FixedRemoveType.cs new file mode 100644 index 0000000..8bf7179 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/FixedRemoveType.cs @@ -0,0 +1,8 @@ +namespace Wizard; + +public enum FixedRemoveType +{ + RemoveByBanish, + RemoveByDestroy, + None +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Footer.cs b/SVSim.BattleEngine/Engine/Wizard/Footer.cs new file mode 100644 index 0000000..58ea508 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Footer.cs @@ -0,0 +1,405 @@ +using System; +using UnityEngine; +using Wizard.RoomMatch; + +namespace Wizard; + +public class Footer : UIBase +{ + [SerializeField] + private UIButton[] underButtons; + + [SerializeField] + private UISprite[] underButtonSprites; + + [SerializeField] + private UILabel[] underButtonLabels; + + [SerializeField] + private UILabelGradientOverwriter[] _labelGradientOverwriters; + + [SerializeField] + private UILabelEffectOverwriter[] _labelEffectOverwriters; + + [SerializeField] + private GameObject m_footerMenuObj; + + [SerializeField] + private GameObject InviteIcon; + + [SerializeField] + private GameObject ArenaIcon; + + [SerializeField] + private GameObject _soloPlayIcon; + + [SerializeField] + private GameObject _shopIcon; + + [SerializeField] + private GameObject OtherIcon; + + private string[] menuIdleTexTbl = new string[7] { "btn_main_home_off", "btn_main_story_off", "btn_main_battle_off", "btn_main_arena_off", "btn_main_card_off", "btn_main_shop_off", "btn_main_other_off" }; + + private string[] menuPushTexTbl = new string[7] { "btn_main_home_on", "btn_main_story_on", "btn_main_battle_on", "btn_main_arena_on", "btn_main_card_on", "btn_main_shop_on", "btn_main_other_on" }; + + public UIButton[] _underButtons => underButtons; + + public GameObject _footerMenuObj => m_footerMenuObj; + + public int CurrentIndex { get; private set; } + + private void Awake() + { + UpdateCurrentIndex(0); + InviteIconDisp(inDisp: false); + UpdateArenaBadgeIcon(); + SoloPlayIconDisp(inDisp: false); + SetShopIconVisible(visible: false); + underButtonLabels[0].text = Data.SystemText.Get("MyPage_0001"); + underButtonLabels[1].text = Data.SystemText.Get("MyPage_0002"); + underButtonLabels[2].text = Data.SystemText.Get("MyPage_0003"); + underButtonLabels[3].text = Data.SystemText.Get("MyPage_0004"); + underButtonLabels[4].text = Data.SystemText.Get("MyPage_0005"); + underButtonLabels[5].text = Data.SystemText.Get("MyPage_0006"); + underButtonLabels[6].text = Data.SystemText.Get("MyPage_0007"); + for (int i = 0; i < underButtons.Length; i++) + { + UIButton buttonUnder = underButtons[i]; + buttonUnder.gameObject.layer = 27; + buttonUnder.onClick.Clear(); + buttonUnder.onClick.Add(new EventDelegate(delegate + { + UIManager uiMgr = UIManager.GetInstance(); + int selectedMenu = int.Parse(buttonUnder.name); + if (uiMgr.IsTouchable) + { + if (MyPageMenu.Instance != null) + { + if (!MyPageMenu.Instance.IsVisible) + { + Action action = delegate + { + UIManager.ChangeViewSceneParam param2 = new UIManager.ChangeViewSceneParam + { + MyPageMenuIndex = selectedMenu, + IsCutCardMotion = false + }; + if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.Room)) + { + (UIManager.GetInstance().GetUIBase(UIManager.ViewScene.Room) as RoomRoot).CreateChangeSceneDialog(UIManager.ViewScene.MyPage, param2, delegate + { + UpdateCurrentIndex(selectedMenu); + }); + } + else + { + buttonSoundMenu(); + uiMgr.ChangeViewScene(UIManager.ViewScene.MyPage, param2); + UpdateCurrentIndex(selectedMenu); + } + }; + if (uiMgr.GetUiBaseOfCurrentScene().IsGetOutOfScene(action)) + { + action(); + } + } + else + { + buttonSoundMenu(); + if (CanPushCurrentButton(selectedMenu)) + { + MyPageMenu.Instance.ChangeMenu(selectedMenu); + } + } + } + else + { + UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam + { + MyPageMenuIndex = selectedMenu, + IsCutCardMotion = false + }; + if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.Room)) + { + (UIManager.GetInstance().GetUIBase(UIManager.ViewScene.Room) as RoomRoot).CreateChangeSceneDialog(UIManager.ViewScene.MyPage, param, delegate + { + UpdateCurrentIndex(selectedMenu); + }); + } + else + { + buttonSoundMenu(); + uiMgr.ChangeViewScene(UIManager.ViewScene.MyPage, param); + UpdateCurrentIndex(selectedMenu); + } + } + } + })); + } + UpdateArenaBadgeIcon(); + UpdateInviteIcon(); + UpdateOtherBadgeIcon(); + UpdateSoloPlayBadgeIcon(); + UpdateShopBadgeIcon(); + } + + protected bool CanPushCurrentButton(int selectedMenuIndex) + { + if (CurrentIndex != selectedMenuIndex) + { + return true; + } + if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.MyPage && MyPageMenu.Instance.IsEnableFooterCurrentMenu) + { + return true; + } + return false; + } + + private void buttonSoundMenu() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SWITCH_MENU); + } + + public void ShowFooterMenu(bool isShow) + { + m_footerMenuObj.SetActive(isShow); + EnableMyPageCamera(); + if (isShow) + { + UpdateArenaBadgeIcon(); + } + } + + private void EnableMyPageCamera() + { + if (MyPageMenu.Instance != null) + { + UIManager.GetInstance().MyPageUICameraObj.SetActive(_footerMenuObj.activeSelf || MyPageMenu.Instance.IsVisible); + } + else + { + UIManager.GetInstance().MyPageUICameraObj.SetActive(_footerMenuObj.activeSelf); + } + } + + public void UpdateCurrentIndex(int pushMenuIdx) + { + CurrentIndex = pushMenuIdx; + int num = menuIdleTexTbl.Length; + for (int i = 0; i < num; i++) + { + underButtonSprites[i].spriteName = menuIdleTexTbl[i]; + } + underButtonSprites[pushMenuIdx].spriteName = menuPushTexTbl[pushMenuIdx]; + } + + public void SetButtonEnableColorChange(int btnIndex, bool btnIsEnable = true) + { + underButtons[btnIndex].isEnabled = btnIsEnable; + if (btnIsEnable) + { + underButtonLabels[btnIndex].color = LabelDefine.TEXT_COLOR_BUTTON_ENABLE; + underButtonSprites[btnIndex].color = Color.white; + underButtonLabels[btnIndex].effectColor = LabelDefine.OUTLINE_COLOR_FOOTER_DEFAULT; + return; + } + underButtonLabels[btnIndex].color = LabelDefine.TEXT_COLOR_BUTTON_DISABLE; + underButtonSprites[btnIndex].color = LabelDefine.TEXT_COLOR_BUTTON_DISABLE; + if (Array.IndexOf(menuIdleTexTbl, underButtonSprites[btnIndex].spriteName) >= 0) + { + underButtonLabels[btnIndex].effectColor = LabelDefine.OUTLINE_COLOR_FOOTER_DISABLE_DEFAULT; + } + else + { + underButtonLabels[btnIndex].effectColor = LabelDefine.OUTLINE_COLOR_FOOTER_DISABLE_PUSH; + } + } + + public void SetAllButtonEnableColorChange(bool isEnable) + { + for (int i = 0; i < underButtons.Length; i++) + { + SetButtonEnableColorChange(i, isEnable); + } + } + + public void SetButtonEnable(int index, bool isEnable) + { + underButtons[index].isEnabled = isEnable; + } + + public void InviteIconDisp(bool inDisp) + { + InviteIcon.SetActive(inDisp); + } + + public void SoloPlayIconDisp(bool inDisp) + { + _soloPlayIcon.SetActive(inDisp); + } + + private void OtherIconDisp(bool inDisp) + { + OtherIcon.SetActive(inDisp); + } + + private void SetShopIconVisible(bool visible) + { + _shopIcon.SetActive(visible); + } + + public void UpdateInviteIcon() + { + InviteIconDisp(Data.Load.data._receiveInviteCount > 0); + } + + public void UpdateArenaBadgeIcon() + { + bool active = false; + if (Data.Load.data._userTutorial.TutorialStep != 100) + { + ArenaIcon.SetActive(value: false); + return; + } + if (Data.ArenaData != null && Data.ArenaData.ColosseumData.IsFreeEntry) + { + active = true; + } + if (Data.MyPageNotifications.data.IsCompetitionBadge) + { + active = true; + } + if (Data.MyPageNotifications.data.IsInviteGathering) + { + active = true; + } + if (Data.MyPageNotifications.data.GatheringMyPageInfo.IsMatchingNotification) + { + active = true; + } + ArenaIcon.SetActive(active); + } + + public void UpdateSoloPlayBadgeIcon() + { + bool flag = false; + bool flag2 = false; + bool flag3 = false; + if (Data.Load.data._userTutorial.TutorialStep == 100) + { + flag = Data.MyPageNotifications.data.QuestOpenInfo.IsDisplayBadge; + flag2 = Data.MyPageNotifications.data.StoryNotification.IsDisplayBadge; + flag3 = Data.MyPageNotifications.data.IsPracticePuzzleBadgeEnable; + } + SoloPlayIconDisp(flag || flag2 || flag3); + } + + public void UpdateQuestBadgeIcon(bool isDisp) + { + bool flag = isDisp; + bool flag2 = false; + bool flag3 = false; + if (Data.Load.data._userTutorial.TutorialStep == 100) + { + flag2 = Data.MyPageNotifications.data.StoryNotification.IsDisplayBadge; + flag3 = Data.MyPageNotifications.data.IsPracticePuzzleBadgeEnable; + } + SoloPlayIconDisp(flag || flag2 || flag3); + } + + public void TurnOffStoryBadgeIcon(bool isTurnOffDisplayBadgeFlag) + { + bool flag = false; + bool flag2 = false; + if (Data.Load.data._userTutorial.TutorialStep == 100) + { + flag = Data.MyPageNotifications.data.QuestOpenInfo.IsDisplayBadge; + flag2 = Data.MyPageNotifications.data.IsPracticePuzzleBadgeEnable; + } + if (isTurnOffDisplayBadgeFlag) + { + Data.MyPageNotifications.data.StoryNotification.TurnOffIsDisplayBadge(); + } + SoloPlayIconDisp(flag || flag2); + } + + public void UpdateOtherBadgeIcon() + { + OtherIconDisp(Data.MyPageNotifications.data.ReceiveFriendApplyCount > 0); + } + + public void UpdateShopBadgeIcon() + { + if (Data.Load.data._userTutorial.TutorialStep != 100) + { + SetShopIconVisible(visible: false); + } + else if (Data.MyPageNotifications.data.ShopNotification.AppealCardPack == null) + { + SetShopIconVisible(visible: false); + } + else + { + SetShopIconVisible(Data.MyPageNotifications.data.ShopNotification.AppealCardPack.NeedsFooterBadgeIcon); + } + } + + public void SetShopBadgeIconVisible(bool visible) + { + Data.MyPageNotifications.data.ShopNotification.AppealCardPack.NeedsFooterBadgeIcon = visible; + UpdateShopBadgeIcon(); + } + + public void OverwriteLabelColors(eColorCodeId gradientTopColorId, eColorCodeId gradientBottomColorId, eColorCodeId effectColorId) + { + OverwriteLabelGradients(gradientTopColorId, gradientBottomColorId); + OverwriteLabelEffects(effectColorId); + } + + public void CancelOverwriteLabelColors() + { + CancelOverwriteLabelGradients(); + CancelOverwriteLabelEffects(); + } + + private void OverwriteLabelGradients(eColorCodeId topColorId, eColorCodeId bottomColorId) + { + UILabelGradientOverwriter[] labelGradientOverwriters = _labelGradientOverwriters; + foreach (UILabelGradientOverwriter obj in labelGradientOverwriters) + { + obj.enabled = true; + obj.GradientTopColorId = topColorId; + obj.GradientBottomColorId = bottomColorId; + } + } + + private void CancelOverwriteLabelGradients() + { + UILabelGradientOverwriter[] labelGradientOverwriters = _labelGradientOverwriters; + for (int i = 0; i < labelGradientOverwriters.Length; i++) + { + labelGradientOverwriters[i].enabled = false; + } + } + + private void OverwriteLabelEffects(eColorCodeId colorId) + { + UILabelEffectOverwriter[] labelEffectOverwriters = _labelEffectOverwriters; + foreach (UILabelEffectOverwriter obj in labelEffectOverwriters) + { + obj.enabled = true; + obj.EffectColorId = colorId; + } + } + + private void CancelOverwriteLabelEffects() + { + UILabelEffectOverwriter[] labelEffectOverwriters = _labelEffectOverwriters; + for (int i = 0; i < labelEffectOverwriters.Length; i++) + { + labelEffectOverwriters[i].enabled = false; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/FormatBehaviorManager.cs b/SVSim.BattleEngine/Engine/Wizard/FormatBehaviorManager.cs new file mode 100644 index 0000000..b2e4d23 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/FormatBehaviorManager.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class FormatBehaviorManager +{ + private static Dictionary _behaviorDic = new Dictionary(); + + public static IFormatBehavior Create(Format format, ConventionDeckList conventionDeckList) + { + if (conventionDeckList != null) + { + switch (format) + { + case Format.Rotation: + return new ConventionRotationFormatBehavior(conventionDeckList); + case Format.Unlimited: + return new ConventionUnlimitedFormatBehavior(conventionDeckList); + case Format.Crossover: + return new ConventionCrossoverFormatBehavior(conventionDeckList); + case Format.MyRotation: + return new ConventionMyRotationFormatBehavior(conventionDeckList); + } + } + return GetDefaultBehaviour(format); + } + + public static IFormatBehavior GetDefaultBehaviour(Format format) + { + if (_behaviorDic.TryGetValue(format, out var value)) + { + return value; + } + value = CreateDefaultBehaviour(format); + _behaviorDic.Add(format, value); + return value; + } + + private static IFormatBehavior CreateDefaultBehaviour(Format format) + { + return format switch + { + Format.Rotation => new RotationFormatBehavior(), + Format.Unlimited => new UnlimitedFormatBehavior(), + Format.Sealed => new SealedFormatBehavior(), + Format.PreRotation => new PreRotationFormatBehavior(), + Format.Hof => new HofFormatBehavior(), + Format.Crossover => new CrossoverFormatBehavior(), + Format.MyRotation => new MyRotationFormatBehavior(), + Format.Avatar => new AvatarFormatBehavior(), + _ => new NoneFormatBehavior(), + }; + } + + public static string GetFormatName(Format format) + { + return format switch + { + Format.Hof => Data.SystemText.Get("Colosseum_0108"), + Format.Windfall => Data.SystemText.Get("Colosseum_0115"), + _ => GetDefaultBehaviour(format).Name, + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/FormatChangeUI.cs b/SVSim.BattleEngine/Engine/Wizard/FormatChangeUI.cs new file mode 100644 index 0000000..e76949e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/FormatChangeUI.cs @@ -0,0 +1,202 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class FormatChangeUI : MonoBehaviour +{ + public enum FormatCategory + { + Invalid, + Rotation, + Unlimited, + PreRotation, + Crossover, + Hof, + Windfall, + MyRotation, + Avatar, + Other + } + + private const string UNLIMITED_CENTER_SPRITE_OFF = "btn_unlimited_center_off"; + + private const string UNLIMITED_CENTER_SPRITE_ON = "btn_unlimited_center_on"; + + private const string UNLIMITED_RIGHT_SPRITE_OFF = "btn_gacha_unlimited_off"; + + private const string UNLIMITED_RIGHT_SPRITE_ON = "btn_gacha_unlimited_on"; + + private const string OLD_ROTATION_SPRITE_ON = "btn_gacha_rotation_on"; + + private const string OLD_ROTATION_SPRITE_OFF = "btn_gacha_rotation_off"; + + private static readonly Dictionary ANOTHER_BTN_SPRITES = new Dictionary + { + { + FormatCategory.Other, + ("btn_gacha_other_on", "btn_gacha_other_off") + }, + { + FormatCategory.PreRotation, + ("btn_prerotation_on", "btn_prerotation_off") + }, + { + FormatCategory.Crossover, + ("btn_gacha_crossover_on", "btn_gacha_crossover_off") + }, + { + FormatCategory.MyRotation, + ("btn_gacha_myrotation_on", "btn_gacha_myrotation_off") + } + }; + + [SerializeField] + private UIButton _btnRotation; + + [SerializeField] + private UIButton _btnUnlimited; + + [SerializeField] + private UIButton _btnAnother; + + private FormatCategory _currentFormatCategory = FormatCategory.Rotation; + + private Action _onChangeFormat; + + public static FormatChangeUI Create(FormatCategory defaultFormatCategory, FormatCategory anotherFormatCategory, Action onChangeFormat) + { + FormatChangeUI component = (UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/Guild/FormatChangeUI")) as GameObject).GetComponent(); + component.gameObject.SetActive(value: true); + component.Initialize(defaultFormatCategory, anotherFormatCategory, onChangeFormat); + return component; + } + + public void ShowOldRotationIcon() + { + _btnRotation.normalSprite = "btn_gacha_rotation_on"; + _btnRotation.pressedSprite = "btn_gacha_rotation_off"; + } + + public void ChangeFormat(FormatCategory inFormatCategory) + { + _currentFormatCategory = inFormatCategory; + UpdateFormatBtnSprite(inFormatCategory); + } + + public void SetEnableFormatButton(FormatCategory formatCategory, bool isEnable) + { + switch (formatCategory) + { + case FormatCategory.Rotation: + UIManager.SetObjectToGrey(_btnRotation.gameObject, !isEnable); + return; + case FormatCategory.Unlimited: + UIManager.SetObjectToGrey(_btnUnlimited.gameObject, !isEnable); + return; + } + if (ANOTHER_BTN_SPRITES.ContainsKey(formatCategory)) + { + UIManager.SetObjectToGrey(_btnAnother.gameObject, !isEnable); + } + } + + public void UpdateAnotherFormatButton(FormatCategory anotherFormatCategory) + { + bool flag = anotherFormatCategory != FormatCategory.Invalid; + _btnAnother.gameObject.SetActive(flag); + _btnUnlimited.normalSprite = (flag ? "btn_unlimited_center_off" : "btn_gacha_unlimited_off"); + _btnUnlimited.pressedSprite = (flag ? "btn_unlimited_center_on" : "btn_gacha_unlimited_on"); + if (flag) + { + _btnAnother.onClick.Add(new EventDelegate(delegate + { + OnClickChangeFormatBtn(anotherFormatCategory); + })); + _btnAnother.normalSprite = ANOTHER_BTN_SPRITES[anotherFormatCategory].OFF; + _btnAnother.pressedSprite = ANOTHER_BTN_SPRITES[anotherFormatCategory].ON; + } + else + { + _btnAnother.onClick.Clear(); + } + } + + private void Initialize(FormatCategory defaultFormatCategory, FormatCategory anotherFormatCategory, Action onChangeFormat) + { + InitializeFormatCategoryButtons(anotherFormatCategory); + _onChangeFormat = onChangeFormat; + ChangeFormat(defaultFormatCategory); + } + + private void InitializeFormatCategoryButtons(FormatCategory anotherFormatCategory) + { + _btnRotation.onClick.Add(new EventDelegate(delegate + { + OnClickChangeFormatBtn(FormatCategory.Rotation); + })); + _btnUnlimited.onClick.Add(new EventDelegate(delegate + { + OnClickChangeFormatBtn(FormatCategory.Unlimited); + })); + UpdateAnotherFormatButton(anotherFormatCategory); + } + + private void OnClickChangeFormatBtn(FormatCategory formatCategory) + { + if (_currentFormatCategory != formatCategory) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + ChangeFormat(formatCategory); + _onChangeFormat.Call(formatCategory); + StartCoroutine(WaitForCanClickFormatBtns()); + } + } + + private IEnumerator WaitForCanClickFormatBtns() + { + SetEnableAllBtns(isEnable: false); + yield return new WaitForSeconds(0.4f); + SetEnableAllBtns(isEnable: true); + } + + private void SetEnableAllBtns(bool isEnable) + { + _btnRotation.isEnabled = isEnable; + _btnUnlimited.isEnabled = isEnable; + _btnAnother.isEnabled = isEnable; + } + + private string RenameSpriteString(string str, bool isEnable) + { + string oldValue = (isEnable ? "_off" : "_on"); + string newValue = (isEnable ? "_on" : "_off"); + return str.Replace(oldValue, newValue); + } + + private void UpdateFormatBtnSprite(FormatCategory inFormatCategory) + { + switch (inFormatCategory) + { + case FormatCategory.Rotation: + _btnRotation.normalSprite = RenameSpriteString(_btnRotation.normalSprite, isEnable: true); + _btnUnlimited.normalSprite = RenameSpriteString(_btnUnlimited.normalSprite, isEnable: false); + _btnAnother.normalSprite = RenameSpriteString(_btnAnother.normalSprite, isEnable: false); + return; + case FormatCategory.Unlimited: + _btnRotation.normalSprite = RenameSpriteString(_btnRotation.normalSprite, isEnable: false); + _btnUnlimited.normalSprite = RenameSpriteString(_btnUnlimited.normalSprite, isEnable: true); + _btnAnother.normalSprite = RenameSpriteString(_btnAnother.normalSprite, isEnable: false); + return; + } + if (ANOTHER_BTN_SPRITES.ContainsKey(inFormatCategory)) + { + _btnRotation.normalSprite = RenameSpriteString(_btnRotation.normalSprite, isEnable: false); + _btnUnlimited.normalSprite = RenameSpriteString(_btnUnlimited.normalSprite, isEnable: false); + _btnAnother.normalSprite = RenameSpriteString(_btnAnother.normalSprite, isEnable: true); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/FreeCardPackCampaignFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/FreeCardPackCampaignFinishTask.cs new file mode 100644 index 0000000..d15777b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/FreeCardPackCampaignFinishTask.cs @@ -0,0 +1,41 @@ +namespace Wizard; + +public class FreeCardPackCampaignFinishTask : BaseTask +{ + public class FreeCardPackCampaignFinishTaskParam : BaseParam + { + public int campaign_id { get; set; } + + public int prize { get; set; } + + public int opened_box { get; set; } + } + + public FreeCardPackCampaignFinishTask() + { + base.type = ApiType.Type.FreeCardPackBoxFinish; + } + + public void SetParameter(int campaignId, int prizeId, int openedBox) + { + FreeCardPackCampaignFinishTaskParam freeCardPackCampaignFinishTaskParam = new FreeCardPackCampaignFinishTaskParam(); + freeCardPackCampaignFinishTaskParam.campaign_id = campaignId; + freeCardPackCampaignFinishTaskParam.prize = prizeId; + freeCardPackCampaignFinishTaskParam.opened_box = openedBox; + base.Params = freeCardPackCampaignFinishTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + if (base.ResponseData["data"].TryGetValue("reward_list", out var value)) + { + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(value); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/FullSimulationAI.cs b/SVSim.BattleEngine/Engine/Wizard/FullSimulationAI.cs new file mode 100644 index 0000000..a109055 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/FullSimulationAI.cs @@ -0,0 +1,338 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; + +namespace Wizard; + +public class FullSimulationAI : IBattleSimulationAI +{ + private EnemyAI AI; + + private int bestMoveCount; + + private bool _isOverComplexity; + + private int _bestFirstDeadIndex; + + private int _originalFieldInplayCount; + + private ulong[] _defaultPlayptnHashArray; + + private List _simulationAllMoves; + + public AIVirtualActionInfo Cr_FirstActionInfo { get; private set; } + + public AIVirtualField Cr_MaxField { get; private set; } + + public float Cr_MaxFieldValue { get; private set; } + + public float Cr_MaxFieldValueAtSelfTurnEnd { get; private set; } + + public List Cr_MaxActionInfoSequence { get; private set; } + + public PlayPtnWithToken Cr_BestPlayPtnWithToken { get; private set; } + + public FullSimulationAI(EnemyAI ai, List allMoves) + { + AI = ai; + Cr_FirstActionInfo = null; + bestMoveCount = int.MaxValue; + Cr_MaxFieldValue = float.MinValue; + Cr_MaxFieldValueAtSelfTurnEnd = float.MinValue; + Cr_MaxActionInfoSequence = null; + Cr_MaxField = null; + _isOverComplexity = false; + _originalFieldInplayCount = 0; + _simulationAllMoves = allMoves; + } + + public IEnumerator _CrSimulate(AIVirtualField originalField, bool doesUseEvo, bool checkTimeOverLogic, PlayPtnWithToken[] bestPlayPtnsWithToken = null, SimulationAdditionalActionInfoSet additionalActions = null) + { + _ = originalField.ParamQuery; + Cr_FirstActionInfo = null; + bestMoveCount = int.MaxValue; + Cr_MaxFieldValue = float.MinValue; + Cr_MaxFieldValueAtSelfTurnEnd = float.MinValue; + Cr_MaxActionInfoSequence = null; + Cr_MaxField = null; + _isOverComplexity = false; + AI.IsInVirutalSimulation = true; + _originalFieldInplayCount = originalField.AllyInplayCards.Count((AIVirtualCard c) => !c.IsDead); + _defaultPlayptnHashArray = AISimulationUtility.CalculatePlayptnWithTokenHashs(originalField, bestPlayPtnsWithToken); + AI.IsFullSimulation = true; + ParallelJob job = ParallelJob.Dispatch(delegate + { + try + { + List recursiveMoveList = null; + RunAllMoves(originalField, doesUseEvo, _simulationAllMoves, bestPlayPtnsWithToken, recursiveMoveList, additionalActions); + } + catch (Exception) + { + } + }); + while (!job.isDone) + { + yield return null; + if (checkTimeOverLogic && AI.IsRunWeakLogic) + { + AI.IsInVirutalSimulation = false; + yield break; + } + } + AI.IsFullSimulation = false; + if (_isOverComplexity) + { + BestInPlayMoveAI safety = new BestInPlayMoveAI(AI); + yield return EnemyAICoroutine.GetInstance().StartCoroutine(safety._CrSimulate(originalField, doesUseEvo, checkTimeOverLogic: false, bestPlayPtnsWithToken, additionalActions)); + Cr_FirstActionInfo = safety.Cr_FirstActionInfo; + Cr_MaxField = safety.Cr_MaxField; + Cr_MaxFieldValue = safety.Cr_MaxFieldValue; + Cr_MaxActionInfoSequence = safety.Cr_MaxActionInfoSequence; + } + AI.IsInVirutalSimulation = false; + } + + private void RunAllMoves(AIVirtualField field, bool doesUseEvo, List allMoveSet, PlayPtnWithToken[] bestPlayPtnsWithToken, List recursiveMoveList, SimulationAdditionalActionInfoSet additionalActions) + { + if (AI.IsRunWeakLogic) + { + return; + } + if (allMoveSet.Count > AISimulationUtility.FULL_SIMULATION_MOVE_COUNT_TURESHOLD) + { + _isOverComplexity = true; + return; + } + AIVirtualTargetSelectAction aIVirtualTargetSelectAction = null; + if (additionalActions != null) + { + aIVirtualTargetSelectAction = additionalActions.ForceEvoAction; + } + if (aIVirtualTargetSelectAction != null && !IsAttackPlanContainsSituation(recursiveMoveList, aIVirtualTargetSelectAction) && !IsAttackPlanContainsSituation(allMoveSet, aIVirtualTargetSelectAction)) + { + return; + } + List list = new List(); + bool isPlayptnSimulation = bestPlayPtnsWithToken != null; + for (int i = 0; i < allMoveSet.Count && !AI.IsRunWeakLogic; i++) + { + AIVirtualField aIVirtualField = new AIVirtualField(field, isLatestAction: false, isPlayptnSimulation); + AIVirtualActionInfo cloneActionInfo = GetCloneActionInfo(aIVirtualField, allMoveSet[i]); + if (cloneActionInfo == null) + { + continue; + } + ulong hash = cloneActionInfo.GetHash(); + if (list.Contains(hash)) + { + continue; + } + List list2 = ((recursiveMoveList == null) ? new List() : new List(recursiveMoveList)); + list2.Add(cloneActionInfo); + if (AI.IsRunWeakLogic) + { + break; + } + switch (cloneActionInfo.ActionType) + { + case AIOperationType.PLAY: + RunPlay(cloneActionInfo, aIVirtualField); + break; + case AIOperationType.EVOLVE: + RunEvolution(cloneActionInfo, aIVirtualField); + break; + case AIOperationType.ATTACK: + RunAttack(cloneActionInfo, aIVirtualField); + break; + case AIOperationType.TURNEND: + RunTurnEnd(cloneActionInfo, aIVirtualField, bestPlayPtnsWithToken, list2, aIVirtualTargetSelectAction); + continue; + } + if (AI.IsRunWeakLogic) + { + break; + } + if (aIVirtualField.EnemyClass.IsDead || aIVirtualField.AllyClass.IsDead) + { + UpdateBestRecord(aIVirtualField, list2, null, 0, aIVirtualTargetSelectAction); + continue; + } + SimulationAdditionalActionInfoSet simulationAdditionalActionInfoSet = new SimulationAdditionalActionInfoSet + { + ForceEvoAction = ((cloneActionInfo.ActionType == AIOperationType.EVOLVE) ? null : aIVirtualTargetSelectAction), + ExtraActionBaseList = additionalActions?.ExtraActionBaseList, + PlayPtnRecord = additionalActions?.PlayPtnRecord + }; + List allMovesForFullSimulation = AISimulationUtility.GetAllMovesForFullSimulation(aIVirtualField, doesUseEvo, simulationAdditionalActionInfoSet); + RunAllMoves(aIVirtualField, doesUseEvo, allMovesForFullSimulation, bestPlayPtnsWithToken, list2, simulationAdditionalActionInfoSet); + if (_isOverComplexity || AI.IsRunWeakLogic) + { + break; + } + list.Add(hash); + } + } + + private void RunPlay(AIVirtualActionInfo play, AIVirtualField field) + { + PlaySimulationInfo playInfo = AIPlayCardSimulationUtility.CreatePlaySimulationInfo(play.Actor, play, field); + AIVirtualPlaySimulator.PlayCard((AIVirtualTargetSelectAction)play, field, playInfo); + } + + private void RunEvolution(AIVirtualActionInfo evolution, AIVirtualField field) + { + AIVirtualCard actor = evolution.Actor; + if (!actor.IsDead && !actor.IsEvolution) + { + actor.IsUseEvo = true; + AIVirtualEvolutionSimulator.ManualEvolve(evolution, field); + field.EvoUsedCard = actor; + } + } + + private void RunAttack(AIVirtualActionInfo attackSituation, AIVirtualField field) + { + AIVirtualAttackInfo aIVirtualAttackInfo = attackSituation as AIVirtualAttackInfo; + AIVirtualCard actor = aIVirtualAttackInfo.Actor; + AIVirtualAttackSimulator.Attack(aIVirtualAttackInfo, field); + if (aIVirtualAttackInfo.AttackTarget.IsDead) + { + aIVirtualAttackInfo.IsBreakTarget = true; + } + if (aIVirtualAttackInfo.IsAttackSuccessed && actor.TagCollectionContainer.HasTag(AIPlayTagType.PuppetAttack)) + { + actor.TagCollectionContainer.PuppetAttackTags.ExecutePuppetAttack(actor, aIVirtualAttackInfo, null); + } + if (aIVirtualAttackInfo.AttackTarget.IsDead) + { + aIVirtualAttackInfo.IsBreakTarget = true; + } + } + + private void RunTurnEnd(AIVirtualActionInfo move, AIVirtualField field, PlayPtnWithToken[] bestPlayPtnsWithToken, List passToNext, AIVirtualTargetSelectAction forceEvoSituation) + { + int openCount = 0; + if (bestPlayPtnsWithToken == null) + { + BattleSequencer.OnAfterExecuteAttackCommon(field, (AIVirtualTurnEndInfo)move, ref passToNext, isAttackToLeaderAgain: true); + } + else + { + openCount = _originalFieldInplayCount - field.AllyInplayCards.Count((AIVirtualCard c) => !c.IsDead); + } + UpdateBestRecord(field, passToNext, bestPlayPtnsWithToken, openCount, forceEvoSituation); + } + + private void UpdateBestRecord(AIVirtualField fieldTemp, List moves, PlayPtnWithToken[] bestPlayPtnsWithToken, int openCount, AISituationInfo forceEvoSituation) + { + if (forceEvoSituation != null && !IsAttackPlanContainsSituation(moves, forceEvoSituation)) + { + return; + } + float num = AISimulationUtility.EvaluateField(fieldTemp, EvaluationType.SELF_TURN); + float num2 = num; + int bestFirstDeadActionIndex = int.MaxValue; + PlayPtnWithToken bestPlayPtnWithToken = null; + if (bestPlayPtnsWithToken != null) + { + num2 += AISimulationUtility.CalculateOneOnOneBothDeadBonus(moves); + num2 += AISimulationUtility.EvaluateLegalPlayPtnAfterSimulation(fieldTemp, moves, bestPlayPtnsWithToken, openCount, _defaultPlayptnHashArray, out bestPlayPtnWithToken, out bestFirstDeadActionIndex); + } + else + { + num2 -= (fieldTemp.EnemyClass.IsDead ? 0f : fieldTemp.EvaluateThreaten()); + } + num2 -= (float)fieldTemp.ActionLength * 0.001f; + num2 += AISimulationUtility.CalculateMoveFirstBonusValue(moves); + bool flag = false; + if (fieldTemp.EnemyClass.IsDead) + { + if (Cr_MaxField == null || !Cr_MaxField.EnemyClass.IsDead || fieldTemp.ActionLength < bestMoveCount || (fieldTemp.ActionLength == bestMoveCount && EnemyAI.IsLargerThan(num2, Cr_MaxFieldValue))) + { + if (moves[0].ActionType == AIOperationType.TURNEND) + { + AI.IsTurnEndLethal = true; + } + flag = true; + } + } + else if (EnemyAI.IsLargerThan(num2, Cr_MaxFieldValue)) + { + flag = true; + } + else if (EnemyAI.IsSameValue(num2, Cr_MaxFieldValue)) + { + if (bestPlayPtnsWithToken == null) + { + if (EnemyAI.IsLargerThan(num, Cr_MaxFieldValueAtSelfTurnEnd)) + { + flag = true; + } + } + else if (bestFirstDeadActionIndex < _bestFirstDeadIndex) + { + flag = true; + } + } + if (flag) + { + Cr_MaxFieldValue = num2; + Cr_MaxFieldValueAtSelfTurnEnd = num; + Cr_MaxActionInfoSequence = moves; + Cr_FirstActionInfo = moves[0]; + bestMoveCount = fieldTemp.ActionLength; + Cr_MaxField = fieldTemp; + if (bestPlayPtnsWithToken != null) + { + _bestFirstDeadIndex = bestFirstDeadActionIndex; + Cr_BestPlayPtnWithToken = bestPlayPtnWithToken; + } + } + } + + private AIVirtualActionInfo GetCloneActionInfo(AIVirtualField fieldTemp, AIVirtualActionInfo action) + { + if (action == null || action is AIVirtualTurnEndInfo) + { + return action; + } + AIVirtualCard aIVirtualCard = null; + aIVirtualCard = ((action.ActionType != AIOperationType.PLAY) ? fieldTemp.AllyInplayCards.Find((AIVirtualCard c) => c.CardIndex == action.OriginalCard.CardIndex) : fieldTemp.AllyHandCards.Find((AIVirtualCard c) => c.CardIndex == action.OriginalCard.CardIndex)); + if (aIVirtualCard == null) + { + AIConsoleUtility.LogError("FullSimulationAI.GetCloneActionInfo() error!! Cannot find originalCard!!!!!"); + return null; + } + if (action is AIVirtualTargetSelectAction aIVirtualTargetSelectAction) + { + return new AIVirtualTargetSelectAction(aIVirtualCard.IsSameCard(action.Actor) ? aIVirtualCard : new AIVirtualCard(action.Actor, fieldTemp), selectedTargetList: aIVirtualTargetSelectAction.SelectedTargets.GetSimilarTargetInfoSet(fieldTemp), original: aIVirtualCard, operationType: action.ActionType); + } + if (action is AIVirtualAttackInfo) + { + AIVirtualAttackInfo aIVirtualAttackInfo = action as AIVirtualAttackInfo; + AIVirtualCard originalAttackTarget = aIVirtualAttackInfo.AttackTarget; + AIVirtualCard target = fieldTemp.CardListSet.EnemyClassAndInplayCards.Find((AIVirtualCard c) => c.CardIndex == originalAttackTarget.CardIndex); + return new AIVirtualAttackInfo(aIVirtualCard, target); + } + return null; + } + + private bool IsAttackPlanContainsSituation(List moves, AISituationInfo situation) + { + if (moves == null || moves.Count <= 0) + { + return false; + } + for (int i = 0; i < moves.Count; i++) + { + if (moves[i].IsSameSituation(situation)) + { + return true; + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GachaPointExchangePlate.cs b/SVSim.BattleEngine/Engine/Wizard/GachaPointExchangePlate.cs new file mode 100644 index 0000000..baf358b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GachaPointExchangePlate.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.Arena; + +namespace Wizard; + +public class GachaPointExchangePlate : MonoBehaviour +{ + private readonly Quaternion CARDOBJECT_ROTATION_QUATERNION = new Quaternion(0f, 0f, 0f, 0f); + + private const string SPOT_CARD_NUM_FORMAT = "[fcd24a]+{0}[-]"; + + [SerializeField] + private GameObject _objCardRoot; + + [SerializeField] + private UILabel _labelCardName; + + [SerializeField] + private UILabel _labelCardPossessionNum; + + [SerializeField] + private UILabel _labelCardPossessionNumNormal; + + [SerializeField] + private UILabel _labelCardPossessionNumPremium; + + [SerializeField] + private UIButton _btnExchangeCard; + + [SerializeField] + private UILabel _labelReward; + + [SerializeField] + private UILabel _labelOwnedReward; + + private GameObject _cardObject; + + public void SetData(GachaPointExchangeInfo gachaPointInfo, Action onClickExchangButton, bool isExchangeable) + { + string text = gachaPointInfo.GetExchangeCardText(); + if (gachaPointInfo.RewardList.Any((Wizard.Scripts.Network.Data.TaskData.Arena.Reward c) => c.UserGoodsData.GoodsType == UserGoods.Type.Skin)) + { + text = Data.SystemText.Get("Shop_0232") + " " + text; + } + if (gachaPointInfo.IsDisplayPrize) + { + text = Data.SystemText.Get("Shop_0235") + " " + text; + } + _labelCardName.text = text; + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + int possessionCardNum = dataMgr.GetPossessionCardNum(gachaPointInfo.CardId, isIncludingSpotCard: false); + int spotCardNum = dataMgr.SpotCardData.GetSpotCardNum(gachaPointInfo.CardId); + _labelCardPossessionNumNormal.text = possessionCardNum + ((spotCardNum > 0) ? $"[fcd24a]+{spotCardNum}[-]" : string.Empty); + int cardId = gachaPointInfo.CardId + 1; + int possessionCardNum2 = dataMgr.GetPossessionCardNum(cardId, isIncludingSpotCard: false); + _labelCardPossessionNumPremium.text = possessionCardNum2.ToString(); + int num = possessionCardNum + possessionCardNum2 + spotCardNum; + _labelCardPossessionNum.text = num.ToString(); + _btnExchangeCard.onClick.Clear(); + if (isExchangeable) + { + _btnExchangeCard.onClick.Add(new EventDelegate(delegate + { + onClickExchangButton(gachaPointInfo); + })); + UIManager.SetObjectToGrey(_btnExchangeCard.gameObject, b: false); + } + else + { + _btnExchangeCard.isEnabled = false; + UIManager.SetObjectToGrey(_btnExchangeCard.gameObject, b: true); + } + if (gachaPointInfo.RewardList.Count > 0) + { + _labelReward.text = GetRewardListText(gachaPointInfo.RewardList); + } + else + { + _labelReward.text = string.Empty; + } + if (gachaPointInfo.IsReceived) + { + _labelOwnedReward.gameObject.SetActive(value: true); + _labelOwnedReward.text = Data.SystemText.Get("Shop_0163"); + } + else + { + _labelOwnedReward.gameObject.SetActive(value: false); + } + } + + public void SetCardObject(GameObject cardObject, GameObject evacuationParent) + { + if (_cardObject != null) + { + _cardObject.SetActive(value: false); + _cardObject.transform.parent = evacuationParent.transform; + } + cardObject.transform.parent = _objCardRoot.transform; + cardObject.transform.localPosition = Vector3.zero; + cardObject.transform.rotation = CARDOBJECT_ROTATION_QUATERNION; + cardObject.SetActive(value: true); + _cardObject = cardObject; + } + + private static string GetRewardListText(List rewardList) + { + return UIUtil.CreateListText(rewardList.Select((Wizard.Scripts.Network.Data.TaskData.Arena.Reward reward) => reward.UserGoodsData).OrderBy(GachaUtil.GetRewardListSortIndex).Select(GachaUtil.GetRewardListGoodsTypeName) + .Distinct() + .ToList(), Data.SystemText.Get("Shop_0226"), Data.SystemText.Get("Shop_0225")); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GachaUIParam.cs b/SVSim.BattleEngine/Engine/Wizard/GachaUIParam.cs new file mode 100644 index 0000000..417165e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GachaUIParam.cs @@ -0,0 +1,14 @@ +namespace Wizard; + +public class GachaUIParam +{ + public bool EnableOverRideDefaultPackId { get; private set; } + + public int OverrideDefaultPackId { get; private set; } + + public void SetDefaultPackId(int packId) + { + EnableOverRideDefaultPackId = true; + OverrideDefaultPackId = packId; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GameStartAttachTagPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/GameStartAttachTagPolicyCollection.cs new file mode 100644 index 0000000..f375da9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GameStartAttachTagPolicyCollection.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class GameStartAttachTagPolicyCollection : AIPolicyCollection +{ + public void ExecuteAttachTag(AIVirtualField field) + { + if (!base.HasPolicy) + { + return; + } + AIVirtualCard allyClass = field.AllyClass; + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + AIUnknownAction situation = new AIUnknownAction(allyClass); + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(allyClass, emptyPlayPtn, field, situation) && aIPolicyData.Argument is AIGameStartAttachTag aIGameStartAttachTag) + { + aIGameStartAttachTag.Execute(allyClass, field, emptyPlayPtn, situation); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringMyPageInfo.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringMyPageInfo.cs new file mode 100644 index 0000000..f796523 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringMyPageInfo.cs @@ -0,0 +1,58 @@ +using System; +using LitJson; + +namespace Wizard; + +public class GatheringMyPageInfo +{ + public bool IsEntry { get; private set; } + + public bool IsDeckEntry { get; private set; } + + public bool IsBattleFinish { get; private set; } + + public bool IsMatchingNotification { get; set; } + + public bool IsOpening { get; private set; } + + public string FinishTime { get; private set; } + + public string DeckEntryFinishTime { get; private set; } + + public GatheringMyPageInfo() + { + } + + public GatheringMyPageInfo(JsonData data, double serverTime) + { + IsEntry = data["is_entry"].ToInt() == 1; + if (data.Keys.Contains("battle_end_time")) + { + if (data.TryGetValue("battle_end_time", out var value)) + { + FinishTime = ConvertTime.ToLocal(DateTime.Parse(value.ToString())).ToString(); + } + } + else + { + FinishTime = string.Empty; + } + if (data.Keys.Contains("battle_begin_time")) + { + double num = ConvertTime.DateTimeToUnixTime(DateTime.Parse(data["battle_begin_time"].ToString())); + if (data.TryGetValue("battle_end_time", out var value2)) + { + double num2 = ConvertTime.DateTimeToUnixTime(DateTime.Parse(value2.ToString())); + IsBattleFinish = serverTime > num2; + } + else + { + IsBattleFinish = false; + IsOpening = true; + } + IsDeckEntry = serverTime < num; + DeckEntryFinishTime = ConvertTime.ToLocal(DateTime.Parse(data["battle_begin_time"].ToString())).ToString(); + } + IsMatchingNotification = !string.IsNullOrEmpty(data.GetValueOrDefault("matching_established_message", string.Empty)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringRule.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringRule.cs new file mode 100644 index 0000000..5a21104 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringRule.cs @@ -0,0 +1,176 @@ +using System; +using LitJson; +using Wizard.RoomMatch; + +namespace Wizard; + +public class GatheringRule +{ + public enum eRole + { + NONE, + OWNER, + GUEST + } + + public enum eWatchSetting + { + OWNER_ONLY = 1, + ALL_MEMBER, + NONE + } + + public enum eType + { + FREE_BATTLE = 1, + TOURNAMENT + } + + public enum eTournamentType + { + NONE, + SINGLE_ELIMINATION, + DOUBLE_ELIMINATION + } + + public const int DEFAULT_DECK_ENTRY_MINUTE = 5; + + public const int ID_NUMBER_OF_DIGIT = 6; + + public const int DEFAULT_MAX_MEMBER = 2; + + public const int DEFAULT_BATTLE_HOUR = 1; + + public const eWatchSetting DEFAULT_WATCH_SETTING = eWatchSetting.OWNER_ONLY; + + public bool IsReset; + + public eType Type { get; set; } = eType.FREE_BATTLE; + + public eTournamentType TournamentType { get; set; } + + public bool IsTournament + { + get + { + if (TournamentType != eTournamentType.SINGLE_ELIMINATION) + { + return TournamentType == eTournamentType.DOUBLE_ELIMINATION; + } + return true; + } + } + + public int MaxMember { get; set; } = 2; + + public BattleParameter BattleParameterInstance { get; private set; } + + public int BattleTimeHour { get; set; } = 1; + + public DateTime BattleStartLocalTime + { + get + { + return ConvertTime.ToLocalByDateTime(BattleStartUtcTime); + } + set + { + BattleStartUtcTime = ConvertTime.LocalToUtc(value); + } + } + + public DateTime BattleStartUtcTime { get; private set; } + + public bool IsOwnerEntryBattle { get; set; } = true; + + public bool IsEntryDeckOnly { get; set; } + + public eWatchSetting WatchSetting { get; set; } = eWatchSetting.OWNER_ONLY; + + public string GetGatheringTypeString() + { + return GatheringUtility.GetGatheringTypeString(Type, TournamentType, IsReset); + } + + public string GetGatheringResetString() + { + if (!IsReset) + { + return "ไปฎใƒชใ‚ปใƒƒใƒˆใชใ—"; + } + return "ไปฎใƒชใ‚ปใƒƒใƒˆใ‚ใ‚Š"; + } + + public GatheringRule() + { + } + + public GatheringRule(JsonData data, JsonData config) + { + BattleParameterInstance = BattleParameter.JsonToBattleParameter(data); + MaxMember = data["join_member_limit"].ToInt(); + IsOwnerEntryBattle = data["is_master_joined"].ToInt() == 1; + WatchSetting = (eWatchSetting)data["watch_type"].ToInt(); + Type = (eType)data["gathering_type"].ToInt(); + if (Type == eType.TOURNAMENT) + { + IsEntryDeckOnly = true; + } + else if (config.Keys.Contains("is_deck_entry")) + { + IsEntryDeckOnly = config["is_deck_entry"].ToInt() == 1; + } + if (config.TryGetValue("format", out var value)) + { + TournamentType = (eTournamentType)value.ToInt(); + } + if (config.TryGetValue("is_reset", out var value2)) + { + IsReset = value2.ToInt() == 1; + } + } + + public void SaveToPlayerPrefs() + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_MAX_MEMBER, MaxMember); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_FORMAT, (int)BattleParameterInstance.DeckFormat); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_BATTLE_STYLE, (int)BattleParameterInstance.Rule); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_BATTLE_TYPE, (int)Type); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_BATTLE_TORNAMENT_TYPE, (int)TournamentType); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.GATHERING_IS_RESET, IsReset); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.GATHERING_OWNER_ENTRY_BATTLE, IsOwnerEntryBattle); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_WATCH_SETTING, (int)WatchSetting); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.GATHERING_BATTLE_HOUR, BattleTimeHour); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.GATHERING_IS_ENTRY_DECK_ONLY, IsEntryDeckOnly); + } + + public void LoadFromPlayerPrefs() + { + MaxMember = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_MAX_MEMBER); + Format format = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_FORMAT); + if (format == Format.PreRotation && Prerelease.Status != Prerelease.eStatus.PRE_ROTATION) + { + format = Format.Rotation; + } + if (format == Format.Crossover && (!Data.Crossover.IsWithinGatheringPeriod || Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_FORMAT_CROSSOVER))) + { + format = Format.Rotation; + } + else if (format == Format.MyRotation && (!Data.MyRotationAllInfo.IsWithinGatheringPeriod || Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GATHERING_MYROTATION))) + { + format = Format.Rotation; + } + else if (format == Format.Avatar && (!Data.AvatarBattleAllInfo.IsWithinGatheringPeriod || Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GATHERING_AVATAR))) + { + format = Format.Rotation; + } + BattleParameterInstance = new BattleParameter(NetworkDefine.ServerBattleType.Gathering, format, TwoPickFormat.None, (RoomConnectController.BattleRule)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_BATTLE_STYLE), isOpenDeckRoom: false); + IsOwnerEntryBattle = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.GATHERING_OWNER_ENTRY_BATTLE); + WatchSetting = (eWatchSetting)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_WATCH_SETTING); + BattleTimeHour = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_BATTLE_HOUR); + IsEntryDeckOnly = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.GATHERING_IS_ENTRY_DECK_ONLY); + Type = (eType)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_BATTLE_TYPE); + TournamentType = (eTournamentType)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.GATHERING_BATTLE_TORNAMENT_TYPE); + IsReset = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.GATHERING_IS_RESET); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GetCardMasterTask.cs b/SVSim.BattleEngine/Engine/Wizard/GetCardMasterTask.cs new file mode 100644 index 0000000..197ba62 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GetCardMasterTask.cs @@ -0,0 +1,40 @@ +using System; +using System.Text; +using BestHTTP.Decompression.Zlib; +using LitJson; + +namespace Wizard; + +public class GetCardMasterTask : BaseTask +{ + public class CardMasterTaskParam : BaseParam + { + public string card_master_hash { get; private set; } + + public CardMasterTaskParam(string cardMasterHash) + { + card_master_hash = cardMasterHash; + } + } + + public JsonData CardMasterJsonData { get; private set; } + + public GetCardMasterTask(string cardMasterHash) + { + base.type = ApiType.Type.GetCardMaster; + base.Params = new CardMasterTaskParam(cardMasterHash); + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + byte[] compressed = Convert.FromBase64String(base.ResponseData["data"]["card_master"].ToString()); + string json = Encoding.UTF8.GetString(GZipStream.UncompressBuffer(compressed)); + CardMasterJsonData = JsonMapper.ToObject(json); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GetSelectSkinOwnedStatusTask.cs b/SVSim.BattleEngine/Engine/Wizard/GetSelectSkinOwnedStatusTask.cs new file mode 100644 index 0000000..da15394 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GetSelectSkinOwnedStatusTask.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class GetSelectSkinOwnedStatusTask : BaseTask +{ + public class SelectSkinCardListTaskParam : BaseParam + { + public int parent_gacha_id; + } + + public Dictionary> SkinCardListInClassDic { get; private set; } + + public GetSelectSkinOwnedStatusTask() + { + base.type = ApiType.Type.GetSelectSkinOwnedStatus; + } + + public void SetParameter(int packId) + { + SelectSkinCardListTaskParam selectSkinCardListTaskParam = new SelectSkinCardListTaskParam(); + selectSkinCardListTaskParam.parent_gacha_id = packId; + base.Params = selectSkinCardListTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + SkinCardListInClassDic = new Dictionary>(); + for (CardBasePrm.ClanType clanType = CardBasePrm.ClanType.MIN; clanType < CardBasePrm.ClanType.MAX; clanType++) + { + SkinCardListInClassDic[clanType] = new List(); + int num2 = (int)clanType; + JsonData jsonData2 = jsonData[num2.ToString()]; + if (jsonData2.Count != 0) + { + List list = new List(jsonData2.Keys); + for (int i = 0; i < list.Count; i++) + { + string prop_name = list[i]; + SelectSkinCardInfo item = new SelectSkinCardInfo(jsonData2[prop_name], clanType); + SkinCardListInClassDic[clanType].Add(item); + } + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GuildNotification.cs b/SVSim.BattleEngine/Engine/Wizard/GuildNotification.cs new file mode 100644 index 0000000..72b4215 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GuildNotification.cs @@ -0,0 +1,22 @@ +using LitJson; + +namespace Wizard; + +public class GuildNotification +{ + public int? GuildId { get; private set; } + + public int? GuildRoomMessageId { get; private set; } + + public bool IsJoinRequest { get; private set; } + + public bool IsInvited { get; private set; } + + public void SetGuildNotification(JsonData json) + { + GuildId = json["guild_id"]?.ToInt(); + GuildRoomMessageId = json["guild_room_message_id"]?.ToInt(); + IsJoinRequest = json["is_join_request"].ToBoolean(); + IsInvited = json["is_invited"].ToBoolean(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/IAIRemoveTagArgument.cs b/SVSim.BattleEngine/Engine/Wizard/IAIRemoveTagArgument.cs new file mode 100644 index 0000000..ad744b1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/IAIRemoveTagArgument.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace Wizard; + +public interface IAIRemoveTagArgument +{ + AIPlayTag RemoveTag { get; } + + void Execute(AIVirtualCard tagOwner, AIVirtualField field, AISituationInfo situation, AIPlayTag executingOwnerTag, List playPtn = null); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/IAITurnEndArgument.cs b/SVSim.BattleEngine/Engine/Wizard/IAITurnEndArgument.cs new file mode 100644 index 0000000..5f041dc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/IAITurnEndArgument.cs @@ -0,0 +1,8 @@ +namespace Wizard; + +public interface IAITurnEndArgument +{ + bool IsAllyTurn { get; } + + float CalculateThreaten(AIVirtualCard tagOwner, ref Tuple[] allInplayStatusList); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/InCompleteDeckDecideDialog.cs b/SVSim.BattleEngine/Engine/Wizard/InCompleteDeckDecideDialog.cs new file mode 100644 index 0000000..4395fb5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/InCompleteDeckDecideDialog.cs @@ -0,0 +1,116 @@ +using System; +using Cute; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public static class InCompleteDeckDecideDialog +{ + private const int DIALOG_PANEL_DEPTH = 100; + + public static void Create(DialogBase dialogDeckList, DeckData deck, ConventionDeckList conventionDeckList = null, bool canUseNonPossessionCard = false, Action unusableDeckChangeViewSceneAction = null) + { + DeckData.UnusableReason reason; + if (deck.IsNoCard()) + { + Action onStartChangeViewScene = delegate + { + dialogDeckList.CloseWithoutSelect(); + }; + DeckCreateMenuUI.ShowDeckCreateMenu(deck, conventionDeckList, onStartChangeViewScene); + } + else if (!deck.IsUsable(out reason, canUseNonPossessionCard)) + { + CreateUnusableDeckDialog(deck, conventionDeckList, reason, unusableDeckChangeViewSceneAction, dialogDeckList); + } + } + + private static void CreateUnusableDeckDialog(DeckData deck, ConventionDeckList conventionDeckList, DeckData.UnusableReason unusableReason, Action changeViewSceneAction, DialogBase dialogDeckList) + { + if (unusableReason == DeckData.UnusableReason.MaintenanceCard && deck.IsRentalDeck) + { + DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(Data.SystemText.Get("Story_0060")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + dialogBase.SetTitleLabel(Data.SystemText.Get("System_0022")); + dialogBase.SetPanelDepth(100); + return; + } + (string, string) textsUnusableDeckDialog = GetTextsUnusableDeckDialog(unusableReason); + DialogBase dialogBase2 = UIManager.GetInstance().CreateDialogClose(); + dialogBase2.SetTitleLabel(textsUnusableDeckDialog.Item1); + dialogBase2.SetText(textsUnusableDeckDialog.Item2); + dialogBase2.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase2.SetButtonText(Data.SystemText.Get("Dia_DeckSelect_002_Button")); + dialogBase2.onPushButton1 = delegate + { + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.DECK_MAINTENANCE)) + { + Toolbox.NetworkManager.NetworkUI.OpenEachFunctionMaintenancePopUp(2019); + } + else + { + DeckCardEditUI.SetDeckEditParameter(deck, conventionDeckList); + dialogDeckList.CloseWithoutSelect(); + if (changeViewSceneAction != null) + { + changeViewSceneAction(UIManager.ViewScene.DeckCardEdit); + } + else + { + UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam + { + IsUpdateFooterMenuTexture = true + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.DeckCardEdit, param); + } + } + }; + dialogBase2.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE_TRANS; + dialogBase2.SetPanelDepth(100); + } + + private static (string title, string body) GetTextsUnusableDeckDialog(DeckData.UnusableReason unusableReason) + { + string item = string.Empty; + string item2 = string.Empty; + switch (unusableReason) + { + case DeckData.UnusableReason.MaintenanceCard: + item = Data.SystemText.Get("System_0022"); + item2 = Data.SystemText.Get("System_0039"); + break; + case DeckData.UnusableReason.FormatRestrictCard: + item = Data.SystemText.Get("Dia_DeckSelect_004_Title"); + item2 = Data.SystemText.Get("Card_0192"); + break; + case DeckData.UnusableReason.TooLittleCards: + item = Data.SystemText.Get("Dia_DeckSelect_002_Title"); + item2 = Data.SystemText.Get("Card_0069"); + break; + case DeckData.UnusableReason.TooMuchCards: + item = Data.SystemText.Get("Dia_DeckSelect_003_Title"); + item2 = Data.SystemText.Get("Card_0140"); + break; + case DeckData.UnusableReason.NonPossessionCard: + item = Data.SystemText.Get("Dia_DeckSelect_004_Title"); + item2 = Data.SystemText.Get("Card_0254"); + break; + case DeckData.UnusableReason.ShortageMainClassCards: + item = Data.SystemText.Get("Dia_DeckSelect_005_Title"); + item2 = Data.SystemText.Get("Card_0289"); + break; + case DeckData.UnusableReason.ShortageSubClassCards: + item = Data.SystemText.Get("Dia_DeckSelect_006_Title"); + item2 = Data.SystemText.Get("Card_0290"); + break; + case DeckData.UnusableReason.ShortageBothClassCards: + item = Data.SystemText.Get("Dia_DeckSelect_007_Title"); + item2 = Data.SystemText.Get("Card_0291"); + break; + case DeckData.UnusableReason.Unknown: + Debug.LogError("unknown deck unusable reason."); + break; + } + return (title: item, body: item2); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/InplayMovePatternFilter.cs b/SVSim.BattleEngine/Engine/Wizard/InplayMovePatternFilter.cs new file mode 100644 index 0000000..f548e20 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/InplayMovePatternFilter.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class InplayMovePatternFilter +{ + public bool IsSupposedToBeBestBreakPattern { get; private set; } + + public bool IsBestBreakPattern { get; private set; } + + public InplayMovePatternFilter() + { + IsSupposedToBeBestBreakPattern = false; + IsBestBreakPattern = false; + } + + public void CheckBreakPatternCondition(AIVirtualField field, List enemyTargets) + { + IsSupposedToBeBestBreakPattern = false; + IsBestBreakPattern = false; + bool flag = false; + for (int i = 0; i < field.EnemyInplayCards.Count; i++) + { + bool flag2 = enemyTargets.Contains(i); + AIVirtualCard aIVirtualCard = field.EnemyInplayCards[i]; + if ((flag2 && aIVirtualCard.Value <= 0f) || (!flag2 && aIVirtualCard.Value > 0f)) + { + flag = true; + break; + } + } + IsSupposedToBeBestBreakPattern = !flag; + } + + public void ConfirmBestPattern(List enemyTargets) + { + if (IsBestBreakPattern || !IsSupposedToBeBestBreakPattern) + { + return; + } + for (int i = 0; i < enemyTargets.Count; i++) + { + if (!enemyTargets[i].IsDead) + { + return; + } + } + IsBestBreakPattern = true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ItemPurchase.cs b/SVSim.BattleEngine/Engine/Wizard/ItemPurchase.cs new file mode 100644 index 0000000..07d9105 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ItemPurchase.cs @@ -0,0 +1,279 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.ItemPurchase; + +namespace Wizard; + +public class ItemPurchase : MonoBehaviour +{ + private const int PRODUCT_SCROLL_OBJECT_NUM = 5; + + private const int DEPTH_PURCHASE_SUCCESS_DIALOG = 100; + + [SerializeField] + private UILabel _redEtherLabel; + + [SerializeField] + private UILabel _premierOrbOrbPieceLabel; + + [SerializeField] + private UIScrollView _scrollView; + + [SerializeField] + private UIWrapContent _wrapContent; + + [SerializeField] + private UIScrollBarWrapContent _scrollBarWrapContent; + + [SerializeField] + private WrapContentsScrollBarSize _wrapContentScrollBarSize; + + [SerializeField] + private GameObject _itemPlateOriginal; + + [SerializeField] + private PurchaseConfirm _prefabConfirmDialog; + + [SerializeField] + private UILabel _labelNoItem; + + private List _itemDataList; + + private List _plateList = new List(); + + private List _loadedResourceList = new List(); + + private ItemPurchaseData _purchaseItemData; + + public void Init(Action onInitFinCallBack) + { + _labelNoItem.gameObject.SetActive(value: false); + _itemPlateOriginal.gameObject.SetActive(value: false); + _scrollBarWrapContent.m_WrapContents = _wrapContent; + StartConnectItemPurchaseInfo(delegate + { + _itemDataList = Data.ItemPurchaseInfo.itemPurchaseList; + CreateItemView(onInitFinCallBack); + }); + UserItemCountUpdate(); + } + + private void CreateItemView(Action onFinCallBack = null) + { + if (_itemDataList.Count <= 0) + { + _labelNoItem.gameObject.SetActive(value: true); + _scrollView.gameObject.SetActive(value: false); + _scrollBarWrapContent.gameObject.SetActive(value: false); + onFinCallBack.Call(); + return; + } + _labelNoItem.gameObject.SetActive(value: false); + _scrollView.gameObject.SetActive(value: true); + _scrollBarWrapContent.gameObject.SetActive(value: true); + StartCoroutine(LoadImages(delegate + { + StartCoroutine(CreateScrollView(onFinCallBack)); + })); + } + + private void StartConnectItemPurchaseInfo(Action callbackOnSuccess) + { + ItemPurchaseInfoTask task = new ItemPurchaseInfoTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, callbackOnSuccess)); + } + + private IEnumerator LoadImages(Action callBack = null) + { + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + List assetList = new List(); + for (int i = 0; i < _itemDataList.Count; i++) + { + ItemPurchaseData itemPurchaseData = _itemDataList[i]; + string assetTypePath = resourcesManager.GetAssetTypePath(itemPurchaseData.textureName, ResourcesManager.AssetLoadPathType.Item); + if (!assetList.Contains(assetTypePath) && !_loadedResourceList.Contains(assetTypePath)) + { + assetList.Add(assetTypePath); + } + if (IsCardPackTicket(itemPurchaseData.require_item_type, itemPurchaseData.RequireUserGoodsId)) + { + string assetTypePath2 = resourcesManager.GetAssetTypePath($"card_pack_{itemPurchaseData.RequireUserGoodsId}_icon", ResourcesManager.AssetLoadPathType.ShopCardPack); + if (!assetList.Contains(assetTypePath2) && !_loadedResourceList.Contains(assetTypePath2)) + { + assetList.Add(assetTypePath2); + } + } + } + if (assetList.Count > 0) + { + yield return StartCoroutine(resourcesManager.LoadAssetGroupAsync(assetList, null)); + _loadedResourceList.AddRange(assetList); + } + callBack.Call(); + } + + private void UnloadImages() + { + if (_loadedResourceList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList); + _loadedResourceList = null; + } + } + + private IEnumerator CreateScrollView(Action onFinishCallback = null) + { + _wrapContent.gameObject.SetActive(value: false); + if (_plateList.Count > 0) + { + for (int i = 0; i < _plateList.Count; i++) + { + UnityEngine.Object.Destroy(_plateList[i].gameObject); + } + _plateList.Clear(); + } + if (_itemDataList.Count == 1) + { + _wrapContent.enabled = false; + ItemPurchasePlate component = NGUITools.AddChild(_scrollView.gameObject, _itemPlateOriginal).GetComponent(); + component._buyBtnCallBack = OnPushBuyButton; + component.SetData(0); + _plateList.Add(component); + } + else + { + _wrapContent.enabled = true; + for (int j = 0; j < _itemDataList.Count && j < 5; j++) + { + ItemPurchasePlate component2 = NGUITools.AddChild(_wrapContent.gameObject, _itemPlateOriginal).GetComponent(); + component2._buyBtnCallBack = OnPushBuyButton; + _plateList.Add(component2); + } + } + yield return null; + for (int k = 0; k < _plateList.Count; k++) + { + _plateList[k].gameObject.SetActive(value: true); + } + _wrapContent.minIndex = -(_itemDataList.Count - 1); + _wrapContent.maxIndex = 0; + _wrapContent.onInitializeItem = OnInitializeItem; + _wrapContent.gameObject.SetActive(value: true); + ResetScrollView(); + onFinishCallback.Call(); + } + + private void ResetScrollView() + { + _wrapContentScrollBarSize.ContentUpdate(); + _wrapContent.SortBasedOnScrollMovement(); + _scrollView.ResetPosition(); + _wrapContent.WrapContent(); + } + + private void OnInitializeItem(GameObject go, int wrapIndex, int realIndex) + { + int num = -realIndex; + if (num >= _itemDataList.Count || num < 0) + { + go.SetActive(value: false); + return; + } + go.SetActive(value: true); + go.GetComponent().SetData(num); + } + + private void OnDestroy() + { + UnloadImages(); + } + + private void OnPushBuyButton(ItemPurchaseData itemData) + { + if (itemData != null) + { + DialogBase dialogBase = ShopCommonUtility.CreateBasePopupPurchaseConfirm(new EventDelegate(delegate + { + _purchaseItemData = itemData; + ItemPurchaseBuyTask itemPurchaseBuyTask = new ItemPurchaseBuyTask(); + itemPurchaseBuyTask.SetParameter(itemData.purchase_id, itemData.rest); + StartCoroutine(Toolbox.NetworkManager.Connect(itemPurchaseBuyTask, OnSuccessItemPurchaseBuy)); + })); + PurchaseConfirm purchaseConfirm = UnityEngine.Object.Instantiate(_prefabConfirmDialog); + dialogBase.SetObj(purchaseConfirm.gameObject); + dialogBase.SetTitleLabel(Data.SystemText.Get("Shop_0135")); + string purchaseText = Data.SystemText.Get("Shop_0101", itemData.purchase_name); + int haveUserGoods = PlayerStaticData.GetHaveUserGoods(itemData.require_item_type, itemData.RequireUserGoodsId); + if (IsCardPackTicket(itemData.require_item_type, itemData.RequireUserGoodsId)) + { + Texture texture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath($"card_pack_{itemData.RequireUserGoodsId}_icon", ResourcesManager.AssetLoadPathType.ShopCardPack, isfetch: true)) as Texture; + purchaseConfirm.SetConfirmDialog(itemData.require_item_num, purchaseText, haveUserGoods, itemData.require_item_type, itemData.RequireUserGoodsId, null, texture); + } + else + { + purchaseConfirm.SetConfirmDialog(itemData.require_item_num, purchaseText, haveUserGoods, itemData.require_item_type, itemData.RequireUserGoodsId, null); + } + } + } + + private bool IsCardPackTicket(UserGoods.Type itemType, long userGoodsId) + { + if (itemType != UserGoods.Type.Item) + { + return false; + } + if (Item.GetItemType(itemType, (int)userGoodsId) == Item.Type.CardPackTicket) + { + return true; + } + return false; + } + + private void OnSuccessItemPurchaseBuy(NetworkTask.ResultCode e) + { + MyPageMenu.Instance.UpdateCrystalCount(); + MyPageMenu.Instance.UpdateRupyCount(); + ShopCommonUtility.CreatePurchaseSuccess(_purchaseItemData.purchase_name).SetPanelDepth(100); + List oldItemDataList = new List(_itemDataList); + StartConnectItemPurchaseInfo(delegate + { + bool flag = false; + if (oldItemDataList.Count != _itemDataList.Count) + { + flag = true; + } + else + { + for (int i = 0; i < _itemDataList.Count; i++) + { + if (oldItemDataList[i].purchase_id != _itemDataList[i].purchase_id) + { + flag = true; + break; + } + } + } + if (flag) + { + CreateItemView(); + } + else + { + for (int j = 0; j < _plateList.Count; j++) + { + _plateList[j].UpdatePlate(); + } + } + UserItemCountUpdate(); + }); + } + + private void UserItemCountUpdate() + { + _redEtherLabel.text = PlayerStaticData.UserRedEtherCount.ToString(); + _premierOrbOrbPieceLabel.text = PlayerStaticData.GetItemNum(1001).ToString(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ItemPurchasePlate.cs b/SVSim.BattleEngine/Engine/Wizard/ItemPurchasePlate.cs new file mode 100644 index 0000000..572e14e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ItemPurchasePlate.cs @@ -0,0 +1,93 @@ +using System; +using Cute; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.ItemPurchase; + +namespace Wizard; + +public class ItemPurchasePlate : MonoBehaviour +{ + [SerializeField] + private UITexture _textureThumbnail; + + [SerializeField] + private UILabel _labelItemName; + + [SerializeField] + private UILabel _labelCostName; + + [SerializeField] + private UILabel _labelStockNum; + + [SerializeField] + private UIButton _btnBuyItem; + + [SerializeField] + private UISprite _useItemIconSprite; + + private ItemPurchaseData _itemData; + + public Action _buyBtnCallBack; + + private int _dataIndex; + + public void SetData(int dataIndex) + { + _dataIndex = dataIndex; + UpdateDisplay(Data.ItemPurchaseInfo.itemPurchaseList[dataIndex]); + } + + public void UpdatePlate() + { + UpdateDisplay(Data.ItemPurchaseInfo.itemPurchaseList[_dataIndex]); + } + + private void UpdateDisplay(ItemPurchaseData data) + { + _itemData = data; + _textureThumbnail.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(data.textureName, ResourcesManager.AssetLoadPathType.Item, isfetch: true)) as Texture; + _labelItemName.text = data.purchase_name; + string typeName = ""; + string detailName = ""; + ShopCommonUtility.GetRewardNames((int)data.require_item_type, data.RequireUserGoodsId, data.require_item_num, out typeName, out detailName); + _labelCostName.text = Data.SystemText.Get("Shop_0129", typeName, detailName); + _useItemIconSprite.gameObject.SetActive(value: true); + if (data.require_item_type == UserGoods.Type.RedEther) + { + _useItemIconSprite.spriteName = "icon_liquid_s"; + } + else if (data.require_item_type == UserGoods.Type.Item && data.RequireUserGoodsId == 1001) + { + _useItemIconSprite.spriteName = "icon_orb_piece_s"; + } + else + { + _useItemIconSprite.gameObject.SetActive(value: false); + } + if (data.isMonthryReset) + { + _labelStockNum.text = Data.SystemText.Get("Shop_0130", data.rest.ToString()); + } + else + { + _labelStockNum.text = Data.SystemText.Get("Shop_0131", data.rest.ToString()); + } + int haveUserGoods = PlayerStaticData.GetHaveUserGoods(_itemData.require_item_type, _itemData.RequireUserGoodsId); + if (_itemData.rest > 0 && haveUserGoods >= _itemData.require_item_num) + { + UIManager.SetObjectToGrey(_btnBuyItem.gameObject, b: false); + _btnBuyItem.isEnabled = true; + } + else + { + UIManager.SetObjectToGrey(_btnBuyItem.gameObject, b: true); + _btnBuyItem.isEnabled = false; + } + } + + public void OnPushBuyButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + _buyBtnCallBack.Call(_itemData); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/LabelDefine.cs b/SVSim.BattleEngine/Engine/Wizard/LabelDefine.cs new file mode 100644 index 0000000..7759b09 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/LabelDefine.cs @@ -0,0 +1,50 @@ +using UnityEngine; + +namespace Wizard; + +public class LabelDefine : MonoBehaviour +{ + public static readonly Color32 TEXT_COLOR_NORMAL = new Color32(byte.MaxValue, 253, 235, byte.MaxValue); + + public static readonly Color32 TEXT_COLOR_DESC_ON_CARDPANEL = new Color32(204, 204, 204, byte.MaxValue); + + public static readonly Color32 TEXT_COLOR_NAME_ON_CARDPANEL = new Color32(byte.MaxValue, 253, 235, byte.MaxValue); + + public static readonly Color32 TEXT_COLOR_KEYWORD = new Color32(byte.MaxValue, 205, 69, byte.MaxValue); + + public static readonly Color32 TEXT_COLOR_CREAM = new Color32(200, 200, 176, byte.MaxValue); + + public static readonly Color32 TEXT_COLOR_RED = new Color32(byte.MaxValue, 84, 69, byte.MaxValue); + + public static readonly Color32 TEXT_COLOR_ORANGE = new Color32(byte.MaxValue, 211, 66, byte.MaxValue); + + public static readonly Color32 TEXT_COLOR_BLACK = new Color32(18, 19, 17, byte.MaxValue); + + public static readonly Color32 TEXT_COLOR_BUTTON_ENABLE = new Color32(byte.MaxValue, 253, 235, byte.MaxValue); + + public static readonly Color32 TEXT_COLOR_BUTTON_DISABLE = new Color32(85, 85, 85, byte.MaxValue); + + public static readonly Color32 TEXT_COLOR_B0B0B0 = new Color32(176, 176, 176, byte.MaxValue); + + public static readonly UILabel.Effect OUTLINE_STYLE_ON_BUTTON = UILabel.Effect.Outline8; + + public static readonly Vector2 OUTLINE_DISTANCE_ON_BUTTON = new Vector2(2f, 2f); + + public static readonly Color32 OUTLINE_COLOR_ON_BUTTON = new Color32(81, 63, 48, byte.MaxValue); + + public static readonly Color32 OUTLINE_COLOR_FOOTER_DEFAULT = new Color32(51, 34, 0, byte.MaxValue); + + public static readonly Color32 OUTLINE_COLOR_FOOTER_DISABLE_DEFAULT = new Color32(19, 20, 12, byte.MaxValue); + + public static readonly Color32 OUTLINE_COLOR_FOOTER_DISABLE_PUSH = new Color32(29, 28, 19, byte.MaxValue); + + public static readonly Color32 OUTLINE_COLOR_PRACTICE_CARDPANEL_DEFAULT = new Color32(31, 211, 236, 20); + + public static readonly Color32 OUTLINE_COLOR_PRACTICE_CARDPANEL_DISABLE = new Color32(14, 64, 71, 19); + + public static readonly UILabel.Effect OUTLINE_STYLE_CLASS_NAME = UILabel.Effect.Outline8; + + public static readonly Vector2 OUTLINE_DISTANCE_CLASS_NAME = new Vector2(1.5f, 1.5f); + + public static readonly Color32 OUTLINE_COLOR_AREA_SELECT_NONCHARA_TITLE = new Color32(38, 36, 32, byte.MaxValue); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/LocalLog.cs b/SVSim.BattleEngine/Engine/Wizard/LocalLog.cs new file mode 100644 index 0000000..4a4db4b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/LocalLog.cs @@ -0,0 +1,828 @@ +using System; +using System.IO; +using System.Text; +using Cute; +using UnityEngine; +using Wizard.RoomMatch; + +namespace Wizard; + +public class LocalLog +{ + public enum TRACELOG_TYPE + { + TRACE_ALL_LOG, + TRACE_LOG, + TRACE_LAST_LOG, + TRACE_INQUIRY_LOG + } + + public enum RecordType + { + CERBERUS, + HADES + } + + private static string AccumulateLogPath = Application.persistentDataPath + "/accumulate_log"; + + private static string AccumulateSettingLogPath = Application.persistentDataPath + "/setting_info_log"; + + private static string LastAccumulate1LogPath = Application.persistentDataPath + "/last_accumulate_log1"; + + private static string LastAccumulate2LogPath = Application.persistentDataPath + "/last_accumulate_log2"; + + private static string InquiryLogPath = Application.persistentDataPath + "/inquiry_log"; + + private static string _failureWriteClientLog = ""; + + private const string TRACELASTLOG_KEY1 = "LastTraceLog1"; + + private const string TRACELASTLOG_KEY2 = "LastTraceLog2"; + + private static int nowTraceTurn = 0; + + private const string TRACELOG_KEY = "TraceLog"; + + private const string TRACE_SETTING_LOG_KEY = "TraceSettingLog"; + + private const string BATTLE_SETTING_INFO_TOP = "BattleSetting:"; + + private const string TRACE_INQUIRY_LOG_KEY = "TraceInquiryLog"; + + private static int currentTurn = -1; + + private static string _roomCreateLog = ""; + + private static bool _isRoomCreateLogEnd = false; + + private static string _loadResourceLog = ""; + + private static string _gungnirLog = ""; + + private static string _socketFrameLog = ""; + + private static string _disconnectLog = ""; + + public static bool _isSendGungnirLog = false; + + public static bool _isSendSocketFrameLog = false; + + private static bool _isLastTraceLogTimeAdd = false; + + private const string _resourceLoadErrorText = "ResourcesManager ParallelAssetListExec Error"; + + private static StringBuilder _lastTraceLogStringBuilder = null; + + [RuntimeInitializeOnLoadMethod] + public static void CreateLogFile() + { + CreateLocalLogFile(AccumulateLogPath); + CreateLocalLogFile(AccumulateSettingLogPath); + CreateLocalLogFile(LastAccumulate1LogPath); + CreateLocalLogFile(LastAccumulate2LogPath); + CreateLocalLogFile(InquiryLogPath); + } + + public static void CreateLocalLogFile(string filePath) + { + FileStream fileStream = null; + try + { + if (!File.Exists(filePath)) + { + using (fileStream = File.Create(filePath)) + { + fileStream.Close(); + return; + } + } + } + catch + { + string text = "FailedToCreateFile:" + filePath; + fileStream?.Dispose(); + _failureWriteClientLog = _failureWriteClientLog + text + "\n"; + } + } + + public static void SendAllClientTraceLog(Action onSended) + { + MakeTreceLogToSend(TRACELOG_TYPE.TRACE_ALL_LOG, onSended); + } + + public static void SendClientInfoTraceLog(Action onSended) + { + MakeTreceLogToSend(TRACELOG_TYPE.TRACE_LOG, onSended); + } + + public static void SendLastTraceLog(Action onSended) + { + MakeTreceLogToSend(TRACELOG_TYPE.TRACE_LAST_LOG, onSended); + } + + private static void MakeTreceLogToSend(TRACELOG_TYPE logType, Action onSended) + { + if (string.IsNullOrEmpty(Certification.Udid) || Certification.ViewerId == 0) + { + onSended.Call(); + return; + } + string log = string.Empty; + string text = string.Empty; + string log2 = string.Empty; + string log3 = string.Empty; + bool flag = false; + string text2 = string.Empty; + string text3 = string.Empty; + string text4 = string.Empty; + string text5 = string.Empty; + string text6 = string.Empty; + switch (logType) + { + case TRACELOG_TYPE.TRACE_ALL_LOG: + text2 = ReadLogFile(AccumulateLogPath); + text2 += _failureWriteClientLog; + text3 = ReadLogFile(LastAccumulate1LogPath); + text4 = ReadLogFile(LastAccumulate2LogPath); + text5 = ReadLogFile(AccumulateSettingLogPath); + text6 = ReadLogFile(InquiryLogPath); + break; + case TRACELOG_TYPE.TRACE_LOG: + text2 = ReadLogFile(AccumulateLogPath); + text2 += _failureWriteClientLog; + text5 = ReadLogFile(AccumulateSettingLogPath); + break; + case TRACELOG_TYPE.TRACE_LAST_LOG: + text3 = ReadLogFile(LastAccumulate1LogPath); + text4 = ReadLogFile(LastAccumulate2LogPath); + break; + } + if (!string.IsNullOrEmpty(text2) || !string.IsNullOrEmpty(text3) || !string.IsNullOrEmpty(text4) || !string.IsNullOrEmpty(text5) || !string.IsNullOrEmpty(text6)) + { + flag = true; + } + if (flag) + { + if (GetBattleAndViewIdText() != string.Empty) + { + log = GetBattleAndViewIdText() + "\n"; + } + switch (logType) + { + case TRACELOG_TYPE.TRACE_ALL_LOG: + log = text2; + if (ToolboxGame.RealTimeNetworkAgent != null) + { + text = text + "bId" + ToolboxGame.RealTimeNetworkAgent.GetBattleId() + "\n"; + } + text += AppendLastLog(text3, text4); + log2 = text5; + log3 = "InquiryLog:" + text6; + break; + case TRACELOG_TYPE.TRACE_LOG: + log = text2; + log2 = text5; + break; + case TRACELOG_TYPE.TRACE_LAST_LOG: + text += AppendLastLog(text3, text4); + if (_isSendGungnirLog) + { + text = text + "\nGungnirLog:==================\n" + _gungnirLog; + InitGungnirLog(); + } + if (_isSendSocketFrameLog) + { + text = text + "\nSocketFrameLog:==================\n" + _socketFrameLog; + InitSocketFrameLog(); + } + if (!string.IsNullOrEmpty(_disconnectLog)) + { + text = text + "\nDisconnectLog:==================\n" + _disconnectLog; + InitDisconnectLog(); + } + break; + } + switch (logType) + { + case TRACELOG_TYPE.TRACE_LAST_LOG: + if (IsLogNullOrEmpty(text)) + { + onSended.Call(); + } + else + { + SendTraceLog(logType, string.Empty, GetShapedLog(text), string.Empty, string.Empty, onSended); + } + break; + case TRACELOG_TYPE.TRACE_LOG: + if (IsLogNullOrEmpty(log) && IsLogNullOrEmpty(log2)) + { + onSended.Call(); + } + else + { + SendTraceLog(logType, GetShapedLog(log), string.Empty, GetShapedLog(log2), string.Empty, onSended); + } + break; + case TRACELOG_TYPE.TRACE_ALL_LOG: + if (IsLogNullOrEmpty(log) && IsLogNullOrEmpty(text) && IsLogNullOrEmpty(log2) && IsLogNullOrEmpty(log3)) + { + onSended.Call(); + } + else + { + SendTraceLog(logType, GetShapedLog(log), GetShapedLog(text), GetShapedLog(log2), GetShapedLog(log3), onSended); + } + break; + } + } + else + { + onSended.Call(); + } + } + + public static void RecordResouseLoadError(int errorFlag) + { + UIManager.ViewScene currentScene = UIManager.GetInstance().GetCurrentScene(); + string text = ((currentScene == UIManager.ViewScene.Battle && ToolboxGame.RealTimeNetworkAgent != null) ? "NetworkBattle" : currentScene.ToString()); + AccumulateTraceLog("ResourcesManager ParallelAssetListExec Error in " + text + " : " + errorFlag); + } + + public static void RecordTurnEndIfLoadErrorOccured() + { + if (ExistResourceLoadErrorInNetWorkBattle()) + { + AccumulateTraceLog("TurnEnd After LoadError"); + } + } + + public static void RecordFreezeLogIfLoadErrorOccured() + { + if (ExistResourceLoadErrorInNetWorkBattle()) + { + AccumulateTraceLog("ResourceLoadFreeze in NetworkBattleScene"); + } + } + + public static bool ExistResourceLoadErrorInNetWorkBattle() + { + return ReadLogFile(AccumulateLogPath).Contains("ResourcesManager ParallelAssetListExec Error in NetworkBattle"); + } + + private static string AppendLastLog(string append_log1, string append_log2) + { + string text = ""; + if (nowTraceTurn != 0) + { + text += append_log1; + return text + append_log2; + } + text += append_log2; + return text + append_log1; + } + + private static bool IsLogNullOrEmpty(string log) + { + return string.IsNullOrEmpty(log.Replace("\n", "").Replace("\r", "")); + } + + private static string GetShapedLog(string log) + { + log = log.Replace("\n", "&&").Replace("\r", ""); + string text = "ID:" + PlayerStaticData.UserViewerID + " {\n" + log + " \n}"; + text.Replace("\n", "\\n"); + return text; + } + + private static void SendTraceLog(TRACELOG_TYPE logType, string log, string last_log, string setting_log, string inquiry_log, Action onSended) + { + bool showLoadingIcon = false; + SendTraceLogTask sendTraceLogTask = new SendTraceLogTask(logType); + if (logType == TRACELOG_TYPE.TRACE_LAST_LOG) + { + sendTraceLogTask.SetParameter(last_log); + } + else if (logType == TRACELOG_TYPE.TRACE_LOG) + { + sendTraceLogTask.SetParameter(log, setting_log); + } + else + { + showLoadingIcon = true; + sendTraceLogTask.SetParameter(log + inquiry_log, last_log, setting_log); + } + sendTraceLogTask.SkipCuteHttpStatusErrorPopup(); + sendTraceLogTask.SkipCuteTimeOutPopup(); + sendTraceLogTask.SkipAllCuteResultCodeCheckErrorPopup(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(sendTraceLogTask, delegate + { + ClearLogByType(logType); + onSended.Call(); + }, delegate + { + onSended.Call(); + }, delegate + { + onSended.Call(); + }, encrypt: true, useJson: false, showLoadingIcon)); + } + + public static void AccumulateTraceLog(string log) + { + AccumulateLog(GetBattleAndViewIdText() + log, "TraceLog"); + } + + public static void AccumulateTraceInquiryLog(string log) + { + AccumulateLog(log, "TraceInquiryLog"); + OrganizeInquiryLog(); + } + + public static void AccumulateSettingLog() + { + if (!(ToolboxGame.RealTimeNetworkAgent == null)) + { + string battleAndViewIdText = GetBattleAndViewIdText(); + string text = (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_BATTLE_EFFECT) ? "1" : "0"); + string text2 = (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.CONFIRM_TURN_END) ? "1" : "0"); + string text3 = (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.CONFIRM_EVOLVE) ? "1" : "0"); + string text4 = (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SELECT_WSS) ? "1" : "0"); + AccumulateLog(battleAndViewIdText + "BattleSetting:" + text + text2 + text3 + text4, "TraceSettingLog"); + } + } + + public static void AddGungnirLog(string log) + { + if (ToolboxGame.RealTimeNetworkAgent != null) + { + DateTime dateTime = DateTime.Now.ToUniversalTime(); + log = dateTime.Day + "/" + dateTime.Hour + ":" + dateTime.Minute + ":" + dateTime.Second + ":" + dateTime.Millisecond.ToString("000") + ":[" + ToolboxGame.RealTimeNetworkAgent.NowSocketID + "]" + log + "\n"; + _gungnirLog += log; + } + } + + public static void InitGungnirLog() + { + _gungnirLog = ""; + if (ToolboxGame.RealTimeNetworkAgent != null && _isSendGungnirLog) + { + ToolboxGame.RealTimeNetworkAgent.NetworkLogger.LogInfo("OffGungnirLog"); + } + _isSendGungnirLog = false; + } + + public static void AddSocketFrameLog(string log) + { + if (ToolboxGame.RealTimeNetworkAgent != null) + { + DateTime dateTime = DateTime.Now.ToUniversalTime(); + log = dateTime.Day + "/" + dateTime.Hour + ":" + dateTime.Minute + ":" + dateTime.Second + ":" + dateTime.Millisecond.ToString("000") + ":[" + ToolboxGame.RealTimeNetworkAgent.NowSocketID + "]" + log + "\n"; + _socketFrameLog += log; + } + } + + public static void InitSocketFrameLog() + { + _socketFrameLog = ""; + if (ToolboxGame.RealTimeNetworkAgent != null && _isSendSocketFrameLog) + { + ToolboxGame.RealTimeNetworkAgent.NetworkLogger.LogInfo("OffSocketFrameLog"); + } + _isSendSocketFrameLog = false; + } + + public static void AccumulateTraceLogAddRoomCreateLog() + { + if (!_isRoomCreateLogEnd) + { + _isRoomCreateLogEnd = true; + AccumulateTraceLog("#696951 " + _roomCreateLog); + InitRoomCreateLog(); + } + } + + public static void AddRoomCreateLog(string log) + { + if (!_isRoomCreateLogEnd) + { + DateTime dateTime = DateTime.Now.ToUniversalTime(); + log = dateTime.Day + "/" + dateTime.Hour + ":" + dateTime.Minute + ":" + dateTime.Second + ":" + dateTime.Millisecond.ToString("000") + log + "\n"; + _roomCreateLog += log; + } + } + + public static void InitRoomCreateLog() + { + _roomCreateLog = ""; + } + + public static void UpdateLoadResourceLog(string log) + { + _loadResourceLog = log; + } + + public static string GetLoadResourceLog() + { + return _loadResourceLog; + } + + public static void SetDisconnectLog(string log) + { + if (_disconnectLog == "") + { + DateTime dateTime = DateTime.Now.ToUniversalTime(); + log = dateTime.Day + "/" + dateTime.Hour + ":" + dateTime.Minute + ":" + dateTime.Second + ":" + dateTime.Millisecond.ToString("000") + ":[" + ToolboxGame.RealTimeNetworkAgent.NowSocketID + "]" + log + "\n"; + _disconnectLog = log; + } + } + + public static void InitDisconnectLog() + { + _disconnectLog = ""; + } + + public static void AccumulateLastTraceLog(string log) + { + if (_lastTraceLogStringBuilder == null) + { + _lastTraceLogStringBuilder = new StringBuilder(); + } + else + { + _lastTraceLogStringBuilder.Append("\n"); + } + float num = 0f; + if (num != 0f && num / (float)SystemInfo.systemMemorySize > 0.8f) + { + string text = ""; + log += text; + } + if (!_isLastTraceLogTimeAdd) + { + DateTime dateTime = DateTime.Now.ToUniversalTime(); + _lastTraceLogStringBuilder.AppendFormat("{0}/{1}:{2}:{3}:{4:000}:{5}", dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second, dateTime.Millisecond.ToString("000"), "\n" + log); + _isLastTraceLogTimeAdd = true; + } + else + { + _lastTraceLogStringBuilder.Append(log); + } + } + + public static void SubmitAccumulateLastTraceLog() + { + if (_lastTraceLogStringBuilder != null) + { + string key = ""; + if (nowTraceTurn == 0) + { + key = "LastTraceLog1"; + } + else if (nowTraceTurn == 1) + { + key = "LastTraceLog2"; + } + AccumulateLog(_lastTraceLogStringBuilder.ToString(), key, isTimeEnable: false); + _isLastTraceLogTimeAdd = false; + _lastTraceLogStringBuilder = null; + } + } + + public static void SetLastTraceLogTurn(int turn) + { + if (currentTurn != turn) + { + string log = "Turn" + turn + " " + GetBattleAndViewIdText() + "====\n"; + string text = ""; + if (turn % 2 == 0) + { + text = "LastTraceLog1"; + nowTraceTurn = 0; + } + else + { + text = "LastTraceLog2"; + nowTraceTurn = 1; + } + if (turn != 0) + { + ClearLastTraceLog(text); + } + WriteAccumulateTraceLog(text, log); + currentTurn = turn; + } + } + + private static string ReadLogFile(string filePath) + { + SubmitAccumulateLastTraceLog(); + string result = ""; + StreamReader streamReader = null; + try + { + if (!File.Exists(filePath)) + { + CreateLogFile(); + } + using (streamReader = new StreamReader(filePath)) + { + result = streamReader.ReadToEnd(); + streamReader.Close(); + streamReader.Dispose(); + } + } + catch (Exception ex) + { + streamReader?.Dispose(); + string text = "FailedToReadFile:" + filePath + "(" + ex?.ToString() + ")"; + Debug.LogError(text); + _failureWriteClientLog = _failureWriteClientLog + text + "\n"; + } + return result; + } + + private static void WriteAccumulateTraceLog(string key, string log) + { + string text = ""; + switch (key) + { + default: + return; + case "TraceLog": + text = AccumulateLogPath; + break; + case "LastTraceLog1": + text = LastAccumulate1LogPath; + break; + case "LastTraceLog2": + text = LastAccumulate2LogPath; + break; + case "TraceSettingLog": + text = AccumulateSettingLogPath; + break; + case "TraceInquiryLog": + text = InquiryLogPath; + break; + } + try + { + if ((float)new FileInfo(text).Length / 1024f > 500f) + { + return; + } + } + catch + { + return; + } + StreamWriter streamWriter = null; + try + { + using (streamWriter = new StreamWriter(text, append: true)) + { + streamWriter.WriteLine(log); + streamWriter.Flush(); + streamWriter.Close(); + } + } + catch (Exception ex) + { + string text2 = "FailedToWriteFile" + ex.ToString(); + Debug.LogError(text2); + streamWriter?.Dispose(); + if (key == "TraceLog") + { + _failureWriteClientLog = _failureWriteClientLog + text2 + " " + log + "\n"; + } + } + } + + private static void OrganizeInquiryLog() + { + try + { + FileInfo fileInfo = new FileInfo(InquiryLogPath); + if (fileInfo != null && (float)fileInfo.Length / 1024f > 5f) + { + string text = ReadLogFile(InquiryLogPath); + string log = text.Substring((int)((float)text.Length - 2560f)); + ClearInquiryLogKey(); + AccumulateTraceInquiryLog(log); + } + } + catch + { + } + } + + private static void AccumulateLog(string log, string key, bool isTimeEnable = true) + { + if (!string.IsNullOrEmpty(Environment.UserName) && log.IndexOf("Users") >= 0) + { + if (log.IndexOf(Environment.UserName) >= 0) + { + log = log.Replace(Environment.UserName, "Environment_UserName"); + } + if (log.IndexOf(Environment.UserName.ToLower()) >= 0) + { + log = log.Replace(Environment.UserName.ToLower(), "Environment_UserName"); + } + if (log.IndexOf(Environment.UserName.ToUpper()) >= 0) + { + log = log.Replace(Environment.UserName.ToUpper(), "Environment_UserName"); + } + } + _ = Toolbox.DebugManager != null; + if (isTimeEnable) + { + DateTime dateTime = DateTime.Now.ToUniversalTime(); + log = dateTime.Day + "/" + dateTime.Hour + ":" + dateTime.Minute + ":" + dateTime.Second + ":" + dateTime.Millisecond.ToString("000") + ":" + log; + } + try + { + WriteAccumulateTraceLog(key, log); + } + catch + { + } + } + + private static void ClearLogByType(TRACELOG_TYPE logType) + { + switch (logType) + { + case TRACELOG_TYPE.TRACE_ALL_LOG: + _failureWriteClientLog = ""; + ClearTraceLog(); + ClearLastLogKey(); + ClearInquiryLogKey(); + break; + case TRACELOG_TYPE.TRACE_LOG: + _failureWriteClientLog = ""; + ClearTraceLog(); + break; + case TRACELOG_TYPE.TRACE_LAST_LOG: + ClearLastLogKey(); + break; + } + } + + public static void ClearTraceLog() + { + ClearLog("TraceLog"); + ClearLog("TraceSettingLog"); + } + + public static void ClearLastTraceLog(string key) + { + ClearLog(key); + } + + private static void ClearInquiryLogKey() + { + ClearLog("TraceInquiryLog"); + } + + private static void ClearLog(string key) + { + string text = ""; + switch (key) + { + default: + return; + case "TraceLog": + text = AccumulateLogPath; + break; + case "LastTraceLog1": + text = LastAccumulate1LogPath; + break; + case "LastTraceLog2": + text = LastAccumulate2LogPath; + break; + case "TraceSettingLog": + text = AccumulateSettingLogPath; + break; + case "TraceInquiryLog": + text = InquiryLogPath; + break; + } + StreamWriter streamWriter = null; + try + { + using (streamWriter = new StreamWriter(text)) + { + streamWriter.WriteLine(""); + streamWriter.Flush(); + streamWriter.Close(); + } + } + catch + { + Debug.LogError("Failed to clear log"); + streamWriter?.Dispose(); + } + } + + public static void ClearLastLogKey() + { + ClearLastTraceLog("LastTraceLog1"); + ClearLastTraceLog("LastTraceLog2"); + currentTurn = -1; + } + + public static void ClearAllLog() + { + ClearTraceLog(); + ClearLastLogKey(); + ClearInquiryLogKey(); + } + + public static void RecordCheckLog(RecordType type, bool isWin) + { + if (BattleManagerBase.GetIns() == null || !isWin) + { + return; + } + switch (type) + { + case RecordType.CERBERUS: + if (BattleManagerBase.GetIns().BattlePlayer.Turn <= 1) + { + AccumulateLastTraceLog("CERBERUS AWAKEN"); + } + break; + case RecordType.HADES: + { + NetworkBattleManagerBase networkBattleManagerBase = (NetworkBattleManagerBase)BattleManagerBase.GetIns(); + if (networkBattleManagerBase.JudgeResultReceiveCode == NetworkBattleReceiver.RESULT_CODE.RetireWin || networkBattleManagerBase.JudgeResultReceiveCode == NetworkBattleReceiver.RESULT_CODE.DisconnectWin || networkBattleManagerBase.JudgeResultReceiveCode == NetworkBattleReceiver.RESULT_CODE.FirstcardWin || networkBattleManagerBase.BattlePlayer.PlayCardTouchCount != 0) + { + break; + } + long num = ((ToolboxGame.RealTimeNetworkAgent != null) ? ToolboxGame.RealTimeNetworkAgent.GetBattleId() : 0); + if (num <= 0 && Data.DoMatchingDetail.data != null) + { + num = Data.DoMatchingDetail.data.GetBattleId(); + } + if (num <= 0) + { + RoomConnectController connectController = RoomBase.ConnectController; + if (connectController != null && connectController.OwnCtrl is PlayerControllerForOwn playerControllerForOwn) + { + num = playerControllerForOwn.GetBattleId(); + } + } + AccumulateTraceLog("HADES AWAKEN BattleID:" + num); + break; + } + } + } + + public static void RecordMemoryOnLastTurnLog() + { + } + + private static float ConvertByteToMegaByte(float _byte) + { + return _byte / 1024f / 1024f; + } + + private static string GetBattleAndViewIdText() + { + string battleIdText = GetBattleIdText(); + string viewIdText = GetViewIdText(); + if (battleIdText.IsNotNullOrEmpty() || viewIdText.IsNotNullOrEmpty()) + { + return "[bid " + battleIdText + " vid " + viewIdText + "]"; + } + return string.Empty; + } + + private static string GetBattleIdText() + { + if (ToolboxGame.RealTimeNetworkAgent != null) + { + long battleId = ToolboxGame.RealTimeNetworkAgent.GetBattleId(); + if (battleId == -1) + { + return string.Empty; + } + return battleId.ToString(); + } + return string.Empty; + } + + private static string GetViewIdText() + { + if (ToolboxGame.RealTimeNetworkAgent != null) + { + int viewId = ToolboxGame.RealTimeNetworkAgent.GetViewId(); + if (viewId == 0) + { + return string.Empty; + } + return viewId.ToString(); + } + return string.Empty; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/LocalizeJson.cs b/SVSim.BattleEngine/Engine/Wizard/LocalizeJson.cs new file mode 100644 index 0000000..1945c8e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/LocalizeJson.cs @@ -0,0 +1,226 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using LitJson; +using UnityEngine; + +namespace Wizard; + +public class LocalizeJson +{ + private enum ParserState + { + ObjectAwait, + ObjectStart, + ObjectEnd, + KeyAwait, + KeyStart, + KeyEnd, + ValueAwait, + ValueStart, + ValueEnd + } + + private static readonly string PC_SP_TEXT_PREFIX = "[pcsp]"; + + private static readonly char PC_SP_SPLIT = '|'; + + public static void Parse(IDictionary dic, string region, string text, bool isTrimKey = false) + { + int i; + for (i = 0; i < text.Length && Convert.ToInt32(text[i]) == 65279; i++) + { + } + int length = text.Length; + int num = 0; + int num2 = 0; + string text2 = ""; + bool flag = false; + bool flag2 = false; + bool flag3 = false; + bool flag4 = false; + ParserState parserState = ParserState.ObjectAwait; + for (; i < text.Length; i++) + { + char c = text[i]; + switch (c) + { + case '{': + switch (parserState) + { + case ParserState.ObjectAwait: + parserState = ParserState.ObjectStart; + num2++; + break; + default: + flag4 = true; + break; + case ParserState.KeyStart: + case ParserState.ValueStart: + break; + } + break; + case '"': + switch (parserState) + { + case ParserState.ObjectStart: + case ParserState.KeyAwait: + parserState = ParserState.KeyStart; + num = i + 1; + break; + case ParserState.ValueAwait: + parserState = ParserState.ValueStart; + num = i + 1; + break; + case ParserState.KeyStart: + if (flag3) + { + text2 = text.Substring(num, i - num); + } + else if (num2 == 2 && text.Substring(num, i - num) == region) + { + flag3 = true; + } + parserState = ParserState.KeyEnd; + break; + case ParserState.ValueStart: + if (flag3) + { + string text3 = text.Substring(num, i - num); + if (flag) + { + text3 = text3.Replace("\\n", "\n"); + flag = false; + } + if (flag2) + { + text3 = text3.Replace("\\\"", "\""); + flag2 = false; + } + if (text3.StartsWith(PC_SP_TEXT_PREFIX, StringComparison.Ordinal)) + { + text3 = text3.Remove(0, PC_SP_TEXT_PREFIX.Length); + text3 = text3.Split(PC_SP_SPLIT)[0]; + } + dic.Add(isTrimKey ? text2.Trim() : text2, text3); + } + parserState = ParserState.ValueEnd; + break; + default: + flag4 = true; + break; + } + break; + case ':': + switch (parserState) + { + case ParserState.KeyEnd: + parserState = ((num2 == 3) ? ParserState.ValueAwait : ParserState.ObjectAwait); + break; + default: + flag4 = true; + break; + case ParserState.KeyStart: + case ParserState.ValueStart: + break; + } + break; + case '}': + switch (parserState) + { + case ParserState.ObjectStart: + case ParserState.ObjectEnd: + case ParserState.ValueEnd: + if (flag3) + { + return; + } + parserState = ParserState.ObjectEnd; + num2--; + break; + default: + flag4 = true; + break; + case ParserState.KeyStart: + case ParserState.ValueStart: + break; + } + break; + case ',': + switch (parserState) + { + case ParserState.ObjectEnd: + parserState = ParserState.KeyAwait; + break; + case ParserState.ValueEnd: + parserState = ParserState.KeyAwait; + break; + default: + flag4 = true; + break; + case ParserState.KeyStart: + case ParserState.ValueStart: + break; + } + break; + case '\\': + i++; + if (flag3 && i < text.Length) + { + switch (text[i]) + { + case 'n': + flag = true; + break; + case '"': + flag2 = true; + break; + } + } + break; + default: + if (parserState != ParserState.KeyStart && parserState != ParserState.ValueStart) + { + switch (c) + { + default: + flag4 = true; + break; + case '\t': + case '\n': + case '\r': + case ' ': + break; + } + } + break; + } + if (flag4) + { + throw new ApplicationException($"Could not parse localize JSON: invalid '{c}' at position {i}, state {parserState.ToString()}, around '{text.Substring(Math.Max(i - 32, 0), Math.Min(64, length - i))}'"); + } + } + } + + public static void LegacyParse(IDictionary dic, string region, string fileName, bool isTrimKey = false) + { + TextAsset textAsset = Toolbox.ResourcesManager.LoadObject(fileName) as TextAsset; + IDictionary dictionary = JsonMapper.ToObject(textAsset.ToString())[textAsset.name]; + foreach (string key in dictionary.Keys) + { + if (key != region) + { + continue; + } + IDictionary dictionary2 = (IDictionary)dictionary[region]; + { + foreach (string key2 in dictionary2.Keys) + { + dic.Add(isTrimKey ? key2.Trim() : key2, dictionary2[key2].ToString()); + } + break; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/LootBoxDialogUtility.cs b/SVSim.BattleEngine/Engine/Wizard/LootBoxDialogUtility.cs new file mode 100644 index 0000000..557f2a8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/LootBoxDialogUtility.cs @@ -0,0 +1,71 @@ +using System; + +namespace Wizard; + +public static class LootBoxDialogUtility +{ + private const int LOOT_BOX_DIALOG_DEPTH = 3000; + + public static void CreateLootBoxRegulationDialog(PlayerStaticData.LootBoxType type) + { + string key; + string key2; + switch (type) + { + default: + return; + case PlayerStaticData.LootBoxType.GACHA: + key = "Dia_LootBox_002_Title"; + key2 = "Dia_LootBox_002_Body"; + break; + case PlayerStaticData.LootBoxType.TWOPICK: + key = "Dia_LootBox_003_Title"; + key2 = "Dia_LootBox_003_Body"; + break; + case PlayerStaticData.LootBoxType.SEALED: + key = "Dia_LootBox_Sealed_Title"; + key2 = "Dia_LootBox_Sealed_Body"; + break; + case PlayerStaticData.LootBoxType.COLOSSEUM: + key = "Dia_LootBox_004_Title"; + key2 = "Dia_LootBox_004_Body"; + break; + case PlayerStaticData.LootBoxType.COMPETITION: + key = "Dia_LootBox_Competition_Title"; + key2 = "Dia_LootBox_Competition_Body"; + break; + case PlayerStaticData.LootBoxType.SPECIAL_CRYSTAL: + key = "Dia_LootBox_005_Title"; + key2 = "Dia_LootBox_005_Body"; + break; + } + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetPanelDepth(3000); + dialogBase.SetTitleLabel(Data.SystemText.Get(key)); + dialogBase.SetText(Data.SystemText.Get(key2)); + } + + public static void CreatePurchaseNotificationLootBoxDialog(string titleLabel, string itemText, Action onClickPayment, Action onClickCancel) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(titleLabel); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(Data.SystemText.Get("Dia_BuyCrystal_004_Button")); + dialogBase.SetPanelDepth(3000); + dialogBase.onPushButton1 = onClickPayment; + dialogBase.onPushButton2 = onClickCancel; + string text = Data.SystemText.Get("Dia_LootBox_001", itemText); + if (PlayerStaticData.IsLootBoxRegulation(PlayerStaticData.LootBoxType.GACHA)) + { + text = text + "\n" + Data.SystemText.Get("Dia_LootBox_Item_001"); + } + if (PlayerStaticData.IsLootBoxRegulation(PlayerStaticData.LootBoxType.TWOPICK) || PlayerStaticData.IsLootBoxRegulation(PlayerStaticData.LootBoxType.SEALED) || PlayerStaticData.IsLootBoxRegulation(PlayerStaticData.LootBoxType.COLOSSEUM) || PlayerStaticData.IsLootBoxRegulation(PlayerStaticData.LootBoxType.COMPETITION)) + { + text = text + "\n" + Data.SystemText.Get("Dia_LootBox_Item_002"); + } + dialogBase.SetText(text); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Mastershop.cs b/SVSim.BattleEngine/Engine/Wizard/Mastershop.cs new file mode 100644 index 0000000..f8114cf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Mastershop.cs @@ -0,0 +1,71 @@ +using System.Collections; +using System.Collections.Generic; + +namespace Wizard; + +public class Mastershop +{ + public class Shop + { + private int _id; + + private string _store_product_id; + + private string _name; + + private string _text; + + private int _price; + + private int _charge_jewel; + + private int _free_jewel; + + public int id => _id; + + public string store_product_id => _store_product_id; + + public string name => _name; + + public string text => _text; + + public int price => _price; + + public int charge_jewel => _charge_jewel; + + public int free_jewel => _free_jewel; + + public Shop(string[] record) + { + _id = int.Parse(record[0]); + _store_product_id = record[1]; + _name = record[2]; + _text = record[3]; + _price = int.Parse(record[4]); + _charge_jewel = int.Parse(record[5]); + _free_jewel = int.Parse(record[6]); + } + } + + private Dictionary _dictionary = new Dictionary(); + + public Dictionary dictionary => _dictionary; + + public string[] ProductIdList { get; private set; } + + public Mastershop(ArrayList list) + { + ProductIdList = new string[list.Count]; + for (int i = 0; i < list.Count; i++) + { + string[] array = (string[])((ArrayList)list[i]).ToArray(typeof(string)); + int key = int.Parse(array[0]); + _dictionary.Add(key, new Shop(array)); + ProductIdList[i] = array[1]; + } + } + + public Mastershop() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Matching_Competition.cs b/SVSim.BattleEngine/Engine/Wizard/Matching_Competition.cs new file mode 100644 index 0000000..2bded5e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Matching_Competition.cs @@ -0,0 +1,52 @@ +using System; +using Cute; + +namespace Wizard; + +public class Matching_Competition : Matching +{ + public Matching_Competition() + { + errorDialogReturnText = Data.SystemText.Get("Sealed_BattleResult_0001"); + } + + public override void DoMatching(Action onFinished, int need_init, DO_MATCHING_LOG log) + { + base.DoMatching(onFinished, need_init, log); + CompetitionBattleDoMatchingTask task = new CompetitionBattleDoMatchingTask(selectDeckID, need_init, (int)log); + ConnectAPI(task, delegate + { + if (Data.DoMatchingDetail.data.matchingState != 3009) + { + DoMatchingResultSetting(); + onFinished.Call(); + } + }); + } + + protected override void TimeOutMessageToRetry() + { + SystemText systemText = Data.SystemText; + ErrorDialogWithRetry(systemText.Get("Battle_0461"), systemText.Get("Battle_0412")); + Data.ArenaData.CompetitionData.IsRankMatching = false; + } + + public override FinishTaskBase GetBattleFinishTask() + { + return new CompetitionBattleFinishTask(); + } + + protected override void GotoDeckSelectScene() + { + UIManager uiMgr = UIManager.GetInstance(); + UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam + { + OnFinishChangeView = delegate + { + uiMgr.CloseInSceneLoadingMatching(); + uiMgr.CloseInSceneLoadingBattle(); + } + }; + uiMgr.ChangeViewScene(UIManager.ViewScene.CompetitionLobby, param); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Matching_Sealed.cs b/SVSim.BattleEngine/Engine/Wizard/Matching_Sealed.cs new file mode 100644 index 0000000..a8890bc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Matching_Sealed.cs @@ -0,0 +1,51 @@ +using System; +using Cute; + +namespace Wizard; + +public class Matching_Sealed : Matching +{ + public Matching_Sealed() + { + errorDialogReturnText = Data.SystemText.Get("Sealed_BattleResult_0001"); + } + + public override void DoMatching(Action onFinished, int need_init, DO_MATCHING_LOG log) + { + base.DoMatching(onFinished, need_init, log); + SealedBattleDoMatchingTask task = new SealedBattleDoMatchingTask(selectDeckID, need_init, (int)log); + ConnectAPI(task, delegate + { + if (Data.DoMatchingDetail.data.matchingState != 3009) + { + DoMatchingResultSetting(); + onFinished.Call(); + } + }); + } + + protected override void TimeOutMessageToRetry() + { + SystemText systemText = Data.SystemText; + ErrorDialogWithRetry(systemText.Get("Battle_0461"), systemText.Get("Battle_0412")); + } + + public override FinishTaskBase GetBattleFinishTask() + { + return new SealedBattleFinishTask(); + } + + protected override void GotoDeckSelectScene() + { + UIManager uiMgr = UIManager.GetInstance(); + UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam + { + OnFinishChangeView = delegate + { + uiMgr.CloseInSceneLoadingMatching(); + uiMgr.CloseInSceneLoadingBattle(); + } + }; + uiMgr.ChangeViewScene(UIManager.ViewScene.Sealed, param); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MaterialDefine.cs b/SVSim.BattleEngine/Engine/Wizard/MaterialDefine.cs new file mode 100644 index 0000000..fb16cc2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MaterialDefine.cs @@ -0,0 +1,13 @@ +using UnityEngine; + +namespace Wizard; + +public static class MaterialDefine +{ + public static Material CreateNguiStencilMaskMaterial(int stencil = 1) + { + Material material = new Material(Shader.Find("/Unlit/UIMask")); + material.SetInt("_StencilMask", stencil); + return material; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MissionInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard/MissionInfoTask.cs new file mode 100644 index 0000000..4e023e9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MissionInfoTask.cs @@ -0,0 +1,43 @@ +using UnityEngine; + +namespace Wizard; + +public class MissionInfoTask : BaseTask +{ + public class MissionInfoTaskParam : BaseParam + { + } + + public long ServerTime { get; private set; } + + public long RequestTime { get; private set; } + + public long NowUnixTime() + { + return ServerTime - RequestTime + (long)Time.realtimeSinceStartup; + } + + public MissionInfoTask() + { + base.type = ApiType.Type.MissionInfo; + } + + public void SetParameter() + { + MissionInfoTaskParam missionInfoTaskParam = new MissionInfoTaskParam(); + base.Params = missionInfoTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + ServerTime = base.ResponseData["data_headers"]["servertime"].ToLong(); + RequestTime = (long)Time.realtimeSinceStartup; + Data.MissionInfo.data = new MissionInfoDetail(base.ResponseData["data"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ModUnitRatePolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/ModUnitRatePolicyCollection.cs new file mode 100644 index 0000000..02202de --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ModUnitRatePolicyCollection.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class ModUnitRatePolicyCollection : AIPolicyCollection +{ + public float GetUnitRate(AIVirtualCard card, AIVirtualField field, List playPtn) + { + if (!base.HasPolicy) + { + return 1f; + } + float num = 1f; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(card, playPtn, field, null)) + { + num *= aIPolicyData.EvalArg(card, playPtn, field); + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MoveFirstBonusPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/MoveFirstBonusPolicyCollection.cs new file mode 100644 index 0000000..1a61747 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MoveFirstBonusPolicyCollection.cs @@ -0,0 +1,93 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class MoveFirstBonusPolicyCollection : AIPolicyCollection +{ + private struct MoveFirstBonusInfo + { + public bool IsLeastValue; + + public bool IsAllyAttackFollower; + } + + public float GetMoveFirstBonus(AIVirtualCard card, AIVirtualField field, List moves) + { + if (!base.HasPolicy) + { + return 0f; + } + AIVirtualActionInfo situation = moves[0]; + float num = 0f; + MoveFirstBonusInfo moveFirstBonusInfo = GetMoveFirstBonusInfo(moves); + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (!(aIPolicyData.Argument is AIFirstMoveBonus { ActionArgType: var actionArgType } aIFirstMoveBonus)) + { + continue; + } + switch (actionArgType) + { + case AIScriptTokenArgType.LEAST_VALUE: + if (!moveFirstBonusInfo.IsLeastValue) + { + continue; + } + break; + case AIScriptTokenArgType.ALLY_ATTACK_FOLLOWER: + if (!moveFirstBonusInfo.IsAllyAttackFollower) + { + continue; + } + break; + default: + AIConsoleUtility.LogError($"MoveFirstBonusPolicyCollection.GetMoveFirstBonus(): Arg type is unsupported. type:[{aIFirstMoveBonus.ActionArgType}]"); + continue; + case AIScriptTokenArgType.ALL: + break; + } + if (aIPolicyData.CheckCondition(card, EnemyAI.EmptyPlayPtn, field, situation)) + { + num += aIFirstMoveBonus.GetEvaluateValue(card, situation); + } + } + return num; + } + + private MoveFirstBonusInfo GetMoveFirstBonusInfo(List moves) + { + AIVirtualCard actor = moves[0].Actor; + bool flag = true; + bool flag2 = false; + if (moves.Count > 1) + { + float defaultValue = actor.DefaultValue; + for (int i = 1; i < moves.Count; i++) + { + AIVirtualActionInfo aIVirtualActionInfo = moves[i]; + if (aIVirtualActionInfo.ActionType == AIOperationType.TURNEND) + { + break; + } + if (flag && aIVirtualActionInfo.Actor != null && aIVirtualActionInfo.Actor.DefaultValue < defaultValue) + { + flag = false; + } + if (!flag2 && aIVirtualActionInfo is AIVirtualAttackInfo aIVirtualAttackInfo && !aIVirtualAttackInfo.AttackTarget.IsLeader) + { + flag2 = true; + } + if (!flag && flag2) + { + break; + } + } + } + return new MoveFirstBonusInfo + { + IsLeastValue = flag, + IsAllyAttackFollower = flag2 + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MovieSubtitles.cs b/SVSim.BattleEngine/Engine/Wizard/MovieSubtitles.cs new file mode 100644 index 0000000..86075c5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MovieSubtitles.cs @@ -0,0 +1,116 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class MovieSubtitles : MonoBehaviour +{ + private class SubtitlesData + { + public string Text { get; private set; } + + public int StartPositionTime { get; private set; } + + public int EndPositionTime { get; private set; } + + public SubtitlesData(string text, int startPositionTime, int endPositionTime) + { + Text = text; + StartPositionTime = startPositionTime; + EndPositionTime = endPositionTime; + } + } + + private enum eStateSubtitles + { + READY, + WAIT_DISPLAY_START, + WAIT_DISPLAY_END, + FINISH + } + + [SerializeField] + private UILabel _labelMovieSubtitles; + + public void PlaySubtitles(string subtitlesCSV) + { + if (!PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.MOVIE_SUBTITLES)) + { + Finish(); + return; + } + List subtitlesDataList = ParseSubtitlesData(subtitlesCSV); + base.gameObject.SetLayer(LayerMask.NameToLayer("SystemUI"), isSetChildren: true); + _labelMovieSubtitles.gameObject.SetActive(value: true); + StartCoroutine(ISubtitlesOnPlayMovie(subtitlesDataList)); + } + + public void Finish() + { + Object.Destroy(base.gameObject); + } + + private List ParseSubtitlesData(string subtitlesCSV) + { + List list = new List(); + foreach (ArrayList item in Utility.ConvertCSV(subtitlesCSV)) + { + string[] obj = (string[])item.ToArray(typeof(string)); + string text = obj[0]; + int startPositionTime = int.Parse(obj[1]); + int endPositionTime = int.Parse(obj[2]); + list.Add(new SubtitlesData(text, startPositionTime, endPositionTime)); + } + return list; + } + + private IEnumerator ISubtitlesOnPlayMovie(List subtitlesDataList) + { + int index = 0; + SubtitlesData data = null; + eStateSubtitles state = eStateSubtitles.READY; + _labelMovieSubtitles.text = string.Empty; + while (true) + { + switch (state) + { + case eStateSubtitles.READY: + if (index < subtitlesDataList.Count) + { + data = subtitlesDataList[index]; + state = eStateSubtitles.WAIT_DISPLAY_START; + } + else + { + state = eStateSubtitles.FINISH; + } + continue; + case eStateSubtitles.WAIT_DISPLAY_START: + if (Toolbox.MovieManager.GetSeekPosition() > data.StartPositionTime) + { + _labelMovieSubtitles.text = data.Text; + state = eStateSubtitles.WAIT_DISPLAY_END; + continue; + } + break; + case eStateSubtitles.WAIT_DISPLAY_END: + if (Toolbox.MovieManager.GetSeekPosition() > data.EndPositionTime) + { + _labelMovieSubtitles.text = string.Empty; + state = eStateSubtitles.READY; + index++; + continue; + } + break; + } + if (state == eStateSubtitles.FINISH) + { + break; + } + yield return null; + } + Finish(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPage.cs b/SVSim.BattleEngine/Engine/Wizard/MyPage.cs new file mode 100644 index 0000000..a2a8ec1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPage.cs @@ -0,0 +1,8 @@ +namespace Wizard; + +public class MyPage : HeaderData +{ + public MyPageDetail data; + + public bool CardUpdateFlag { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageBGInfo.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageBGInfo.cs new file mode 100644 index 0000000..5c6ffb6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageBGInfo.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class MyPageBGInfo +{ + public MyPageDetail.BGType BGType { get; set; } + + public string Id { get; set; } + + public List RandomIdList { get; set; } + + public MyPageBGInfo() + { + } + + public MyPageBGInfo(JsonData json) + { + BGType = (MyPageDetail.BGType)json["select_type"].ToInt(); + Id = json["mypage_id"].ToString(); + RandomIdList = new List(); + if (json.TryGetValue("mypage_id_list", out var value)) + { + for (int i = 0; i < value.Count; i++) + { + RandomIdList.Add(value[i].ToString()); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageCustomBGControl.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageCustomBGControl.cs new file mode 100644 index 0000000..36ed214 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageCustomBGControl.cs @@ -0,0 +1,520 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class MyPageCustomBGControl : MonoBehaviour +{ + private const string PARTICLE_SORT_LAYER = "Default"; + + private const int CHARACTER_BACK_EFFECT_SORT_ORDER = 15; + + private const int RENDER_TEXTURE_DEPTH_BIT = 16; + + private const float FADE_TIME = 0.3f; + + private readonly Vector3 FADE_DESTROY_OFFSET = new Vector3(6000f, 0f, 0f); + + private const float RENDER_TEXTURE_BASE_SIZE = 2048f; + + private const float ASPECT_RATIO = 0.5625f; + + private const float ASPECT_RATIO_2 = 0.46153846f; + + private const float ASPECT_RATIO_REVERSE = 1.7777778f; + + [SerializeField] + private UITexture _bg; + + [SerializeField] + private UITexture _character; + + [SerializeField] + private GameObject _effectRoot; + + [SerializeField] + private GameObject _effectRootBG; + + [SerializeField] + private GameObject _root; + + [SerializeField] + private UITexture _customBGTexture; + + [SerializeField] + private Camera _customBGCamera; + + [SerializeField] + private GameObject _spineRoot; + + [SerializeField] + private GameObject _spineCameraPrefab; + + [SerializeField] + private GameObject _spineCameraParent; + + [SerializeField] + private SpineDisplay _spineDiaplay; + + [SerializeField] + private UITexture _spineTexture; + + [SerializeField] + private Camera _myPageParticleCamera; + + [SerializeField] + private GameObject _effectPositionDecideObject; + + [SerializeField] + private UIPanel _panel; + + private List _loadFileList = new List(); + + private GameObject _frontEffect; + + private List _frontEffectChild = new List(); + + private List _frontEffectLocalPosition = new List(); + + private GameObject _backEffect; + + private RenderTexture _renderTexture; + + private Camera _spineCamera; + + private float _characterAspectFixRate = 1f; + + private Vector3 _characterAspectOffset = Vector3.zero; + + private float _fadeOutTimer; + + private bool _isFadeOut = true; + + private bool _isFadeOutDestroy; + + private int _saveScreenWidth; + + private int _saveScreenHeight; + + private bool _isFadeOutStandbyCalled; + + private Shader _fadeoutShader; + + private Shader _normalShader; + + private Action _onFadeFinish; + + private float _startShowTime; + + public bool IsLoading { get; private set; } + + public string Id { get; private set; } = string.Empty; + + public bool IsLoadRequestEnd => Id != string.Empty; + + private string GetBackGroundTexturePath(string id, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(id, ResourcesManager.AssetLoadPathType.MyPageBackGround, isFetch); + } + + private string GetBackGroundMaterialPath(string id, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(id + "_M", ResourcesManager.AssetLoadPathType.MyPageBackGround, isFetch); + } + + private string GetBackGroundMaskPath(string id, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(id + "_mask", ResourcesManager.AssetLoadPathType.MyPageBackGround, isFetch); + } + + private string GetCharacterPath(string id, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(id, ResourcesManager.AssetLoadPathType.MyPageCharacter, isFetch); + } + + private string GetCharacterMaskPath(string id, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(id, ResourcesManager.AssetLoadPathType.MyPageCharacterMask, isFetch); + } + + private string GetEffectPath(string id, string footer, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath("scn_bg_mypage_" + id + "_" + footer, ResourcesManager.AssetLoadPathType.Effect2D, isFetch); + } + + private string GetSpineFileName(string id) + { + return "spine_mypage_" + id + "_body"; + } + + public void Load(string id, bool isDisplaySoon, Action onLoadFinish) + { + IsLoading = true; + Id = id; + _fadeoutShader = Shader.Find("Unlit/Transparent Colored MyPageFinal"); + _normalShader = Shader.Find("Unlit/Texture"); + _spineCamera = NGUITools.AddChild(_spineCameraParent, _spineCameraPrefab).GetComponent(); + _spineCamera.enabled = false; + _myPageParticleCamera.enabled = false; + _customBGTexture.alpha = 0f; + StartCoroutine(LoadResources(id, isDisplaySoon, onLoadFinish)); + } + + public void SetEnable(bool enable) + { + _root.SetActive(enable); + } + + private IEnumerator LoadResources(string id, bool isDisplaySoon, Action onLoadFinish) + { + _loadFileList.Add(GetBackGroundTexturePath(id, isFetch: false)); + _loadFileList.Add(GetCharacterPath(id, isFetch: false)); + _loadFileList.Add(GetCharacterMaskPath(id, isFetch: false)); + _loadFileList.Add(GetEffectPath(id, "1", isFetch: false)); + _loadFileList.Add(GetEffectPath(id, "2", isFetch: false)); + _loadFileList.AddRange(_spineDiaplay.GetLoadPath(GetSpineFileName(id), fetch: false)); + if (Data.Master.MyPageCustomBGMaster[id].IsBGCardShader) + { + _loadFileList.Add(GetBackGroundMaterialPath(id, isFetch: false)); + _loadFileList.Add(GetBackGroundMaskPath(id, isFetch: false)); + } + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadFileList, null)); + InitializeBG(id); + _character.material = Toolbox.ResourcesManager.LoadObject(GetCharacterPath(id, isFetch: true)) as Material; + _character.onRender = SetCharacterMaterial; + _spineDiaplay.Initialize(GetSpineFileName(id), _spineTexture, _spineCamera); + _spineTexture.enabled = false; + _spineDiaplay.gameObject.SetActive(value: false); + _spineDiaplay.gameObject.SetActive(value: true); + _character.material.mainTexture = _spineTexture.mainTexture; + _character.material.SetTexture("_MaskTex", Toolbox.ResourcesManager.LoadObject(GetCharacterMaskPath(id, isFetch: true)) as Texture); + yield return InitializeEffect(id); + CreateRenderTexture(); + SetMasterData(id); + if (isDisplaySoon) + { + Show(); + } + else + { + SetEnable(enable: false); + } + _spineCamera.enabled = true; + _myPageParticleCamera.enabled = true; + _customBGTexture.onRender = SetRenderFinalTexture; + onLoadFinish.Call(); + IsLoading = false; + } + + private void InitializeBG(string id) + { + MyPageCustomBGMasterData myPageCustomBGMasterData = Data.Master.MyPageCustomBGMaster[id]; + Texture mainTexture = Toolbox.ResourcesManager.LoadObject(GetBackGroundTexturePath(id, isFetch: true)) as Texture; + _bg.mainTexture = mainTexture; + if (myPageCustomBGMasterData.IsBGCardShader) + { + Material material = Toolbox.ResourcesManager.LoadObject(GetBackGroundMaterialPath(id, isFetch: true)) as Material; + Texture value = Toolbox.ResourcesManager.LoadObject(GetBackGroundMaskPath(id, isFetch: true)) as Texture; + material.SetTexture("_MainTex", _bg.mainTexture); + material.SetTexture("_MaskTex", value); + _bg.material = material; + } + } + + private void CreateRenderTexture() + { + if (!(_renderTexture != null)) + { + _renderTexture = new RenderTexture(2048, 1152, 16, RenderTextureFormat.ARGB32); + _renderTexture.name = "bgControl"; + _customBGCamera.targetTexture = _renderTexture; + _customBGTexture.mainTexture = _renderTexture; + UpdateUITextureSize(); + } + } + + private void UpdateUITextureSize() + { + Camera frontCamera = UIManager.GetInstance().FrontCamera; + _saveScreenWidth = frontCamera.pixelWidth; + _saveScreenHeight = frontCamera.pixelHeight; + Vector3 position = new Vector3(0f, 1f, 0f); + Vector3 position2 = new Vector3(1f, 0f, 0f); + Vector3 position3 = frontCamera.ViewportToWorldPoint(position); + Vector3 position4 = frontCamera.ViewportToWorldPoint(position2); + Vector3 vector = _customBGTexture.transform.InverseTransformPoint(position3); + Vector3 vector2 = _customBGTexture.transform.InverseTransformPoint(position4); + float num = frontCamera.pixelHeight; + float num2 = frontCamera.pixelWidth; + float num3 = num / num2; + if (num3 < 0.5625f) + { + float num4 = vector2.x - vector.x; + float num5 = num4 * 0.5625f; + _customBGTexture.width = (int)Math.Ceiling(num4); + _customBGTexture.height = (int)Math.Ceiling(num5); + } + else + { + float num6 = vector.y - vector2.y; + float num7 = num6 * 1.7777778f; + _customBGTexture.width = (int)Math.Ceiling(num7); + _customBGTexture.height = (int)Math.Ceiling(num6); + } + if (!string.IsNullOrEmpty(Id)) + { + MyPageCustomBGMasterData myPageCustomBGMasterData = Data.Master.MyPageCustomBGMaster[Id]; + _characterAspectFixRate = myPageCustomBGMasterData.Scale; + _characterAspectOffset = myPageCustomBGMasterData.Position; + if (num3 < 0.5625f) + { + float num8 = (0.5625f - num3) / 0.100961536f; + float num9 = myPageCustomBGMasterData.Scale2 - myPageCustomBGMasterData.Scale; + _characterAspectFixRate = num9 * num8 + myPageCustomBGMasterData.Scale; + _characterAspectOffset = (myPageCustomBGMasterData.Position2 - myPageCustomBGMasterData.Position) * num8 + myPageCustomBGMasterData.Position; + } + if (myPageCustomBGMasterData.IsFrontEffectAttachCharacter) + { + FixEffectPosition(); + } + } + if (!string.IsNullOrEmpty(Id)) + { + SetMasterData(Id); + } + } + + private void FixEffectPosition() + { + if (string.IsNullOrEmpty(Id)) + { + return; + } + MyPageCustomBGMasterData myPageCustomBGMasterData = Data.Master.MyPageCustomBGMaster[Id]; + float num = 1f + (_characterAspectFixRate - myPageCustomBGMasterData.Scale); + _effectRoot.transform.localScale = new Vector3(num, num, 1f); + if (myPageCustomBGMasterData.IsFrontEffectAttachCharacter) + { + for (int i = 0; i < _frontEffectChild.Count; i++) + { + _effectPositionDecideObject.transform.localPosition = _frontEffectLocalPosition[i]; + _frontEffectChild[i].transform.localPosition = _frontEffect.transform.InverseTransformPoint(_effectPositionDecideObject.transform.position); + } + } + } + + private IEnumerator InitializeEffect(string id) + { + MyPageCustomBGMasterData myPageCustomBGMasterData = Data.Master.MyPageCustomBGMaster[id]; + GameObject effectCharacterFront = (_frontEffect = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(GetEffectPath(id, "1", isFetch: true))) as GameObject); + effectCharacterFront.transform.parent = (myPageCustomBGMasterData.IsFrontEffectAttachCharacter ? _effectRoot.transform : _effectRootBG.transform); + effectCharacterFront.SetLayer(28, isSetChildren: true); + effectCharacterFront.transform.localPosition = new Vector3(0f, 0f, -6f); + effectCharacterFront.transform.localScale = Vector3.one * 320f; + if (myPageCustomBGMasterData.IsFrontEffectAttachCharacter) + { + Vector3 localPosition = _character.transform.localPosition; + Vector3 localScale = _character.transform.localScale; + _character.transform.localPosition = myPageCustomBGMasterData.Position; + _character.transform.localScale = new Vector3(myPageCustomBGMasterData.Scale, myPageCustomBGMasterData.Scale, 1f); + for (int i = 0; i < effectCharacterFront.transform.childCount; i++) + { + Transform child = effectCharacterFront.transform.GetChild(i); + _effectPositionDecideObject.transform.position = child.position; + _frontEffectChild.Add(child.gameObject); + _frontEffectLocalPosition.Add(_effectPositionDecideObject.transform.localPosition); + } + _character.transform.localPosition = localPosition; + _character.transform.localScale = localScale; + } + GameObject effectCharacterBack = (_backEffect = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(GetEffectPath(id, "2", isFetch: true))) as GameObject); + effectCharacterBack.transform.parent = (myPageCustomBGMasterData.IsBackEffectAttachCharacter ? _effectRoot.transform : _effectRootBG.transform); + effectCharacterBack.SetLayer(28, isSetChildren: true); + effectCharacterBack.transform.localPosition = new Vector3(0f, 0f, 7f); + effectCharacterBack.transform.localScale = Vector3.one * 320f; + Renderer[] componentsInChildren = effectCharacterBack.GetComponentsInChildren(); + foreach (Renderer obj in componentsInChildren) + { + obj.sortingLayerName = "Default"; + obj.sortingOrder = 15; + } + bool isLoading = true; + bool isLoading2 = true; + _loadFileList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(effectCharacterBack, delegate + { + isLoading = false; + })); + _loadFileList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(effectCharacterFront, delegate + { + isLoading2 = false; + })); + while (isLoading || isLoading2) + { + yield return null; + } + effectCharacterFront.SetActive(value: true); + effectCharacterBack.SetActive(value: true); + } + + private void OnDestroy() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadFileList); + _loadFileList.Clear(); + if (_renderTexture != null) + { + _renderTexture.Release(); + UnityEngine.Object.Destroy(_renderTexture); + _renderTexture = null; + } + } + + public void FadeOut() + { + _fadeOutTimer = 0.3f; + _isFadeOut = true; + } + + public void FadeoutStandby() + { + _spineRoot.transform.localPosition += FADE_DESTROY_OFFSET; + _root.transform.localPosition += FADE_DESTROY_OFFSET; + _isFadeOutStandbyCalled = true; + _panel.Refresh(); + } + + public void FadeOutDestroy() + { + if (!_isFadeOutStandbyCalled) + { + FadeoutStandby(); + } + _fadeOutTimer = 0.3f; + _isFadeOut = true; + _isFadeOutDestroy = true; + } + + public void Show(Action onFadeFinish = null) + { + SetEnable(enable: true); + _fadeOutTimer = 0.3f; + _customBGTexture.alpha = 0f; + _isFadeOut = false; + _character.gameObject.SetActive(value: true); + _onFadeFinish = onFadeFinish; + ShowSpecialResetShader(); + } + + public void ShowSpecialResetShader() + { + if (IsSpecialMypageShader(_character.material)) + { + _startShowTime = Time.time; + SetSpecialResetShaderParameter(); + ResetEffect(_frontEffect); + ResetEffect(_backEffect); + } + } + + public void SetSpecialResetShaderParameter() + { + if (IsSpecialMypageShader(_character.material)) + { + _character.material.SetFloat("_SceneTime", Time.time - _startShowTime); + _character.gameObject.SetActive(value: false); + _character.gameObject.SetActive(value: true); + } + } + + private void ResetEffect(GameObject effect) + { + if (!(effect == null)) + { + effect.SetActive(value: false); + ParticleSystem component = effect.GetComponent(); + component.Stop(withChildren: true); + component.Play(withChildren: true); + effect.SetActive(value: true); + } + } + + private bool IsSpecialMypageShader(Material material) + { + return material.shader.name.Contains("VariantMypage"); + } + + private void SetMasterData(string id) + { + MyPageCustomBGMasterData myPageCustomBGMasterData = Data.Master.MyPageCustomBGMaster[id]; + _character.transform.localPosition = _characterAspectOffset; + Vector3 localScale = new Vector3(_characterAspectFixRate, _characterAspectFixRate, 1f); + _character.transform.localScale = localScale; + _spineTexture.transform.localPosition = myPageCustomBGMasterData.Position; + _spineTexture.transform.localScale = new Vector3(myPageCustomBGMasterData.Scale, myPageCustomBGMasterData.Scale, 1f); + _spineCamera.orthographicSize = myPageCustomBGMasterData.SpineCameraSize; + FixEffectPosition(); + } + + private void SetCharacterMaterial(Material material) + { + material.SetFloat("_SleeveSrcFactor", 5f); + material.SetFloat("_SleeveDstFactor", 10f); + if (!string.IsNullOrEmpty(Id)) + { + MyPageCustomBGMasterData myPageCustomBGMasterData = Data.Master.MyPageCustomBGMaster[Id]; + material.SetFloat("_MypageBoundaryAlpha", myPageCustomBGMasterData.ShaderAlphaBorder); + material.SetFloat("_MypageDivisionValue", myPageCustomBGMasterData.ShaderAlphaDevide); + } + } + + private void SetRenderFinalTexture(Material material) + { + material.shader = ((_fadeOutTimer > 0f) ? _fadeoutShader : _normalShader); + } + + private void CheckScreenSizeChange() + { + if (UIManager.GetInstance().FrontCameraPixelWidth != _saveScreenWidth || UIManager.GetInstance().FrontCameraPixelHeight != _saveScreenHeight) + { + UpdateUITextureSize(); + } + } + + private void Update() + { + CheckScreenSizeChange(); + if (_customBGTexture.alpha > 0.01f) + { + SetSpecialResetShaderParameter(); + } + if (_fadeOutTimer <= 0f || IsLoading) + { + return; + } + _fadeOutTimer -= Time.deltaTime; + if (_fadeOutTimer <= 0f) + { + _fadeOutTimer = 0f; + _onFadeFinish.Call(); + _onFadeFinish = null; + if (_isFadeOutDestroy) + { + UnityEngine.Object.Destroy(base.gameObject); + return; + } + } + float num = _fadeOutTimer / 0.3f; + float num2 = num; + if (!_isFadeOut) + { + num2 = 1f - num; + } + _customBGTexture.alpha = num2; + if ((num2 < 0.01f) & _isFadeOut) + { + _character.gameObject.SetActive(value: false); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageDetail.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageDetail.cs new file mode 100644 index 0000000..fd10963 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageDetail.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Wizard.Lottery; + +namespace Wizard; + +public class MyPageDetail +{ + public enum BGType + { + Deck, + CustomBG, + RandomBG + } + + public int unread_mail_count; + + public int last_announce_id; + + public DateTime last_announce_time; + + public int unreceived_mission_reward_count; + + public LotteryLoadTaskData _lotteryData = new LotteryLoadTaskData(); + + public List _bannerList; + + public List _subBannerInfoList; + + public bool _isJoinConvention; + + public bool _isAdminWatcher; + + public string _conventionBattleStartTime; + + public bool IsExistUnfinishedBattle { get; set; } + + public bool IsExistUnfinishedRoom { get; set; } + + public int BattleFinishWaitTime { get; set; } + + public float SinceTime { get; set; } + + public double ServerUnixTime { get; set; } + + public MyPageHomeDialogData MyPageHomeDialogData { get; set; } = new MyPageHomeDialogData(); + + public bool IsChallangeMissionEnable { get; set; } + + public RoomNonPossessionCardCampaign RoomNonPossessionCardCampaign { get; set; } + + public bool IsPracticePuzzleBadgeEnable { get; set; } + + public bool CanGiveDailyLoginBonus { get; set; } + + public MyPageBGInfo BGInfo { get; set; } = new MyPageBGInfo(); + + public SpeedChallengeInfo SpeedChallengeInfo { get; set; } + + public bool IsRoomNonPossessionCardCampaign() + { + if (RoomNonPossessionCardCampaign == null) + { + return false; + } + double nowUnixTime = GetNowUnixTime(); + if (nowUnixTime < RoomNonPossessionCardCampaign.StartUnixTime || nowUnixTime >= RoomNonPossessionCardCampaign.EndUnixTime) + { + return false; + } + return true; + } + + public int GetRoomNonPossessionCardCampaignRemainTimeSec() + { + return (int)RoomNonPossessionCardCampaign.EndUnixTime - (int)GetNowUnixTime(); + } + + private double GetNowUnixTime() + { + return ServerUnixTime + (double)Time.realtimeSinceStartup - (double)SinceTime; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageMaintenanceNotification.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageMaintenanceNotification.cs new file mode 100644 index 0000000..1e326c9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageMaintenanceNotification.cs @@ -0,0 +1,51 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class MyPageMaintenanceNotification : MonoBehaviour +{ + [SerializeField] + private NotificatonAnimation _notificationAnimationPrefab; + + private NotificatonAnimation _notificationAnimation; + + private bool _isShow; + + private const float WAIT_TIME = 0.5f; + + private void Awake() + { + _notificationAnimation = NGUITools.AddChild(base.gameObject, _notificationAnimationPrefab.gameObject).GetComponent(); + _isShow = false; + } + + private void Update() + { + if (_isShow && (UIManager.GetInstance().WebViewHelper.IsOpenWebViewDialog() || UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.MyPage)) + { + Object.Destroy(base.gameObject); + } + } + + public IEnumerator Show(List paramList) + { + int waitCount = 0; + while (UIManager.GetInstance().isFading() || UIManager.GetInstance().WebViewHelper.IsOpenWebViewDialog() || waitCount <= 0) + { + yield return new WaitForSeconds(0.5f); + int num = waitCount + 1; + waitCount = num; + } + _isShow = true; + yield return StartCoroutine(_notificationAnimation.Exec(paramList)); + _isShow = false; + Object.Destroy(base.gameObject); + } + + private void OnDisable() + { + Object.Destroy(base.gameObject); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageMyPageNotificationDetail.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageMyPageNotificationDetail.cs new file mode 100644 index 0000000..13a5fac --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageMyPageNotificationDetail.cs @@ -0,0 +1,58 @@ +using System; +using LitJson; +using UnityEngine; + +namespace Wizard; + +public class MyPageMyPageNotificationDetail +{ + public RoomRuleInfo RoomRule; + + public GatheringMyPageInfo GatheringMyPageInfo; + + public GuildNotification GuildNotification { get; set; } + + public CampaignBattleWin CampaignBattleWin { get; set; } + + public ShopNotification ShopNotification { get; set; } + + public StoryNotification StoryNotification { get; private set; } + + public QuestOpenInfo QuestOpenInfo { get; set; } + + public bool IsPracticePuzzleBadgeEnable { get; set; } + + public int ReceiveFriendApplyCount { get; set; } + + public bool IsCompetitionBadge { get; set; } + + public bool IsInviteGathering { get; set; } + + public bool IsColosseumFreeEntry { get; set; } + + public MyPageMyPageNotificationDetail() + { + GuildNotification = new GuildNotification(); + CampaignBattleWin = new CampaignBattleWin(); + RoomRule = new RoomRuleInfo(); + ShopNotification = new ShopNotification(); + StoryNotification = new StoryNotification(); + QuestOpenInfo = new QuestOpenInfo(); + GatheringMyPageInfo = new GatheringMyPageInfo(); + } + + public void SetIsCompetitionBadge(JsonData json) + { + if (json["data"]["competition_info"]["is_competition_period"].ToBoolean()) + { + bool flag = json["data"]["competition_info"]["is_received_featured_entry_reward"].ToBoolean(); + ArenaCompetition.EntryStatusType entryStatusType = (ArenaCompetition.EntryStatusType)json["data"]["competition_info"]["entry_status"].ToInt(); + double num = ConvertTime.DateTimeToUnixTime(DateTime.Parse(json["data"]["competition_info"]["entry_end_time"].ToString())); + float realtimeSinceStartup = Time.realtimeSinceStartup; + double num2 = json["data_headers"]["servertime"].ToDouble() + (double)Time.realtimeSinceStartup - (double)realtimeSinceStartup; + bool flag2 = num - num2 < 0.0; + bool flag3 = json["data"]["competition_info"].GetValueOrDefault("competition_id", 0) <= PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.COMPETITION_JOIN_BUTTON_LATEST_ID); + IsCompetitionBadge = !flag && entryStatusType == ArenaCompetition.EntryStatusType.NotEntry && !flag2 && !flag3; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageNotifications.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageNotifications.cs new file mode 100644 index 0000000..2dd7591 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageNotifications.cs @@ -0,0 +1,21 @@ +using LitJson; + +namespace Wizard; + +public class MyPageNotifications : HeaderData +{ + public MyPageMyPageNotificationDetail data = new MyPageMyPageNotificationDetail(); + + public void ParseBadgeInfos(JsonData jsonData) + { + data.QuestOpenInfo.SetIsDisplayBadge(jsonData["data"]["quest"]); + data.StoryNotification.SetIsDisplayBadge(jsonData["data"]["story_notification"]); + data.IsPracticePuzzleBadgeEnable = jsonData["data"]["basic_puzzle"]["is_display_badge"].ToBoolean(); + data.ShopNotification.SetShopBadgeEnable(jsonData); + data.ReceiveFriendApplyCount = jsonData["data"]["receive_friend_apply_count"].ToInt(); + data.SetIsCompetitionBadge(jsonData); + data.GatheringMyPageInfo.IsMatchingNotification = !string.IsNullOrEmpty(jsonData["data"]["gathering_info"].GetValueOrDefault("matching_established_message", string.Empty)); + data.IsInviteGathering = jsonData["data"]["gathering_info"]["has_invite"].ToInt() != 0; + data.IsColosseumFreeEntry = jsonData["data"]["is_available_colosseum_free_entry"].ToBoolean(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyRotationAbilityGroup.cs b/SVSim.BattleEngine/Engine/Wizard/MyRotationAbilityGroup.cs new file mode 100644 index 0000000..30e2407 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyRotationAbilityGroup.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class MyRotationAbilityGroup +{ + public List AbilityList; + + public int StartPackNumber { get; } + + public int LastPackNumber { get; } + + public string StartPackShortName { get; } + + public string LastPackShortName { get; } + + public MyRotationAbilityGroup(int startNumber, int lastNumber, string startPackShorName, string lastPackShortName, List list) + { + StartPackNumber = startNumber; + LastPackNumber = lastNumber; + StartPackShortName = startPackShorName; + LastPackShortName = lastPackShortName; + AbilityList = list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyRotationAllInfo.cs b/SVSim.BattleEngine/Engine/Wizard/MyRotationAllInfo.cs new file mode 100644 index 0000000..81c9c2d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyRotationAllInfo.cs @@ -0,0 +1,223 @@ +using System; +using System.Collections.Generic; +using LitJson; +using UnityEngine; + +namespace Wizard; + +public class MyRotationAllInfo +{ + public class PeriodData + { + public DateTime BeginTime = DateTime.MaxValue; + + public DateTime EndTime = DateTime.MinValue; + + public double StartUnixTime { get; set; } + + public double EndUnixTime { get; set; } + } + + private Dictionary _myRotationDictionary = new Dictionary(); + + public PeriodData GatheringPeriod = new PeriodData(); + + public PeriodData FreeMatchPeriod = new PeriodData(); + + private bool _myRotationScheduleExist; + + private float _receiveSinceTime; + + private double _receiveServerUnixTime; + + public List MyRotationInfoList { get; } = new List(); + + public MyRotationInfo FirstPackInfo { get; private set; } + + public MyRotationInfo FirstPackInfoNemesis { get; private set; } + + public List AbilityGroup { get; private set; } = new List(); + + public List DisableCardPackIdList { get; private set; } = new List(); + + public bool IsFinishInitializeText { get; private set; } + + public bool IsMyRotationEnable => IsWithinPeriod(FreeMatchPeriod); + + public bool IsWithinGatheringPeriod => IsWithinPeriod(GatheringPeriod); + + public bool IsWithinFreeMatchPeriod => IsWithinPeriod(FreeMatchPeriod); + + public bool IsWithinCopyDeckIntroductionPeriod => IsWithinFreeMatchPeriod; + + public void InitializeText() + { + IsFinishInitializeText = true; + int num = int.MaxValue; + int num2 = int.MaxValue; + foreach (MyRotationInfo myRotationInfo in MyRotationInfoList) + { + myRotationInfo.InitializeText(); + int num3 = int.Parse(myRotationInfo.LastPackId); + if (num3 < num) + { + num = num3; + FirstPackInfo = myRotationInfo; + } + if (myRotationInfo.IsEnableNemesis && num3 < num2) + { + num2 = num3; + FirstPackInfoNemesis = myRotationInfo; + } + } + InitializeAbilityGroup(); + InitializeRePrintCard(); + } + + private void InitializeRePrintCard() + { + CardMaster instance = CardMaster.GetInstance(FormatBehaviorManager.GetDefaultBehaviour(Format.MyRotation).CardMasterId); + List allCardIds = instance.GetAllCardIds(); + List list = new List(allCardIds.Count); + foreach (int item in allCardIds) + { + list.Add(instance.GetCardParameterFromId(item)); + } + foreach (MyRotationInfo myRotationInfo in MyRotationInfoList) + { + myRotationInfo.InitializeRePrintCard(list); + } + } + + public MyRotationInfo Get(string id) + { + if (string.IsNullOrEmpty(id)) + { + return null; + } + if (_myRotationDictionary.TryGetValue(id, out var value)) + { + return value; + } + return null; + } + + private void InitializeAbilityGroup() + { + if (MyRotationInfoList.Count == 0) + { + return; + } + MyRotationInfo myRotationInfo = MyRotationInfoList[0]; + MyRotationInfo lastPack = MyRotationInfoList[0]; + bool isFirst = true; + for (int i = 0; i < MyRotationInfoList.Count; i++) + { + MyRotationInfo myRotationInfo2 = MyRotationInfoList[i]; + if (!MyRotationInfo.IsEqualAbility(myRotationInfo, myRotationInfo2)) + { + AbilityGroup.Add(CreateGroup(myRotationInfo, lastPack, isFirst)); + isFirst = false; + myRotationInfo = (lastPack = myRotationInfo2); + } + else + { + lastPack = myRotationInfo2; + } + } + AbilityGroup.Add(CreateGroup(myRotationInfo, lastPack, isFirst)); + } + + private static MyRotationAbilityGroup CreateGroup(MyRotationInfo startPack, MyRotationInfo lastPack, bool isFirst) + { + int startNumber = int.Parse(startPack.LastPackId) - 10000; + int lastNumber = int.Parse(lastPack.LastPackId) - 10000; + string shortName = Data.Master.CardSetNameMgr.Get(startPack.LastPackId).ShortName; + string shortName2 = Data.Master.CardSetNameMgr.Get(lastPack.LastPackId).ShortName; + if (isFirst) + { + startNumber = int.Parse(startPack.FirstPackId) - 10000; + shortName = Data.Master.CardSetNameMgr.Get(startPack.FirstPackId).ShortName; + } + return new MyRotationAbilityGroup(startNumber, lastNumber, shortName, shortName2, startPack.Abilities); + } + + public void Parse(JsonData json, JsonData headerData) + { + JsonData jsonData = json["setting"]; + JsonData jsonData2 = json["restricted_base_card_id_list"]; + JsonData jsonData3 = json["abilities"]; + foreach (string key in jsonData.Keys) + { + MyRotationInfo myRotationInfo = new MyRotationInfo(jsonData[key]); + _myRotationDictionary[myRotationInfo.Id] = myRotationInfo; + MyRotationInfoList.Add(myRotationInfo); + } + if (jsonData2.IsObject) + { + foreach (string key2 in jsonData2.Keys) + { + _myRotationDictionary[key2].ParseRestrictJson(jsonData2[key2]); + } + } + JsonData jsonData4 = json["reprinted_base_card_ids"]; + if (jsonData4.IsObject) + { + foreach (string key3 in jsonData4.Keys) + { + _myRotationDictionary[key3].ParseRePrintJson(jsonData4[key3]); + } + } + if (jsonData3.IsObject) + { + foreach (MyRotationInfo myRotationInfo2 in MyRotationInfoList) + { + myRotationInfo2.ParseAbilitiesJson(jsonData3); + } + } + JsonData jsonData5 = json["schedules"]; + if (jsonData5.IsObject) + { + if (jsonData5.TryGetValue("gathering", out var value)) + { + SetPeriodData(GatheringPeriod, value); + } + if (jsonData5.TryGetValue("free_battle", out var value2)) + { + SetPeriodData(FreeMatchPeriod, value2); + _myRotationScheduleExist = true; + _receiveSinceTime = Time.realtimeSinceStartup; + _receiveServerUnixTime = headerData["servertime"].ToDouble(); + } + } + if (json.TryGetValue("disable_card_set_ids", out var value3)) + { + for (int i = 0; i < value3.Count; i++) + { + DisableCardPackIdList.Add(value3[i].ToString()); + } + } + } + + private void SetPeriodData(PeriodData period, JsonData jsonData) + { + period.BeginTime = DateTime.Parse(jsonData["begin_time"].ToString()); + period.EndTime = DateTime.Parse(jsonData["end_time"].ToString()); + period.StartUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(jsonData["begin_time"].ToString())); + period.EndUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(jsonData["end_time"].ToString())); + } + + private bool IsWithinPeriod(PeriodData period) + { + if (!_myRotationScheduleExist) + { + return false; + } + double num = _receiveServerUnixTime + (double)Time.realtimeSinceStartup - (double)_receiveSinceTime; + if (num >= period.EndUnixTime) + { + return false; + } + return num > period.StartUnixTime; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MypageReceiveSpecialTreasureTask.cs b/SVSim.BattleEngine/Engine/Wizard/MypageReceiveSpecialTreasureTask.cs new file mode 100644 index 0000000..142c7a8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MypageReceiveSpecialTreasureTask.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class MypageReceiveSpecialTreasureTask : BaseTask +{ + public class MypageReceiveSpecialTreasureTaskParam : BaseParam + { + } + + public class MypageTreasureBoxCpOpenTaskData + { + public List RewardDataList { get; private set; } + + public MypageTreasureBoxCpOpenTaskData(List rewardDataList) + { + RewardDataList = rewardDataList; + } + } + + public MypageTreasureBoxCpOpenTaskData Result { get; private set; } + + public MypageReceiveSpecialTreasureTask() + { + base.type = ApiType.Type.TreasureOpenSpecialTreasureBox; + } + + public void SetParameter() + { + MypageReceiveSpecialTreasureTaskParam mypageReceiveSpecialTreasureTaskParam = new MypageReceiveSpecialTreasureTaskParam(); + base.Params = mypageReceiveSpecialTreasureTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]["treasure_reward_list"]; + List list = new List(); + for (int i = 0; i < jsonData.Count; i++) + { + ReceivedReward item = ReceivedReward.CreateFromPackInfoResult(jsonData[i]); + list.Add(item); + } + Result = new MypageTreasureBoxCpOpenTaskData(list); + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MypageTreasureBoxCpOpenTask.cs b/SVSim.BattleEngine/Engine/Wizard/MypageTreasureBoxCpOpenTask.cs new file mode 100644 index 0000000..1df0ab6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MypageTreasureBoxCpOpenTask.cs @@ -0,0 +1,58 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class MypageTreasureBoxCpOpenTask : BaseTask +{ + public class MypageTreasureBoxCpOpenTaskParam : BaseParam + { + } + + public class MypageTreasureBoxCpOpenTaskData + { + public List RewardDataList { get; private set; } + + public int Grade { get; private set; } + + public MypageTreasureBoxCpOpenTaskData(List rewardDataList, int grade) + { + RewardDataList = rewardDataList; + Grade = grade; + } + } + + public MypageTreasureBoxCpOpenTaskData Result { get; private set; } + + public MypageTreasureBoxCpOpenTask() + { + base.type = ApiType.Type.ReceiveUpgradeTreasureBox; + } + + public void SetParameter() + { + MypageTreasureBoxCpOpenTaskParam mypageTreasureBoxCpOpenTaskParam = new MypageTreasureBoxCpOpenTaskParam(); + base.Params = mypageTreasureBoxCpOpenTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + JsonData jsonData2 = jsonData["upgrade_treasure_box_reward_list"]; + List list = new List(); + for (int i = 0; i < jsonData2.Count; i++) + { + ReceivedReward item = ReceivedReward.CreateFromPackInfoResult(jsonData2[i]); + list.Add(item); + } + int grade = jsonData["grade"].ToInt(); + Result = new MypageTreasureBoxCpOpenTaskData(list, grade); + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/NetworkSkill_spell_charge.cs b/SVSim.BattleEngine/Engine/Wizard/NetworkSkill_spell_charge.cs new file mode 100644 index 0000000..1183286 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/NetworkSkill_spell_charge.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +namespace Wizard; + +public class NetworkSkill_spell_charge : Skill_spell_charge +{ + public NetworkSkill_spell_charge(SkillParameter skillPrm, string option) + : base(skillPrm, option) + { + RegisterSkillEndEvent(); + } + + public override VfxWithLoading Start(CallParameter parameter) + { + VfxWithLoading result = base.Start(parameter); + base.SkillPrm.ownerCard.SelfBattlePlayer.CallOnSpellCharge(base.SkillPrm.ownerCard, _targetCards, _addList); + return result; + } + + private void RegisterSkillEndEvent() + { + if (GameMgr.GetIns().IsWatchBattle || GameMgr.GetIns().IsReplayBattle || (!base.SkillPrm.ownerCard.IsPlayer && RegisterFilter.IsFilterCard(this))) + { + return; + } + Func, SkillConditionCheckerOption, SkillProcessor, VfxBase> value = delegate(SkillBase localSkill, List localCards, SkillConditionCheckerOption checkerOption, SkillProcessor skillProcessor) + { + if (localCards.Count() > 0) + { + RegisterSpellboost data = new RegisterSpellboost(localCards, localSkill, base.AddCount, base.DiffAddCount); + (BattleManagerBase.GetIns() as NetworkBattleManagerBase).RegisterActionManager.Add(data); + } + return NullVfx.GetInstance(); + }; + base.OnSkillEnd -= value; + base.OnSkillEnd += value; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/NetworkUI.cs b/SVSim.BattleEngine/Engine/Wizard/NetworkUI.cs new file mode 100644 index 0000000..fdecc48 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/NetworkUI.cs @@ -0,0 +1,278 @@ +using Cute; +using Wizard.ErrorDialog; + +namespace Wizard; + +public class NetworkUI : INetworkUI +{ + private static NetworkUI instance; + + private DialogBase _errorDialog; + + private const int DEAPTH = 6000; + + private const int PC_ERROR_NEW_VERSION_AVAILABLE = 214; + + public bool keepLastRequest; + + public static NetworkUI GetInstance() + { + if (instance == null) + { + instance = new NetworkUI(); + } + return instance; + } + + public NetworkUI() + { + keepLastRequest = false; + } + + public bool IsKeepLastRequest() + { + return keepLastRequest; + } + + public void SetKeepLastRequest(bool flag) + { + keepLastRequest = flag; + } + + public void StartLoading(bool notEditor) + { + if (notEditor) + { + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true, notCollider: false, force: false); + } + else + { + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true, notCollider: false, force: false); + } + } + + public void StopLoading() + { + UIManager.GetInstance().closeInSceneCenterLoading(force: false); + } + + public string GetText(string code) + { + string text = ""; + text = Data.SystemText.Get(code); + if (string.IsNullOrEmpty(text)) + { + text = code; + } + return text; + } + + public void GoToMypage() + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.MyPage); + } + + public void SoftwareRest() + { + SoftwareReset.exec(); + } + + public void OpenRetryAndToTitleErrorPopUp(string title, string message, string errorCode) + { + if (!keepLastRequest) + { + keepLastRequest = true; + UIManager.GetInstance().closeInSceneCenterLoading(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true); + dialogBase.SetFadeButtonEnabled(flag: false); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetPanelDepth(6000); + dialogBase.SetTitleLabel(title); + dialogBase.SetText(message); + dialogBase.SetReturnMsg(Toolbox.NetworkManager.gameObject, "Retry", "ReturnToTitle"); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_GrayBtn); + dialogBase.SetButtonText(GetText("System_0012"), GetText("System_0006")); + dialogBase.ClickSe_Btn2 = Se.TYPE.SYS_BTN_CANCEL_TRANS; + dialogBase.SetVisibleContactButton(isVisible: true, errorCode); + dialogBase.OnClose = delegate + { + keepLastRequest = false; + }; + } + } + + public void OpenGoToMypageErrorPopUp(string title, string message, string errorCode) + { + if (!keepLastRequest) + { + keepLastRequest = true; + UIManager.GetInstance().closeInSceneCenterLoading(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true); + dialogBase.SetFadeButtonEnabled(flag: false); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetPanelDepth(6000); + dialogBase.SetTitleLabel((title == "") ? GetText("Error_0002") : title); + dialogBase.SetText((message == "") ? GetText("System_0011") : message); + dialogBase.SetReturnMsg(Toolbox.NetworkManager.gameObject, "GoToMypage"); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.GrayBtn); + dialogBase.SetButtonText(GetText("System_0010")); + dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_CANCEL_TRANS; + dialogBase.SetVisibleContactButton(isVisible: true, errorCode); + dialogBase.OnClose = delegate + { + keepLastRequest = false; + }; + _errorDialog = dialogBase; + } + } + + public void OpenGoToTitleErrorPopUp(string title, string message, string errorCode) + { + keepLastRequest = false; + UIManager.GetInstance().closeInSceneCenterLoading(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true); + dialogBase.SetFadeButtonEnabled(flag: false); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetPanelDepth(6000); + dialogBase.SetTitleLabel(title); + dialogBase.SetText(message); + dialogBase.SetReturnMsg(Toolbox.NetworkManager.gameObject, "ReturnToTitle"); + if (title == GetText("System_0022")) + { + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + } + else + { + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.GrayBtn); + dialogBase.SetButtonText(GetText("System_0006")); + dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_CANCEL_TRANS; + } + dialogBase.SetVisibleContactButton(isVisible: true, errorCode); + _errorDialog = dialogBase; + } + + public void OpenCloseOnlyErrorPopUp(int resultCode) + { + _errorDialog = Wizard.ErrorDialog.Dialog.Create(resultCode); + } + + public void OpenAccountBlockErrorPopUp(int resultCode) + { + _errorDialog = Wizard.ErrorDialog.Dialog.Create(resultCode); + } + + public void OpenAccountLimitedBlockErrorPopUp(int resultCode, string endTimeText) + { + SystemText systemText = Data.SystemText; + Wizard.ErrorDialog.Data data = Wizard.ErrorDialog.Dialog.FindData(resultCode); + DialogBase dialogBase = Wizard.ErrorDialog.Dialog.Create(resultCode); + dialogBase.SetText(systemText.Get(data.BodyId, ConvertTime.ToLocal(endTimeText))); + _errorDialog = dialogBase; + } + + public void OpenOtherServerErrorPopUp(int resultCode) + { + _errorDialog = Wizard.ErrorDialog.Dialog.Create(resultCode); + } + + public void OpenGotoStoreErrorPopup() + { + _errorDialog = Wizard.ErrorDialog.Dialog.Create(214); + } + + public void OpenRetryFailErrorPopup() + { + keepLastRequest = false; + UIManager.GetInstance().CreatFadeOpen(); + UIManager.GetInstance().closeInSceneCenterLoading(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetFadeButtonEnabled(flag: false); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetPanelDepth(6000); + dialogBase.SetTitleLabel(GetText("Error_0002")); + dialogBase.SetText(GetText("System_0018")); + dialogBase.SetReturnMsg(Toolbox.NetworkManager.gameObject, "ReturnToTitle"); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.GrayBtn); + dialogBase.SetButtonText(GetText("System_0006")); + dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_CANCEL_TRANS; + _errorDialog = dialogBase; + } + + public void OpenTimeOutErrorPopUp() + { + _errorDialog = Wizard.ErrorDialog.Dialog.Create("TIMEOUT"); + } + + public void OpenHttpStatusErrorPopUp() + { + _errorDialog = Wizard.ErrorDialog.Dialog.Create("COMMUNICATION"); + } + + public void OpenResourceVersionUpPopUp() + { + _errorDialog = Wizard.ErrorDialog.Dialog.Create("RES_VERSION_UP"); + } + + public void OpenSessionErrorPopUp() + { + _errorDialog = Wizard.ErrorDialog.Dialog.Create(201); + } + + public bool isCloseDialogGroupError(int resultCode) + { + return NetworkDefine.IsCloseOnlyDialogError(resultCode); + } + + public void OpenAllMaintenancePopUp(int resultCode, string endTime) + { + SystemText systemText = Data.SystemText; + if (string.IsNullOrEmpty(endTime)) + { + Wizard.ErrorDialog.Data data = Wizard.ErrorDialog.Dialog.FindData("URGENCY_MAINTENANCE"); + DialogBase dialogBase = Wizard.ErrorDialog.Dialog.Create("URGENCY_MAINTENANCE"); + dialogBase.SetText(systemText.Get(data.BodyId, systemText.Get("Common_0118"))); + _errorDialog = dialogBase; + } + else + { + Wizard.ErrorDialog.Data data2 = Wizard.ErrorDialog.Dialog.FindData(resultCode); + DialogBase dialogBase2 = Wizard.ErrorDialog.Dialog.Create(resultCode); + dialogBase2.SetText(systemText.Get(data2.BodyId, ConvertTime.ToLocal(endTime))); + _errorDialog = dialogBase2; + } + } + + public void OpenStrictServerErrorPopUp(int resultCode) + { + _errorDialog = Wizard.ErrorDialog.Dialog.Create(resultCode); + } + + public void OpenEachFunctionMaintenancePopUp(int resultCode) + { + _errorDialog = Wizard.ErrorDialog.Dialog.Create(resultCode); + } + + public void OpenSocialServiceNoResponseErrorPopup() + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = Wizard.ErrorDialog.Dialog.Create("SOCIAL_SERVICE_NO_RESPONSE"); + string socialServiceName = SocialServiceUtility.GetSocialServiceName(); + Wizard.ErrorDialog.Data data = Wizard.ErrorDialog.Dialog.FindData("SOCIAL_SERVICE_NO_RESPONSE"); + dialogBase.SetText(systemText.Get(data.BodyId, socialServiceName)); + _errorDialog = dialogBase; + } + + public bool IsOpenErrorDialog() + { + return _errorDialog != null; + } + + public void CloseErrorDialog() + { + if (_errorDialog != null) + { + _errorDialog.Close(); + } + _errorDialog = null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/OptionSettingWindow.cs b/SVSim.BattleEngine/Engine/Wizard/OptionSettingWindow.cs new file mode 100644 index 0000000..9fe7ff9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/OptionSettingWindow.cs @@ -0,0 +1,1232 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.Battle.View.Vfx; +using Wizard.Dialog.Setting; + +namespace Wizard; + +public class OptionSettingWindow : SettingBase +{ + private enum Category + { + SOUND_VISUAL, + BATTLE, + STAGE, + OTHER + } + + public enum Shortcut + { + Off, + RightClick, + DoubleClick, + MiddleClick + } + + public enum ShortcutDetail + { + RightClick, + MiddleClick, + LongPress, + Auto, + DoubleClick + } + + [SerializeField] + private GameObject _soundVisualRoot; + + [SerializeField] + private GameObject _battleRoot; + + [SerializeField] + private GameObject _stageRoot; + + [SerializeField] + private GameObject _otherRoot; + + [SerializeField] + private UIButton _buttonSoundVisualForBattleScene; + + [SerializeField] + private UIButton _buttonBattleForBattleScene; + + [SerializeField] + private UIButton _buttonSoundVisualForRoomScene; + + [SerializeField] + private UIButton _buttonBattleForRoomScene; + + [SerializeField] + private UIButton _buttonOtherForRoomScene; + + [SerializeField] + private UIButton _buttonSoundVisual; + + [SerializeField] + private UIButton _buttonBattle; + + [SerializeField] + private UIButton _buttonStage; + + [SerializeField] + private UIButton _buttonOther; + + [SerializeField] + private GameObject _battleSceneRoot; + + [SerializeField] + private GameObject _normalSceneRoot; + + [SerializeField] + private GameObject _roomSceneRoot; + + [SerializeField] + private BattleStageChoiceWindow _activeStageSelectWindow; + + private Category _currentCategory; + + private readonly List _resolutions = new List + { + "1024ร—768", "1280ร—720", "1280ร—800", "1280ร—960", "1360ร—768", "1600ร—900", "1600ร—1200", "1680ร—1050", "1920ร—1080", "1920ร—1200", + "2560ร—1440", "3840ร—2160" + }; + + private const int RES_MAX_WIDTH = 3840; + + private float _wantedScreenWidth = Screen.width; + + private float _wantedScreenHeight = Screen.height; + + private static List _battleDetailSizes = new List { "100%", "90%", "80%", "70%", "60%", "50%" }; + + private static Shortcut? _shortcutPlay; + + private static Shortcut? _shortcutEvolution; + + private static ShortcutDetail? _shortcutDetail; + + private List _mouseShortcuts = new List { "OtherConfig_0042", "OtherConfig_0043", "OtherConfig_0044", "OtherConfig_0052" }; + + private List _mouseShortcutsDetail = new List { "OtherConfig_0043", "OtherConfig_0052", "OtherConfig_0053", "OtherConfig_0054" }; + + private bool _startInvitationFriendRoom; + + private bool _startInvitationInBattle; + + private bool _startInvitationInOffline; + + private bool _startReceivedFriendApply; + + private const float STAGE_SELECT_LABEL_POSITION_X = -5f; + + private const float STAGE_SELECT_SPRITE_POSITION_X = 205f; + + public static Shortcut ShortcutPlay + { + get + { + if (!_shortcutPlay.HasValue) + { + _shortcutPlay = (Shortcut)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.MOUSE_SHORTCUT_PLAY); + } + return _shortcutPlay.Value; + } + private set + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.MOUSE_SHORTCUT_PLAY, (int)value); + _shortcutPlay = value; + } + } + + public static Shortcut ShortcutEvolution + { + get + { + if (!_shortcutEvolution.HasValue) + { + _shortcutEvolution = (Shortcut)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.MOUSE_SHORTCUT_EVOLUTION); + } + return _shortcutEvolution.Value; + } + private set + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.MOUSE_SHORTCUT_EVOLUTION, (int)value); + _shortcutEvolution = value; + } + } + + public static ShortcutDetail ShortcutDetailPanel + { + get + { + if (!_shortcutDetail.HasValue) + { + _shortcutDetail = (ShortcutDetail)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.MOUSE_SHORTCUT_DETAIL); + } + return _shortcutDetail.Value; + } + private set + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.MOUSE_SHORTCUT_DETAIL, (int)value); + _shortcutDetail = value; + } + } + + private UIButton BattleButton + { + get + { + if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Battle) + { + return _buttonBattleForBattleScene; + } + if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Room) + { + return _buttonBattleForRoomScene; + } + return _buttonBattle; + } + } + + private UIButton StageButton => _buttonStage; + + private UIButton SoundVisualButton + { + get + { + if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Battle) + { + return _buttonSoundVisualForBattleScene; + } + if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Room) + { + return _buttonSoundVisualForRoomScene; + } + return _buttonSoundVisual; + } + } + + private UIButton OtherButton + { + get + { + if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Room) + { + return _buttonOtherForRoomScene; + } + return _buttonOther; + } + } + + public override void Create() + { + base.Create(); + CreateSoundItem(); + CreateBattleItem(); + CreateStageItem(); + CreateOtherItem(); + ChangeCategory(Category.SOUND_VISUAL, playSE: false); + SoundVisualButton.onClick.Add(new EventDelegate(delegate + { + ChangeCategory(Category.SOUND_VISUAL, playSE: true); + })); + BattleButton.onClick.Add(new EventDelegate(delegate + { + ChangeCategory(Category.BATTLE, playSE: true); + })); + StageButton.onClick.Add(new EventDelegate(delegate + { + ChangeCategory(Category.STAGE, playSE: true); + })); + OtherButton.onClick.Add(new EventDelegate(delegate + { + ChangeCategory(Category.OTHER, playSE: true); + })); + bool num = UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Battle; + _battleSceneRoot.SetActive(value: false); + _normalSceneRoot.SetActive(value: false); + _roomSceneRoot.SetActive(value: false); + if (num) + { + _battleSceneRoot.SetActive(value: true); + } + else if (UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Room) + { + _roomSceneRoot.SetActive(value: true); + } + else + { + _normalSceneRoot.SetActive(value: true); + } + _startInvitationFriendRoom = Data.Load.data._userConfig.ReceivedInvite; + _startInvitationInBattle = Data.Load.data._userConfig.ReceivedInviteInBattle; + _startInvitationInOffline = Data.Load.data._userConfig.ReceivedInviteInOffline; + _startReceivedFriendApply = Data.Load.data._userConfig.ReceivedFriendApply; + } + + private void CreateSoundItem() + { + CreateSoundItem(_soundVisualRoot); + CreateToggle_PlayMusicInBackground(isDispSeparatorLine: true); + CreateSelectResolution(isDispSeparatorLine: true); + CreateToggle_Fullscreen(isDispSeparatorLine: true); + CreateSelect_Fps(isDispSeparatorLine: true); + bool isDispSeparatorLine = false; + CreateToggle_MovieSubtitles(isDispSeparatorLine, _soundVisualRoot); + } + + private void CreateBattleItem() + { + bool flag = UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.Battle; + bool flag2 = !flag; + bool flag3 = UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.Room; + CreateBattleDetailPanelSize(isDispSeparatorLine: true); + CreateToggleBattleLightEffect(isDispSeparatorLine: true); + if (flag) + { + CreateToggle_FoilCardAnimation(isDispSeparatorLine: true); + } + CreateToggle_LeaderAnimation(isDispSeparatorLine: true); + if (flag) + { + CreateToggle_OpponentShowDefaultSkin(isDispSeparatorLine: true); + } + CreateToggle_TurnEndConfirm(isDispSeparatorLine: true); + bool flag4 = Data.MyPageNotifications.data.RoomRule.NormalRuleFormatList.Contains(Format.Avatar); + if ((Data.CurrentFormat == Format.Avatar && flag2) || (flag4 && flag)) + { + CreateToggle_TurnEndWithoutUsingHeroSkillConfirm(isDispSeparatorLine: true); + } + CreateToggle_EvolveConfirm(isDispSeparatorLine: true); + CreateToggle_FusionCardPlayConfirm(isDispSeparatorLine: true); + CreateToggle_FixedUseCostInfo(isDispSeparatorLine: true); + CreateToggle_ShowSideLog(isDispSeparatorLine: true); + CreateToggle_OpponentMessageDisplay(isDispSeparatorLine: true); + if (flag && flag3) + { + CreateToggle_Wss(isDispSeparatorLine: true); + CreateToggle_Ipv6(isDispSeparatorLine: true); + } + CreateMouseControl(isDispSeparatorLine: true); + CreateMouseShortcutPlay(isDispSeparatorLine: false); + CreateMouseShortcutEvolution(isDispSeparatorLine: false); + CreateMouseShortcutDetail(isDispSeparatorLine: false); + if (Prediction._isFeatureEnabled) + { + CreateToggle_PredictionIconDisplay(isDispSeparatorLine: true); + } + } + + private void CreateStageItem() + { + CreateToggleUseSimpleRoom(isDispSeparatorLine: true); + CreateToggle_UseStageSwitch(isDispSeparatorLine: true); + CreateButtonBattleStageSelect(isDispSeparatorLine: true); + UpdateStageSettingView(); + } + + private ItemToggle CreateToggleUseSimpleRoom(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.SIMPLE_STAGE, isDispSeparatorLine, _stageRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0022")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SIMPLE_STAGE)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SIMPLE_STAGE, item.GetValue()); + UpdateStageSettingView(); + }); + return item; + } + + private ItemToggle CreateToggle_UseStageSwitch(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.USE_STAGE_SELECT, isDispSeparatorLine, _stageRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0078")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.USE_OFF_STAGE)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.USE_OFF_STAGE, item.GetValue()); + bool toGrey = !item.GetValue(); + if ((FindItem(ID.SIMPLE_STAGE) as ItemToggle).GetValue()) + { + toGrey = true; + } + (FindItem(ID.STAGE_SELECT) as ItemButton).SetToGrey(toGrey); + }); + return item; + } + + private ItemButton CreateButtonBattleStageSelect(bool isDispSeparatorLine) + { + ItemButton itemButton = CreateButton(ID.STAGE_SELECT, isDispSeparatorLine, _stageRoot); + itemButton.SetSpriteName("btn_common_02_m_off", isMakePixelPerfect: true, isCollisionResize: true); + itemButton.SetSpriteNameOnPress("btn_common_02_m_on"); + itemButton.SetLabelPos(new Vector3(-5f, 0f, 0f)); + itemButton.SetSpritePos(new Vector3(205f, 0f, 0f)); + SystemText systemText = Data.SystemText; + itemButton.SetValue(systemText.Get("Dia_StageChoice_001")); + itemButton.SetSubLabelPos(new Vector3(-180f, 0f, 0f)); + itemButton.SetSubLabelText(systemText.Get("OtherConfig_0075")); + itemButton.AddChangeCallback(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + CreateStageChoiceWindow(); + }); + return itemButton; + } + + private void UpdateStageSettingView() + { + ItemToggle itemToggle = FindItem(ID.SIMPLE_STAGE) as ItemToggle; + if (itemToggle != null) + { + bool flag = itemToggle.GetValue(); + ItemToggle obj = FindItem(ID.USE_STAGE_SELECT) as ItemToggle; + obj.SetLabelLooks(!flag); + obj.SetToggleLooks(!flag); + if (!obj.GetValue()) + { + flag = true; + } + (FindItem(ID.STAGE_SELECT) as ItemButton).SetToGrey(flag); + } + } + + private void CreateStageChoiceWindow() + { + BattleStageChoiceWindow stageChoice = UnityEngine.Object.Instantiate(_activeStageSelectWindow); + StartCoroutine(stageChoice.LoadResource(delegate + { + SystemText systemText = Data.SystemText; + DialogBase stageSelectDialog = UIManager.GetInstance().CreateDialogClose(); + stageSelectDialog.SetSize(DialogBase.Size.XL); + bool isAllOff = false; + BattleStageChoiceWindow battleStageChoiceWindow = stageChoice; + battleStageChoiceWindow.OnAllOff = (Action)Delegate.Combine(battleStageChoiceWindow.OnAllOff, (Action)delegate(bool alloff) + { + isAllOff = alloff; + stageSelectDialog.SetButtonDisable(alloff); + }); + stageChoice.Initialize(); + stageSelectDialog.SetObj(stageChoice.gameObject); + stageSelectDialog.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + stageSelectDialog.SetTitleLabel(systemText.Get("Dia_StageChoice_001")); + _dialogObject.gameObject.SetActive(value: false); + _dialogObject.backView.SetActive(value: false); + DialogBase dialogBase = stageSelectDialog; + dialogBase.onPushButton1 = (Action)Delegate.Combine(dialogBase.onPushButton1, (Action)delegate + { + stageChoice.SaveSetting(); + }); + DialogBase dialogBase2 = stageSelectDialog; + dialogBase2.OnClose = (Action)Delegate.Combine(dialogBase2.OnClose, (Action)delegate + { + _dialogObject.gameObject.SetActive(value: true); + _dialogObject.backView.SetActive(value: true); + }); + })); + } + + private ItemToggle CreateToggle_UseCollaborationSound(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.COLLABORATION_SOUND, isDispSeparatorLine, _stageRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0077")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.COLLABORATION_SOUND)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.COLLABORATION_SOUND, item.GetValue()); + }); + return item; + } + + private void CreateOtherItem() + { + bool num = UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.Battle; + bool flag = UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.Room; + if (num && flag) + { + CreateToggle_PurchaseAlert(isDispSeparatorLine: true); + } + if (num) + { + CreateToggle_InvitationFriendRoom(isDispSeparatorLine: true); + CreateToggle_InvitationInBattle(isDispSeparatorLine: true); + CreateToggleReceivedFriendApply(isDispSeparatorLine: true); + } + CreateToggleShowBattlePassResult(isDispSeparatorLine: true); + CreateSelect_ShowQrCode(isDispSeparatorLine: false); + } + + protected override void OnDestroy() + { + base.OnDestroy(); + if (_startInvitationFriendRoom != Data.Load.data._userConfig.ReceivedInvite || _startInvitationInBattle != Data.Load.data._userConfig.ReceivedInviteInBattle || _startInvitationInOffline != Data.Load.data._userConfig.ReceivedInviteInOffline || _startReceivedFriendApply != Data.Load.data._userConfig.ReceivedFriendApply) + { + InviteConfigUpdateTask inviteConfigUpdateTask = new InviteConfigUpdateTask(); + inviteConfigUpdateTask.SetParameter(Data.Load.data._userConfig.ReceivedInvite, Data.Load.data._userConfig.ReceivedInviteInBattle, Data.Load.data._userConfig.ReceivedInviteInOffline, Data.Load.data._userConfig.ReceivedFriendApply); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(inviteConfigUpdateTask)); + } + } + + private void ChangeCategory(Category category, bool playSE) + { + if (playSE && category != _currentCategory) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + } + _currentCategory = category; + ResetScroll(); + _soundVisualRoot.gameObject.SetActive(category == Category.SOUND_VISUAL); + _battleRoot.gameObject.SetActive(category == Category.BATTLE); + _stageRoot.gameObject.SetActive(category == Category.STAGE); + _otherRoot.gameObject.SetActive(category == Category.OTHER); + RenameBtnSprite(SoundVisualButton, category == Category.SOUND_VISUAL); + RenameBtnSprite(BattleButton, category == Category.BATTLE); + RenameBtnSprite(StageButton, category == Category.STAGE); + RenameBtnSprite(OtherButton, category == Category.OTHER); + } + + private void RenameBtnSprite(UIButton button, bool isEnable) + { + button.normalSprite = RenameSpriteString(button.normalSprite, isEnable); + } + + private string RenameSpriteString(string str, bool isEnable) + { + string oldValue = (isEnable ? "_off" : "_on"); + string newValue = (isEnable ? "_on" : "_off"); + return str.Replace(oldValue, newValue); + } + + private ItemToggle CreateToggle_InvitationInBattle(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.INVITATION_IN_BATTLE, isDispSeparatorLine, _otherRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0038")); + item.SetValue(Data.Load.data._userConfig.ReceivedInviteInBattle); + item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS); + item.SetButtonEnable(isEnable: false); + item.AddChangeCallback(delegate + { + Data.Load.data._userConfig.ReceivedInviteInBattle = item.GetValue(); + }); + return item; + } + + private ItemToggle CreateToggleShowBattlePassResult(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.BATTLE_PASS_SHOW_RESULT, isDispSeparatorLine, _otherRoot); + item.SetTitleLabel(systemText.Get("BattlePass_0011")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.BATTLE_PASS_SHOW_RESULT)); + item.SetButtonEnable(isEnable: false); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.BATTLE_PASS_SHOW_RESULT, item.GetValue()); + }); + return item; + } + + private ItemToggle CreateToggle_InvitationInOffline(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.INVITATION_IN_OFFLINE, isDispSeparatorLine, _otherRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0039")); + item.SetValue(Data.Load.data._userConfig.ReceivedInviteInOffline); + item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS); + item.SetButtonEnable(isEnable: false); + item.AddChangeCallback(delegate + { + Data.Load.data._userConfig.ReceivedInviteInOffline = item.GetValue(); + }); + return item; + } + + private ItemToggle CreateToggleReceivedFriendApply(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.RECEIVED_FRIEND_APPLY, isDispSeparatorLine, _otherRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0068")); + item.SetValue(Data.Load.data._userConfig.ReceivedFriendApply); + item.AddChangeCallback(delegate + { + Data.Load.data._userConfig.ReceivedFriendApply = item.GetValue(); + }); + return item; + } + + private ItemToggle CreateToggle_PurchaseAlert(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.PURCHASE_ALERT, isDispSeparatorLine, _otherRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0065")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.PURCHASE_ALERT)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.PURCHASE_ALERT, item.GetValue()); + }); + return item; + } + + private ItemToggle CreateToggle_Wss(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.SELECT_WSS, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0060")); + bool isSetting = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SELECT_WSS); + item.SetValue(isSetting); + item.AddChangeCallback(delegate + { + if (isSetting != item.GetValue()) + { + isSetting = item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.IS_SELECT_WSS, item.GetValue()); + CustomPreference.SetOptionalNodeSceme(); + LocalLog.AccumulateSettingLog(); + } + }); + return item; + } + + private ItemToggle CreateToggle_Ipv6(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.SELECT_IPV6, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0083")); + bool isSetting = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SELECT_IPV6); + item.SetValue(isSetting); + item.AddChangeCallback(delegate + { + if (isSetting != item.GetValue()) + { + isSetting = item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.IS_SELECT_IPV6, item.GetValue()); + } + }); + return item; + } + + private ItemToggle CreateSelect_Fps(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.FPS, isDispSeparatorLine, _soundVisualRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0045")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.FRAMERATE)); + item.AddChangeCallback(delegate + { + bool value = item.GetValue(); + int frameRate = (Application.targetFrameRate = (value ? 60 : 30)); + Toolbox.QualityManager.SetFrameRate(frameRate); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.FRAMERATE, value); + }); + return item; + } + + private ItemToggle CreateSelect_ShowQrCode(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.QRCode, isDispSeparatorLine, _otherRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0081")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOWQRCODE)); + item.AddChangeCallback(delegate + { + bool value = item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOWQRCODE, value); + }); + return item; + } + + private ItemToggle CreateToggle_InvitationFriendRoom(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.INVITATION_FRIEND_ROOM, isDispSeparatorLine, _otherRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0037")); + item.SetValue(Data.Load.data._userConfig.ReceivedInvite); + item.AddChangeCallback(delegate + { + Data.Load.data._userConfig.ReceivedInvite = item.GetValue(); + SetRelationFriendRoomToggleLook(item); + }); + SetRelationFriendRoomToggleLook(item); + return item; + } + + private void SetRelationFriendRoomToggleLook(ItemToggle friendRoomToggle) + { + _SetItemToggleLooks(ID.INVITATION_IN_BATTLE, friendRoomToggle.GetValue()); + _SetItemToggleLooks(ID.INVITATION_IN_OFFLINE, friendRoomToggle.GetValue()); + } + + private ItemToggle CreateToggle_LeaderAnimation(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.LEADER_ANIMATION_DISPLAY, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0031")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION, item.GetValue()); + if (ToolboxGame.UIManager.IsCurrentScene(UIManager.ViewScene.Battle)) + { + bool isAnimation = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION); + BattleManagerBase.GetIns().VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + ((ClassBattleCardBase)BattleManagerBase.GetIns().BattlePlayer.Class).ClassBattleCardView.ClassCharacter.SetAnimationEnable(isAnimation); + ((ClassBattleCardBase)BattleManagerBase.GetIns().BattleEnemy.Class).ClassBattleCardView.ClassCharacter.SetAnimationEnable(isAnimation); + })); + } + }); + return item; + } + + private ItemToggle CreateToggleBattleLightEffect(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.BATTLE_EFFECT_DISPLAY, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0010")); + bool isSetting = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_BATTLE_EFFECT); + item.SetValue(isSetting); + item.AddChangeCallback(delegate + { + if (isSetting != item.GetValue()) + { + isSetting = item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_BATTLE_EFFECT, item.GetValue()); + LocalLog.AccumulateSettingLog(); + } + }); + return item; + } + + private ItemToggle CreateToggle_FoilCardAnimation(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.SHOW_FOIL_CARD_ANIMATION, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0067")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_FOIL_CARD_ANIMATION)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_FOIL_CARD_ANIMATION, item.GetValue()); + }); + return item; + } + + private ItemToggle CreateToggle_TurnEndConfirm(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.TURN_END_CONFIRM, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0004")); + bool isSetting = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.CONFIRM_TURN_END); + item.SetValue(isSetting); + item.AddChangeCallback(delegate + { + if (isSetting != item.GetValue()) + { + isSetting = item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.CONFIRM_TURN_END, item.GetValue()); + LocalLog.AccumulateSettingLog(); + } + }); + return item; + } + + private ItemToggle CreateToggle_TurnEndWithoutUsingHeroSkillConfirm(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.TURN_END_WITHOUT_USING_HERO_SKILL_CONFIRM, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0084")); + bool isSetting = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.CONFIRM_TURN_END_WITHOUT_USING_HERO_SKILL); + item.SetValue(isSetting); + item.AddChangeCallback(delegate + { + if (isSetting != item.GetValue()) + { + isSetting = item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.CONFIRM_TURN_END_WITHOUT_USING_HERO_SKILL, item.GetValue()); + } + }); + return item; + } + + private ItemToggle CreateToggle_EvolveConfirm(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.EVOLVE_CONFIRM, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0025")); + bool isSetting = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.CONFIRM_EVOLVE); + item.SetValue(isSetting); + item.AddChangeCallback(delegate + { + if (isSetting != item.GetValue()) + { + isSetting = item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.CONFIRM_EVOLVE, item.GetValue()); + LocalLog.AccumulateSettingLog(); + } + }); + return item; + } + + private ItemToggle CreateToggle_FusionCardPlayConfirm(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.SHOW_FUSION_CARD_PLAY_DIALOG, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0072")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_FUSION_CARD_PLAY_DIALOG)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_FUSION_CARD_PLAY_DIALOG, item.GetValue()); + }); + return item; + } + + private ItemToggle CreateToggle_FixedUseCostInfo(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.FIXEDUSE_COST_INFO, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0059")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.FIXEDUSE_COST_INFO)); + item.AddChangeCallback(delegate + { + if (item.GetValue() != PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.FIXEDUSE_COST_INFO)) + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.FIXEDUSE_COST_INFO, item.GetValue()); + BattleManagerBase ins = BattleManagerBase.GetIns(); + if (ins != null) + { + if (ins.BattlePlayer != null) + { + ins.BattlePlayer.ApplyFixedUseCostInfo(); + } + if (ins.BattleEnemy != null) + { + ins.BattleEnemy.ApplyFixedUseCostInfo(); + } + } + } + }); + return item; + } + + private ItemToggle CreateToggle_OpponentMessageDisplay(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.OPPONENT_MESSAGE_DISPLAY, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0005")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_OTHER_PLAYER_EMOTE)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_OTHER_PLAYER_EMOTE, item.GetValue()); + }); + return item; + } + + private ItemToggle CreateToggle_OpponentShowDefaultSkin(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.OPPONENT_SHOW_DEFAULT_SKIN, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0066")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_OPPONENT_DEFAULT_SKIN)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_OPPONENT_DEFAULT_SKIN, item.GetValue()); + }); + return item; + } + + private ItemToggle CreateToggle_ShowPanelAlways(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.SHOW_PANEL_ALWAYS, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0061")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_PANEL_ALWAYS)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_PANEL_ALWAYS, item.GetValue()); + BattleManagerBase ins = BattleManagerBase.GetIns(); + if (ins != null) + { + ClassInformationUIController classInformationUIController = ins.BattlePlayer.ClassInformationUIController; + ClassInformationUIController classInformationUIController2 = ins.BattleEnemy.ClassInformationUIController; + if (!ins.IsMulliganEnd && GameMgr.GetIns().IsNetworkBattle && !GameMgr.GetIns().IsAINetwork) + { + classInformationUIController.SetClassInformationUiPosition(isPlayer: true); + classInformationUIController2.SetClassInformationUiPosition(isPlayer: false); + } + else + { + ins.BattlePlayer.StatusPanelControl.ShowStatusPanelOnBattle(); + ins.BattleEnemy.StatusPanelControl.ShowStatusPanelOnBattle(); + classInformationUIController.UpdateStatusPanelOnBattle(isPlayer: true); + classInformationUIController2.UpdateStatusPanelOnBattle(isPlayer: false); + } + } + }); + return item; + } + + private ItemToggle CreateToggle_ShowSideLog(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.SHOW_SIDE_LOG, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0062")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_SIDE_LOG)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_SIDE_LOG, item.GetValue()); + }); + return item; + } + + private ItemToggle CreateToggle_PredictionIconDisplay(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.PREDICTION_ICONS_DISPLAY, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0028")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_PREDICTION_ICONS)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SHOW_PREDICTION_ICONS, item.GetValue()); + }); + return item; + } + + private ItemToggle CreateToggle_PlayMusicInBackground(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.PLAY_SOUND_IN_BG, isDispSeparatorLine, _soundVisualRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0036")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.PLAY_SOUND_IN_BACKGROUND)); + item.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.PLAY_SOUND_IN_BACKGROUND, item.GetValue()); + }); + return item; + } + + private ItemSelect CreateSelectResolution(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemSelect item = CreateSelect(ID.RESOLUTION, isDispSeparatorLine, _soundVisualRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0034")); + string[] array = _resolutions[0].Split('ร—'); + int num = int.Parse(array[0]); + int num2 = int.Parse(array[1]); + int num3 = num; + int num4 = num2; + Display[] displays = Display.displays; + foreach (Display display in displays) + { + if (display.systemWidth > display.systemHeight) + { + num3 = Mathf.Max(num3, display.systemWidth); + num4 = Mathf.Max(num4, display.systemHeight); + } + else + { + num3 = Mathf.Max(num3, display.systemWidth); + num4 = Mathf.Max(num4, display.systemWidth); + } + } + List list = new List(); + foreach (string resolution in _resolutions) + { + string[] array2 = resolution.Split('ร—'); + int num5 = int.Parse(array2[0]); + int num6 = int.Parse(array2[1]); + if (num5 <= num3 && num6 <= num4) + { + list.Add(resolution); + } + } + item.SetPossibleResolutionValues(list, resizeListSprite: true); + string resolutionValue = Screen.width + "ร—" + Screen.height; + item.SetResolutionValue(resolutionValue); + _wantedScreenWidth = Screen.width; + _wantedScreenHeight = Screen.height; + item.AddChangeCallback(delegate + { + string[] array3 = item.GetValue().Split('ร—'); + float num7 = int.Parse(array3[0]); + float num8 = int.Parse(array3[1]); + _wantedScreenWidth = num7; + _wantedScreenHeight = num8; + WindowResize.SetResolution((int)num7, (int)num8); + }); + return item; + } + + private ItemToggle CreateToggle_Fullscreen(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.FULLSCREEN, isDispSeparatorLine, _soundVisualRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0035")); + item.SetValue(Screen.fullScreen); + item.AddChangeCallback(delegate + { + bool value = item.GetValue(); + if (value != Screen.fullScreen) + { + Toolbox.QualityManager.ChangeResolution(Screen.width, Screen.height, value); + } + }); + return item; + } + + private ItemToggle CreateMouseControl(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.MOUSE_CONTROL, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0040")); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.MOUSE_CONTROL)); + item.AddChangeCallback(delegate + { + bool value = item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.MOUSE_CONTROL, value); + InputMgr.MouseControl = value; + (FindItem(ID.MOUSE_SHORTCUT_PLAY) as ItemSelect).SetToGrey(!value); + (FindItem(ID.MOUSE_SHORTCUT_EVOLUTION) as ItemSelect).SetToGrey(!value); + (FindItem(ID.MOUSE_SHORTCUT_DETAIL) as ItemSelect).SetToGrey(!value); + }); + return item; + } + + private ItemSelect CreateMouseShortcutPlay(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemSelect item = CreateSelect(ID.MOUSE_SHORTCUT_PLAY, isDispSeparatorLine, _battleRoot); + item._isOpenDirectionUp = true; + item.SetTitleLabel(systemText.Get("OtherConfig_0049")); + item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS); + SetShortcut(item); + item.SetValue(item.PossibleValues[(int)ShortcutPlay]); + item.AddChangeCallback(delegate + { + string value = item.GetValue(); + int num = 0; + for (num = 0; num < item.PossibleValues.Count && !(value == item.PossibleValues[num]); num++) + { + } + ShortcutPlay = (Shortcut)num; + ItemSelect shortcutDetail = FindItem(ID.MOUSE_SHORTCUT_DETAIL) as ItemSelect; + SetShortcutDetail(shortcutDetail); + }); + return item; + } + + private ItemSelect CreateMouseShortcutEvolution(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemSelect item = CreateSelect(ID.MOUSE_SHORTCUT_EVOLUTION, isDispSeparatorLine, _battleRoot); + item._isOpenDirectionUp = true; + item.SetTitleLabel(systemText.Get("OtherConfig_0050")); + item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS); + SetShortcut(item); + item.SetValue(item.PossibleValues[(int)ShortcutEvolution]); + item.AddChangeCallback(delegate + { + string value = item.GetValue(); + int num = 0; + for (num = 0; num < item.PossibleValues.Count && !(value == item.PossibleValues[num]); num++) + { + } + ShortcutEvolution = (Shortcut)num; + ItemSelect shortcutDetail = FindItem(ID.MOUSE_SHORTCUT_DETAIL) as ItemSelect; + SetShortcutDetail(shortcutDetail); + }); + return item; + } + + private ItemSelect CreateBattleDetailPanelSize(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemSelect item = CreateSelect(ID.BATTLE_DETAIL_PANEL_SIZE, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0055")); + item.SetPossibleValues(_battleDetailSizes, resizeListSprite: true); + item.SetValue(_battleDetailSizes[PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_DETAIL_PANEL_SIZE)]); + item.AddChangeCallback(delegate + { + string value = item.GetValue(); + int value2 = 0; + for (int i = 0; i < _battleDetailSizes.Count; i++) + { + value2 = i; + if (value == _battleDetailSizes[i]) + { + break; + } + } + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.BATTLE_DETAIL_PANEL_SIZE, value2); + UIManager instance = UIManager.GetInstance(); + if (instance != null && instance.GetCurrentScene() == UIManager.ViewScene.Battle && BattleManagerBase.GetIns() != null) + { + DetailMgr detailMgr = BattleManagerBase.GetIns().DetailMgr; + detailMgr.DetailPanelControl.SetSize(GetBattleDetailPanelSizePercent()); + detailMgr.SubDetailPanelControl.SetSize(GetBattleDetailPanelSizePercent()); + } + }); + return item; + } + + private ItemSelect CreateMouseShortcutDetail(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemSelect item = CreateSelect(ID.MOUSE_SHORTCUT_DETAIL, isDispSeparatorLine, _battleRoot); + item._isOpenDirectionUp = true; + item.SetTitleLabel(systemText.Get("OtherConfig_0051")); + item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS); + SetShortcutDetail(item); + item.SetValue(item.PossibleValues[(int)ShortcutDetailPanel]); + item.AddChangeCallback(delegate + { + string value = item.GetValue(); + int num = 0; + for (num = 0; num < item.PossibleValues.Count && !(value == item.PossibleValues[num]); num++) + { + } + ShortcutDetailPanel = (ShortcutDetail)num; + ItemSelect shortcut = FindItem(ID.MOUSE_SHORTCUT_PLAY) as ItemSelect; + SetShortcut(shortcut); + ItemSelect shortcut2 = FindItem(ID.MOUSE_SHORTCUT_EVOLUTION) as ItemSelect; + SetShortcut(shortcut2); + }); + return item; + } + + private void SetShortcut(ItemSelect item) + { + item.SetPossibleValues(_mouseShortcuts, resizeListSprite: true, (string t) => Data.SystemText.Get(t)); + if (ShortcutDetailPanel == ShortcutDetail.RightClick) + { + if (item.name == ID.MOUSE_SHORTCUT_PLAY.ToString() && ShortcutPlay == Shortcut.RightClick) + { + ShortcutPlay = Shortcut.Off; + item.SetValue(item.PossibleValues[0]); + } + else if (item.name == ID.MOUSE_SHORTCUT_EVOLUTION.ToString() && ShortcutEvolution == Shortcut.RightClick) + { + ShortcutEvolution = Shortcut.Off; + item.SetValue(item.PossibleValues[0]); + } + } + if (ShortcutDetailPanel == ShortcutDetail.MiddleClick) + { + if (item.name == ID.MOUSE_SHORTCUT_PLAY.ToString() && ShortcutPlay == Shortcut.MiddleClick) + { + ShortcutPlay = Shortcut.Off; + item.SetValue(item.PossibleValues[0]); + } + else if (item.name == ID.MOUSE_SHORTCUT_EVOLUTION.ToString() && ShortcutEvolution == Shortcut.MiddleClick) + { + ShortcutEvolution = Shortcut.Off; + item.SetValue(item.PossibleValues[0]); + } + } + if (ShortcutDetailPanel == ShortcutDetail.DoubleClick) + { + if (item.name == ID.MOUSE_SHORTCUT_PLAY.ToString() && ShortcutPlay == Shortcut.DoubleClick) + { + ShortcutPlay = Shortcut.Off; + item.SetValue(item.PossibleValues[0]); + } + else if (item.name == ID.MOUSE_SHORTCUT_EVOLUTION.ToString() && ShortcutEvolution == Shortcut.DoubleClick) + { + ShortcutEvolution = Shortcut.Off; + item.SetValue(item.PossibleValues[0]); + } + } + } + + private void SetShortcutDetail(ItemSelect item) + { + item.SetPossibleValues(_mouseShortcutsDetail, resizeListSprite: true, (string t) => Data.SystemText.Get(t)); + int index = item.PossibleValues.Count - 1; + if ((ShortcutPlay == Shortcut.RightClick || ShortcutEvolution == Shortcut.RightClick) && ShortcutDetailPanel == ShortcutDetail.RightClick) + { + ShortcutDetailPanel = ShortcutDetail.Auto; + item.SetValue(item.PossibleValues[index]); + } + if ((ShortcutPlay == Shortcut.MiddleClick || ShortcutEvolution == Shortcut.MiddleClick) && ShortcutDetailPanel == ShortcutDetail.MiddleClick) + { + ShortcutDetailPanel = ShortcutDetail.Auto; + item.SetValue(item.PossibleValues[index]); + } + } + + private ItemToggle CreateKeyboardControl(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.KEYBOARD_CONTROL, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0056")); + bool value = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.KEYBOARD_CONTROL); + item.SetValue(value: true); + item.AddChangeCallback(delegate + { + bool value2 = item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.KEYBOARD_CONTROL, value2); + ItemToggle obj = FindItem(ID.KEYBOARD_SHORTCUT_EVOLUTION) as ItemToggle; + obj.SetLabelLooks(value2); + obj.SetToggleLooks(value2); + obj.SetButtonEnable(value2); + obj.SetToggleEnable(value2); + ItemToggle obj2 = FindItem(ID.KEYBOARD_SHORTCUT_SPACE) as ItemToggle; + obj2.SetToggleLooks(value2); + obj2.SetLabelLooks(value2); + obj2.SetButtonEnable(value2); + obj2.SetToggleEnable(value2); + InputMgr.KeyboardControl = value2; + }); + StartCoroutine(InitializeKeyboardControlToggle(item, value)); + return item; + } + + private IEnumerator InitializeKeyboardControlToggle(ItemToggle item, bool value) + { + yield return null; + item.SetValue(value); + } + + private ItemToggle CreateKeyboardShortcutEvolution(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.KEYBOARD_SHORTCUT_EVOLUTION, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0057")); + item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.KEYBOARD_SHORTCUT_EVOLUTION)); + item.AddChangeCallback(delegate + { + bool value = item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.KEYBOARD_SHORTCUT_EVOLUTION, value); + InputMgr.KeyboardControlEvolution = value; + }); + return item; + } + + private ItemToggle CreateKeyboardShortcutSpace(bool isDispSeparatorLine) + { + SystemText systemText = Data.SystemText; + ItemToggle item = CreateToggle(ID.KEYBOARD_SHORTCUT_SPACE, isDispSeparatorLine, _battleRoot); + item.SetTitleLabel(systemText.Get("OtherConfig_0058")); + item.SetTitleTextLocalPos(SettingBase.CHILD_STATE_LABEL_POS); + item.SetValue(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.KEYBOARD_SHORTCUT_SPACE)); + item.AddChangeCallback(delegate + { + bool value = item.GetValue(); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.KEYBOARD_SHORTCUT_SPACE, value); + InputMgr.KeyboardControlSpace = value; + }); + return item; + } + + public static int GetBattleDetailPanelSizePercent() + { + string text = _battleDetailSizes[PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_DETAIL_PANEL_SIZE)]; + return int.Parse(text.Remove(text.Length - 1)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PackInfo.cs b/SVSim.BattleEngine/Engine/Wizard/PackInfo.cs new file mode 100644 index 0000000..1a0942b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PackInfo.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class PackInfo : HeaderData +{ + private List m_dataList = new List(); + + public List dataList => m_dataList; +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PackOpenTask.cs b/SVSim.BattleEngine/Engine/Wizard/PackOpenTask.cs new file mode 100644 index 0000000..0ad96d1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PackOpenTask.cs @@ -0,0 +1,167 @@ +using System.Collections.Generic; +using LitJson; +using Wizard.Scripts.Network.Data.TaskData.Arena; + +namespace Wizard; + +public class PackOpenTask : BaseTask +{ + public class PackOpenTaskParam : BaseParam + { + public int parent_gacha_id; + + public int gacha_id; + + public int gacha_type; + + public int pack_number; + + public int[] exclude_card_ids; + } + + public class PackOpenStarterPackTaskParam : BaseParam + { + public int parent_gacha_id; + + public int gacha_id; + + public int gacha_type; + + public int pack_number; + + public int[] exclude_card_ids; + + public int class_id; + } + + public class PackOpenAcquireSkinCardPackTaskParam : BaseParam + { + public int parent_gacha_id; + + public int gacha_id; + + public int gacha_type; + + public int pack_number; + + public int[] exclude_card_ids; + + public int target_card_id; + } + + private PackConfig _packConfig; + + public bool IsSpecialEffect; + + public bool IsExistFreePackLeaderSkin { get; private set; } + + public PackOpenTask(bool isTutorial, PackConfig packConfig) + { + base.type = (isTutorial ? ApiType.Type.PackOpenTutorial : ApiType.Type.PackOpen); + _packConfig = packConfig; + } + + public void SetParameter(int parent_gacha_id, int gacha_id, int gacha_type, int pack_number, int[] excluedeCardIds) + { + PackOpenTaskParam packOpenTaskParam = new PackOpenTaskParam(); + packOpenTaskParam.parent_gacha_id = parent_gacha_id; + packOpenTaskParam.gacha_id = gacha_id; + packOpenTaskParam.gacha_type = gacha_type; + packOpenTaskParam.pack_number = pack_number; + packOpenTaskParam.exclude_card_ids = excluedeCardIds; + base.Params = packOpenTaskParam; + } + + public void SetStarterPackParameter(int parent_gacha_id, int gacha_id, int gacha_type, int pack_number, int[] excluedeCardIds, int classId) + { + PackOpenStarterPackTaskParam packOpenStarterPackTaskParam = new PackOpenStarterPackTaskParam(); + packOpenStarterPackTaskParam.parent_gacha_id = parent_gacha_id; + packOpenStarterPackTaskParam.gacha_id = gacha_id; + packOpenStarterPackTaskParam.gacha_type = gacha_type; + packOpenStarterPackTaskParam.pack_number = pack_number; + packOpenStarterPackTaskParam.exclude_card_ids = excluedeCardIds; + packOpenStarterPackTaskParam.class_id = classId; + base.Params = packOpenStarterPackTaskParam; + } + + public void SetAcquireSkinCardPackParameter(int parentGachaId, int gachaId, int gachaType, int packNumber, int targetCardId) + { + PackOpenAcquireSkinCardPackTaskParam packOpenAcquireSkinCardPackTaskParam = new PackOpenAcquireSkinCardPackTaskParam(); + packOpenAcquireSkinCardPackTaskParam.parent_gacha_id = parentGachaId; + packOpenAcquireSkinCardPackTaskParam.gacha_id = gachaId; + packOpenAcquireSkinCardPackTaskParam.gacha_type = gachaType; + packOpenAcquireSkinCardPackTaskParam.pack_number = packNumber; + packOpenAcquireSkinCardPackTaskParam.exclude_card_ids = new int[0]; + packOpenAcquireSkinCardPackTaskParam.target_card_id = targetCardId; + base.Params = packOpenAcquireSkinCardPackTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + if (Data.PackOpen.data == null) + { + Data.PackOpen.data = new PackOpenDetail(); + Data.PackOpen.data.pack_list = new List(); + Data.PackOpen.data.reward_list = new List(); + Data.PackOpen.data.NotificatonAnimationParams = new List(); + Data.PackOpen.data.AchievedInfo = new AchievedInfo(); + } + else + { + Data.PackOpen.data.pack_list.Clear(); + Data.PackOpen.data.reward_list.Clear(); + if (Data.PackOpen.data.NotificatonAnimationParams != null) + { + Data.PackOpen.data.NotificatonAnimationParams.Clear(); + } + Data.PackOpen.data.AchievedInfo = new AchievedInfo(); + } + if (base.ResponseData["data"].Keys.Contains("mission_result")) + { + Data.PackOpen.data.AchievedInfo = new AchievedInfo(base.ResponseData["data"]["mission_result"]); + Data.PackOpen.data.NotificatonAnimationParams = new List(); + for (int i = 0; i < Data.PackOpen.data.AchievedInfo._missions.Count; i++) + { + string achieved_message = Data.PackOpen.data.AchievedInfo._missions[i].achieved_message; + Data.PackOpen.data.NotificatonAnimationParams.Add(new NotificatonAnimation.Param(NotificatonAnimation.Param.Type.GachaResult, achieved_message)); + } + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + JsonData jsonData = base.ResponseData["data"]["pack_list"]; + int count = jsonData.Count; + for (int j = 0; j < count; j++) + { + JsonData jsonData2 = jsonData[j]; + CardPack cardPack = new CardPack(); + cardPack.card_id = (int)jsonData2["card_id"]; + cardPack.rarity = (int)jsonData2["rarity"]; + cardPack.SleeveId = _packConfig.SleeveId; + cardPack.IsFreePackLeaderSkin = jsonData2.GetValueOrDefault("special_effect", 0) == 1; + if (cardPack.IsFreePackLeaderSkin) + { + IsExistFreePackLeaderSkin = true; + } + Data.PackOpen.data.pack_list.Add(cardPack); + } + if (_packConfig.IsSpecialCardPack && _packConfig.PackId >= 90001) + { + CardPack cardPack2 = Data.PackOpen.data.pack_list[count - 1]; + cardPack2.SleeveId = _packConfig.SpecialSleeveId; + cardPack2.IsSpecialCard = true; + } + JsonData jsonData3 = base.ResponseData["data"]["rewards"]; + for (int k = 0; k < jsonData3.Count; k++) + { + Wizard.Scripts.Network.Data.TaskData.Arena.Reward item = new Wizard.Scripts.Network.Data.TaskData.Arena.Reward(jsonData3[k]); + Data.PackOpen.data.reward_list.Add(item); + } + IsSpecialEffect = base.ResponseData["data"].GetValueOrDefault("is_special_effect", defaultValue: false); + Data.Load.data._userTutorial.Update(base.ResponseData["data"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlayBreakPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/PlayBreakPolicyCollection.cs new file mode 100644 index 0000000..b735a06 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlayBreakPolicyCollection.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class PlayBreakPolicyCollection : AIPolicyCollection +{ + public bool IsPlayBreak(AIVirtualCard card, List playPtn, AISituationInfo situation) + { + if (!base.HasPolicy || !card.IsInHand) + { + return false; + } + AIVirtualField selfField = card.SelfField; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(card, playPtn, selfField, situation) && (aIPolicyData.Argument as AIPlayBreak).IsPlayBreak(card, selfField, playPtn, situation)) + { + return true; + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlaySimulationInfo.cs b/SVSim.BattleEngine/Engine/Wizard/PlaySimulationInfo.cs new file mode 100644 index 0000000..5f2d9dd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlaySimulationInfo.cs @@ -0,0 +1,17 @@ +namespace Wizard; + +public class PlaySimulationInfo +{ + public AIVirtualCard Actor; + + public int UseCost; + + public PlaySimulationType Type; + + public PlaySimulationInfo(AIVirtualCard actor, int cost, PlaySimulationType type) + { + Actor = actor; + UseCost = cost; + Type = type; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlaySkipIfEvoInformation.cs b/SVSim.BattleEngine/Engine/Wizard/PlaySkipIfEvoInformation.cs new file mode 100644 index 0000000..b372027 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlaySkipIfEvoInformation.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public class PlaySkipIfEvoInformation : PlaySkipInformation +{ + private List _evolutionPermittedCards; + + public bool HasEvolutionPermittedCards + { + get + { + if (_evolutionPermittedCards != null) + { + return _evolutionPermittedCards.Any(); + } + return false; + } + } + + public PlaySkipIfEvoInformation() + { + TagType = AIPlayTagType.PlaySkipIfEvo; + base.IsEvolutionPermittedTag = true; + _evolutionPermittedCards = null; + } + + public override bool IsEvoCardLegal(AIVirtualCard evoCard) + { + if (evoCard == null) + { + return false; + } + if (HasEvolutionPermittedCards) + { + return _evolutionPermittedCards.Any((AIVirtualCard c) => c.IsSameCard(evoCard)); + } + return false; + } + + public void AddEvolutionPermittedCards(List cards) + { + _evolutionPermittedCards = AIParamQuery.AddRangeToList(cards, _evolutionPermittedCards); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlaySkipWithActionIfEvoInformation.cs b/SVSim.BattleEngine/Engine/Wizard/PlaySkipWithActionIfEvoInformation.cs new file mode 100644 index 0000000..d4826f2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlaySkipWithActionIfEvoInformation.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class PlaySkipWithActionIfEvoInformation : PlaySkipInformation +{ + private readonly PlaySkipIfEvoInformation _playSkipIfEvo; + + private readonly PlaySkipWithActionInformation _playSkipWithAction; + + public PlaySkipWithActionIfEvoInformation(AIScriptTokenArgType action) + { + TagType = AIPlayTagType.PlaySkipWithActionIfEvo; + base.IsEvolutionPermittedTag = true; + _playSkipIfEvo = new PlaySkipIfEvoInformation(); + _playSkipWithAction = new PlaySkipWithActionInformation(action); + } + + public override bool IsEvoCardLegal(AIVirtualCard evoCard) + { + return _playSkipIfEvo.IsEvoCardLegal(evoCard); + } + + public void AddEvolutionPermittedCards(List cards) + { + _playSkipIfEvo.AddEvolutionPermittedCards(cards); + } + + public AIVirtualActionInfo GetExtraActionBase(AISinglePlayptnRecord playPtnRecord, ref List checkedActionTypeList) + { + return _playSkipWithAction.GetExtraActionBase(playPtnRecord, ref checkedActionTypeList); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlaySkipWithActionInformation.cs b/SVSim.BattleEngine/Engine/Wizard/PlaySkipWithActionInformation.cs new file mode 100644 index 0000000..3f799d2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlaySkipWithActionInformation.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class PlaySkipWithActionInformation : PlaySkipInformation +{ + public AIScriptTokenArgType Action; + + public PlaySkipWithActionInformation(AIScriptTokenArgType action) + { + TagType = AIPlayTagType.PlaySkipWithAction; + Action = action; + base.IsEvolutionPermittedTag = false; + } + + public AIVirtualActionInfo GetExtraActionBase(AISinglePlayptnRecord playPtnRecord, ref List checkedActionTypeList) + { + if (checkedActionTypeList != null && checkedActionTypeList.Contains(Action)) + { + return null; + } + AIVirtualActionInfo result = ((Action != AIScriptTokenArgType.NEXT_PLAY) ? null : GetNextPlayActionBase(playPtnRecord)); + checkedActionTypeList = AIParamQuery.AddElementToList(Action, checkedActionTypeList); + return result; + } + + private AIVirtualActionInfo GetNextPlayActionBase(AISinglePlayptnRecord record) + { + if (record.PlayedCardList.Count <= 0) + { + return null; + } + PlayedCardInfo playedCardInfo = record.PlayedCardList[0]; + if (playedCardInfo.TransformCard == null) + { + return new AIVirtualTargetSelectAction(playedCardInfo.Card, playedCardInfo.Card, AIOperationType.PLAY); + } + return new AIVirtualTargetSelectAction(playedCardInfo.TransformCard, playedCardInfo.Card, AIOperationType.PLAY); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlayedTogetherHistory.cs b/SVSim.BattleEngine/Engine/Wizard/PlayedTogetherHistory.cs new file mode 100644 index 0000000..b0eb4fd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlayedTogetherHistory.cs @@ -0,0 +1,52 @@ +using System; +using LitJson; + +namespace Wizard; + +public class PlayedTogetherHistory : HeaderData +{ + public const int FRIEND_STATUS_NO_ACTION = 0; + + public const int FRIEND_STATUS_IS_FRIEND = 1; + + public const int FRIEND_STATUS_IS_SEND = 2; + + public const int FRIEND_STATUS_IS_RECEIVED = 3; + + public int ViewerId; + + public string Name; + + public string CountryCode; + + public int Rank; + + public long EmblemId; + + public int DegreeId; + + public DateTime LastPlayTime; + + public int FriendStatus; + + public DateTime PlayedTime; + + public int ApplyId; + + public BattleParameter BattleParameter; + + public PlayedTogetherHistory(JsonData data) + { + ViewerId = data["viewer_id"].ToInt(); + Name = data["name"].ToString(); + CountryCode = data["country_code"].ToString(); + Rank = data["rank"].ToInt(); + EmblemId = data["emblem_id"].ToLong(); + DegreeId = data["degree_id"].ToInt(); + LastPlayTime = DateTime.Parse(data["last_play_time"].ToString()); + FriendStatus = data["friend_status"].ToInt(); + PlayedTime = DateTime.Parse(data["played_time"].ToString()); + ApplyId = data["friend_apply_id"].ToInt(); + BattleParameter = BattleParameter.JsonToBattleParameter(data); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlayedTogetherInfo.cs b/SVSim.BattleEngine/Engine/Wizard/PlayedTogetherInfo.cs new file mode 100644 index 0000000..222f646 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlayedTogetherInfo.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class PlayedTogetherInfo : HeaderData +{ + public List HistoryList = new List(); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlayerEmoOnLeaderDamagedPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/PlayerEmoOnLeaderDamagedPolicyCollection.cs new file mode 100644 index 0000000..68cce91 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlayerEmoOnLeaderDamagedPolicyCollection.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class PlayerEmoOnLeaderDamagedPolicyCollection : AIPolicyCollection +{ + public int GetPlayerEmoOnLeaderDamaged(AIVirtualField field) + { + if (!base.HasPolicy) + { + return -1; + } + AIVirtualCard enemyClass = field.EnemyClass; + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(enemyClass, emptyPlayPtn, field, null)) + { + int num = (int)aIPolicyData.EvalArg(enemyClass, emptyPlayPtn, field); + if (num >= 0) + { + return num; + } + } + } + return -1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlayerEmoOnTurnEndPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/PlayerEmoOnTurnEndPolicyCollection.cs new file mode 100644 index 0000000..832d6fc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlayerEmoOnTurnEndPolicyCollection.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class PlayerEmoOnTurnEndPolicyCollection : AIPolicyCollection +{ + public int GetPlayerEmoOnTurnEnd(AIVirtualField field, bool isAllyTurn) + { + if (base.HasPolicy) + { + AIVirtualCard enemyClass = field.EnemyClass; + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(enemyClass, emptyPlayPtn, field, null)) + { + int emoteIdIfSideIsCorrect = (aIPolicyData.Argument as AIEmoteOnTurnTransition).GetEmoteIdIfSideIsCorrect(isAllyTurn); + if (emoteIdIfSideIsCorrect >= 0) + { + return emoteIdIfSideIsCorrect; + } + } + } + } + return -1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlayerEmoOnTurnStartPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/PlayerEmoOnTurnStartPolicyCollection.cs new file mode 100644 index 0000000..4c77a32 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlayerEmoOnTurnStartPolicyCollection.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class PlayerEmoOnTurnStartPolicyCollection : AIPolicyCollection +{ + public int GetPlayerEmoOnTurnStart(AIVirtualField field) + { + if (!base.HasPolicy) + { + return -1; + } + AIVirtualCard enemyClass = field.EnemyClass; + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(enemyClass, emptyPlayPtn, field, null)) + { + int num = (int)aIPolicyData.EvalArg(enemyClass, emptyPlayPtn, field); + if (num >= 0) + { + return num; + } + } + } + return -1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlayerPrefsWrapper.cs b/SVSim.BattleEngine/Engine/Wizard/PlayerPrefsWrapper.cs new file mode 100644 index 0000000..6efe543 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlayerPrefsWrapper.cs @@ -0,0 +1,519 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public static class PlayerPrefsWrapper +{ + public static readonly int TRUE = 1; + + public static readonly int FALSE = 0; + + public static readonly KeyValuePair BGM_VOLUME = new KeyValuePair("BGMVOLUME", 1f); + + public static readonly KeyValuePair SE_VOLUME = new KeyValuePair("SEVOLUME", 1f); + + public static readonly KeyValuePair VOICE_VOLUME = new KeyValuePair("VOICEVOLUME", 1f); + + public static readonly KeyValuePair SOUND_MUTE = new KeyValuePair("SOUND_MUTE", FALSE); + + public static readonly KeyValuePair MOVIE_SUBTITLES = new KeyValuePair("MOVIE_SUBTITLES", FALSE); + + public static readonly KeyValuePair CONFIRM_TURN_END = new KeyValuePair("CONFIRM_TURN_END", FALSE); + + public static readonly KeyValuePair CONFIRM_TURN_END_WITHOUT_USING_HERO_SKILL = new KeyValuePair("CONFIRM_TURN_END_WITHOUT_USING_HERO_SKILL", TRUE); + + public static readonly KeyValuePair CONFIRM_EVOLVE = new KeyValuePair("CONFIRM_EVOLVE", FALSE); + + public static readonly KeyValuePair FIXEDUSE_COST_INFO = new KeyValuePair("FIXEDUSE_COST_INFO", FALSE); + + public static readonly KeyValuePair SHOW_OTHER_PLAYER_EMOTE = new KeyValuePair("SHOW_OPPONENT_EMOTE", TRUE); + + public static readonly KeyValuePair SHOW_OPPONENT_DEFAULT_SKIN = new KeyValuePair("SHOW_OPPONENT_DEFAULT_SKIN", FALSE); + + public static readonly KeyValuePair SHOW_FOIL_CARD_ANIMATION = new KeyValuePair("SHOW_FOIL_CARD_ANIMATION", TRUE); + + public static readonly KeyValuePair SHOW_BATTLE_EFFECT = new KeyValuePair("SHOW_BATTLE_EFFECT", FALSE); + + public static readonly KeyValuePair SHOW_LEADER_ANIMATION = new KeyValuePair("SHOW_LEADER_ANIMATION", TRUE); + + public static readonly KeyValuePair SHOW_PANEL_ALWAYS = new KeyValuePair("SHOW_PANEL_ALWAYS", FALSE); + + public static readonly KeyValuePair SHOW_PREDICTION_ICONS = new KeyValuePair("SHOW_PREDICTION_ICONS", FALSE); + + public static readonly KeyValuePair DEVICE_ORIENTATION = new KeyValuePair("DEVICE_ORIENTATION", FALSE); + + public static readonly KeyValuePair AUTO_MESSAGE = new KeyValuePair("AUTO_MESSAGE", FALSE); + + public static readonly KeyValuePair SHOW_SIDE_LOG = new KeyValuePair("SHOW_SIDE_LOG", TRUE); + + public static readonly KeyValuePair SHOW_FUSION_CARD_PLAY_DIALOG = new KeyValuePair("SHOW_FUSION_CARD_PLAY_DIALOG", FALSE); + + public static readonly KeyValuePair CARDPACK_CARD_AUTO_OPEN = new KeyValuePair("SKIPCARDPACK", value: false); + + public static readonly KeyValuePair HOME_CENTER_CARD_INDEX = new KeyValuePair("HOME_CARD_INDEX", 0); + + public static readonly KeyValuePair LAST_BATTLE_DECK_ID = new KeyValuePair("LAST_BATTLE_DECK_ID", -1); + + public static readonly KeyValuePair LAST_BATTLE_DECK_FORMAT_FOR_MYPAGE = new KeyValuePair("LAST_BATTLE_DECK_FORMAT", 2); + + public static readonly KeyValuePair LAST_BATTLE_DECK_ID_FOR_MYPAGE = new KeyValuePair("LAST_BATTLE_DECK_ID_FOR_MYPAGE", 1); + + public static readonly KeyValuePair LAST_BATTLE_IS_DEFAULT_DECK_FOR_MYPAGE = new KeyValuePair("LAST_BATTLE_IS_DEFDECK", TRUE); + + public static readonly KeyValuePair LAST_BATTLE_DECK_FORMAT_FOR_SINGLE_RECOVER = new KeyValuePair("LAST_BATTLE_DECK_FORMAT_FOR_SINGLE_RECOVER", 2); + + public static readonly KeyValuePair LAST_BATTLE_LEADER_ID = new KeyValuePair("LAST_BATTLE_LEADER_ID", 0); + + public static readonly KeyValuePair LAST_BATTLE_IS_DEFDECK = new KeyValuePair("LAST_BATTLE_IS_DEFAULT_DECK_FOR_BATTLE", FALSE); + + public static readonly KeyValuePair LAST_BATTLE_IS_TRIALDECK = new KeyValuePair("LAST_BATTLE_IS_TRIAL_DECK_FOR_BATTLE", FALSE); + + public static readonly KeyValuePair LAST_BATTLE_NAME_TRIALDECK = new KeyValuePair("LAST_BATTLE_NAME_TRIALDECK", ""); + + public static readonly KeyValuePair LAST_BATTLE_DECK_CARD_LIST = new KeyValuePair("LAST_BATTLE_DECK_CARD_LIST", ""); + + public static readonly KeyValuePair LAST_BATTLE_DECK_SLEEVE_ID = new KeyValuePair("LAST_BATTLE_DECK_SLEEVE_ID", ""); + + public static readonly KeyValuePair LAST_BATTLE_DECK_ID_MULTI_DECK_ROOM1 = new KeyValuePair("LAST_ROOM_BATTLE_DECK_ID1", 1); + + public static readonly KeyValuePair LAST_BATTLE_DECK_ID_MULTI_DECK_ROOM2 = new KeyValuePair("LAST_ROOM_BATTLE_DECK_ID2", 1); + + public static readonly KeyValuePair LAST_BATTLE_DECK_ID_MULTI_DECK_ROOM3 = new KeyValuePair("LAST_ROOM_BATTLE_DECK_ID3", 1); + + public static readonly KeyValuePair LAST_BATTLE_DECK_ID_MULTI_DECK_ROOM4 = new KeyValuePair("LAST_ROOM_BATTLE_DECK_ID4", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_DECK_ID_MULTI_DECK_ROOM1 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_DECK_ID1", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_DECK_ID_MULTI_DECK_ROOM2 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_DECK_ID2", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_DECK_ID_MULTI_DECK_ROOM3 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_DECK_ID3", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_DECK_ID_MULTI_DECK_ROOM4 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_DECK_ID4", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_CARD_ID_ROOM1 = new KeyValuePair("LAST_BATTLE_ENEMY_CARD_ID_ROOM1", string.Empty); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_CARD_ID_ROOM2 = new KeyValuePair("LAST_BATTLE_ENEMY_CARD_ID_ROOM2", string.Empty); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_CARD_ID_ROOM3 = new KeyValuePair("LAST_BATTLE_ENEMY_CARD_ID_ROOM3", string.Empty); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_CARD_ID_ROOM4 = new KeyValuePair("LAST_BATTLE_ENEMY_CARD_ID_ROOM4", string.Empty); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_CARD_ID_FORMAT1 = new KeyValuePair("LAST_BATTLE_ENEMY_CARD_ID_FORMAT1", 2); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_CARD_ID_FORMAT2 = new KeyValuePair("LAST_BATTLE_ENEMY_CARD_ID_FORMAT2", 2); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_CARD_ID_FORMAT3 = new KeyValuePair("LAST_BATTLE_ENEMY_CARD_ID_FORMAT3", 2); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_CARD_ID_FORMAT4 = new KeyValuePair("LAST_BATTLE_ENEMY_CARD_ID_FORMAT4", 2); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_CLASS_ID_MULTI_DECK_ROOM1 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_CLASS1", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_CLASS_ID_MULTI_DECK_ROOM2 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_CLASS2", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_CLASS_ID_MULTI_DECK_ROOM3 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_CLASS3", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_CLASS_ID_MULTI_DECK_ROOM4 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_CLASS4", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_SUB_CLASS_ID_MULTI_DECK_ROOM1 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_SUB_CLASS1", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_SUB_CLASS_ID_MULTI_DECK_ROOM2 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_SUB_CLASS2", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_SUB_CLASS_ID_MULTI_DECK_ROOM3 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_SUB_CLASS3", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_SUB_CLASS_ID_MULTI_DECK_ROOM4 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_SUB_CLASS4", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_MY_ROTATION_ID_MULTI_DECK_ROOM1 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_MY_ROTATION1", string.Empty); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_MY_ROTATION_ID_MULTI_DECK_ROOM2 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_MY_ROTATION2", string.Empty); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_MY_ROTATION_ID_MULTI_DECK_ROOM3 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_MY_ROTATION3", string.Empty); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_MY_ROTATION_ID_MULTI_DECK_ROOM4 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_MY_ROTATION4", string.Empty); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_SLEEVE_ID_MULTI_DECK_ROOM1 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_SLEEVE1", "1"); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_SLEEVE_ID_MULTI_DECK_ROOM2 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_SLEEVE2", "1"); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_SLEEVE_ID_MULTI_DECK_ROOM3 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_SLEEVE3", "1"); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_SLEEVE_ID_MULTI_DECK_ROOM4 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_SLEEVE4", "1"); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_SKIN_ID_MULTI_DECK_ROOM1 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_SKIN1", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_SKIN_ID_MULTI_DECK_ROOM2 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_SKIN2", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_SKIN_ID_MULTI_DECK_ROOM3 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_SKIN3", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_SKIN_ID_MULTI_DECK_ROOM4 = new KeyValuePair("LAST_ROOM_BATTLE_ENEMY_SKIN4", 1); + + public static readonly KeyValuePair LAST_BATTLE_PLAYER_BAN_DECK_ID = new KeyValuePair("LAST_BATTLE_PLAYER_BAN_DECK_ID", 1); + + public static readonly KeyValuePair LAST_BATTLE_ENEMY_BAN_DECK_ID = new KeyValuePair("LAST_BATTLE_ENEMY_BAN_DECK_ID", 1); + + public static readonly KeyValuePair ROOM_MATCH_2PICK_DRAFT_MY_SELECT_DECK = new KeyValuePair("ROOM_MATCHI_2PICK_DRAFT_MY_SELECT_DECK", ""); + + public static readonly KeyValuePair QUEST_LAST_USED_DECK_INFO = new KeyValuePair("QUEST_LAST_USED_DECK_INFO", string.Empty); + + public static readonly KeyValuePair FIRST_TIPS = new KeyValuePair("FIRST_TIPS", "0"); + + public static readonly KeyValuePair FIRST_TIPS_AFTER_ROTATION_USER_FLAG = new KeyValuePair("FIRST_TIPS_AFTER_ROTATION_USER_FLAG", 0); + + public static readonly KeyValuePair FIRST_TIPS_QUEST_ID = new KeyValuePair("FIRST_TIPS_QUEST_ID", 0); + + public static readonly KeyValuePair FIRST_TIPS_ADDITIONAL_PUZZLE_QUEST_ID = new KeyValuePair("FIRST_TIPS_ADDITIONAL_PUZZLE_QUEST_ID", 0); + + public static readonly KeyValuePair FIRST_TIPS_BOSSRUSH_QUEST_ID = new KeyValuePair("FIRST_TIPS_BOSSRUSH_QUEST_ID", 0); + + public static readonly KeyValuePair BOSSRUSH_LAST_USED_DECK_INFO = new KeyValuePair("BOSSRUSH_LAST_USED_DECK_INFO", string.Empty); + + public static readonly KeyValuePair FIRST_TIPS_COLOSSEUM_ID = new KeyValuePair("FIRST_TIPS_COLOSSEUM_ID", 0); + + public static readonly KeyValuePair FIRST_TIPS_NEUTRAL_POPULARITY_VOTE_CAMPAIGN_ID = new KeyValuePair("FIRST_TIPS_NEUTRAL_POPULARITY_VOTE_CAMPAIGN_ID", 0); + + public static readonly KeyValuePair FIRST_TIPS_LEADER_POPULARITY_VOTE_CAMPAIGN_ID = new KeyValuePair("FIRST_TIPS_LEADER_POPULARITY_VOTE_CAMPAIGN_ID", 0); + + public static readonly KeyValuePair FIRST_TIPS_BINGO_ID = new KeyValuePair("FIRST_TIPS_BINGO_ID", 0); + + public static readonly KeyValuePair INSTALL_REGION_CODE = new KeyValuePair("INSTALL_REGION_CODE", ""); + + public static readonly KeyValuePair CURRENT_REGION_CODE = new KeyValuePair("CURRENT_REGION_CODE", ""); + + public static readonly KeyValuePair SIMPLE_STAGE = new KeyValuePair("SIMPLE_STAGE", FALSE); + + public static readonly KeyValuePair COLLABORATION_SOUND = new KeyValuePair("COLLABORATION_SOUND", TRUE); + + public static readonly KeyValuePair USE_OFF_STAGE = new KeyValuePair("USE_OFF_STAGE", TRUE); + + public static readonly KeyValuePair OFF_STAGE = new KeyValuePair("OFF_STAGE", 0); + + public static readonly KeyValuePair OFF_STAGE_ID = new KeyValuePair("OFF_STAGE_ID", ""); + + public static readonly KeyValuePair VIDEOHOSTING_VERSION = new KeyValuePair("VIDEOHOSTING_VERSION", ""); + + public static readonly KeyValuePair VIDEOHOSTING_FLAGS = new KeyValuePair("VIDEOHOSTING_FLAGS", 1); + + public static readonly KeyValuePair VIDEOHOSTING_MICROPHONE_GAIN = new KeyValuePair("VIDEOHOSTING_MICROPHONE_GAIN", 0.5f); + + public static readonly KeyValuePair SOCIAL_ACHIEVEMENT_SIGNIN = new KeyValuePair("SOCIAL_ACHIEVEMENT_SIGNIN", TRUE); + + public static readonly KeyValuePair PLAY_SOUND_IN_BACKGROUND = new KeyValuePair("PLAY_SOUND_IN_BACKGROUND", TRUE); + + public static readonly KeyValuePair ROOM_MATCH_EMOTE_MINE = new KeyValuePair("ROOM_MATCH_EMOTE_MINE", -1); + + public static readonly KeyValuePair ROOM_MATCH_EMOTE_ENEMY = new KeyValuePair("ROOM_MATCH_EMOTE_ENEMY", -1); + + public static readonly KeyValuePair ROOM_MATCH_DISPLAY_ID = new KeyValuePair("ROOM_MATCH_DISPLAY_ID", ""); + + public static readonly KeyValuePair ROOM_MATCH_RULE = new KeyValuePair("ROOM_MATCH_RULE", -1); + + public static readonly KeyValuePair ROOM_MATCH_ENEMY_IS_FRIEND = new KeyValuePair("ROOM_MATCH_ENEMY_IS_FRIEND", -1); + + public static readonly KeyValuePair ROOM_MATCH_ENEMY_IS_SAME_GUILD = new KeyValuePair("ROOM_MATCH_ENEMY_IS_SAME_GUILD", -1); + + public static readonly KeyValuePair ROOM_MATCH_ENEMY_IS_JOIN_GUILD = new KeyValuePair("ROOM_MATCH_ENEMY_IS_JOIN_GUILD", -1); + + public static readonly KeyValuePair ROOM_MATCH_OWNER_IS_FIRST_TURN = new KeyValuePair("ROOM_MATCH_OWNER_IS_FIRST_TURN", -1); + + public static readonly KeyValuePair ROOM_MATCH_FRIEND_WATCH_PERMIT = new KeyValuePair("ROOM_MATCH_FRIEND_WATCH_PERMIT", FALSE); + + public static readonly KeyValuePair ROOM_MATCH_GUILD_WATCH_PERMIT = new KeyValuePair("ROOM_MATCH_GUILD_WATCH_PERMIT", FALSE); + + public static readonly KeyValuePair LAST_ROOM_MATCH_BASE_RULE = new KeyValuePair("LAST_ROOM_MATCH_BASE_RULE", 0); + + public static readonly KeyValuePair LAST_ROOM_MATCH_RULE = new KeyValuePair("LAST_ROOM_MATCH_RULE", 1); + + public static readonly KeyValuePair LAST_ROOM_MATCH_RULE_2PICK = new KeyValuePair("LAST_ROOM_MATCH_RULE_2PICK", 1); + + public static readonly KeyValuePair LAST_ROOM_MATCH_FORMAT_2PICK = new KeyValuePair("LAST_ROOM_MATCH_FORMAT_2PICK", 1); + + public static readonly KeyValuePair ROOM_MATCH_FORMAT = new KeyValuePair("ROOM_MATCH_FORMAT", 0); + + public static readonly KeyValuePair LAST_SELECT_DECK_ID_ROTATION = new KeyValuePair("LAST_SELECT_DECK_ID_ROTATION", -1); + + public static readonly KeyValuePair LAST_SELECT_DECK_ID_UNLIMITED = new KeyValuePair("LAST_SELECT_DECK_ID", -1); + + public static readonly KeyValuePair LAST_SELECT_DECK_ID_PRE_ROTATION = new KeyValuePair("LAST_SELECT_DECK_ID_PRE_ROTATION", -1); + + public static readonly KeyValuePair LAST_SELECT_DECK_ID_CROSSOVER = new KeyValuePair("LAST_SELECT_DECK_ID_CROSSOVER", -1); + + public static readonly KeyValuePair LAST_SELECT_DECK_ID_MY_ROTATION = new KeyValuePair("LAST_SELECT_DECK_ID_MY_ROTATION", -1); + + public static readonly KeyValuePair LAST_SELECT_DECK_ID_AVATAR = new KeyValuePair("LAST_SELECT_DECK_ID_AVATAR", -1); + + public static readonly KeyValuePair LAST_SELECT_DECK_FORMAT = new KeyValuePair("LAST_SELECT_DECK_FORMAT", 2); + + public static readonly KeyValuePair CONVENTION_LAST_SELECT_DECK_ID = new KeyValuePair("CONVENTION_LAST_SELECT_DECK_ID", -1); + + public static readonly KeyValuePair LAST_SELECT_IS_DEFDECK_ROTATION = new KeyValuePair("LAST_SELECT_IS_DEFDECK_ROTATION", TRUE); + + public static readonly KeyValuePair LAST_SELECT_IS_DEFDECK_UNLIMITED = new KeyValuePair("LAST_SELECT_IS_DEFDECK", TRUE); + + public static readonly KeyValuePair LAST_SELECT_IS_BUILD_DECK = new KeyValuePair("LAST_SELECT_IS_BUILD_DECK", FALSE); + + public static readonly KeyValuePair MOUSE_CONTROL = new KeyValuePair("MOUSE_CONTROL", FALSE); + + public static readonly KeyValuePair MOUSE_SHORTCUT = new KeyValuePair("MOUSE_SHORTCUT", 1); + + public static readonly KeyValuePair MOUSE_SHORTCUT_PLAY = new KeyValuePair("MOUSE_SHORTCUT_PLAY", 1); + + public static readonly KeyValuePair MOUSE_SHORTCUT_EVOLUTION = new KeyValuePair("MOUSE_SHORTCUT_EVOLUTION", 1); + + public static readonly KeyValuePair MOUSE_SHORTCUT_DETAIL = new KeyValuePair("MOUSE_SHORTCUT_DETAIL", 3); + + public static readonly KeyValuePair FRAMERATE = new KeyValuePair("FRAMERATE", 0); + + public static readonly KeyValuePair SHOWQRCODE = new KeyValuePair("SHOWQRCODE", 0); + + public static readonly KeyValuePair PACK_FIRST_TRANSITION_SERIAL_ID = new KeyValuePair("PACK_FIRST_TRANSITION_SERIAL_ID", -1); + + public static readonly KeyValuePair LAST_PURCHASE_PACK_ID = new KeyValuePair("LAST_PURCHASE_PACK_ID", -1); + + public static readonly KeyValuePair LAST_PURCHASE_PACK_ID_IN_EXIST_ADDITIONALPACK = new KeyValuePair("LAST_PURCHASE_PACK_ID_IN_EXIST_ADDITIONALPACK", -1); + + public static readonly KeyValuePair LAST_PURCHASE_DECK_SERIES_ID = new KeyValuePair("LAST_PURCHASE_DECK_SERIES_ID", -1); + + public static readonly KeyValuePair SCENE_TRANSITION_VIEW_DECK_SERIES_ID = new KeyValuePair("SCENE_TRANSITION_VIEW_DECK_SERIES_ID", -1); + + public static readonly KeyValuePair LATEST_DECK_SERIES_ID = new KeyValuePair("LATEST_DECK_SERIES_ID", -1); + + public static readonly KeyValuePair LAST_PURCHASE_SKIN_SERIES_ID = new KeyValuePair("LAST_PURCHASE_SKIN_SERIES_ID", -1); + + public static readonly KeyValuePair SCENE_TRANSITION_VIEW_SKIN_SERIES_ID = new KeyValuePair("SCENE_TRANSITION_VIEW_SKIN_SERIES_ID", -1); + + public static readonly KeyValuePair LATEST_SKIN_SERIES_ID = new KeyValuePair("LATEST_SKIN_SERIES_ID", -1); + + public static readonly KeyValuePair LAST_PURCHASE_SLEEVE_SERIES_ID = new KeyValuePair("LAST_PURCHASE_SLEEVE_SERIES_ID", -1); + + public static readonly KeyValuePair SCENE_TRANSITION_VIEW_SLEEVE_SERIES_ID = new KeyValuePair("SCENE_TRANSITION_VIEW_SLEEVE_SERIES_ID", -1); + + public static readonly KeyValuePair LATEST_SLEEVE_SERIES_ID = new KeyValuePair("LATEST_SLEEVE_SERIES_ID", -1); + + public static readonly KeyValuePair BATTLE_DETAIL_PANEL_SIZE = new KeyValuePair("BATTLE_DETAIL_PANEL_SIZE", 0); + + public static readonly KeyValuePair LAST_REPORT_DATETIME = new KeyValuePair("LAST_REPORT_DATETIME", "01/01/0001 00:00:00"); + + public static readonly KeyValuePair KEYBOARD_CONTROL = new KeyValuePair("KEYBOARD_CONTROL", FALSE); + + public static readonly KeyValuePair KEYBOARD_SHORTCUT_EVOLUTION = new KeyValuePair("KEYBOARD_SHORTCUT_EVOLUTION", FALSE); + + public static readonly KeyValuePair KEYBOARD_SHORTCUT_SPACE = new KeyValuePair("KEYBOARD_SHORTCUT_SPACE", FALSE); + + public static readonly KeyValuePair IS_COPY_SLEEVE_AND_SKIN = new KeyValuePair("IS_COPY_SLEEVE_AND_SKIN", FALSE); + + public static readonly KeyValuePair IS_COPY_SUBCLASS_CARDS = new KeyValuePair("IS_COPY_SUBCLASS_CARDS", TRUE); + + public static readonly KeyValuePair IS_SKIP_CLEARED_STORY_BATTLE = new KeyValuePair("IS_SKIP_CLEARED_STORY_BATTLE", FALSE); + + public static readonly KeyValuePair BATTLE_WINNER_REWARD_GRADE = new KeyValuePair("BATTLE_WINNER_REWARD_GRADE", 0); + + public static readonly KeyValuePair BATTLE_WINNER_REWARD_STRING = new KeyValuePair("BATTLE_WINNER_REWARD_STRING", ""); + + public static readonly KeyValuePair IS_SELECT_WSS = new KeyValuePair("IS_SELECT_WSS", FALSE); + + public static readonly KeyValuePair IS_SELECT_IPV6 = new KeyValuePair("IS_SELECT_IPV6", TRUE); + + public static readonly KeyValuePair COLOSSEUM_PUBLISHED_SETTING = new KeyValuePair("COLOSSEUM_PUBLISHED_SETTING", TRUE); + + public static readonly KeyValuePair COMPETITION_PUBLISHED_SETTING = new KeyValuePair("COMPETITION_PUBLISHED_SETTING", TRUE); + + public static readonly KeyValuePair AUTO_CACHE_CLEAR_FLAG = new KeyValuePair("AUTO_CACHE_CLEAR_FLAG", FALSE); + + public static readonly KeyValuePair ASSET_FILE_ERROR_LATE = new KeyValuePair("ASSET_FILE_ERROR_IN_BATTLE", FALSE); + + public static readonly KeyValuePair PURCHASE_ALERT = new KeyValuePair("PURCHASE_ALERT", TRUE); + + public static readonly KeyValuePair JOINING_GUILD_ID = new KeyValuePair("JOINING_GUILD_ID", -1); + + public static readonly KeyValuePair READ_LATEST_GUILD_CHAT_MESSAGE_ID = new KeyValuePair("READ_LATEST_GUILD_CHAT_MESSAGE_ID", -1); + + public static readonly KeyValuePair READ_LATEST_GATHERING_CHAT_MESSAGE_ID = new KeyValuePair("READ_LATEST_GATHERING_CHAT_MESSAGE_ID", -1); + + public static readonly KeyValuePair RANKING_START_TYPE = new KeyValuePair("RANKING_START_TYPE", 0); + + public static readonly KeyValuePair GATHERING_BATTLE_TYPE = new KeyValuePair("GATHERING_BATTLE_TYPE", 1); + + public static readonly KeyValuePair GATHERING_BATTLE_TORNAMENT_TYPE = new KeyValuePair("GATHERING_BATTLE_TORNAMENT_TYPE", 0); + + public static readonly KeyValuePair GATHERING_IS_RESET = new KeyValuePair("GATHERING_IS_RESET", 0); + + public static readonly KeyValuePair GATHERING_BATTLE_STYLE = new KeyValuePair("GATHERING_BATTLE_STYLE", 1); + + public static readonly KeyValuePair GATHERING_MAX_MEMBER = new KeyValuePair("GATHERING_MAX_MEMBER", 2); + + public static readonly KeyValuePair GATHERING_FORMAT = new KeyValuePair("GATHERING_FORMAT", 0); + + public static readonly KeyValuePair GATHERING_BATTLE_HOUR = new KeyValuePair("GATHERING_BATTLE_HOUR", 1); + + public static readonly KeyValuePair GATHERING_OWNER_ENTRY_BATTLE = new KeyValuePair("GATHERING_OWNER_ENTRY_BATTLE", 1); + + public static readonly KeyValuePair GATHERING_IS_ENTRY_DECK_ONLY = new KeyValuePair("GATHERING_IS_ENTRY_DECK_ONLY", 1); + + public static readonly KeyValuePair GATHERING_WATCH_SETTING = new KeyValuePair("GATHERING_WATCH_SETTING", 1); + + public static readonly KeyValuePair BATTLE_PASS_SHOW_RESULT = new KeyValuePair("BATTLE_PASS_SHOW_RESULT", TRUE); + + public static readonly KeyValuePair BATTLE_PASS_LAST_TIPS_LEASON = new KeyValuePair("BATTLE_PASS_LAST_TIPS_LEASON", -1); + + public static readonly KeyValuePair PREMIUM_PASS_APPEAL_LAST_SEASON = new KeyValuePair("PREMIUM_PASS_APPEAL_LAST_SEASON", -1); + + public static readonly KeyValuePair PREMIUM_PASS_APPEAL_LAST_LEVEL = new KeyValuePair("PREMIUM_PASS_APPEAL_LAST_LEVEL", -1); + + public static readonly KeyValuePair COMPETITION_JOIN_BUTTON_LATEST_ID = new KeyValuePair("COMPETITION_JOIN_BUTTON_LATEST_ID", -1); + + public static readonly KeyValuePair SELF_DISCONNECT_OPEN_STATUS_TO_REPLACE_LOG = new KeyValuePair("SELF_DISCONNECT_OPEN_STATUS_TO_REPLACE_LOG", -1f); + + public static readonly KeyValuePair ANDROID_ALARM_REMINDER_ENABLE = new KeyValuePair("ANDROID_ALARM_REMINDER_ENABLE", 1); + + public static readonly KeyValuePair ANDROID_ALARM_RIMINDER_SETTING = new KeyValuePair("ANDROID_ALARM_RIMINDER_SETTING", 1); + + public static readonly string STORY_BATTLE_LOSE_COUNT = "STORY_BATTLE_LOSE_COUNT"; + + public static readonly KeyValuePair SMALL_RESOURCE_STATUS = new KeyValuePair("SMALL_RESOURCE_STATUS", 0); + + public static readonly KeyValuePair DECK_INTRO_IS_MYROTATION_COPY_EQUAL_PERIOD = new KeyValuePair("DECK_INTRO_IS_MYROTATION_COPY_EQUAL_PERIOD", 0); + + public static readonly KeyValuePair DECK_INTRO_IS_MYROTATION_COPY_NOT_EQUAL_PERIOD = new KeyValuePair("DECK_INTRO_IS_MYROTATION_COPY_NOT_EQUAL_PERIOD", 1); + + public static readonly KeyValuePair IS_SECTION20_WERUSA_ANIMATION_PLAYED = new KeyValuePair("IS_SECTION_20_WERUSA_ANIMATION_PLAYED", FALSE); + + public static readonly KeyValuePair IS_SECTION20_NATERA_ANIMATION_PLAYED = new KeyValuePair("IS_SECTION_20_NATERA_ANIMATION_PLAYED", FALSE); + + public static bool GetBool(KeyValuePair id) + { + return PlayerPrefs.GetInt(id.Key, id.Value) == TRUE; + } + + public static bool GetValue(KeyValuePair id) + { + return PlayerPrefs.GetInt(id.Key, id.Value ? TRUE : FALSE) == TRUE; + } + + public static int GetValue(KeyValuePair id) + { + return PlayerPrefs.GetInt(id.Key, id.Value); + } + + public static float GetValue(KeyValuePair id) + { + return PlayerPrefs.GetFloat(id.Key, id.Value); + } + + public static string GetValue(KeyValuePair id) + { + return PlayerPrefs.GetString(id.Key, id.Value); + } + + public static void SetBool(KeyValuePair id, bool flag) + { + PlayerPrefs.SetInt(id.Key, flag ? TRUE : FALSE); + } + + public static void SetValue(KeyValuePair id, bool flag) + { + PlayerPrefs.SetInt(id.Key, flag ? TRUE : FALSE); + } + + public static void SetValue(KeyValuePair id, int value) + { + PlayerPrefs.SetInt(id.Key, value); + } + + public static void SetValue(KeyValuePair id, float value) + { + PlayerPrefs.SetFloat(id.Key, value); + } + + public static void SetValue(KeyValuePair id, string value) + { + PlayerPrefs.SetString(id.Key, value); + } + + public static void ConvertOldStageIdListToNewStageIdList() + { + int value = GetValue(OFF_STAGE); + if (value == 0) + { + return; + } + bool[] array = new bool[Data.Load.data.OpenBattleFieldIdList.Count]; + string[] array2 = new string[12] + { + "1", "2", "3", "4", "5", "6", "7", "10", "18", "30", + "31", "1005" + }; + new List(); + int num = value; + int num2 = 1; + for (int i = 0; i < array2.Length; i++) + { + if ((num & num2) != 0) + { + for (int j = 0; j < Data.Load.data.OpenBattleFieldIdList.Count; j++) + { + if (array2[i] == Data.Load.data.OpenBattleFieldIdList[j].ToString()) + { + array[j] = true; + break; + } + } + } + num2 *= 2; + } + SetValue(OFF_STAGE, 0); + SetValue(OFF_STAGE_ID, ConvertStageIdListToSaveData(array)); + } + + public static void TurnOnFirsStageIfStageIdListAllOff() + { + List list = CreateStageOffList(); + for (int i = 0; i < Data.Load.data.OpenBattleFieldIdList.Count; i++) + { + if (!list.Contains(int.Parse(Data.Load.data.OpenBattleFieldIdList[i]))) + { + return; + } + } + bool[] array = new bool[Data.Load.data.OpenBattleFieldIdList.Count]; + array[0] = false; + for (int j = 1; j < Data.Load.data.OpenBattleFieldIdList.Count; j++) + { + array[j] = true; + } + SetValue(OFF_STAGE_ID, ConvertStageIdListToSaveData(array)); + } + + public static string ConvertStageIdListToSaveData(bool[] indexs) + { + string text = ""; + for (int i = 0; i < Data.Load.data.OpenBattleFieldIdList.Count; i++) + { + if (indexs[i]) + { + text = text + Data.Load.data.OpenBattleFieldIdList[i] + ","; + } + } + return text; + } + + public static List CreateServerSendStageOffList() + { + TurnOnFirsStageIfStageIdListAllOff(); + return CreateStageOffList(); + } + + private static List CreateStageOffList() + { + string[] array = GetValue(OFF_STAGE_ID).Split(','); + List list = new List(); + int result = 0; + for (int i = 0; i < array.Length; i++) + { + if (int.TryParse(array[i], out result)) + { + list.Add(result); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlayerStaticData.cs b/SVSim.BattleEngine/Engine/Wizard/PlayerStaticData.cs new file mode 100644 index 0000000..ffe2921 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlayerStaticData.cs @@ -0,0 +1,820 @@ +using System; +using System.Collections.Generic; +using Cute; +using LitJson; +using UnityEngine; + +namespace Wizard; + +public class PlayerStaticData : MonoBehaviour +{ + public class UserTex + { + public enum Type + { + Emblem, + RankIcon, + Country + } + + public Texture[] m_loadedList; + + public List[] m_requiredAttachList; + + public List m_unloadList = new List(); + + private readonly Type m_type; + + private readonly int m_sizeDiffNum; + + public int m_loadingCnt; + + public Format Format; + + private List _rankIconPathList = new List(); + + public UserTex(Type type) + { + m_type = type; + m_sizeDiffNum = GetSizeDiffNum(m_type); + m_loadedList = new Texture[m_sizeDiffNum]; + m_requiredAttachList = new List[m_sizeDiffNum]; + for (int i = 0; i < m_requiredAttachList.Length; i++) + { + m_requiredAttachList[i] = new List(); + } + } + + public void LoadTexture() + { + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + List pathList = null; + if (m_type == Type.RankIcon) + { + pathList = GetRankTexturePath(); + for (int i = 0; i < m_sizeDiffNum; i++) + { + m_loadedList[i] = null; + } + } + else + { + for (int j = 0; j < m_sizeDiffNum; j++) + { + m_loadedList[j] = null; + m_loadingCnt++; + string texturePath = GetTexturePath(GetTextureName(), j); + if (pathList == null) + { + pathList = new List(); + } + pathList.Add(texturePath); + } + } + resourcesManager.StartCoroutine_LoadAssetGroupSync(pathList, delegate + { + m_loadingCnt = 0; + UpdateTexture(); + UnloadTexture(); + if (m_type == Type.RankIcon) + { + _rankIconPathList.AddRange(pathList); + } + }); + } + + private List GetRankTexturePath() + { + List list = new List(); + GetRankTexturePathSub(Format.Unlimited, list); + GetRankTexturePathSub(Format.Rotation, list); + m_loadingCnt += list.Count; + return list; + } + + private static void GetRankTexturePathSub(Format format, List list) + { + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(UserRank(format).ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_S)); + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(UserRank(format).ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_L)); + } + + public void ReLoadTexture(string oldId, string newId) + { + if (m_type != Type.RankIcon && !string.IsNullOrEmpty(oldId) && !m_unloadList.Contains(oldId)) + { + m_unloadList.Add(oldId); + } + if (!string.IsNullOrEmpty(newId)) + { + m_unloadList.Remove(newId); + LoadTexture(); + return; + } + for (int i = 0; i < m_sizeDiffNum; i++) + { + m_loadedList[i] = null; + } + } + + public void AttachTexture(UITexture uiTexture, int size) + { + if (m_loadingCnt == 0) + { + uiTexture.mainTexture = m_loadedList[size]; + } + else + { + m_requiredAttachList[size].Add(uiTexture); + } + } + + private void UpdateTexture() + { + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + for (int i = 0; i < m_sizeDiffNum; i++) + { + Texture mainTexture = (m_loadedList[i] = resourcesManager.LoadObject(GetTexturePath(GetTextureName(), i, isfetch: true)) as Texture); + List list = m_requiredAttachList[i]; + foreach (UITexture item in list) + { + item.mainTexture = mainTexture; + } + list.Clear(); + } + } + + private void UnloadTexture() + { + List list = new List(); + foreach (string unload in m_unloadList) + { + for (int i = 0; i < m_sizeDiffNum; i++) + { + list.Add(GetTexturePath(unload, i)); + } + } + m_unloadList.Clear(); + list.AddRange(_rankIconPathList); + _rankIconPathList.Clear(); + Toolbox.ResourcesManager.RemoveAssetGroup(list); + } + + private static int GetSizeDiffNum(Type type) + { + return type switch + { + Type.Emblem => 2, + Type.RankIcon => 2, + Type.Country => 2, + _ => 0, + }; + } + + private string GetTexturePath(string name, int sizeId, bool isfetch = false) + { + int num = 0; + switch (m_type) + { + case Type.Emblem: + num = 42; + break; + case Type.RankIcon: + num = 49; + break; + case Type.Country: + num = 51; + break; + } + return Toolbox.ResourcesManager.GetAssetTypePath(name, (ResourcesManager.AssetLoadPathType)(num + sizeId), isfetch); + } + + private string GetTextureName() + { + return m_type switch + { + Type.Emblem => UserEmblemID.ToString(), + Type.RankIcon => (GameMgr.GetIns().GetDataMgr().IsDipslayHighRankFormat() ? UserRankHighAllFormat() : UserRank(Format)).ToString("00"), + Type.Country => UserCountryCode, + _ => "", + }; + } + } + + public enum EmblemTexSize + { + S, + M, + MAX + } + + public enum RankTexSize + { + S, + L, + MAX + } + + public enum CountryTexSize + { + S, + M, + MAX + } + + public enum AgreementState + { + Agreed, + NotAgree, + Reset + } + + public enum LootBoxType + { + GACHA, + TWOPICK, + SEALED, + COLOSSEUM, + COMPETITION, + SPECIAL_CRYSTAL, + MAX + } + + public static AgreementState _tosAgreementState = AgreementState.NotAgree; + + public static AgreementState _privacyPolicyAgreementState = AgreementState.NotAgree; + + private static UserTex UserEmblemTexture = new UserTex(UserTex.Type.Emblem); + + private static UserTex UserCountryTexture = new UserTex(UserTex.Type.Country); + + private static UserTex UserRankTexture = new UserTex(UserTex.Type.RankIcon); + + public static TimeData UserTime = new TimeData(); + + public static int UserViewerID => Certification.ViewerId; + + public static string UserName + { + get + { + if (Data.Load.data == null) + { + return ""; + } + return Data.Load.data._userInfo.name; + } + set + { + Data.Load.data._userInfo.name = value; + } + } + + public static string UserRegionCode => PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.CURRENT_REGION_CODE); + + public static bool IsOfficialUser { get; set; } + + public static bool IsOfficialUserDisplay { get; set; } + + public static AgreementState KorAuthorityAgreementState { get; set; } = AgreementState.NotAgree; + + public static int UserCrystalCount + { + get + { + if (Data.Load.data == null) + { + return 0; + } + return Data.Load.data._userCrystalCount.total_crystal; + } + set + { + Data.Load.data._userCrystalCount.total_crystal = value; + } + } + + public static int UserRupyCount + { + get + { + if (Data.Load.data == null) + { + return 0; + } + return Data.Load.data._userCrystalCount.rupy; + } + set + { + Data.Load.data._userCrystalCount.rupy = value; + } + } + + public static int UserRedEtherCount + { + get + { + if (Data.Load.data == null) + { + return 0; + } + return Data.Load.data._userCrystalCount.red_ether; + } + set + { + Data.Load.data._userCrystalCount.red_ether = value; + } + } + + public static int UserSpotCardPointCount + { + get + { + if (Data.Load.data == null) + { + return 0; + } + return Data.Load.data._userCrystalCount._spotcardPoint; + } + set + { + Data.Load.data._userCrystalCount._spotcardPoint = value; + } + } + + public static int UserOrbNum + { + get + { + return GetItemNum(1000); + } + set + { + UpdateItemNum(1000, value); + } + } + + public static int UserChallengeTicketNum + { + get + { + return GetItemNum(1); + } + set + { + UpdateItemNum(1, value); + } + } + + public static int UserColosseumTicketNum + { + get + { + return GetItemNum(2); + } + set + { + UpdateItemNum(2, value); + } + } + + public static long UserEmblemID + { + get + { + return Data.Load.data._userInfo.selected_emblem_id; + } + set + { + UserInfo userInfo = Data.Load.data._userInfo; + long selected_emblem_id = userInfo.selected_emblem_id; + if (selected_emblem_id != value) + { + userInfo.selected_emblem_id = value; + UserEmblemTexture.ReLoadTexture(selected_emblem_id.ToString(), value.ToString()); + } + } + } + + public static int UserDegreeID + { + get + { + return Data.Load.data._userInfo.selected_degree_id; + } + set + { + Data.Load.data._userInfo.selected_degree_id = value; + } + } + + public static string UserCountryCode + { + get + { + return Data.Load.data._userInfo.country_code; + } + set + { + UserInfo userInfo = Data.Load.data._userInfo; + string country_code = userInfo.country_code; + if (country_code != value) + { + userInfo.country_code = value; + UserCountryTexture.ReLoadTexture(country_code, value); + } + } + } + + public static bool UserPromotionFlag + { + get + { + return Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.is_promotion; + } + set + { + Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.is_promotion = value; + } + } + + public static int UserPromotionMatchCount + { + get + { + return Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.match_count; + } + set + { + Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.match_count = value; + } + } + + public static int UserPromotionWinCount + { + get + { + return Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.win; + } + set + { + Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.win = value; + } + } + + public static int UserPromotionLoseCount + { + get + { + return Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.lose; + } + set + { + Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.lose = value; + } + } + + public static string UserBirthDay + { + get + { + return Data.Load.data._userInfo.birth_day; + } + set + { + Data.Load.data._userInfo.birth_day = value; + } + } + + public static bool IsLootBoxRegulation(LootBoxType type) + { + return Data.Load.data.LootBoxReguration[(int)type]; + } + + public static bool IsPurchaseNotificationOfLootBox() + { + for (int i = 0; i < 6; i++) + { + if (IsLootBoxRegulation((LootBoxType)i)) + { + return true; + } + } + return false; + } + + public static int GetItemNum(int itemId) + { + if (Data.Load.data._userItemDict == null) + { + return 0; + } + if (Data.Load.data._userItemDict.ContainsKey(itemId)) + { + return Data.Load.data._userItemDict[itemId]; + } + return 0; + } + + public static void InitializeItemNum(int itemId, int num) + { + UpdateItemNum(itemId, num); + } + + public static void UpdateItemNum(int itemId, int num) + { + if (Data.Load.data._userItemDict == null) + { + Data.Load.data._userItemDict = new Dictionary(); + } + if (Data.Load.data._userItemDict.ContainsKey(itemId)) + { + Data.Load.data._userItemDict[itemId] = num; + } + else + { + Data.Load.data._userItemDict.Add(itemId, num); + } + } + + public static void Clear() + { + UserEmblemTexture = new UserTex(UserTex.Type.Emblem); + UserCountryTexture = new UserTex(UserTex.Type.Country); + UserRankTexture = new UserTex(UserTex.Type.RankIcon); + } + + public static void LoadUserEmblemTexture() + { + UserEmblemTexture.LoadTexture(); + } + + public static void AttachUserEmblemTexture(UITexture uiTexture, EmblemTexSize size) + { + UserEmblemTexture.AttachTexture(uiTexture, (int)size); + } + + public static void LoadUserCountryTexture() + { + if (!string.IsNullOrEmpty(UserCountryCode)) + { + UserCountryTexture.LoadTexture(); + } + } + + public static void AttachUserCountryTexture(UITexture uiTexture, CountryTexSize size) + { + UserCountryTexture.AttachTexture(uiTexture, (int)size); + } + + public static int UserBattlePointCurrentFormat() + { + return UserBattlePoint(Data.CurrentFormat); + } + + public static int UserBattlePoint(Format inFormat) + { + return Data.Load.data._userRank[(int)inFormat].battle_point; + } + + public static int UserBattlePointHighFormat() + { + int val = UserBattlePoint(Format.Rotation); + int val2 = UserBattlePoint(Format.Unlimited); + return Math.Max(val, val2); + } + + public static int UserMasterPointCurrentFormat() + { + return UserMasterPoint(Data.CurrentFormat); + } + + public static int UserMasterPoint(Format inFormat) + { + return Data.Load.data._userRank[(int)inFormat].master_point; + } + + public static int UserMasterPointHighAllFormat() + { + return UserMasterPoint(HighRankFormat()); + } + + public static Format HighRankFormat() + { + int num = UserRank(Format.Rotation); + int num2 = UserRank(Format.Unlimited); + if (num == num2) + { + int num3 = UserBattlePoint(Format.Rotation); + int num4 = UserBattlePoint(Format.Unlimited); + if (IsMasterRank(Format.Rotation)) + { + num3 = UserMasterPoint(Format.Rotation); + num4 = UserMasterPoint(Format.Unlimited); + } + if (num3 <= num4) + { + return Format.Unlimited; + } + return Format.Rotation; + } + if (num <= num2) + { + return Format.Unlimited; + } + return Format.Rotation; + } + + public static int UserBattlePointEachRankCurrentFormat() + { + return UserBattlePointEachRank(Data.CurrentFormat); + } + + public static int UserBattlePointEachRank(Format inFormat) + { + if (IsMasterRank(inFormat)) + { + return Data.Load.data._userRank[(int)inFormat].grandMasterData.currentMasterPoint; + } + int num = ((!Data.Load.data.IsStartRank(inFormat, UserRank(inFormat))) ? Data.Load.data.GetRankInfo(inFormat, UserRank(inFormat) - 1).accumulate_point : 0); + return UserBattlePoint(inFormat) - num; + } + + public static int UserRankCurrentFormat() + { + return UserRank(Data.CurrentFormat); + } + + public static int UserRank(Format inFormat) + { + if (inFormat == Format.PreRotation) + { + inFormat = Format.Rotation; + } + if (Data.Load.data == null) + { + return 0; + } + return Data.Load.data._userRank[(int)inFormat].rank; + } + + public static int UserRankHighAllFormat() + { + int val = UserRank(Format.Rotation); + int val2 = UserRank(Format.Unlimited); + return Math.Max(val, val2); + } + + public static void LoadUserRankTexture(Format inFormat) + { + UserRankTexture.Format = inFormat; + UserRankTexture.LoadTexture(); + } + + public static void ReLoadUserRankTexture(string inOldId, string inNewId, Format inFormat) + { + UserRankTexture.Format = inFormat; + UserRankTexture.ReLoadTexture(inOldId, inNewId); + } + + public static void AttachUserRankTexture(UITexture uiTexture, RankTexSize size) + { + UserRankTexture.AttachTexture(uiTexture, (int)size); + } + + public static bool IsMasterRankCurrentFormat() + { + return IsMasterRank(Data.CurrentFormat); + } + + public static bool IsMasterRank(Format inFormat) + { + return Data.Load.data._userRank[(int)inFormat].is_master_rank; + } + + public static bool IsGrandMasterRankCurrentFormat() + { + return IsGrandMasterRank(Data.CurrentFormat); + } + + public static bool IsGrandMasterRank(Format inFormat) + { + return Data.Load.data._userRank[(int)inFormat].is_grand_master_rank; + } + + public static bool IsMaxRank(Format inFormat) + { + List rankInfoRawList = Data.Load.data.GetRankInfoRawList(inFormat); + return UserRank(inFormat) >= rankInfoRawList[rankInfoRawList.Count - 1].RankId; + } + + public static int UserNextRankExp(Format inFormat) + { + if (IsMasterRank(inFormat)) + { + return Data.Load.data._userRank[(int)inFormat].grandMasterData.targetMasterPoint; + } + return Mathf.Max(0, Data.Load.data.GetRankInfo(inFormat, UserRank(inFormat)).necessary_point - UserBattlePointEachRank(inFormat)); + } + + public static bool UserPromotionIsWin(int matchNum) + { + return (Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match.battle_result >> matchNum) % 2 != 0; + } + + public static void UpdateHaveUserGoodsNumByJsonData(JsonData userGoodsList) + { + for (int i = 0; i < userGoodsList.Count; i++) + { + JsonData jsonData = userGoodsList[i]; + UserGoods.Type type = (UserGoods.Type)jsonData["reward_type"].ToInt(); + long userGoodsId = jsonData["reward_id"].ToLong(); + int num = jsonData["reward_num"].ToInt(); + UpdateHaveUserGoodsNum(type, userGoodsId, num); + } + } + + public static void UpdateHaveUserGoodsNum(UserGoods.Type type, long userGoodsId, int num) + { + switch (type) + { + case UserGoods.Type.RedEther: + UserRedEtherCount = num; + break; + case UserGoods.Type.Crystal: + UserCrystalCount = num; + if (MyPageMenu.Instance != null) + { + MyPageMenu.Instance.UpdateCrystalCount(); + } + break; + case UserGoods.Type.Item: + UpdateItemNum((int)userGoodsId, num); + break; + case UserGoods.Type.Card: + { + int cardId = (int)userGoodsId; + GameMgr.GetIns().GetDataMgr().UpdateUserOwnCardData(cardId, num); + break; + } + case UserGoods.Type.SpotCard: + case UserGoods.Type.SpotCardOnlyLatestCardPack: + { + int cardId = (int)userGoodsId; + GameMgr.GetIns().GetDataMgr().SpotCardData.SetSpotCardNum(cardId, num); + break; + } + case UserGoods.Type.Rupy: + UserRupyCount = num; + if (MyPageMenu.Instance != null) + { + MyPageMenu.Instance.UpdateRupyCount(); + } + break; + case UserGoods.Type.Skin: + GameMgr.GetIns().GetDataMgr().GetCharaPrmBySkinId((int)userGoodsId)?.Acquired(); + break; + case UserGoods.Type.Sleeve: + Data.Master.SleeveMgr.Acquired(userGoodsId); + break; + case UserGoods.Type.Emblem: + Data.Master.EmblemMgr.Acquired(userGoodsId); + break; + case UserGoods.Type.Degree: + Data.Master.DegreeMgr.Acquired((int)userGoodsId); + break; + case UserGoods.Type.SpotCardPoint: + UserSpotCardPointCount = num; + break; + case UserGoods.Type.MyPageBG: + Data.Load.data.AcquiredMyPageBGList.Add(userGoodsId.ToString()); + break; + case (UserGoods.Type)3: + case UserGoods.Type.FreeGachaCount: + break; + } + } + + public static int GetHaveUserGoods(UserGoods.Type type, long userGoodsId) + { + int result = 0; + switch (type) + { + case UserGoods.Type.RedEther: + result = UserRedEtherCount; + break; + case UserGoods.Type.Crystal: + result = UserCrystalCount; + break; + case UserGoods.Type.Item: + result = GetItemNum((int)userGoodsId); + break; + case UserGoods.Type.Rupy: + result = UserRupyCount; + break; + case UserGoods.Type.SpotCardPoint: + result = UserSpotCardPointCount; + break; + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlayptnBonusPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/PlayptnBonusPolicyCollection.cs new file mode 100644 index 0000000..66f1d1e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlayptnBonusPolicyCollection.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class PlayptnBonusPolicyCollection : AIPolicyCollection +{ + public float GetPlayptnBonus(AIVirtualField field, List playPtn) + { + if (!base.HasPolicy) + { + return 0f; + } + float num = 0f; + AIVirtualCard allyClass = field.AllyClass; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(allyClass, playPtn, field, null)) + { + num += aIPolicyData.EvalArg(allyClass, playPtn, field); + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PolicyCollectionWithSingleType.cs b/SVSim.BattleEngine/Engine/Wizard/PolicyCollectionWithSingleType.cs new file mode 100644 index 0000000..7d38bd5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PolicyCollectionWithSingleType.cs @@ -0,0 +1,40 @@ +namespace Wizard; + +public class PolicyCollectionWithSingleType : PolicyCollectionWithTypeBase +{ + private AIPolicyType _policyType; + + public PolicyCollectionWithSingleType(AIPolicyType policyType, AIPolicyCollection policyCollection) + { + _policyType = policyType; + base.PolicyCollection = policyCollection; + } + + public override bool IsUnderManagement(AIPolicyType type) + { + return _policyType == type; + } + + public override void AddPolicy(AIPolicyData policy) + { + if (_policyType == policy.PolicyType) + { + base.PolicyCollection.AddPolicy(policy); + } + } + + public override bool HasTag(AIPolicyType type) + { + if (IsUnderManagement(type)) + { + return base.PolicyCollection.HasPolicy; + } + return false; + } + + public override bool RemovePolicyAndCheckIsNoLongerHoldThisType(AIPolicyData policy) + { + base.PolicyCollection.RemovePolicy(policy); + return !base.PolicyCollection.HasPolicy; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PolicyCollectionWithTypeCreator.cs b/SVSim.BattleEngine/Engine/Wizard/PolicyCollectionWithTypeCreator.cs new file mode 100644 index 0000000..378df4f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PolicyCollectionWithTypeCreator.cs @@ -0,0 +1,75 @@ +namespace Wizard; + +public static class PolicyCollectionWithTypeCreator +{ + public static PolicyCollectionWithTypeBase Create(AIPolicyType type) + { + AIPolicyCollection aIPolicyCollection = null; + switch (type) + { + case AIPolicyType.AllyPlayBonus: + aIPolicyCollection = new AllyPlayBonusPolicyCollection(); + break; + case AIPolicyType.AllyPlayBonusRate: + aIPolicyCollection = new AllyPlayBonusRatePolicyCollection(); + break; + case AIPolicyType.DisableLethalCheck: + aIPolicyCollection = new DisableLethalCheckPolicyCollection(); + break; + case AIPolicyType.EpValue: + aIPolicyCollection = new EpValuePolicyCollection(); + break; + case AIPolicyType.ModUnitRate: + aIPolicyCollection = new ModUnitRatePolicyCollection(); + break; + case AIPolicyType.UnitBonus: + aIPolicyCollection = new UnitBonusPolicyCollection(); + break; + case AIPolicyType.PlayptnBonus: + aIPolicyCollection = new PlayptnBonusPolicyCollection(); + break; + case AIPolicyType.BarrierBonus: + aIPolicyCollection = new BarrierBonusPolicyCollection(); + break; + case AIPolicyType.PlayBreak: + aIPolicyCollection = new PlayBreakPolicyCollection(); + break; + case AIPolicyType.EmoOnTurnEnd: + aIPolicyCollection = new EmoOnTurnEndPolicyCollection(); + break; + case AIPolicyType.EmoOnTurnStart: + aIPolicyCollection = new EmoOnTurnStartPolicyCollection(); + break; + case AIPolicyType.DelayTurnEndTime: + aIPolicyCollection = new AIDelayTurnEndTimePolicyCollection(); + break; + case AIPolicyType.EmoOnLeaderDamaged: + aIPolicyCollection = new EmoOnLeaderDamagedPolicyCollection(); + break; + case AIPolicyType.SetReferenceId: + aIPolicyCollection = new SetReferenceIdPolicyCollection(); + break; + case AIPolicyType.SetReferenceTribe: + aIPolicyCollection = new SetReferenceTribePolicyCollection(); + break; + case AIPolicyType.PlayerEmoOnTurnEnd: + aIPolicyCollection = new PlayerEmoOnTurnEndPolicyCollection(); + break; + case AIPolicyType.PlayerEmoOnTurnStart: + aIPolicyCollection = new PlayerEmoOnTurnStartPolicyCollection(); + break; + case AIPolicyType.PlayerEmoOnLeaderDamaged: + aIPolicyCollection = new PlayerEmoOnLeaderDamagedPolicyCollection(); + break; + case AIPolicyType.MoveFirstBonus: + aIPolicyCollection = new MoveFirstBonusPolicyCollection(); + break; + case AIPolicyType.GameStartAttachTag: + aIPolicyCollection = new GameStartAttachTagPolicyCollection(); + break; + default: + return null; + } + return new PolicyCollectionWithSingleType(type, aIPolicyCollection); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PracticeData.cs b/SVSim.BattleEngine/Engine/Wizard/PracticeData.cs new file mode 100644 index 0000000..7e2d811 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PracticeData.cs @@ -0,0 +1,66 @@ +using LitJson; + +namespace Wizard; + +public class PracticeData +{ + public int ID { get; private set; } + + public string Text { get; private set; } + + public int ClassId { get; private set; } + + public int CharaId { get; private set; } + + public int DegreeId { get; private set; } + + public int AIDeckLevel { get; private set; } + + public int AILogicLevel { get; private set; } + + public int AIMaxLife { get; private set; } + + public int Battle3dFieldId { get; private set; } + + public bool IsMaintenance { get; private set; } + + public bool IsCampaign { get; private set; } + + public PracticeData(JsonData data) + { + ID = data["practice_id"].ToInt(); + Text = Data.Master.GetPracticeText(data["text_id"].ToString()); + ClassId = data["class_id"].ToInt(); + CharaId = data["chara_id"].ToInt(); + DegreeId = data["degree_id"].ToInt(); + AIDeckLevel = data["ai_deck_level"].ToInt(); + AILogicLevel = data["ai_logic_level"].ToInt(); + AIMaxLife = data["ai_max_life"].ToInt(); + IsCampaign = data["is_campaign_practice"].ToBoolean(); + if (IsCampaign) + { + Text = Data.SystemText.Get("Mission_0080") + Text; + } + int.TryParse(data["battle3dfield_id"].ToString(), out var result); + Battle3dFieldId = result; + IsMaintenance = data["is_maintenance"] != null && data["is_maintenance"].ToBoolean(); + if (IsMaintenance) + { + Text = Text + " " + Data.Master.GetPracticeText("Practice_Maintenance"); + } + } + + public PracticeData(int id, string text, int classId, int charaId, int degreeId, int aiDeckLevel, int aiLogicLevel, int aiMaxlife) + { + ID = id; + Text = text; + ClassId = classId; + CharaId = charaId; + DegreeId = degreeId; + AIDeckLevel = aiDeckLevel; + AILogicLevel = aiLogicLevel; + AIMaxLife = aiMaxlife; + Battle3dFieldId = 1; + IsMaintenance = false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PracticeDataMgr.cs b/SVSim.BattleEngine/Engine/Wizard/PracticeDataMgr.cs new file mode 100644 index 0000000..a9e6317 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PracticeDataMgr.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using System.Linq; +using LitJson; + +namespace Wizard; + +public class PracticeDataMgr +{ + private List _dataList = new List(); + + public List CampaignClassIdList { get; private set; } = new List(); + + public PracticeDataMgr(JsonData data) + { + if (data == null) + { + return; + } + for (int i = 0; i < data.Count; i++) + { + _dataList.Add(new PracticeData(data[i])); + } + foreach (PracticeData data2 in _dataList) + { + if (data2.IsCampaign && !CampaignClassIdList.Contains(data2.ClassId)) + { + CampaignClassIdList.Add(data2.ClassId); + } + } + } + + public List GetClassDataList(int classId) + { + return _dataList.Where((PracticeData data) => data.ClassId == classId).ToList(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PracticeFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/PracticeFinishTask.cs new file mode 100644 index 0000000..1957536 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PracticeFinishTask.cs @@ -0,0 +1,88 @@ +using System.Collections.Generic; +using LitJson; +using Wizard.Battle.Recovery; + +namespace Wizard; + +public class PracticeFinishTask : BaseTask +{ + public class PracticeFinishTaskParam : BaseParam + { + public int deck_no; + + public int is_win; + + public int evolve_count; + + public int total_turn; + + public int enemy_class_id; + + public int difficulty; + + public int deck_format; + + public int class_id; + + public Dictionary mission; + + public string recovery_data; + + public string[] prosessing_time_data; + } + + public PracticeFinishTask() + { + base.type = ApiType.Type.PracticeFinish; + } + + public void SetParameter(int deck_no, int is_win, int evolve_count, int total_turn, int enemy_class_id, int difficulty, Format format, int class_id) + { + BattleManagerBase ins = BattleManagerBase.GetIns(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + PracticeFinishTaskParam practiceFinishTaskParam = new PracticeFinishTaskParam + { + deck_no = deck_no, + is_win = is_win, + evolve_count = evolve_count, + total_turn = total_turn, + enemy_class_id = enemy_class_id, + difficulty = difficulty, + deck_format = Data.FormatConvertApi(format), + class_id = class_id + }; + if (dataMgr.RecoveryData == null) + { + dataMgr.SetRecoveryData(RecoveryOperationInfo.ReadRecoveryFile(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json")); + } + practiceFinishTaskParam.recovery_data = dataMgr.RecoveryData.ToJson(); + BattlePlayerPair battlePlayerPair = ins.GetBattlePlayerPair(isPlayer: true); + BattleCardBase selfClass = ins.GetBattlePlayer(isPlayer: true).Class; + practiceFinishTaskParam.mission = dataMgr.MissionNecessaryInformation.GetMissionNecessaryInfo(battlePlayerPair, selfClass); + base.Params = practiceFinishTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + DeleteRecoveryFileIfBattleAlreadyEnded(num); + return num; + } + Data.PracticeFinish.data = new PracticeFinishDetail(); + Data.PracticeFinish.data._responseData = base.ResponseData; + Data.PracticeFinish.data.class_chara_experience = 0; + Data.PracticeFinish.data.class_chara_level = 0; + Data.PracticeFinish.data.get_class_chara_experience = base.ResponseData["data"]["get_class_experience"].ToInt(); + Data.PracticeFinish.data.class_chara_experience = base.ResponseData["data"]["class_experience"].ToInt(); + Data.PracticeFinish.data.class_chara_level = base.ResponseData["data"]["class_level"].ToInt(); + JsonData jsonData = base.ResponseData["data"]["achieved_info"]; + if (jsonData.GetJsonType() == JsonType.Object) + { + Data.PracticeFinish.data.AchievedInfo.Read(jsonData); + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleMissionData.cs b/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleMissionData.cs new file mode 100644 index 0000000..513f9fb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleMissionData.cs @@ -0,0 +1,32 @@ +using LitJson; + +namespace Wizard; + +public class PracticePuzzleMissionData +{ + public string Name { get; private set; } + + public UserGoods.Type UserGoodsType { get; private set; } + + public long ItemId { get; private set; } + + public int ItemCount { get; private set; } + + public int CurrentClearCount { get; private set; } + + public int TotalMissionCount { get; private set; } + + public bool IsCleared { get; private set; } + + public PracticePuzzleMissionData(JsonData json) + { + Name = json["mission_name"].ToString(); + JsonData jsonData = json["reward_list"][0]; + UserGoodsType = (UserGoods.Type)jsonData["reward_type"].ToInt(); + ItemId = jsonData["reward_detail_id"].ToLong(); + ItemCount = jsonData["reward_number"].ToInt(); + CurrentClearCount = json["total_count"].ToInt(); + TotalMissionCount = json["require_number"].ToInt(); + IsCleared = json["is_achieved"].ToBoolean(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PremiumCardConversionTask.cs b/SVSim.BattleEngine/Engine/Wizard/PremiumCardConversionTask.cs new file mode 100644 index 0000000..f4fce1a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PremiumCardConversionTask.cs @@ -0,0 +1,38 @@ +namespace Wizard; + +public class PremiumCardConversionTask : BaseTask +{ + private class PostParam : BaseParam + { + public int base_card_id; + + public int base_card_number; + + public int create_number; + } + + public PremiumCardConversionTask() + { + base.type = ApiType.Type.PremiumCardConversion; + } + + public void SetParameter(int normalCardId, int normalCardNumber) + { + PostParam postParam = new PostParam(); + postParam.base_card_id = normalCardId; + postParam.base_card_number = normalCardNumber; + postParam.create_number = 1; + base.Params = postParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Prerelease.cs b/SVSim.BattleEngine/Engine/Wizard/Prerelease.cs new file mode 100644 index 0000000..ecea47e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Prerelease.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class Prerelease +{ + public enum eStatus + { + NONE, + PRE_ROTATION, + DISPLAY_DECK_ONLY + } + + public static Prerelease Instance { get; private set; } + + public static eStatus Status { get; set; } + + public DateTime EndTime { get; private set; } + + public DateTime DisplayEndTime { get; private set; } + + public List RotationCardSetList { get; private set; } + + public List ReprintedBaseCardIds { get; private set; } + + public List LatestReprintedBaseCardIds { get; private set; } + + public int NextCardSetId { get; private set; } + + public CardMaster.CardMasterId CardMasterId { get; private set; } + + public bool IsEnableFreeMatch { get; private set; } + + public static void Create(JsonData json) + { + Instance = new Prerelease(json); + } + + public static void Clear() + { + Instance = null; + } + + private Prerelease(JsonData json) + { + ParseJsonData(json); + } + + private void ParseJsonData(JsonData data) + { + EndTime = DateTime.Parse(data["end_time"].ToString()); + DisplayEndTime = DateTime.Parse(data["display_end_time"].ToString()); + RotationCardSetList = new List(); + JsonData jsonData = data["rotation_card_set_id_list"]; + for (int i = 0; i < jsonData.Count; i++) + { + RotationCardSetList.Add(jsonData[i].ToInt()); + } + ReprintedBaseCardIds = new List(); + JsonData jsonData2 = data["reprinted_base_card_ids"]; + for (int j = 0; j < jsonData2.Count; j++) + { + ReprintedBaseCardIds.Add(jsonData2[j].ToInt()); + } + LatestReprintedBaseCardIds = new List(); + JsonData jsonData3 = data["latest_reprinted_base_card_ids"]; + for (int k = 0; k < jsonData3.Count; k++) + { + LatestReprintedBaseCardIds.Add(jsonData3[k].ToInt()); + } + NextCardSetId = data["next_card_set_id"].ToInt(); + CardMasterId = ParseCardMasterId(data["card_master_id"].ToString()); + Status = (eStatus)data["pre_release_status"].ToInt(); + IsEnableFreeMatch = data["is_pre_rotation_free_match_term"].ToInt() == 1; + } + + private CardMaster.CardMasterId ParseCardMasterId(JsonData cardMasterIdJson) + { + Enum.TryParse(cardMasterIdJson.ToString(), out var result); + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ProductDetailPlate.cs b/SVSim.BattleEngine/Engine/Wizard/ProductDetailPlate.cs new file mode 100644 index 0000000..118d929 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ProductDetailPlate.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class ProductDetailPlate : MonoBehaviour +{ + [SerializeField] + private UILabel _labelProductName; + + [SerializeField] + private UISprite _spriteClassIcon; + + [SerializeField] + private SupplyLabelPlateListUI _supplyLabelPlateList; + + public float SetProductData(string name, ClassCharacterMasterData charaData, List rewardInfoList) + { + _labelProductName.text = name; + ClassCharaPrm.SetClassLabelSetting(_labelProductName, charaData.ClassColorId); + _spriteClassIcon.spriteName = ClassCharaPrm.GetIconSpriteName(charaData.clan); + return _supplyLabelPlateList.SetSupplyList(rewardInfoList) + 30f; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PurchaseRewardDialog.cs b/SVSim.BattleEngine/Engine/Wizard/PurchaseRewardDialog.cs new file mode 100644 index 0000000..4d99011 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PurchaseRewardDialog.cs @@ -0,0 +1,439 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class PurchaseRewardDialog : MonoBehaviour +{ + public enum Layout + { + NORMAL, + TITLE_BOTTOM, + TITLE_BOTTOM_LARGE_FONT + } + + private const int LARGE_FONT_GRID_WIDTH = 275; + + private const float FLICK_MARGIN = 70f; + + private const int CARD_OBJECT_DEPTH = 23; + + private const int CARD_TEXTURE_DEPTH = 21; + + private readonly Vector3 CARDOBJECT_COLLIDER_SIZE = new Vector3(175f, 230f, 1f); + + [SerializeField] + private UIGrid _itemGrid; + + [SerializeField] + private GameObject _purchaseRewardItemOriginal; + + [SerializeField] + private int _rewardNumParPage; + + [SerializeField] + private UIButton _btnPrevPage; + + [SerializeField] + private UIButton _btnNextPage; + + [SerializeField] + private BoxCollider _flickCollider; + + [SerializeField] + private UIPageIndicator _indicator; + + [SerializeField] + private GameObject _centerLine; + + [SerializeField] + private GameObject _attachPointBottom; + + private int _currentPageIndex = 1; + + private int _lastPageIndex = 1; + + private bool _flickStart; + + private List _rewardObjectsList = new List(); + + private List _cardObjList; + + private CardDetailUI _cardDetail; + + protected List _loadedResourceList = new List(); + + private string _detailDialogTitleOverride; + + private DialogBase _dialog; + + private Layout _layout; + + private const string PATH_NORMAL_LAYOUT = "UI/layoutParts/Dialog/PurchaseRewardDialog"; + + private const string PATH_LAYOUT_10 = "UI/layoutParts/Dialog/PurchaseRewardDialog10"; + + private const string PATH_NORMAL_LAYOUT_TITLE_BOTTOM = "UI/layoutParts/Dialog/PurchaseRewardDialogTitleBottom"; + + private const string PATH_LAYOUT_10_TITLE_BOTTOM = "UI/layoutParts/Dialog/PurchaseRewardDialog10TitleBottom"; + + private const string PATH_LAYOUT_TITLE_BOTTOM_LARGE_FONT = "UI/layoutParts/Dialog/PurchaseRewardDialogTitleBottomLargeFont"; + + private bool IsFirstPage => _currentPageIndex <= 1; + + private bool IsLastPage => _currentPageIndex >= _lastPageIndex; + + private static string GetPrefabPath(List purchaseRewardsList, Layout layout) + { + switch (layout) + { + case Layout.TITLE_BOTTOM_LARGE_FONT: + return "UI/layoutParts/Dialog/PurchaseRewardDialogTitleBottomLargeFont"; + case Layout.TITLE_BOTTOM: + if (purchaseRewardsList.Count < 10) + { + return "UI/layoutParts/Dialog/PurchaseRewardDialogTitleBottom"; + } + return "UI/layoutParts/Dialog/PurchaseRewardDialog10TitleBottom"; + default: + if (purchaseRewardsList.Count < 10) + { + return "UI/layoutParts/Dialog/PurchaseRewardDialog"; + } + return "UI/layoutParts/Dialog/PurchaseRewardDialog10"; + } + } + + public static DialogBase Create(List purchaseRewardsList, CardDetailUI cardDetail, bool useLargeDetailDialog, Layout layout, GameObject attachBottomObj = null, string detailDialogTitleOverride = null, bool isPaging = false) + { + PurchaseRewardDialog component = (UnityEngine.Object.Instantiate(Resources.Load(GetPrefabPath(purchaseRewardsList, layout))) as GameObject).GetComponent(); + component.CreateDialog(); + component.Initialize(purchaseRewardsList, cardDetail, useLargeDetailDialog, attachBottomObj, detailDialogTitleOverride, isPaging, layout); + return component._dialog; + } + + private void CreateDialog() + { + _dialog = UIManager.GetInstance().CreateDialogClose(); + _dialog.SetSize(DialogBase.Size.M); + _dialog.SetTitleLabel(Data.SystemText.Get("Shop_0142")); + _dialog.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + _dialog.SetObj(base.gameObject); + } + + private void Initialize(List purchaseRewardsList, CardDetailUI cardDetail, bool useLargeDetailDialog, GameObject attachBottomObj, string detailDialogTitleOverride, bool isPaging, Layout layout) + { + _detailDialogTitleOverride = detailDialogTitleOverride; + _layout = layout; + if (attachBottomObj != null) + { + attachBottomObj.transform.parent = _attachPointBottom.transform; + attachBottomObj.transform.localPosition = Vector3.zero; + attachBottomObj.transform.localScale = Vector3.one; + } + _cardDetail = cardDetail; + InitializePage(purchaseRewardsList); + UIManager.GetInstance().createInSceneCenterLoading(); + StartCoroutine(LoadResources(purchaseRewardsList, delegate + { + SetRewards(purchaseRewardsList, useLargeDetailDialog, isPaging); + ShowPage(_currentPageIndex); + UIManager.GetInstance().closeInSceneCenterLoading(); + })); + } + + private void SetRewards(List purchaseRewardsList, bool useLargeDetailDialog, bool isPaging) + { + int count = purchaseRewardsList.Count; + for (int i = 0; i < count; i++) + { + GameObject gameObject = NGUITools.AddChild(_itemGrid.gameObject, _purchaseRewardItemOriginal.gameObject); + PurchaseRewardInfo purchaseRewardInfo = purchaseRewardsList[i]; + ShopCommonRewardInfo shopCommonRewardInfo = purchaseRewardInfo.RewardInfoList[0]; + PurchaseRewardItem component = gameObject.GetComponent(); + if (shopCommonRewardInfo.Type == 5) + { + GameObject cardObj = GetCardObj(shopCommonRewardInfo.UserGoodsId); + component.SetUserGoods(purchaseRewardInfo, useLargeDetailDialog, cardObj, isPaging, isEnableItemNumber: true); + } + else + { + component.SetUserGoods(purchaseRewardInfo, useLargeDetailDialog, null, isPaging, _layout != Layout.TITLE_BOTTOM_LARGE_FONT); + } + component.DetailDialogTitleOverride = _detailDialogTitleOverride; + _rewardObjectsList.Add(gameObject); + } + if (count <= 4) + { + float scale = ((count <= 3) ? 1.5f : 1.25f); + foreach (GameObject rewardObjects in _rewardObjectsList) + { + rewardObjects.GetComponent().SetScale(scale); + } + if (count <= 3) + { + float num = ((count == 3) ? 1.25f : 1.5f); + _itemGrid.cellWidth *= num; + _itemGrid.cellHeight *= num; + } + } + if (_layout == Layout.TITLE_BOTTOM_LARGE_FONT) + { + _itemGrid.cellWidth = 275f; + } + } + + private void InitializePage(List rewardsList) + { + _lastPageIndex = (rewardsList.Count - 1) / _rewardNumParPage + 1; + _currentPageIndex = _lastPageIndex; + for (int i = 0; i < rewardsList.Count; i++) + { + if (!rewardsList[i].IsGet) + { + _currentPageIndex = i / _rewardNumParPage + 1; + break; + } + } + _indicator.Init(_lastPageIndex); + if (_lastPageIndex > 1) + { + _flickCollider.gameObject.SetActive(value: true); + UIEventListener uIEventListener = UIEventListener.Get(_flickCollider.gameObject); + uIEventListener.onDragStart = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onDragStart, new UIEventListener.VoidDelegate(OnDragStart)); + UIEventListener uIEventListener2 = UIEventListener.Get(_flickCollider.gameObject); + uIEventListener2.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener2.onDrag, new UIEventListener.VectorDelegate(OnDrag)); + UIEventListener uIEventListener3 = UIEventListener.Get(_btnPrevPage.gameObject); + uIEventListener3.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener3.onClick, (UIEventListener.VoidDelegate)delegate + { + ShowPrevPage(); + }); + UIEventListener uIEventListener4 = UIEventListener.Get(_btnNextPage.gameObject); + uIEventListener4.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener4.onClick, (UIEventListener.VoidDelegate)delegate + { + ShowNextPage(); + }); + } + if (rewardsList.Count <= 4) + { + _itemGrid.transform.localPosition = Vector3.zero; + _itemGrid.pivot = UIWidget.Pivot.Center; + _centerLine.SetActive(value: false); + } + } + + private void ShowPage(int pageIndex) + { + _currentPageIndex = pageIndex; + for (int i = 0; i < _rewardObjectsList.Count; i++) + { + _rewardObjectsList[i].gameObject.SetActive(value: false); + } + int num = (_currentPageIndex - 1) * _rewardNumParPage; + int num2 = Mathf.Min(num + _rewardNumParPage, _rewardObjectsList.Count); + for (int j = num; j < num2; j++) + { + _rewardObjectsList[j].gameObject.SetActive(value: true); + } + _itemGrid.Reposition(); + _btnPrevPage.gameObject.SetActive(!IsFirstPage); + _btnNextPage.gameObject.SetActive(!IsLastPage); + _indicator.UpdateIndicator(_currentPageIndex); + } + + private void ShowPrevPage() + { + if (!IsFirstPage) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + ShowPage(_currentPageIndex - 1); + } + } + + private void ShowNextPage() + { + if (!IsLastPage) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + ShowPage(_currentPageIndex + 1); + } + } + + private void OnDragStart(GameObject obj) + { + _flickStart = true; + } + + private void OnDrag(GameObject obj, Vector2 dir) + { + if (_flickStart) + { + if (dir.x >= 70f) + { + _flickStart = false; + ShowPrevPage(); + } + else if (dir.x <= -70f) + { + _flickStart = false; + ShowNextPage(); + } + } + } + + private IEnumerator LoadResources(List purchaseRewardsList, Action onFinish) + { + List rewardPathList = new List(); + for (int i = 0; i < purchaseRewardsList.Count; i++) + { + for (int j = 0; j < purchaseRewardsList[i].RewardInfoList.Count; j++) + { + ShopCommonRewardInfo shopCommonRewardInfo = purchaseRewardsList[i].RewardInfoList[j]; + string text = string.Empty; + switch ((UserGoods.Type)shopCommonRewardInfo.Type) + { + case UserGoods.Type.Item: + { + string userGoodsImageName = UserGoods.GetUserGoodsImageName(UserGoods.Type.Item, shopCommonRewardInfo.UserGoodsId); + text = Toolbox.ResourcesManager.GetAssetTypePath(userGoodsImageName, ResourcesManager.AssetLoadPathType.Item); + break; + } + case UserGoods.Type.Degree: + text = Toolbox.ResourcesManager.GetAssetTypePath(UserGoods.GetUserGoodsImageName(UserGoods.Type.Degree, 0L), ResourcesManager.AssetLoadPathType.Item); + break; + case UserGoods.Type.Sleeve: + { + long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(shopCommonRewardInfo.UserGoodsId); + text = Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture); + Sleeve sleeve = Data.Master.SleeveMgr.Get(existingSleeveId); + if (sleeve.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref rewardPathList, sleeve); + } + break; + } + case UserGoods.Type.Emblem: + text = Toolbox.ResourcesManager.GetAssetTypePath(shopCommonRewardInfo.UserGoodsId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M); + break; + } + if (text != string.Empty && !rewardPathList.Contains(text) && !_loadedResourceList.Contains(text)) + { + rewardPathList.Add(text); + } + } + } + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(rewardPathList, null)); + _loadedResourceList.AddRange(rewardPathList); + yield return StartCoroutine(LoadCardObject(purchaseRewardsList)); + onFinish.Call(); + } + + private IEnumerator LoadCardObject(List purchaseRewardsList) + { + List cardIdList = GetCardIdList(purchaseRewardsList); + if (cardIdList.Count != 0) + { + UIBase_CardManager uiCardMgr = UIManager.GetInstance().getUIBase_CardManager(); + int layer = LayerMask.NameToLayer("MyPage"); + UIManager.GetInstance().CardLoadSelect(base.gameObject, cardIdList, layer, is2D: true); + while (!uiCardMgr.getCreateEndFlag() || !uiCardMgr.isAssetAllReady) + { + yield return null; + } + SetCardObj(); + } + } + + private List GetCardIdList(List purchaseRewardsList) + { + List list = new List(); + for (int i = 0; i < purchaseRewardsList.Count; i++) + { + PurchaseRewardInfo purchaseRewardInfo = purchaseRewardsList[i]; + for (int j = 0; j < purchaseRewardInfo.RewardInfoList.Count; j++) + { + ShopCommonRewardInfo shopCommonRewardInfo = purchaseRewardInfo.RewardInfoList[j]; + if (shopCommonRewardInfo.Type == 5 && !list.Contains((int)shopCommonRewardInfo.UserGoodsId)) + { + list.Add((int)shopCommonRewardInfo.UserGoodsId); + } + } + } + return list; + } + + private void SetCardObj() + { + _cardObjList = UIManager.GetInstance().getCardList2DObjs(); + if (_cardObjList == null) + { + return; + } + for (int i = 0; i < _cardObjList.Count; i++) + { + GameObject cardObj = _cardObjList[i].CardObj; + if (!(null == cardObj)) + { + cardObj.SetActive(value: false); + CardListTemplate component = cardObj.GetComponent(); + component.HideNum(); + component._newLabel.gameObject.SetActive(value: false); + UITexture[] componentsInChildren = cardObj.GetComponentsInChildren(includeInactive: true); + for (int j = 0; j < componentsInChildren.Length; j++) + { + componentsInChildren[j].depth += 23; + } + UILabel[] componentsInChildren2 = cardObj.GetComponentsInChildren(includeInactive: true); + for (int k = 0; k < componentsInChildren2.Length; k++) + { + componentsInChildren2[k].depth += 23; + } + component._frameSprite.depth = 23; + component._cardTexture.depth = 21; + cardObj.AddComponent().size = CARDOBJECT_COLLIDER_SIZE; + UIEventListener.Get(cardObj).onClick = _cardDetail.OnPushCardDetailOn; + if (_lastPageIndex > 1) + { + UIEventListener uIEventListener = UIEventListener.Get(cardObj); + uIEventListener.onDragStart = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onDragStart, new UIEventListener.VoidDelegate(OnDragStart)); + UIEventListener uIEventListener2 = UIEventListener.Get(cardObj); + uIEventListener2.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener2.onDrag, new UIEventListener.VectorDelegate(OnDrag)); + } + } + } + } + + private GameObject GetCardObj(long userGoodsId) + { + GameObject result = null; + for (int i = 0; i < _cardObjList.Count; i++) + { + if (_cardObjList[i] != null && userGoodsId == _cardObjList[i].ids) + { + result = _cardObjList[i].CardObj; + break; + } + } + return result; + } + + private void OnDestroy() + { + if (_cardObjList != null) + { + for (int i = 0; i < _cardObjList.Count; i++) + { + UnityEngine.Object.Destroy(_cardObjList[i].CardObj.gameObject); + } + _cardObjList.Clear(); + } + if (_loadedResourceList.Count > 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList); + _loadedResourceList.Clear(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PuzzleAnimation.cs b/SVSim.BattleEngine/Engine/Wizard/PuzzleAnimation.cs new file mode 100644 index 0000000..010c598 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PuzzleAnimation.cs @@ -0,0 +1,153 @@ +using System.Collections; +using System.Linq; +using UnityEngine; + +namespace Wizard; + +public class PuzzleAnimation : MonoBehaviour +{ + [SerializeField] + private UISprite TitleFailed; + + [SerializeField] + private UISprite TitleReset; + + [SerializeField] + private UITexture Bg; + + [SerializeField] + private UITexture FieldHideBg; + + [SerializeField] + private UIPanel MainPanel; + + [SerializeField] + private UISprite ArcaneIn; + + [SerializeField] + private UISprite ArcaneOut; + + private const float TextFadeDuration = 0.15f; + + private const float WaitTimeAfterTextFade = 0.075f; + + private const float BGFadeDuration = 0.15f; + + private const int LOADING_LAYER = 26; + + private bool _isEndFadeOut; + + public float FadeOutDuration { get; private set; } = 0.7f; + + public float FadeInDuration => 0.475f; + + public void Run(bool isReset) + { + StartCoroutine(FadeOut(isReset)); + } + + public void End() + { + StartCoroutine(FadeIn()); + } + + public void SetUp() + { + ArcaneIn.transform.localScale = Vector3.one * 0.01f; + ArcaneOut.transform.localScale = Vector3.one * 0.01f; + ArcaneIn.alpha = 0f; + ArcaneOut.alpha = 0f; + Bg.alpha = 0f; + FieldHideBg.alpha = 0f; + UIAtlas atlas = UIManager.GetInstance().GetAtlasList().FirstOrDefault((UIAtlas s) => s.name == "BattleLang"); + TitleFailed.atlas = atlas; + TitleFailed.spriteName = "result_text_failed"; + TitleReset.atlas = atlas; + TitleReset.spriteName = "result_text_resetting"; + GameMgr.GetIns().GetEffectMgr().InitCommonEffect("Json/EffectResultData", isBattle: true, isField: false, isBattleEffect: true); + base.gameObject.SetLayer(26, isSetChildren: true); + Bg.gameObject.SetActive(value: false); + FieldHideBg.gameObject.SetActive(value: false); + } + + public IEnumerator FadeOut(bool isReset) + { + _isEndFadeOut = false; + Bg.gameObject.SetActive(value: true); + FieldHideBg.gameObject.SetActive(value: true); + FieldHideBg.alpha = 0f; + if (isReset) + { + TitleFailed.gameObject.SetActive(value: false); + TitleReset.gameObject.SetActive(value: true); + TitleReset.transform.localScale = Vector3.one * 10f; + TitleReset.alpha = 0f; + Bg.color = new Color32(0, 48, 16, 0); + } + else + { + TitleFailed.gameObject.SetActive(value: true); + TitleReset.gameObject.SetActive(value: false); + TitleFailed.transform.localScale = Vector3.one * 10f; + TitleFailed.alpha = 0f; + Bg.color = new Color32(0, 24, 48, 0); + } + MainPanel.alpha = 1f; + yield return new WaitForSeconds(0.1f); + if (isReset) + { + TweenAlpha.Begin(TitleReset.gameObject, 0.2f, 1f); + iTween.ScaleTo(TitleReset.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_PUZZLE_RESET); + } + else + { + TweenAlpha.Begin(TitleFailed.gameObject, 0.2f, 1f); + iTween.ScaleTo(TitleFailed.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_PUZZLE_RESET); + } + TweenAlpha.Begin(Bg.gameObject, 0.5f, 0.75f); + TweenAlpha.Begin(FieldHideBg.gameObject, 0.5f, 1f); + yield return new WaitForSeconds(0.2f); + TweenAlpha.Begin(ArcaneIn.gameObject, 0.5f, 1f); + TweenAlpha.Begin(ArcaneOut.gameObject, 0.5f, 1f); + iTween.ScaleTo(ArcaneIn.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(ArcaneOut.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + if (isReset) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_3, Vector3.zero, Quaternion.identity, 26); + TitleReset.transform.localScale = Vector3.one; + iTween.ScaleTo(TitleReset.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + else + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_2, Vector3.zero, Quaternion.identity, 26); + TitleFailed.transform.localScale = Vector3.one; + iTween.ScaleTo(TitleFailed.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear)); + } + yield return new WaitForSeconds(2f); + _isEndFadeOut = true; + } + + public IEnumerator FadeIn() + { + while (!_isEndFadeOut) + { + yield return null; + } + TweenAlpha.Begin(TitleFailed.gameObject, 0.15f, 0f); + TweenAlpha.Begin(TitleReset.gameObject, 0.15f, 0f); + TweenAlpha.Begin(ArcaneIn.gameObject, 0.15f, 0f); + TweenAlpha.Begin(ArcaneOut.gameObject, 0.15f, 0f); + yield return new WaitForSeconds(0.22500001f); + TweenAlpha.Begin(FieldHideBg.gameObject, 0.15f, 0f); + TweenAlpha.Begin(Bg.gameObject, 0.15f, 0f); + yield return new WaitForSeconds(0.15f); + Bg.alpha = 0f; + FieldHideBg.alpha = 0f; + TweenAlpha.Begin(FieldHideBg.gameObject, 0f, 0f); + TweenAlpha.Begin(Bg.gameObject, 0f, 0f); + Bg.gameObject.SetActive(value: false); + FieldHideBg.gameObject.SetActive(value: false); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PuzzleQuestSelectGroup.cs b/SVSim.BattleEngine/Engine/Wizard/PuzzleQuestSelectGroup.cs new file mode 100644 index 0000000..3b642ae --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PuzzleQuestSelectGroup.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class PuzzleQuestSelectGroup : MonoBehaviour +{ + [SerializeField] + private UILabel _difficultyLabel; + + [SerializeField] + private UILabel _clearCountLabel; + + [SerializeField] + private UILabel _clearLabel; + + [SerializeField] + private UIGrid _grid; + + [SerializeField] + private GameObject _itemOrigin; + + private const float HEADER_HEIGHT = 56f; + + private const float ITEM_HEIGHT = 137f; + + public void Setup(string difficultyName, List displayDataList, Action onClick) + { + _difficultyLabel.text = difficultyName; + _clearCountLabel.gameObject.SetActive(value: false); + _clearLabel.gameObject.SetActive(value: false); + _itemOrigin.SetActive(value: true); + foreach (PuzzleQuestSelectDialog.DisplayData displayData in displayDataList) + { + UnityEngine.Object.Instantiate(_itemOrigin, _grid.transform).GetComponent().Setup(displayData, onClick); + } + _itemOrigin.SetActive(value: false); + _grid.Reposition(); + } + + public float GetHeight() + { + int childCount = _grid.transform.childCount; + if (childCount <= 0) + { + return 56f; + } + int num = (childCount - 1) / _grid.maxPerLine + 1; + return 56f + 137f * (float)num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PuzzleUtil.cs b/SVSim.BattleEngine/Engine/Wizard/PuzzleUtil.cs new file mode 100644 index 0000000..6db9530 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PuzzleUtil.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; + +namespace Wizard; + +public class PuzzleUtil +{ + public static void SetPracticePuzzleData(int groupId, PuzzleQuestData data, int difficulty, DataMgr.BattleType battleType) + { + GameMgr.GetIns().GetDataMgr().PracticePuzzleGroupId = groupId; + SetPuzzleQuestData(data, difficulty, battleType); + } + + public static void SetPuzzleQuestData(PuzzleQuestData data, int difficulty, DataMgr.BattleType battleType) + { + CardMaster.SetBattleCardMasterId(FormatBehaviorManager.GetDefaultBehaviour(Format.Unlimited).CardMasterId); + GameMgr.GetIns().IsPuzzleQuest = true; + Data.CurrentFormat = Format.Unlimited; + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + dataMgr.m_BattleType = battleType; + dataMgr.SetPlayerCharaIdBySkinId(data.PlayerSkin); + dataMgr.SetPlayerSleeveId(3000011L); + dataMgr.SetSelectDeckFormat(Format.Unlimited); + dataMgr.Load(); + dataMgr.PuzzleEnemyClass = data.BattleData.EnemyClass; + dataMgr.SetEnemyCharaId(data.EnemySkin); + dataMgr.SetEnemySleeveId(3000011L); + dataMgr.SetCurrentEnemyDeckData(Enumerable.Repeat(100011010, 40).ToList()); + dataMgr.LoadEnemyClassData(); + dataMgr.SetSoroPlay3DFieldID(data.StageId); + dataMgr.SetStoryBgmID("NONE"); + dataMgr.PuzzleQuestId = data.Id; + dataMgr.PuzzleDifficulty = difficulty; + } + + public static void ChangeSceneToPuzzleQuest(PuzzleQuestData data) + { + QuestStartTask questStartTask = new QuestStartTask(isPuzzle: true); + questStartTask.SetParameterForPuzzle(data.Id); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(questStartTask, delegate + { + UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam + { + IsShow_CardIntroduction = true + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Battle, param); + })); + } + + public static void ChangeSceneToPracticePuzzle(PuzzleQuestData data) + { + PracticePuzzleBattleStartTask practicePuzzleBattleStartTask = new PracticePuzzleBattleStartTask(); + practicePuzzleBattleStartTask.SetParameter(data.Id); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(practicePuzzleBattleStartTask, delegate + { + UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam + { + IsShow_CardIntroduction = true + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Battle, param); + })); + } + + public static IEnumerator OpenPuzzleSelectDialogCoroutine(Action onDecide, Action onOpen = null, Action onClose = null) + { + QuestOpenPuzzleDialogTask task = new QuestOpenPuzzleDialogTask(); + yield return Toolbox.NetworkManager.Connect(task, delegate + { + UIManager.GetInstance().createInSceneCenterLoading(); + }); + while (!task.IsResultSuccess) + { + yield return null; + } + List loadList = PuzzleQuestSelectDialog.CollectResourcePath(task.PuzzleQuestInfo.DisplayDatas); + yield return Toolbox.ResourcesManager.LoadAssetGroupAsync(loadList, null); + UIManager.GetInstance().closeInSceneCenterLoading(); + PuzzleQuestSelectDialog.CreateDialog(task.PuzzleQuestInfo, onDecide).OnClose = delegate + { + Toolbox.ResourcesManager.RemoveAssetGroup(loadList); + onClose.Call(task); + }; + onOpen.Call(task); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestCampaignDialog.cs b/SVSim.BattleEngine/Engine/Wizard/QuestCampaignDialog.cs new file mode 100644 index 0000000..2d6e718 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestCampaignDialog.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class QuestCampaignDialog : MonoBehaviour +{ + [SerializeField] + private UITexture _texture; + + private Action _onTweet; + + private List _loadPathList = new List(); + + private string GetTexturePath(bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath("quest_dialog_0013", ResourcesManager.AssetLoadPathType.UiOtherTexture, isFetch); + } + + public static void Create(Action onFinish, Action onTweet = null) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("BossRush_0046")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_GrayBtn); + dialogBase.SetButtonText(Data.SystemText.Get("Mission_0109"), Data.SystemText.Get("Common_0008")); + dialogBase.SetSize(DialogBase.Size.M); + GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/BossRush/QuestCampaignDialog")) as GameObject; + dialogBase.SetObj(gameObject); + QuestCampaignDialog component = gameObject.GetComponent(); + component.Initialize(dialogBase); + component._onTweet = onTweet; + dialogBase.OnClose = delegate + { + onFinish.Call(); + }; + } + + private void Initialize(DialogBase dialog) + { + dialog.onPushButton1 = (Action)Delegate.Combine(dialog.onPushButton1, (Action)delegate + { + OnClickTwitterShare(); + }); + Load(delegate + { + _texture.mainTexture = Toolbox.ResourcesManager.LoadObject(GetTexturePath(isFetch: true)) as Texture; + }); + } + + private void Load(Action onFinish) + { + _loadPathList.Add(GetTexturePath(isFetch: false)); + StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadPathList, delegate + { + onFinish.Call(); + })); + } + + private void OnClickTwitterShare() + { + QuestTweetTask task = new QuestTweetTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + _onTweet.Call(); + })); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestDeckListTask.cs b/SVSim.BattleEngine/Engine/Wizard/QuestDeckListTask.cs new file mode 100644 index 0000000..8b8053a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestDeckListTask.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class QuestDeckListTask : BaseTask +{ + public class QuestDeckListTaskParam : BaseParam + { + public int quest_stage_id; + } + + public DeckGroupListData DeckGroupListData { get; private set; } + + public List BonusFormatList { get; private set; } + + public List BonusClassList { get; private set; } + + public QuestDeckListTask() + { + base.type = ApiType.Type.QuestGetDeckList; + } + + public void SetParameter(int questStageId) + { + QuestDeckListTaskParam questDeckListTaskParam = new QuestDeckListTaskParam(); + questDeckListTaskParam.quest_stage_id = questStageId; + base.Params = questDeckListTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + GameMgr.GetIns().GetDataMgr().SetMaintenanceCardIds(base.ResponseData["data"]["maintenance_card_list"]); + DeckGroupListData = new DeckGroupListData(jsonData, Format.All); + DeckGroupListData.RemoveUseSubClassDeckList(); + BonusFormatList = new List(); + for (int i = 0; i < jsonData["bonus_deck_format"].Count; i++) + { + BonusFormatList.Add(Data.ParseApiFormat(jsonData["bonus_deck_format"][i].ToInt())); + } + BonusClassList = new List(); + for (int j = 0; j < jsonData["bonus_class_id"].Count; j++) + { + BonusClassList.Add((CardBasePrm.ClanType)jsonData["bonus_class_id"][j].ToInt()); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestLastUsedDeckSaveDataManager.cs b/SVSim.BattleEngine/Engine/Wizard/QuestLastUsedDeckSaveDataManager.cs new file mode 100644 index 0000000..5d6cd66 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestLastUsedDeckSaveDataManager.cs @@ -0,0 +1,239 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Wizard; + +public class QuestLastUsedDeckSaveDataManager +{ + public class ExtractedDeckData : IEquatable + { + public Format Format { get; } + + public int ID { get; } + + public DateTime? CreatedTime { get; } + + public bool IsValid + { + get + { + if (!CreatedTime.HasValue) + { + return true; + } + DeckGroup deckGroup = DeckListUtility.DeckGroupDataBaseClone().FirstOrDefault((DeckGroup x) => x.DeckFormat == Format); + if (deckGroup == null) + { + return false; + } + DeckData deckData = deckGroup.DeckDataList.FirstOrDefault((DeckData x) => x.GetDeckID() == ID); + if (deckData == null) + { + return false; + } + if (!deckData.IsNoCard()) + { + DateTime? createdTime = deckData.CreatedTime; + DateTime? createdTime2 = CreatedTime; + if (createdTime.HasValue != createdTime2.HasValue) + { + return false; + } + if (!createdTime.HasValue) + { + return true; + } + return createdTime.GetValueOrDefault() == createdTime2.GetValueOrDefault(); + } + return false; + } + } + + public ExtractedDeckData(DeckData deckData) + { + Format = deckData.Format; + ID = deckData.GetDeckID(); + CreatedTime = deckData.CreatedTime; + } + + public ExtractedDeckData(Format format, int id, DateTime? createdTime) + { + Format = format; + ID = id; + CreatedTime = createdTime; + } + + public override bool Equals(object obj) + { + return Equals(obj as ExtractedDeckData); + } + + public bool Equals(ExtractedDeckData x) + { + if ((object)x == null) + { + return false; + } + if ((object)this == x) + { + return true; + } + if (GetType() != x.GetType()) + { + return false; + } + if (Format == x.Format && ID == x.ID) + { + DateTime? createdTime = CreatedTime; + DateTime? createdTime2 = x.CreatedTime; + if (createdTime.HasValue != createdTime2.HasValue) + { + return false; + } + if (!createdTime.HasValue) + { + return true; + } + return createdTime.GetValueOrDefault() == createdTime2.GetValueOrDefault(); + } + return false; + } + + public override int GetHashCode() + { + return (Format, ID, CreatedTime).GetHashCode(); + } + + public static bool operator ==(ExtractedDeckData lhs, ExtractedDeckData rhs) + { + return lhs?.Equals(rhs) ?? ((object)rhs == null); + } + + public static bool operator !=(ExtractedDeckData lhs, ExtractedDeckData rhs) + { + return !(lhs == rhs); + } + } + + private class SaveData + { + public readonly Dictionary StageDeckTable = new Dictionary(); + + public int? QuestId { get; set; } + } + + private static readonly string Version = "1"; + + private static readonly char DataDelimiter = ','; + + private static readonly char DeckDataDelimiter = '&'; + + private readonly SaveData _saveData; + + public int? QuestId => _saveData.QuestId; + + public QuestLastUsedDeckSaveDataManager() + { + string value = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.QUEST_LAST_USED_DECK_INFO); + _saveData = DeserializeSaveData(value); + } + + private void Save() + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.QUEST_LAST_USED_DECK_INFO, Serialize(_saveData)); + } + + public void DeleteAll() + { + _saveData.QuestId = null; + _saveData.StageDeckTable.Clear(); + Save(); + } + + public void SaveQuestId(int questId) + { + if (_saveData.QuestId != questId) + { + _saveData.QuestId = questId; + Save(); + } + } + + public void SaveDeck(int stage, DeckData deckData) + { + ExtractedDeckData extractedDeckData = new ExtractedDeckData(deckData); + if (!_saveData.StageDeckTable.TryGetValue(stage, out var value) || !(extractedDeckData == value)) + { + _saveData.StageDeckTable[stage] = extractedDeckData; + Save(); + } + } + + public ExtractedDeckData GetDeck(int stage) + { + _saveData.StageDeckTable.TryGetValue(stage, out var value); + if (value == null || !value.IsValid) + { + return null; + } + return value; + } + + private static SaveData DeserializeSaveData(string serializedData) + { + if (serializedData == string.Empty) + { + return new SaveData(); + } + string[] array = serializedData.Split(DataDelimiter); + if (array[0] != Version) + { + return new SaveData(); + } + SaveData saveData = new SaveData(); + if (int.TryParse(array[1], out var result)) + { + saveData.QuestId = result; + } + for (int i = 2; i < array.Length; i += 2) + { + int key = int.Parse(array[i]); + ExtractedDeckData value = DeserializeDeckData(array[i + 1]); + saveData.StageDeckTable[key] = value; + } + return saveData; + } + + private static ExtractedDeckData DeserializeDeckData(string serializedData) + { + string[] array = serializedData.Split(DeckDataDelimiter); + Format format = (Format)int.Parse(array[0]); + int id = int.Parse(array[1]); + DateTime? createdTime = null; + if (DateTime.TryParse(array[2], out var result)) + { + createdTime = result; + } + return new ExtractedDeckData(format, id, createdTime); + } + + private static string Serialize(SaveData saveData) + { + StringBuilder stringBuilder = new StringBuilder(); + string arg = (saveData.QuestId.HasValue ? $"{saveData.QuestId.Value}" : string.Empty); + stringBuilder.Append($"{Version}{DataDelimiter}{arg}"); + foreach (KeyValuePair item in saveData.StageDeckTable) + { + stringBuilder.Append($"{DataDelimiter}{item.Key}{DataDelimiter}{Serialize(item.Value)}"); + } + return stringBuilder.ToString(); + } + + private static string Serialize(ExtractedDeckData deckData) + { + string text = (deckData.CreatedTime.HasValue ? $"{deckData.CreatedTime.Value}" : string.Empty); + return $"{(int)deckData.Format}{DeckDataDelimiter}{deckData.ID}{DeckDataDelimiter}{text}"; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestMissionInfo.cs b/SVSim.BattleEngine/Engine/Wizard/QuestMissionInfo.cs new file mode 100644 index 0000000..7a324cc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestMissionInfo.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class QuestMissionInfo +{ + public List MissionDataList { get; private set; } + + public QuestMissionInfo() + { + Initialize(); + } + + public QuestMissionInfo(JsonData data) + { + Initialize(); + if (data != null) + { + for (int i = 0; i < data.Count; i++) + { + MissionDataList.Add(new QuestMissionData(data[i])); + } + } + } + + private void Initialize() + { + MissionDataList = new List(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestMissionInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard/QuestMissionInfoTask.cs new file mode 100644 index 0000000..4111059 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestMissionInfoTask.cs @@ -0,0 +1,20 @@ +namespace Wizard; + +public class QuestMissionInfoTask : BaseTask +{ + public QuestMissionInfoTask() + { + base.type = ApiType.Type.QuestMission; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Data.QuestMissionInfo = new QuestMissionInfo(base.ResponseData["data"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestOpenInfo.cs b/SVSim.BattleEngine/Engine/Wizard/QuestOpenInfo.cs new file mode 100644 index 0000000..289f854 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestOpenInfo.cs @@ -0,0 +1,32 @@ +using System; +using LitJson; + +namespace Wizard; + +public class QuestOpenInfo +{ + public bool IsOpen { get; private set; } + + public bool IsDisplayBadge { get; private set; } + + public string QuestPanelBandText { get; private set; } + + public DateTime EndTime { get; private set; } + + public void SetOpenInfo(JsonData jsonData, JsonData responseData) + { + bool flag = responseData["is_hidden_boss_appeared"].ToBoolean(); + IsOpen = jsonData["is_open"].ToBoolean(); + QuestPanelBandText = jsonData["name"].ToString(); + IsDisplayBadge = jsonData["is_display_badge"].ToBoolean() || flag; + if (!string.IsNullOrEmpty(jsonData["end_time"].ToString())) + { + EndTime = DateTime.Parse(jsonData["end_time"].ToString()); + } + } + + public void SetIsDisplayBadge(JsonData jsonData) + { + IsDisplayBadge = jsonData["is_display_badge"].ToBoolean(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestPointInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard/QuestPointInfoTask.cs new file mode 100644 index 0000000..425da18 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestPointInfoTask.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class QuestPointInfoTask : BaseTask +{ + public List RewardInfoList { get; private set; } + + public DateTime StartTime { get; private set; } + + public DateTime EndTime { get; private set; } + + public int TotalPoint { get; private set; } + + public int MaxPoint { get; private set; } + + public QuestPointInfoTask() + { + base.type = ApiType.Type.QuestPoint; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + StartTime = DateTime.Parse(jsonData["start_time"].ToString()); + EndTime = DateTime.Parse(jsonData["end_time"].ToString()); + TotalPoint = jsonData["total_point"].ToInt(); + MaxPoint = jsonData["max_point"].ToInt(); + RewardInfoList = new List(); + for (int i = 0; i < jsonData["reward_list"].Count; i++) + { + RewardInfoList.Add(new QuestRewardInfo(jsonData["reward_list"][i])); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestPuzzleSelectionButton.cs b/SVSim.BattleEngine/Engine/Wizard/QuestPuzzleSelectionButton.cs new file mode 100644 index 0000000..8c729d9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestPuzzleSelectionButton.cs @@ -0,0 +1,122 @@ +using System; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class QuestPuzzleSelectionButton : QuestSelectionButtonBase +{ + [SerializeField] + private UILabel _puzzleQuestClearNumLabel; + + [SerializeField] + private UILabel _additionalPuzzleLabel; + + [SerializeField] + private UILabel _puzzleLabel; + + [SerializeField] + private UITexture _texture; + + [SerializeField] + private UIButton _button; + + [SerializeField] + private UILabel _charaNameLabel; + + [SerializeField] + private UILabel _clearLabel; + + [SerializeField] + private UILabel _missionLabel; + + [SerializeField] + private UILabel _noticeLabel; + + [SerializeField] + private GameObject _questButtonRoot; + + private PuzzleQuestInfo _buttonData; + + public override void Initialize(QuestSelectionButtonData data, bool isOpenExtra, bool isLastDay, Action onClick = null) + { + _buttonData = data.PuzzleData; + InitializePuzzleQuest(_buttonData, onClick); + } + + public void InitializePuzzleQuest(PuzzleQuestInfo info, Action onClick = null) + { + if (onClick != null) + { + UIEventListener.Get(_button.gameObject).onClick = delegate + { + onClick(); + }; + } + ClassCharacterMasterData charaPrmByCharaId = GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId(info.CharaId); + _charaNameLabel.text = charaPrmByCharaId.chara_name; + _puzzleLabel.text = Data.SystemText.Get("Puzzle_QuestSelect_0002"); + SetTexture(info.CharaId.ToString()); + int num = info.DisplayDatas.Count((PuzzleQuestSelectDialog.DisplayData data) => data.IsCleared); + int count = info.DisplayDatas.Count; + if (num == count) + { + _missionLabel.gameObject.SetActive(value: false); + _puzzleQuestClearNumLabel.gameObject.SetActive(value: false); + _clearLabel.gameObject.SetActive(value: true); + } + else + { + _missionLabel.gameObject.SetActive(value: true); + _missionLabel.GetComponent().enabled = false; + _missionLabel.text = Data.SystemText.Get("Puzzle_QuestSelect_0003"); + _puzzleQuestClearNumLabel.gameObject.SetActive(value: true); + _puzzleQuestClearNumLabel.text = $"{num}/{count}"; + _clearLabel.gameObject.SetActive(value: false); + } + SetNoticeLabel(null); + SetAdditionalPuzzleLabel(info); + SetButtonRootToGrey(isGrey: false); + } + + private void SetAdditionalPuzzleLabel(PuzzleQuestInfo info) + { + bool flag = info?.DisplayDatas.Any((PuzzleQuestSelectDialog.DisplayData x) => x.IsAdditional && !x.IsCleared) ?? false; + _additionalPuzzleLabel.gameObject.SetActive(flag); + if (flag) + { + _additionalPuzzleLabel.text = Data.SystemText.Get("Puzzle_QuestSelect_0004"); + } + } + + private void SetNoticeLabel(QuestOpponentData data) + { + bool flag = data != null && data.IsPlayable && data.NoticeLabel != null; + _noticeLabel.gameObject.SetActive(flag); + if (flag) + { + _noticeLabel.text = data.NoticeLabel; + } + } + + protected override void SetTexture(string textureId) + { + _texture.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(textureId, ResourcesManager.AssetLoadPathType.ClassCharaWideThumbnail, isfetch: true)); + } + + protected override void SetButtonRootToGrey(bool isGrey) + { + UIManager.SetObjectToGrey(_questButtonRoot.gameObject, isGrey, null, AllLabelColorChanger.COLOR_TABLE_QUEST_BUTTON); + } + + public override void SelectChara() + { + _questSelectionPage.SelectCharaPuzzleButton(_buttonData); + } + + public override void OnDecideButtonClick() + { + _questSelectionPage.OnPuzzleDecideButtonClick(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestRewardReceiveAllTask.cs b/SVSim.BattleEngine/Engine/Wizard/QuestRewardReceiveAllTask.cs new file mode 100644 index 0000000..770b2f4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestRewardReceiveAllTask.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class QuestRewardReceiveAllTask : BaseTask +{ + public List ReceiveRewardList { get; private set; } + + public QuestRewardReceiveAllTask() + { + base.type = ApiType.Type.QuestRewardReceiveAll; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + ReceiveRewardList = new List(); + JsonData jsonData = base.ResponseData["data"]["total_receive_count_list"]; + for (int i = 0; i < jsonData.Count; i++) + { + ReceiveRewardList.Add(new ReceivedReward(jsonData[i])); + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RankWinnerReward.cs b/SVSim.BattleEngine/Engine/Wizard/RankWinnerReward.cs new file mode 100644 index 0000000..ca04d5f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RankWinnerReward.cs @@ -0,0 +1,177 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class RankWinnerReward : MonoBehaviour +{ + [SerializeField] + private NguiObjs _rewardObjs; + + private GameObject _rewardObject; + + private int _rewardGrade; + + private string _rewardMessage = ""; + + private const string ITEM_BOX_FILE_NAME = "box_2pick_{0}_close"; + + private List _assetPathList = new List(); + + public int RewardGrade => _rewardGrade; + + public string RewardString + { + get + { + if (_rewardMessage == "") + { + _rewardMessage = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_STRING); + } + return _rewardMessage; + } + } + + public NguiObjs RewardObjs => _rewardObjs; + + public void SetInfomation(int grade, string message) + { + UILabel obj = _rewardObjs.labels[0]; + UISprite uISprite = _rewardObjs.sprites[2]; + SetRewardString(message); + obj.text = _rewardMessage; + SetRewardGrade(grade); + uISprite.spriteName = GetBoxSpriteName(); + } + + public void SetRewardGrade(int grade) + { + _rewardGrade = grade; + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_GRADE, grade); + } + + public void SetRewardString(string text) + { + _rewardMessage = text; + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_STRING, text); + } + + public IEnumerator ResultWinnerReward() + { + GameObject obj = Object.Instantiate(Resources.Load("UI/layoutParts/RankWinnerRewardResultPanel")) as GameObject; + obj.transform.parent = UIManager.GetInstance().UIManagerRoot.transform; + obj.transform.localScale = Vector3.one; + _rewardObject = obj; + NguiObjs component = _rewardObject.GetComponent(); + UISprite bg = component.sprites[0]; + UISprite window = component.sprites[1]; + UISprite box = component.sprites[2]; + UIManager.GetInstance().AttachAtlas(box.gameObject); + UILabel label = component.labels[0]; + label.text = GameMgr.GetIns()._rankWinnerReward.RewardString; + UIPanel panel = _rewardObject.GetComponent(); + panel.alpha = 0f; + box.spriteName = GetBoxSpriteName(); + string loadEffectName = "cmn_arena_treasure_" + _rewardGrade; + List loadList = new List { Toolbox.ResourcesManager.GetAssetTypePath(loadEffectName, ResourcesManager.AssetLoadPathType.Effect2D) }; + MonoBehaviour component2 = base.transform.parent.gameObject.GetComponent(); + yield return component2.StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadList, null)); + _assetPathList.AddRange(loadList); + GameObject treasureEffectObject = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(loadEffectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject); + treasureEffectObject.transform.parent = obj.transform; + _assetPathList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(treasureEffectObject, null)); + bg.alpha = 0f; + box.alpha = 0f; + label.alpha = 0f; + panel.alpha = 1f; + TweenAlpha.Begin(bg.gameObject, 0.5f, 0.65f); + TweenAlpha.Begin(label.gameObject, 0.5f, 1f); + TweenAlpha.Begin(box.gameObject, 0.5f, 1f); + label.transform.localPosition = new Vector3(100f, 0f, 0f); + window.transform.localScale = new Vector3(1f, 0.01f, 1f); + box.transform.localPosition = new Vector3(180f, 0f, 0f); + iTween.MoveTo(label.gameObject, iTween.Hash("x", 20f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(window.gameObject, iTween.Hash("y", 1f, "time", 0.5f, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.MoveTo(box.gameObject, iTween.Hash("y", 20f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(0.8f); + TweenAlpha.Begin(label.gameObject, 0.5f, 0f); + iTween.MoveTo(box.gameObject, iTween.Hash("x", 0f, "time", 0.7f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_2PICK_BOX_OPEN); + yield return new WaitForSeconds(1f); + treasureEffectObject.transform.localPosition = box.transform.localPosition; + treasureEffectObject.transform.localScale = Vector3.one * 320f * 1.75f; + treasureEffectObject.SetActive(value: true); + box.gameObject.SetActive(value: false); + } + + public string GetBoxSpriteName() + { + return string.Format("box_2pick_{0}_close", (PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_GRADE) - 1).ToString("00")); + } + + public IEnumerator HideRewardObject() + { + NguiObjs component = _rewardObject.GetComponent(); + UISprite uISprite = component.sprites[0]; + UISprite obj = component.sprites[1]; + TweenAlpha.Begin(uISprite.gameObject, 0.3f, 0f); + TweenAlpha.Begin(obj.gameObject, 0.3f, 0f); + yield return new WaitForSeconds(0.3f); + _rewardObject.SetActive(value: false); + } + + public void RemoveObject() + { + if (_rewardObject != null) + { + _rewardObject.SetActive(value: false); + } + if (_assetPathList.Count > 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_assetPathList); + _assetPathList.Clear(); + } + } + + public Color GetGradeColor() + { + return _rewardGrade switch + { + 1 => new Color(0.5f, 1f, 0.75f), + 2 => new Color(1f, 0.85f, 0.25f), + 3 => new Color(1f, 0.5f, 0.2f), + 4 => new Color(1f, 0.25f, 0.25f), + 5 => new Color(0.75f, 0.35f, 1f), + 6 => Color.white, + _ => Color.white, + }; + } + + public Vector3 GetBattleMenuBoxPosition() + { + return PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_GRADE) switch + { + 1 => Vector3.up * 4.3f, + 2 => Vector3.up * 6.8f, + 3 => Vector3.up * 10.9f, + 4 => Vector3.up * 10.9f, + 5 => Vector3.up * 11.9f, + 6 => Vector3.up * 27.14f, + _ => Vector3.up * 27.14f, + }; + } + + public void PlayOpeningSE() + { + if (PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_GRADE) == 6) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SE_SYS_WIN_REWARD_BOX_BIG); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SE_SYS_WIN_REWARD_BOX_SMALL); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignResultData.cs b/SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignResultData.cs new file mode 100644 index 0000000..80a4e44 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignResultData.cs @@ -0,0 +1,82 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class RedEtherCampaignResultData +{ + public class ClearMissionInfo + { + public string MissionText { get; private set; } + + public int RedEther { get; private set; } + + public ClearMissionInfo(JsonData json) + { + MissionText = json["mission_name"].ToString(); + RedEther = json["reward_number"].ToInt(); + } + + public ClearMissionInfo(string text, int ether) + { + MissionText = text; + RedEther = ether; + } + } + + public bool IsEnable { get; private set; } + + public int BeforeDailyEther { get; private set; } + + public int AfterDailyEther { get; private set; } + + public int MaxDailyEther { get; private set; } + + public int CanGainBattleWin { get; private set; } + + public int BattleRewardEther { get; private set; } + + public List ClearMissionList { get; private set; } = new List(); + + public List RewardList { get; private set; } = new List(); + + public float BeforeGaugeValue + { + get + { + float num = BeforeDailyEther; + float num2 = MaxDailyEther; + return num / num2; + } + } + + public float AfterGaugeValue + { + get + { + float num = AfterDailyEther; + float num2 = MaxDailyEther; + return num / num2; + } + } + + public RedEtherCampaignResultData(JsonData json) + { + BeforeDailyEther = json["before_red_ether"].ToInt(); + AfterDailyEther = json["after_red_ethe"].ToInt(); + MaxDailyEther = json["max_gain_red_ethe"].ToInt(); + CanGainBattleWin = json["can_gain_times_by_battle"].ToInt(); + BattleRewardEther = json["current_gain_red_ether_by_battle"].ToInt(); + JsonData jsonData = json["achieved_mission_info_list"]; + for (int i = 0; i < jsonData.Count; i++) + { + ClearMissionInfo clearMissionInfo = new ClearMissionInfo(jsonData[i]); + ClearMissionList.Add(clearMissionInfo); + RewardList.Add(new ReceivedReward(1, 0L, clearMissionInfo.RedEther)); + } + if (BattleRewardEther > 0) + { + RewardList.Add(new ReceivedReward(1, 0L, BattleRewardEther)); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignRewardData.cs b/SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignRewardData.cs new file mode 100644 index 0000000..3091d5f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignRewardData.cs @@ -0,0 +1,31 @@ +using LitJson; + +namespace Wizard; + +public class RedEtherCampaignRewardData +{ + public UserGoods.Type UserGoodsType { get; private set; } + + public int ItemCount { get; private set; } + + public bool IsCleared { get; private set; } + + public string MissionText { get; private set; } + + public RedEtherCampaignRewardData(JsonData json, bool isCleared) + { + MissionText = json["mission_name"].ToString(); + IsCleared = isCleared; + JsonData jsonData = json["reward_list"][0]; + ItemCount = jsonData["reward_number"].ToInt(); + UserGoodsType = (UserGoods.Type)jsonData["reward_type"].ToInt(); + } + + public RedEtherCampaignRewardData(UserGoods.Type type, int count, bool cleared, string missionText) + { + UserGoodsType = type; + ItemCount = count; + IsCleared = cleared; + MissionText = missionText; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ReplayInfo.cs b/SVSim.BattleEngine/Engine/Wizard/ReplayInfo.cs new file mode 100644 index 0000000..9ddae82 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ReplayInfo.cs @@ -0,0 +1,8 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class ReplayInfo : HeaderData +{ + public List Items; +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ReplayInfoItem.cs b/SVSim.BattleEngine/Engine/Wizard/ReplayInfoItem.cs new file mode 100644 index 0000000..ac21bce --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ReplayInfoItem.cs @@ -0,0 +1,62 @@ +using System; +using LitJson; + +namespace Wizard; + +public class ReplayInfoItem +{ + public BattleParameter BattleParameter; + + public long BattleId; + + public string OpponentName; + + public int ClassId; + + public int SubClassId; + + public int OpponentClassId; + + public int OpponentSubClassId; + + public int CharaId; + + public int OpponentCharaId; + + public string OpponentCountryCode; + + public string OpponentEmblemId; + + public string OpponentDegreeId; + + public bool IsWin; + + public DateTime BattleStartTime; + + public Format BattleFormat { get; set; } + + public string OpponentRotationId { get; private set; } + + public string RotationId { get; private set; } + + public ReplayInfoItem(JsonData data) + { + BattleParameter = BattleParameter.JsonToBattleParameter(data); + BattleId = data["battle_id"].ToLong(); + OpponentName = data["opponent_name"].ToString(); + ClassId = data["class_id"].ToInt(); + SubClassId = data.GetValueOrDefault("sub_class_id", 10); + OpponentClassId = data["opponent_class_id"].ToInt(); + OpponentSubClassId = data.GetValueOrDefault("opponent_sub_class_id", 10); + CharaId = data.GetValueOrDefault("chara_id", 0); + OpponentCharaId = data.GetValueOrDefault("opponent_chara_id", 0); + OpponentCountryCode = data["opponent_country_code"].ToString(); + OpponentEmblemId = data["opponent_emblem_id"].ToString(); + OpponentDegreeId = data["opponent_degree_id"].ToString(); + IsWin = data["is_win"].ToString().Equals("1"); + BattleStartTime = DateTime.Parse(data["battle_start_time"].ToString()); + BattleFormat = Data.ParseApiFormat(data["deck_format"].ToInt()); + OpponentRotationId = data.GetValueOrDefault("opponent_rotation_id", null); + RotationId = data.GetValueOrDefault("rotation_id", null); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RewardConfirmDialog.cs b/SVSim.BattleEngine/Engine/Wizard/RewardConfirmDialog.cs new file mode 100644 index 0000000..efc4652 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RewardConfirmDialog.cs @@ -0,0 +1,98 @@ +using System.Collections.Generic; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.Arena; + +namespace Wizard; + +public class RewardConfirmDialog : MonoBehaviour +{ + [SerializeField] + private UILabel _rewardConfirmLabelMainFirst; + + [SerializeField] + private UILabel _rewardConfirmLabelMainSecond; + + [SerializeField] + private UILabel _rewardConfirmLabelSub; + + [SerializeField] + private GameObject _rewardDialogRoot; + + [SerializeField] + private RewardBase _rewardDialog; + + [SerializeField] + private RewardBase _pageChangeRewardPrefab; + + [SerializeField] + private RewardConfirmView _reardConfirmViewFor4; + + public void CreateRewardConfirmDialog(GachaPointExchangeInfo gachaPointExchangeInfo, int dialogInnerDepth, int dialogInnerSortingOrder) + { + if (gachaPointExchangeInfo.RewardList.Count >= 5 && !RewardConfirmView.IsSpecialEmblemLayout(gachaPointExchangeInfo.RewardList)) + { + CreateRewardViewForPageChange(gachaPointExchangeInfo.RewardList, dialogInnerDepth, dialogInnerSortingOrder); + } + else if (gachaPointExchangeInfo.RewardList.Count <= 3) + { + CreateRewardViewFor3(gachaPointExchangeInfo.RewardList, dialogInnerDepth, dialogInnerSortingOrder); + } + else + { + CreateRewardViewFor4(gachaPointExchangeInfo.RewardList); + } + } + + public void SetText(string mainTextFirst, string mainTextSecond, string subText) + { + _rewardConfirmLabelMainFirst.text = mainTextFirst; + _rewardConfirmLabelMainSecond.text = mainTextSecond; + _rewardConfirmLabelSub.text = subText; + } + + private void CreateRewardViewFor3(List rewardList, int dialogInnerDepth, int dialogInnerSortingOrder) + { + _reardConfirmViewFor4.gameObject.SetActive(value: false); + RewardBase component = NGUITools.AddChild(_rewardDialogRoot, _rewardDialog.gameObject).GetComponent(); + UIPanel component2 = component.gameObject.GetComponent(); + component2.depth = dialogInnerDepth; + component2.sortingOrder = dialogInnerSortingOrder; + component.SetActiveRewardLabel(isShow: false); + for (int i = 0; i < rewardList.Count; i++) + { + component.AddReward(rewardList[i]); + } + component.EndCreate(); + } + + private void CreateRewardViewForPageChange(List rewardList, int dialogInnerDepth, int dialogInnerSortingOrder) + { + _reardConfirmViewFor4.gameObject.SetActive(value: false); + RewardBase component = NGUITools.AddChild(_rewardDialogRoot, _pageChangeRewardPrefab.gameObject).GetComponent(); + UIPanel component2 = component.gameObject.GetComponent(); + component2.depth = dialogInnerDepth; + component2.sortingOrder = dialogInnerSortingOrder; + component.SetActiveRewardLabel(isShow: false); + for (int i = 0; i < rewardList.Count; i++) + { + NguiObjs rewardObj = component.AddReward(rewardList[i]); + switch (rewardList[i].UserGoodsData.GoodsType) + { + case UserGoods.Type.Sleeve: + component.ChangeRewardTextureSize(rewardObj, 145, 200); + break; + case UserGoods.Type.Degree: + case UserGoods.Type.MyPageBG: + component.ChangeRewardTextureSize(rewardObj, 145, 145); + break; + } + } + component.EndCreate(); + } + + private void CreateRewardViewFor4(List rewardList) + { + _reardConfirmViewFor4.gameObject.SetActive(value: true); + _reardConfirmViewFor4.Initialize(rewardList); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RewardConfirmView.cs b/SVSim.BattleEngine/Engine/Wizard/RewardConfirmView.cs new file mode 100644 index 0000000..05a0f51 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RewardConfirmView.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.Arena; + +namespace Wizard; + +public class RewardConfirmView : MonoBehaviour +{ + [SerializeField] + private UIGrid _gridRewardViewFor4; + + [SerializeField] + private RewardConfirmViewItem _itemOriginal; + + private List _loadedResourceList; + + public static bool IsSpecialEmblemLayout(List rewardList) + { + if (rewardList.Count() == 5) + { + return rewardList.Count((Wizard.Scripts.Network.Data.TaskData.Arena.Reward n) => n.UserGoodsData.GoodsType == UserGoods.Type.Emblem) == 2; + } + return false; + } + + public void Initialize(List rewardList) + { + _gridRewardViewFor4.gameObject.SetActive(value: true); + UIManager.GetInstance().createInSceneCenterLoading(); + LoadResources(rewardList, delegate + { + UIManager.GetInstance().closeInSceneCenterLoading(); + if (IsSpecialEmblemLayout(rewardList)) + { + List list = new List(); + foreach (Wizard.Scripts.Network.Data.TaskData.Arena.Reward reward in rewardList) + { + if (reward.UserGoodsData.GoodsType == UserGoods.Type.Emblem) + { + list.Add(reward); + if (list.Count() == 2) + { + NGUITools.AddChild(_gridRewardViewFor4.gameObject, _itemOriginal.gameObject).GetComponent().InitializeForTwoEmblem(list[0], list[1]); + } + } + else + { + NGUITools.AddChild(_gridRewardViewFor4.gameObject, _itemOriginal.gameObject).GetComponent().Initialize(reward.UserGoodsData, reward.num); + } + } + } + else + { + foreach (Wizard.Scripts.Network.Data.TaskData.Arena.Reward reward2 in rewardList) + { + NGUITools.AddChild(_gridRewardViewFor4.gameObject, _itemOriginal.gameObject).GetComponent().Initialize(reward2.UserGoodsData, reward2.num); + } + } + _itemOriginal.gameObject.SetActive(value: false); + _gridRewardViewFor4.repositionNow = true; + }); + } + + private void LoadResources(List rewardList, Action onFinish) + { + List rewardPathList = new List(); + foreach (Wizard.Scripts.Network.Data.TaskData.Arena.Reward reward in rewardList) + { + UserGoods userGoodsData = reward.UserGoodsData; + switch (userGoodsData.GoodsType) + { + case UserGoods.Type.Sleeve: + { + long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(userGoodsData.Id); + rewardPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture)); + Sleeve sleeve = Data.Master.SleeveMgr.Get(existingSleeveId); + if (sleeve.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref rewardPathList, sleeve); + } + break; + } + case UserGoods.Type.Emblem: + rewardPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(userGoodsData.Id.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M)); + break; + case UserGoods.Type.Skin: + rewardPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(userGoodsData.Id.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail)); + break; + case UserGoods.Type.Degree: + rewardPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(userGoodsData.Thumbnail, ResourcesManager.AssetLoadPathType.Item)); + break; + case UserGoods.Type.MyPageBG: + rewardPathList.Add(Toolbox.ResourcesManager.GetAssetTypePath("thumbnail_mypage_custom_bg", ResourcesManager.AssetLoadPathType.Item)); + break; + } + } + rewardPathList.Distinct(); + UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(rewardPathList, delegate + { + _loadedResourceList = rewardPathList; + onFinish.Call(); + })); + } + + private void OnDestroy() + { + if (_loadedResourceList != null && _loadedResourceList.Count > 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RewardConfirmViewItem.cs b/SVSim.BattleEngine/Engine/Wizard/RewardConfirmViewItem.cs new file mode 100644 index 0000000..80455c1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RewardConfirmViewItem.cs @@ -0,0 +1,121 @@ +using Cute; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.Arena; + +namespace Wizard; + +public class RewardConfirmViewItem : MonoBehaviour +{ + [SerializeField] + private UITexture _textureSleeve; + + [SerializeField] + private UITexture _textureEmblem; + + [SerializeField] + private UITexture _textureSkin; + + [SerializeField] + private UITexture _textureDegree; + + [SerializeField] + private UITexture _textureMyPageBG; + + [SerializeField] + private UILabel _labelRewardItemName; + + [SerializeField] + private UITexture _textureEmblem1; + + [SerializeField] + private UITexture _textureEmblem2; + + [SerializeField] + private UILabel _labelEmblemRewardItemName1; + + [SerializeField] + private UILabel _labelEmblemRewardItemName2; + + public void Initialize(UserGoods userGoods, int number) + { + SetTexture(userGoods); + string presentItemName = AreaSelInfo.GetPresentItemName((int)userGoods.GoodsType, userGoods.Id); + _labelRewardItemName.SetWrapText(presentItemName + Data.SystemText.Get("Common_0040", number.ToString())); + } + + public void InitializeForTwoEmblem(Wizard.Scripts.Network.Data.TaskData.Arena.Reward emblemReward1, Wizard.Scripts.Network.Data.TaskData.Arena.Reward emblemReward2) + { + _textureSleeve.gameObject.SetActive(value: false); + _textureEmblem.gameObject.SetActive(value: false); + _textureSkin.gameObject.SetActive(value: false); + _textureDegree.gameObject.SetActive(value: false); + _labelRewardItemName.gameObject.SetActive(value: false); + _textureEmblem1.gameObject.SetActive(value: true); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(emblemReward1.UserGoodsData.Id.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true); + _textureEmblem1.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath); + _textureEmblem2.gameObject.SetActive(value: true); + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(emblemReward2.UserGoodsData.Id.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true); + _textureEmblem2.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + _labelEmblemRewardItemName1.gameObject.SetActive(value: true); + string presentItemName = AreaSelInfo.GetPresentItemName((int)emblemReward1.UserGoodsData.GoodsType, emblemReward1.UserGoodsData.Id); + _labelEmblemRewardItemName1.SetWrapText(presentItemName + Data.SystemText.Get("Common_0040", emblemReward1.num.ToString())); + _labelEmblemRewardItemName2.gameObject.SetActive(value: true); + string presentItemName2 = AreaSelInfo.GetPresentItemName((int)emblemReward2.UserGoodsData.GoodsType, emblemReward2.UserGoodsData.Id); + _labelEmblemRewardItemName2.SetWrapText(presentItemName2 + Data.SystemText.Get("Common_0040", emblemReward2.num.ToString())); + } + + private void SetTexture(UserGoods userGoods) + { + _textureSleeve.gameObject.SetActive(value: false); + _textureEmblem.gameObject.SetActive(value: false); + _textureSkin.gameObject.SetActive(value: false); + _textureDegree.gameObject.SetActive(value: false); + _textureEmblem1.gameObject.SetActive(value: false); + _textureEmblem2.gameObject.SetActive(value: false); + _labelEmblemRewardItemName1.gameObject.SetActive(value: false); + _labelEmblemRewardItemName2.gameObject.SetActive(value: false); + _textureMyPageBG.gameObject.SetActive(value: false); + switch (userGoods.GoodsType) + { + case UserGoods.Type.Sleeve: + { + _textureSleeve.gameObject.SetActive(value: true); + long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(userGoods.Id); + Sleeve sleeve = Data.Master.SleeveMgr.Get(existingSleeveId); + if (sleeve.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().SetSleeveTexture(_textureSleeve, sleeve.sleeve_id); + break; + } + string assetTypePath4 = Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture, isfetch: true); + _textureSleeve.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath4); + break; + } + case UserGoods.Type.Emblem: + { + _textureEmblem.gameObject.SetActive(value: true); + string assetTypePath3 = Toolbox.ResourcesManager.GetAssetTypePath(userGoods.Id.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true); + _textureEmblem.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath3); + break; + } + case UserGoods.Type.Skin: + { + _textureSkin.gameObject.SetActive(value: true); + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(userGoods.Id.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail, isfetch: true); + _textureSkin.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + break; + } + case UserGoods.Type.Degree: + { + _textureDegree.gameObject.SetActive(value: true); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(userGoods.Thumbnail, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + _textureDegree.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath); + break; + } + case UserGoods.Type.MyPageBG: + _textureMyPageBG.gameObject.SetActive(value: true); + _textureMyPageBG.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("thumbnail_mypage_custom_bg", ResourcesManager.AssetLoadPathType.Item, isfetch: true)); + break; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomNonPossessionCardCampaign.cs b/SVSim.BattleEngine/Engine/Wizard/RoomNonPossessionCardCampaign.cs new file mode 100644 index 0000000..919e1de --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomNonPossessionCardCampaign.cs @@ -0,0 +1,10 @@ +namespace Wizard; + +public class RoomNonPossessionCardCampaign +{ + public double StartUnixTime { get; set; } + + public double EndUnixTime { get; set; } + + public string EndLocalTimeString => ConvertTime.ToLocal(ConvertTime.UnixTimeToDateTime((int)EndUnixTime)).ToString(); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomRuleInfo.cs b/SVSim.BattleEngine/Engine/Wizard/RoomRuleInfo.cs new file mode 100644 index 0000000..e51207d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomRuleInfo.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class RoomRuleInfo +{ + public List NormalRuleFormatList { get; private set; } = new List(); + + public List TwoPickRuleFormatList { get; private set; } = new List(); + + public List SpecialTwoPickRuleFormatList { get; private set; } = new List(); + + public Dictionary NormalRuleFormatEndTime { get; private set; } = new Dictionary(); + + public Dictionary TwoPickRuleFormatEndTime { get; private set; } = new Dictionary(); + + public TwoPickFormat ChallengePickFormat { get; private set; } = TwoPickFormat.Normal; + + public TwoPickFormat BackDraftFormat { get; private set; } = TwoPickFormat.Backdraft; + + public int RoomChaosNum { get; private set; } + + public RoomRuleInfo() + { + NormalRuleFormatList.Add(Format.Rotation); + NormalRuleFormatList.Add(Format.Unlimited); + } + + public RoomRuleInfo(JsonData json) + : this() + { + if (json.TryGetValue("room_type_in_session", out var value)) + { + if (value.TryGetValue("special_deck_format_list", out var value2)) + { + for (int i = 0; i < value2.Count; i++) + { + string value3 = ConvertTime.ToLocal(ConvertTime.UnixTimeToDateTime((int)ConvertTime.DateTimeToUnixTime(DateTime.Parse(value2[i]["end_time"].ToString())))).ToString(); + Format format = Data.ParseApiFormat(value2[i]["deck_format"].ToInt()); + NormalRuleFormatList.Add(format); + NormalRuleFormatEndTime.Add(format, value3); + } + } + if (value.TryGetValue("special_two_pick_list", out var value4)) + { + for (int j = 0; j < value4.Count; j++) + { + string value5 = ConvertTime.ToLocal(ConvertTime.UnixTimeToDateTime((int)ConvertTime.DateTimeToUnixTime(DateTime.Parse(value4[j]["end_time"].ToString())))).ToString(); + TwoPickFormat twoPickFormat = (TwoPickFormat)value4[j]["two_pick_type"].ToInt(); + if (value4[j]["is_challenge_format"].ToInt() == 1) + { + switch (twoPickFormat) + { + case TwoPickFormat.Normal: + case TwoPickFormat.Cube: + case TwoPickFormat.Chaos: + ChallengePickFormat = twoPickFormat; + break; + case TwoPickFormat.Backdraft: + case TwoPickFormat.BackdraftCube: + case TwoPickFormat.BackdraftChaos: + BackDraftFormat = twoPickFormat; + break; + } + } + else + { + SpecialTwoPickRuleFormatList.Add(twoPickFormat); + TwoPickRuleFormatEndTime.Add(twoPickFormat, value5); + } + if (value4[j].TryGetValue("strategy_pick_num", out var value6)) + { + RoomChaosNum = value6.ToInt(); + Data.Master.LoadRoomChaosBattleInfo(RoomChaosNum); + Data.Master.SetRoomClassInfomationOrder(RoomChaosNum); + } + } + } + } + TwoPickRuleFormatList.Add(ChallengePickFormat); + TwoPickRuleFormatList.Add(BackDraftFormat); + if (SpecialTwoPickRuleFormatList.Count > 0) + { + for (int k = 0; k < SpecialTwoPickRuleFormatList.Count; k++) + { + TwoPickRuleFormatList.Add(SpecialTwoPickRuleFormatList[k]); + } + } + if (Prerelease.Status == Prerelease.eStatus.PRE_ROTATION) + { + NormalRuleFormatList.Add(Format.PreRotation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomTwoPickMultiDeckInfo.cs b/SVSim.BattleEngine/Engine/Wizard/RoomTwoPickMultiDeckInfo.cs new file mode 100644 index 0000000..821c872 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomTwoPickMultiDeckInfo.cs @@ -0,0 +1,88 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class RoomTwoPickMultiDeckInfo +{ + public class DeckResultInfo + { + public List _cardIds; + + public int _classId; + + public int _skinId; + + public int _opponentClassId; + + public bool _isWin; + + public DeckResultInfo(JsonData data) + { + JsonData jsonData = data["card_id_list"]; + int count = jsonData.Count; + List list = new List(count); + for (int i = 0; i < count; i++) + { + list.Add(ConvertValue.ToInt(jsonData[i])); + } + _cardIds = UIManager.GetInstance().getUIBase_CardManager().SortIDList(list, CardMaster.CardMasterId.Default); + _classId = ConvertValue.ToInt(data["class_id"]); + _skinId = ConvertValue.ToInt(data["chara_id"]); + _opponentClassId = ConvertValue.ToInt(data["opponent_class_id"]); + _isWin = ConvertValue.ToInt(data["battle_result"]) == 1; + } + + public DeckResultInfo(Dictionary data) + { + List list = data["cardIds"] as List; + int count = list.Count; + List list2 = new List(count); + for (int i = 0; i < count; i++) + { + list2.Add(ConvertValue.ToInt(list[i])); + } + _cardIds = UIManager.GetInstance().getUIBase_CardManager().SortIDList(list2, CardMaster.CardMasterId.Default); + _classId = ConvertValue.ToInt(data["classId"]); + _skinId = ConvertValue.ToInt(data["skinId"]); + _opponentClassId = ConvertValue.ToInt(data["oppoClass"]); + _isWin = ConvertValue.ToInt(data["isWin"]) == 1; + } + } + + public DeckResultInfo[] DeckList { get; private set; } + + public void Reset() + { + DeckList = null; + } + + public void SetDeckList(JsonData data) + { + if (data == null || !data.IsObject) + { + return; + } + ICollection keys = data.Keys; + DeckResultInfo[] array = new DeckResultInfo[keys.Count]; + foreach (string item in keys) + { + JsonData jsonData = data[item]; + int num = ConvertValue.ToInt(jsonData["entry_no"]); + array[num - 1] = new DeckResultInfo(jsonData); + } + DeckList = array; + } + + public void SetDeckList(Dictionary data) + { + List list = data["ownerList"] as List; + DeckResultInfo[] array = new DeckResultInfo[list.Count]; + for (int i = 0; i < list.Count; i++) + { + Dictionary data2 = list[i] as Dictionary; + array[i] = new DeckResultInfo(data2); + } + DeckList = array; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RubyText.cs b/SVSim.BattleEngine/Engine/Wizard/RubyText.cs new file mode 100644 index 0000000..ea919cf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RubyText.cs @@ -0,0 +1,910 @@ +using System.Text; +using System.Text.RegularExpressions; +using UnityEngine; + +namespace Wizard; + +public static class RubyText +{ + private enum eSubscriptMode + { + NORMAL, + SUBSCRIPT, + SUPERSCRIPT, + RUBYSTART, + RUBYEND + } + + private const string rubStartStr = "[rub<"; + + private const string rubEndStr = ">]"; + + private const string rubTagEndStr = "[/rub]"; + + private static Color mInvisible = new Color(0f, 0f, 0f, 0f); + + private static float mAlpha = 1f; + + private static Color32 s_c0; + + private static Color32 s_c1; + + private static BetterList mColors = new BetterList(); + + private static float[] mBoldOffset = new float[8] { -0.25f, 0f, 0.25f, 0f, 0f, -0.25f, 0f, 0.25f }; + + private static bool IsSpace(int ch) + { + if (ch != 32 && ch != 8202 && ch != 8203) + { + return ch == 8201; + } + return true; + } + + public static string ReplaceDotTagToRubyTag(string text) + { + return Regex.Replace(text, "(\\[dot\\])(.+?)(\\[\\/dot\\])", (Match m) => ConvertRubyTagForDotText(m.Groups[2].Value)); + } + + public static string RemoveRubyTag(string text) + { + return Regex.Replace(Regex.Replace(text, "\\[rub<.*?>\\]", ""), "\\[/rub\\]", ""); + } + + private static string ConvertRubyTagForDotText(string text) + { + StringBuilder stringBuilder = new StringBuilder(); + foreach (char c in text) + { + stringBuilder.Append($"[rub<ใƒป>]{c}[/rub]"); + } + return stringBuilder.ToString(); + } + + public static bool ParseSymbol(string text, ref int index, BetterList colors, bool premultiply, ref int sub, ref bool bold, ref bool italic, ref bool underline, ref bool strike, ref bool ignoreColor) + { + float rubyTotalAdvanceRaw = 0f; + float charWithRubyTotalAdvance = 0f; + bool isDot = false; + return ParseSymbol(text, ref index, colors, premultiply, ref sub, ref bold, ref italic, ref underline, ref strike, ref ignoreColor, ref rubyTotalAdvanceRaw, ref charWithRubyTotalAdvance, isRuby: false, ref isDot); + } + + private static bool ParseSymbol(string text, ref int index, BetterList colors, bool premultiply, ref int sub, ref bool bold, ref bool italic, ref bool underline, ref bool strike, ref bool ignoreColor, ref float rubyTotalAdvanceRaw, ref float charWithRubyTotalAdvance, bool isRuby, ref bool isDot) + { + int length = text.Length; + if (index + 1 < length && text.Substring(index, ">]".Length) == ">]") + { + if (isRuby) + { + sub = 4; + } + index += ">]".Length; + return true; + } + if (index + 3 > length || text[index] != '[') + { + return false; + } + if (text[index + 2] == ']') + { + if (text[index + 1] == '-') + { + if (colors != null && colors.size > 1) + { + colors.RemoveAt(colors.size - 1); + } + index += 3; + return true; + } + switch (text.Substring(index, 3)) + { + case "[1]": + case "[2]": + case "[3]": + case "[4]": + case "[5]": + index += 3; + return true; + case "[b]": + bold = true; + index += 3; + return true; + case "[i]": + italic = true; + index += 3; + return true; + case "[u]": + underline = true; + index += 3; + return true; + case "[s]": + strike = true; + index += 3; + return true; + case "[c]": + ignoreColor = true; + index += 3; + return true; + } + } + if (index + 4 > length) + { + return false; + } + if (text[index + 3] == ']') + { + switch (text.Substring(index, 4)) + { + case "[/b]": + bold = false; + index += 4; + return true; + case "[/i]": + italic = false; + index += 4; + return true; + case "[/u]": + underline = false; + index += 4; + return true; + case "[/s]": + strike = false; + index += 4; + return true; + case "[/c]": + ignoreColor = false; + index += 4; + return true; + } + char ch = text[index + 1]; + char ch2 = text[index + 2]; + if (NGUIText.IsHex(ch) && NGUIText.IsHex(ch2)) + { + mAlpha = (float)((NGUIMath.HexToDecimal(ch) << 4) | NGUIMath.HexToDecimal(ch2)) / 255f; + index += 4; + return true; + } + } + if (index + 5 > length) + { + return false; + } + if (text[index + 4] == ']') + { + switch (text.Substring(index, 5)) + { + case "[sub]": + sub = 1; + index += 5; + return true; + case "[sup]": + sub = 2; + index += 5; + return true; + } + } + if (text[index + 4] == '<') + { + string text2 = text.Substring(index, 5); + if (text2 != null && text2 == "[rub<") + { + index += "[rub<".Length; + bool flag = false; + rubyTotalAdvanceRaw = 0f; + int num = 0; + StringBuilder stringBuilder = new StringBuilder(); + for (int i = index; i + ">]".Length < length; i++) + { + char c = text[i]; + if (c == '\n') + { + continue; + } + if (text.Substring(i, ">]".Length) == ">]") + { + break; + } + num++; + if (!flag && IsFadeTagStart(text, i)) + { + flag = true; + } + if (flag) + { + if (c == ']') + { + flag = false; + } + } + else + { + int prev = ((i > 0) ? text[i - 1] : '\0'); + rubyTotalAdvanceRaw += NGUIText.finalSpacingX + NGUIText.GetGlyph(c, prev).advance; + stringBuilder.Append(c); + } + } + if (isRuby) + { + bool flag2 = false; + charWithRubyTotalAdvance = 0f; + for (int j = index + num + ">]".Length; j < length; j++) + { + char c2 = text[j]; + if (c2 == '\n') + { + continue; + } + if (j + "[/rub]".Length <= length && text.Substring(j, "[/rub]".Length) == "[/rub]") + { + break; + } + if (!flag2 && IsFadeTagStart(text, j)) + { + flag2 = true; + } + if (flag2) + { + if (c2 == ']') + { + flag2 = false; + } + } + else + { + int prev2 = ((j > 0) ? text[j - 1] : '\0'); + charWithRubyTotalAdvance += NGUIText.finalSpacingX + NGUIText.GetGlyph(c2, prev2).advance; + } + } + if (stringBuilder.ToString() == "ใƒป") + { + isDot = true; + } + else + { + isDot = false; + } + sub = 3; + } + else + { + if (length > index + num + ">]".Length) + { + index += num + ">]".Length; + } + sub = 0; + } + return true; + } + } + if (index + 6 > length) + { + return false; + } + if (text[index + 5] == ']') + { + switch (text.Substring(index, 6)) + { + case "[/sub]": + sub = 0; + index += 6; + return true; + case "[/sup]": + sub = 0; + index += 6; + return true; + case "[/rub]": + sub = 0; + index += 6; + return true; + case "[/url]": + index += 6; + return true; + } + } + if (text[index + 1] == 'u' && text[index + 2] == 'r' && text[index + 3] == 'l' && text[index + 4] == '=') + { + int num2 = text.IndexOf(']', index + 4); + if (num2 != -1) + { + index = num2 + 1; + return true; + } + index = text.Length; + return true; + } + if (index + 8 > length) + { + return false; + } + if (text[index + 7] == ']') + { + Color color = NGUIText.ParseColor24(text, index + 1); + if (NGUIText.EncodeColor24(color) != text.Substring(index + 1, 6).ToUpper()) + { + return false; + } + if (colors != null) + { + color.a = colors[colors.size - 1].a; + if (premultiply && color.a != 1f) + { + color = Color.Lerp(mInvisible, color, color.a); + } + colors.Add(color); + } + index += 8; + return true; + } + if (index + 10 > length) + { + return false; + } + if (text[index + 9] == ']') + { + Color color2 = NGUIText.ParseColor32(text, index + 1); + if (NGUIText.EncodeColor32(color2) != text.Substring(index + 1, 8).ToUpper()) + { + return false; + } + if (colors != null) + { + if (premultiply && color2.a != 1f) + { + color2 = Color.Lerp(mInvisible, color2, color2.a); + } + colors.Add(color2); + } + index += 10; + return true; + } + return false; + } + + private static bool IsFadeTagStart(string text, int offset) + { + if (offset + 3 >= text.Length) + { + return false; + } + if (text[offset] == '[' && text[offset + 3] == ']' && NGUIText.IsHex(text[offset + 1]) && NGUIText.IsHex(text[offset + 2])) + { + return true; + } + return false; + } + + public static void PrintWithRuby(string text, BetterList verts, BetterList uvs, BetterList cols, UILabel uiLabel = null) + { + if (string.IsNullOrEmpty(text)) + { + return; + } + UICurveLabel component = uiLabel.GetComponent(); + if (component != null) + { + component.Init(text); + } + int size = verts.size; + NGUIText.Prepare(text); + mColors.Add(Color.white); + mAlpha = 1f; + int num = 0; + int prev = 0; + float num2 = 0f; + float num3 = 0f; + float num4 = 0f; + float num5 = NGUIText.finalSize; + Color a = NGUIText.tint * NGUIText.gradientBottom; + Color b = NGUIText.tint * NGUIText.gradientTop; + Color32 color = NGUIText.tint; + int length = text.Length; + Rect rect = default(Rect); + float num6 = 0f; + float num7 = 0f; + float num8 = num5 * NGUIText.pixelDensity; + bool flag = false; + int sub = 0; + bool bold = false; + bool italic = false; + bool underline = false; + bool strike = false; + bool ignoreColor = false; + float num9 = 0f; + float num10 = 0f; + if (NGUIText.bitmapFont != null) + { + rect = NGUIText.bitmapFont.uvRect; + num6 = rect.width / (float)NGUIText.bitmapFont.texWidth; + num7 = rect.height / (float)NGUIText.bitmapFont.texHeight; + } + float num11 = 0f; + float rubyTotalAdvanceRaw = 0f; + float charWithRubyTotalAdvance = 0f; + bool flag2 = false; + bool isRuby = uiLabel.IsRuby; + float num12 = NGUIText.fontScale * (float)NGUIText.fontSize * uiLabel.RubyMargin; + float num13 = NGUIText.fontScale * (float)NGUIText.fontSize * uiLabel.DotMargin; + bool isDot = false; + for (int i = 0; i < length; i++) + { + num = text[i]; + num9 = num2; + if (num == 10) + { + if (num2 > num4) + { + num4 = num2; + } + if (NGUIText.alignment != NGUIText.Alignment.Left) + { + NGUIText.Align(verts, size, CalcAlignPrintedWidth(num2, num10, isRuby)); + size = verts.size; + } + num2 = 0f; + num3 += NGUIText.finalLineHeight; + prev = 0; + if (isRuby) + { + num11 = 0f; + num10 = 0f; + } + continue; + } + if (num < 32) + { + prev = num; + continue; + } + if (NGUIText.encoding && ParseSymbol(text, ref i, mColors, NGUIText.premultiply, ref sub, ref bold, ref italic, ref underline, ref strike, ref ignoreColor, ref rubyTotalAdvanceRaw, ref charWithRubyTotalAdvance, isRuby, ref isDot)) + { + Color color2; + if (ignoreColor) + { + color2 = mColors[mColors.size - 1]; + color2.a *= mAlpha * NGUIText.tint.a; + } + else + { + color2 = NGUIText.tint * mColors[mColors.size - 1]; + color2.a *= mAlpha; + } + color = color2; + int j = 0; + for (int num14 = mColors.size - 2; j < num14; j++) + { + color2.a *= mColors[j].a; + } + if (NGUIText.gradient) + { + a = NGUIText.gradientBottom * color2; + b = NGUIText.gradientTop * color2; + } + i--; + continue; + } + BMSymbol bMSymbol = (NGUIText.useSymbols ? NGUIText.GetSymbol(text, i, length) : null); + float num15; + float num16; + float num18; + float num17; + if (bMSymbol != null) + { + num15 = num2 + (float)bMSymbol.offsetX * NGUIText.fontScale; + num16 = num15 + (float)bMSymbol.width * NGUIText.fontScale; + num17 = 0f - (num3 + (float)bMSymbol.offsetY * NGUIText.fontScale); + num18 = num17 - (float)bMSymbol.height * NGUIText.fontScale; + if (Mathf.RoundToInt(num2 + (float)bMSymbol.advance * NGUIText.fontScale) > NGUIText.regionWidth) + { + if (num2 == 0f) + { + return; + } + if (NGUIText.alignment != NGUIText.Alignment.Left && size < verts.size) + { + NGUIText.Align(verts, size, CalcAlignPrintedWidth(num2, num10, isRuby)); + size = verts.size; + } + num15 -= num2; + num16 -= num2; + num18 -= NGUIText.finalLineHeight; + num17 -= NGUIText.finalLineHeight; + num2 = 0f; + num3 += NGUIText.finalLineHeight; + num9 = 0f; + } + verts.Add(new Vector3(num15, num18)); + verts.Add(new Vector3(num15, num17)); + verts.Add(new Vector3(num16, num17)); + verts.Add(new Vector3(num16, num18)); + num2 += NGUIText.finalSpacingX + (float)bMSymbol.advance * NGUIText.fontScale; + i += bMSymbol.length - 1; + prev = 0; + if (uvs != null) + { + Rect uvRect = bMSymbol.uvRect; + float xMin = uvRect.xMin; + float yMin = uvRect.yMin; + float xMax = uvRect.xMax; + float yMax = uvRect.yMax; + uvs.Add(new Vector2(xMin, yMin)); + uvs.Add(new Vector2(xMin, yMax)); + uvs.Add(new Vector2(xMax, yMax)); + uvs.Add(new Vector2(xMax, yMin)); + } + if (cols == null) + { + continue; + } + if (NGUIText.symbolStyle == NGUIText.SymbolStyle.Colored) + { + for (int k = 0; k < 4; k++) + { + cols.Add(color); + } + continue; + } + Color32 item = Color.white; + item.a = color.a; + for (int l = 0; l < 4; l++) + { + cols.Add(item); + } + continue; + } + NGUIText.GlyphInfo glyph = NGUIText.GetGlyph(num, prev); + if (glyph == null) + { + continue; + } + prev = num; + float num19 = uiLabel.RubyScale; + float num20 = num12; + if ((sub == 3 || sub == 4) && uiLabel.IsDot && isDot) + { + num19 = uiLabel.DotScale; + num20 = num13; + } + switch (sub) + { + case 1: + glyph.v0.x *= 0.75f; + glyph.v0.y *= 0.75f; + glyph.v1.x *= 0.75f; + glyph.v1.y *= 0.75f; + glyph.v0.y -= NGUIText.fontScale * (float)NGUIText.fontSize * 0.4f; + glyph.v1.y -= NGUIText.fontScale * (float)NGUIText.fontSize * 0.4f; + break; + case 2: + glyph.v0.x *= 0.75f; + glyph.v0.y *= 0.75f; + glyph.v1.x *= 0.75f; + glyph.v1.y *= 0.75f; + glyph.v0.y += NGUIText.fontScale * (float)NGUIText.fontSize * 0.05f; + glyph.v1.y += NGUIText.fontScale * (float)NGUIText.fontSize * 0.05f; + break; + case 3: + { + glyph.v0.x *= num19; + glyph.v0.y *= num19; + glyph.v1.x *= num19; + glyph.v1.y *= num19; + glyph.v0.y += num20; + glyph.v1.y += num20; + float num21 = (num19 * rubyTotalAdvanceRaw - charWithRubyTotalAdvance) / 2f; + glyph.v0.x -= num11 + num21; + glyph.v1.x -= num11 + num21; + flag2 = false; + break; + } + case 4: + if (!flag2) + { + flag2 = true; + num11 += rubyTotalAdvanceRaw * num19; + } + glyph.v0.x -= num11; + glyph.v1.x -= num11; + break; + case 0: + if (isRuby) + { + glyph.v0.x -= num11; + glyph.v1.x -= num11; + } + break; + } + if (component != null) + { + num3 = component.GetTargetCharacterHeight(i); + num15 = glyph.v0.x + num2; + num18 = glyph.v0.y - num3; + num16 = glyph.v1.x + num2; + num17 = glyph.v1.y - num3; + } + else + { + num15 = glyph.v0.x + num2; + num18 = glyph.v0.y - num3; + num16 = glyph.v1.x + num2; + num17 = glyph.v1.y - num3; + } + float num22 = glyph.advance; + if (NGUIText.finalSpacingX < 0f) + { + num22 += NGUIText.finalSpacingX; + } + if (Mathf.RoundToInt(num2 - num10 + num22) > NGUIText.regionWidth) + { + if (num2 == 0f) + { + return; + } + if (NGUIText.alignment != NGUIText.Alignment.Left && size < verts.size) + { + NGUIText.Align(verts, size, CalcAlignPrintedWidth(num2, num10, isRuby)); + size = verts.size; + } + num15 -= num2; + num16 -= num2; + num18 -= NGUIText.finalLineHeight; + num17 -= NGUIText.finalLineHeight; + num2 = 0f; + num3 += NGUIText.finalLineHeight; + num9 = 0f; + } + if (IsSpace(num)) + { + if (underline) + { + num = 95; + } + else if (strike) + { + num = 45; + } + } + switch (sub) + { + case 0: + case 4: + num2 += NGUIText.finalSpacingX + glyph.advance; + break; + case 1: + case 2: + num2 += (NGUIText.finalSpacingX + glyph.advance) * 0.75f; + break; + case 3: + { + float num23 = (NGUIText.finalSpacingX + glyph.advance) * num19; + num2 += num23; + num10 += num23; + break; + } + } + if (IsSpace(num)) + { + continue; + } + if (uvs != null) + { + if (NGUIText.bitmapFont != null) + { + glyph.u0.x = rect.xMin + num6 * glyph.u0.x; + glyph.u2.x = rect.xMin + num6 * glyph.u2.x; + glyph.u0.y = rect.yMax - num7 * glyph.u0.y; + glyph.u2.y = rect.yMax - num7 * glyph.u2.y; + glyph.u1.x = glyph.u0.x; + glyph.u1.y = glyph.u2.y; + glyph.u3.x = glyph.u2.x; + glyph.u3.y = glyph.u0.y; + } + int m = 0; + for (int num24 = ((!bold) ? 1 : 4); m < num24; m++) + { + uvs.Add(glyph.u0); + uvs.Add(glyph.u1); + uvs.Add(glyph.u2); + uvs.Add(glyph.u3); + } + } + if (cols != null) + { + if (glyph.channel == 0 || glyph.channel == 15) + { + if (NGUIText.gradient) + { + float num25 = num8 + glyph.v0.y / NGUIText.fontScale; + float num26 = num8 + glyph.v1.y / NGUIText.fontScale; + num25 /= num8; + num26 /= num8; + s_c0 = Color.Lerp(a, b, num25); + s_c1 = Color.Lerp(a, b, num26); + int n = 0; + for (int num27 = ((!bold) ? 1 : 4); n < num27; n++) + { + cols.Add(s_c0); + cols.Add(s_c1); + cols.Add(s_c1); + cols.Add(s_c0); + } + } + else + { + int num28 = 0; + for (int num29 = (bold ? 16 : 4); num28 < num29; num28++) + { + cols.Add(color); + } + } + } + else + { + Color color3 = color; + color3 *= 0.49f; + switch (glyph.channel) + { + case 1: + color3.b += 0.51f; + break; + case 2: + color3.g += 0.51f; + break; + case 4: + color3.r += 0.51f; + break; + case 8: + color3.a += 0.51f; + break; + } + Color32 item2 = color3; + int num30 = 0; + for (int num31 = (bold ? 16 : 4); num30 < num31; num30++) + { + cols.Add(item2); + } + } + } + if (!bold) + { + if (!italic) + { + if (component != null) + { + Vector2[] array = component.SetTargetCharacterRotation(i, ref num15, ref num18, ref num16, ref num17); + verts.Add(new Vector3(array[0].x, array[0].y)); + verts.Add(new Vector3(array[1].x, array[1].y)); + verts.Add(new Vector3(array[2].x, array[2].y)); + verts.Add(new Vector3(array[3].x, array[3].y)); + } + else + { + verts.Add(new Vector3(num15, num18)); + verts.Add(new Vector3(num15, num17)); + verts.Add(new Vector3(num16, num17)); + verts.Add(new Vector3(num16, num18)); + } + } + else + { + float num32 = (float)NGUIText.fontSize * 0.1f * ((num17 - num18) / (float)NGUIText.fontSize); + verts.Add(new Vector3(num15 - num32, num18)); + verts.Add(new Vector3(num15 + num32, num17)); + verts.Add(new Vector3(num16 + num32, num17)); + verts.Add(new Vector3(num16 - num32, num18)); + } + } + else + { + for (int num33 = 0; num33 < 4; num33++) + { + float num34 = mBoldOffset[num33 * 2]; + float num35 = mBoldOffset[num33 * 2 + 1]; + float num36 = (italic ? ((float)NGUIText.fontSize * 0.1f * ((num17 - num18) / (float)NGUIText.fontSize)) : 0f); + verts.Add(new Vector3(num15 + num34 - num36, num18 + num35)); + verts.Add(new Vector3(num15 + num34 + num36, num17 + num35)); + verts.Add(new Vector3(num16 + num34 + num36, num17 + num35)); + verts.Add(new Vector3(num16 + num34 - num36, num18 + num35)); + } + } + if (!(underline || strike)) + { + continue; + } + NGUIText.GlyphInfo glyph2 = NGUIText.GetGlyph(strike ? 45 : 95, prev); + if (glyph2 == null) + { + continue; + } + if (uvs != null) + { + if (NGUIText.bitmapFont != null) + { + glyph2.u0.x = rect.xMin + num6 * glyph2.u0.x; + glyph2.u2.x = rect.xMin + num6 * glyph2.u2.x; + glyph2.u0.y = rect.yMax - num7 * glyph2.u0.y; + glyph2.u2.y = rect.yMax - num7 * glyph2.u2.y; + } + float x = (glyph2.u0.x + glyph2.u2.x) * 0.5f; + int num37 = 0; + for (int num38 = ((!bold) ? 1 : 4); num37 < num38; num37++) + { + uvs.Add(new Vector2(x, glyph2.u0.y)); + uvs.Add(new Vector2(x, glyph2.u2.y)); + uvs.Add(new Vector2(x, glyph2.u2.y)); + uvs.Add(new Vector2(x, glyph2.u0.y)); + } + } + if (flag && strike) + { + num18 = (0f - num3 + glyph2.v0.y) * 0.75f; + num17 = (0f - num3 + glyph2.v1.y) * 0.75f; + } + else + { + num18 = 0f - num3 + glyph2.v0.y; + num17 = 0f - num3 + glyph2.v1.y; + } + if (bold) + { + for (int num39 = 0; num39 < 4; num39++) + { + float num40 = mBoldOffset[num39 * 2]; + float num41 = mBoldOffset[num39 * 2 + 1]; + verts.Add(new Vector3(num9 + num40, num18 + num41)); + verts.Add(new Vector3(num9 + num40, num17 + num41)); + verts.Add(new Vector3(num2 + num40, num17 + num41)); + verts.Add(new Vector3(num2 + num40, num18 + num41)); + } + } + else + { + verts.Add(new Vector3(num9, num18)); + verts.Add(new Vector3(num9, num17)); + verts.Add(new Vector3(num2, num17)); + verts.Add(new Vector3(num2, num18)); + } + if (NGUIText.gradient) + { + float num42 = num8 + glyph2.v0.y / NGUIText.fontScale; + float num43 = num8 + glyph2.v1.y / NGUIText.fontScale; + num42 /= num8; + num43 /= num8; + s_c0 = Color.Lerp(a, b, num42); + s_c1 = Color.Lerp(a, b, num43); + int num44 = 0; + for (int num45 = ((!bold) ? 1 : 4); num44 < num45; num44++) + { + cols.Add(s_c0); + cols.Add(s_c1); + cols.Add(s_c1); + cols.Add(s_c0); + } + } + else + { + int num46 = 0; + for (int num47 = (bold ? 16 : 4); num46 < num47; num46++) + { + cols.Add(color); + } + } + } + if (NGUIText.alignment != NGUIText.Alignment.Left && size < verts.size) + { + NGUIText.Align(verts, size, CalcAlignPrintedWidth(num2, num10, isRuby)); + size = verts.size; + } + mColors.Clear(); + } + + private static float CalcAlignPrintedWidth(float textWidth, float rubyTextWidth, bool isRuby) + { + float num = textWidth - NGUIText.finalSpacingX; + if (isRuby) + { + num -= rubyTextWidth; + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedCardInfo.cs b/SVSim.BattleEngine/Engine/Wizard/SealedCardInfo.cs new file mode 100644 index 0000000..ef33234 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedCardInfo.cs @@ -0,0 +1,30 @@ +using LitJson; + +namespace Wizard; + +public class SealedCardInfo +{ + public int OriginalCardId { get; private set; } + + public int SealedCardId { get; private set; } + + public bool IsPhantom { get; private set; } + + public int OwnNum { get; private set; } + + public int DeckUsingNum { get; private set; } + + public SealedCardInfo(JsonData rootData) + : this(rootData["card_id"].ToInt(), rootData["is_phantom"].ToInt() == 1, rootData["num"].ToInt(), rootData["deck_using_num"].ToInt()) + { + } + + public SealedCardInfo(int originalCardId, bool isPhantom, int ownNum, int deckUsingNum) + { + OriginalCardId = originalCardId; + IsPhantom = isPhantom; + OwnNum = ownNum; + DeckUsingNum = deckUsingNum; + SealedCardId = SealedData.ConvertToSealedCardId(originalCardId, isPhantom); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedClassInfo.cs b/SVSim.BattleEngine/Engine/Wizard/SealedClassInfo.cs new file mode 100644 index 0000000..2e0b138 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedClassInfo.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class SealedClassInfo +{ + public int ClassId { get; private set; } + + public List PublishedCardInfoList { get; private set; } + + public SealedClassInfo(int classId, List publishedCardInfoList) + { + ClassId = classId; + PublishedCardInfoList = publishedCardInfoList; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedData.cs b/SVSim.BattleEngine/Engine/Wizard/SealedData.cs new file mode 100644 index 0000000..c7387a3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedData.cs @@ -0,0 +1,366 @@ +using System.Collections.Generic; +using System.Linq; +using LitJson; +using Wizard.Scripts.Network.Data.TaskData.Arena; + +namespace Wizard; + +public class SealedData +{ + private const int ACQUIRED_NORMAL_CARDID_END = 6; + + private const int ACQUIRED_PREMIUM_CARDID_END = 7; + + private const int PHANTOM_NORMAL_CARDID_END = 8; + + private const int PHANTOM_PREMIUM_CARDID_END = 9; + + public const int PHANTOM_CARD_SLEEVE_ID = 5070001; + + public const int GACHA_RESOURCE_ID = 70; + + public const GenerateDeckCodeTask.SubmitDeckType DECK_CODE_TYPE = GenerateDeckCodeTask.SubmitDeckType.SEALED; + + private List _registeredSealedCardInfoList = new List(); + + private List _sortedSealedCardInfoList; + + public int? EntryId { get; private set; } + + public int? SeasonId { get; private set; } + + public List ClassInfoList { get; private set; } + + public int? SelectedClassId { get; private set; } + + public List GachaCardList { get; private set; } + + public List GachaSupplyList { get; private set; } + + public List SortedOwnSealedCardList => _sortedSealedCardInfoList.SelectMany((SealedCardInfo x) => Enumerable.Repeat(x.SealedCardId, x.OwnNum)).ToList(); + + public List SortedDeckOriginalCardList => _sortedSealedCardInfoList.SelectMany((SealedCardInfo x) => Enumerable.Repeat(x.OriginalCardId, x.DeckUsingNum)).ToList(); + + private List SortedDeckSealedCardList => _sortedSealedCardInfoList.SelectMany((SealedCardInfo x) => Enumerable.Repeat(x.SealedCardId, x.DeckUsingNum)).ToList(); + + public int[] DeckOriginalExcludedPhantomCardList => _sortedSealedCardInfoList.Where((SealedCardInfo x) => !x.IsPhantom).SelectMany((SealedCardInfo x) => Enumerable.Repeat(x.OriginalCardId, x.DeckUsingNum)).ToArray(); + + public int[] DeckOriginalPhantomCardList => _sortedSealedCardInfoList.Where((SealedCardInfo x) => x.IsPhantom).SelectMany((SealedCardInfo x) => Enumerable.Repeat(x.OriginalCardId, x.DeckUsingNum)).ToArray(); + + public DeckData DeckData { get; private set; } + + public int? DeckCardNumMax { get; private set; } + + public bool[] BattleResultList { get; private set; } = new bool[0]; + + public int BattleWinNum { get; private set; } + + public List RewardCardCandidates { get; private set; } = new List(); + + public List RewardList { get; private set; } + + public bool? IsRetired { get; private set; } + + public bool IsSelectedClass => SelectedClassId.HasValue; + + public bool? IsCompletedDeck { get; private set; } + + public bool RegisteredSealedCardExists => _registeredSealedCardInfoList.Count > 0; + + public bool IsSpecialEffect { get; private set; } + + public void SetEntryInfo(JsonData rootData) + { + if (!rootData.Keys.Contains("entry_info")) + { + return; + } + JsonData jsonData = rootData["entry_info"]; + if (jsonData != null) + { + EntryId = jsonData["id"].ToInt(); + SeasonId = jsonData["reward_schedule_id"].ToInt(); + IsRetired = jsonData["is_retire"].ToInt() == 1; + JsonData jsonData2 = jsonData["selected_class"]; + if (jsonData2 != null) + { + SelectedClassId = jsonData2.ToInt(); + GameMgr.GetIns().GetDataMgr().GetClassPrm(SelectedClassId.Value) + .SetCurrentCharaId(jsonData["leader_skin_id"].ToInt()); + } + } + } + + public void SetClassInfo(JsonData rootData) + { + if (rootData.Keys.Contains("candidate_class")) + { + JsonData jsonData = rootData["candidate_class"]; + ClassInfoList = new List(); + List list = new List(); + for (int i = 0; i < jsonData.Count; i++) + { + JsonData jsonData2 = jsonData[i]; + List list2 = new List + { + new SealedCardInfo(jsonData2["card_id_1"].ToInt(), isPhantom: true, 0, 0), + new SealedCardInfo(jsonData2["card_id_2"].ToInt(), isPhantom: true, 0, 0) + }; + list.AddRange(list2); + ClassInfoList.Add(new SealedClassInfo(jsonData2["class"].ToInt(), list2)); + } + (from x in list + group x by x.OriginalCardId into x + select x.First()).ToList().ForEach(RegisterSealedCard); + } + } + + public void SetGachaCardInfo(JsonData rootData) + { + if (rootData.Keys.Contains("cards")) + { + JsonData jsonData = rootData["cards"]; + int count = jsonData.Count; + GachaCardList = new List(count); + for (int i = 0; i < count; i++) + { + JsonData jsonData2 = jsonData[i]; + GachaCardList.Add(new CardPack + { + card_id = ConvertToSealedCardId(jsonData2["card_id"].ToInt(), jsonData2["is_phantom"].ToInt() == 1), + rarity = jsonData2["rarity"].ToInt() + }); + } + } + } + + public void ClearGachaCardInfo() + { + GachaCardList = null; + } + + public void SetGachaSupplyInfo(JsonData rootData) + { + if (!rootData.Keys.Contains("rewards")) + { + return; + } + JsonData jsonData = rootData["rewards"]; + int count = jsonData.Count; + if (count > 0) + { + GachaSupplyList = new List(count); + for (int i = 0; i < count; i++) + { + Wizard.Scripts.Network.Data.TaskData.Arena.Reward item = new Wizard.Scripts.Network.Data.TaskData.Arena.Reward(jsonData[i]); + GachaSupplyList.Add(item); + } + } + } + + public void SetIsSpecialEffect(JsonData jsonData) + { + IsSpecialEffect = jsonData.GetValueOrDefault("is_special_effect", defaultValue: false); + } + + public void ClearGachaSupplyInfo() + { + GachaSupplyList = null; + } + + public void SetSealedCardInfo(JsonData rootData, bool isRegisterSealedCard) + { + if (!rootData.Keys.Contains("card_list")) + { + return; + } + JsonData jsonData = rootData["card_list"]; + int count = jsonData.Count; + List list = new List(count); + for (int i = 0; i < count; i++) + { + list.Add(new SealedCardInfo(jsonData[i])); + } + DeckCardNumMax = list.Sum((SealedCardInfo x) => x.OwnNum); + if (isRegisterSealedCard) + { + list.ForEach(RegisterSealedCard); + list.ForEach(delegate(SealedCardInfo info) + { + GameMgr.GetIns().GetDataMgr().SetIsNewCard(info.OriginalCardId, isNew: false); + }); + } + list.Sort(delegate(SealedCardInfo a, SealedCardInfo b) + { + UIBase_CardManager.ComparableCard comparableCard = new UIBase_CardManager.ComparableCard(a.SealedCardId, CardMaster.CardMasterId.Default); + UIBase_CardManager.ComparableCard other = new UIBase_CardManager.ComparableCard(b.SealedCardId, CardMaster.CardMasterId.Default); + return comparableCard.CompareTo(other); + }); + _sortedSealedCardInfoList = list; + DeckData = new DeckData(Format.Sealed); + DeckData.SetDeckName(string.Empty); + DeckData.SetDeckClassID(SelectedClassId.Value); + DeckData.SetCardIdList(SortedDeckSealedCardList); + } + + public void SetDeckCompleted(JsonData rootData) + { + if (rootData.Keys.Contains("deck_info")) + { + JsonData jsonData = rootData["deck_info"]; + IsCompletedDeck = jsonData["is_completed"].ToBoolean(); + DeckData.SetDeckIsComplete(IsCompletedDeck.Value); + } + } + + public void SetBattleResultInfo(JsonData rootData) + { + if (rootData.Keys.Contains("battle_results")) + { + JsonData jsonData = rootData["battle_results"]; + JsonData jsonData2 = jsonData["result_list"]; + int count = jsonData2.Count; + BattleResultList = new bool[count]; + for (int i = 0; i < count; i++) + { + BattleResultList[i] = jsonData2[i].ToInt() == 1; + } + BattleWinNum = jsonData["win_count"].ToInt(); + } + } + + public void SetRewardCardCandidates(JsonData rootData) + { + if (rootData.Keys.Contains("acquire_phantom_cards")) + { + JsonData jsonData = rootData["acquire_phantom_cards"]; + RewardCardCandidates.Clear(); + for (int i = 0; i < jsonData.Count; i++) + { + RewardCardCandidates.Add(jsonData[i].ToInt()); + } + RewardCardCandidates = RewardCardCandidates.Distinct().ToList(); + } + } + + public void SetRewardInfo(JsonData rootData) + { + if (rootData.Keys.Contains("rewards")) + { + JsonData jsonData = rootData["rewards"]; + int count = jsonData.Count; + RewardList = new List(count); + for (int i = 0; i < count; i++) + { + RewardList.Add(new ReceivedReward(jsonData[i])); + } + } + } + + public void UpdateHaveUserGoodsNum(JsonData rootData) + { + if (rootData.Keys.Contains("reward_list")) + { + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(rootData["reward_list"]); + } + } + + public void SetSelectedClassId(int classId) + { + SelectedClassId = classId; + } + + public void SetRetired(bool isRetired) + { + IsRetired = isRetired; + } + + public SealedCardInfo GetSealedCardInfo(int sealedCardId) + { + return _registeredSealedCardInfoList.Find((SealedCardInfo x) => x.SealedCardId == sealedCardId); + } + + private void RegisterSealedCard(SealedCardInfo cardInfo) + { + CardMaster instance = CardMaster.GetInstance(CardMaster.CardMasterId.Default); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + int sealedCardId = cardInfo.SealedCardId; + int originalCardId = cardInfo.OriginalCardId; + _registeredSealedCardInfoList.Add(cardInfo); + CardParameter cardParam = instance.GetCardParameterFromId(originalCardId).Clone(sealedCardId); + if (!cardInfo.IsPhantom) + { + dataMgr.SetIsNewCard(sealedCardId, dataMgr.IsNewCard(originalCardId)); + } + instance.RegisterCardParameter(sealedCardId, cardParam); + dataMgr.RegisterUserOwnCardData(sealedCardId, cardInfo.OwnNum); + RegisterSealedCardInAllCardIdList(sealedCardId); + } + + private static void RegisterSealedCardInAllCardIdList(int sealedCardId) + { + List allCardIds = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetAllCardIds(); + int count = allCardIds.Count; + int num = sealedCardId / 10; + int num2 = sealedCardId % 10; + int i; + for (i = allCardIds.IndexOf(num * 10) + 1; i < count; i++) + { + int num3 = allCardIds[i]; + if (num != num3 / 10 || num2 < num3 % 10) + { + break; + } + } + allCardIds.Insert(i, sealedCardId); + } + + public void UnregisterAllSealedCard() + { + for (int num = _registeredSealedCardInfoList.Count - 1; num >= 0; num--) + { + UnregisterSealedCard(_registeredSealedCardInfoList[num].SealedCardId); + } + } + + private void UnregisterSealedCard(int sealedCardId) + { + _registeredSealedCardInfoList.RemoveAll((SealedCardInfo x) => x.SealedCardId == sealedCardId); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + CardMaster.GetInstance(CardMaster.CardMasterId.Default).UnregisterCardParameter(sealedCardId); + dataMgr.UnregisterUserOwnCardData(sealedCardId); + CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetAllCardIds().Remove(sealedCardId); + } + + public static int ConvertToSealedCardId(int originalCardId, bool isPhantomCard) + { + bool isFoil = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(originalCardId).IsFoil; + int num = 0; + num = (isPhantomCard ? (isFoil ? 9 : 8) : (isFoil ? 7 : 6)); + return originalCardId / 10 * 10 + num; + } + + private static int? ConvertToOriginalCardId(int sealedCardId) + { + return Data.ArenaData.SealedData.GetSealedCardInfo(sealedCardId)?.OriginalCardId; + } + + public static bool IsPhantomCard(int cardId) + { + return Data.ArenaData.SealedData.GetSealedCardInfo(cardId)?.IsPhantom ?? false; + } + + public static void GroupByPhantomCard(List inputCardList, out List excludedPhantomCardList, out List phantomCardList, bool isConvertToOriginalCardId) + { + excludedPhantomCardList = new List(); + phantomCardList = new List(); + foreach (int inputCard in inputCardList) + { + SealedCardInfo sealedCardInfo = Data.ArenaData.SealedData.GetSealedCardInfo(inputCard); + if (sealedCardInfo != null) + { + ((!sealedCardInfo.IsPhantom) ? excludedPhantomCardList : phantomCardList).Add(isConvertToOriginalCardId ? sealedCardInfo.OriginalCardId : inputCard); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedMyPageResponseData.cs b/SVSim.BattleEngine/Engine/Wizard/SealedMyPageResponseData.cs new file mode 100644 index 0000000..5ee55ae --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedMyPageResponseData.cs @@ -0,0 +1,36 @@ +using LitJson; + +namespace Wizard; + +public class SealedMyPageResponseData +{ + public ArenaEntryDataBase EntryData { get; private set; } + + public int ScheduleId { get; private set; } + + public int DeckCardNumMin { get; private set; } + + public string[] CardPackIdList { get; private set; } + + public ShopExpirtyInfo ExpirtyInfo { get; private set; } + + public SealedMyPageResponseData(JsonData data) + { + EntryData = new SealedEntryData(data); + ScheduleId = data["schedule_id"].ToInt(); + DeckCardNumMin = data["deck_using_num_min"].ToInt(); + SetCardPackInfo(data); + ExpirtyInfo = new ShopExpirtyInfo(data["sales_period_info"]); + } + + private void SetCardPackInfo(JsonData rootData) + { + JsonData jsonData = rootData["pack_info"]; + int count = jsonData.Count; + CardPackIdList = new string[count]; + for (int i = 0; i < count; i++) + { + CardPackIdList[i] = jsonData[i].ToString(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SelectCardPurchaseConfirmDialog.cs b/SVSim.BattleEngine/Engine/Wizard/SelectCardPurchaseConfirmDialog.cs new file mode 100644 index 0000000..cd8c7e4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SelectCardPurchaseConfirmDialog.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UnityEngine; + +namespace Wizard; + +public class SelectCardPurchaseConfirmDialog : MonoBehaviour +{ + private const int SKIN_WARNING_LINE_BOTTOM_ANCHOR_ABSOLUTE = -43; + + private const int SKIN_WARNING_LINE_TOP_ANCHOR_ABSOLUTE = -35; + + [SerializeField] + private UIScrollView _scrollView; + + [SerializeField] + private PurchaseConfirm _objPurchaseConfirm; + + [SerializeField] + private UILabel _listHeaderLabel; + + [SerializeField] + private UILabel _labelSelectCardList; + + [SerializeField] + private UILabel _labelAcquiredSkinWarning; + + [SerializeField] + private UISprite _spriteLine; + + private DialogBase _dialog; + + public static void Create(PackConfig packConfig, PackChildGachaInfo gachaInfo, int buyPackNum, List selectCardIdList, Action onDecide, bool isAcquireSkinCardPack, bool hasTargetSkin = false) + { + DialogBase dialog = UIManager.GetInstance().CreateDialogClose(); + (UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/Dialog/SelectCardPurchaseConfirmDialog")) as GameObject).GetComponent().Initialize(dialog, packConfig, gachaInfo, buyPackNum, selectCardIdList, onDecide, isAcquireSkinCardPack, hasTargetSkin); + } + + private void Initialize(DialogBase dialog, PackConfig packConfig, PackChildGachaInfo gachaInfo, int buyPackNum, List selectCardIdList, Action onDecide, bool isAcquireSkinCardPack, bool hasTargetSkin) + { + _dialog = dialog; + InitDialog(onDecide); + SetPurchaseConfirm(packConfig, gachaInfo, buyPackNum); + string key = (isAcquireSkinCardPack ? "Shop_0259" : "Shop_0199"); + _listHeaderLabel.text = Data.SystemText.Get(key); + SetSelectCardList(selectCardIdList, hasTargetSkin); + _scrollView.ResetPosition(); + } + + private void InitDialog(Action onDecide) + { + _dialog.SetSize(DialogBase.Size.M); + _dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + _dialog.SetButtonText(Data.SystemText.Get("Shop_0082")); + _dialog.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE_TRANS; + _dialog.SetButtonDelegate(delegate + { + onDecide(); + }); + _dialog.SetPanelDepth(100); + _dialog.SetObj(base.gameObject); + } + + private void SetPurchaseConfirm(PackConfig packConfig, PackChildGachaInfo gachaInfo, int buyPackNum) + { + _dialog.SetTitleLabel(packConfig.Title); + int useItemNum = gachaInfo.Cost * buyPackNum; + string purchaseText = Data.SystemText.Get("Shop_0101", packConfig.Title); + _objPurchaseConfirm.SetClystalConfirmDialog(useItemNum, purchaseText, PlayerStaticData.UserCrystalCount, packConfig.ExpirtyInfo); + if (packConfig.GachaPointData != null) + { + GachaPointData gachaPointData = packConfig.GachaPointData; + int num = gachaPointData.IncreaseGachaPoint; + if (gachaInfo.OverrideIncreaseGachaPoint > 0) + { + num = gachaInfo.OverrideIncreaseGachaPoint; + } + int num2 = (packConfig.IsSpecialCardPack ? num : (num * buyPackNum)); + StartCoroutine(_objPurchaseConfirm.SetCardPackPoint(gachaPointData.GachaPoint, gachaPointData.GachaPoint + num2)); + } + } + + private void SetSelectCardList(List selectCardIdList, bool hasTargetSkin) + { + if (selectCardIdList.Count == 0) + { + _labelSelectCardList.gameObject.SetActive(value: false); + } + _labelSelectCardList.gameObject.SetActive(value: true); + StringBuilder stringBuilder = new StringBuilder(); + for (int i = 0; i < selectCardIdList.Count; i++) + { + if (i > 0) + { + stringBuilder.Append("\n"); + } + stringBuilder.Append(UserGoods.getUserGoodsName(UserGoods.Type.Card, selectCardIdList[i])); + } + _labelSelectCardList.text = stringBuilder.ToString(); + if (hasTargetSkin) + { + _labelAcquiredSkinWarning.gameObject.SetActive(value: true); + _labelAcquiredSkinWarning.text = Data.SystemText.Get("Shop_0166"); + _spriteLine.bottomAnchor.absolute = -43; + _spriteLine.topAnchor.absolute = -35; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SelectSkinCardDialog.cs b/SVSim.BattleEngine/Engine/Wizard/SelectSkinCardDialog.cs new file mode 100644 index 0000000..94170de --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SelectSkinCardDialog.cs @@ -0,0 +1,402 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.UI.Common; + +namespace Wizard; + +public class SelectSkinCardDialog : MonoBehaviour +{ + private const int DIALOG_DEPTH = 900; + + private const int DIALOG_SORTING_ORDER = 37; + + private const int CARD_OBJECT_DEPTH = 20; + + private const float CARD_OBJECT_SCALE = 0.36f; + + private const float CARD_OBJECT_COLLIDER_SCALE = 0.9f; + + [SerializeField] + private SimpleScrollViewUI _cardListScrollView; + + [SerializeField] + private TabList _tabListClass; + + [SerializeField] + private UISprite _spriteClassTab; + + private List _loadedResourceList = new List(); + + private UIAtlas _atlasProfile; + + private List _cardObjectList; + + [SerializeField] + private GameObject _cardObjectRoot; + + [SerializeField] + private GameObject _cardDetailRoot; + + private CardDetailUI _cardDetail; + + private List _loadedCardResourceList = new List(); + + private int _cardDetailIndex; + + [SerializeField] + private UIButton _btnExclude; + + private DialogBase _dialog; + + private CardBasePrm.ClanType _displayClassType = CardBasePrm.ClanType.MAX; + + private Dictionary> _selectSkinCardListInClassDic = new Dictionary>(); + + private Dictionary _selectCardStateDict; + + private bool _isAcquireSkinCardPack; + + private Action _onClickAcquireButton; + + private const int TAB_POS_Y_BY_ACQUIRE_SKIN_CARD_PACK = -255; + + public static void Create(Dictionary> selectSkinCardListInClassDic, Action> onClickOk, bool isDefaultExclude, bool isAcquireSkinCardPack, Action onClickAcquireButton) + { + DialogBase dialog = UIManager.GetInstance().CreateDialogClose(); + (UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/Dialog/SelectSkinCardDialog")) as GameObject).GetComponent().Initialize(dialog, selectSkinCardListInClassDic, onClickOk, isDefaultExclude, isAcquireSkinCardPack, onClickAcquireButton); + } + + public void Initialize(DialogBase dialog, Dictionary> selectSkinCardListInClassDic, Action> onClickOk, bool isDefaultExclude, bool isAcquireSkinCardPack, Action onClickAcquireButton) + { + _dialog = dialog; + _selectSkinCardListInClassDic = selectSkinCardListInClassDic; + _isAcquireSkinCardPack = isAcquireSkinCardPack; + _onClickAcquireButton = onClickAcquireButton; + InitDialog(onClickOk); + InitCardDetail(); + if (_isAcquireSkinCardPack) + { + _btnExclude.gameObject.SetActive(value: false); + UIUtil.SetPositionY(_tabListClass.transform, -255f); + _cardListScrollView.SetScrollViewLayoutByAcquireSkinCardPack(); + } + else + { + InitializeSelectSkinCardState(isDefaultExclude); + _btnExclude.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + ExcludeSkinCardAlreadyHave(); + })); + } + StartCoroutine(LoadInitialResources(delegate + { + InitClassTab(); + })); + } + + private void InitDialog(Action> onClickOk) + { + _dialog.SetSize(DialogBase.Size.XL); + _dialog.SetLayer("MyPage"); + _dialog.SetPanelSortingOrder(37); + _dialog.SetPanelDepth(900); + if (_isAcquireSkinCardPack) + { + _dialog.SetTitleLabel(Data.SystemText.Get("Shop_0258")); + _dialog.SetButtonLayout(DialogBase.ButtonLayout.NONE); + } + else + { + _dialog.SetTitleLabel(Data.SystemText.Get("Shop_0194")); + _dialog.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + _dialog.SetButtonDelegate(delegate + { + onClickOk.Call(_selectCardStateDict); + }); + } + _dialog.SetObj(base.gameObject); + } + + private IEnumerator LoadInitialResources(Action onFinish) + { + UIManager.GetInstance().createInSceneCenterLoading(); + yield return StartCoroutine(LoadProfileAtlas()); + UIManager.GetInstance().closeInSceneCenterLoading(); + onFinish.Call(); + } + + private IEnumerator LoadProfileAtlas() + { + string profileAtlasName = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Profile, null); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetAsync(profileAtlasName, null)); + _loadedResourceList.Add(profileAtlasName); + profileAtlasName = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Profile, null, isload: true); + _atlasProfile = Toolbox.ResourcesManager.LoadObject(profileAtlasName).GetComponent(); + } + + private void UnloadResources() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList); + _loadedResourceList.Clear(); + } + + private void OnDestroy() + { + UnloadResources(); + UnloadCardObject(); + } + + private void InitCardDetail() + { + _cardDetail = DialogCreator.CreateCardDetailDialog(_cardDetailRoot, "Detail"); + _cardDetail.OnDragCard = CardDetailDragCallback; + _cardDetail.OnDetailCardUpdate = UpdateCardDetailArrowButtonVisible; + _cardDetail.gameObject.SetActive(value: false); + } + + private void CardDetailDragCallback(Vector2 vec) + { + if (!_cardDetail.IsEnableShowDetail) + { + return; + } + float x = vec.x; + if (!(Mathf.Abs(x) < 70f)) + { + int num = _cardDetailIndex + ((!(x > 0f)) ? 1 : (-1)); + if (num >= 0 && _cardObjectList.Count > num) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + _cardDetail.CloseDefault(playSe: false); + _cardDetail.ShowCardDetail(_cardObjectList[num].CardObj); + _cardDetailIndex = num; + UpdateCardDetailArrowButtonVisible(); + } + } + } + + private void UpdateCardDetailArrowButtonVisible() + { + _cardDetail.LeftButtonVisible = _cardDetailIndex > 0; + _cardDetail.RightButtonVisible = _cardDetailIndex < _cardObjectList.Count - 1; + } + + private IEnumerator LoadCardObject(List cardIdList, Action onFinish) + { + if (cardIdList.Count == 0) + { + onFinish.Call(); + yield break; + } + UnloadCardObject(); + UIManager uiMgr = UIManager.GetInstance(); + uiMgr.createInSceneCenterLoading(); + bool isLoaded = false; + uiMgr.CardLoadSelect(null, cardIdList, base.gameObject.layer, is2D: true, delegate + { + isLoaded = true; + }); + while (!isLoaded) + { + yield return null; + } + InitCardObject(); + uiMgr.closeInSceneCenterLoading(); + onFinish.Call(); + } + + private void InitCardObject() + { + List cardList2DObjs = UIManager.GetInstance().getCardList2DObjs(); + _cardObjectList = new List(cardList2DObjs); + cardList2DObjs.Clear(); + List cardListAssetPathList = Toolbox.ResourcesManager.CardListAssetPathList; + _loadedCardResourceList.AddRange(new List(cardListAssetPathList)); + cardListAssetPathList.Clear(); + if (_cardObjectList == null) + { + return; + } + for (int i = 0; i < _cardObjectList.Count; i++) + { + GameObject cardObject = _cardObjectList[i].CardObj; + cardObject.SetActive(value: false); + UITexture[] componentsInChildren = cardObject.GetComponentsInChildren(); + foreach (UITexture uITexture in componentsInChildren) + { + if (uITexture.name.Contains("CardTexture")) + { + UITexture component = uITexture.GetComponent(); + Material material = component.material; + component.mainTexture = material.mainTexture; + component.material = null; + } + } + cardObject.transform.parent = _cardObjectRoot.transform; + CardListTemplate component2 = cardObject.GetComponent(); + component2.HideNum(); + component2._newLabel.gameObject.SetActive(value: false); + component2.SetId(_cardObjectList[i].ids); + component2.SetScale(0.36f); + component2.AddDepth(20); + int tempIndex = i; + component2.AddColliderToFrame(0.9f).onClick = delegate + { + _cardDetailIndex = tempIndex; + _cardDetail.OnPushCardDetailOn(cardObject); + }; + } + } + + private void UnloadCardObject() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedCardResourceList); + _loadedCardResourceList.Clear(); + if (_cardObjectList != null) + { + for (int i = 0; i < _cardObjectList.Count; i++) + { + UnityEngine.Object.Destroy(_cardObjectList[i].CardObj.gameObject); + } + _cardObjectList.Clear(); + } + } + + private void InitClassTab() + { + _spriteClassTab.atlas = _atlasProfile; + int num = 0; + for (int i = 1; i < 9; i++) + { + CardBasePrm.ClanType classType = (CardBasePrm.ClanType)i; + string spriteBaseName = "class_tab_" + i.ToString("00"); + _tabListClass.AddTab(delegate + { + if (classType != _displayClassType) + { + ShowCardList(classType); + } + }, spriteBaseName).name = "Class_" + i + "(Clone)"; + if (_selectSkinCardListInClassDic[classType].Count == 0) + { + int num2 = i - 1; + _tabListClass.SetTabToGrayByIndex(num2, disable: true); + if (num == num2) + { + num++; + } + } + } + _tabListClass.Reset(); + _tabListClass.SelectTabByIndex(num, isForceSet: true); + } + + private void ShowCardList(CardBasePrm.ClanType classType) + { + _displayClassType = classType; + List cardList = _selectSkinCardListInClassDic[_displayClassType]; + _cardListScrollView.SetVisiable(isVisiable: false); + List list = new List(cardList.Count); + CardMaster instance = CardMaster.GetInstance(CardMaster.CardMasterId.Default); + for (int i = 0; i < cardList.Count; i++) + { + CardParameter cardParameterFromId = instance.GetCardParameterFromId(cardList[i].CardId); + list.Add(cardParameterFromId.ResourceCardId); + } + StartCoroutine(LoadCardObject(list, delegate + { + _cardListScrollView.SetVisiable(isVisiable: true); + _cardListScrollView.CreateScrollView(cardList.Count, InitializePlate); + })); + } + + private void InitializePlate(int index, GameObject plate) + { + List list = _selectSkinCardListInClassDic[_displayClassType]; + if (index >= list.Count) + { + plate.SetActive(value: false); + } + else + { + plate.GetComponent().SetData(list[index], OnClickSelectCardToggle, _selectCardStateDict, _cardObjectList[index].CardObj, _cardObjectRoot, _isAcquireSkinCardPack ? new Action(OnClickAcquireButton) : null); + } + } + + private void InitializeSelectSkinCardState(bool isDefaultExclude) + { + _selectCardStateDict = new Dictionary(); + for (CardBasePrm.ClanType clanType = CardBasePrm.ClanType.MIN; clanType < CardBasePrm.ClanType.MAX; clanType++) + { + List list = _selectSkinCardListInClassDic[clanType]; + for (int i = 0; i < list.Count; i++) + { + bool value = true; + if (isDefaultExclude) + { + value = !list[i].HasSkin; + } + _selectCardStateDict.Add(list[i].CardId, value); + } + } + UpdateDialogOkBtn(); + UpdateExcludeBtn(); + } + + private void ExcludeSkinCardAlreadyHave() + { + for (CardBasePrm.ClanType clanType = CardBasePrm.ClanType.MIN; clanType < CardBasePrm.ClanType.MAX; clanType++) + { + List list = _selectSkinCardListInClassDic[clanType]; + for (int i = 0; i < list.Count; i++) + { + _selectCardStateDict[list[i].CardId] = !list[i].HasSkin; + } + } + List list2 = _cardListScrollView.ActivePlateList.Select((GameObject p) => p.GetComponent()).ToList(); + for (int num = 0; num < list2.Count; num++) + { + list2[num].SetSelectStatus(_selectCardStateDict, isOnClickToggle: false); + } + UpdateDialogOkBtn(); + UpdateExcludeBtn(); + } + + private void OnClickSelectCardToggle(int cardId, bool isSelect, SelectSkinCardPlate plate) + { + _selectCardStateDict[cardId] = isSelect; + plate.SetSelectStatus(_selectCardStateDict, isOnClickToggle: true); + UpdateDialogOkBtn(); + UpdateExcludeBtn(); + } + + private void UpdateDialogOkBtn() + { + UIManager.SetObjectToGrey(_dialog.button1.gameObject, _selectCardStateDict.All((KeyValuePair x) => !x.Value)); + } + + private void UpdateExcludeBtn() + { + bool b = true; + for (CardBasePrm.ClanType clanType = CardBasePrm.ClanType.MIN; clanType < CardBasePrm.ClanType.MAX; clanType++) + { + if (_selectSkinCardListInClassDic[clanType].Any((SelectSkinCardInfo x) => x.HasSkin && _selectCardStateDict[x.CardId])) + { + b = false; + break; + } + } + UIManager.SetObjectToGrey(_btnExclude.gameObject, b); + } + + private void OnClickAcquireButton(int cardId, bool hasSkin) + { + _onClickAcquireButton.Call(cardId, hasSkin); + _dialog.Close(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SelectSkinCardPlate.cs b/SVSim.BattleEngine/Engine/Wizard/SelectSkinCardPlate.cs new file mode 100644 index 0000000..ba8a06c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SelectSkinCardPlate.cs @@ -0,0 +1,214 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.Arena; + +namespace Wizard; + +public class SelectSkinCardPlate : MonoBehaviour +{ + private readonly Quaternion CARDOBJECT_ROTATION_QUATERNION = new Quaternion(0f, 0f, 0f, 0f); + + private const string SPOT_CARD_NUM_FORMAT = "[fcd24a]+{0}[-]"; + + [SerializeField] + private GameObject _objCardRoot; + + [SerializeField] + private UILabel _labelAcquiredOnCard; + + [SerializeField] + private UILabel _labelCardName; + + [SerializeField] + private UILabel _labelCardPossessionNum; + + [SerializeField] + private UILabel _labelCardPossessionNumNormal; + + [SerializeField] + private UILabel _labelCardPossessionNumPremium; + + [SerializeField] + private UIToggle _toggleSelect; + + [SerializeField] + private UILabel _labelToggle; + + [SerializeField] + private UILabel _labelDescription; + + [SerializeField] + private UILabel _labelAcquired; + + [SerializeField] + private UIButton _buttonAcquire; + + private GameObject _cardObject; + + private SelectSkinCardInfo _skinCardInfo; + + private bool _isFirstToggleChange = true; + + private bool _isSetValue; + + public void SetData(SelectSkinCardInfo skinCardInfo, Action onClickSelectToggle, Dictionary selectCardStateDict, GameObject cardObject, GameObject evacuationParent, Action onClickAcquireButton) + { + _skinCardInfo = skinCardInfo; + _labelCardName.text = UserGoods.getUserGoodsName(UserGoods.Type.Card, _skinCardInfo.CardId); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + int possessionCardNum = dataMgr.GetPossessionCardNum(_skinCardInfo.CardId, isIncludingSpotCard: false); + int spotCardNum = dataMgr.SpotCardData.GetSpotCardNum(_skinCardInfo.CardId); + _labelCardPossessionNumNormal.text = possessionCardNum + ((spotCardNum > 0) ? $"[fcd24a]+{spotCardNum}[-]" : string.Empty); + int cardId = _skinCardInfo.CardId + 1; + int possessionCardNum2 = dataMgr.GetPossessionCardNum(cardId, isIncludingSpotCard: false); + _labelCardPossessionNumPremium.text = possessionCardNum2.ToString(); + int num = possessionCardNum + possessionCardNum2 + spotCardNum; + _labelCardPossessionNum.text = num.ToString(); + SetLabel(skinCardInfo); + SetCardObject(cardObject, evacuationParent); + if (onClickAcquireButton != null) + { + _buttonAcquire.gameObject.SetActive(value: true); + _buttonAcquire.onClick.Clear(); + _buttonAcquire.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + onClickAcquireButton(_skinCardInfo.CardId, _skinCardInfo.HasSkin); + })); + _toggleSelect.gameObject.SetActive(value: false); + _labelToggle.gameObject.SetActive(value: false); + _labelAcquiredOnCard.gameObject.SetActive(value: false); + return; + } + UIManager.SetObjectToGrey(_toggleSelect.gameObject, !_skinCardInfo.HasSkin); + UIManager.SetObjectToGrey(_labelToggle.gameObject, !_skinCardInfo.HasSkin); + if (!_toggleSelect.value) + { + _toggleSelect.activeSprite.alpha = 0f; + } + _toggleSelect.onChange.Clear(); + _toggleSelect.onChange.Add(new EventDelegate(delegate + { + if (!_isFirstToggleChange) + { + onClickSelectToggle(_skinCardInfo.CardId, !_toggleSelect.value, this); + } + _isFirstToggleChange = false; + })); + SetSelectStatus(selectCardStateDict, isOnClickToggle: false); + if (_buttonAcquire != null) + { + _buttonAcquire.gameObject.SetActive(value: false); + } + } + + private void SetLabel(SelectSkinCardInfo skinCardInfo) + { + _labelDescription.text = GetRewardListText(skinCardInfo); + _labelAcquired.gameObject.SetActive(skinCardInfo.HasSkin); + _labelAcquired.text = Data.SystemText.Get("Shop_0166"); + } + + private static string GetRewardListText(SelectSkinCardInfo skinCardInfo) + { + List list = skinCardInfo.RewardList.Select((Wizard.Scripts.Network.Data.TaskData.Arena.Reward reward) => reward.UserGoodsData).OrderBy(GachaUtil.GetRewardListSortIndex).Select(GachaUtil.GetRewardListGoodsTypeName) + .Distinct() + .ToList(); + if (list.Count == 0) + { + Debug.LogError($"reward is not set : {skinCardInfo.CardId} {UserGoods.getUserGoodsName(UserGoods.Type.Card, skinCardInfo.CardId)}"); + return string.Empty; + } + return UIUtil.CreateListText(list, Data.SystemText.Get("Shop_0226"), Data.SystemText.Get("Shop_0234")); + } + + public void SetSelectStatus(Dictionary selectCardStateDict, bool isOnClickToggle) + { + if (!_isSetValue) + { + _isSetValue = true; + _toggleSelect.value = !selectCardStateDict[_skinCardInfo.CardId]; + if (isOnClickToggle) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(_toggleSelect.value ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF); + } + if (_cardObject != null) + { + SetObjectToGreyEnableCollider(_cardObject, !selectCardStateDict[_skinCardInfo.CardId]); + _labelAcquiredOnCard.gameObject.SetActive(!selectCardStateDict[_skinCardInfo.CardId]); + } + _isSetValue = false; + } + } + + private void SetCardObject(GameObject cardObject, GameObject evacuationParent) + { + if (_cardObject != null) + { + _cardObject.SetActive(value: false); + _cardObject.transform.parent = evacuationParent.transform; + } + cardObject.transform.parent = _objCardRoot.transform; + cardObject.transform.localPosition = Vector3.zero; + cardObject.transform.rotation = CARDOBJECT_ROTATION_QUATERNION; + cardObject.SetActive(value: true); + _cardObject = cardObject; + } + + private void SetObjectToGreyEnableCollider(GameObject o, bool b) + { + Color color = (b ? LabelDefine.TEXT_COLOR_BUTTON_DISABLE : LabelDefine.TEXT_COLOR_BUTTON_ENABLE); + Color color2 = (b ? LabelDefine.TEXT_COLOR_BUTTON_DISABLE : ((Color32)Color.white)); + string text = "_grey"; + if (b) + { + if (!o.name.Contains(text)) + { + o.name += text; + } + } + else + { + o.name = o.name.Replace(text, ""); + } + UISprite[] components = o.GetComponents(); + for (int i = 0; i < components.Length; i++) + { + components[i].color = color2; + } + UITexture[] componentsInChildren = o.GetComponentsInChildren(includeInactive: true); + for (int i = 0; i < componentsInChildren.Length; i++) + { + componentsInChildren[i].color = color2; + } + components = o.GetComponentsInChildren(includeInactive: true); + for (int i = 0; i < components.Length; i++) + { + components[i].color = color2; + } + UIWidget[] componentsInChildren2 = o.GetComponentsInChildren(includeInactive: true); + for (int i = 0; i < componentsInChildren2.Length; i++) + { + componentsInChildren2[i].color = color2; + } + UIButton[] componentsInChildren3 = o.GetComponentsInChildren(includeInactive: true); + foreach (UIButton obj in componentsInChildren3) + { + obj.defaultColor = color2; + obj.disabledColor = color2; + } + UILabel[] componentsInChildren4 = o.GetComponentsInChildren(includeInactive: true); + for (int i = 0; i < componentsInChildren4.Length; i++) + { + componentsInChildren4[i].color = color; + } + TweenColor[] componentsInChildren5 = o.GetComponentsInChildren(includeInactive: true); + foreach (TweenColor obj2 in componentsInChildren5) + { + obj2.from = color2; + obj2.to = color2; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SetReferenceIdPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/SetReferenceIdPolicyCollection.cs new file mode 100644 index 0000000..14081c6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SetReferenceIdPolicyCollection.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class SetReferenceIdPolicyCollection : AIPolicyCollection +{ + public Dictionary CreateReferenceIdTable() + { + Dictionary dictionary = new Dictionary(); + if (!base.HasPolicy) + { + return dictionary; + } + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + int key = aIPolicyData.EvalId(); + int value = aIPolicyData.EvalId(1); + dictionary.Add(key, value); + } + return dictionary; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SetReferenceTribePolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/SetReferenceTribePolicyCollection.cs new file mode 100644 index 0000000..d648605 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SetReferenceTribePolicyCollection.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class SetReferenceTribePolicyCollection : AIPolicyCollection +{ + public Dictionary> CreateReferenceTribeTable() + { + Dictionary> dictionary = new Dictionary>(); + if (!base.HasPolicy) + { + return dictionary; + } + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + string text = aIPolicyData.EvalText(); + if (text == null || text == "") + { + AIConsoleUtility.LogError("SetReferenceTribePolicyCollection.CreateReferenceTribeTable(): arg0 is not tribe text. ARG:[" + aIPolicyData.ARG + "]"); + continue; + } + List list = aIPolicyData.EvalIdList(1); + if (list == null || list.Count <= 0) + { + AIConsoleUtility.LogError("SetReferenceTribePolicyCollection.CreateReferenceTribeTable(): Not contains target Id. ARG:[" + aIPolicyData.ARG + "]"); + } + else + { + dictionary.Add(text, list); + } + } + return dictionary; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SetUp.cs b/SVSim.BattleEngine/Engine/Wizard/SetUp.cs new file mode 100644 index 0000000..d3257f2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SetUp.cs @@ -0,0 +1,261 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using Cute; +using LitJson; +using UnityEngine; +using Wizard.ErrorDialog; + +namespace Wizard; + +public class SetUp : MonoBehaviour +{ + private JsonReader defaultReader; + + private NetworkManager networkManager; + + private IEnumerator Start() + { + Object.DontDestroyOnLoad(this); + ToolboxGame.SetUp = this; + if (string.IsNullOrEmpty(Toolbox.SavedataManager.GetString("LANG_SETTING"))) + { + CustomPreference.SetTextLanguage("Eng"); + CustomPreference.SetSoundLanguage("Eng"); + } + Data.SystemText = new SystemText(); + Data.SystemText.Initialize(); + InitFrameWorkSettings(); + Data.Initialize(); + Data.SystemText.Initialize(); + Wizard.ErrorDialog.Dialog.Initialize(); + while (ToolboxGame.UIManager == null) + { + yield return 0; + } + InitGameManger(); + Toolbox.SceneManager.SceneChangeParameter.KeepAssets = true; + } + + public void InitFrameWorkSettings() + { + CustomPreference.SetScemeMode(CustomPreference.eSchemeType.Https); + CustomPreference.SetScemeModeCDN(CustomPreference.eSchemeType.Https); + CustomPreference.SetOptionalNodeSceme(); + CustomPreference.SetSignature("Shadowverse"); + CustomPreference.SetApplicationServerURL("utoongaize.shadowverse.jp/shadowverse/"); + CustomPreference.SetResourceServerURL("shadowverse.akamaized.net/"); + CustomPreference.SetNodeServerURL(""); + CustomPreference.SetDeckBuilderServerURL("shadowverse-portal.com/api/v1/game_api/"); + CustomPreference.SetLocale("Eng"); + int num = (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.FRAMERATE) ? 60 : 30); + Toolbox.QualityManager.SetFrameRate(num); + Application.targetFrameRate = num; + Toolbox.DeviceManager.SetVersionName(); + Toolbox.AssetManager.AddNoUnloadAssetGroupName("card_shader_common"); + Toolbox.AssetManager.AddNoUnloadAssetGroupName("card_foil"); + Toolbox.AssetManager.AddNoUnloadAssetGroupName("effect_md_eff"); + string text = Toolbox.SavedataManager.GetString("LANG_SETTING", "Eng"); + string soundLanguage = Toolbox.SavedataManager.GetString("LANG_SOUND_SETTING", SwitchLanguage.GetDefaultVoiceLanguage(text)); + string text2 = ""; + for (int i = 0; i < AssetBundleEditorTag.categoryNameList.Length; i++) + { + if (text2 != "") + { + text2 += ","; + } + text2 += AssetBundleEditorTag.categoryNameList[i].name; + } + string[] categoryList = text2.Split(','); + Toolbox.AssetManager.SetCategoryList(categoryList); + Toolbox.AssetManager.createSavePath(); + Toolbox.AssetManager.createPackagePath(); + Toolbox.NetworkManager.NetworkUI = NetworkUI.GetInstance(); + SoftwareReset.setAction(); + CustomPreference.isPreferenceComplete = true; + CustomPreference.SetTextLanguage(text); + CustomPreference.SetSoundLanguage(soundLanguage); + SetLanguageData(); + Toolbox.NetworkManager.Certification(); + StartTitleCheckTask(); + } + + private void StartTitleCheckTask() + { + CheckSpecialTitleTask checkSpecialTitleTask = new CheckSpecialTitleTask(); + checkSpecialTitleTask.SkipAllNetworkChecks(); + StartCoroutine(Toolbox.NetworkManager.Connect(checkSpecialTitleTask, null, null, null, encrypt: true, useJson: false, showLoadingIcon: false)); + } + + public void InitGameSetting() + { + SetNetworkManager(); + WaitSetUp(); + } + + private void InitGameManger() + { + GameMgr.CreateIns(); + GameMgr.GetIns().CreateMgrIns(base.gameObject); + GameMgr.GetIns().GetSoundMgr().SetCueInfo(); + GameMgr.GetIns().GetSoundMgr().AssignSe(); + GameMgr.GetIns().GetSoundMgr().CreateBGMList(); + } + + private void WaitSetUp() + { + StartDownLoad(); + } + + private void StartDownLoad() + { + GameMgr.GetIns().GetSoundMgr().LoadBGM(Bgm.BGM_TYPE.HOME, delegate + { + StartCoroutine(LoadAssetBundles()); + }); + } + + private void errorCallBack() + { + UIManager.GetInstance().isErrorProc = false; + string titleLabel = Data.SystemText.Get("System_0020"); + if (UIManager.GetInstance().NowOpenDialog != null) + { + UIManager.GetInstance().NowOpenDialog.CloseWithoutSelect(); + } + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true); + dialogBase.SetFadeButtonEnabled(flag: false); + dialogBase.SetTitleLabel(titleLabel); + dialogBase.SetText(Data.SystemText.Get("System_0021")); + dialogBase.SetReturnMsg(UIManager.GetInstance().gameObject, "CommonResetGame"); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.GrayBtn); + dialogBase.SetButtonText(Data.SystemText.Get("System_0006")); + UIManager.GetInstance().isRetryProc = false; + if (UIManager.GetInstance().isErrorProc && !UIManager.GetInstance().isRetryProc) + { + SoftwareReset.exec(); + } + } + + [DllImport("CyCrypt")] + public static extern string EncodePost(string input, string opt); + + [DllImport("CyCrypt")] + public static extern string DecodePost(string input, string opt); + + [DllImport("CyCrypt")] + public static extern void DestoryEncodeText(); + + [DllImport("CyCrypt")] + public static extern void DestoryDecodeText(); + + private void SetNetworkManager() + { + if (networkManager == null) + { + networkManager = Toolbox.NetworkManager; + } + } + + public void BuildFirstScene() + { + PlayerStaticData.LoadUserEmblemTexture(); + PlayerStaticData.LoadUserCountryTexture(); + IDictionary dictionary = new Dictionary(); + foreach (UserCard userCard in Data.Load.data.UserCardList) + { + if (!dictionary.ContainsKey(userCard.card_id)) + { + dictionary.Add(userCard.card_id, userCard.number); + } + } + GameMgr.GetIns().GetDataMgr().SetUserOwnCardData(dictionary); + LoadComplete(); + } + + private void LoadComplete() + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + if (Data.Load.data._userTutorial.tutorial_step != 100) + { + dataMgr.SetPlayerCharaId(500008); + Global.IS_LOAD_ALLDONE = true; + return; + } + DeckInfoTask task = new DeckInfoTask(); + task.SetParameter(Format.All); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + bool flag = false; + DeckGroupListData deckGroupListData = task.DeckGroupListData; + foreach (DeckData item in deckGroupListData.GetDeckListByAttribute(DeckAttributeType.CustomDeck)) + { + if (!item.IsNoCard()) + { + dataMgr.SetPlayerCharaIdBySkinId(item.GetSkinId()); + dataMgr.SetCurrentDeckData(item.GetCardIdList()); + flag = true; + break; + } + } + if (!flag) + { + DeckData deckData = deckGroupListData.GetDeckListByAttribute(DeckAttributeType.DefaultDeck).First(); + dataMgr.SetPlayerCharaIdByClassId(deckData.GetDeckClassID()); + dataMgr.SetCurrentDeckData(deckData.GetCardIdList()); + } + GameMgr.GetIns().BuildDeckData(); + Global.IS_LOAD_ALLDONE = true; + })); + } + + private IEnumerator LoadAssetBundles() + { + GameMgr.GetIns().Init(); + yield return StartCoroutine(UIManager.GetInstance().CardLoadResident()); + BuildFirstScene(); + } + + private void OnUpdateDeckRequestFinished(NetworkTask.ResultCode error) + { + LoadComplete(); + } + + private void Update() + { + if (GameMgr.GetIns() != null) + { + GameMgr.GetIns().Update(); + } + } + + private void SetLanguageData() + { + string text = Toolbox.SavedataManager.GetString("LANG_SETTING"); + if (string.IsNullOrEmpty(text)) + { + string systemLanguage = Global.GetSystemLanguage(); + if (Global.IsSupportedSystemLanguage(systemLanguage)) + { + text = Global.GetLanguageType(systemLanguage); + Toolbox.SavedataManager.SetString("LANG_SETTING", text); + Toolbox.SavedataManager.SetString("LANG_FONT", Global.GetFontLangType(text)); + Toolbox.SavedataManager.SetString("LANG_SOUND_SETTING", SwitchLanguage.GetDefaultVoiceLanguage(text)); + CustomPreference.SetTextLanguage(Toolbox.SavedataManager.GetString("LANG_SETTING")); + CustomPreference.SetSoundLanguage(Toolbox.SavedataManager.GetString("LANG_SOUND_SETTING")); + Data.SystemText = new SystemText(); + Data.SystemText.Initialize(); + CustomPreference.createResourcePath(); + } + if (string.IsNullOrEmpty(text)) + { + Toolbox.SavedataManager.SetString("LANG_SETTING", "Eng"); + Toolbox.SavedataManager.SetString("LANG_FONT", Global.GetFontLangType(Global.LANG_TYPE.Eng.ToString())); + Toolbox.SavedataManager.SetString("LANG_SOUND_SETTING", SwitchLanguage.GetDefaultVoiceLanguage("Eng")); + CustomPreference.SetTextLanguage(Toolbox.SavedataManager.GetString("LANG_SETTING")); + CustomPreference.SetSoundLanguage(Toolbox.SavedataManager.GetString("LANG_SOUND_SETTING")); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ShopCommonSaleInfo.cs b/SVSim.BattleEngine/Engine/Wizard/ShopCommonSaleInfo.cs new file mode 100644 index 0000000..5976100 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ShopCommonSaleInfo.cs @@ -0,0 +1,22 @@ +namespace Wizard; + +public class ShopCommonSaleInfo +{ + public string name { get; set; } + + public string path { get; set; } + + public bool isFree { get; set; } + + public int? costCrystal { get; set; } + + public int? costRupy { get; set; } + + public int? costTicket { get; set; } + + public int? haveTicketNum { get; set; } + + public long? costTicketItemId { get; set; } + + public ShopExpirtyInfo expirtyTimeInfo { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ShopCommonUtility.cs b/SVSim.BattleEngine/Engine/Wizard/ShopCommonUtility.cs new file mode 100644 index 0000000..3b2e6c2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ShopCommonUtility.cs @@ -0,0 +1,376 @@ +using System; +using Cute; +using UnityEngine; +using Wizard.ErrorDialog; + +namespace Wizard; + +public static class ShopCommonUtility +{ + public enum SalesType + { + free, + crystal, + rupy, + ticket + } + + public const float SUPPLY_LIST_LASTLINE_MARGIN = 30f; + + private const string SPRITE_FORMAT_CLASS_COLOR = "icon_class_color_{0}"; + + private const int MAX_LENGTH_VIEW_PRODUCT_NAME = 18; + + private const int MAX_LENGTH_VIEW_PRODUCT_NAME_ALPHABET = 35; + + private const string OVER_MAX_TEXT_REPLACE_CHAR = "..."; + + public const string CMN_SHOP_ICON_1 = "cmn_shop_icon_1"; + + public const string TEXTURE_NAME_PRE_PACK_ICON = "card_pack_{0}_icon"; + + private const int ERROR_CODE_NOTFOUND_DECKCODE = 10001; + + private const int ERROR_CODE_2PICK_DECKCODE = 10005; + + private static readonly Vector3 POS_COST_LABLE_RIGHT = new Vector3(40f, -86f, 0f); + + private static readonly Vector3 POS_COST_LABLE_LEFT = new Vector3(-141f, -86f, 0f); + + private static readonly Vector3 POS_COST_LABLE_CENTER = new Vector3(-47f, -86f, 0f); + + public static void SetButtonLabelStyle(UIButton button, UILabel label) + { + if (button.isEnabled) + { + label.color = LabelDefine.TEXT_COLOR_BUTTON_ENABLE; + } + else + { + label.color = LabelDefine.TEXT_COLOR_BUTTON_DISABLE; + } + } + + public static bool IsHaveEnoughCost(ShopCommonSaleInfo info, SalesType costType, Action funcCrystalShortage) + { + switch (costType) + { + case SalesType.free: + if (!info.isFree) + { + return false; + } + break; + case SalesType.crystal: + if (!info.costCrystal.HasValue) + { + return false; + } + if (PlayerStaticData.UserCrystalCount < info.costCrystal) + { + funcCrystalShortage.Call(); + return false; + } + break; + case SalesType.rupy: + if (!info.costRupy.HasValue) + { + return false; + } + if (PlayerStaticData.UserRupyCount < info.costRupy) + { + return false; + } + break; + } + return true; + } + + public static DialogBase CreateBasePopupPurchaseConfirm(EventDelegate del_OkBtn) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(Data.SystemText.Get("Shop_0082")); + dialogBase.SetButtonDelegate(del_OkBtn); + dialogBase.SetPanelDepth(100); + return dialogBase; + } + + public static DialogBase CreatePurchaseConfirmPopup(ShopCommonSaleInfo info, SalesType costType, PurchaseConfirm prefabPurchaseConfirm, Action buyApiFunc, string warningTextId = null) + { + DialogBase dialogBase = CreateBasePopupPurchaseConfirm(new EventDelegate(delegate + { + buyApiFunc.Call(); + })); + PurchaseConfirm purchaseConfirm = UnityEngine.Object.Instantiate(prefabPurchaseConfirm); + dialogBase.SetObj(purchaseConfirm.gameObject); + string purchaseText = Data.SystemText.Get("Shop_0101", info.name.Replace("\n", "")); + switch (costType) + { + case SalesType.crystal: + purchaseConfirm.SetClystalConfirmDialog(info.costCrystal.Value, purchaseText, PlayerStaticData.UserCrystalCount, info.expirtyTimeInfo); + break; + case SalesType.rupy: + purchaseConfirm.SetRupyConfirmDialog(info.costRupy.Value, purchaseText, PlayerStaticData.UserRupyCount); + break; + case SalesType.ticket: + purchaseConfirm.SetLeaderSkinTicketConfirmDialog(info.costTicket.Value, purchaseText, info.haveTicketNum.Value, info.costTicketItemId.Value); + break; + } + if (warningTextId != null) + { + purchaseConfirm.SetWarningTextId(warningTextId); + } + return dialogBase; + } + + public static DialogBase CreateCrystalShortagePopup() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Shop_0092")); + dialogBase.SetText(Data.SystemText.Get("Shop_0013"), isWrapText: true); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetPanelDepth(100); + return dialogBase; + } + + public static DialogBase CreatePurchaseSuccess(string productName) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetText(Data.SystemText.Get("Shop_0022", productName), isWrapText: true); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + return dialogBase; + } + + public static void GetRewardNames(ShopCommonRewardInfo rewardInfo, out string typeName, out string detailName) + { + int type = rewardInfo.Type; + long userGoodsId = rewardInfo.UserGoodsId; + int num = rewardInfo.Num; + GetRewardNames(type, userGoodsId, num, out typeName, out detailName); + } + + public static void GetRewardNames(int type, long userGoodsId, int num, out string typeName, out string detailName) + { + typeName = ""; + detailName = ""; + switch ((UserGoods.Type)type) + { + case UserGoods.Type.RedEther: + typeName = Data.SystemText.Get("Common_0205"); + detailName = num + Data.SystemText.Get("Common_0116"); + break; + case UserGoods.Type.Crystal: + typeName = Data.SystemText.Get("Common_0201"); + detailName = num + Data.SystemText.Get("Common_0116"); + break; + case UserGoods.Type.Card: + { + typeName = Data.SystemText.Get("Common_0204"); + CardParameter cardParameterFromId = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId((int)userGoodsId); + detailName = cardParameterFromId.CardName + num + Data.SystemText.Get("Common_0117"); + break; + } + case UserGoods.Type.Sleeve: + typeName = ((!Data.Master.SleeveMgr.Get(userGoodsId).IsPremiumSleeve) ? Data.SystemText.Get("Common_0203") : Data.SystemText.Get("Common_0160")); + if (Data.Master.SleeveMgr.IsContainsInMaster(userGoodsId)) + { + detailName = Data.Master.SleeveMgr.Get(userGoodsId).sleeve_name; + } + else + { + detailName = ""; + } + break; + case UserGoods.Type.Emblem: + typeName = Data.SystemText.Get("Common_0145"); + if (Data.Master.EmblemMgr.IsContainsInMaster(userGoodsId)) + { + detailName = Data.Master.EmblemMgr.Get(userGoodsId)._name; + } + else + { + detailName = ""; + } + break; + case UserGoods.Type.Degree: + typeName = Data.SystemText.Get("Common_0144"); + if (Data.Master.DegreeMgr.IsContainsInMaster((int)userGoodsId)) + { + detailName = Data.Master.DegreeMgr.Get((int)userGoodsId)._name; + } + else + { + detailName = ""; + } + break; + case UserGoods.Type.Rupy: + typeName = Data.SystemText.Get("Common_0115"); + detailName = num + Data.SystemText.Get("Common_0120"); + break; + case UserGoods.Type.Item: + { + string text = Data.SystemText.Get("Common_0117"); + foreach (Item item in Data.Master.ItemList) + { + if (item.UserGoodsId == userGoodsId) + { + typeName = item.name; + text = item.unit; + } + } + detailName = num + text; + break; + } + case UserGoods.Type.Skin: + typeName = Data.SystemText.Get("Common_0143"); + detailName = GameMgr.GetIns().GetDataMgr().GetCharaPrmBySkinId((int)userGoodsId) + .chara_name; + break; + case UserGoods.Type.SpotCardPoint: + typeName = Data.SystemText.Get("Common_0161"); + detailName = num + Data.SystemText.Get("Common_0162"); + break; + case (UserGoods.Type)3: + case UserGoods.Type.SpotCard: + break; + } + } + + public static string GetRewardDetailName(ShopCommonRewardInfo rewardInfo) + { + int type = rewardInfo.Type; + long userGoodsId = rewardInfo.UserGoodsId; + int num = rewardInfo.Num; + string typeName = null; + string detailName = null; + GetRewardNames(type, userGoodsId, num, out typeName, out detailName); + return detailName; + } + + public static string GetRewardImagePath(ShopCommonRewardInfo rewardInfo, bool isFetch = false) + { + int type = rewardInfo.Type; + long userGoodsId = rewardInfo.UserGoodsId; + string result = ""; + switch ((UserGoods.Type)type) + { + case UserGoods.Type.Sleeve: + { + long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(userGoodsId); + result = Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture, isFetch); + break; + } + case UserGoods.Type.Emblem: + result = Toolbox.ResourcesManager.GetAssetTypePath(userGoodsId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isFetch); + break; + } + return result; + } + + public static string TrimProductName(string text) + { + int maxLength = (Global.IsAlphabetLanguage() ? 35 : 18); + return TrimProductName(text, maxLength); + } + + public static string TrimProductName(string text, int maxLength) + { + text = text.Replace("\n", ""); + if (text.Length > maxLength) + { + text = text.Remove(maxLength - 1); + text += "..."; + } + return text; + } + + public static void SetCostInfo(ShopCommonSaleInfo saleInfo, UILabel _labelCostCrystal, UILabel _labelCostRupy, UILabel _labelFree, UILabel _labelTicket) + { + SystemText systemText = Data.SystemText; + if (_labelTicket != null) + { + _labelTicket.gameObject.SetActive(value: false); + } + if (saleInfo.isFree) + { + _labelCostCrystal.gameObject.SetActive(value: false); + _labelCostRupy.gameObject.SetActive(value: false); + _labelFree.gameObject.SetActive(value: true); + _labelFree.text = systemText.Get("Shop_0103"); + return; + } + _labelFree.gameObject.SetActive(value: false); + if (saleInfo.costCrystal.HasValue && saleInfo.costRupy.HasValue) + { + _labelCostCrystal.gameObject.SetActive(value: true); + _labelCostCrystal.gameObject.transform.localPosition = POS_COST_LABLE_RIGHT; + _labelCostCrystal.text = systemText.Get("Shop_0112", saleInfo.costCrystal.Value.ToString()); + _labelCostRupy.gameObject.SetActive(value: true); + _labelCostRupy.gameObject.transform.localPosition = POS_COST_LABLE_LEFT; + _labelCostRupy.text = systemText.Get("Shop_0113", saleInfo.costRupy.Value.ToString()); + } + else if (saleInfo.costCrystal.HasValue) + { + _labelCostCrystal.gameObject.SetActive(value: true); + _labelCostCrystal.gameObject.transform.localPosition = POS_COST_LABLE_CENTER; + _labelCostCrystal.text = systemText.Get("Shop_0112", saleInfo.costCrystal.Value.ToString()); + _labelCostRupy.gameObject.SetActive(value: false); + } + else if (saleInfo.costRupy.HasValue) + { + _labelCostRupy.gameObject.SetActive(value: true); + _labelCostRupy.gameObject.transform.localPosition = POS_COST_LABLE_CENTER; + _labelCostRupy.text = systemText.Get("Shop_0113", saleInfo.costRupy.Value.ToString()); + _labelCostCrystal.gameObject.SetActive(value: false); + } + else if (saleInfo.costTicket.HasValue) + { + _labelCostCrystal.gameObject.SetActive(value: false); + _labelCostRupy.gameObject.SetActive(value: false); + _labelTicket.gameObject.SetActive(value: true); + _labelTicket.gameObject.transform.localPosition = POS_COST_LABLE_CENTER; + _labelTicket.text = systemText.Get("Shop_0189", saleInfo.costTicket.Value.ToString()); + } + else + { + _labelCostCrystal.gameObject.SetActive(value: false); + _labelCostRupy.gameObject.SetActive(value: false); + _labelFree.gameObject.SetActive(value: false); + } + } + + public static void OnResultCodeErrorDeckCodeInfo(int code) + { + switch (code) + { + case 10001: + { + DialogBase dialogBase2 = UIManager.GetInstance().CreateDialogClose(isSystem: true); + dialogBase2.SetTitleLabel(Data.SystemText.Get("Dia_BuyBuildDeck_006_Title")); + dialogBase2.SetText(Data.SystemText.Get("Dia_BuyBuildDeck_006_Body")); + break; + } + case 10005: + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true); + dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_BuyBuildDeck_007_Title")); + dialogBase.SetText(Data.SystemText.Get("Dia_BuyBuildDeck_007_Body")); + break; + } + default: + Wizard.ErrorDialog.Dialog.Create(code); + break; + } + } + + public static string GetTicketIconPath(string itemId, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath("ticket_" + itemId + "_icon", ResourcesManager.AssetLoadPathType.ShopItem, isFetch); + } + + public static string GetTicketIconRightDownPath(string itemId, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath("ticket_" + itemId + "_icon_right_down", ResourcesManager.AssetLoadPathType.ShopItem, isFetch); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ShopDrumrollScrollItem.cs b/SVSim.BattleEngine/Engine/Wizard/ShopDrumrollScrollItem.cs new file mode 100644 index 0000000..7a643a6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ShopDrumrollScrollItem.cs @@ -0,0 +1,89 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ShopDrumrollScrollItem : MonoBehaviour +{ + [SerializeField] + private GameObject _objNewMark; + + [SerializeField] + private GameObject _objPrerelease; + + [SerializeField] + private GameObject _objBadge; + + private GameObject _objNewEffect; + + private List _assetPathList = new List(); + + private void Awake() + { + _ = _objNewMark != null; + } + + private void OnDestroy() + { + if (_assetPathList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_assetPathList); + _assetPathList.Clear(); + } + } + + public void SetActiveNewMark(bool isActive) + { + if (_objNewMark == null) + { + return; + } + if (_objNewMark.activeSelf != isActive) + { + _objNewMark.SetActive(isActive); + } + if (isActive) + { + GameObject _objNewEffect = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("cmn_shop_icon_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject); + _objNewEffect.transform.SetParent(_objNewMark.transform); + _objNewEffect.transform.localPosition = Vector3.zero; + _assetPathList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_objNewEffect, delegate + { + GameMgr.GetIns().GetEffectMgr().ChangeMaskShader(_objNewEffect); + })); + _objNewEffect.SetActive(value: true); + } + } + + public void SetActiveBadge(bool isActive) + { + if (!(_objBadge == null) && _objBadge.activeSelf != isActive) + { + _objBadge.SetActive(isActive); + } + } + + public void SetActivePrereleaseMark(bool isActive) + { + if (_objPrerelease == null) + { + return; + } + if (_objPrerelease.activeSelf != isActive) + { + _objPrerelease.SetActive(isActive); + } + if (isActive) + { + GameObject effectObj = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("cmn_shop_icon_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject); + effectObj.transform.SetParent(_objPrerelease.transform); + effectObj.transform.localPosition = Vector3.zero; + _assetPathList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(effectObj, delegate + { + GameMgr.GetIns().GetEffectMgr().ChangeMaskShader(effectObj); + })); + effectObj.SetActive(value: true); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ShopNotification.cs b/SVSim.BattleEngine/Engine/Wizard/ShopNotification.cs new file mode 100644 index 0000000..9c9d417 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ShopNotification.cs @@ -0,0 +1,75 @@ +using LitJson; + +namespace Wizard; + +public class ShopNotification +{ + public class ShopAppealInfo + { + public RemainTime RemainTime { get; private set; } + + public bool IsNew { get; private set; } + + public bool IsCollaborationPanel { get; private set; } + + public bool NeedsCampaignDisplay { get; set; } + + public bool NeedsFooterBadgeIcon { get; set; } + + public ShopAppealInfo(JsonData data, double serverTime) + { + if (data.Count != 0) + { + RemainTime = (data.Keys.Contains("sale_end_time") ? new RemainTime(data["sale_end_time"].ToString(), serverTime) : null); + IsNew = data.Keys.Contains("is_new") && data["is_new"].ToBoolean(); + IsCollaborationPanel = data.Keys.Contains("is_collaboration_term") && data["is_collaboration_term"].ToBoolean(); + if (data.TryGetValue("is_open_free_gacha_campaign", out var value)) + { + NeedsCampaignDisplay = value.ToBoolean(); + } + if (data.TryGetValue("can_free_gacha", out var value2)) + { + NeedsFooterBadgeIcon = value2.ToBoolean(); + } + } + } + + public ShopAppealInfo() + { + RemainTime = null; + IsNew = false; + IsCollaborationPanel = false; + } + } + + public ShopAppealInfo AppealCardPack { get; private set; } + + public ShopAppealInfo AppealBuildDeck { get; private set; } + + public ShopAppealInfo AppealSleeve { get; private set; } + + public ShopAppealInfo AppealLeaderSkin { get; private set; } + + public void SetShopNotification(JsonData data) + { + double serverTime = data["data_headers"]["servertime"].ToDouble(); + JsonData jsonData = data["data"]["shop_notification"]; + AppealCardPack = new ShopAppealInfo(jsonData["card_pack"], serverTime); + AppealBuildDeck = new ShopAppealInfo(jsonData["build_deck"], serverTime); + AppealSleeve = new ShopAppealInfo(jsonData["sleeve"], serverTime); + AppealLeaderSkin = new ShopAppealInfo(jsonData["leader_skin"], serverTime); + } + + public void SetShopBadgeEnable(JsonData data) + { + JsonData jsonData = data["data"]["shop_notification"]; + AppealCardPack = ((AppealCardPack != null) ? AppealCardPack : new ShopAppealInfo()); + AppealBuildDeck = ((AppealBuildDeck != null) ? AppealBuildDeck : new ShopAppealInfo()); + AppealSleeve = ((AppealSleeve != null) ? AppealSleeve : new ShopAppealInfo()); + AppealLeaderSkin = ((AppealLeaderSkin != null) ? AppealLeaderSkin : new ShopAppealInfo()); + AppealCardPack.NeedsFooterBadgeIcon = jsonData["card_pack"].ToBoolean(); + AppealBuildDeck.NeedsFooterBadgeIcon = jsonData["build_deck"].ToBoolean(); + AppealSleeve.NeedsFooterBadgeIcon = jsonData["sleeve"].ToBoolean(); + AppealLeaderSkin.NeedsFooterBadgeIcon = jsonData["leader_skin"].ToBoolean(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ShopPanelAppealItem.cs b/SVSim.BattleEngine/Engine/Wizard/ShopPanelAppealItem.cs new file mode 100644 index 0000000..51aa092 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ShopPanelAppealItem.cs @@ -0,0 +1,111 @@ +using System.Collections; +using UnityEngine; + +namespace Wizard; + +public class ShopPanelAppealItem : MonoBehaviour +{ + [SerializeField] + private GameObject _rootAppealObj; + + [SerializeField] + private GameObject _objNewMark; + + [SerializeField] + private UILabel _labelRemainTime; + + [SerializeField] + [Tooltip("ๆฎ‹ใ‚Š{0}ๆ—ฅ")] + private string _remainDayTextId = "MyPage_0062"; + + [SerializeField] + [Tooltip("ๆฎ‹ใ‚Š{0}ๆ™‚้–“")] + private string _remainHourTextId = "MyPage_0063"; + + [SerializeField] + [Tooltip("ๆฎ‹ใ‚Š{0}ๅˆ†")] + private string _remainMinuteTextId = "MyPage_0064"; + + public void SetActiveAppealObj(bool isActive) + { + _rootAppealObj.SetActive(isActive); + } + + public void DelaySetActiveAppealObj(bool isActive, float delayTime) + { + if (base.gameObject.activeInHierarchy) + { + StartCoroutine(DelaySetActiveCoroutin(isActive, delayTime)); + } + } + + private IEnumerator DelaySetActiveCoroutin(bool isActive, float delayTime) + { + yield return new WaitForSeconds(delayTime); + SetActiveAppealObj(isActive); + } + + public void SetAppeal(ShopNotification.ShopAppealInfo appealInfo) + { + if (appealInfo.NeedsCampaignDisplay) + { + SetCampaignDisplay(); + SetActiveNewMark(appealInfo.IsNew); + } + else if (appealInfo.RemainTime != null) + { + SetRemainTimeLabel(appealInfo.RemainTime.Second); + SetActiveNewMark(isActive: false); + } + else + { + SetActiveNewMark(appealInfo.IsNew); + SetActiveRemainTime(isActive: false); + } + } + + public void SetActiveNewMark(bool isActive) + { + _objNewMark?.SetActive(isActive); + } + + public void SetActiveRemainTime(bool isActive) + { + _labelRemainTime?.gameObject.SetActive(isActive); + } + + private void SetRemainTimeLabel(int limitTime) + { + if (_labelRemainTime == null) + { + return; + } + if (limitTime <= 0) + { + _labelRemainTime.gameObject.SetActive(value: false); + return; + } + _labelRemainTime.gameObject.SetActive(value: true); + SystemText systemText = Data.SystemText; + if (limitTime < 3600) + { + int num = limitTime / 60 + 1; + _labelRemainTime.text = systemText.Get(_remainMinuteTextId, num.ToString()); + } + else if (limitTime < 86400) + { + int num2 = limitTime / 3600; + _labelRemainTime.text = systemText.Get(_remainHourTextId, num2.ToString()); + } + else + { + int num3 = limitTime / 86400; + _labelRemainTime.text = systemText.Get(_remainDayTextId, num3.ToString()); + } + } + + private void SetCampaignDisplay() + { + _labelRemainTime.text = Data.SystemText.Get("MyPage_0076"); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SimulationSetting.cs b/SVSim.BattleEngine/Engine/Wizard/SimulationSetting.cs new file mode 100644 index 0000000..66ee1b3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SimulationSetting.cs @@ -0,0 +1,20 @@ +namespace Wizard; + +public class SimulationSetting +{ + public bool IsHandRemovalValid { get; private set; } + + public bool UseLeaderAttackPreCheck { get; private set; } + + public bool NoSkipAttack { get; private set; } + + public bool CheckFirstActionFailure { get; private set; } + + public SimulationSetting(bool isHandRemovalValid, bool useLeaderAttackPreCheck, bool noSkipAttack = false, bool checkAct = true) + { + IsHandRemovalValid = isHandRemovalValid; + UseLeaderAttackPreCheck = useLeaderAttackPreCheck; + NoSkipAttack = noSkipAttack; + CheckFirstActionFailure = checkAct; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SkinProductDetail.cs b/SVSim.BattleEngine/Engine/Wizard/SkinProductDetail.cs new file mode 100644 index 0000000..2fd9af9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SkinProductDetail.cs @@ -0,0 +1,65 @@ +using Cute; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.SkinPurchase; + +namespace Wizard; + +public class SkinProductDetail : BaseProductDetail +{ + private const int WIDTH_PRODUCT_IMG_NORMAL = 249; + + private const int HEIGHT_PRODUCT_IMG_NORMAL = 199; + + private const int WIDTH_PRODUCT_IMG_LARGE = 370; + + private const int HEIGHT_PRODUCT_IMG_LARGE = 213; + + [SerializeField] + private GameObject _detailObjsParent; + + [SerializeField] + private ProductDetailPlate _productTemplate; + + public void SetMultiProductDetail(SkinSeriesPurchaseInfo seriesInfo) + { + Texture textureProductImage = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(seriesInfo.saleInfo.path, ResourcesManager.AssetLoadPathType.ShopClassSkin, isfetch: true)); + SetProductDetail(textureProductImage, seriesInfo.rewardInfoList); + if (Data.Master.LeaderSkinSeriesIdDic[seriesInfo.series_id].IsLargeImage) + { + _texProductImg.width = 370; + _texProductImg.height = 213; + } + else + { + _texProductImg.width = 249; + _texProductImg.height = 199; + } + _SetMultiSupplyList(seriesInfo); + ResetPositionScrollView(); + } + + public void SetSingleProductDetail(SkinProductInfo productInfo, string descriptionText = null) + { + _productTemplate.gameObject.SetActive(value: false); + Texture textureProductImage = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(productInfo.saleInfo.path, ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail, isfetch: true)); + SetProductDetail(textureProductImage, productInfo.rewardInfoList, descriptionText); + } + + private void _SetMultiSupplyList(SkinSeriesPurchaseInfo info) + { + bool flag = info.is_completed && info._rewardStatus != SkinSeriesPurchaseInfo.RewardStatus.not_got; + for (int i = 0; i < info.productList.Count; i++) + { + SkinProductInfo skinProductInfo = info.productList[i]; + if (!skinProductInfo.is_purchased || flag) + { + GameObject obj = NGUITools.AddChild(_detailObjsParent.gameObject, _productTemplate.gameObject); + obj.transform.localPosition = Vector3.up * TailPosY; + ProductDetailPlate component = obj.GetComponent(); + ClassCharacterMasterData charaPrmBySkinId = GameMgr.GetIns().GetDataMgr().GetCharaPrmBySkinId(skinProductInfo.leader_skin_id); + TailPosY -= component.SetProductData(skinProductInfo.saleInfo.name, charaPrmBySkinId, skinProductInfo.rewardInfoList); + } + } + _productTemplate.gameObject.SetActive(value: false); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SleeveBuyTask.cs b/SVSim.BattleEngine/Engine/Wizard/SleeveBuyTask.cs new file mode 100644 index 0000000..1ad1630 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SleeveBuyTask.cs @@ -0,0 +1,38 @@ +namespace Wizard; + +public class SleeveBuyTask : BaseTask +{ + public class SleeveBuyTaskParam : BaseParam + { + public int series_id; + + public int product_id; + + public int sales_type; + } + + public SleeveBuyTask() + { + base.type = ApiType.Type.SleeveBuy; + } + + public void SetParameter(int series_id, int productId, ShopCommonUtility.SalesType sales_type) + { + SleeveBuyTaskParam sleeveBuyTaskParam = new SleeveBuyTaskParam(); + sleeveBuyTaskParam.series_id = series_id; + sleeveBuyTaskParam.product_id = productId; + sleeveBuyTaskParam.sales_type = (int)sales_type; + base.Params = sleeveBuyTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SoftwareReset.cs b/SVSim.BattleEngine/Engine/Wizard/SoftwareReset.cs new file mode 100644 index 0000000..8df6d44 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SoftwareReset.cs @@ -0,0 +1,67 @@ +using Convention; +using Cute; +using UnityEngine; +using Wizard.RoomMatch; + +namespace Wizard; + +public static class SoftwareReset +{ + private const float BGM_FADE_OUT_TIME = 1f; + + private static string _bootScene; + + private static void resetAction() + { + Data.Clear(); + PaymentImpl.GetInstance().finalize(); + GameObject gameObject = GameObject.Find("_GameMgr"); + if (gameObject != null) + { + Object.Destroy(gameObject); + } + GameObject gameObject2 = GameObject.Find("_Game"); + if (gameObject2 != null) + { + Object.Destroy(gameObject2); + } + BGMManager.Dispose(); + Global.GAME_FONT = null; + Global.IS_LOAD_ALLDONE = false; + } + + public static void setAction() + { + SoftwareResetBase.setSoftwareResetAction(resetAction); + } + + public static void BgmFadeEndCallBack() + { + SoftwareResetBase.SoftwareReset(_bootScene, resetAction); + _bootScene = null; + } + + public static void exec(string sceneName = null, bool isFromUserDelete = false) + { + UIManager.GetInstance().isBattleRecovery = false; + _bootScene = sceneName; + SoundMgr soundMgr = GameMgr.GetIns().GetSoundMgr(); + soundMgr.StopBGM(BgmFadeEndCallBack, 1f); + soundMgr.StopSeAll(0f); + soundMgr.PlaySe(Se.TYPE.SYS_BTN_CANCEL_TRANS); + UIManager.GetInstance().CreatFadeClose(); + VideoHostingUtil.OnSoftwareReset(); + RoomBase.OnSoftwareReset(); + Offline.OnSoftwareReset(); + SealedController.OnSoftwareReset(); + PlayerPrefsCache.OnSoftwareReset(); + if (null != GameMgr.GetIns().GetBattleCtrl()) + { + GameMgr.GetIns().GetBattleCtrl().BattleRelease(); + } + if (BattleManagerBase.GetIns() != null) + { + BattleManagerBase.GetIns().DisposeBattleGameObj(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SpecialTreasureInfo.cs b/SVSim.BattleEngine/Engine/Wizard/SpecialTreasureInfo.cs new file mode 100644 index 0000000..191d75b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SpecialTreasureInfo.cs @@ -0,0 +1,36 @@ +using LitJson; + +namespace Wizard; + +public class SpecialTreasureInfo +{ + public int SpecialTreasureBoxNecessaryNumbers { get; private set; } + + public int ReceivedBoxNumbers { get; private set; } + + public bool IsGotSpecialTreasureBox { get; private set; } + + public bool IsTreasureBoxReadyToOpen + { + get + { + if (SpecialTreasureBoxNecessaryNumbers == ReceivedBoxNumbers) + { + return !IsGotSpecialTreasureBox; + } + return false; + } + } + + public SpecialTreasureInfo(JsonData json) + { + SpecialTreasureBoxNecessaryNumbers = json["special_treasure_box_necessary_numbers"].ToInt(); + ReceivedBoxNumbers = json["received_box_numbers"].ToInt(); + IsGotSpecialTreasureBox = json["is_got_special_treasure_box"].ToInt() == 1; + } + + public void SetGotSpecialTreasureBox(bool isGot) + { + IsGotSpecialTreasureBox = isGot; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SpeedChallengeInfo.cs b/SVSim.BattleEngine/Engine/Wizard/SpeedChallengeInfo.cs new file mode 100644 index 0000000..f927f26 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SpeedChallengeInfo.cs @@ -0,0 +1,43 @@ +using System; +using LitJson; + +namespace Wizard; + +public class SpeedChallengeInfo +{ + public DateTime Begin { get; private set; } + + public DateTime ApplyEnd { get; private set; } + + public DateTime Announce { get; private set; } + + public DateTime End { get; private set; } + + public string Message { get; private set; } + + public string ApplyUrl { get; private set; } + + public SpeedChallengeInfo(JsonData data) + { + Parse(data); + } + + private void Parse(JsonData data) + { + if (data.TryGetValue("schedule", out var value)) + { + Begin = DateTime.Parse(value["begin_time"].ToString()); + ApplyEnd = DateTime.Parse(value["apply_end_time"].ToString()); + Announce = DateTime.Parse(value["announce_time"].ToString()); + End = DateTime.Parse(value["end_time"].ToString()); + } + if (data.TryGetValue("dialog_message", out var value2)) + { + Message = value2.ToString().Replace("\\n", "\n"); + } + if (data.TryGetValue("apply_url", out var value3)) + { + ApplyUrl = value3.ToString(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SpineDisplay.cs b/SVSim.BattleEngine/Engine/Wizard/SpineDisplay.cs new file mode 100644 index 0000000..5b038db --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SpineDisplay.cs @@ -0,0 +1,223 @@ +using System.Collections.Generic; +using Cute; +using Spine.Unity; +using UnityEngine; + +namespace Wizard; + +public class SpineDisplay : MonoBehaviour +{ + private const string ANIMATION_TRANSFORM_NAME = "AnimationTransform"; + + private const string MASK_MATERIAL = "mt_encampment_mask"; + + private const int STENCIL_VALUE = 3; + + [SerializeField] + private bool _isEnableAspectFix = true; + + [SerializeField] + private bool _isEnableRenderTextureSizeSetting; + + [SerializeField] + private int _renderTextureSize = 2048; + + [SerializeField] + private int _renderTextureMobileSize = 1024; + + private GameObject _spineObject; + + private Animator[] _animators; + + private int _saveScreenWidth; + + private int _saveScreenHeight; + + private RenderTexture _renderTexture; + + private UITexture _uiTexture; + + private Camera _camera; + + private List _materialList = new List(); + + private const float RENDER_TEXTURE_BASE_SIZE_DEFAULT = 2048f; + + private const float ASPECT_RATIO = 0.5625f; + + private const float ASPECT_RATIO_REVERSE = 1.7777778f; + + private float RenderTextureSize + { + get + { + if (_isEnableRenderTextureSizeSetting) + { + return _renderTextureSize; + } + return 2048f; + } + } + + public List GetLoadPath(string path, bool fetch) + { + return new List + { + Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.UISpine, fetch), + Toolbox.ResourcesManager.GetAssetTypePath("mt_encampment_mask", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, fetch), + Toolbox.ResourcesManager.GetAssetTypePath(MaskTextureName(), ResourcesManager.AssetLoadPathType.ClassCharaTexture, fetch) + }; + } + + public void Initialize(string path, UITexture texture, Camera camera) + { + _uiTexture = texture; + _camera = camera; + SpriteRenderer spriteRenderer = base.gameObject.AddComponent(); + Material material = new Material(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("mt_encampment_mask", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true))); + material.SetInt("_Stencil", 3); + _materialList.Add(spriteRenderer.material); + spriteRenderer.material = material; + _materialList.Add(material); + spriteRenderer.sprite = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(MaskTextureName(), ResourcesManager.AssetLoadPathType.ClassCharaTexture, isfetch: true)); + GameObject original = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.UISpine, isfetch: true)); + _spineObject = Object.Instantiate(original); + MotionUtils.SetLayerAll(_spineObject, base.gameObject.layer); + Transform transform = _spineObject.transform; + transform.parent = base.transform; + transform.localPosition = Vector3.zero; + transform.localScale = Vector3.one; + transform.localEulerAngles = Vector3.zero; + MeshRenderer component = transform.GetComponentInChildren().GetComponent(); + _animators = transform.GetComponentsInChildren(); + Animator[] animators = _animators; + for (int i = 0; i < animators.Length; i++) + { + animators[i].speed = 1f; + } + StartMotion("NONE"); + SetMaterialInfo(component, 3); + CreateRenderTexture(); + UpdateUITextureSize(_uiTexture); + } + + public void StartMotion(string motionName) + { + Animator[] animators = _animators; + for (int i = 0; i < animators.Length; i++) + { + animators[i].SetTrigger(motionName); + } + } + + public bool IsPlaying() + { + Animator[] animators = _animators; + for (int i = 0; i < animators.Length; i++) + { + if ((double)animators[i].GetCurrentAnimatorStateInfo(0).normalizedTime < 1.0) + { + return true; + } + } + return false; + } + + private void CreateRenderTexture() + { + if (!(_renderTexture != null)) + { + if (_isEnableAspectFix) + { + _renderTexture = new RenderTexture((int)RenderTextureSize, (int)(RenderTextureSize * 0.5625f), 0, RenderTextureFormat.ARGB32); + } + else + { + _renderTexture = new RenderTexture((int)RenderTextureSize, (int)RenderTextureSize, 0, RenderTextureFormat.ARGB32); + } + _renderTexture.name = "SpineDisplay"; + _camera.targetTexture = _renderTexture; + _uiTexture.mainTexture = _renderTexture; + } + } + + private void OnDestroy() + { + if (_renderTexture != null) + { + _renderTexture.Release(); + Object.Destroy(_renderTexture); + _renderTexture = null; + } + foreach (Material material in _materialList) + { + Object.Destroy(material); + } + _materialList.Clear(); + } + + private string MaskTextureName() + { + return "tx_encampment_mask"; + } + + private void Update() + { + if (!(_camera == null) && !(_uiTexture == null) && (UIManager.GetInstance().FrontCameraPixelWidth != _saveScreenWidth || UIManager.GetInstance().FrontCameraPixelHeight != _saveScreenHeight)) + { + UpdateUITextureSize(_uiTexture); + } + } + + private void UpdateUITextureSize(UITexture uiTexture) + { + Camera frontCamera = UIManager.GetInstance().FrontCamera; + Vector3 localScale = uiTexture.transform.localScale; + uiTexture.transform.localScale = Vector3.one; + _saveScreenWidth = UIManager.GetInstance().FrontCameraPixelWidth; + _saveScreenHeight = UIManager.GetInstance().FrontCameraPixelHeight; + Vector3 position = new Vector3(0f, 1f, 0f); + Vector3 position2 = new Vector3(1f, 0f, 0f); + Vector3 position3 = frontCamera.ViewportToWorldPoint(position); + Vector3 position4 = frontCamera.ViewportToWorldPoint(position2); + Vector3 vector = uiTexture.transform.InverseTransformPoint(position3); + Vector3 vector2 = uiTexture.transform.InverseTransformPoint(position4); + uiTexture.transform.localScale = localScale; + float num = 0.5625f; + float num2 = frontCamera.pixelHeight; + float num3 = frontCamera.pixelWidth; + if (num2 / num3 < num) + { + float num4 = vector2.x - vector.x; + float num5 = num4 * num; + uiTexture.width = (int)num4; + uiTexture.height = (int)num5; + } + else + { + float num6 = vector.y - vector2.y; + float num7 = num6 * 1.7777778f; + uiTexture.width = (int)num7; + uiTexture.height = (int)num6; + } + } + + private void SetMaterialInfo(MeshRenderer meshRenderer, int stencil) + { + Material material = new Material(meshRenderer.material); + material.SetInt("_Stencil", stencil); + _materialList.Add(meshRenderer.material); + meshRenderer.material = material; + _materialList.Add(material); + for (int i = 0; i < meshRenderer.materials.Length; i++) + { + Material material2 = meshRenderer.materials[i]; + if (material2 != null && material2.GetInt("_Stencil") != stencil) + { + meshRenderer.materials[i] = new Material(material2); + meshRenderer.materials[i].SetInt("_Stencil", stencil); + _materialList.Add(meshRenderer.materials[i]); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SpotCardExchange.cs b/SVSim.BattleEngine/Engine/Wizard/SpotCardExchange.cs new file mode 100644 index 0000000..9b8a852 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SpotCardExchange.cs @@ -0,0 +1,350 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.SpotCardExchange; +using Wizard.UI.Common; + +namespace Wizard; + +public class SpotCardExchange : MonoBehaviour +{ + private const string SPRITE_CLASS_TAB_NEUTRAL = "class_tab_neutral"; + + private const int CONFIRM_DIALOG_DEPTH = 100; + + private const int CARD_OBJECT_DEPTH = 20; + + private const float CARD_OBJECT_SCALE = 0.36f; + + private const float CARD_OBJECT_COLLIDER_SCALE = 0.9f; + + [SerializeField] + private UILabel _labelSpotCardPoint; + + [SerializeField] + private SimpleScrollViewUI _spotCardScrollView; + + [SerializeField] + private UILabel _labelNoSpotCardList; + + [SerializeField] + private TabList _tabListClass; + + [SerializeField] + private UISprite _spriteClassTab; + + [SerializeField] + private PurchaseConfirm _purchaseConfirmDialog; + + private List _loadedResourceList = new List(); + + private UIAtlas _atlasProfile; + + private List _cardObjectList; + + [SerializeField] + private GameObject _cardObjectRoot; + + [SerializeField] + private GameObject _cardDetailRoot; + + private CardDetailUI _cardDetail; + + private List _loadedCardResourceList = new List(); + + private int _cardDetailIndex; + + private CardBasePrm.ClanType _displayClassType; + + private Dictionary> _spotCardListInClassDict = new Dictionary>(); + + private SpotCardExchangeInfoTask.PrereleaseExchangeInfo _prereleaseExchangeInfo; + + public void Init() + { + _labelSpotCardPoint.gameObject.SetActive(value: false); + InitCardDetail(); + StartCoroutine(LoadInitialResources(delegate + { + InitClassTab(); + UpdateExchangeableSpotCardList(CardBasePrm.ClanType.ALL); + })); + } + + private IEnumerator LoadInitialResources(Action onFinish) + { + UIManager.GetInstance().createInSceneCenterLoading(); + yield return StartCoroutine(LoadProfileAtlas()); + UIManager.GetInstance().closeInSceneCenterLoading(); + onFinish.Call(); + } + + private IEnumerator LoadProfileAtlas() + { + string profileAtlasName = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Profile, null); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetAsync(profileAtlasName, null)); + _loadedResourceList.Add(profileAtlasName); + profileAtlasName = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Profile, null, isload: true); + _atlasProfile = Toolbox.ResourcesManager.LoadObject(profileAtlasName).GetComponent(); + } + + private void UnloadResources() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList); + _loadedResourceList.Clear(); + } + + private void OnDestroy() + { + UnloadResources(); + UnloadCardObject(); + } + + private void InitCardDetail() + { + _cardDetail = DialogCreator.CreateCardDetailDialog(_cardDetailRoot, "Detail"); + _cardDetail.OnDragCard = CardDetailDragCallback; + _cardDetail.OnDetailCardUpdate = UpdateCardDetailArrowButtonVisible; + _cardDetail.gameObject.SetActive(value: false); + } + + private IEnumerator LoadCardObject(List cardIdList, Action onFinish) + { + if (cardIdList.Count == 0) + { + onFinish.Call(); + yield break; + } + UnloadCardObject(); + UIManager uiMgr = UIManager.GetInstance(); + uiMgr.createInSceneCenterLoading(); + bool isLoaded = false; + uiMgr.CardLoadSelect(null, cardIdList, base.gameObject.layer, is2D: true, delegate + { + isLoaded = true; + }); + while (!isLoaded) + { + yield return null; + } + InitCardObject(); + uiMgr.closeInSceneCenterLoading(); + onFinish.Call(); + } + + private void InitCardObject() + { + List cardList2DObjs = UIManager.GetInstance().getCardList2DObjs(); + _cardObjectList = new List(cardList2DObjs); + cardList2DObjs.Clear(); + List cardListAssetPathList = Toolbox.ResourcesManager.CardListAssetPathList; + _loadedCardResourceList.AddRange(new List(cardListAssetPathList)); + cardListAssetPathList.Clear(); + if (_cardObjectList == null) + { + return; + } + for (int i = 0; i < _cardObjectList.Count; i++) + { + GameObject cardObject = _cardObjectList[i].CardObj; + cardObject.SetActive(value: false); + UITexture[] componentsInChildren = cardObject.GetComponentsInChildren(); + foreach (UITexture uITexture in componentsInChildren) + { + if (uITexture.name.Contains("CardTexture")) + { + UITexture component = uITexture.GetComponent(); + Material material = component.material; + component.mainTexture = material.mainTexture; + component.material = null; + } + } + cardObject.transform.parent = _cardObjectRoot.transform; + CardListTemplate component2 = cardObject.GetComponent(); + component2.HideNum(); + component2._newLabel.gameObject.SetActive(value: false); + component2.SetId(_cardObjectList[i].ids); + component2.SetScale(0.36f); + component2.AddDepth(20); + int tempIndex = i; + component2.AddColliderToFrame(0.9f).onClick = delegate + { + _cardDetailIndex = tempIndex; + _cardDetail.OnPushCardDetailOn(cardObject); + }; + } + } + + private void CardDetailDragCallback(Vector2 vec) + { + if (!_cardDetail.IsEnableShowDetail) + { + return; + } + float x = vec.x; + if (!(Mathf.Abs(x) < 70f)) + { + int num = _cardDetailIndex + ((!(x > 0f)) ? 1 : (-1)); + if (num >= 0 && _cardObjectList.Count > num) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + _cardDetail.CloseDefault(playSe: false); + _cardDetail.ShowCardDetail(_cardObjectList[num].CardObj); + _cardDetailIndex = num; + UpdateCardDetailArrowButtonVisible(); + } + } + } + + private void UpdateCardDetailArrowButtonVisible() + { + _cardDetail.LeftButtonVisible = _cardDetailIndex > 0; + _cardDetail.RightButtonVisible = _cardDetailIndex < _cardObjectList.Count - 1; + } + + private void UnloadCardObject() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedCardResourceList); + _loadedCardResourceList.Clear(); + if (_cardObjectList != null) + { + for (int i = 0; i < _cardObjectList.Count; i++) + { + UnityEngine.Object.Destroy(_cardObjectList[i].CardObj.gameObject); + } + _cardObjectList.Clear(); + } + } + + private void InitClassTab() + { + _spriteClassTab.atlas = _atlasProfile; + for (int i = 0; i < 9; i++) + { + CardBasePrm.ClanType classType = (CardBasePrm.ClanType)i; + string spriteBaseName = ((classType != CardBasePrm.ClanType.ALL) ? ("class_tab_" + i.ToString("00")) : "class_tab_neutral"); + _tabListClass.AddTab(delegate + { + if (classType != _displayClassType) + { + ShowExchangeableSpotCardList(classType); + } + }, spriteBaseName).name = "Class_" + i + "(Clone)"; + } + _tabListClass.Reset(); + } + + private void UpdateDisplaySpotCardPoint() + { + _labelSpotCardPoint.text = GetHaveSpotCardPoint().ToString(); + } + + private int GetHaveSpotCardPoint() + { + return PlayerStaticData.UserSpotCardPointCount; + } + + private void UpdateExchangeableSpotCardList(CardBasePrm.ClanType displayClassType) + { + SpotCardExchangeInfoTask task = new SpotCardExchangeInfoTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + _spotCardListInClassDict = task.ExchangeableSpotCardListInClassDict; + _prereleaseExchangeInfo = task.PrereleaseInfo; + UpdateDisplaySpotCardPoint(); + _labelSpotCardPoint.gameObject.SetActive(value: true); + ShowExchangeableSpotCardList(displayClassType); + })); + } + + private void ShowExchangeableSpotCardList(CardBasePrm.ClanType classType) + { + _displayClassType = classType; + List cardList = _spotCardListInClassDict[_displayClassType]; + _spotCardScrollView.SetVisiable(isVisiable: false); + if (cardList.Count > 0) + { + List list = new List(cardList.Count); + CardMaster.GetInstance(CardMaster.CardMasterId.Default); + for (int i = 0; i < cardList.Count; i++) + { + list.Add(cardList[i].CardId); + } + StartCoroutine(LoadCardObject(list, delegate + { + _spotCardScrollView.SetVisiable(isVisiable: true); + _spotCardScrollView.CreateScrollView(cardList.Count, InitializePlate); + _labelNoSpotCardList.gameObject.SetActive(value: false); + })); + } + else + { + _labelNoSpotCardList.gameObject.SetActive(value: true); + } + } + + private void InitializePlate(int index, GameObject plate) + { + List list = _spotCardListInClassDict[_displayClassType]; + if (index >= list.Count) + { + plate.SetActive(value: false); + return; + } + SpotCardExchangePlate component = plate.GetComponent(); + component.SetData(list[index], GetHaveSpotCardPoint(), _prereleaseExchangeInfo, OnClickConfirmExchangeButton); + component.SetCardObject(_cardObjectList[index].CardObj, _cardObjectRoot); + } + + private void OnClickConfirmExchangeButton(SpotCardExchangeInfo spotCardExchangeInfo) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ShowConfirmExchangeDialog(spotCardExchangeInfo); + } + + private void ShowConfirmExchangeDialog(SpotCardExchangeInfo spotCardExchangeInfo) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetTitleLabel(systemText.Get("Shop_0153")); + dialogBase.SetButtonText(systemText.Get("Shop_0154")); + dialogBase.SetPanelDepth(100); + dialogBase.onPushButton1 = (Action)Delegate.Combine(dialogBase.onPushButton1, (Action)delegate + { + OnClickExchangeButton(spotCardExchangeInfo); + }); + PurchaseConfirm purchaseConfirm = UnityEngine.Object.Instantiate(_purchaseConfirmDialog); + dialogBase.SetObj(purchaseConfirm.gameObject); + purchaseConfirm.SetSpotCardPointConfirmDialog(spotCardExchangeInfo.ExchangePoint, systemText.Get("Shop_0152", spotCardExchangeInfo.GetExchangeCardText()), GetHaveSpotCardPoint()); + if (_prereleaseExchangeInfo.IsPrerelease && spotCardExchangeInfo.IsPrereleaseCard) + { + purchaseConfirm.SetWarningText(systemText.Get("Shop_0184", _prereleaseExchangeInfo.RemainingExchangeableCount.ToString())); + } + } + + private void OnClickExchangeButton(SpotCardExchangeInfo spotCardExchangeInfo) + { + SpotCardExchangeTask spotCardExchangeTask = new SpotCardExchangeTask(); + spotCardExchangeTask.SetParameter(spotCardExchangeInfo.CardId, spotCardExchangeInfo.ExchangePoint); + StartCoroutine(Toolbox.NetworkManager.Connect(spotCardExchangeTask, delegate + { + ShowSuccessExchangeDialog(spotCardExchangeInfo.GetExchangeCardText()); + UpdateDisplaySpotCardPoint(); + UpdateExchangeableSpotCardList(_displayClassType); + })); + } + + private void ShowSuccessExchangeDialog(string exchangedCardName) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Common_0021")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetText(systemText.Get("Shop_0155", exchangedCardName), isWrapText: true); + dialogBase.SetPanelDepth(100); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SpotCardExchangeDialog.cs b/SVSim.BattleEngine/Engine/Wizard/SpotCardExchangeDialog.cs new file mode 100644 index 0000000..9dd70f7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SpotCardExchangeDialog.cs @@ -0,0 +1,53 @@ +using System.Collections; +using UnityEngine; + +namespace Wizard; + +public class SpotCardExchangeDialog : MonoBehaviour +{ + private const int EXCHANGE_DIALOG_DEPTH = 900; + + [SerializeField] + private SpotCardExchange _spotCardExchangeOriginal; + + public void CreateSpotCardExchangeDialog() + { + if (FirstTips.IsFirstTipsOpen(FirstTips.TipsType.SpotCardExchange)) + { + CreateDialogWithFirstTips(); + } + else + { + CreateDialog(); + } + } + + private void CreateDialog() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetTitleLabel(Data.SystemText.Get("Shop_0149")); + dialogBase.SetLayer("MyPage"); + dialogBase.SetPanelDepth(900); + SpotCardExchange spotCardExchange = Object.Instantiate(_spotCardExchangeOriginal); + dialogBase.SetObj(spotCardExchange.gameObject); + spotCardExchange.Init(); + } + + private void CreateDialogWithFirstTips() + { + UIManager.GetInstance().StartFirstTips(FirstTips.TipsType.SpotCardExchange); + StartCoroutine(CreateDialogAfterOpenFirstTips()); + } + + private IEnumerator CreateDialogAfterOpenFirstTips() + { + UIManager uiMgr = UIManager.GetInstance(); + while (!uiMgr.IsActiveFirstTips()) + { + yield return null; + } + yield return new WaitForSeconds(0.5f); + CreateDialog(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SpotCardExchangeInfo.cs b/SVSim.BattleEngine/Engine/Wizard/SpotCardExchangeInfo.cs new file mode 100644 index 0000000..e3a0f9c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SpotCardExchangeInfo.cs @@ -0,0 +1,50 @@ +using LitJson; + +namespace Wizard; + +public class SpotCardExchangeInfo +{ + public enum ExchangeStatus + { + EnableExchange, + AlreadyExchange, + LimitOver + } + + public int CardId { get; private set; } + + public CardBasePrm.ClanType Class { get; private set; } + + public int PackId { get; private set; } + + public ExchangeStatus SpotCardExchangeStatus { get; private set; } + + public int ExchangePoint { get; private set; } + + public int ExchangeNum { get; private set; } + + public bool IsPrereleaseCard { get; private set; } + + public SpotCardExchangeInfo(JsonData data, int packId) + { + CardId = data["card_id"].ToInt(); + Class = (CardBasePrm.ClanType)data["class"].ToInt(); + PackId = packId; + SpotCardExchangeStatus = (ExchangeStatus)data["exchange_status"].ToInt(); + ExchangePoint = data["exchange_point"].ToInt(); + IsPrereleaseCard = data["is_pre_release"].ToBoolean(); + ExchangeNum = 1; + } + + public string GetExchangeCardText() + { + string userGoodsName = UserGoods.getUserGoodsName(UserGoods.Type.SpotCard, CardId); + return Data.SystemText.Get("Shop_0150", userGoodsName, ExchangeNum.ToString()); + } + + public string GetExchangeCardTextSmall() + { + string text = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(CardId).CardName + " " + Data.SystemText.Get("Shop_0248"); + return Data.SystemText.Get("Shop_0150", text, ExchangeNum.ToString()); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/StarterClassSelectDialog.cs b/SVSim.BattleEngine/Engine/Wizard/StarterClassSelectDialog.cs new file mode 100644 index 0000000..80d821b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/StarterClassSelectDialog.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class StarterClassSelectDialog : MonoBehaviour +{ + [SerializeField] + public GameObject StarterPurchaseConfirmationDialog; + + [SerializeField] + private List _class; + + private List _classSprites; + + private int _selectedClassId = -1; + + [SerializeField] + private GameObject _selectFrame; + + [SerializeField] + private UITexture _logoTexture; + + public void Init(DialogBase inDialog, PackConfig packConfig, PackChildGachaInfo info, int localSelectedClassId, Action onPurchase, Action onPushOk) + { + inDialog.SetSize(DialogBase.Size.M); + inDialog.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + inDialog.SetTitleLabel(Data.SystemText.Get("Shop_0239")); + inDialog.onPushButton1 = delegate + { + PackSetRotationStarterClassTask packSetRotationStarterClassTask = new PackSetRotationStarterClassTask(); + packSetRotationStarterClassTask.SetParameter(packConfig.PackId, _selectedClassId); + StartCoroutine(Toolbox.NetworkManager.Connect(packSetRotationStarterClassTask, delegate + { + onPushOk.Call(_selectedClassId); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + GameObject gameObject = UnityEngine.Object.Instantiate(StarterPurchaseConfirmationDialog); + dialogBase.SetObj(gameObject); + gameObject.GetComponent().Init(dialogBase, _selectedClassId, packConfig, info, onPurchase); + })); + }; + _logoTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(packConfig.GetPackTitleLogoTexturePath(isFetch: true)) as Texture; + UIManager.GetInstance().AttachAtlas(_class); + _classSprites = new List(); + for (int num = 0; num < _class.Count; num++) + { + _classSprites.Add(_class[num].GetComponent()); + SetEventOnClickBtn(_class[num], num + 1); + } + int classId = ((localSelectedClassId == 10) ? packConfig.SelectedClassId : localSelectedClassId); + SelectClass(classId, playSE: false); + } + + private void SetEventOnClickBtn(GameObject btn, int index) + { + UIEventListener.Get(btn).onClick = delegate + { + SelectClass(index); + }; + } + + private void SelectClass(int classId, bool playSE = true) + { + if (classId < 9 && classId >= 1) + { + if (playSE) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + } + if (classId != _selectedClassId) + { + _selectedClassId = classId; + SetSelectedFrame(_classSprites[classId - 1].gameObject); + } + } + } + + private void SetSelectedFrame(GameObject selectedClass) + { + _selectFrame.transform.localPosition = selectedClass.transform.localPosition; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/StoryFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/StoryFinishTask.cs new file mode 100644 index 0000000..ffda418 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/StoryFinishTask.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; +using LitJson; +using Wizard.Battle.Recovery; +using Wizard.Story; + +namespace Wizard; + +public class StoryFinishTask : BaseTask +{ + public class StoryFinishTaskParam : BaseParam + { + public int story_id; + + public int is_finish; + + public int evolve_count; + + public int total_turn; + + public int deck_no; + + public int use_build_deck; + + public int deck_format; + + public int class_id; + + public Dictionary mission; + + public string recovery_data; + + public string[] prosessing_time_data; + } + + public class StoryFinishTaskParamNoBattle : BaseParam + { + public int story_id; + + public int is_finish; + + public string selection_chapter_id; + + public bool is_select_another_end; + } + + private readonly int _storyId; + + public StoryFinishTask(SelectedStoryInfo storyInfo) + { + base.type = GetApiType(storyInfo.StoryApiType); + _storyId = storyInfo.FinishStoryId; + } + + private static ApiType.Type GetApiType(StoryApiType storyType) + { + return storyType switch + { + StoryApiType.MainStory => ApiType.Type.MainStoryFinish, + StoryApiType.LimitedStory => ApiType.Type.LimitedStoryFinish, + StoryApiType.EventStory => ApiType.Type.EventStoryFinish, + _ => throw new NotImplementedException(), + }; + } + + public void SetParameter(int is_finish, int evolve_count, int total_turn, int deck_no, bool is_build_deck, Format format, int class_id) + { + StoryFinishTaskParam storyFinishTaskParam = new StoryFinishTaskParam(); + BattleManagerBase ins = BattleManagerBase.GetIns(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + storyFinishTaskParam.story_id = _storyId; + storyFinishTaskParam.is_finish = is_finish; + storyFinishTaskParam.evolve_count = evolve_count; + storyFinishTaskParam.total_turn = total_turn; + storyFinishTaskParam.deck_no = deck_no; + storyFinishTaskParam.use_build_deck = (is_build_deck ? 1 : 0); + storyFinishTaskParam.deck_format = Data.FormatConvertApi(format); + storyFinishTaskParam.class_id = class_id; + if (RecoveryRecordManagerBase.IsExistsSingleRecoveryFile()) + { + if (dataMgr.RecoveryData == null) + { + dataMgr.SetRecoveryData(RecoveryOperationInfo.ReadRecoveryFile(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json")); + } + storyFinishTaskParam.recovery_data = dataMgr.RecoveryData.ToJson(); + } + BattlePlayerPair battlePlayerPair = ins.GetBattlePlayerPair(isPlayer: true); + BattleCardBase selfClass = ins.GetBattlePlayer(isPlayer: true).Class; + storyFinishTaskParam.mission = dataMgr.MissionNecessaryInformation.GetMissionNecessaryInfo(battlePlayerPair, selfClass); + base.Params = storyFinishTaskParam; + } + + public void SetParameterNoBattle(bool isFinish, bool isSelectAnotherEnding, string chosenUnlockChapterId) + { + base.Params = new StoryFinishTaskParamNoBattle + { + story_id = _storyId, + is_finish = (isFinish ? 1 : 0), + is_select_another_end = isSelectAnotherEnding, + selection_chapter_id = (isFinish ? chosenUnlockChapterId : null) + }; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + DeleteRecoveryFileIfBattleAlreadyEnded(num); + return num; + } + Data.StoryFinish.data = new StoryFinishDetail(); + Data.StoryFinish.data._responseData = base.ResponseData; + Data.StoryFinish.data.class_chara_experience = 0; + Data.StoryFinish.data.class_chara_level = 0; + Data.StoryFinish.data.get_class_chara_experience = base.ResponseData["data"]["get_class_experience"].ToInt(); + Data.StoryFinish.data.class_chara_experience = base.ResponseData["data"]["class_experience"].ToInt(); + Data.StoryFinish.data.class_chara_level = base.ResponseData["data"]["class_level"].ToInt(); + Data.MyPageNotifications.ParseBadgeInfos(base.ResponseData); + JsonData jsonData = base.ResponseData["data"]["achieved_info"]; + if (jsonData.GetJsonType() == JsonType.Object) + { + Data.StoryFinish.data.AchievedInfo.Read(jsonData); + } + Data.StoryFinish.data.StoryClearRewards = GetStoryClearRewards(base.ResponseData["data"]); + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } + + private static ReceivedReward[] GetStoryClearRewards(JsonData rootJsonData) + { + JsonData jsonData = rootJsonData["story_reward_list"]; + int count = jsonData.Count; + ReceivedReward[] array = new ReceivedReward[count]; + for (int i = 0; i < count; i++) + { + JsonData jsonData2 = jsonData[i]; + array[i] = new ReceivedReward(jsonData2["reward_type"].ToInt(), jsonData2["reward_id"].ToLong(), jsonData2["reward_num"].ToInt()); + } + return array; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/StoryNotification.cs b/SVSim.BattleEngine/Engine/Wizard/StoryNotification.cs new file mode 100644 index 0000000..5d4fdfc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/StoryNotification.cs @@ -0,0 +1,27 @@ +using LitJson; + +namespace Wizard; + +public class StoryNotification +{ + public bool IsDisplayRibbon { get; private set; } + + public bool IsDisplayBadge { get; private set; } + + public void SetStoryNotification(JsonData data) + { + JsonData data2 = data["data"]["story_notification"]; + IsDisplayRibbon = data2.GetValueOrDefault("is_display_ribbon", defaultValue: false); + IsDisplayBadge = data2.GetValueOrDefault("is_display_badge", defaultValue: false); + } + + public void SetIsDisplayBadge(JsonData data) + { + IsDisplayBadge = data.GetValueOrDefault("is_display_badge", defaultValue: false); + } + + public void TurnOffIsDisplayBadge() + { + IsDisplayBadge = false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/StorySectionBtn.cs b/SVSim.BattleEngine/Engine/Wizard/StorySectionBtn.cs new file mode 100644 index 0000000..f622067 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/StorySectionBtn.cs @@ -0,0 +1,175 @@ +using System; +using System.Collections; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class StorySectionBtn : MonoBehaviour +{ + public const string BTN_IMAGE_NAME_SUFFIX_OFF = "{0}_off"; + + public const string BTN_IMAGE_NAME_SUFFIX_ON = "{0}_on"; + + private const int POS_Y_NAME_LABEL = 14; + + private const int POS_Y_NAME_LABEL_COMPLETE = 0; + + private const int PROLOGUE_SECTION_ID = 0; + + [SerializeField] + private UILabel _labelSectionNo; + + [SerializeField] + private UILabel _labelSectionName; + + [SerializeField] + private UILabel _labelSectionClearClassNum; + + [SerializeField] + private Transform _labelSectionCenterRoot; + + [SerializeField] + private UILabel _labelSectionNameCenter; + + [SerializeField] + private UILabel _labelSectionClearClassNumCenter; + + [SerializeField] + private GameObject _labelNewMark; + + [SerializeField] + private UITexture _textureBtnImage; + + [SerializeField] + private UISprite _textureCompleteImage; + + private Texture _textureNormalImage; + + private Texture _texturePressImage; + + [SerializeField] + private UIButton _btnSectionSummary; + + public int SectionId { get; private set; } + + public void SetData(StorySectionData sectionData, Action onClickSectionBtn, bool isLimitedOrEventStory) + { + SectionId = sectionData.Id; + UILabel uILabel; + if (!isLimitedOrEventStory && Data.SystemText.Get("Dialog_Text_Alignment") == "Left") + { + _labelSectionNameCenter.gameObject.SetActive(value: false); + _labelSectionClearClassNumCenter.gameObject.SetActive(value: false); + _labelSectionNo.gameObject.SetActive(value: true); + _labelSectionName.gameObject.SetActive(value: true); + _labelSectionClearClassNum.gameObject.SetActive(value: true); + _labelSectionNo.text = sectionData.NameNo; + _labelSectionName.text = sectionData.Name; + uILabel = _labelSectionClearClassNum; + } + else + { + _labelSectionNameCenter.gameObject.SetActive(value: true); + _labelSectionClearClassNumCenter.gameObject.SetActive(value: true); + _labelSectionNo.gameObject.SetActive(value: false); + _labelSectionName.gameObject.SetActive(value: false); + _labelSectionClearClassNum.gameObject.SetActive(value: false); + _labelSectionNameCenter.text = sectionData.NameNo + sectionData.Name; + uILabel = _labelSectionClearClassNumCenter; + } + Vector3 localPosition = uILabel.transform.parent.transform.localPosition; + if (sectionData.ReleasedCharaCount > 0 && !sectionData.IsFinish) + { + uILabel.gameObject.SetActive(value: true); + uILabel.text = Data.SystemText.Get("Story_0063", sectionData.FinishedCharaCount.ToString(), sectionData.ReleasedCharaCount.ToString()); + uILabel.transform.parent.transform.localPosition = new Vector3(localPosition.x, 14f, localPosition.z); + } + else + { + uILabel.gameObject.SetActive(value: false); + uILabel.transform.parent.transform.localPosition = new Vector3(localPosition.x, 0f, localPosition.z); + } + _textureNormalImage = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath($"{sectionData.ImageName}_off", ResourcesManager.AssetLoadPathType.UiStory, isfetch: true)) as Texture; + _texturePressImage = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath($"{sectionData.ImageName}_on", ResourcesManager.AssetLoadPathType.UiStory, isfetch: true)) as Texture; + _textureBtnImage.mainTexture = _textureNormalImage; + if (sectionData.IsFinish) + { + _textureCompleteImage.gameObject.SetActive(value: true); + } + else + { + _textureCompleteImage.gameObject.SetActive(value: false); + } + UIEventListener uIEventListener = UIEventListener.Get(base.gameObject); + uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + onClickSectionBtn.Call(); + }); + UIEventListener uIEventListener2 = UIEventListener.Get(base.gameObject); + uIEventListener2.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener2.onPress, (UIEventListener.BoolDelegate)delegate + { + StartCoroutine(OnPressImage()); + }); + if (sectionData.IsUnderMaintenance) + { + SetDisableBtn(isDisable: true); + GameMgr.GetIns().GetPrefabMgr().Load("Prefab/UI/Menu/CardPanelMaintenancePlate"); + GameObject prefab = GameMgr.GetIns().GetPrefabMgr().Get("Prefab/UI/Menu/CardPanelMaintenancePlate"); + NGUITools.AddChild(base.gameObject, prefab).GetComponent().SetDepth(_labelSectionName.depth + 1); + } + if (sectionData.Id != 0 && !isLimitedOrEventStory) + { + _btnSectionSummary.gameObject.SetActive(value: true); + _btnSectionSummary.onClick.Clear(); + _btnSectionSummary.onClick.Add(new EventDelegate(delegate + { + OnClickSectionSummaryBtn(sectionData.Id); + })); + } + else + { + _btnSectionSummary.gameObject.SetActive(value: false); + } + DispNewMark(inDisp: false); + if (isLimitedOrEventStory) + { + LimitedStoryAjustPosition(); + } + } + + private void LimitedStoryAjustPosition() + { + _textureCompleteImage.transform.localPosition = new Vector3(178f, _textureCompleteImage.transform.localPosition.y, _textureCompleteImage.transform.localPosition.z); + _labelSectionCenterRoot.transform.localPosition = Vector3.zero; + _labelSectionNameCenter.width = 280; + _labelSectionNameCenter.height = 60; + } + + public void SetDisableBtn(bool isDisable) + { + UIManager.SetObjectToGrey(_textureBtnImage.gameObject, isDisable); + } + + private IEnumerator OnPressImage() + { + _textureBtnImage.mainTexture = _texturePressImage; + while (Input.GetMouseButton(0)) + { + yield return null; + } + _textureBtnImage.mainTexture = _textureNormalImage; + } + + private void OnClickSectionSummaryBtn(int sectionId) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + StorySectionSummaryDialog.Create(sectionId); + } + + public void DispNewMark(bool inDisp) + { + _labelNewMark.SetActive(inDisp); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/StorySelectPage.cs b/SVSim.BattleEngine/Engine/Wizard/StorySelectPage.cs new file mode 100644 index 0000000..aec9677 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/StorySelectPage.cs @@ -0,0 +1,408 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.Story; + +namespace Wizard; + +public class StorySelectPage : UIBase +{ + private const int NO_SECTION_ID = -1; + + private const int PROLOGUE_SECTION_ID = 0; + + private const int MAX_NUM_BTN_IN_TABLE = 6; + + private const float DRAG_DEGREE = 70f; + + private const float MOVE_PAGE_DURATION = 0.2f; + + [SerializeField] + private GameObject _backGroundObj; + + [SerializeField] + private UIAnchor _backGroundEffectAnchor; + + [SerializeField] + private UIGrid _sectionTableParent; + + [SerializeField] + private UIGrid _originalSectionTable; + + [SerializeField] + private StorySectionBtn _originalSectionBtn; + + [SerializeField] + private BoxCollider _flickCollider; + + [SerializeField] + private BoxCollider _leftButton; + + [SerializeField] + private BoxCollider _rightButton; + + [SerializeField] + private UIPageIndicator _indicator; + + [SerializeField] + private GameObject _mainStoryBgRoot; + + [SerializeField] + private GameObject _limitedStoryBgRoot; + + [SerializeField] + private UITexture _limitedStoryBgTexture; + + [SerializeField] + private GameObject _bgEffectRoot; + + private string _limitedStoryBgTextureName = "bg_limited_story"; + + private string _limitedStoryBgEffectName = "cmn_bg_limited_story_1"; + + private readonly Vector3 EFFECT_SCALE = new Vector3(320f, 320f, 320f); + + private List _sectionTableList = new List(); + + private List _sectionBtnList = new List(); + + private List _loadPathList = new List(); + + private TopBar _topBar; + + private Vector3 _parentFirstPos; + + private int _currentPage; + + private bool _isChangePage; + + private string _lastChapterClearTextId; + + public static int SelectSectionId = -1; + + private SelectedStoryInfo SelectedStoryInfo => Data.SelectedStoryInfo; + + private UIManager.ViewScene ChapterSelectionView => SelectedStoryInfo.ChapterSelectionView; + + private bool IsEntranceLimitedStory => SelectedStoryInfo.StoryEntranceType == StoryEntranceType.LimitedStory; + + public override void onFirstStart() + { + _backGroundObj.SetLayer(LayerMask.NameToLayer("FrontUI"), isSetChildren: true); + _backGroundEffectAnchor.uiCamera = NGUITools.FindCameraForLayer(_backGroundEffectAnchor.gameObject.layer); + base.IsShowFooterMenu = true; + base.onFirstStart(); + } + + protected override void onOpen() + { + base.onOpen(); + ResetSelectedStoryInfo(); + _mainStoryBgRoot.SetActive(!IsEntranceLimitedStory); + _limitedStoryBgRoot.SetActive(IsEntranceLimitedStory); + StorySectionTask storySectionTask = new StorySectionTask(SelectedStoryInfo); + storySectionTask.SetParameter(isDispFirstTips: false); + StartCoroutine(Toolbox.NetworkManager.Connect(storySectionTask, delegate + { + InitOrRedirect(); + })); + } + + protected override void onClose() + { + Final(); + base.onClose(); + } + + private void InitOrRedirect() + { + StorySectionData storySectionData = null; + if (SelectSectionId != -1) + { + storySectionData = Data.StoryWorldDataManager.FindSectionData(SelectSectionId); + SelectSectionId = -1; + } + if (storySectionData != null) + { + ChangeViewBySectionData(storySectionData, isRedirect: true); + } + else + { + Init(); + } + UIManager.GetInstance()._Footer.TurnOffStoryBadgeIcon(isTurnOffDisplayBadgeFlag: true); + } + + private void Init() + { + InitTopBar(); + InitFooter(); + InitStorySelect(); + } + + private void Final() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadPathList); + _loadPathList.Clear(); + } + + private void InitTopBar() + { + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.MyPageMenuIndex = 1; + changeViewSceneParam.IsCutCardMotion = true; + _topBar = UIManager.GetInstance().CreateTopBar(base.gameObject, Data.SystemText.Get("Story_0059"), UIManager.ViewScene.MyPage, MoneyDraw: false, changeViewSceneParam); + _topBar.gameObject.layer = LayerMask.NameToLayer("MyPage"); + } + + private void InitFooter() + { + UIManager instance = UIManager.GetInstance(); + instance.setBackScene(base.gameObject, UIManager.ViewScene.MyPage); + instance._Footer.UpdateCurrentIndex(1); + } + + private void InitStorySelect() + { + _parentFirstPos = _sectionTableParent.transform.localPosition; + UIEventListener uIEventListener = UIEventListener.Get(_flickCollider.gameObject); + uIEventListener.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener.onDrag, new UIEventListener.VectorDelegate(OnDragPanel)); + UIEventListener uIEventListener2 = UIEventListener.Get(_rightButton.gameObject); + uIEventListener2.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener2.onClick, (UIEventListener.VoidDelegate)delegate + { + NextPage(); + }); + UIEventListener uIEventListener3 = UIEventListener.Get(_leftButton.gameObject); + uIEventListener3.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener3.onClick, (UIEventListener.VoidDelegate)delegate + { + PrevPage(); + }); + StartCoroutine(LoadImages(delegate + { + SetSectionBtn(); + _indicator.Init(_sectionTableList.Count); + ChangePage(1); + UIManager.GetInstance().OnReadyViewScene(isFadein: true, null, OnFinishFadeIn); + })); + } + + private void OnDragPanel(GameObject obj, Vector2 dir) + { + if (dir.x >= 70f) + { + PrevPage(); + } + else if (dir.x <= -70f) + { + NextPage(); + } + } + + private void NextPage() + { + if (ChangePage(_currentPage + 1)) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + } + } + + private void PrevPage() + { + if (ChangePage(_currentPage - 1)) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + } + } + + private bool ChangePage(int page, bool isAnimation = true) + { + if (_isChangePage) + { + return false; + } + if (!IsValidPage(page)) + { + return false; + } + _currentPage = page; + Vector3 vector = _parentFirstPos + Vector3.left * _sectionTableParent.cellWidth * (page - 1); + if (isAnimation) + { + TweenPosition tweenPosition = TweenPosition.Begin(_sectionTableParent.gameObject, 0.2f, vector); + _isChangePage = true; + tweenPosition.SetOnFinished(delegate + { + _isChangePage = false; + }); + } + else + { + _sectionTableParent.transform.localPosition = vector; + _isChangePage = false; + } + _rightButton.gameObject.SetActive(IsValidPage(page + 1)); + _leftButton.gameObject.SetActive(IsValidPage(page - 1)); + _indicator.UpdateIndicator(page); + return true; + } + + private bool IsValidPage(int page) + { + if (_sectionTableList.Count > 0 && page > 0) + { + return page <= _sectionTableList.Count; + } + return false; + } + + private void ChangeViewBySectionData(StorySectionData inSectionData, bool isRedirect = false) + { + if (inSectionData.Id == 0) + { + OnClickTutorialSectionBtn(); + return; + } + SelectedStoryInfo.SetSection(inSectionData); + GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.Story; + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + if (isRedirect) + { + changeViewSceneParam.WaitTime = 0f; + } + if (inSectionData.IsLeaderSelect) + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.ClassSelectionPage, changeViewSceneParam, ClassSelectionPageParam.CreateStorySelect()); + } + else + { + UIManager.GetInstance().ChangeViewScene(ChapterSelectionView, changeViewSceneParam); + } + } + + private void OnClickTutorialSectionBtn() + { + SelectedStoryInfo.SetSection(StorySection.TUTORIAL_SECTION_ID); + SelectedStoryInfo.SetSectionChara(500008); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.AreaSelect); + } + + private IEnumerator LoadImages(Action callBack) + { + IReadOnlyList sectionDatas = Data.StoryWorldDataManager.SectionDatas; + ResourcesManager resMgr = Toolbox.ResourcesManager; + List assetList = new List(); + for (int i = 0; i < sectionDatas.Count; i++) + { + string imageName = sectionDatas[i].ImageName; + assetList.Add(resMgr.GetAssetTypePath($"{imageName}_off", ResourcesManager.AssetLoadPathType.UiStory)); + assetList.Add(resMgr.GetAssetTypePath($"{imageName}_on", ResourcesManager.AssetLoadPathType.UiStory)); + } + if (IsEntranceLimitedStory) + { + assetList.Add(resMgr.GetAssetTypePath(_limitedStoryBgTextureName, ResourcesManager.AssetLoadPathType.UiStory)); + assetList.Add(resMgr.GetAssetTypePath(_limitedStoryBgEffectName, ResourcesManager.AssetLoadPathType.Effect2D)); + } + yield return StartCoroutine(resMgr.LoadAssetGroupAsync(assetList, null)); + _loadPathList.AddRange(assetList); + if (IsEntranceLimitedStory) + { + bool isLoadBGEffect = false; + GameObject effectObject = UnityEngine.Object.Instantiate(resMgr.LoadObject(resMgr.GetAssetTypePath(_limitedStoryBgEffectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true))); + effectObject.transform.SetParent(_bgEffectRoot.transform); + effectObject.transform.localScale = EFFECT_SCALE; + _limitedStoryBgTexture.mainTexture = resMgr.LoadObject(resMgr.GetAssetTypePath(_limitedStoryBgTextureName, ResourcesManager.AssetLoadPathType.UiStory, isfetch: true)) as Texture; + _loadPathList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(effectObject, delegate + { + isLoadBGEffect = true; + })); + while (!isLoadBGEffect) + { + yield return null; + } + effectObject.SetActive(value: true); + } + callBack.Call(); + } + + private void SetSectionBtn() + { + IReadOnlyList sectionDatas = Data.StoryWorldDataManager.SectionDatas; + _sectionBtnList.Clear(); + for (int i = 0; i < sectionDatas.Count; i++) + { + StorySectionData data = sectionDatas[i]; + CreateSectionBtn(onClickSectionBtn: (!data.IsSpoiler) ? ((Action)delegate + { + ChangeViewBySectionData(data); + }) : ((Action)delegate + { + CreateSpoilerConfirmationDialog(data); + }), sectionData: data); + } + _originalSectionBtn.gameObject.SetActive(value: false); + for (int num = 0; num < _sectionTableList.Count; num++) + { + _sectionTableList[num].Reposition(); + } + _sectionTableParent.Reposition(); + } + + public void CreateSpoilerConfirmationDialog(StorySectionData inSectionData) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetTitleLabel(systemText.Get("Story_0080")); + dialogBase.SetButtonText(systemText.Get("Story_0081")); + string text = inSectionData.Name; + text = text.Replace("\n", " "); + string text2 = systemText.Get("Story_0076", text, Data.Master.GetStorySectionTitleText(inSectionData.SpoilerMessage)); + dialogBase.SetText(text2); + dialogBase.onPushButton1 = delegate + { + ChangeViewBySectionData(inSectionData); + }; + } + + private void CreateSectionBtn(StorySectionData sectionData, Action onClickSectionBtn) + { + if (_sectionBtnList.Count % 6 == 0) + { + _sectionTableList.Add(NGUITools.AddChild(_sectionTableParent.gameObject, _originalSectionTable.gameObject).GetComponent()); + } + GameObject obj = NGUITools.AddChild(_sectionTableList[_sectionTableList.Count - 1].gameObject, _originalSectionBtn.gameObject); + StorySectionBtn component = obj.GetComponent(); + bool isLimitedOrEventStory = sectionData.StoryApiType == StoryApiType.LimitedStory || sectionData.StoryApiType == StoryApiType.EventStory; + component.SetData(sectionData, onClickSectionBtn, isLimitedOrEventStory); + component.DispNewMark(sectionData.IsNew); + _sectionBtnList.Add(component); + UIEventListener uIEventListener = UIEventListener.Get(obj.gameObject); + uIEventListener.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener.onDrag, new UIEventListener.VectorDelegate(OnDragPanel)); + } + + private void OnFinishFadeIn() + { + if (_lastChapterClearTextId != null) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetTitleLabel(systemText.Get("Common_0021")); + dialogBase.SetButtonText(systemText.Get("Common_0004")); + dialogBase.SetText(systemText.Get(_lastChapterClearTextId)); + dialogBase.OnClose = delegate + { + AreaSelectUI.CheckPreBuildDeckConfirmDialog(); + }; + _lastChapterClearTextId = null; + } + } + + private void ResetSelectedStoryInfo() + { + _lastChapterClearTextId = SelectedStoryInfo.LastChapterClearTextId; + SelectedStoryInfo.ClearInfoForSectionSelectionScene(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SubClassSelectDialog.cs b/SVSim.BattleEngine/Engine/Wizard/SubClassSelectDialog.cs new file mode 100644 index 0000000..8e744cc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SubClassSelectDialog.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class SubClassSelectDialog : MonoBehaviour +{ + [SerializeField] + private UIGrid _subClassButtonGrid; + + [SerializeField] + private ClassSelectionButton _classButtonParts; + + [SerializeField] + private GameObject _selectMarkSubClass; + + private ClassSelectionButton _firstSelectClassButton; + + private List _loadPathList = new List(); + + public ClassCharacterMasterData SelectCharaMasterData { get; private set; } + + public static DialogBase Create(DeckData srcDeck, SubClassSelectDialog prefab, List usedClass, Action onClickButton1) + { + UIManager.GetInstance().createInSceneCenterLoading(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("Card_0282")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(Data.SystemText.Get("Card_0284")); + dialogBase.SetPanelDepth(100); + SubClassSelectDialog subClassSelectParts = UnityEngine.Object.Instantiate(prefab.gameObject).GetComponent(); + dialogBase.SetObj(subClassSelectParts.gameObject); + UIManager.GetInstance().StartCoroutine(subClassSelectParts.Init(srcDeck, usedClass, delegate + { + UIManager.GetInstance().closeInSceneCenterLoading(); + })); + dialogBase.onPushButton1 = delegate + { + onClickButton1.Call(subClassSelectParts.SelectCharaMasterData.class_id); + }; + return dialogBase; + } + + private IEnumerator Init(DeckData srcDeck, List usedClass, Action onComplete) + { + int num = 9; + _selectMarkSubClass.SetActive(value: false); + _classButtonParts.gameObject.SetActive(value: false); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + List classCharacterMasterDatas = new List(); + for (int i = 1; i < num; i++) + { + classCharacterMasterDatas.Add(dataMgr.GetCharaPrmByClassId(i)); + } + ResourcesManager resMgr = Toolbox.ResourcesManager; + foreach (ClassCharacterMasterData item in classCharacterMasterDatas) + { + _loadPathList.Add(resMgr.GetAssetTypePath(item.skin_id.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaButton)); + } + _loadPathList.Add(resMgr.GetAssetTypePath("empty", ResourcesManager.AssetLoadPathType.ClassCharaButton)); + yield return UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadPathList, null)); + foreach (ClassCharacterMasterData item2 in classCharacterMasterDatas) + { + if (item2.class_id != srcDeck.GetDeckClassID()) + { + GameObject obj = NGUITools.AddChild(_subClassButtonGrid.gameObject, _classButtonParts.gameObject); + bool flag = usedClass.Contains(item2.class_id); + ClassSelectionButton component = obj.GetComponent(); + component.Init(item2, resMgr.LoadObject(resMgr.GetAssetTypePath(item2.skin_id.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaButton, isfetch: true)), OnClickClassButton, isShowStoryClearLabel: false, flag, showNotificationIcon: false); + obj.SetActive(value: true); + if (_firstSelectClassButton == null && !flag) + { + _firstSelectClassButton = component; + } + } + } + _subClassButtonGrid.Reposition(); + SetSelection(_firstSelectClassButton); + _selectMarkSubClass.SetActive(value: true); + onComplete.Call(); + } + + private void OnClickClassButton(ClassSelectionButton classButton) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + SelectSubClass(classButton); + } + + private void SelectSubClass(ClassSelectionButton classButton) + { + if (SelectCharaMasterData != classButton.ClassCharacterMasterData) + { + SetSelection(classButton); + } + } + + private void SetSelection(ClassSelectionButton classButton) + { + SelectCharaMasterData = classButton.ClassCharacterMasterData; + _selectMarkSubClass.transform.position = classButton.transform.position; + } + + private void OnDestroy() + { + if (_loadPathList.Count > 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadPathList); + _loadPathList.Clear(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SummonedVirtualCard.cs b/SVSim.BattleEngine/Engine/Wizard/SummonedVirtualCard.cs new file mode 100644 index 0000000..679bfd1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SummonedVirtualCard.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class SummonedVirtualCard : AIVirtualCard +{ + public SummonedVirtualCard(BattleCardBase card, AIVirtualField field) + : base(card, field) + { + } + + protected override void InitializeFromBattleCardBase(BattleCardBase origin) + { + InitializeFromBattleCardBaseBasic(origin); + IsSpell = false; + IsLeader = false; + if (origin.Tribe != null && origin.Tribe.Count > 0) + { + for (int i = 0; i < origin.Tribe.Count; i++) + { + AppendTribe(origin.Tribe[i]); + } + } + } + + public override bool IsFollower(List playPtn) + { + return IsUnit; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SupplyLabelPlate.cs b/SVSim.BattleEngine/Engine/Wizard/SupplyLabelPlate.cs new file mode 100644 index 0000000..e75ce44 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SupplyLabelPlate.cs @@ -0,0 +1,25 @@ +using UnityEngine; + +namespace Wizard; + +public class SupplyLabelPlate : MonoBehaviour +{ + [SerializeField] + private UILabel _labelSupplyType; + + [SerializeField] + private UILabel _labelSupplyName; + + public void SetSupplyText(ShopCommonRewardInfo rewardInfo) + { + string typeName = null; + string detailName = null; + ShopCommonUtility.GetRewardNames(rewardInfo, out typeName, out detailName); + _labelSupplyType.text = typeName; + _labelSupplyName.text = detailName; + if (rewardInfo.IsAlreadyGet) + { + _labelSupplyName.text = Data.SystemText.Get("Shop_0237"); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SupplyLabelPlateListUI.cs b/SVSim.BattleEngine/Engine/Wizard/SupplyLabelPlateListUI.cs new file mode 100644 index 0000000..822eb05 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SupplyLabelPlateListUI.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class SupplyLabelPlateListUI : MonoBehaviour +{ + [SerializeField] + private SupplyLabelPlate _SupplyTemplate; + + [SerializeField] + private UIGrid _parentGrid; + + public float SetSupplyList(List rewardInfoList) + { + _SupplyTemplate.gameObject.SetActive(value: false); + if (rewardInfoList.Count <= 0) + { + return 0f; + } + for (int i = 0; i < rewardInfoList.Count; i++) + { + GameObject obj = NGUITools.AddChild(_parentGrid.gameObject, _SupplyTemplate.gameObject); + obj.SetActive(value: true); + obj.GetComponent().SetSupplyText(rewardInfoList[i]); + } + _parentGrid.Reposition(); + return (float)rewardInfoList.Count * _parentGrid.cellHeight + 30f; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TagCollectionWithSingleType.cs b/SVSim.BattleEngine/Engine/Wizard/TagCollectionWithSingleType.cs new file mode 100644 index 0000000..5cff750 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TagCollectionWithSingleType.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class TagCollectionWithSingleType : TagCollectionWithTypeBase +{ + private AIPlayTagType _type; + + public TagCollectionWithSingleType(AIPlayTagType type, TagCollection tagCollection) + { + _type = type; + base.Collection = tagCollection; + } + + public override TagCollectionWithTypeBase Clone() + { + TagCollection tagCollection = base.Collection.Clone(); + return new TagCollectionWithSingleType(_type, tagCollection); + } + + public override bool IsUnderManagement(AIPlayTagType type) + { + return type == _type; + } + + public override void AddTag(AIPlayTag tag) + { + base.Collection.AddTag(tag); + } + + public override bool RemoveTagAndCheckIsNolongerHoldThisType(AIPlayTag tag) + { + return base.Collection.RemoveTagAndCheckIsNoLongerHoldThisType(tag); + } + + public override void RegisterTypes(List targetList) + { + if (!targetList.Contains(_type)) + { + targetList.Add(_type); + } + } + + public override void RemoveTypes(List targetList) + { + if (targetList.Contains(_type)) + { + targetList.Remove(_type); + } + } + + public override bool HasTag(AIPlayTagType type) + { + if (_type == type) + { + return base.Collection.HasTag; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TagCollectionWithTypeCreator.cs b/SVSim.BattleEngine/Engine/Wizard/TagCollectionWithTypeCreator.cs new file mode 100644 index 0000000..06cf0df --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TagCollectionWithTypeCreator.cs @@ -0,0 +1,753 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class TagCollectionWithTypeCreator +{ + public static TagCollectionWithTypeBase Create(AIPlayTagType type) + { + TagCollection tagCollection = null; + List list = null; + switch (type) + { + case AIPlayTagType.Priority: + tagCollection = new PriorityTagCollection(); + break; + case AIPlayTagType.PlayBonus: + tagCollection = new PlayBonusTagCollection(); + break; + case AIPlayTagType.PlayBonusRate: + tagCollection = new PlayBonusRateTagCollection(); + break; + case AIPlayTagType.AllyPlayBonus: + tagCollection = new AllyPlayBonusTagCollection(); + break; + case AIPlayTagType.EnemyPlayBonus: + tagCollection = new EnemyPlayBonusTagCollection(); + break; + case AIPlayTagType.FanfareBonus: + tagCollection = new FanfareBonusTagCollection(); + break; + case AIPlayTagType.IgnoreFanfareBonus: + tagCollection = new IgnoreFanfareBonusTagCollection(); + break; + case AIPlayTagType.HandPlus: + tagCollection = new HandPlusTagCollection(); + break; + case AIPlayTagType.PlayLimit: + tagCollection = new PlayLimitTagCollection(); + break; + case AIPlayTagType.PlayptnBonus: + tagCollection = new PlayPtnBonusTagCollection(); + break; + case AIPlayTagType.AttackBonus: + tagCollection = new AttackBonusTagCollection(); + break; + case AIPlayTagType.BattleBonusRate: + tagCollection = new BattleBonusRateTagCollection(); + break; + case AIPlayTagType.BattleBonus: + tagCollection = new BattleBonusTagCollection(); + break; + case AIPlayTagType.MemberBattleBonus: + tagCollection = new MemberBattleBonusTagCollection(); + break; + case AIPlayTagType.EnemyBattleBonus: + tagCollection = new EnemyBattleBonusTagCollection(); + break; + case AIPlayTagType.MemberBattleBonusRate: + tagCollection = new MemberBattleBonusRateTagCollection(); + break; + case AIPlayTagType.EnemyBattleBonusRate: + tagCollection = new EnemyBattleBonusRateTagCollection(); + break; + case AIPlayTagType.EvoBonus: + tagCollection = new EvoBonusTagCollection(); + break; + case AIPlayTagType.MemberEvoBonus: + tagCollection = new MemberEvoBonusTagCollection(); + break; + case AIPlayTagType.EnemyEvoBonus: + tagCollection = new EnemyEvoBonusTagCollection(); + break; + case AIPlayTagType.PuppetAttack: + tagCollection = new PuppetAttackTagCollection(); + break; + case AIPlayTagType.DamagedBonus: + case AIPlayTagType.DamagedBuff: + case AIPlayTagType.DamagedDamage: + case AIPlayTagType.DamagedToken: + case AIPlayTagType.DamagedHeal: + case AIPlayTagType.DamagedCantUnderAttack: + list = new List { type }; + tagCollection = new DamagedTagCollection(); + break; + case AIPlayTagType.OtherDamagedDamage: + case AIPlayTagType.OtherDamagedHeal: + case AIPlayTagType.OtherDamagedSetLeaderMaxLife: + case AIPlayTagType.OtherDamagedSubtractCountdown: + case AIPlayTagType.OtherDamagedBanish: + list = new List { type }; + tagCollection = new OtherDamagedTagCollection(); + break; + case AIPlayTagType.PlayoutNextTurn: + tagCollection = new PlayoutNextTurnTagCollection(); + break; + case AIPlayTagType.NoSkipAttack: + tagCollection = new NoSkipAttackTagCollection(); + break; + case AIPlayTagType.ClashDestroy: + case AIPlayTagType.ClashHeal: + case AIPlayTagType.ClashToken: + case AIPlayTagType.ClashBanish: + case AIPlayTagType.ClashSpellboost: + case AIPlayTagType.AttackBuff: + case AIPlayTagType.AttackHandBuff: + case AIPlayTagType.AttackDestroy: + case AIPlayTagType.AttackBanish: + case AIPlayTagType.AttackHeal: + case AIPlayTagType.AttackDiscard: + case AIPlayTagType.AttackAttackableCount: + case AIPlayTagType.AttackQuick: + case AIPlayTagType.AttackRemoveTag: + case AIPlayTagType.AttackSetStatus: + case AIPlayTagType.ClashBuff: + case AIPlayTagType.AttackToken: + case AIPlayTagType.AttackDamage: + case AIPlayTagType.AttackEvo: + case AIPlayTagType.ClashDamage: + case AIPlayTagType.ClashKiller: + case AIPlayTagType.AttackKiller: + case AIPlayTagType.ClashRemoveSkill: + case AIPlayTagType.ClashRemoveTag: + case AIPlayTagType.AttackRemoveSkill: + case AIPlayTagType.AttackAttachTag: + case AIPlayTagType.AttackSubtractCountdown: + case AIPlayTagType.AttackShield: + case AIPlayTagType.ClashShield: + case AIPlayTagType.AttackDamageClip: + case AIPlayTagType.ClashDamageClip: + case AIPlayTagType.AttackAddDeck: + list = new List { type }; + tagCollection = new AttackTagCollection(); + break; + case AIPlayTagType.BounceBonus: + tagCollection = new BounceBonusTagCollection(); + break; + case AIPlayTagType.BreakBuff: + case AIPlayTagType.BreakSetLeaderMaxLife: + case AIPlayTagType.BreakHeal: + case AIPlayTagType.BreakDamage: + case AIPlayTagType.BreakRecoverAttackableCount: + case AIPlayTagType.BreakDestroy: + case AIPlayTagType.BreakRecoverPp: + case AIPlayTagType.BreakAttachTag: + case AIPlayTagType.BreakAddStack: + list = new List { type }; + tagCollection = new BreakTagCollection(); + break; + case AIPlayTagType.BanishBonus: + tagCollection = new BanishBonusTagCollection(); + break; + case AIPlayTagType.AfterAttackEvo: + case AIPlayTagType.AfterAttackDraw: + case AIPlayTagType.AfterAttackBanish: + case AIPlayTagType.AttackBreakDamage: + case AIPlayTagType.AttackBreakEvo: + case AIPlayTagType.AttackBreakRecoverPp: + case AIPlayTagType.AttackBreakAttackTwice: + case AIPlayTagType.AfterAttackHeal: + list = new List { type }; + tagCollection = new AfterAttackTagCollection(); + break; + case AIPlayTagType.OtherAttackBuff: + case AIPlayTagType.OtherAttackDamage: + case AIPlayTagType.OtherAttackHeal: + case AIPlayTagType.OtherAttackToken: + case AIPlayTagType.OtherAttackAttachTag: + case AIPlayTagType.OtherAttackRemoveTag: + list = new List { type }; + tagCollection = new OtherAttackTagCollection(); + break; + case AIPlayTagType.SummonBuff: + case AIPlayTagType.SummonEvo: + case AIPlayTagType.SummonRush: + case AIPlayTagType.SummonQuick: + case AIPlayTagType.SummonDamage: + case AIPlayTagType.SummonBanish: + case AIPlayTagType.SummonHeal: + case AIPlayTagType.SummonDestroy: + case AIPlayTagType.SummonBanAttack: + case AIPlayTagType.SummonAttachTag: + case AIPlayTagType.Stack: + list = new List { type }; + tagCollection = new SummonTagCollection(); + break; + case AIPlayTagType.OtherSummonDamage: + case AIPlayTagType.OtherSummonRush: + case AIPlayTagType.OtherSummonGuard: + case AIPlayTagType.OtherSummonQuick: + case AIPlayTagType.OtherSummonKiller: + case AIPlayTagType.OtherSummonDrain: + case AIPlayTagType.OtherSummonBanish: + case AIPlayTagType.OtherSummonHeal: + case AIPlayTagType.OtherSummonBuff: + case AIPlayTagType.OtherSummonEvo: + case AIPlayTagType.OtherSummonDamageCut: + case AIPlayTagType.OtherSummonDamageClip: + case AIPlayTagType.OtherSummonSubtractCountdown: + case AIPlayTagType.OtherSummonAddCemetery: + case AIPlayTagType.OtherSummonUntouchable: + case AIPlayTagType.OtherSummonDestory: + case AIPlayTagType.OtherSummonDraw: + case AIPlayTagType.OtherSummonAttachTag: + list = new List { type }; + tagCollection = new OtherSummonTagCollection(); + break; + case AIPlayTagType.Necromance: + case AIPlayTagType.EarthRite: + case AIPlayTagType.BurialRite: + list = new List { type }; + tagCollection = new PreprocessTagCollection(); + break; + case AIPlayTagType.LastwordToken: + case AIPlayTagType.LastwordBuff: + case AIPlayTagType.LastwordDestroy: + case AIPlayTagType.LastwordDamage: + case AIPlayTagType.LastwordHeal: + case AIPlayTagType.LastwordMetamorphose: + case AIPlayTagType.LastwordBanish: + case AIPlayTagType.LastwordDraw: + case AIPlayTagType.LastwordAddDeck: + case AIPlayTagType.LastwordSetStatus: + case AIPlayTagType.LastwordReanimate: + case AIPlayTagType.LastwordAttachTag: + case AIPlayTagType.LastwordEvo: + case AIPlayTagType.LastwordRemoveSkill: + case AIPlayTagType.LastwordAddCemetery: + case AIPlayTagType.LastwordDamageClip: + case AIPlayTagType.LastwordShield: + case AIPlayTagType.LastwordSubtractCountdown: + list = new List { type }; + tagCollection = new LastwordTagCollection(); + break; + case AIPlayTagType.FanfareToken: + case AIPlayTagType.FanfareHeal: + case AIPlayTagType.FanfareBanish: + case AIPlayTagType.FanfareSubtractCountdown: + case AIPlayTagType.FanfareDamage: + case AIPlayTagType.FanfareBuff: + case AIPlayTagType.FanfareDestroy: + case AIPlayTagType.FanfareBounce: + case AIPlayTagType.FanfareRecoverAttackableCount: + case AIPlayTagType.FanfareSneak: + case AIPlayTagType.FanfareQuick: + case AIPlayTagType.FanfareRush: + case AIPlayTagType.FanfareGuard: + case AIPlayTagType.FanfareDrain: + case AIPlayTagType.FanfareKiller: + case AIPlayTagType.FanfareHandBuff: + case AIPlayTagType.FanfareUntouchable: + case AIPlayTagType.FanfareForceTargeting: + case AIPlayTagType.FanfareSelect: + case AIPlayTagType.FanfareHandSelect: + case AIPlayTagType.FanfareRemoveSkill: + case AIPlayTagType.FanfareReanimate: + case AIPlayTagType.FanfareMetamorphose: + case AIPlayTagType.FanfareHandMetamorphose: + case AIPlayTagType.FanfareSetMaxStatus: + case AIPlayTagType.FanfareBonusInSimulation: + case AIPlayTagType.FanfareRecoverPp: + case AIPlayTagType.FanfareAttachTag: + case AIPlayTagType.FanfareAttachStyle: + case AIPlayTagType.FanfareCopyTag: + case AIPlayTagType.FanfareTokenDraw: + case AIPlayTagType.FanfareSummonHandCard: + case AIPlayTagType.FanfareDiscard: + case AIPlayTagType.FanfareSpellboost: + case AIPlayTagType.FanfareAddCemetery: + case AIPlayTagType.FanfareBanAttack: + case AIPlayTagType.FanfareIgnoreGuard: + case AIPlayTagType.FanfareChangeClass: + case AIPlayTagType.FanfareChangeTribe: + case AIPlayTagType.FanfareChangeCost: + case AIPlayTagType.FanfareNotBeAttacked: + case AIPlayTagType.FanfareAttackableCount: + case AIPlayTagType.FanfareModifyConsumeEp: + case AIPlayTagType.FanfareEvo: + case AIPlayTagType.FanfareShield: + case AIPlayTagType.FanfareDamageCut: + case AIPlayTagType.FanfareDamageClip: + case AIPlayTagType.FanfareRemoveGuard: + case AIPlayTagType.FanfareAddDeck: + list = new List { type }; + tagCollection = new FanfareTagCollection(); + break; + case AIPlayTagType.PlayToken: + case AIPlayTagType.PlayDestroy: + case AIPlayTagType.PlayDamage: + case AIPlayTagType.PlayHeal: + case AIPlayTagType.PlayBanish: + case AIPlayTagType.PlayBounce: + case AIPlayTagType.PlaySubtractCountdown: + case AIPlayTagType.PlayBuff: + case AIPlayTagType.PlaySneak: + case AIPlayTagType.PlayQuick: + case AIPlayTagType.PlayRush: + case AIPlayTagType.PlayGuard: + case AIPlayTagType.PlayDrain: + case AIPlayTagType.PlayKiller: + case AIPlayTagType.PlayHandBuff: + case AIPlayTagType.PlayUntouchable: + case AIPlayTagType.PlaySelect: + case AIPlayTagType.PlayHandSelect: + case AIPlayTagType.PlayRemoveSkill: + case AIPlayTagType.PlayReanimate: + case AIPlayTagType.PlayMetamorphose: + case AIPlayTagType.PlayHandMetamorphose: + case AIPlayTagType.PlaySetMaxStatus: + case AIPlayTagType.PlaySetLeaderMaxLife: + case AIPlayTagType.PlayBonusInSimulation: + case AIPlayTagType.PlayRecoverPP: + case AIPlayTagType.PlayAttachTag: + case AIPlayTagType.PlayCopyTag: + case AIPlayTagType.PlayTokenDraw: + case AIPlayTagType.PlaySummonHandCard: + case AIPlayTagType.PlayDiscard: + case AIPlayTagType.PlaySpellboost: + case AIPlayTagType.PlayAddCemetery: + case AIPlayTagType.PlayBanAttack: + case AIPlayTagType.PlayIgnoreGuard: + case AIPlayTagType.PlayChangeClass: + case AIPlayTagType.PlayChangeTribe: + case AIPlayTagType.PlayChangeCost: + case AIPlayTagType.PlayNotBeAttacked: + case AIPlayTagType.PlayAttackableCount: + case AIPlayTagType.PlayModifyConsumeEp: + case AIPlayTagType.PlayEvo: + case AIPlayTagType.PlayShield: + case AIPlayTagType.PlayDamageCut: + case AIPlayTagType.PlayDamageClip: + case AIPlayTagType.PlayAddDeck: + list = new List { type }; + tagCollection = new PlayTagCollection(); + break; + case AIPlayTagType.OtherPlayAttachTag: + case AIPlayTagType.OtherPlayEvo: + case AIPlayTagType.OtherEnhanceEvo: + case AIPlayTagType.OtherPlayDamage: + case AIPlayTagType.OtherPlayRecoverPp: + case AIPlayTagType.OtherPlayDestroy: + case AIPlayTagType.OtherPlayBuff: + case AIPlayTagType.OtherPlayToken: + case AIPlayTagType.OtherPlayRemoveTag: + case AIPlayTagType.OtherPlayBounce: + case AIPlayTagType.OtherPlayQuick: + list = new List { type }; + tagCollection = new OtherPlayTagCollection(); + break; + case AIPlayTagType.CostBonus: + tagCollection = new CostBonusTagCollection(); + break; + case AIPlayTagType.AfterClashHeal: + case AIPlayTagType.AfterClashDamage: + list = new List { type }; + tagCollection = new AfterClashTagCollection(); + break; + case AIPlayTagType.RemoveSkill: + tagCollection = new RemoveSkillTagCollection(); + break; + case AIPlayTagType.PlaySkip: + case AIPlayTagType.PlaySkipWithEvo: + case AIPlayTagType.PlaySkipIfEvo: + case AIPlayTagType.PlaySkipWithAction: + case AIPlayTagType.PlaySkipWithActionIfEvo: + list = new List { type }; + tagCollection = new PlaySkipTagCollection(); + break; + case AIPlayTagType.HealDamage: + case AIPlayTagType.HealBuff: + case AIPlayTagType.HealToken: + case AIPlayTagType.HealHeal: + case AIPlayTagType.HealEvo: + case AIPlayTagType.HealAttachTag: + list = new List { type }; + tagCollection = new HealTagCollection(); + break; + case AIPlayTagType.TurnStartAttachTag: + case AIPlayTagType.TurnStartSubtractCountdown: + case AIPlayTagType.TurnStartDamageCut: + case AIPlayTagType.TurnStartShield: + case AIPlayTagType.TurnStartDamage: + list = new List { type }; + tagCollection = new TurnStartTagCollection(); + break; + case AIPlayTagType.TurnEndDestroy: + case AIPlayTagType.TurnEndBanish: + case AIPlayTagType.TurnEndDamage: + case AIPlayTagType.TurnEndHeal: + case AIPlayTagType.TurnEndSetLeaderMaxLife: + case AIPlayTagType.TurnEndDiscard: + case AIPlayTagType.TurnEndBuff: + case AIPlayTagType.TurnEndSubtractCountdown: + case AIPlayTagType.TurnEndToken: + case AIPlayTagType.TurnEndBounce: + case AIPlayTagType.TurnEndAddDeck: + case AIPlayTagType.TurnEndEvo: + case AIPlayTagType.TurnEndDraw: + case AIPlayTagType.TurnEndShield: + case AIPlayTagType.TurnEndDamageClip: + case AIPlayTagType.TurnEndDamageCut: + case AIPlayTagType.TurnEndGuard: + case AIPlayTagType.TurnEndBanAttack: + case AIPlayTagType.TurnEndMetamorphose: + case AIPlayTagType.TurnEndAttachTag: + case AIPlayTagType.TurnEndRemoveTag: + list = new List { type }; + tagCollection = new TurnEndTagCollection(); + break; + case AIPlayTagType.IgnoreBreak: + tagCollection = new IgnoreBreakTagCollection(); + break; + case AIPlayTagType.Break: + tagCollection = new BreakBonusTagCollection(); + break; + case AIPlayTagType.LeaveBonus: + tagCollection = new LeaveBonusTagCollection(); + break; + case AIPlayTagType.LeaveHeal: + case AIPlayTagType.LeaveDamage: + case AIPlayTagType.LeaveBanish: + case AIPlayTagType.LeaveToken: + case AIPlayTagType.LeaveAttachTag: + list = new List { type }; + tagCollection = new LeaveTagCollection(); + break; + case AIPlayTagType.OtherLeaveDamage: + case AIPlayTagType.OtherLeaveToken: + list = new List { type }; + tagCollection = new OtherLeaveTagCollection(); + break; + case AIPlayTagType.EvoEvo: + case AIPlayTagType.EvoDamage: + case AIPlayTagType.EvoHandBuff: + case AIPlayTagType.EvoToken: + case AIPlayTagType.EvoDestroy: + case AIPlayTagType.EvoBuff: + case AIPlayTagType.EvoHeal: + case AIPlayTagType.EvoBanish: + case AIPlayTagType.EvoSubtractCountdown: + case AIPlayTagType.EvoRecoverPp: + case AIPlayTagType.EvoSetLeaderMaxLife: + case AIPlayTagType.EvoDiscard: + case AIPlayTagType.EvoMetamorphose: + case AIPlayTagType.EvoHandMetamorphose: + case AIPlayTagType.EvoBounce: + case AIPlayTagType.EvoRush: + case AIPlayTagType.EvoQuick: + case AIPlayTagType.EvoGuard: + case AIPlayTagType.EvoKiller: + case AIPlayTagType.EvoDrain: + case AIPlayTagType.EvoAttackableCount: + case AIPlayTagType.EvoChangeCost: + case AIPlayTagType.EvoHandSelect: + case AIPlayTagType.EvoShield: + case AIPlayTagType.EvoDamageCut: + case AIPlayTagType.EvoReanimate: + case AIPlayTagType.EvoAddDeck: + case AIPlayTagType.EvoAttachTag: + case AIPlayTagType.EvoTokenDraw: + case AIPlayTagType.EvoAddStack: + case AIPlayTagType.EvoSetStatus: + list = new List { type }; + tagCollection = new EvoTagCollection(); + break; + case AIPlayTagType.OtherEvoBuff: + case AIPlayTagType.OtherEvoDamage: + case AIPlayTagType.OtherEvoBanish: + case AIPlayTagType.OtherEvoSubtractCountdown: + case AIPlayTagType.OtherEvoEvo: + case AIPlayTagType.OtherEvoToken: + case AIPlayTagType.OtherEvoShield: + list = new List { type }; + tagCollection = new OtherEvoTagCollection(); + break; + case AIPlayTagType.SelfAndOtherEvoDamage: + case AIPlayTagType.SelfAndOtherEvoAttachTag: + case AIPlayTagType.SelfAndOtherEvoShield: + case AIPlayTagType.SelfAndOtherEvoDestroy: + case AIPlayTagType.SelfAndOtherEvoBounce: + case AIPlayTagType.SelfAndOtherEvoToken: + case AIPlayTagType.SelfAndOtherEvoDraw: + case AIPlayTagType.SelfAndOtherEvoAddCemetery: + case AIPlayTagType.SelfAndOtherEvoHeal: + case AIPlayTagType.SelfAndOtherEvoTokenDraw: + list = new List { type }; + tagCollection = new SelfAndOtherEvoTagCollection(); + break; + case AIPlayTagType.FirstEvo: + tagCollection = new FirstEvoTagCollection(); + break; + case AIPlayTagType.Target: + tagCollection = new TargetTagCollection(); + break; + case AIPlayTagType.IgnoreTarget: + tagCollection = new IgnoreTargetTagCollection(); + break; + case AIPlayTagType.BreakLast: + tagCollection = new BreakLastTagCollection(); + break; + case AIPlayTagType.BreakFirst: + tagCollection = new BreakFirstTagCollection(); + break; + case AIPlayTagType.BreakBeforePlay: + tagCollection = new BreakBeforePlayTagCollection(); + break; + case AIPlayTagType.AttackByLife: + tagCollection = new AttackByLifeTagCollection(); + break; + case AIPlayTagType.EmoteOnPlay: + case AIPlayTagType.EmoteOnEvo: + case AIPlayTagType.EmoteOnAtk: + case AIPlayTagType.EmoteOnDestroy: + case AIPlayTagType.ForceEmoteOnDestroy: + case AIPlayTagType.EmoteOnTurnEnd: + list = new List { type }; + tagCollection = new EmoteTagCollection(); + break; + case AIPlayTagType.ReanimateBonus: + tagCollection = new ReanimateBonusTagCollection(); + break; + case AIPlayTagType.ReanimateEvo: + tagCollection = new ReanimateEvoTagCollection(); + break; + case AIPlayTagType.PlayDraw: + tagCollection = new PlayDrawTagCollection(); + break; + case AIPlayTagType.EvolvedAttackable: + case AIPlayTagType.EvolvedAttackableCount: + case AIPlayTagType.EvolvedSkill: + list = new List { type }; + tagCollection = new EvolvedResidentTagCollection(); + break; + case AIPlayTagType.PlayPlus: + tagCollection = new PlayPlusTagCollection(); + break; + case AIPlayTagType.PlayoutDamageBonus: + case AIPlayTagType.PlayoutAttackBonus: + list = new List { type }; + tagCollection = new PlayoutBonusTagCollection(); + break; + case AIPlayTagType.AllyPlayoutDamageBonus: + tagCollection = new OtherPlayoutBonusTagCollection(); + break; + case AIPlayTagType.AttackableClass: + tagCollection = new AttackableClassTagCollection(); + break; + case AIPlayTagType.HandBonus: + tagCollection = new HandBonusTagCollection(); + break; + case AIPlayTagType.Fusion: + tagCollection = new FusionTagCollection(); + break; + case AIPlayTagType.FusionDraw: + tagCollection = new FusionDrawTagCollection(); + break; + case AIPlayTagType.ModifyHeal: + tagCollection = new ModifyHealTagCollection(); + break; + case AIPlayTagType.FusionBonus: + tagCollection = new FusionBonusTagCollection(); + break; + case AIPlayTagType.PlayptnBaseStatsRate: + tagCollection = new PlayptnBaseStatsRateTagCollection(); + break; + case AIPlayTagType.NoInstantAttack: + tagCollection = new NoInstantAttackTagCollection(); + break; + case AIPlayTagType.GiveSkill: + tagCollection = new GiveSkillTagCollection(); + break; + case AIPlayTagType.Enhance: + case AIPlayTagType.Accelerate: + case AIPlayTagType.Crystalize: + case AIPlayTagType.ChoiceTransform: + list = new List { type }; + tagCollection = new FixedCostTagCollection(); + break; + case AIPlayTagType.DiscardedBonus: + tagCollection = new DiscardedBonusTagCollection(); + break; + case AIPlayTagType.DiscardedToken: + list = new List { type }; + tagCollection = new DiscardedTagCollection(); + break; + case AIPlayTagType.DiscardDamage: + case AIPlayTagType.DiscardHeal: + case AIPlayTagType.AllyDiscardBonus: + list = new List { type }; + tagCollection = new AfterDiscardTagCollection(); + break; + case AIPlayTagType.OtherBreakBonus: + tagCollection = new OtherBreakBonusTagCollection(); + break; + case AIPlayTagType.OtherBanishBonus: + tagCollection = new OtherBanishBonusTagCollection(); + break; + case AIPlayTagType.OtherLeaveBonus: + tagCollection = new OtherLeaveBonusTagCollection(); + break; + case AIPlayTagType.OneMoreLastword: + tagCollection = new OneMoreLastwordTagCollection(); + break; + case AIPlayTagType.BuffDamage: + case AIPlayTagType.BuffDestroy: + case AIPlayTagType.BuffShield: + case AIPlayTagType.BuffToken: + case AIPlayTagType.BuffRecoverPP: + case AIPlayTagType.BuffRush: + case AIPlayTagType.BuffHeal: + case AIPlayTagType.BuffBuff: + case AIPlayTagType.BuffEvo: + case AIPlayTagType.BuffDraw: + list = new List { type }; + tagCollection = new BuffTriggerTagCollection(); + break; + case AIPlayTagType.BanishAttachTag: + list = new List { type }; + tagCollection = new BanishTagCollection(); + break; + case AIPlayTagType.OtherBanishToken: + case AIPlayTagType.OtherBanishAddCemetery: + list = new List { type }; + tagCollection = new OtherBanishTagCollection(); + break; + case AIPlayTagType.GetOn: + tagCollection = new GetOnTagCollection(); + break; + case AIPlayTagType.GetOnBanish: + case AIPlayTagType.GetOnDamage: + case AIPlayTagType.GetOnEvo: + list = new List { type }; + tagCollection = new GetOnTriggerTagCollection(); + break; + case AIPlayTagType.GetOffMetamorphose: + case AIPlayTagType.GetOffEvo: + list = new List { type }; + tagCollection = new WhenGetOffTagCollection(); + break; + case AIPlayTagType.AddCardToPlayoutPlayPtn: + tagCollection = new AddCardToPlayoutPlayPtnTagCollection(); + break; + case AIPlayTagType.PlayActivateCount: + case AIPlayTagType.AttackActivateCount: + case AIPlayTagType.BreakActivateCount: + case AIPlayTagType.BanishActivateCount: + case AIPlayTagType.DamagedActivateCount: + case AIPlayTagType.BuffActivateCounnt: + case AIPlayTagType.TurnEndActivateCount: + case AIPlayTagType.HealActivateCount: + case AIPlayTagType.NecromanceActivateCount: + case AIPlayTagType.EvoActivateCount: + case AIPlayTagType.SummonActivateCount: + list = new List { type }; + tagCollection = new ActivateCountTagCollection(); + break; + case AIPlayTagType.EvoHandPlus: + tagCollection = new EvoHandPlusTagCollection(); + break; + case AIPlayTagType.ClashBonus: + tagCollection = new ClashBonusTagCollection(); + break; + case AIPlayTagType.NoNormalEvo: + tagCollection = new NoNormalEvoTagCollection(); + break; + case AIPlayTagType.ReincarnationSimulation: + tagCollection = new ReincarnationSimulationTagCollection(); + break; + case AIPlayTagType.PlagueCity: + tagCollection = new PlagueCityTagCollection(); + break; + case AIPlayTagType.CondChoice: + tagCollection = new CondChoiceTagCollection(); + break; + case AIPlayTagType.EvoChoice: + case AIPlayTagType.PlayChoice: + case AIPlayTagType.FanfareChoice: + case AIPlayTagType.ChoiceBrave: + list = new List { type }; + tagCollection = new ChoiceTagCollection(); + break; + case AIPlayTagType.CantBeAttacked: + tagCollection = new CantBeAttackedTagCollection(); + break; + case AIPlayTagType.RallyCountPlus: + tagCollection = new RallyCountPlusTagCollection(); + break; + case AIPlayTagType.BounceDamage: + list = new List { type }; + tagCollection = new BounceTagCollection(); + break; + case AIPlayTagType.NecromanceAttachTag: + case AIPlayTagType.NecromanceAddCemetery: + case AIPlayTagType.NecromanceDamage: + case AIPlayTagType.NecromanceHeal: + list = new List { type }; + tagCollection = new WhenNecromanceTagCollection(); + break; + case AIPlayTagType.ResonanceDamage: + case AIPlayTagType.ResonanceHeal: + case AIPlayTagType.ResonanceKiller: + list = new List { type }; + tagCollection = new ResonanceTagCollection(); + break; + case AIPlayTagType.ForceBerserk: + tagCollection = new ForceBerserkTagCollection(); + break; + case AIPlayTagType.SetAITribe: + tagCollection = new SetAITribeTagCollection(); + break; + case AIPlayTagType.GenerateTag: + tagCollection = new GenerateTagCollection(); + break; + case AIPlayTagType.RemoveByDestroy: + tagCollection = new RemoveByDestroyTagCollection(); + break; + case AIPlayTagType.ChangeInplayAttachTag: + case AIPlayTagType.ChangeInplayImmediateRemoveByBanish: + case AIPlayTagType.ChangeInplayImmediateRemoveByDestroy: + case AIPlayTagType.ChangeInplayCannotPlay: + case AIPlayTagType.ChangeInplayCannotAttack: + case AIPlayTagType.ChangeInplayImmediateShield: + case AIPlayTagType.ChangeInplayImmediateDamageCut: + case AIPlayTagType.ChangeInplayImmediateDamageClip: + case AIPlayTagType.ChangeInplayImmediateLifeLowerLimit: + case AIPlayTagType.ChangeInplayImmediateDamageModifier: + case AIPlayTagType.ChangeInplayImmediateUntouchable: + case AIPlayTagType.ChangeInplayImmediateIndestructible: + case AIPlayTagType.ChangePpTotalBuff: + list = new List { type }; + tagCollection = new ChangeInplayTagCollection(); + break; + case AIPlayTagType.EvolveToOther: + tagCollection = new EvolveToOtherTagCollection(); + break; + case AIPlayTagType.BuffBonus: + tagCollection = new BuffBonusTagCollection(); + break; + case AIPlayTagType.ForceImmediateAttack: + tagCollection = new ForceImmediateAttackTagCollection(); + break; + case AIPlayTagType.FusionMetamorphose: + tagCollection = new FusionMetamorphoseTagCollection(); + break; + default: + return null; + } + if (list != null) + { + return new TagCollectionWithMultipleTypes(list, tagCollection); + } + return new TagCollectionWithSingleType(type, tagCollection); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ToolboxGame.cs b/SVSim.BattleEngine/Engine/Wizard/ToolboxGame.cs new file mode 100644 index 0000000..6e0f497 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ToolboxGame.cs @@ -0,0 +1,86 @@ +using System.Collections; +using UnityEngine; + +namespace Wizard; + +public static class ToolboxGame +{ + private enum SYSTEM_INIT + { + SYSTEM_NOT_READY, + SYSTEM_READY + } + + public static SetUp SetUp = null; + + public static UIManager UIManager = null; + + public static GameMgr GameManager = null; + + public static bool isLoadFromLocal = false; + + public static bool isLoadLocalSound = false; + + public static bool bDebugLogMode = true; + + private static Transform _gameTransform = null; + + public static RealTimeNetworkAgent RealTimeNetworkAgent { get; private set; } + + public static Transform GameTransform + { + get + { + if (!_gameTransform) + { + GameObject gameObject = GameObject.Find("_Game"); + if ((bool)gameObject) + { + _gameTransform = gameObject.transform; + } + } + return _gameTransform; + } + } + + public static void Clear() + { + UIManager = null; + GameManager = null; + } + + public static void ClearUIManager() + { + UIManager = null; + } + + public static void SetRealTimeNetworkBattle(RealTimeNetworkAgent agent) + { + RealTimeNetworkAgent = agent; + } + + public static void DestroyNetworkAgent() + { + if (RealTimeNetworkAgent != null) + { + Object.DestroyImmediate(RealTimeNetworkAgent.gameObject); + RealTimeNetworkAgent = null; + } + } + + public static IEnumerator CreateRealTimeNetworkBattleAgent(Matching matching = null) + { + string loadObjectPath = "TurnBase/_TurnBaseManager"; + if (GameMgr.GetIns().IsAINetwork) + { + loadObjectPath = "TurnBase/_AINetworkBaseManager"; + } + yield return BattleCoroutine.GetInstance().StartCoroutine(GameMgr.GetIns().GetPrefabMgr().LoadAync(loadObjectPath)); + NGUITools.AddChild(GameObject.Find("_Game"), GameMgr.GetIns().GetPrefabMgr().Get(loadObjectPath)); + yield return null; + if (matching != null) + { + RealTimeNetworkAgent.SettingMatchingClass(matching); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TransformBackup.cs b/SVSim.BattleEngine/Engine/Wizard/TransformBackup.cs new file mode 100644 index 0000000..a715d36 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TransformBackup.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace Wizard; + +internal class TransformBackup +{ + public Transform backup_parent { get; private set; } + + public Vector3 backup_pos { get; private set; } + + public Vector3 backup_scale { get; private set; } + + public int backup_layer { get; private set; } + + public void Save(Transform trans) + { + backup_parent = trans.parent; + backup_pos = trans.localPosition; + backup_scale = trans.localScale; + backup_layer = trans.gameObject.layer; + } + + public void Restore(Transform trans) + { + trans.parent = backup_parent; + trans.localPosition = backup_pos; + trans.localScale = backup_scale; + trans.gameObject.layer = backup_layer; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TreasureBoxCp.cs b/SVSim.BattleEngine/Engine/Wizard/TreasureBoxCp.cs new file mode 100644 index 0000000..24aa8c2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TreasureBoxCp.cs @@ -0,0 +1,107 @@ +using System; +using LitJson; +using UnityEngine; + +namespace Wizard; + +public class TreasureBoxCp +{ + public const string TREASURE_BOX_OPEN_EFFECT = "cmn_arena_treasure_{0}"; + + public const string GRADE_UP_EFFECT = "cmn_treasure_gradeup_gp_{0}"; + + private const string TREASURE_GET_SPRITE_NAME = "treasure_get"; + + private const string TREASURE_RANK_UP_SPRITE_NAME = "treasure_rank_up"; + + private const string TREASURE_RANK_MAX_SPRITE_NAME = "treasure_rank_max"; + + private bool _treasureBoxCpNotExist = true; + + public static readonly float[] OPEN_TREASURE_BOX_TIME = new float[4] { 1f, 1.5f, 1.5f, 4f }; + + public static readonly int[] GRADE_TO_TREASURE_BOX_ID = new int[5] { -1, 0, 2, 4, 5 }; + + private double _receiveServerUnixTime; + + private double _receiveSinceTime; + + public bool IsTreasureBoxOpened => CurrentGrade == MaxGrade; + + public bool IsReceivable { get; private set; } + + public double StartUnixTime { get; private set; } + + public double EndUnixTime { get; private set; } + + public int CurrentGrade { get; private set; } + + public int NextGrade { get; private set; } + + public int MaxGrade { get; private set; } + + public int CurrentMemory { get; private set; } + + public int MaxMemory { get; private set; } + + public void Parse(JsonData data, JsonData headerData) + { + _treasureBoxCpNotExist = false; + IsReceivable = false; + if (data.Keys.Contains("is_receivable")) + { + IsReceivable = data["is_receivable"].ToInt() == 1; + } + StartUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(data["start_time"].ToString())); + EndUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(data["end_time"].ToString())); + CurrentGrade = data["current_grade"].ToInt(); + NextGrade = data["next_grade"].ToInt(); + CurrentMemory = data["current_memory"].ToInt(); + MaxGrade = data["max_grade"].ToInt(); + MaxMemory = data["max_memory"].ToInt(); + _receiveServerUnixTime = headerData["servertime"].ToDouble(); + _receiveSinceTime = Time.realtimeSinceStartup; + } + + public bool IsWithinPeriod() + { + if (_treasureBoxCpNotExist) + { + return false; + } + double num = _receiveServerUnixTime + (double)Time.realtimeSinceStartup - _receiveSinceTime; + if (num >= EndUnixTime) + { + return false; + } + return num > StartUnixTime; + } + + public static Se.TYPE GetGradeSE(int grade) + { + return grade switch + { + 1 => Se.TYPE.SE_SYS_UPGRADE_TREASURE_BOX_01, + 2 => Se.TYPE.SE_SYS_UPGRADE_TREASURE_BOX_02, + 3 => Se.TYPE.SE_SYS_UPGRADE_TREASURE_BOX_03, + 4 => Se.TYPE.SE_SYS_UPGRADE_TREASURE_BOX_04, + _ => Se.TYPE.NONE, + }; + } + + public static string GetTreasureSpriteName(int grade) + { + switch (grade) + { + case 1: + return "treasure_get"; + case 2: + case 3: + return "treasure_rank_up"; + case 4: + return "treasure_rank_max"; + default: + return ""; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TreasureCpBoxTextPanel.cs b/SVSim.BattleEngine/Engine/Wizard/TreasureCpBoxTextPanel.cs new file mode 100644 index 0000000..b2afddb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TreasureCpBoxTextPanel.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace Wizard; + +public class TreasureCpBoxTextPanel : MonoBehaviour +{ + [SerializeField] + public UISprite _treasureCpBoxText; +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Tuple.cs b/SVSim.BattleEngine/Engine/Wizard/Tuple.cs new file mode 100644 index 0000000..73dce1a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Tuple.cs @@ -0,0 +1,14 @@ +namespace Wizard; + +public struct Tuple +{ + public T1 first; + + public T2 second; + + public Tuple(T1 first, T2 second) + { + this.first = first; + this.second = second; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/UIAtlasManager.cs b/SVSim.BattleEngine/Engine/Wizard/UIAtlasManager.cs new file mode 100644 index 0000000..af7a059 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/UIAtlasManager.cs @@ -0,0 +1,476 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class UIAtlasManager +{ + public enum AssetBundleNames + { + MypageComon, + Battle, + BattleLang, + RoomMatch, + AreaSelect, + DeckEdit, + Arena, + Gacha, + Profile, + Ranking, + Friend, + CardFrame, + CardFramePhantom, + Tournament, + Quest, + Scenario, + Bingo, + RedEtherCampaign, + NeutralPopularityVote, + BossRush, + Max + } + + private List _atlasList = new List(); + + private List _residentAtlasList = new List(); + + private List _loadPath; + + private bool _isLoadFinish; + + private HashSet _loadedAtlasHash = new HashSet(); + + private bool IsTutorialFinish() + { + if (Data.Load != null && Data.Load.data != null && Data.Load.data._userTutorial.tutorial_step != 100) + { + return true; + } + return false; + } + + public void LoadCurrentScene(Action callback = null) + { + if (_isLoadFinish && callback != null) + { + callback(); + return; + } + if (_loadPath == null) + { + _loadPath = new List(); + _atlasList = new List(); + } + else + { + _loadPath.Clear(); + _atlasList.Clear(); + } + HashSet assetBundleNameSet = GetLoadTargetSet(UIManager.GetInstance().GetCurrentScene()); + if (IsTutorialFinish()) + { + assetBundleNameSet.Add(AssetBundleNames.AreaSelect); + assetBundleNameSet.Add(AssetBundleNames.Battle); + } + UpdateAssetPathFromAssetBundleNames(assetBundleNameSet); + UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadPath, delegate + { + foreach (AssetBundleNames item in assetBundleNameSet) + { + UnityEngine.Object listData = Toolbox.ResourcesManager.LoadObject(GetAtlasPath(item, null, isload: true)); + AddAssetObjList(listData); + } + _isLoadFinish = true; + foreach (AssetBundleNames item2 in assetBundleNameSet) + { + _loadedAtlasHash.Add(item2); + } + if (callback != null) + { + callback(); + } + })); + } + + public void RemoveSceneAtlas(UIManager.ViewScene inLeaveScene) + { + HashSet loadTargetSet = GetLoadTargetSet(inLeaveScene); + HashSet hashSet = new HashSet(_loadedAtlasHash); + hashSet.ExceptWith(loadTargetSet); + List list = new List(hashSet.ToList().Count); + foreach (AssetBundleNames item in hashSet) + { + list.Add(GetAtlasPath(item, null)); + } + if (list.Count != 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(list); + } + foreach (AssetBundleNames loop_name in hashSet) + { + _loadedAtlasHash.RemoveWhere((AssetBundleNames x) => (x == loop_name) ? true : false); + } + } + + public string GetAtlasPath(AssetBundleNames assetname, string singlebundlename = "", bool isload = false) + { + string result = ""; + if (isload) + { + if (string.IsNullOrEmpty(singlebundlename)) + { + switch (assetname) + { + case AssetBundleNames.MypageComon: + result = "Ui/TextureAtlas/MyPageSubTextureAtlas/" + assetname; + break; + case AssetBundleNames.Battle: + result = "Ui/TextureAtlas/BattleTextureAtlas/" + assetname; + break; + case AssetBundleNames.BattleLang: + result = "Uilang/TextureAtlas/BattleLangTextureAtlas/" + assetname; + break; + case AssetBundleNames.RoomMatch: + result = "Ui/TextureAtlas/RoomMatchAtlas/" + assetname; + break; + case AssetBundleNames.AreaSelect: + result = "Ui/TextureAtlas/AreaSelectTextureAtlas/" + assetname; + break; + case AssetBundleNames.DeckEdit: + result = "Ui/TextureAtlas/DeckEditTextureAtlas/" + assetname; + break; + case AssetBundleNames.Arena: + result = "Ui/TextureAtlas/ArenaTextureAtlas/" + assetname; + break; + case AssetBundleNames.Gacha: + result = "Ui/TextureAtlas/GachaTextureAtlas/" + assetname; + break; + case AssetBundleNames.Profile: + result = "Ui/TextureAtlas/Profile/" + assetname; + break; + case AssetBundleNames.Ranking: + result = "Ui/TextureAtlas/Ranking/" + assetname; + break; + case AssetBundleNames.Friend: + result = "Ui/TextureAtlas/Friend/" + assetname; + break; + case AssetBundleNames.CardFrame: + result = "Ui/TextureAtlas/CardFrame/" + assetname; + break; + case AssetBundleNames.CardFramePhantom: + result = "Ui/TextureAtlas/CardFramePhantom/" + assetname; + break; + case AssetBundleNames.Tournament: + result = "Ui/TextureAtlas/Tournament/" + assetname; + break; + case AssetBundleNames.Quest: + result = "Ui/TextureAtlas/Quest/" + assetname; + break; + case AssetBundleNames.Scenario: + result = "Ui/TextureAtlas/Scenario/" + assetname; + break; + case AssetBundleNames.Bingo: + result = "Ui/TextureAtlas/BingoTextureAtlas/" + assetname; + break; + case AssetBundleNames.RedEtherCampaign: + result = "Ui/TextureAtlas/RedEtherCampaign/" + assetname; + break; + case AssetBundleNames.NeutralPopularityVote: + result = $"Ui/TextureAtlas/PopularityVote/{assetname}"; + break; + case AssetBundleNames.BossRush: + result = $"Ui/TextureAtlas/BossRush/{assetname}"; + break; + } + } + else + { + switch (assetname) + { + case AssetBundleNames.MypageComon: + result = "Ui/TextureAtlas/MyPageSubTextureAtlas/" + singlebundlename.ToString(); + break; + case AssetBundleNames.Battle: + result = "Ui/TextureAtlas/BattleTextureAtlas/" + singlebundlename.ToString(); + break; + case AssetBundleNames.BattleLang: + result = "Uilang/TextureAtlas/BattleLangTextureAtlas/" + singlebundlename.ToString(); + break; + case AssetBundleNames.RoomMatch: + result = "Ui/TextureAtlas/RoomMatchAtlas/" + singlebundlename.ToString(); + break; + case AssetBundleNames.AreaSelect: + result = "Ui/TextureAtlas/AreaSelectTextureAtlas/" + singlebundlename.ToString(); + break; + case AssetBundleNames.Arena: + result = "Ui/TextureAtlas/ArenaTextureAtlas/" + singlebundlename.ToString(); + break; + case AssetBundleNames.Gacha: + result = "Ui/TextureAtlas/GachaTextureAtlas/" + singlebundlename.ToString(); + break; + case AssetBundleNames.Profile: + result = "Ui/TextureAtlas/Profile/" + singlebundlename.ToString(); + break; + case AssetBundleNames.Ranking: + result = "Ui/TextureAtlas/Ranking/" + singlebundlename.ToString(); + break; + case AssetBundleNames.Friend: + result = "Ui/TextureAtlas/Friend/" + singlebundlename.ToString(); + break; + case AssetBundleNames.Tournament: + result = "Ui/TextureAtlas/Tournament/" + singlebundlename.ToString(); + break; + case AssetBundleNames.Quest: + result = "Ui/TextureAtlas/Quest/" + singlebundlename.ToString(); + break; + case AssetBundleNames.Scenario: + result = "Ui/TextureAtlas/Scenario/" + singlebundlename.ToString(); + break; + case AssetBundleNames.Bingo: + result = "Ui/TextureAtlas/BingoTextureAtlas/" + singlebundlename.ToString(); + break; + case AssetBundleNames.RedEtherCampaign: + result = "Ui/TextureAtlas/RedEtherCampaign/" + singlebundlename.ToString(); + break; + case AssetBundleNames.NeutralPopularityVote: + result = "Ui/TextureAtlas/PopularityVote/" + singlebundlename; + break; + case AssetBundleNames.BossRush: + result = "Ui/TextureAtlas/BossRush/" + singlebundlename; + break; + } + } + } + else + { + string text = "ui_"; + string text2 = ""; + if (string.IsNullOrEmpty(singlebundlename)) + { + if (assetname == AssetBundleNames.BattleLang) + { + text = "uilang_"; + } + text2 = assetname.ToString().ToLower(); + } + else + { + if (singlebundlename.ToString().ToLower().Contains("battlelang")) + { + text = "uilang_"; + } + text2 = singlebundlename.ToString().ToLower(); + } + result = text + text2 + ".unity3d"; + } + return result; + } + + public void AddResidentAtlas(AssetBundleNames atlasName) + { + string atlasPath = GetAtlasPath(atlasName, null, isload: true); + UIAtlas component = Toolbox.ResourcesManager.LoadObject(atlasPath).GetComponent(); + _residentAtlasList.Add(component); + } + + public void RemoveResidentAtlas(AssetBundleNames atlasName) + { + string name = atlasName.ToString(); + int num = _residentAtlasList.FindIndex((UIAtlas atlas) => atlas.name == name); + if (num < 0) + { + Debug.LogError("not found in resident atlas list : " + name); + } + else + { + _residentAtlasList.RemoveAt(num); + } + } + + private HashSet GetLoadTargetSet(UIManager.ViewScene scene) + { + HashSet hashSet = new HashSet(); + switch (scene) + { + case UIManager.ViewScene.MyPage: + hashSet.Add(AssetBundleNames.MypageComon); + break; + case UIManager.ViewScene.Battle: + case UIManager.ViewScene.RankMatch: + hashSet.Add(AssetBundleNames.Battle); + hashSet.Add(AssetBundleNames.BattleLang); + hashSet.Add(AssetBundleNames.Arena); + break; + case UIManager.ViewScene.Room: + hashSet.Add(AssetBundleNames.RoomMatch); + break; + case UIManager.ViewScene.StorySelectPage: + case UIManager.ViewScene.StorySelectionWorld: + case UIManager.ViewScene.AreaSelect: + case UIManager.ViewScene.StoryChapterSelectionFlowChart: + hashSet.Add(AssetBundleNames.AreaSelect); + break; + case UIManager.ViewScene.RedEtherCampaignLobby: + hashSet.Add(AssetBundleNames.AreaSelect); + hashSet.Add(AssetBundleNames.RedEtherCampaign); + break; + case UIManager.ViewScene.DeckCardEdit: + case UIManager.ViewScene.CardAllList: + case UIManager.ViewScene.CardDestruct: + case UIManager.ViewScene.SealedDeckEdit: + hashSet.Add(AssetBundleNames.DeckEdit); + break; + case UIManager.ViewScene.TwoPick: + hashSet.Add(AssetBundleNames.MypageComon); + hashSet.Add(AssetBundleNames.Arena); + break; + case UIManager.ViewScene.Sealed: + case UIManager.ViewScene.Colosseum: + case UIManager.ViewScene.CompetitionLobby: + hashSet.Add(AssetBundleNames.Arena); + break; + case UIManager.ViewScene.SealedCardPackOpen: + case UIManager.ViewScene.Gacha: + case UIManager.ViewScene.BuildDeckPurchasePage: + case UIManager.ViewScene.CardSleevePurchasePage: + case UIManager.ViewScene.ClassSkinPurchasePage: + hashSet.Add(AssetBundleNames.Gacha); + break; + case UIManager.ViewScene.Bingo: + hashSet.Add(AssetBundleNames.Bingo); + hashSet.Add(AssetBundleNames.Quest); + break; + case UIManager.ViewScene.Profile: + case UIManager.ViewScene.CrossoverPortal: + hashSet.Add(AssetBundleNames.Profile); + break; + case UIManager.ViewScene.Ranking: + hashSet.Add(AssetBundleNames.Ranking); + break; + case UIManager.ViewScene.Gathering: + hashSet.Add(AssetBundleNames.Friend); + hashSet.Add(AssetBundleNames.Ranking); + hashSet.Add(AssetBundleNames.Tournament); + break; + case UIManager.ViewScene.Guild: + case UIManager.ViewScene.Friend: + hashSet.Add(AssetBundleNames.Friend); + hashSet.Add(AssetBundleNames.Ranking); + break; + case UIManager.ViewScene.LotteryPage: + hashSet.Add(AssetBundleNames.Arena); + hashSet.Add(AssetBundleNames.Quest); + break; + case UIManager.ViewScene.QuestSelectionPage: + hashSet.Add(AssetBundleNames.Quest); + hashSet.Add(AssetBundleNames.BossRush); + break; + case UIManager.ViewScene.Scenario: + case UIManager.ViewScene.Scenario2: + hashSet.Add(AssetBundleNames.Scenario); + break; + case UIManager.ViewScene.NeutralPopularityVote: + hashSet.Add(AssetBundleNames.NeutralPopularityVote); + break; + case UIManager.ViewScene.BossRushLobby: + hashSet.Add(AssetBundleNames.BossRush); + hashSet.Add(AssetBundleNames.Arena); + hashSet.Add(AssetBundleNames.Quest); + break; + case UIManager.ViewScene.FreePackCampaign: + hashSet.Add(AssetBundleNames.Arena); + break; + } + return hashSet; + } + + private void UpdateAssetPathFromAssetBundleNames(HashSet assetBundleNameSet) + { + _loadPath.Clear(); + foreach (AssetBundleNames item in assetBundleNameSet) + { + string atlasPath = GetAtlasPath(item); + _loadPath.Add(atlasPath); + } + } + + private void AddAssetObjList(UnityEngine.Object listData) + { + try + { + UIAtlas component = ((GameObject)listData).GetComponent(); + if (component != null) + { + _atlasList.Add(component); + } + } + catch + { + } + } + + public List GetAtlasList() + { + return _residentAtlasList.Union(_atlasList).ToList(); + } + + public bool getAssetBundleEnd() + { + return _isLoadFinish; + } + + public void setAssetBundleEnd(bool flag) + { + _isLoadFinish = flag; + } + + public void OnDestroyView(UIManager.ViewScene scene) + { + foreach (AssetBundleNames item in GetLoadTargetSet(scene)) + { + string atlasPath = GetAtlasPath(item); + Toolbox.AssetManager.UnloadAsset(atlasPath); + } + } + + public void AttachAtlas(List obj_list, bool isTargetChildren = true) + { + List atlasList = GetAtlasList(); + if (atlasList == null || atlasList.Count <= 0) + { + return; + } + List list = new List(); + for (int i = 0; i < obj_list.Count; i++) + { + UISprite[] collection = (isTargetChildren ? obj_list[i].GetComponentsInChildren(includeInactive: true) : UnityEngine.Object.FindObjectsOfType()); + list.AddRange(collection); + } + for (int j = 0; j < list.Count; j++) + { + UISprite uISprite = list[j]; + string spriteName = uISprite.spriteName; + if (uISprite.atlas != null || string.IsNullOrEmpty(spriteName) || spriteName == "collider") + { + continue; + } + foreach (UIAtlas item in atlasList) + { + foreach (UISpriteData sprite in item.spriteList) + { + if (spriteName == sprite.name) + { + uISprite.atlas = item; + goto end_IL_00f1; + } + } + continue; + end_IL_00f1: + break; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/UIPageIndicator.cs b/SVSim.BattleEngine/Engine/Wizard/UIPageIndicator.cs new file mode 100644 index 0000000..7e03f60 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/UIPageIndicator.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class UIPageIndicator : UIBase +{ + [SerializeField] + private UIGrid _gridParentObj; + + [SerializeField] + private UIToggle _indicatorOriginal; + + private List _indicatorList = new List(); + + private int _maxPageNum; + + public void Init(int maxPageNum, int defaultPage = 1) + { + _maxPageNum = maxPageNum; + if (maxPageNum <= 1) + { + _gridParentObj.gameObject.SetActive(value: false); + } + else + { + for (int i = 0; i < maxPageNum; i++) + { + _indicatorList.Add(NGUITools.AddChild(_gridParentObj.gameObject, _indicatorOriginal.gameObject).GetComponent()); + } + _indicatorOriginal.gameObject.SetActive(value: false); + _gridParentObj.gameObject.SetActive(value: true); + _gridParentObj.Reposition(); + } + UpdateIndicator(defaultPage); + } + + public void UpdateIndicator(int page) + { + if (page > 0 && _maxPageNum >= page && _indicatorList.Count > 0) + { + _indicatorList[page - 1].value = true; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/UIParticleEffectManager.cs b/SVSim.BattleEngine/Engine/Wizard/UIParticleEffectManager.cs new file mode 100644 index 0000000..17c6ae1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/UIParticleEffectManager.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class UIParticleEffectManager : MonoBehaviour +{ + [SerializeField] + private GameObject _groupPrefab; + + private static readonly Vector3 START_POSITION = new Vector3(4000f, 0f, 0f); + + private static readonly Vector3 OFFSET_POSITION = new Vector3(4000f, 0f, 0f); + + private int _groupCount; + + private List _groupList = new List(); + + public static UIParticleEffectManager Instance { get; private set; } + + private void Awake() + { + Instance = this; + } + + public UIParticleEffectGroup StartEffect(Effect2dCreateParam param, UITexture uiTexture, bool isEnableUpdateReposition) + { + UIParticleEffectGroup uIParticleEffectGroup = CreateNewGroup(uiTexture); + uIParticleEffectGroup.StartEffect(param, isEnableUpdateReposition); + return uIParticleEffectGroup; + } + + public UIParticleEffectGroup AddEffect(GameObject effect, UITexture uiTexture) + { + UIParticleEffectGroup uIParticleEffectGroup = CreateNewGroup(uiTexture); + uIParticleEffectGroup.SetEffect(effect); + return uIParticleEffectGroup; + } + + public void Remove(UIParticleEffectGroup group) + { + if (_groupList.Remove(group)) + { + group.OnBeforeDestroy(); + Object.Destroy(group.gameObject); + } + } + + public UIParticleEffectGroup CreateNewGroup(UITexture uiTexture) + { + GameObject obj = NGUITools.AddChild(base.gameObject, _groupPrefab); + UIParticleEffectGroup component = obj.GetComponent(); + component.Initialize(uiTexture); + obj.transform.localPosition = START_POSITION + OFFSET_POSITION * _groupCount; + _groupCount++; + _groupList.Add(component); + return component; + } + + public void OnChangeScene() + { + foreach (UIParticleEffectGroup group in _groupList) + { + Object.Destroy(group.gameObject); + } + _groupList.Clear(); + _groupCount = 0; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/UIUtil.cs b/SVSim.BattleEngine/Engine/Wizard/UIUtil.cs new file mode 100644 index 0000000..cdf6f8e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/UIUtil.cs @@ -0,0 +1,254 @@ +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; +using Cute; +using UnityEngine; + +namespace Wizard; + +public static class UIUtil +{ + private const int TEMP_STRING_BUILDER_CAPACITY = 1024; + + public static StringBuilder _tempStringBuilder = new StringBuilder(1024); + + public static StringBuilder GetTempStringBuilder() + { + _tempStringBuilder.Length = 0; + return _tempStringBuilder; + } + + public static void SetPositionX(Transform targetTransform, float x) + { + Vector2 vector = targetTransform.localPosition; + vector.x = x; + targetTransform.localPosition = vector; + } + + public static void SetPositionY(Transform targetTransform, float y) + { + Vector2 vector = targetTransform.localPosition; + vector.y = y; + targetTransform.localPosition = vector; + } + + public static void AddPositionY(Transform targetTransform, float addY) + { + Vector2 vector = targetTransform.localPosition; + vector.y += addY; + targetTransform.localPosition = vector; + } + + public static void SetLocalPositionY(Transform targetTransform, float y) + { + Vector3 localPosition = targetTransform.localPosition; + localPosition.y = y; + targetTransform.localPosition = localPosition; + } + + public static string GetBattleTypeName(NetworkDefine.ServerBattleType battleType) + { + switch (battleType) + { + case NetworkDefine.ServerBattleType.Free: + return Data.SystemText.Get("Battle_0001"); + case NetworkDefine.ServerBattleType.Rank: + return Data.SystemText.Get("Battle_0002"); + case NetworkDefine.ServerBattleType.OpenRoom: + case NetworkDefine.ServerBattleType.RoomTwoPick: + case NetworkDefine.ServerBattleType.Gathering: + case NetworkDefine.ServerBattleType.OfflineEvent: + return Data.SystemText.Get("Battle_0003"); + case NetworkDefine.ServerBattleType.TwoPick: + return Data.SystemText.Get("Battle_0004"); + case NetworkDefine.ServerBattleType.Colosseum: + case NetworkDefine.ServerBattleType.ColosseumTwoPick: + return Data.SystemText.Get("Colosseum_0001"); + case NetworkDefine.ServerBattleType.Competition: + case NetworkDefine.ServerBattleType.CompetitionTwoPick: + return Data.SystemText.Get("Competition_0006"); + case NetworkDefine.ServerBattleType.Sealed: + return Data.SystemText.Get("BattleName_Sealed"); + default: + Debug.LogError($"unsupported BattleType : {battleType}({(int)battleType})"); + return string.Empty; + } + } + + public static string GetFormatName(Format format) + { + return format switch + { + Format.Rotation => Data.SystemText.Get("Common_0154"), + Format.Unlimited => Data.SystemText.Get("Common_0155"), + Format.PreRotation => Data.SystemText.Get("Common_0163"), + Format.Sealed => Data.SystemText.Get("BattleName_Sealed"), + Format.Hof => Data.SystemText.Get("Colosseum_0108"), + Format.Crossover => Data.SystemText.Get("Common_0166"), + Format.MyRotation => Data.SystemText.Get("Common_0178"), + Format.Avatar => Data.SystemText.Get("HeroesBattle_0001"), + _ => string.Empty, + }; + } + + public static bool IsTwoPickForReplay(BattleParameter battleParameter) + { + if (battleParameter.IsTwoPick) + { + if (battleParameter.TwoPickFormat != TwoPickFormat.Cube && battleParameter.TwoPickFormat != TwoPickFormat.Chaos && battleParameter.TwoPickFormat != TwoPickFormat.BackdraftChaos) + { + return battleParameter.TwoPickFormat != TwoPickFormat.BackdraftCube; + } + return false; + } + return false; + } + + public static string GetFormatSmallSpriteName(Format format) + { + return format switch + { + Format.Rotation => "icon_timesliprotation_s", + Format.Unlimited => "icon_unlimited_s", + Format.PreRotation => "icon_prerotation_s", + Format.Sealed => "icon_sealed_s", + Format.Crossover => "icon_crossover_s", + Format.MyRotation => "icon_myrotation_s", + Format.Avatar => "icon_heroesbattle_s", + _ => string.Empty, + }; + } + + public static string GetShortClassName(CardBasePrm.ClanType clan) + { + switch (clan) + { + case CardBasePrm.ClanType.MIN: + return Data.SystemText.Get("Common_0170"); + case CardBasePrm.ClanType.ROYAL: + return Data.SystemText.Get("Common_0171"); + case CardBasePrm.ClanType.WITCH: + return Data.SystemText.Get("Common_0172"); + case CardBasePrm.ClanType.DRAGON: + return Data.SystemText.Get("Common_0173"); + case CardBasePrm.ClanType.NECRO: + return Data.SystemText.Get("Common_0174"); + case CardBasePrm.ClanType.VAMPIRE: + return Data.SystemText.Get("Common_0175"); + case CardBasePrm.ClanType.BISHOP: + return Data.SystemText.Get("Common_0176"); + case CardBasePrm.ClanType.NEMESIS: + return Data.SystemText.Get("Common_0177"); + default: + Debug.LogError($"unsupported clan type : {clan}"); + return string.Empty; + } + } + + public static string GetMyRotationDefaultDeckClassName(CardBasePrm.ClanType clan) + { + switch (clan) + { + case CardBasePrm.ClanType.MIN: + return Data.SystemText.Get("Common_0179"); + case CardBasePrm.ClanType.ROYAL: + return Data.SystemText.Get("Common_0180"); + case CardBasePrm.ClanType.WITCH: + return Data.SystemText.Get("Common_0181"); + case CardBasePrm.ClanType.DRAGON: + return Data.SystemText.Get("Common_0182"); + case CardBasePrm.ClanType.NECRO: + return Data.SystemText.Get("Common_0183"); + case CardBasePrm.ClanType.VAMPIRE: + return Data.SystemText.Get("Common_0184"); + case CardBasePrm.ClanType.BISHOP: + return Data.SystemText.Get("Common_0185"); + case CardBasePrm.ClanType.NEMESIS: + return Data.SystemText.Get("Common_0186"); + default: + Debug.LogError($"unsupported clan type : {clan}"); + return string.Empty; + } + } + + public static bool IsValidIdDigits(string idString, int numOfDigits) + { + if (idString.Length != numOfDigits) + { + return false; + } + if (!int.TryParse(idString, out var result)) + { + return false; + } + return result >= 0; + } + + public static bool IsValidViewerId(string idString) + { + return IsValidIdDigits(idString, 9); + } + + public static string CreateListText(IList list, string separator, string header = null, string footer = null) + { + StringBuilder tempStringBuilder = GetTempStringBuilder(); + if (header != null) + { + tempStringBuilder.Append(header); + } + if (list.Count > 0) + { + tempStringBuilder.Append(list[0]); + for (int i = 1; i < list.Count; i++) + { + tempStringBuilder.Append(separator); + tempStringBuilder.Append(list[i]); + } + } + if (footer != null) + { + tempStringBuilder.Append(footer); + } + return tempStringBuilder.ToString(); + } + + public static void AdjustClassInfoPartsSize(ClassInfoParts classInfoParts, FlexibleGrid grid, int widthMax) + { + grid.Reposition(); + Bounds bounds = NGUIMath.CalculateRelativeWidgetBounds(grid.transform, considerInactive: false); + while (bounds.size.x > (float)widthMax) + { + int num = classInfoParts.ClassNameLabel.fontSize - 1; + if (num <= 0) + { + Debug.LogError("invalid font size"); + break; + } + classInfoParts.ClassNameLabel.fontSize = num; + if (classInfoParts.SubClassNameLabel != null) + { + classInfoParts.SubClassNameLabel.fontSize = num; + } + grid.Reposition(); + bounds = NGUIMath.CalculateRelativeWidgetBounds(grid.transform, considerInactive: false); + } + UIManager.GetInstance().StartCoroutine(grid.RepositionNextFrame()); + } + + public static void SetCountryTexture(UITexture texture, string countryCode) + { + bool flag = !string.IsNullOrEmpty(countryCode); + texture.gameObject.SetActive(flag); + texture.mainTexture = (flag ? (Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(countryCode, ResourcesManager.AssetLoadPathType.Country_M, isfetch: true)) as Texture) : null); + } + + public static string ExtractStringAlphabet(string str) + { + return Regex.Replace(str, "[^a-zA-z]", string.Empty); + } + + public static int ExtractStringNumber(string str) + { + return int.Parse(Regex.Replace(str, "[^0-9]", string.Empty)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/UnitBonusPolicyCollection.cs b/SVSim.BattleEngine/Engine/Wizard/UnitBonusPolicyCollection.cs new file mode 100644 index 0000000..13e8828 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/UnitBonusPolicyCollection.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class UnitBonusPolicyCollection : AIPolicyCollection +{ + public float GetUnitBonus(AIVirtualCard card, AIVirtualField field, List playPtn) + { + if (!base.HasPolicy) + { + return 0f; + } + float num = 0f; + for (int i = 0; i < base.PolicyList.Count; i++) + { + AIPolicyData aIPolicyData = base.PolicyList[i]; + if (aIPolicyData.CheckCondition(card, playPtn, field, null)) + { + num += aIPolicyData.EvalArg(card, playPtn, field); + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/WebViewHelper.cs b/SVSim.BattleEngine/Engine/Wizard/WebViewHelper.cs new file mode 100644 index 0000000..bdfd215 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/WebViewHelper.cs @@ -0,0 +1,393 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class WebViewHelper +{ + public enum WebViewType + { + NONE, + INFO, + HELP, + COPYRIGHT, + TOS, + PRIVACY_POLICY, + KOR_AUTHORITY, + GACHARATE, + LEGALTEXT, + FUND_SETTLEMENT, + TELECOMMUNICATION_POLICY, + KOREA_CRYSTAL_PAGE, + ANNOUNCE, + SEALED_GACHARATE, + LIMITED_INFO + } + + public delegate void ActionWebviewOpen(DialogBase webviewDialog); + + public enum UrlType + { + POLICY, + FACEBOOK, + RECOMMENDED_DEVICE, + GAME_GUIDE, + NICONICO, + NICONICO_PUBLISH + } + + private const int NICONICO_NOTIFICATION_URLDIALOG_DEPTH = 3000; + + private bool _isDestroyedWebView; + + private DialogBase _webViewDialog; + + public DialogBase WebViewDialog => _webViewDialog; + + public void OpenWebView(WebViewType webviewtype, ActionWebviewOpen cbWebviewOpen = null, Action cbWebviewClose = null, Action onButton1 = null, Action onCancel = null) + { + _OpenWebView(webviewtype, cbWebviewOpen, cbWebviewClose, 0, 0, null, "", onButton1, onCancel); + } + + public void OpenGachaRateWebView(int ratePackId, int packCategory = 0) + { + _OpenWebView(WebViewType.GACHARATE, null, null, ratePackId, packCategory); + } + + public void OpenAnnounceWebView(string announceId, Action onDialogOpening = null) + { + _OpenWebView(WebViewType.ANNOUNCE, null, null, 0, 0, announceId, "", null, null, onDialogOpening); + } + + public void OpenWebViewDirectly(string openUrl, bool isLimited = false) + { + string directOpenUrl = CustomPreference.GetApplicationServerURL() + openUrl + GetWebviewBaseQueryParameters(); + if (isLimited) + { + _OpenWebView(WebViewType.LIMITED_INFO, null, null, 0, 0, null, directOpenUrl); + } + else + { + _OpenWebView(WebViewType.INFO, null, null, 0, 0, null, directOpenUrl); + } + } + + public void OpenWebviewWithPageId(string pageId, bool isLimited = false) + { + string text = CustomPreference.GetApplicationServerURL() + "webview2/index#/info_detail" + GetWebviewBaseQueryParameters(); + if (!string.IsNullOrEmpty(pageId)) + { + text = text + "&id=" + pageId; + } + if (isLimited) + { + _OpenWebView(WebViewType.LIMITED_INFO, null, null, 0, 0, null, text); + } + else + { + _OpenWebView(WebViewType.INFO, null, null, 0, 0, null, text); + } + } + + private void _OpenWebView(WebViewType webviewtype, ActionWebviewOpen cbWebviewOpen = null, Action cbWebviewClose = null, int ratePackId = 0, int packCategory = 0, string announceId = null, string directOpenUrl = "", Action onButton1 = null, Action onCancel = null, Action onDialogOpening = null) + { + VideoHostingUtil.CheckVideoHostingAndExecAction(delegate + { + if (webviewtype == WebViewType.ANNOUNCE) + { + OpenBrowserInsteadOfWebView(webviewtype, onDialogOpening, announceId); + } + else if (webviewtype == WebViewType.SEALED_GACHARATE) + { + OpenBrowserInsteadOfWebView(webviewtype, onDialogOpening, Data.ArenaData.SealedMyPageResponseData.ScheduleId.ToString()); + } + else + { + string text = ratePackId.ToString(); + string text2 = packCategory.ToString(); + OpenBrowserInsteadOfWebView(webviewtype, onDialogOpening, text, text2); + } + }); + } + + private string GetWebviewBaseQueryParameters() + { + string encodedViewerId = Certification.GetEncodedViewerId(); + string encodedSessionId = Certification.GetEncodedSessionId(); + string encodedShortUdid = Certification.GetEncodedShortUdid(); + return "?lang=" + CustomPreference.GetTextLanguage() + "&HASH_ID=" + encodedViewerId + "&SID=" + encodedSessionId + "&SUDID=" + encodedShortUdid; + } + + private string GetWebviewBaseQueryParametersLangOnly() + { + return "?lang=" + CustomPreference.GetTextLanguage(); + } + + private DialogBase OpenWebView_Inner(WebViewType webviewtype) + { + _isDestroyedWebView = false; + string webViewDialogTitleId = GetWebViewDialogTitleId(webviewtype); + SetWebviewOpenUrl(webviewtype); + DialogBase dialogBase = (_webViewDialog = UIManager.GetInstance().CreateDialogClose(isSystem: false, dontChangeLabelColor: true)); + dialogBase.SetSize(DialogBase.Size.XL); + if (webViewDialogTitleId != null) + { + dialogBase.SetTitleLabel(Data.SystemText.Get(webViewDialogTitleId)); + } + else + { + dialogBase.SetTitleLabel(string.Empty); + dialogBase.SetTitleLineVisible(visible: false); + dialogBase.CloseOnOff(flag: false); + } + if (webviewtype == WebViewType.INFO || webviewtype == WebViewType.LIMITED_INFO || webviewtype == WebViewType.ANNOUNCE) + { + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.NONE); + } + else + { + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + } + dialogBase.SetButtonDelegate(delegate + { + DestroyWebView(); + }, delegate + { + DestroyWebView(); + }, delegate + { + DestroyWebView(); + }); + dialogBase.onCloseWithoutSelect = delegate + { + DestroyWebView(); + }; + dialogBase.SetAnchors(); + dialogBase.SetPanelDepth(3000); + WebViewScreen webViewScreen = WebViewManager.getInstance().m_WebViewScreen; + if (webviewtype == WebViewType.INFO || webviewtype == WebViewType.LIMITED_INFO || webviewtype == WebViewType.ANNOUNCE) + { + Vector4 webViewDisplayRect = dialogBase.GetWebViewDisplayRect(); + webViewScreen.CurBoxCollider.size = new Vector3(webViewDisplayRect.z, webViewDisplayRect.w, 0f); + webViewScreen.CurBoxCollider.center = new Vector3(webViewDisplayRect.x, webViewDisplayRect.y, 0f); + } + else + { + webViewScreen.CurBoxCollider.size = Global.WEBVIEW_NORMAL_SIZE; + webViewScreen.CurBoxCollider.center = Vector2.zero; + } + return dialogBase; + } + + private string GetWebViewDialogTitleId(WebViewType webviewtype) + { + string result = null; + switch (webviewtype) + { + case WebViewType.INFO: + case WebViewType.ANNOUNCE: + result = "Common_0036"; + break; + case WebViewType.LIMITED_INFO: + result = "Mission_0048"; + break; + case WebViewType.HELP: + result = "OtherTop_0006"; + break; + case WebViewType.TOS: + result = ((PlayerStaticData._tosAgreementState == PlayerStaticData.AgreementState.Reset) ? "OtherTop_0010_Update" : "OtherTop_0010"); + break; + case WebViewType.PRIVACY_POLICY: + result = ((PlayerStaticData._privacyPolicyAgreementState == PlayerStaticData.AgreementState.Reset) ? "OtherTop_0009_Update" : "OtherTop_0009"); + break; + case WebViewType.TELECOMMUNICATION_POLICY: + result = "OtherTop_0069"; + break; + case WebViewType.KOR_AUTHORITY: + result = ((PlayerStaticData.KorAuthorityAgreementState == PlayerStaticData.AgreementState.Reset) ? "OtherTop_0067_Update" : "OtherTop_0067"); + break; + case WebViewType.COPYRIGHT: + result = "OtherTop_0022"; + break; + case WebViewType.GACHARATE: + result = "Shop_0004"; + break; + case WebViewType.LEGALTEXT: + result = "Shop_0005"; + break; + case WebViewType.FUND_SETTLEMENT: + result = "Shop_0077"; + break; + case WebViewType.KOREA_CRYSTAL_PAGE: + result = "Shop_0126"; + break; + case WebViewType.SEALED_GACHARATE: + result = "Sealed_GachaRateWebViewTitle"; + break; + } + return result; + } + + private void SetWebviewOpenUrl(WebViewType webviewtype) + { + switch (webviewtype) + { + } + } + + private string GetBrowserUrl(WebViewType webviewtype) + { + string text = null; + switch (webviewtype) + { + case WebViewType.INFO: + case WebViewType.LIMITED_INFO: + text = "URL_0004"; + break; + case WebViewType.HELP: + text = "URL_0011"; + break; + case WebViewType.TOS: + text = "URL_0005"; + break; + case WebViewType.PRIVACY_POLICY: + text = "URL_0007"; + break; + case WebViewType.TELECOMMUNICATION_POLICY: + text = "URL_0018"; + break; + case WebViewType.COPYRIGHT: + text = "URL_0006"; + break; + case WebViewType.GACHARATE: + text = "URL_0010"; + break; + case WebViewType.LEGALTEXT: + text = "URL_0009"; + break; + case WebViewType.FUND_SETTLEMENT: + text = "URL_0008"; + break; + case WebViewType.KOREA_CRYSTAL_PAGE: + text = "URL_0015"; + break; + case WebViewType.ANNOUNCE: + text = "URL_0016"; + break; + case WebViewType.SEALED_GACHARATE: + text = "URL_0017"; + break; + } + return text + "_steam"; + } + + private void OpenBrowserInsteadOfWebView(WebViewType webviewtype, Action onDialogOpening, params string[] param) + { + string webViewDialogTitleId = GetWebViewDialogTitleId(webviewtype); + string browserUrl = GetBrowserUrl(webviewtype); + SystemText systemText = Data.SystemText; + UIManager.ShowDialogUrl(systemText.Get(webViewDialogTitleId), systemText.Get(browserUrl, param), onDialogOpening); + } + + public void DestroyWebView() + { + if (!_isDestroyedWebView && WebViewManager.HasInstance) + { + _isDestroyedWebView = true; + WebViewManager instance = WebViewManager.getInstance(); + instance.UnloadWebView(); + instance.SetCallback(null); + } + } + + public void CloseWebViewDialog() + { + if (IsOpenWebViewDialog()) + { + _webViewDialog.Close(); + _webViewDialog = null; + DestroyWebView(); + } + } + + public bool IsOpenWebViewDialog() + { + if (_webViewDialog != null) + { + return _webViewDialog.IsOpen(); + } + return false; + } + + public DialogBase CreateOpenURLWindow(UrlType type) + { + string applicationServerURL = CustomPreference.GetApplicationServerURL(); + string text = "?lang=" + CustomPreference.GetTextLanguage(); + string openUrl = null; + string key = null; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + SystemText systemText = Data.SystemText; + switch (type) + { + case UrlType.POLICY: + dialogBase.SetPanelDepth(3000); + openUrl = applicationServerURL + "information/policy" + text; + key = "OtherTop_0009"; + break; + case UrlType.FACEBOOK: + key = "Account_0038"; + break; + case UrlType.RECOMMENDED_DEVICE: + key = "Common_0134"; + openUrl = "https://shadowverse.jp/device.php"; + break; + case UrlType.GAME_GUIDE: + openUrl = systemText.Get("URL_0012_steam"); + key = "OtherTop_0021"; + break; + case UrlType.NICONICO: + dialogBase.SetPanelDepth(3000); + key = "VideoHosting_0034"; + openUrl = "https://account.nicovideo.jp/rules/account"; + break; + case UrlType.NICONICO_PUBLISH: + dialogBase.SetPanelDepth(3000); + key = "VideoHosting_0035"; + openUrl = "http://live.nicovideo.jp/static/rule.html"; + break; + } + dialogBase.SetTitleLabel(systemText.Get(key)); + dialogBase.SetText(systemText.Get("Common_0208")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("Dia_Web_001_Button")); + dialogBase.onPushButton1 = delegate + { + PrepareOpenUrl(delegate + { + if (type == UrlType.FACEBOOK) + { + UIManager.GetInstance().AccountTransferHelper.DataTransferByFaceBook(); + } + else + { + BrowserURL.Open(openUrl); + } + }); + }; + return dialogBase; + } + + public void PrepareOpenUrl(Action onFinish) + { + onFinish(); + } + + public void OpenUrl(string url) + { + PrepareOpenUrl(delegate + { + BrowserURL.Open(url); + }); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/WebViewScreen.cs b/SVSim.BattleEngine/Engine/Wizard/WebViewScreen.cs new file mode 100644 index 0000000..b6dc1db --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/WebViewScreen.cs @@ -0,0 +1,17 @@ +using UnityEngine; + +namespace Wizard; + +[RequireComponent(typeof(BoxCollider))] +public class WebViewScreen : MonoBehaviour +{ + [SerializeField] + private BoxCollider curBoxCollider; + + public BoxCollider CurBoxCollider => curBoxCollider; + + public void EditorSetBoxCollieder(BoxCollider setBoxCollider) + { + curBoxCollider = setBoxCollider; + } +} diff --git a/SVSim.BattleEngine/Engine/YuwanField.cs b/SVSim.BattleEngine/Engine/YuwanField.cs new file mode 100644 index 0000000..727c58e --- /dev/null +++ b/SVSim.BattleEngine/Engine/YuwanField.cs @@ -0,0 +1,83 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class YuwanField : BackGroundBase +{ + public override int FieldId => 18; + + public YuwanField(string bgmId = "NONE") + : base(bgmId) + { + } + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_gate_01").gameObject; + _fieldParticles = _fieldModel.transform.Find("Particles08").gameObject; + _fieldParticleSystemDictionary.Add("plasma_gimic_1", _fieldParticles.transform.Find("plasma_gimic_1").GetComponent()); + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_8, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_8_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(-20f, 80f, 700f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-10f, 0f, 0f)); + yield return new WaitForSeconds(2f); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _gimicCntDictionary[obj.tag]++; + _fieldParticleSystemDictionary["plasma_gimic_1"].Play(); + yield return new WaitForSeconds(1.5f); + _gimicCntDictionary[obj.tag] = 0; + } + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Engine/llField.cs b/SVSim.BattleEngine/Engine/llField.cs new file mode 100644 index 0000000..9a08c3d --- /dev/null +++ b/SVSim.BattleEngine/Engine/llField.cs @@ -0,0 +1,82 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class llField : BackGroundBase +{ + public override int FieldId => 1002; + + protected override void BattleFieldBuild() + { + BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate + { + base.Field = GameObject.Find(_str3DFieldPath); + base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform; + GimicAudioList = base.Field.GetComponent().GimicAudioList; + _fieldModel = base.Field.transform.Find("md_bf_1002_root").gameObject; + _fieldObjDictionary.Add("horn", _fieldModel.transform.Find("md_bf_1002_01_horn").gameObject); + m_FieldAnimatorDictionary.Add("horn", _fieldObjDictionary["horn"].GetComponent()); + _fieldParticles = _fieldModel.transform.Find("Particles" + FieldId).gameObject; + _fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent()); + _fieldParticleSystemDictionary.Add("shake", _fieldParticles.transform.Find("shake").GetComponent()); + _fieldParticleSystemDictionary.Add("gimic_1", _fieldParticles.transform.Find("gimic_1").GetComponent()); + List list = new List(_fieldObjDictionary.Keys); + List list2 = new List(); + for (int i = 0; i < _fieldObjDictionary.Count; i++) + { + list2.Add(_fieldObjDictionary[list[i]]); + } + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate + { + base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent(); + base.IsLoadDone = true; + }, isBattle: true, isField: true); + })); + } + + public override void StartFieldSetEffect(Vector3 pos) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_1002, pos); + } + + public override void StartFieldTapEffect(int areaId, Vector3 pos) + { + base.StartFieldTapEffect(areaId, pos); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_1002_1, pos); + } + + protected override IEnumerator RunFieldOpening() + { + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L); + _fieldParticleSystemDictionary["opening"].Play(); + _battleCamera.Camera.transform.localPosition = new Vector3(2100f, -1500f, -1800f); + _battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-20f, -30f, 54f)); + Vector3[] bezierQuad = MotionUtils.GetBezierQuad(new Vector3(2100f, -1500f, -1800f), new Vector3(1300f, -1000f, 90f), new Vector3(90f, 120f, -160f), 10); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierQuad, "movetopath", false, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-46f, -109f, 105f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad)); + yield return new WaitForSeconds(2f); + iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + yield return new WaitForSeconds(0f); + } + + protected override IEnumerator RunFieldGimic(GameObject obj) + { + string tag = obj.tag; + if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0) + { + _gimicCntDictionary[obj.tag]++; + m_FieldAnimatorDictionary["horn"].SetTrigger("Rotate"); + _fieldParticleSystemDictionary["gimic_1"].Play(); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_1", "se_field_" + _str3DFieldNo, 0f, 0L); + yield return new WaitForSeconds(3f); + _gimicCntDictionary[obj.tag] = 0; + } + } + + protected override IEnumerator RunFieldShake() + { + _fieldParticleSystemDictionary["shake"].Play(); + yield return new WaitForSeconds(0f); + } +} diff --git a/SVSim.BattleEngine/Shim/External/LooseEnds.cs b/SVSim.BattleEngine/Shim/External/LooseEnds.cs new file mode 100644 index 0000000..d90c2bf --- /dev/null +++ b/SVSim.BattleEngine/Shim/External/LooseEnds.cs @@ -0,0 +1,50 @@ +// AUTHORED SHIM (not copied). Final loose ends for the M1 compile: (1) namespace +// "anchors" -- empty `using` targets in tangentially-copied files reference these +// namespaces, which must merely exist; a single internal anchor type declares them. +// (2) a few concrete tangential types referenced directly. (3) minimal third-party +// serialization/SDK surface. None is on the battle-resolution path. + +namespace Wizard.AutoTest { internal class _ShimAnchor { } } +namespace Wizard.Title { internal class _ShimAnchor { } } +namespace Wizard.ErrorDialog { internal class _ShimAnchor { } } +namespace Wizard.Bingo { internal class _ShimAnchor { } } +namespace Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase { internal class _ShimAnchor { } } +namespace Wizard.Scripts.Network.Data.TaskData.ItemPurchase { internal class _ShimAnchor { } } +namespace Wizard.Scripts.Network.Data.TaskData.SkinPurchase { internal class _ShimAnchor { } } +namespace Wizard.Scripts.Network.Data.TaskData.SpotCardExchange { internal class _ShimAnchor { } } + +// These are NAMESPACES (used as `using` targets in copied files), not types. +namespace Wizard.DeckSelect.FirstDisplayPageIndexGetter { internal class _ShimAnchor { } } +namespace Wizary.StorySelectionWorld { internal class _ShimAnchor { } } +namespace Wizard.Scripts.Network.Data.TableData.Arena.TwoPick { internal class _ShimAnchor { } } +namespace Wizard.Scripts.Network.Data.TaskData.Arena { public class Reward { } } + +// IManager: a Cute manager interface implemented by NetworkManager/ResourcesManager. +namespace Cute { public interface IManager { } } + +// ---- third-party serialization / SDK (minimal surface) ---- +namespace MessagePack +{ + public static class MessagePackSerializer + { + public static byte[] Serialize(T obj) => new byte[0]; + public static T Deserialize(byte[] bytes) => default; + public static string ToJson(byte[] bytes) => ""; + public static byte[] FromJson(string json) => new byte[0]; + } +} + +namespace MiniJSON +{ + public static class Json + { + public static object Deserialize(string json) => null; + public static string Serialize(object obj) => ""; + } +} + +namespace Steamworks +{ + // Steam callback wrapper (engine only references the type). + public sealed class Callback { } +} diff --git a/SVSim.BattleEngine/Shim/External/ThirdParty.cs b/SVSim.BattleEngine/Shim/External/ThirdParty.cs new file mode 100644 index 0000000..92ce9bb --- /dev/null +++ b/SVSim.BattleEngine/Shim/External/ThirdParty.cs @@ -0,0 +1,44 @@ +// AUTHORED SHIM (not copied). Third-party / platform SDK surface referenced by +// tangentially-pulled engine files (audio, Steam, networking, serialization). +// Stubbed minimally in their original namespaces; none is on the battle-resolution +// path. Members grow only if the compile loop demands them. +using System; + +// ---- remaining UnityEngine types ---- +namespace UnityEngine +{ + public class Font : Object { } + public enum Space { World, Self } + // NGUI's UIInputOnGUI reads Event.current (legacy IMGUI event). + public class Event { public static Event current => null; } +} + +namespace UnityEngine.Networking +{ + public class UnityWebRequest : IDisposable { public void Dispose() { } } +} + +// ---- CRI Atom audio middleware ---- +namespace CriWare +{ + public class CriAtomSource { } + public class CriAtom { } +} + +// ---- Steamworks.NET ---- +namespace Steamworks +{ + public struct GetAuthSessionTicketResponse_t { } +} + +// ---- BestHTTP Socket.IO ---- +namespace BestHTTP.SocketIO +{ + public interface IManager { } +} + +// ---- Google Play Games ---- +namespace GooglePlayGames.BasicApi.Events +{ + public class Event { } +} diff --git a/SVSim.BattleEngine/Shim/GodObjects/GodObjects.cs b/SVSim.BattleEngine/Shim/GodObjects/GodObjects.cs new file mode 100644 index 0000000..a247479 --- /dev/null +++ b/SVSim.BattleEngine/Shim/GodObjects/GodObjects.cs @@ -0,0 +1,61 @@ +// AUTHORED SHIM (not copied). The god-object singletons the engine reaches for +// presentation/scene/effects. These are the M0 "stop the bleed" types: copying +// them would re-explode the closure into the whole app (audio, scene, UI, net), +// so we shim a minimal surface. The nested enums below are presentation +// classifiers used only inside never-run VFX actions (IsForecast suppresses VFX), +// so their VALUES are immaterial to game state -- but the symbols the engine +// references must exist to compile. Members listed are exactly those the compiler +// demanded (extracted from the copied engine, not guessed). +// (Global namespace: the decomp root files declare no namespace.) + +public class EffectMgr +{ + public enum EffectType + { + NONE, + CMN_CARD_ACCELERATE_1, CMN_CARD_CRYSTALLIZE_1, CMN_CARD_SELECT_3, + CMN_CARD_SET_1, CMN_CARD_SET_2, CMN_CARD_SET_3, + CMN_CARD_TARGET_1, CMN_CARD_TARGET_2, + CMN_CRAFT_CARD_1, CMN_CRAFT_CARD_2, CMN_CRAFT_ICON_1, + CMN_CRAFT_SPLASH_1, CMN_CRAFT_SPLASH_2, CMN_CRAFT_SPLASH_3, CMN_CRAFT_SPLASH_4, + CMN_CRAFT_TRACK_1, CMN_FRAME_BTN_1, CMN_FRAME_BTN_2, + CMN_GACHA_CURSOR_1, CMN_GACHA_OPEN_2, CMN_GACHA_OPEN_3, CMN_GACHA_OPEN_4, + CMN_INPUT_DRAG_1, CMN_INPUT_TOUCH_1, CMN_INPUT_TOUCH_2, + CMN_RESULT_BACK_1, CMN_RESULT_BACK_2, CMN_RESULT_BACK_3, + CMN_RESULT_FAILED_1, CMN_RESULT_GAUGE_1, CMN_RESULT_GAUGE_2, + CMN_RESULT_LVUP_1, CMN_RESULT_MATCH_1, CMN_RESULT_ORB_1, CMN_RESULT_ORB_2, + CMN_RESULT_RANKDOWN_1, CMN_RESULT_RANKUP_1, CMN_RESULT_TIERUP_1, + CMN_START_CARD_1, CMN_START_VS_1, CMN_START_VS_ST2, + CMN_UI_TURN_1, CMN_UI_TURN_5, CMN_UI_TURN_6, + } + public enum MoveType { NONE, DIRECT, DIRECT_HAND, DIRECT_LEADER } + public enum TargetType { NONE, NONE_WAIT, SINGLE, SINGLE_ONLY_OPPONENT, AREA_ALL, AREA_OPPONENT, AREA_SELF } + public enum EngineType { NONE, SHURIKEN, SOLID } +} + +public class UIManager +{ + public static UIManager GetIns() => _ins ??= new UIManager(); + private static UIManager _ins; + + public enum ViewScene + { + None, Battle, Bingo, BuildDeckPurchasePage, CardAllList, CardSleevePurchasePage, + ClassSkinPurchasePage, Colosseum, CrossoverPortal, DeckList, Gacha, Gathering, + LeaderPopularityVote, LoginBonus, LotteryPage, Mission, MyPage, + NeutralPopularityVote, Profile, QuestSelectionPage, RankMatch, Room, + StorySelectPage, StorySelectionWorld, TwoPick, + } + public class ChangeViewSceneParam { } +} + +public class GameMgr +{ + public static GameMgr GetIns() => _ins ??= new GameMgr(); + private static GameMgr _ins; + public bool IsAdminWatch => false; + public bool IsWatchBattle => false; + public bool IsReplayBattle => false; + public EffectMgr GetEffectMgr() => _effect ??= new EffectMgr(); + private EffectMgr _effect; +} diff --git a/SVSim.BattleEngine/Shim/UnityEngine/UnityShim.cs b/SVSim.BattleEngine/Shim/UnityEngine/UnityShim.cs new file mode 100644 index 0000000..2b64fad --- /dev/null +++ b/SVSim.BattleEngine/Shim/UnityEngine/UnityShim.cs @@ -0,0 +1,166 @@ +// AUTHORED SHIM (not copied). No-op UnityEngine surface for headless battle +// resolution. Grows via the M1 compile loop -- add only members the compiler +// demands. State-bearing battle logic lives in Engine/; nothing here computes +// game state (Unity calls are VFX/IO/rendering, suppressed by IsForecast). +using System; +using System.Collections; + +namespace UnityEngine +{ + // ---- value types (Vector2/3, Quaternion, Color, Mathf, Debug live in Primitives.cs) ---- + public struct Vector4 { public float x, y, z, w; public Vector4(float x, float y, float z, float w){ this.x=x; this.y=y; this.z=z; this.w=w; } } + public struct Color32 { public byte r, g, b, a; public Color32(byte r, byte g, byte b, byte a){ this.r=r; this.g=g; this.b=b; this.a=a; } } + public struct Bounds { public Vector3 center, size; public Bounds(Vector3 c, Vector3 s){ center=c; size=s; } } + public struct Rect { public float x, y, width, height; public Rect(float x, float y, float w, float h){ this.x=x; this.y=y; width=w; height=h; } } + public struct Matrix4x4 { public static Matrix4x4 identity => new Matrix4x4(); } + public struct Plane { } + public struct Ray { } + public struct RaycastHit { } + public struct LayerMask { public int value; public static int NameToLayer(string n) => 0; public static implicit operator int(LayerMask m) => m.value; } + + // ---- core object model ---- + public class Object + { + public string name { get; set; } + public int GetInstanceID() => 0; + public override string ToString() => name ?? base.ToString(); + public static void Destroy(Object o) { } + public static void Destroy(Object o, float t) { } + public static void DestroyImmediate(Object o) { } + public static void DontDestroyOnLoad(Object o) { } + public static T Instantiate(T original) where T : Object => original; + public static T FindObjectOfType() where T : Object => null; + public static bool operator ==(Object a, Object b) => ReferenceEquals(a, b); + public static bool operator !=(Object a, Object b) => !ReferenceEquals(a, b); + public static implicit operator bool(Object o) => !ReferenceEquals(o, null); + public override bool Equals(object o) => ReferenceEquals(this, o); + public override int GetHashCode() => System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(this); + } + + public class Component : Object + { + public Transform transform => null; + public GameObject gameObject => null; + public T GetComponent() => default; + public T GetComponentInChildren() => default; + public T[] GetComponentsInChildren() => new T[0]; + public T GetComponentInParent() => default; + } + + public class Behaviour : Component { public bool enabled { get; set; } } + + public class MonoBehaviour : Behaviour + { + public Coroutine StartCoroutine(IEnumerator routine) => null; + public Coroutine StartCoroutine(string methodName) => null; + public void StopCoroutine(IEnumerator routine) { } + public void StopCoroutine(Coroutine routine) { } + public void StopAllCoroutines() { } + public void Invoke(string methodName, float time) { } + public void CancelInvoke() { } + public bool IsInvoking() => false; + } + + public class Transform : Component, IEnumerable + { + public Vector3 position { get; set; } + public Vector3 localPosition { get; set; } + public Vector3 localScale { get; set; } = new Vector3(1, 1, 1); + public Vector3 localEulerAngles { get; set; } + public Vector3 eulerAngles { get; set; } + public Quaternion rotation { get; set; } + public Quaternion localRotation { get; set; } + public Transform parent { get; set; } + public int childCount => 0; + public Transform Find(string n) => null; + public Transform GetChild(int i) => null; + public void SetParent(Transform p) { } + public void SetParent(Transform p, bool worldPositionStays) { } + public void SetSiblingIndex(int i) { } + public int GetSiblingIndex() => 0; + public void SetAsLastSibling() { } + public void SetAsFirstSibling() { } + public IEnumerator GetEnumerator() { yield break; } + } + + public class GameObject : Object + { + public GameObject() { } + public GameObject(string name) { this.name = name; } + public Transform transform => null; + public bool activeSelf => false; + public bool activeInHierarchy => false; + public int layer { get; set; } + public string tag { get; set; } + public void SetActive(bool value) { } + public T GetComponent() => default; + public T GetComponentInChildren() => default; + public T AddComponent() where T : Component => default; + public Component AddComponent(Type t) => null; + public static GameObject Find(string n) => null; + } + + public class ScriptableObject : Object { } + + // ---- rendering / physics / audio (pure no-op presentation) ---- + public class Renderer : Component { public Material material { get; set; } public Material[] materials { get; set; } public bool enabled { get; set; } } + public class MeshRenderer : Renderer { } + public class SkinnedMeshRenderer : Renderer { } + public class SpriteRenderer : Renderer { public Sprite sprite { get; set; } } + public class MeshFilter : Component { public Mesh mesh { get; set; } } + public class ParticleSystem : Component { } + public class ParticleSystemRenderer : Renderer { } + public class LODGroup : Component { } + public class Collider : Component { public bool enabled { get; set; } } + public class BoxCollider : Collider { } + public class Rigidbody : Component { } + public class Rigidbody2D : Component { } + public class Material : Object { public Material() { } public Material(Material src) { } public Color color { get; set; } public void SetFloat(string n, float v) { } public void SetColor(string n, Color c) { } public void SetTexture(string n, Texture t) { } } + public class Mesh : Object { } + public class Texture : Object { } + public class Texture2D : Texture { public Texture2D(int w, int h) { } } + public class RenderTexture : Texture { } + public class Sprite : Object { } + public class Shader : Object { public static Shader Find(string n) => null; } + public class AnimationClip : Object { } + public class Animation : Component { } + public class Animator : Component { } + public class AnimationCurve { } + public class AudioClip : Object { } + public class AudioSource : Component { } + public class Camera : Component { public static Camera main => null; } + public struct CharacterInfo { } + + // ---- coroutine machinery (never pumped headless; types must exist) ---- + public class YieldInstruction { } + public sealed class Coroutine : YieldInstruction { } + public sealed class WaitForEndOfFrame : YieldInstruction { } + public sealed class WaitForSeconds : YieldInstruction { public WaitForSeconds(float s) { } } + public sealed class WaitForFixedUpdate : YieldInstruction { } + + // ---- input ---- + public struct Touch { public int fingerId; public Vector2 position; public TouchPhase phase; } + + // ---- enums (grow members as the compiler demands) ---- + public enum FontStyle { Normal, Bold, Italic, BoldAndItalic } + public enum TouchPhase { Began, Moved, Stationary, Ended, Canceled } + public enum KeyCode { None } + + // ---- attributes: permissive ctors accept any compile-time attribute args ---- + public class SerializeField : Attribute { } + public class HideInInspector : Attribute { } + public class ExecuteInEditMode : Attribute { } + public class AddComponentMenu : Attribute { public AddComponentMenu(string n) { } public AddComponentMenu(string n, int o) { } } + public class ContextMenu : Attribute { public ContextMenu(string n) { } } + public class RequireComponent : Attribute { public RequireComponent(Type a) { } public RequireComponent(Type a, Type b) { } } + public class HeaderAttribute : Attribute { public HeaderAttribute(string h) { } } + public class TooltipAttribute : Attribute { public TooltipAttribute(string t) { } } + public class SpaceAttribute : Attribute { public SpaceAttribute() { } public SpaceAttribute(float h) { } } + public class RangeAttribute : Attribute { public RangeAttribute(float min, float max) { } } + public class MultilineAttribute : Attribute { public MultilineAttribute() { } public MultilineAttribute(int lines) { } } + + // ---- subsystem singletons / statics ---- + public static class Application { public static bool isEditor => false; public static bool isPlaying => true; public static string persistentDataPath => ""; } + public static class Time { public static float deltaTime => 0f; public static float time => 0f; public static float unscaledDeltaTime => 0f; public static int frameCount => 0; } + public static class Screen { public static int width => 1920; public static int height => 1080; } +} diff --git a/SVSim.BattleEngine/Shim/View/VfxShim.cs b/SVSim.BattleEngine/Shim/View/VfxShim.cs new file mode 100644 index 0000000..96cbeb4 --- /dev/null +++ b/SVSim.BattleEngine/Shim/View/VfxShim.cs @@ -0,0 +1,114 @@ +// AUTHORED SHIM (not copied). The VFX layer, headless. VfxBase mirrors the real +// public surface (see decomp Wizard.Battle.View.Vfx/VfxBase.cs) so the ~800 engine +// call sites that pass/return VfxBase compile unchanged. Containers preserve the +// CONTROL-FLOW contract (Register collects, IsVfxNonEmpty reflects child count) but +// perform NO rendering. InstantVfx stores its action and NEVER runs it: headless +// resolution runs with IsForecast=true so VFX is never played, and per design ยง3.3 +// all state mutation happens synchronously in the skill methods BEFORE the VFX is +// built -- so a never-played VFX loses no game state. +using System; +using System.Collections.Generic; + +namespace Wizard.Battle.View.Vfx +{ + public interface IEffectVfx { } + + public class VfxBase + { + public virtual bool IsEnd { get; protected set; } = true; + public virtual string CurrentVfxName => GetType().ToString(); + public virtual void Update(float dt, List effectVfxList) { } + public virtual void Play() { } + public virtual VfxBase Cancel() => this; + public virtual bool IsVfxNonEmpty() => false; + public virtual List GetVfxNames() => new List(); + } + + public sealed class NullVfx : VfxBase + { + private static readonly NullVfx _ins = new NullVfx(); + public static NullVfx GetInstance() => _ins; + public override bool IsVfxNonEmpty() => false; + } + + public sealed class InstantVfx : VfxBase + { + // Stored, never invoked (headless suppression -- see file header). + private Action _action; + public static InstantVfx Create(Action action) => new InstantVfx { _action = action }; + public override bool IsVfxNonEmpty() => true; + } + + public sealed class WaitVfx : VfxBase + { + public static WaitVfx Create(float seconds) => new WaitVfx(); + public override bool IsVfxNonEmpty() => false; + } + + // Container players: collect children, report non-empty by count, render nothing. + public class SequentialVfxPlayer : VfxBase + { + protected readonly List _children = new List(); + public static SequentialVfxPlayer Create() => new SequentialVfxPlayer(); + public void Register(VfxBase vfx) { if (vfx != null) _children.Add(vfx); } + public int Count() => _children.Count; + public override bool IsVfxNonEmpty() + { + foreach (var c in _children) { if (c != null && c.IsVfxNonEmpty()) return true; } + return false; + } + } + + public class ParallelVfxPlayer : SequentialVfxPlayer + { + public static new ParallelVfxPlayer Create() => new ParallelVfxPlayer(); + } + + public class VfxWithLoading : SequentialVfxPlayer + { + public static new VfxWithLoading Create() => new VfxWithLoading(); + } + + public class VfxWithLoadingSequential : SequentialVfxPlayer + { + public static new VfxWithLoadingSequential Create() => new VfxWithLoadingSequential(); + } + + // Non-generic base (engine references bare `VfxWith` as well as the generics). + public class VfxWith : VfxBase + { + public VfxBase Vfx { get; set; } + } + + // One-value pair (engine reads .Value / .Vfx). + public class VfxWith : VfxWith + { + public T Value { get; set; } + public VfxWith() { } + public VfxWith(T value, VfxBase vfx) { Value = value; Vfx = vfx; } + } + + // Two-value pair (engine reads .Value_1 / .Value_2 / .Vfx). + public class VfxWith : VfxWith + { + public T1 Value_1 { get; set; } + public T2 Value_2 { get; set; } + public VfxWith() { } + public VfxWith(VfxBase vfx, T1 value1, T2 value2) { Vfx = vfx; Value_1 = value1; Value_2 = value2; } + } + + public class EvolveVfxBase : VfxBase { } + public class CanNotTouchCardVfx : VfxBase { } + + public interface ICardVfxCreator { } + public interface IBattleCardVfxCreator { } + + // The VFX manager: headless, registration is suppressed (real VfxMgr early-returns + // when IsForecast; we no-op unconditionally since we never pump the render loop). + public class VfxMgr + { + public void RegisterImmediateVfx(T vfx) where T : VfxBase { } + public void Register(T vfx) where T : VfxBase { } + public void Clear() { } + } +} diff --git a/SVSim.BattleEngine/Shim/View/ViewUiTouchStubs.cs b/SVSim.BattleEngine/Shim/View/ViewUiTouchStubs.cs new file mode 100644 index 0000000..93d5138 --- /dev/null +++ b/SVSim.BattleEngine/Shim/View/ViewUiTouchStubs.cs @@ -0,0 +1,86 @@ +// AUTHORED SHIM (not copied). The battle View / UI / Touch / Replay / RoomMatch +// presentation tree the engine holds references to but never drives headless +// (IsForecast suppresses VFX; we never pump input or rendering). Stubbed in their +// ORIGINAL namespaces so the copied engine's type references resolve. Members grow +// only as the compile loop demands a specific call. Most are referenced as field/ +// parameter types only, so empty stubs suffice. + +namespace Wizard.Battle.View +{ + public interface IReadOnlyVoiceInfo { } + public class BattleCardView + { + public class BuildInfo { } + public class AttackTargetSelectInfo { } + } + public class NonDialogPopup { public virtual void Close() { } } + public abstract class BattlePlayerViewBase + { + public enum BattleDialogItem { Menu, Retire } + } + public class InPlayCardFrameEffectControl { } +} + +namespace Wizard.Battle.UI +{ + public class BattleLogItem + { + public enum CardTextureOption { Null, ForceNormal, ForceEvolution } + } + public class BattleLogManager { } + public class AvatarBattleTitleItem { } + public class AvatarBattlePassiveBonusItem { } + public class AvatarBattleBonusItem { } + public class BossRushEnemySpecialSkillItem { } + public class MyRotationBonusItem { } + public class EvolutionConfirmation { } +} + +namespace Wizard.Battle.Touch +{ + public class SkillTargetSelectTouchProcessor { } + public class EvolutionTouchProcessor { } + public class SetCardProcessor { } + public class EvolutionSimpleProcessor { } + public class EmotionTouchProcessor { } + public class DetailPanelTouchProcessor { } + public class ClassBuffTouchProcessor { } +} + +namespace Wizard.Battle.Replay +{ + public interface IReplayRecordManager { } + public class NetworkBattleReplayOperationRecorder + { + public class RecordBattleLogParameter { } + } +} + +namespace Wizard.Replay +{ + public class ReplayController { } +} + +namespace Wizard.RoomMatch +{ + public class WatchDataHandler { } + public class RoomConnectController + { + public enum BattleRule { None, Bo1 } + } +} + +namespace Wizard.Story +{ + public class StoryRecoveryData { } +} + +namespace Wizard.UI.Common +{ + public class TabList { } +} + +namespace Wizard.UI.Dialog.ImageSelection +{ + public class ImageSelection { } +}