captainbattle 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/CallID.d.ts +121 -105
- package/dist/core/CallID.js +128 -105
- package/dist/core/ListenID.d.ts +503 -443
- package/dist/core/ListenID.js +513 -443
- package/dist/core/config/AccessoriesDrawCfg.d.ts +9 -0
- package/dist/core/config/AccessoriesDrawCfg.js +8 -0
- package/dist/core/config/BadgeCfg.d.ts +76 -19
- package/dist/core/config/BadgeCfg.js +76 -19
- package/dist/core/config/BountyTaskCfg.d.ts +1 -1
- package/dist/core/config/BuffCfg.d.ts +3 -0
- package/dist/core/config/BuffCfg.js +3 -0
- package/dist/core/config/Cfg.d.ts +224 -120
- package/dist/core/config/Cfg.js +251 -121
- package/dist/core/config/ChatChannelCfg.d.ts +8 -2
- package/dist/core/config/ChatChannelCfg.js +7 -1
- package/dist/core/config/ChatEmojiCfg.d.ts +0 -2
- package/dist/core/config/Const.d.ts +3 -1
- package/dist/core/config/Const.js +2 -0
- package/dist/core/config/DailyTrialMapCfg.d.ts +1 -2
- package/dist/core/config/EmailCfg.d.ts +13 -1
- package/dist/core/config/EmailCfg.js +13 -1
- package/dist/core/config/FirstRechargeCfg.d.ts +1 -0
- package/dist/core/config/FuncDescCfg.d.ts +33 -3
- package/dist/core/config/FuncDescCfg.js +33 -3
- package/dist/core/config/FusionLevelCfg.d.ts +10 -0
- package/dist/core/config/FusionLevelCfg.js +8 -0
- package/dist/core/config/GuildBonusLogCfg.d.ts +8 -0
- package/dist/core/config/GuildBonusLogCfg.js +8 -0
- package/dist/core/config/GuildBossRankRewardCfg.d.ts +2 -1
- package/dist/core/config/GuildConfigCfg.d.ts +1 -1
- package/dist/core/config/GuildConfigCfg.js +1 -1
- package/dist/core/config/GuildDonateCfg.d.ts +4 -2
- package/dist/core/config/GuildIslandBuildCfg.d.ts +16 -0
- package/dist/core/config/GuildIslandBuildCfg.js +8 -0
- package/dist/core/config/GuildIslandBuildItemCfg.d.ts +11 -0
- package/dist/core/config/GuildIslandBuildItemCfg.js +8 -0
- package/dist/core/config/GuildIslandConfigCfg.d.ts +19 -0
- package/dist/core/config/GuildIslandConfigCfg.js +16 -0
- package/dist/core/config/GuildIslandIslandCfg.d.ts +9 -0
- package/dist/core/config/GuildIslandIslandCfg.js +8 -0
- package/dist/core/config/GuildIslandRankCfg.d.ts +11 -0
- package/dist/core/config/GuildIslandRankCfg.js +8 -0
- package/dist/core/config/GuildIslandZoneCfg.d.ts +11 -0
- package/dist/core/config/GuildIslandZoneCfg.js +8 -0
- package/dist/core/config/GuildLogCfg.d.ts +1 -0
- package/dist/core/config/GuildLvCfg.d.ts +1 -1
- package/dist/core/config/InviteConfigCfg.d.ts +14 -0
- package/dist/core/config/InviteConfigCfg.js +11 -0
- package/dist/core/config/InviteRewardCfg.d.ts +9 -0
- package/dist/core/config/InviteRewardCfg.js +8 -0
- package/dist/core/config/ItemsCfg.d.ts +5 -1
- package/dist/core/config/ItemsCfg.js +4 -0
- package/dist/core/config/MarqueeContentCfg.d.ts +7 -0
- package/dist/core/config/MarqueeContentCfg.js +7 -1
- package/dist/core/config/ModAffixLvCfg.d.ts +12 -0
- package/dist/core/config/ModAffixLvCfg.js +8 -0
- package/dist/core/config/PetCfg.d.ts +0 -2
- package/dist/core/config/PetConfigCfg.d.ts +19 -0
- package/dist/core/config/PetConfigCfg.js +16 -0
- package/dist/core/config/PetDrawCfg.d.ts +9 -0
- package/dist/core/config/PetDrawCfg.js +8 -0
- package/dist/core/config/PetSkillCfg.d.ts +2 -1
- package/dist/core/config/PrivilegeCfg.d.ts +2 -0
- package/dist/core/config/PrivilegeCfg.js +2 -0
- package/dist/core/config/ProDefineCfg.d.ts +2 -0
- package/dist/core/config/QualityCfg.d.ts +1 -0
- package/dist/core/config/RelicDungeonConfigCfg.d.ts +14 -4
- package/dist/core/config/RelicDungeonConfigCfg.js +14 -4
- package/dist/core/config/RelicDungeonGrowCfg.d.ts +7 -0
- package/dist/core/config/RelicDungeonGrowCfg.js +8 -0
- package/dist/core/config/RelicDungeonLevelCfg.d.ts +4 -10
- package/dist/core/config/RelicDungeonRankRewardCfg.d.ts +9 -0
- package/dist/core/config/RelicDungeonRankRewardCfg.js +8 -0
- package/dist/core/config/RelicDungeonScoreCfg.d.ts +11 -0
- package/dist/core/config/RelicDungeonScoreCfg.js +8 -0
- package/dist/core/config/RelicDungeonScoreRewardCfg.d.ts +9 -0
- package/dist/core/config/RelicDungeonScoreRewardCfg.js +8 -0
- package/dist/core/config/RelicTiesCfg.d.ts +1 -0
- package/dist/core/config/RobotConfigCfg.d.ts +17 -0
- package/dist/core/config/RobotConfigCfg.js +8 -0
- package/dist/core/config/RoleCfg.d.ts +1 -0
- package/dist/core/config/RuleDescCfg.d.ts +12 -2
- package/dist/core/config/RuleDescCfg.js +12 -2
- package/dist/core/config/SeaArenaConfigCfg.d.ts +22 -0
- package/dist/core/config/SeaArenaConfigCfg.js +19 -0
- package/dist/core/config/SeaArenaRankRewardCfg.d.ts +10 -0
- package/dist/core/config/SeaArenaRankRewardCfg.js +8 -0
- package/dist/core/config/SeaArenaRobotCfg.d.ts +8 -0
- package/dist/core/config/SeaArenaRobotCfg.js +8 -0
- package/dist/core/config/SeaArenaTierCfg.d.ts +13 -0
- package/dist/core/config/SeaArenaTierCfg.js +8 -0
- package/dist/core/config/ShopCfg.d.ts +1 -0
- package/dist/core/config/SkillLvCfg.d.ts +10 -0
- package/dist/core/config/SkillLvCfg.js +8 -0
- package/dist/core/config/SkinSkillCfg.d.ts +2 -1
- package/dist/core/config/SprintActivityConfigCfg.d.ts +18 -3
- package/dist/core/config/SprintActivityConfigCfg.js +18 -3
- package/dist/core/config/StageCfg.d.ts +2 -0
- package/dist/core/config/TConfig.d.ts +1 -1
- package/dist/core/config/TConfig.js +6 -4
- package/dist/core/config/TalentTreeLvCfg.d.ts +1 -1
- package/dist/core/config/TurretFusionLevelCfg.d.ts +10 -0
- package/dist/core/config/TurretFusionLevelCfg.js +8 -0
- package/dist/core/config/TurretModAffixLvCfg.d.ts +12 -0
- package/dist/core/config/TurretModAffixLvCfg.js +8 -0
- package/dist/core/config/TurretModCfg.d.ts +20 -0
- package/dist/core/config/TurretModCfg.js +8 -0
- package/dist/core/config/TurretModConfigCfg.d.ts +20 -0
- package/dist/core/config/TurretModConfigCfg.js +17 -0
- package/dist/core/config/TurretModQualityCfg.d.ts +12 -0
- package/dist/core/config/TurretModQualityCfg.js +8 -0
- package/dist/core/config/TurretSkillLvCfg.d.ts +10 -0
- package/dist/core/config/TurretSkillLvCfg.js +8 -0
- package/dist/core/config/VehicleWashAffixCfg.d.ts +14 -0
- package/dist/core/config/VehicleWashAffixCfg.js +8 -0
- package/dist/core/config/VehicleWashLevelCfg.d.ts +6 -2
- package/dist/core/framework/Pool.d.ts +4 -1
- package/dist/core/framework/Pool.js +19 -21
- package/dist/core/framework/Time.js +13 -3
- package/dist/core/framework/Watcher.js +0 -1
- package/dist/core/framework/collections/MinSortList.d.ts +0 -2
- package/dist/core/framework/collections/MinSortList.js +9 -33
- package/dist/core/framework/collections/ObjectPool.js +6 -3
- package/dist/core/framework/notify/Notifier.d.ts +1 -1
- package/dist/core/framework/notify/Notifier.js +5 -4
- package/dist/core/framework/notify/NotifyID.d.ts +2 -1
- package/dist/core/framework/notify/NotifyID.js +1 -0
- package/dist/core/framework/notify/NotifyListener.js +35 -9
- package/dist/core/module/arena/ArenaBattleModule.d.ts +7 -0
- package/dist/core/module/arena/ArenaBattleModule.js +32 -0
- package/dist/core/module/arena/index.d.ts +1 -0
- package/dist/core/module/arena/index.js +13 -0
- package/dist/core/module/battle/Game.d.ts +104 -13
- package/dist/core/module/battle/Game.js +218 -45
- package/dist/core/module/battle/IGameModule.d.ts +6 -0
- package/dist/core/module/battle/IGameModule.js +19 -6
- package/dist/core/module/battle/battle.interface.d.ts +31 -7
- package/dist/core/module/battle/battle.interface.js +5 -1
- package/dist/core/module/battle/buff/BuffMgr.d.ts +25 -0
- package/dist/core/module/battle/buff/BuffMgr.js +43 -0
- package/dist/core/module/battle/buff/BuffTrigger.js +9 -1
- package/dist/core/module/battle/buff/buffitem/AddPhysicDamBuff.js +2 -2
- package/dist/core/module/battle/buff/buffitem/ChangeSetpAddDamageBuff.js +3 -2
- package/dist/core/module/battle/buff/buffitem/DeltaUseSkillBuff.js +3 -2
- package/dist/core/module/battle/buff/buffitem/DiceAddCritBuff.d.ts +8 -0
- package/dist/core/module/battle/buff/buffitem/DiceAddCritBuff.js +35 -0
- package/dist/core/module/battle/buff/buffitem/FireHurtLayerBuff.d.ts +7 -0
- package/dist/core/module/battle/buff/buffitem/FireHurtLayerBuff.js +28 -0
- package/dist/core/module/battle/buff/buffitem/ForceTargetBuff.js +2 -1
- package/dist/core/module/battle/buff/buffitem/HitBoundAddDamageBuff.js +1 -1
- package/dist/core/module/battle/buff/buffitem/HitBoundAddScaleBuff.d.ts +11 -0
- package/dist/core/module/battle/buff/buffitem/HitBoundAddScaleBuff.js +79 -0
- package/dist/core/module/battle/buff/buffitem/LinkCurseBuff.js +3 -2
- package/dist/core/module/battle/buff/buffitem/MonitorBuff.js +10 -12
- package/dist/core/module/battle/buff/buffitem/PosionBanCureBuff.d.ts +3 -0
- package/dist/core/module/battle/buff/buffitem/PosionBanCureBuff.js +18 -0
- package/dist/core/module/battle/buff/buffitem/PosionBuff.d.ts +1 -0
- package/dist/core/module/battle/buff/buffitem/PosionBuff.js +15 -4
- package/dist/core/module/battle/buff/buffitem/ProjectileOrbLinkBuff.js +1 -1
- package/dist/core/module/battle/buff/buffitem/ProjectileScaleUpBuff.js +4 -2
- package/dist/core/module/battle/buff/buffitem/SameHitAddDamageBuff.js +8 -0
- package/dist/core/module/battle/buff/buffitem/SlayBuff.js +1 -1
- package/dist/core/module/battle/buff/buffitem/TimeAddDamageBuff.d.ts +1 -1
- package/dist/core/module/battle/buff/buffitem/TimeAddDamageBuff.js +36 -27
- package/dist/core/module/battle/buff/buffitem/index.d.ts +4 -0
- package/dist/core/module/battle/buff/buffitem/index.js +5 -1
- package/dist/core/module/battle/entity/BaseEntityData.d.ts +15 -1
- package/dist/core/module/battle/entity/BaseEntityData.js +27 -0
- package/dist/core/module/battle/entity/DragonBodyData.d.ts +19 -1
- package/dist/core/module/battle/entity/DragonBodyData.js +34 -0
- package/dist/core/module/battle/entity/DragonData.d.ts +18 -1
- package/dist/core/module/battle/entity/DragonData.js +32 -0
- package/dist/core/module/battle/entity/EntityPool.d.ts +1 -2
- package/dist/core/module/battle/entity/EntityPool.js +9 -18
- package/dist/core/module/battle/entity/FighterData.d.ts +114 -3
- package/dist/core/module/battle/entity/FighterData.js +350 -6
- package/dist/core/module/battle/entity/ProjectileData.d.ts +2 -0
- package/dist/core/module/battle/entity/ProjectileData.js +25 -0
- package/dist/core/module/battle/entity/RoleData.d.ts +12 -1
- package/dist/core/module/battle/entity/RoleData.js +19 -0
- package/dist/core/module/battle/entity/TurnUnit.d.ts +36 -0
- package/dist/core/module/battle/entity/TurnUnit.js +74 -0
- package/dist/core/module/battle/entity/index.d.ts +1 -1
- package/dist/core/module/battle/entity/index.js +1 -1
- package/dist/core/module/battle/event/EntityEvent.d.ts +13 -0
- package/dist/core/module/battle/event/EntityEvent.js +14 -0
- package/dist/core/module/battle/event/EntityEventBus.d.ts +10 -0
- package/dist/core/module/battle/event/EntityEventBus.js +35 -0
- package/dist/core/module/battle/event/EventListener.d.ts +6 -1
- package/dist/core/module/battle/event/EventListener.js +140 -7
- package/dist/core/module/battle/event/GameEvent.d.ts +8 -0
- package/dist/core/module/battle/event/GameEvent.js +9 -0
- package/dist/core/module/battle/factory/FighterFactory.js +26 -10
- package/dist/core/module/battle/fsm-state/AnyFighterStateTransitions.js +24 -12
- package/dist/core/module/battle/fsm-state/AnyFighterStates.js +9 -5
- package/dist/core/module/battle/fsm-state/Boss18110CallState.d.ts +1 -1
- package/dist/core/module/battle/fsm-state/Boss18110State.d.ts +1 -1
- package/dist/core/module/battle/fsm-state/FighterStateMachine.d.ts +2 -0
- package/dist/core/module/battle/fsm-state/FighterStateMachine.js +6 -0
- package/dist/core/module/battle/fsm-state/FighterStateProfiles.d.ts +8 -1
- package/dist/core/module/battle/fsm-state/FighterStateProfiles.js +31 -0
- package/dist/core/module/battle/fsm-state/FighterStateRegistry.d.ts +3 -0
- package/dist/core/module/battle/fsm-state/FighterStateRegistry.js +27 -8
- package/dist/core/module/battle/fsm-state/FighterStateShared.js +2 -2
- package/dist/core/module/battle/fsm-state/FighterStateType.d.ts +2 -1
- package/dist/core/module/battle/fsm-state/FighterStateType.js +2 -1
- package/dist/core/module/battle/fsm-state/TurnState.d.ts +29 -0
- package/dist/core/module/battle/fsm-state/TurnState.js +208 -0
- package/dist/core/module/battle/fsm-state/TurnTransitions.d.ts +36 -0
- package/dist/core/module/battle/fsm-state/TurnTransitions.js +90 -0
- package/dist/core/module/battle/fsm-state/index.d.ts +2 -0
- package/dist/core/module/battle/fsm-state/index.js +3 -1
- package/dist/core/module/battle/manager/EntityManager.d.ts +1 -0
- package/dist/core/module/battle/manager/EntityManager.js +138 -20
- package/dist/core/module/battle/skill/SkillData.d.ts +27 -0
- package/dist/core/module/battle/skill/SkillData.js +43 -0
- package/dist/core/module/battle/skill/emitter/SkillEmitter.js +4 -1
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter1.d.ts +3 -0
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter1.js +30 -2
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter10.js +2 -2
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter13.d.ts +1 -0
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter13.js +25 -2
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter15.js +1 -1
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter2.js +1 -1
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter23.d.ts +9 -0
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter23.js +75 -11
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter24.js +1 -1
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter26.js +4 -0
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter28.js +1 -1
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter3.d.ts +14 -8
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter3.js +127 -31
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter30.d.ts +36 -0
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter30.js +235 -0
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter31.d.ts +13 -0
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter31.js +47 -0
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter4.d.ts +1 -0
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter4.js +25 -2
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter6.js +10 -6
- package/dist/core/module/battle/skill/emitter/projectiles/ProjectileEmitter8.js +2 -2
- package/dist/core/module/battle/skill/emitter/projectiles/index.d.ts +2 -0
- package/dist/core/module/battle/skill/emitter/projectiles/index.js +3 -1
- package/dist/core/module/battle/skill/impacts/Impact1.js +2 -0
- package/dist/core/module/battle/skill/impacts/Impact10.js +1 -1
- package/dist/core/module/battle/skill/impacts/Impact100.d.ts +13 -0
- package/dist/core/module/battle/skill/impacts/Impact100.js +61 -0
- package/dist/core/module/battle/skill/impacts/Impact101.d.ts +13 -0
- package/dist/core/module/battle/skill/impacts/Impact101.js +49 -0
- package/dist/core/module/battle/skill/impacts/Impact17.d.ts +1 -1
- package/dist/core/module/battle/skill/impacts/Impact18.d.ts +1 -1
- package/dist/core/module/battle/skill/impacts/Impact19.d.ts +13 -0
- package/dist/core/module/battle/skill/impacts/Impact19.js +31 -0
- package/dist/core/module/battle/skill/impacts/Impact2.js +1 -1
- package/dist/core/module/battle/skill/impacts/Impact3.js +6 -5
- package/dist/core/module/battle/skill/impacts/index.d.ts +3 -0
- package/dist/core/module/battle/skill/impacts/index.js +4 -1
- package/dist/core/module/battle/skill/pool/SkillEmitterPool.js +11 -6
- package/dist/core/module/battle/system/BornSystem.js +2 -2
- package/dist/core/module/battle/system/BuffSystem.d.ts +8 -5
- package/dist/core/module/battle/system/BuffSystem.js +47 -22
- package/dist/core/module/battle/system/CollisionSystem.d.ts +4 -0
- package/dist/core/module/battle/system/CollisionSystem.js +31 -22
- package/dist/core/module/battle/system/DestroySystem.d.ts +6 -0
- package/dist/core/module/battle/system/DestroySystem.js +61 -20
- package/dist/core/module/battle/system/InputSystem.d.ts +3 -1
- package/dist/core/module/battle/system/InputSystem.js +15 -4
- package/dist/core/module/battle/system/ProjectileSystem.d.ts +1 -0
- package/dist/core/module/battle/system/ProjectileSystem.js +49 -29
- package/dist/core/module/battle/system/SkillSystem.d.ts +3 -1
- package/dist/core/module/battle/system/SkillSystem.js +55 -25
- package/dist/core/module/battle/system/TurnPhaseSystem.d.ts +52 -0
- package/dist/core/module/battle/system/TurnPhaseSystem.js +189 -0
- package/dist/core/module/battle/system/TurnSchedulerSystem.d.ts +51 -0
- package/dist/core/module/battle/system/TurnSchedulerSystem.js +363 -0
- package/dist/core/module/battle/target/CloseAngleTargetSelection.js +30 -10
- package/dist/core/module/battle/target/CloseDownTargetSelection.js +64 -17
- package/dist/core/module/battle/target/CloseTargetSelection.js +22 -5
- package/dist/core/module/battle/target/RandomRangeTargetSelection.js +8 -8
- package/dist/core/module/battle/target/SelfRandomTargetSelection.js +2 -0
- package/dist/core/module/battle/target/SelfRandomTowerTargetSelection.js +0 -1
- package/dist/core/module/battle/turn/TurnBattleGame.d.ts +85 -0
- package/dist/core/module/battle/turn/TurnBattleGame.js +453 -0
- package/dist/core/module/battle/turn/TurnBattleModule.d.ts +14 -0
- package/dist/core/module/battle/turn/TurnBattleModule.js +65 -0
- package/dist/core/module/battle/turn/TurnBattleTypes.d.ts +25 -0
- package/dist/core/module/battle/turn/TurnBattleTypes.js +15 -0
- package/dist/core/module/battle/util/BattleInputCodec.d.ts +2 -3
- package/dist/core/module/battle/util/BattleInputCodec.js +14 -3
- package/dist/core/module/battle/util/BattleUtils.d.ts +21 -1
- package/dist/core/module/battle/util/BattleUtils.js +217 -41
- package/dist/core/module/battle/util/EllipseArc.d.ts +2 -0
- package/dist/core/module/battle/util/EllipseArc.js +43 -0
- package/dist/core/module/battle/util/HitDataPool.js +3 -1
- package/dist/core/module/battle/util/Random.js +13 -4
- package/dist/core/module/dailyTrial/DailyTrialBattleModule.d.ts +11 -0
- package/dist/core/module/dailyTrial/DailyTrialBattleModule.js +103 -0
- package/dist/core/module/dailyTrial/index.d.ts +1 -0
- package/dist/core/module/dailyTrial/index.js +13 -0
- package/dist/core/module/guild/view/boss/GuildBossBattleModule.d.ts +2 -1
- package/dist/core/module/guild/view/boss/GuildBossBattleModule.js +12 -2
- package/dist/core/module/module.interface.d.ts +1 -0
- package/dist/core/module/property/Property.d.ts +22 -3
- package/dist/core/module/property/Property.js +43 -5
- package/dist/core/module/property/PropertyUtil.d.ts +17 -2
- package/dist/core/module/property/PropertyUtil.js +67 -7
- package/dist/core/module/relicDungeon/RelicBattleModule.d.ts +5 -0
- package/dist/core/module/relicDungeon/RelicBattleModule.js +26 -2
- package/dist/core/module/stage/StageBattleModule.js +1 -0
- package/dist/core/proto/CommonProto.d.ts +24671 -14643
- package/dist/core/proto/Proto.d.ts +289 -77
- package/dist/index.d.ts +39 -3
- package/dist/index.js +215 -11
- package/dist/register-all.d.ts +2 -0
- package/dist/register-all.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BuffCfg_1 = require("../../../config/BuffCfg");
|
|
7
|
+
const Property_1 = require("../../property/Property");
|
|
8
|
+
const battle_interface_1 = require("../battle.interface");
|
|
9
|
+
const TurnUnit_1 = require("../entity/TurnUnit");
|
|
10
|
+
const EntityEvent_1 = require("../event/EntityEvent");
|
|
11
|
+
const GameEvent_1 = require("../event/GameEvent");
|
|
12
|
+
const FighterStateType_1 = require("../fsm-state/FighterStateType");
|
|
13
|
+
const Game_1 = __importDefault(require("../Game"));
|
|
14
|
+
const TurnPhaseSystem_1 = require("../system/TurnPhaseSystem");
|
|
15
|
+
const TurnSchedulerSystem_1 = require("../system/TurnSchedulerSystem");
|
|
16
|
+
const BattleUtils_1 = require("../util/BattleUtils");
|
|
17
|
+
const battle_interface_2 = require("./../battle.interface");
|
|
18
|
+
const TurnBattleTypes_1 = require("./TurnBattleTypes");
|
|
19
|
+
/**
|
|
20
|
+
* 回合制战斗主类。
|
|
21
|
+
* 逻辑与表现共用同一套实时系统:回合调度器只决定“当前哪个单位可以行动”,
|
|
22
|
+
* 移动、攻击、技能、子弹、碰撞、伤害都由原有实时管线逐帧结算,前后端跑同一份模拟。
|
|
23
|
+
*/
|
|
24
|
+
class TurnBattleGame extends Game_1.default {
|
|
25
|
+
/** 维修技能表现时长(秒):回合末触发维修后,等表现播完再进入下一回合 */
|
|
26
|
+
static REPAIR_ACTION_DELAY = 1;
|
|
27
|
+
turnState;
|
|
28
|
+
phaseSystem;
|
|
29
|
+
turnScheduler;
|
|
30
|
+
mainRoleId = 0;
|
|
31
|
+
enemyMainRoleId = 0;
|
|
32
|
+
/** 回合制:当前允许行动的单位 ID;<0 表示非回合制(实时战斗),0 表示无单位可行动 */
|
|
33
|
+
turnActiveFighterId = -1;
|
|
34
|
+
/** 双方主角本回合实际损失的生命值,由 ArenaBattleModule.onHurt 统计,回合末维修结算后清零 */
|
|
35
|
+
myMainHurtHp = 0;
|
|
36
|
+
enemyMainHurtHp = 0;
|
|
37
|
+
getTurnHurtHp(campType) {
|
|
38
|
+
return campType === battle_interface_2.CampType.MY ? this.myMainHurtHp : this.enemyMainHurtHp;
|
|
39
|
+
}
|
|
40
|
+
/** 回合末等待延迟(秒):大于 0 时停在 ROUND_END,不进入下一回合 */
|
|
41
|
+
_roundEndDelay = 0;
|
|
42
|
+
config;
|
|
43
|
+
constructor(options) {
|
|
44
|
+
super(options);
|
|
45
|
+
this.config = { ...TurnBattleTypes_1.DEFAULT_TURN_BATTLE_CONFIG, ...(options.turnConfig || {}) };
|
|
46
|
+
this.turnState = {
|
|
47
|
+
round: 0,
|
|
48
|
+
phase: TurnBattleTypes_1.TurnPhase.NONE,
|
|
49
|
+
finished: false,
|
|
50
|
+
winner: 0,
|
|
51
|
+
currentActorId: 0,
|
|
52
|
+
};
|
|
53
|
+
this.initTurnSystems(options);
|
|
54
|
+
}
|
|
55
|
+
initTurnSystems(options) {
|
|
56
|
+
this.phaseSystem = new TurnPhaseSystem_1.TurnPhaseSystem(this);
|
|
57
|
+
this.turnScheduler = new TurnSchedulerSystem_1.TurnSchedulerSystem(this);
|
|
58
|
+
this.turnScheduler.init(options);
|
|
59
|
+
const bornSystemIndex = this._systems.indexOf(this.bornSystem);
|
|
60
|
+
this._systems.splice(bornSystemIndex, 1);
|
|
61
|
+
// 调度器必须在 FsmSystem 之后逐帧推进,追加到系统列表末尾
|
|
62
|
+
this._systems.push(this.turnScheduler);
|
|
63
|
+
this.turnActiveFighterId = 0;
|
|
64
|
+
}
|
|
65
|
+
/** 回合制开战入口:只做初始化,之后由 fixUpdate 逐帧推进(前端)/ runToEnd(后端) */
|
|
66
|
+
initPVPFight(challenger, defender) {
|
|
67
|
+
this.myMainHurtHp = 0;
|
|
68
|
+
this.enemyMainHurtHp = 0;
|
|
69
|
+
this._roundEndDelay = 0;
|
|
70
|
+
this.turnActiveFighterId = 0;
|
|
71
|
+
this.gameModule.moduleState.autoFight = true;
|
|
72
|
+
this.gameModule.moduleState.timeScale = 1;
|
|
73
|
+
const allyFighters = this.handleFighter(challenger, true);
|
|
74
|
+
const enemyFighters = this.handleFighter(defender, false);
|
|
75
|
+
this.gameContext.myFighterNum = 1;
|
|
76
|
+
this.gameContext.enemyFighterNum = 1;
|
|
77
|
+
this.mainRoleId = this.pickMainRole(allyFighters);
|
|
78
|
+
this.enemyMainRoleId = this.pickMainRole(enemyFighters);
|
|
79
|
+
const units = [];
|
|
80
|
+
for (let i = 0; i < allyFighters.length; i++) {
|
|
81
|
+
units.push(new TurnUnit_1.TurnUnit(allyFighters[i]));
|
|
82
|
+
}
|
|
83
|
+
for (let i = 0; i < enemyFighters.length; i++) {
|
|
84
|
+
units.push(new TurnUnit_1.TurnUnit(enemyFighters[i]));
|
|
85
|
+
}
|
|
86
|
+
for (let i = 0; i < this.gameContext.fighters.length; i++) {
|
|
87
|
+
const fighter = this.gameContext.fighters[i];
|
|
88
|
+
fighter.startFight();
|
|
89
|
+
this.applyActiveSkill(fighter);
|
|
90
|
+
fighter.horDir = fighter.campType === battle_interface_2.CampType.MY ? -1 : 1;
|
|
91
|
+
}
|
|
92
|
+
this.phaseSystem.setup(units);
|
|
93
|
+
this.gameState = 1 /* GameState.START */;
|
|
94
|
+
this.gameModule.gameStart();
|
|
95
|
+
this.isReady = false;
|
|
96
|
+
}
|
|
97
|
+
//战斗更新
|
|
98
|
+
fixUpdate(dt) {
|
|
99
|
+
if (this.isReady) {
|
|
100
|
+
if (this.gameState == 2 /* GameState.PAUSE */)
|
|
101
|
+
return;
|
|
102
|
+
dt *= this.gameModule.moduleState.timeScale;
|
|
103
|
+
this._tickLogic(dt);
|
|
104
|
+
}
|
|
105
|
+
this.renderModule && this.renderModule.onUpdate(dt);
|
|
106
|
+
}
|
|
107
|
+
setReady() {
|
|
108
|
+
this.isReady = true;
|
|
109
|
+
this.phaseSystem.startBattle();
|
|
110
|
+
}
|
|
111
|
+
getCurrentPhase() {
|
|
112
|
+
return this.phaseSystem.phase;
|
|
113
|
+
}
|
|
114
|
+
getRound() {
|
|
115
|
+
return this.phaseSystem.round;
|
|
116
|
+
}
|
|
117
|
+
/** 将 hp 已归零但还没进入死亡状态的单位补一次死亡状态,交给死亡动画结束后统一结算 */
|
|
118
|
+
collectDeaths() {
|
|
119
|
+
const fighters = this.gameContext.fighters;
|
|
120
|
+
for (let i = 0; i < fighters.length; i++) {
|
|
121
|
+
const fighter = fighters[i];
|
|
122
|
+
if (!fighter.isDead && fighter.curHp <= 0) {
|
|
123
|
+
this.emit(GameEvent_1.GameEvent.FsmChangeState, fighter, FighterStateType_1.StateType.DEAD);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** 死亡动画结束后由 DeadState 调用;只做回合制侧的身份移除与胜负判定 */
|
|
128
|
+
notifyFighterDead(fighter) {
|
|
129
|
+
if (fighter.curState !== FighterStateType_1.StateType.DEAD) {
|
|
130
|
+
this.emit(GameEvent_1.GameEvent.FsmChangeState, fighter, FighterStateType_1.StateType.DEAD);
|
|
131
|
+
}
|
|
132
|
+
fighter.endFight();
|
|
133
|
+
if (fighter.campType === battle_interface_2.CampType.MY) {
|
|
134
|
+
if (fighter.subType === battle_interface_1.SubEntityType.ROLE) {
|
|
135
|
+
this.gameContext.myFighterNum--;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
if (fighter.subType === battle_interface_1.SubEntityType.ROLE) {
|
|
140
|
+
this.gameContext.enemyFighterNum--;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
this.gameModule.notifyFighterDead(fighter);
|
|
144
|
+
this.phaseSystem.removeUnit(fighter.ID);
|
|
145
|
+
// 和实时一致:我方主角保留实体给结算界面,其余死亡单位交给销毁系统回收
|
|
146
|
+
if (!(fighter.subType === battle_interface_1.SubEntityType.ROLE && fighter.campType === battle_interface_2.CampType.MY)) {
|
|
147
|
+
this.pushToDestroyList(fighter);
|
|
148
|
+
}
|
|
149
|
+
this.checkFinish();
|
|
150
|
+
}
|
|
151
|
+
/** 回合末:buff/时间由实时系统自行推进,这里只处理死亡兜底、回合上限与下一回合 */
|
|
152
|
+
endRound() {
|
|
153
|
+
if (this.isOver())
|
|
154
|
+
return;
|
|
155
|
+
for (let i = 0; i < this.gameContext.fighters.length; i++) {
|
|
156
|
+
const fighter = this.gameContext.fighters[i];
|
|
157
|
+
if (!fighter.isDead) {
|
|
158
|
+
this.emit(fighter, EntityEvent_1.EntityEvent.TurnEnd, this.phaseSystem.round);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// 维修先于 buff 结算,避免回复量被本回合的 buff 或 CD 推进影响
|
|
162
|
+
this.processRepair();
|
|
163
|
+
this.emit(GameEvent_1.GameEvent.StepBuff, 1);
|
|
164
|
+
if (this.phaseSystem.round >= this.config.maxRounds) {
|
|
165
|
+
//超过回合上限
|
|
166
|
+
this.finishTurnBattle(battle_interface_2.CampType.ENEMY);
|
|
167
|
+
this.endFight();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
this.addRoundEndDelay(1); //强制等待时间
|
|
171
|
+
// 回合末表现(维修等)未播完时停在 ROUND_END,由 tickRoundEndDelay 推进到下一回合
|
|
172
|
+
// if (this._roundEndDelay > 0) return;
|
|
173
|
+
// this.enterNextRound();
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* 追加回合末等待时间(秒)。维修等需要表现播完后,由回合末逻辑调用。
|
|
177
|
+
* 多段逻辑可以累加,统一在 tickRoundEndDelay 中倒计时。
|
|
178
|
+
*/
|
|
179
|
+
addRoundEndDelay(delay) {
|
|
180
|
+
if (delay > 0)
|
|
181
|
+
this._roundEndDelay += delay;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* 调度器每帧推进回合末延迟。
|
|
185
|
+
* 返回 true 表示仍在等待,本帧不要开始任何行动;返回 false 表示已可继续(必要时已进入下一回合)。
|
|
186
|
+
*/
|
|
187
|
+
tickRoundEndDelay(dt) {
|
|
188
|
+
if (this.phaseSystem.phase !== TurnBattleTypes_1.TurnPhase.ROUND_END)
|
|
189
|
+
return false;
|
|
190
|
+
if (this._roundEndDelay > dt) {
|
|
191
|
+
this._roundEndDelay -= dt;
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
this._roundEndDelay = 0;
|
|
195
|
+
this.enterNextRound();
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
enterNextRound() {
|
|
199
|
+
this.phaseSystem.beginNextRound();
|
|
200
|
+
this.syncState();
|
|
201
|
+
}
|
|
202
|
+
setGameWin(lastDeadFight) {
|
|
203
|
+
this.finishTurnBattle(battle_interface_2.CampType.MY);
|
|
204
|
+
super.setGameWin(lastDeadFight);
|
|
205
|
+
}
|
|
206
|
+
setGameFail(isCross = false) {
|
|
207
|
+
this.finishTurnBattle(battle_interface_2.CampType.ENEMY);
|
|
208
|
+
super.setGameFail(isCross);
|
|
209
|
+
}
|
|
210
|
+
/** 回合制全自动,不复用实时输入 */
|
|
211
|
+
applyInput(input) {
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* 回合制受击回调:受击方配置了反击技能且当前没有在行动时,插入一次反击行动。
|
|
215
|
+
* 插入行动期间不会再次插入,避免反击互相触发形成死循环。
|
|
216
|
+
*/
|
|
217
|
+
tryCounterAttack(attacker, defender) {
|
|
218
|
+
if (!this.turnScheduler || this.turnState.finished)
|
|
219
|
+
return;
|
|
220
|
+
if (!attacker || !defender || attacker === defender)
|
|
221
|
+
return;
|
|
222
|
+
if (attacker.isDead || defender.isDead || defender.curHp <= 0)
|
|
223
|
+
return;
|
|
224
|
+
if (attacker.campType === defender.campType)
|
|
225
|
+
return;
|
|
226
|
+
// 只有当前正常行动单位的攻击才触发反击,避免游离伤害挂到其他单位的行动上
|
|
227
|
+
if (attacker.ID !== this.turnActiveFighterId)
|
|
228
|
+
return;
|
|
229
|
+
const counterSkillId = defender.counterSkillId;
|
|
230
|
+
if (!counterSkillId)
|
|
231
|
+
return;
|
|
232
|
+
if (!this.isTriggerCounter(attacker, defender))
|
|
233
|
+
return;
|
|
234
|
+
this.turnScheduler.requestInterrupt(defender, counterSkillId, attacker.ID);
|
|
235
|
+
}
|
|
236
|
+
tryDizzinessAttack(attacker, defender) {
|
|
237
|
+
if (attacker.campType === defender.campType)
|
|
238
|
+
return;
|
|
239
|
+
if (attacker.ID !== this.turnActiveFighterId)
|
|
240
|
+
return;
|
|
241
|
+
if (!this.isTriggerStun(attacker, defender))
|
|
242
|
+
return;
|
|
243
|
+
this.emit(GameEvent_1.GameEvent.UseSkill, attacker, 10020021, { hitId: defender.ID });
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* 回合末维修:只处理双方主角。
|
|
247
|
+
*/
|
|
248
|
+
processRepair() {
|
|
249
|
+
const myRepaired = this.repairMainRole(this.mainRoleId, this.enemyMainRoleId, this.myMainHurtHp);
|
|
250
|
+
const enemyRepaired = this.repairMainRole(this.enemyMainRoleId, this.mainRoleId, this.enemyMainHurtHp);
|
|
251
|
+
// 每个回合独立结算,未触发的伤害不累计到下一回合
|
|
252
|
+
this.myMainHurtHp = 0;
|
|
253
|
+
this.enemyMainHurtHp = 0;
|
|
254
|
+
// 双方维修同时播放,只等待一次表现时长
|
|
255
|
+
if (myRepaired || enemyRepaired) {
|
|
256
|
+
this.addRoundEndDelay(TurnBattleGame.REPAIR_ACTION_DELAY);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/** @returns 是否触发了维修 */
|
|
260
|
+
repairMainRole(selfId, opponentId, hurtHp) {
|
|
261
|
+
if (!selfId || !opponentId || hurtHp <= 0)
|
|
262
|
+
return false;
|
|
263
|
+
const self = this.getEntityLogic(selfId);
|
|
264
|
+
const opponent = this.getEntityLogic(opponentId);
|
|
265
|
+
if (!self || self.isDead || self.curHp <= 0 || !opponent)
|
|
266
|
+
return false;
|
|
267
|
+
// 眩晕禁止维修
|
|
268
|
+
if (self.hasBuffByType(BuffCfg_1.BuffDefine.Dizziness))
|
|
269
|
+
return false;
|
|
270
|
+
if (!this.isTriggerRepair(self, opponent))
|
|
271
|
+
return false;
|
|
272
|
+
this.emit(GameEvent_1.GameEvent.UseSkill, self, 10020022);
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
destroy() {
|
|
276
|
+
this.turnActiveFighterId = 0;
|
|
277
|
+
this.myMainHurtHp = 0;
|
|
278
|
+
this.enemyMainHurtHp = 0;
|
|
279
|
+
this._roundEndDelay = 0;
|
|
280
|
+
if (this.phaseSystem)
|
|
281
|
+
this.phaseSystem.clear();
|
|
282
|
+
super.destroy();
|
|
283
|
+
}
|
|
284
|
+
syncState() {
|
|
285
|
+
this.turnState.round = this.phaseSystem.round;
|
|
286
|
+
this.turnState.phase = this.phaseSystem.phase;
|
|
287
|
+
}
|
|
288
|
+
handleFighter(datas, isChallenge) {
|
|
289
|
+
const fighters = [];
|
|
290
|
+
for (let i = 0; i < datas.length; i++) {
|
|
291
|
+
const data = datas[i];
|
|
292
|
+
const fighter = this.loadFighter(data, isChallenge);
|
|
293
|
+
fighters.push(fighter);
|
|
294
|
+
const bronList = this.bornRoleFightInfo[data.playerId];
|
|
295
|
+
if (!bronList) {
|
|
296
|
+
this.bornRoleFightInfo[data.playerId] = [data];
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
bronList.push(data);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return fighters;
|
|
303
|
+
}
|
|
304
|
+
checkFinish() {
|
|
305
|
+
if (this.gameContext.enemyFighterNum <= 0) {
|
|
306
|
+
this.setGameWin();
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (this.gameContext.myFighterNum <= 0) {
|
|
310
|
+
this.setGameFail();
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
pickMainRole(fighters) {
|
|
315
|
+
for (let i = 0; i < fighters.length; i++) {
|
|
316
|
+
if (fighters[i].subType === battle_interface_1.SubEntityType.ROLE) {
|
|
317
|
+
return fighters[i].ID;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return 0;
|
|
321
|
+
}
|
|
322
|
+
finishTurnBattle(winner) {
|
|
323
|
+
if (this.turnState.finished)
|
|
324
|
+
return;
|
|
325
|
+
this.turnState.finished = true;
|
|
326
|
+
this.turnState.winner = winner;
|
|
327
|
+
this.turnState.phase = TurnBattleTypes_1.TurnPhase.FINISHED;
|
|
328
|
+
this.phaseSystem.finish();
|
|
329
|
+
}
|
|
330
|
+
calNormalHurt(hurtData, attacker, defender) {
|
|
331
|
+
if (hurtData.event.isImmune) {
|
|
332
|
+
return 0;
|
|
333
|
+
}
|
|
334
|
+
let atkpro = hurtData.adapterAtkPro ?? attacker.property;
|
|
335
|
+
let defpro = defender.property;
|
|
336
|
+
//有效攻击 = 主线基础攻击 × (1 + 局外pvp攻击加成% + 局内pvp攻击加成%)
|
|
337
|
+
let a1 = Property_1.PropertyHelper.atk(atkpro);
|
|
338
|
+
a1 = a1 * (1 + atkpro[51200]);
|
|
339
|
+
//伤害加成
|
|
340
|
+
let a2 = atkpro[51400];
|
|
341
|
+
//target伤害减免=max(10%, 1 -(target局外pvp减伤% + target局内pvp减伤%))
|
|
342
|
+
let a4 = 1 - defpro[51500] / Property_1.PROPERTY_SCALE;
|
|
343
|
+
a4 = Math.max(0.1, a4);
|
|
344
|
+
let projectileHurtRatio = 0;
|
|
345
|
+
let projectileBaseHurtRatio = 0;
|
|
346
|
+
// 技能伤害 计算额外子弹增加的伤害
|
|
347
|
+
if (hurtData.projectileID) {
|
|
348
|
+
const projectile = this.getEntityLogic(hurtData.projectileID, battle_interface_1.EntityType.PROJECTILE);
|
|
349
|
+
projectileHurtRatio = projectile.extraHurtRatio || 0;
|
|
350
|
+
projectileBaseHurtRatio = projectile.extraBaseHurtRatio || 0;
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
projectileBaseHurtRatio = hurtData.extraHurtRatio || 0;
|
|
354
|
+
}
|
|
355
|
+
//最终技能伤害= 技能基础伤害% × (1 + 对应标签的技能基础倍率放大%) × (1 + ∑局内对应技能基础伤害加成%+(反击技能的增伤||宠物技能的增伤)) *(1+子弹额外系数)
|
|
356
|
+
let countDamage = 0;
|
|
357
|
+
let petDamage = 0;
|
|
358
|
+
if (hurtData.skillData.skillId === attacker.counterSkillId) {
|
|
359
|
+
countDamage = atkpro[51100] - defpro[51110];
|
|
360
|
+
}
|
|
361
|
+
if (attacker.subType === battle_interface_1.SubEntityType.PET) {
|
|
362
|
+
petDamage = atkpro[50900] - defpro[50910];
|
|
363
|
+
}
|
|
364
|
+
let minvalue = this.proMinMap.get(10460);
|
|
365
|
+
let basehurt = Math.max(minvalue, atkpro[10460]);
|
|
366
|
+
let a5 = (hurtData.attackRatio)
|
|
367
|
+
* (1 + atkpro[24000] / Property_1.PROPERTY_SCALE)
|
|
368
|
+
* (1 + (basehurt + (atkpro[hurtData.skillData.skillId] || 0) + (projectileHurtRatio || 0) + countDamage + petDamage) / Property_1.PROPERTY_SCALE)
|
|
369
|
+
* (Math.max(0, 1 + (projectileBaseHurtRatio / Property_1.PROPERTY_SCALE)));
|
|
370
|
+
//基础伤害
|
|
371
|
+
let a6 = Math.ceil(a1 * (a5 / Property_1.PROPERTY_SCALE) * (1 + a2 / Property_1.PROPERTY_SCALE) * a4);
|
|
372
|
+
//暴击率实际暴击率 = clamp(最终暴击率 - target暴击抵抗, 0 , 100%)
|
|
373
|
+
if (!hurtData.event.isIgnoreCrit) {
|
|
374
|
+
if (hurtData.event.isCrit || this.isTriggerCrit(attacker, defender)) {
|
|
375
|
+
hurtData.event.isCrit = true;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
hurtData.event.isCrit = false;
|
|
380
|
+
}
|
|
381
|
+
//主伤害
|
|
382
|
+
let a8 = a6;
|
|
383
|
+
if (hurtData.event.isCrit) {
|
|
384
|
+
let a7 = Math.max(10000, (atkpro[51020] + atkpro[51000]) - defpro[51010]);
|
|
385
|
+
a8 = a6 * (a7 / Property_1.PROPERTY_SCALE);
|
|
386
|
+
}
|
|
387
|
+
//最终伤害 = max(1 , (主伤害 × (1 + pvp最终伤害%) × (1 - min(90% , target pvp最终减伤%) )
|
|
388
|
+
let finalDamage = Math.max(1, Math.ceil(a8 * (1 + atkpro[51600] / Property_1.PROPERTY_SCALE) * (1 - Math.min(0.9, defpro[51700] / Property_1.PROPERTY_SCALE))));
|
|
389
|
+
if (defender.campType === battle_interface_2.CampType.ENEMY && defpro[24480]) {
|
|
390
|
+
const maxDamage = Math.ceil(defpro[24480] * Property_1.PropertyHelper.hp(defpro) / Property_1.PROPERTY_SCALE);
|
|
391
|
+
if (maxDamage < finalDamage)
|
|
392
|
+
finalDamage = maxDamage;
|
|
393
|
+
}
|
|
394
|
+
//计算伤害时连击次数
|
|
395
|
+
if (attacker.comboSkillId && hurtData.skillData.isNormalAttack && attacker.doubleShootNum > 0) {
|
|
396
|
+
this.calComboCount(attacker, defender);
|
|
397
|
+
}
|
|
398
|
+
return finalDamage;
|
|
399
|
+
}
|
|
400
|
+
calComboCount(attacker, defender) {
|
|
401
|
+
let comboRatio = Property_1.PropertyHelper.turnComboRatio(attacker.property) - defender.property[50110];
|
|
402
|
+
attacker.curDoubleShootNum = 0;
|
|
403
|
+
for (let i = 0; i < attacker.doubleShootNum; i++) {
|
|
404
|
+
if (comboRatio <= 0) {
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
const isHit = this.IsHitOrNot(comboRatio, 10000);
|
|
408
|
+
if (isHit) {
|
|
409
|
+
attacker.curDoubleShootNum++;
|
|
410
|
+
comboRatio /= 2;
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
//触发破甲
|
|
418
|
+
isTriggerCrit(attacker, defender) {
|
|
419
|
+
const a = Property_1.PropertyHelper.turnCritRatio(attacker.property);
|
|
420
|
+
const b = defender.property[50510];
|
|
421
|
+
let ratio = BattleUtils_1.BattleUtils.clampf(a - b, 0, 10000);
|
|
422
|
+
return this.IsHitOrNot(ratio, 10000);
|
|
423
|
+
}
|
|
424
|
+
//是否触发闪避
|
|
425
|
+
isTriggerMiss(attacker, defender) {
|
|
426
|
+
const a = Property_1.PropertyHelper.turnMissRatio(defender.property);
|
|
427
|
+
const b = attacker.property[50410];
|
|
428
|
+
let ratio = BattleUtils_1.BattleUtils.clampf(a - b, 0, this.proMaxMap.get(50400));
|
|
429
|
+
return this.IsHitOrNot(ratio, 10000);
|
|
430
|
+
}
|
|
431
|
+
//是否触发击晕
|
|
432
|
+
isTriggerStun(attacker, defender) {
|
|
433
|
+
const a = Property_1.PropertyHelper.turnStunRatio(attacker.property);
|
|
434
|
+
const b = defender.property[50310];
|
|
435
|
+
let ratio = BattleUtils_1.BattleUtils.clampf(a - b, 0, this.proMaxMap.get(50300));
|
|
436
|
+
return this.IsHitOrNot(ratio, 10000);
|
|
437
|
+
}
|
|
438
|
+
//是否触发反击
|
|
439
|
+
isTriggerCounter(attacker, defender) {
|
|
440
|
+
const a = Property_1.PropertyHelper.turnCounterRatio(attacker.property);
|
|
441
|
+
const b = defender.property[50210];
|
|
442
|
+
let ratio = BattleUtils_1.BattleUtils.clampf(a - b, 0, this.proMaxMap.get(50200));
|
|
443
|
+
return this.IsHitOrNot(ratio, 10000);
|
|
444
|
+
}
|
|
445
|
+
//是否触发维修
|
|
446
|
+
isTriggerRepair(attacker, defender) {
|
|
447
|
+
const a = Property_1.PropertyHelper.turnShieldHeal(attacker.property);
|
|
448
|
+
const b = defender.property[50610];
|
|
449
|
+
let ratio = BattleUtils_1.BattleUtils.clampf(a - b, 0, this.proMaxMap.get(50600));
|
|
450
|
+
return this.IsHitOrNot(ratio, 10000);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
exports.default = TurnBattleGame;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IFighterInfo } from "../battle.interface";
|
|
2
|
+
import type FighterData from "../entity/FighterData";
|
|
3
|
+
import { GameModule } from "../IGameModule";
|
|
4
|
+
export default class TurnBattleModule extends GameModule {
|
|
5
|
+
enemyPosIndexs: number[][];
|
|
6
|
+
init(): void;
|
|
7
|
+
setFighterPosition(fighter: FighterData, data: IFighterInfo): void;
|
|
8
|
+
getClosestTarget(fighter: FighterData, isDiffCamp?: boolean, num?: number): FighterData;
|
|
9
|
+
getMode(): number;
|
|
10
|
+
/** 统计双方主角本回合实际损失的生命值,供回合末维修结算 */
|
|
11
|
+
onHurt(attackId: number, hurt: number, defender: FighterData): void;
|
|
12
|
+
gameWin(lastDeadFight?: FighterData): void;
|
|
13
|
+
gameFail(isCross?: boolean): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const battle_interface_1 = require("../battle.interface");
|
|
4
|
+
const IGameModule_1 = require("../IGameModule");
|
|
5
|
+
class TurnBattleModule extends IGameModule_1.GameModule {
|
|
6
|
+
enemyPosIndexs = [[200, 0], [250, -200], [150, -200]];
|
|
7
|
+
init() {
|
|
8
|
+
this.game.rolePosType = 1;
|
|
9
|
+
this.moduleState.isTurn = true;
|
|
10
|
+
this.moduleState.isPvp = true;
|
|
11
|
+
this.moduleState.noPopSelectSkill = true;
|
|
12
|
+
this.moduleState.autoFight = true;
|
|
13
|
+
this.myPosIndexs = [[-200, 0], [-250, -200], [-150, -200]];
|
|
14
|
+
}
|
|
15
|
+
setFighterPosition(fighter, data) {
|
|
16
|
+
if (fighter.subType === battle_interface_1.SubEntityType.ROLE || fighter.subType === battle_interface_1.SubEntityType.PET) {
|
|
17
|
+
const posIndexs = fighter.campType === battle_interface_1.CampType.MY ? this.myPosIndexs : this.enemyPosIndexs;
|
|
18
|
+
let list = fighter.game.gameContext.curBornRole[data.playerId];
|
|
19
|
+
let posIndex = list.length - 1;
|
|
20
|
+
if (fighter.subType === battle_interface_1.SubEntityType.PET) {
|
|
21
|
+
posIndex = 0;
|
|
22
|
+
const petlist = fighter.game.gameContext.curBornPet[data.playerId];
|
|
23
|
+
posIndex = list.length + petlist.length - 1;
|
|
24
|
+
}
|
|
25
|
+
let pos = posIndexs[posIndex];
|
|
26
|
+
fighter.posIndex = posIndex;
|
|
27
|
+
fighter.moveStartX = pos[0];
|
|
28
|
+
fighter.moveStartY = pos[1];
|
|
29
|
+
fighter.setPosition(pos[0], pos[1]);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
getClosestTarget(fighter, isDiffCamp = true, num) {
|
|
33
|
+
// 清空数组
|
|
34
|
+
const gameContext = this.game.gameContext;
|
|
35
|
+
for (let i = 0; i < gameContext.fighters.length; i++) {
|
|
36
|
+
let value = gameContext.fighters[i];
|
|
37
|
+
if (isDiffCamp && fighter.campType === value.campType)
|
|
38
|
+
continue;
|
|
39
|
+
if (!value.isDead && value.subType === battle_interface_1.SubEntityType.ROLE) {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
getMode() {
|
|
45
|
+
return 5;
|
|
46
|
+
}
|
|
47
|
+
/** 统计双方主角本回合实际损失的生命值,供回合末维修结算 */
|
|
48
|
+
onHurt(attackId, hurt, defender) {
|
|
49
|
+
super.onHurt(attackId, hurt, defender);
|
|
50
|
+
if (hurt <= 0 || !defender || defender.isDead || defender.curHp <= 0)
|
|
51
|
+
return;
|
|
52
|
+
const game = this.game;
|
|
53
|
+
if (defender.ID === game.mainRoleId) {
|
|
54
|
+
game.myMainHurtHp += hurt;
|
|
55
|
+
}
|
|
56
|
+
else if (defender.ID === game.enemyMainRoleId) {
|
|
57
|
+
game.enemyMainHurtHp += hurt;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
gameWin(lastDeadFight) {
|
|
61
|
+
}
|
|
62
|
+
gameFail(isCross) {
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.default = TurnBattleModule;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CampType } from "../battle.interface";
|
|
2
|
+
import type { GameOptions } from "../Game";
|
|
3
|
+
/** 阵营回合阶段 */
|
|
4
|
+
export declare enum TurnPhase {
|
|
5
|
+
NONE = 0,
|
|
6
|
+
MY = 1,
|
|
7
|
+
ENEMY = 2,
|
|
8
|
+
ROUND_END = 3,
|
|
9
|
+
FINISHED = 4
|
|
10
|
+
}
|
|
11
|
+
export interface TurnBattleState {
|
|
12
|
+
round: number;
|
|
13
|
+
phase: TurnPhase;
|
|
14
|
+
finished: boolean;
|
|
15
|
+
winner: CampType | 0;
|
|
16
|
+
currentActorId: number;
|
|
17
|
+
}
|
|
18
|
+
export interface TurnBattleConfig {
|
|
19
|
+
/** 最大回合数,超过按平局处理 */
|
|
20
|
+
maxRounds: number;
|
|
21
|
+
}
|
|
22
|
+
export interface TurnBattleOptions extends GameOptions {
|
|
23
|
+
turnConfig?: Partial<TurnBattleConfig>;
|
|
24
|
+
}
|
|
25
|
+
export declare const DEFAULT_TURN_BATTLE_CONFIG: TurnBattleConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_TURN_BATTLE_CONFIG = exports.TurnPhase = void 0;
|
|
4
|
+
/** 阵营回合阶段 */
|
|
5
|
+
var TurnPhase;
|
|
6
|
+
(function (TurnPhase) {
|
|
7
|
+
TurnPhase[TurnPhase["NONE"] = 0] = "NONE";
|
|
8
|
+
TurnPhase[TurnPhase["MY"] = 1] = "MY";
|
|
9
|
+
TurnPhase[TurnPhase["ENEMY"] = 2] = "ENEMY";
|
|
10
|
+
TurnPhase[TurnPhase["ROUND_END"] = 3] = "ROUND_END";
|
|
11
|
+
TurnPhase[TurnPhase["FINISHED"] = 4] = "FINISHED";
|
|
12
|
+
})(TurnPhase || (exports.TurnPhase = TurnPhase = {}));
|
|
13
|
+
exports.DEFAULT_TURN_BATTLE_CONFIG = {
|
|
14
|
+
maxRounds: 25,
|
|
15
|
+
};
|
|
@@ -7,13 +7,13 @@ import { GameInput, IBattleFrameData } from "../battle.interface";
|
|
|
7
7
|
* 两者是同一份数据的不同表达,本文件负责两个方向的互转。
|
|
8
8
|
*
|
|
9
9
|
* ── params 位序约定(服务端需与此一致)──
|
|
10
|
-
*
|
|
10
|
+
* 除 UseSkill 外 params[0] 固定为 playerId,其余按客户端接口的字段顺序排列:
|
|
11
11
|
* AdjustAtkDir(1): [playerId, x, y, isDir, isTouching]
|
|
12
12
|
* LearnSkills(2): [playerId, ...skills] // 变长,尾段即技能列表,空列表则只有 playerId
|
|
13
13
|
* AddPartner(3): [playerId, roleId]
|
|
14
14
|
* TimePast(4): [playerId, dt] // dt 按 INPUT_TIME_SCALE 放大后传输
|
|
15
15
|
* Relive(5): [playerId]
|
|
16
|
-
*
|
|
16
|
+
* UseSkill(6): [ownerId, skillId] // ownerId 为实体唯一id
|
|
17
17
|
*
|
|
18
18
|
* ── 数值约定 ──
|
|
19
19
|
* proto 里 params 是 repeated int32(见 CommonProto.js 中 GameInput.encode 的 `w.int32(m.params[i])`),
|
|
@@ -22,7 +22,6 @@ import { GameInput, IBattleFrameData } from "../battle.interface";
|
|
|
22
22
|
* Game.adjustAtkDir 里再 /10000 还原,故此处原样透传,不重复缩放。
|
|
23
23
|
* - TimePast 的 dt:是秒的浮点数(Game.stableTime = 0.0166),直接取整会变成 0,
|
|
24
24
|
* 所以按 INPUT_TIME_SCALE 放大传输,解码时再除回来。
|
|
25
|
-
* - BoundSet 的 boundWidth/boundHeight 是格数 × cellSize(37) 的整数世界坐标,本身即整数。
|
|
26
25
|
*/
|
|
27
26
|
export declare const INPUT_TIME_SCALE = 10000;
|
|
28
27
|
export default class BattleInputCodec {
|
|
@@ -10,13 +10,13 @@ const battle_interface_1 = require("../battle.interface");
|
|
|
10
10
|
* 两者是同一份数据的不同表达,本文件负责两个方向的互转。
|
|
11
11
|
*
|
|
12
12
|
* ── params 位序约定(服务端需与此一致)──
|
|
13
|
-
*
|
|
13
|
+
* 除 UseSkill 外 params[0] 固定为 playerId,其余按客户端接口的字段顺序排列:
|
|
14
14
|
* AdjustAtkDir(1): [playerId, x, y, isDir, isTouching]
|
|
15
15
|
* LearnSkills(2): [playerId, ...skills] // 变长,尾段即技能列表,空列表则只有 playerId
|
|
16
16
|
* AddPartner(3): [playerId, roleId]
|
|
17
17
|
* TimePast(4): [playerId, dt] // dt 按 INPUT_TIME_SCALE 放大后传输
|
|
18
18
|
* Relive(5): [playerId]
|
|
19
|
-
*
|
|
19
|
+
* UseSkill(6): [ownerId, skillId] // ownerId 为实体唯一id
|
|
20
20
|
*
|
|
21
21
|
* ── 数值约定 ──
|
|
22
22
|
* proto 里 params 是 repeated int32(见 CommonProto.js 中 GameInput.encode 的 `w.int32(m.params[i])`),
|
|
@@ -25,7 +25,6 @@ const battle_interface_1 = require("../battle.interface");
|
|
|
25
25
|
* Game.adjustAtkDir 里再 /10000 还原,故此处原样透传,不重复缩放。
|
|
26
26
|
* - TimePast 的 dt:是秒的浮点数(Game.stableTime = 0.0166),直接取整会变成 0,
|
|
27
27
|
* 所以按 INPUT_TIME_SCALE 放大传输,解码时再除回来。
|
|
28
|
-
* - BoundSet 的 boundWidth/boundHeight 是格数 × cellSize(37) 的整数世界坐标,本身即整数。
|
|
29
28
|
*/
|
|
30
29
|
exports.INPUT_TIME_SCALE = 10000;
|
|
31
30
|
function toInt(value) {
|
|
@@ -79,6 +78,10 @@ class BattleInputCodec {
|
|
|
79
78
|
const data = input;
|
|
80
79
|
return { type: input.type, params: [data.playerId] };
|
|
81
80
|
}
|
|
81
|
+
case battle_interface_1.GameInputTypeEnum.UseSkill: {
|
|
82
|
+
const data = input;
|
|
83
|
+
return { type: input.type, params: [toInt(data.ownerId), toInt(data.skillId)] };
|
|
84
|
+
}
|
|
82
85
|
default:
|
|
83
86
|
console.warn(`[BattleInputCodec] encode unknow input type: ${input.type}`);
|
|
84
87
|
return null;
|
|
@@ -137,6 +140,14 @@ class BattleInputCodec {
|
|
|
137
140
|
};
|
|
138
141
|
return input;
|
|
139
142
|
}
|
|
143
|
+
case battle_interface_1.GameInputTypeEnum.UseSkill: {
|
|
144
|
+
const input = {
|
|
145
|
+
type: battle_interface_1.GameInputTypeEnum.UseSkill,
|
|
146
|
+
ownerId: readInt(params, 0),
|
|
147
|
+
skillId: readInt(params, 1),
|
|
148
|
+
};
|
|
149
|
+
return input;
|
|
150
|
+
}
|
|
140
151
|
default:
|
|
141
152
|
console.warn(`[BattleInputCodec] decode unknow input type: ${type}`);
|
|
142
153
|
return null;
|