captainbattle 1.0.8 → 1.0.10

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.
Files changed (151) hide show
  1. package/dist/core/CallID.d.ts +21 -13
  2. package/dist/core/CallID.js +23 -13
  3. package/dist/core/ListenID.d.ts +551 -501
  4. package/dist/core/ListenID.js +552 -501
  5. package/dist/core/config/BadgeCfg.d.ts +18 -4
  6. package/dist/core/config/BadgeCfg.js +20 -6
  7. package/dist/core/config/BattlePassCfg.d.ts +1 -1
  8. package/dist/core/config/BuffCfg.d.ts +7 -1
  9. package/dist/core/config/BuffCfg.js +6 -0
  10. package/dist/core/config/Cfg.d.ts +36 -4
  11. package/dist/core/config/Cfg.js +46 -6
  12. package/dist/core/config/ChatLogCfg.d.ts +18 -0
  13. package/dist/core/config/ChatLogCfg.js +17 -0
  14. package/dist/core/config/Const.d.ts +2 -1
  15. package/dist/core/config/Const.js +1 -0
  16. package/dist/core/config/ConstConfigCfg.d.ts +2 -0
  17. package/dist/core/config/ConstConfigCfg.js +2 -0
  18. package/dist/core/config/DragonPathCfg.d.ts +1 -1
  19. package/dist/core/config/EmailCfg.d.ts +5 -3
  20. package/dist/core/config/EmailCfg.js +7 -5
  21. package/dist/core/config/EndlessConfigCfg.d.ts +1 -0
  22. package/dist/core/config/EndlessConfigCfg.js +1 -0
  23. package/dist/core/config/EnemyGridCfg.d.ts +1 -1
  24. package/dist/core/config/FormationCfg.d.ts +1 -1
  25. package/dist/core/config/FuncDescCfg.d.ts +4 -0
  26. package/dist/core/config/FuncDescCfg.js +4 -0
  27. package/dist/core/config/GemCfg.d.ts +1 -1
  28. package/dist/core/config/GuildBossWaveCfg.d.ts +1 -0
  29. package/dist/core/config/GuildIslandBuildCfg.d.ts +2 -1
  30. package/dist/core/config/GuildIslandTaskCfg.d.ts +13 -0
  31. package/dist/core/config/GuildIslandTaskCfg.js +8 -0
  32. package/dist/core/config/ItemsCfg.d.ts +1 -1
  33. package/dist/core/config/PetCfg.d.ts +1 -1
  34. package/dist/core/config/PetConfigCfg.d.ts +7 -0
  35. package/dist/core/config/PetConfigCfg.js +7 -0
  36. package/dist/core/config/PetSkillCfg.d.ts +1 -0
  37. package/dist/core/config/PetSlotLvCfg.d.ts +1 -0
  38. package/dist/core/config/PrivilegeCfg.d.ts +1 -0
  39. package/dist/core/config/PrivilegeCfg.js +1 -0
  40. package/dist/core/config/RankListCfg.d.ts +10 -0
  41. package/dist/core/config/RankListCfg.js +8 -0
  42. package/dist/core/config/RelicDungeonConfigCfg.d.ts +0 -1
  43. package/dist/core/config/RelicDungeonConfigCfg.js +0 -1
  44. package/dist/core/config/RelicDungeonGrowCfg.d.ts +5 -0
  45. package/dist/core/config/RobotConfigCfg.d.ts +7 -6
  46. package/dist/core/config/RuleDescCfg.d.ts +6 -2
  47. package/dist/core/config/RuleDescCfg.js +9 -5
  48. package/dist/core/config/SeaArenaConfigCfg.d.ts +2 -1
  49. package/dist/core/config/SeaArenaConfigCfg.js +1 -0
  50. package/dist/core/config/SprintActivityConfigCfg.d.ts +12 -0
  51. package/dist/core/config/SprintActivityConfigCfg.js +12 -0
  52. package/dist/core/config/SprintActivityRankRewardCfg.d.ts +3 -1
  53. package/dist/core/config/StageCfg.d.ts +2 -0
  54. package/dist/core/config/TreasureMatchConfigCfg.d.ts +19 -0
  55. package/dist/core/config/TreasureMatchConfigCfg.js +16 -0
  56. package/dist/core/config/TreasureMatchIconCfg.d.ts +12 -0
  57. package/dist/core/config/TreasureMatchIconCfg.js +8 -0
  58. package/dist/core/config/TreasureMatchRankRewardCfg.d.ts +10 -0
  59. package/dist/core/config/TreasureMatchRankRewardCfg.js +8 -0
  60. package/dist/core/config/VehicleUpgradeAttrCfg.d.ts +10 -0
  61. package/dist/core/config/VehicleUpgradeAttrCfg.js +8 -0
  62. package/dist/core/config/VehicleUpgradeConfigCfg.d.ts +16 -0
  63. package/dist/core/config/VehicleUpgradeConfigCfg.js +13 -0
  64. package/dist/core/config/VehicleUpgradeLevelCfg.d.ts +13 -0
  65. package/dist/core/config/VehicleUpgradeLevelCfg.js +8 -0
  66. package/dist/core/framework/Time.d.ts +1 -0
  67. package/dist/core/framework/Time.js +1 -0
  68. package/dist/core/module/arena/ArenaBattleModule.d.ts +3 -0
  69. package/dist/core/module/arena/ArenaBattleModule.js +14 -2
  70. package/dist/core/module/battle/Game.d.ts +13 -3
  71. package/dist/core/module/battle/Game.js +36 -6
  72. package/dist/core/module/battle/IGameModule.d.ts +1 -0
  73. package/dist/core/module/battle/IGameModule.js +7 -3
  74. package/dist/core/module/battle/battle.interface.d.ts +17 -1
  75. package/dist/core/module/battle/battle.interface.js +3 -0
  76. package/dist/core/module/battle/buff/buffitem/BossCloneBuff.d.ts +10 -0
  77. package/dist/core/module/battle/buff/buffitem/BossCloneBuff.js +89 -0
  78. package/dist/core/module/battle/buff/buffitem/BossPetrifyBuff.d.ts +9 -0
  79. package/dist/core/module/battle/buff/buffitem/BossPetrifyBuff.js +60 -0
  80. package/dist/core/module/battle/buff/buffitem/BossReinforcementBuff.d.ts +7 -0
  81. package/dist/core/module/battle/buff/buffitem/BossReinforcementBuff.js +26 -0
  82. package/dist/core/module/battle/buff/buffitem/ForceDizzinessBuff.d.ts +6 -0
  83. package/dist/core/module/battle/buff/buffitem/ForceDizzinessBuff.js +26 -0
  84. package/dist/core/module/battle/buff/buffitem/ImmuneForceDizziness.d.ts +3 -0
  85. package/dist/core/module/battle/buff/buffitem/ImmuneForceDizziness.js +18 -0
  86. package/dist/core/module/battle/buff/buffitem/PosionBuff.js +8 -2
  87. package/dist/core/module/battle/buff/buffitem/ReplaceSkillBuff.d.ts +1 -1
  88. package/dist/core/module/battle/buff/buffitem/ReplaceSkillBuff.js +4 -3
  89. package/dist/core/module/battle/buff/buffitem/SprintBuff.js +40 -17
  90. package/dist/core/module/battle/buff/buffitem/VenomBurstBuff.d.ts +8 -0
  91. package/dist/core/module/battle/buff/buffitem/VenomBurstBuff.js +40 -0
  92. package/dist/core/module/battle/buff/buffitem/index.d.ts +6 -0
  93. package/dist/core/module/battle/buff/buffitem/index.js +7 -1
  94. package/dist/core/module/battle/entity/FighterData.js +5 -1
  95. package/dist/core/module/battle/event/EntityEvent.d.ts +2 -0
  96. package/dist/core/module/battle/event/EntityEvent.js +2 -0
  97. package/dist/core/module/battle/factory/FighterFactory.js +17 -5
  98. package/dist/core/module/battle/fsm-state/Boss38210State.d.ts +11 -0
  99. package/dist/core/module/battle/fsm-state/Boss38210State.js +30 -0
  100. package/dist/core/module/battle/fsm-state/FighterStateProfiles.d.ts +2 -1
  101. package/dist/core/module/battle/fsm-state/FighterStateProfiles.js +4 -2
  102. package/dist/core/module/battle/fsm-state/TurnState.js +4 -4
  103. package/dist/core/module/battle/fsm-state/TurnTransitions.js +4 -4
  104. package/dist/core/module/battle/fsm-state/index.d.ts +1 -0
  105. package/dist/core/module/battle/fsm-state/index.js +2 -1
  106. package/dist/core/module/battle/manager/EntityManager.js +7 -3
  107. package/dist/core/module/battle/skill/emitter/SkillTargetHorRandomEmitter.d.ts +12 -0
  108. package/dist/core/module/battle/skill/emitter/SkillTargetHorRandomEmitter.js +62 -0
  109. package/dist/core/module/battle/skill/emitter/index.d.ts +1 -0
  110. package/dist/core/module/battle/skill/emitter/index.js +2 -1
  111. package/dist/core/module/battle/skill/impacts/Impact101.js +1 -0
  112. package/dist/core/module/battle/skill/impacts/Impact3.js +2 -1
  113. package/dist/core/module/battle/skill/impacts/Impact5.js +5 -1
  114. package/dist/core/module/battle/system/BornSystem.js +4 -0
  115. package/dist/core/module/battle/system/BuffSystem.js +9 -3
  116. package/dist/core/module/battle/system/SkillSystem.js +1 -1
  117. package/dist/core/module/battle/system/TurnPhaseSystem.js +1 -1
  118. package/dist/core/module/battle/target/RandomPosSelection.d.ts +4 -0
  119. package/dist/core/module/battle/target/RandomPosSelection.js +61 -0
  120. package/dist/core/module/battle/target/index.d.ts +1 -0
  121. package/dist/core/module/battle/target/index.js +2 -1
  122. package/dist/core/module/battle/turn/TurnBattleGame.d.ts +11 -3
  123. package/dist/core/module/battle/turn/TurnBattleGame.js +53 -12
  124. package/dist/core/module/battle/turn/TurnBattleModule.js +2 -2
  125. package/dist/core/module/battle/turn/TurnBattleTypes.d.ts +1 -6
  126. package/dist/core/module/battle/turn/TurnBattleTypes.js +1 -4
  127. package/dist/core/module/battle/util/BattleConfig.js +2 -2
  128. package/dist/core/module/battle/util/BattleUtils.d.ts +7 -1
  129. package/dist/core/module/battle/util/BattleUtils.js +67 -33
  130. package/dist/core/module/guild/island/battle/GuildIsLandBattleModule.d.ts +11 -0
  131. package/dist/core/module/guild/island/battle/GuildIsLandBattleModule.js +44 -0
  132. package/dist/core/module/guild/island/battle/index.d.ts +1 -0
  133. package/dist/core/module/guild/island/battle/index.js +13 -0
  134. package/dist/core/module/guild/view/boss/GuildBossBattleModule.js +1 -0
  135. package/dist/core/module/module.interface.d.ts +24 -0
  136. package/dist/core/module/module.interface.js +3 -0
  137. package/dist/core/module/property/Property.d.ts +2 -1
  138. package/dist/core/module/property/Property.js +8 -7
  139. package/dist/core/module/property/PropertyUtil.d.ts +17 -0
  140. package/dist/core/module/property/PropertyUtil.js +75 -1
  141. package/dist/core/module/relicDungeon/RelicBattleModule.d.ts +18 -0
  142. package/dist/core/module/relicDungeon/RelicBattleModule.js +148 -5
  143. package/dist/core/proto/CommonProto.d.ts +8740 -4068
  144. package/dist/core/proto/Proto.d.ts +129 -39
  145. package/dist/index.d.ts +48 -4
  146. package/dist/index.js +227 -12
  147. package/dist/register-all.d.ts +1 -0
  148. package/dist/register-all.js +1 -0
  149. package/dist/tsconfig.tsbuildinfo +1 -1
  150. package/package.json +1 -1
  151. package/resources/config/GameJsonCfg.bin +0 -0
@@ -385,6 +385,10 @@ class BornSystem extends GameSystem_1.GameSystem {
385
385
  if (fighter.cfg.type === battle_interface_1.SubEntityType.CALL || fighter.cfg.type === battle_interface_1.SubEntityType.OBSTACLE) {
386
386
  fighter.callEntityId = info.parentId;
387
387
  fighter.callTopEntityId = info.topParentId;
388
+ const parent = game.getEntityLogic(info.parentId);
389
+ if (parent) {
390
+ game.emit1(parent, EntityEvent_1.EntityEvent.CallFighter, fighter);
391
+ }
388
392
  }
389
393
  fighter.atkDir.x = info.atkDirx;
390
394
  fighter.atkDir.y = info.atkDiry;
@@ -62,7 +62,9 @@ class BuffSystem extends GameSystem_1.GameSystem {
62
62
  func.layerChange(entity, buff, buff.buffLayer + 1);
63
63
  let casterer = entity.game.getEntityLogic(buff.caster);
64
64
  if (casterer) {
65
- casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff });
65
+ const args = { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff };
66
+ casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, args);
67
+ casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNumRatio, args);
66
68
  }
67
69
  if (buff.triggerType && buff.triggerType.length > 0) {
68
70
  this.registerTrigger(entity, buff.triggerType, true);
@@ -339,14 +341,18 @@ class BuffSystem extends GameSystem_1.GameSystem {
339
341
  func.layerChange(entity, buff, buff.buffLayer + 1);
340
342
  let casterer = entity.game.getEntityLogic(buff.caster);
341
343
  if (casterer) {
342
- casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff });
344
+ const args = { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff };
345
+ casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, args);
346
+ casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNumRatio, args);
343
347
  }
344
348
  }
345
349
  else {
346
350
  buff.buffLayer += 1;
347
351
  let casterer = entity.game.getEntityLogic(buff.caster);
348
352
  if (casterer) {
349
- casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff });
353
+ const args = { id: buff.buffTypeId, layer: buff.buffLayer, beHiter: entity, buff };
354
+ casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNum, args);
355
+ casterer.game.emit1(casterer, EntityEvent_1.EntityEvent.BuffLayerNumRatio, args);
350
356
  }
351
357
  }
352
358
  if (entity.game.gameModule.moduleState.showEffect && (buff.buffTime < 0 || buff.buffTime >= 0.1)) {
@@ -371,7 +371,7 @@ class SkillSystem extends GameSystem_1.GameSystem {
371
371
  }
372
372
  }
373
373
  if (entity.campType === battle_interface_1.CampType.MY && value.cfg.useType === 3) {
374
- Notifier_1.Notifier.send(ListenID_1.ListenID.Battle_UpdateUseType3SkillCd, value.cfg.id, value.skillCurCd, value.maxCd);
374
+ Notifier_1.Notifier.send(ListenID_1.ListenID.Battle_UpdateUseType3SkillCd, value.cfg.id, value.skillCurCd, value.maxCd, entity.playerId);
375
375
  }
376
376
  }
377
377
  }
@@ -21,7 +21,7 @@ class TurnPhaseSystem extends GameSystem_1.GameSystem {
21
21
  }
22
22
  set round(value) {
23
23
  this._round = value;
24
- Notifier_1.Notifier.send(ListenID_1.ListenID.Battle_TurnChange, value, this.game.config.maxRounds);
24
+ Notifier_1.Notifier.send(ListenID_1.ListenID.Battle_TurnChange, value, this.game.gameOptions.maxRounds);
25
25
  }
26
26
  phase = TurnBattleTypes_1.TurnPhase.NONE;
27
27
  _units = [];
@@ -0,0 +1,4 @@
1
+ import type FighterData from "../entity/FighterData";
2
+ export declare class RandomPosSelection {
3
+ static select(owner: FighterData, targetTypes: number[], x?: number, y?: number, ignoreList?: number[], searchRange?: number, forceSkillId?: number): FighterData[];
4
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RandomPosSelection = void 0;
4
+ const Property_1 = require("../../property/Property");
5
+ const battle_interface_1 = require("../battle.interface");
6
+ const BattleUtils_1 = require("../util/BattleUtils");
7
+ const BVec2_1 = require("../util/BVec2");
8
+ const RandomTargetSelection_1 = require("./RandomTargetSelection");
9
+ const TargetSelection_1 = require("./TargetSelection");
10
+ class RandomPosSelection {
11
+ static select(owner, targetTypes, x, y, ignoreList, searchRange, forceSkillId) {
12
+ let realx = owner.x;
13
+ let realy = owner.y;
14
+ if (typeof x === "number") {
15
+ realx = x;
16
+ realy = y;
17
+ }
18
+ let targets = RandomTargetSelection_1.RandomTargetSelection.select(owner, [2], realx, realy, ignoreList, searchRange, forceSkillId);
19
+ const tempVec2 = TargetSelection_1.tempTargetVec;
20
+ if (targets.length > 0) {
21
+ tempVec2.x = targets[0].x - realx;
22
+ tempVec2.y = targets[0].y - realy;
23
+ }
24
+ else {
25
+ let maxDis = Number.MAX_SAFE_INTEGER;
26
+ let minDis = 0;
27
+ const skillId = forceSkillId || owner.normalSkillIds[0];
28
+ if (skillId && owner.skillDatas[skillId].cfg.skillArea) {
29
+ maxDis = Property_1.PropertyHelper.attackDis(owner.skillDatas[skillId].cfg.skillArea[1], owner.property);
30
+ minDis = Property_1.PropertyHelper.attackMinDis(owner.skillDatas[skillId].cfg.skillArea[0], owner.property);
31
+ }
32
+ if (searchRange) {
33
+ maxDis = searchRange;
34
+ minDis = 0;
35
+ }
36
+ BVec2_1.BVecHelper.set(tempVec2, 0, owner.game.randomRange(minDis, maxDis));
37
+ BVec2_1.BVecHelper.rotate(tempVec2, tempVec2, owner.game.randomRange(0, 360));
38
+ }
39
+ const min = targetTypes[1] || 0;
40
+ const max = targetTypes[2] || 0;
41
+ const num = owner.game.randomRange(min, max);
42
+ const setTargets = [];
43
+ for (let i = 0; i < max; i++) {
44
+ if (i < num) {
45
+ if (i === 0) {
46
+ setTargets.push(BattleUtils_1.BattleUtils.getTargetPosFighter(owner, realx + tempVec2.x, realy + tempVec2.y));
47
+ }
48
+ else {
49
+ BVec2_1.BVecHelper.rotate(tempVec2, tempVec2, Math.ceil(360 / num));
50
+ setTargets.push(BattleUtils_1.BattleUtils.getTargetPosFighter(owner, realx + tempVec2.x, realy + tempVec2.y));
51
+ }
52
+ }
53
+ else {
54
+ setTargets.push(null);
55
+ }
56
+ }
57
+ return setTargets;
58
+ }
59
+ }
60
+ exports.RandomPosSelection = RandomPosSelection;
61
+ (0, TargetSelection_1.registerTargetSelection)(battle_interface_1.ETargetType.RANDOM_POS)(RandomPosSelection);
@@ -3,6 +3,7 @@ import "./CloseDownTargetSelection";
3
3
  import "./CloseTargetSelection";
4
4
  import "./FarTargetSelection";
5
5
  import "./PriorityTypeTargetSelection";
6
+ import "./RandomPosSelection";
6
7
  import "./RandomRangeTargetSelection";
7
8
  import "./RandomTargetSelection";
8
9
  import "./RectRandomTargetSelection";
@@ -8,13 +8,14 @@
8
8
  // Cocos 的资源系统会把 assets 下所有脚本加载一遍,所以引擎里天然成立;
9
9
  // Node 只执行从入口 import 可达的模块,不引这一下,注册表就是空的。
10
10
  //
11
- // 共 12 个模块。下面的 import 只为副作用,不需要用到导出。
11
+ // 共 13 个模块。下面的 import 只为副作用,不需要用到导出。
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  require("./CloseAngleTargetSelection");
14
14
  require("./CloseDownTargetSelection");
15
15
  require("./CloseTargetSelection");
16
16
  require("./FarTargetSelection");
17
17
  require("./PriorityTypeTargetSelection");
18
+ require("./RandomPosSelection");
18
19
  require("./RandomRangeTargetSelection");
19
20
  require("./RandomTargetSelection");
20
21
  require("./RectRandomTargetSelection");
@@ -1,11 +1,11 @@
1
- import { GameInput, IFighterInfo } from "../battle.interface";
1
+ import { GameInput, IFighterInfo, IPVPFightData } from "../battle.interface";
2
2
  import FighterData from "../entity/FighterData";
3
3
  import Game from "../Game";
4
4
  import { TurnPhaseSystem } from "../system/TurnPhaseSystem";
5
5
  import { TurnSchedulerSystem } from "../system/TurnSchedulerSystem";
6
6
  import type { HitData } from "../util/HitDataPool";
7
7
  import { CampType } from './../battle.interface';
8
- import { TurnBattleConfig, TurnBattleOptions, TurnBattleState, TurnPhase } from "./TurnBattleTypes";
8
+ import { TurnBattleOptions, TurnBattleState, TurnPhase } from "./TurnBattleTypes";
9
9
  /**
10
10
  * 回合制战斗主类。
11
11
  * 逻辑与表现共用同一套实时系统:回合调度器只决定“当前哪个单位可以行动”,
@@ -27,7 +27,6 @@ export default class TurnBattleGame extends Game {
27
27
  getTurnHurtHp(campType: CampType): number;
28
28
  /** 回合末等待延迟(秒):大于 0 时停在 ROUND_END,不进入下一回合 */
29
29
  private _roundEndDelay;
30
- config: TurnBattleConfig;
31
30
  constructor(options: TurnBattleOptions);
32
31
  private initTurnSystems;
33
32
  /** 回合制开战入口:只做初始化,之后由 fixUpdate 逐帧推进(前端)/ runToEnd(后端) */
@@ -35,6 +34,15 @@ export default class TurnBattleGame extends Game {
35
34
  fixUpdate(dt: number): void;
36
35
  setReady(): void;
37
36
  getCurrentPhase(): TurnPhase;
37
+ getFightDataMap(): {
38
+ [playerId: number]: {
39
+ [key: number]: IPVPFightData;
40
+ };
41
+ };
42
+ logHurtData(attacker: FighterData, fightType: number, hurt: number, skillId: number): void;
43
+ logTakeDamage(defender: FighterData, hurt: number): void;
44
+ logHealData(caster: FighterData, heal: number): void;
45
+ logShieldData(caster: FighterData, shield: number): void;
38
46
  getRound(): number;
39
47
  /** 将 hp 已归零但还没进入死亡状态的单位补一次死亡状态,交给死亡动画结束后统一结算 */
40
48
  collectDeaths(): void;
@@ -39,10 +39,9 @@ class TurnBattleGame extends Game_1.default {
39
39
  }
40
40
  /** 回合末等待延迟(秒):大于 0 时停在 ROUND_END,不进入下一回合 */
41
41
  _roundEndDelay = 0;
42
- config;
43
42
  constructor(options) {
44
43
  super(options);
45
- this.config = { ...TurnBattleTypes_1.DEFAULT_TURN_BATTLE_CONFIG, ...(options.turnConfig || {}) };
44
+ this.gameOptions.maxRounds = options.maxRounds || 25;
46
45
  this.turnState = {
47
46
  round: 0,
48
47
  phase: TurnBattleTypes_1.TurnPhase.NONE,
@@ -111,6 +110,45 @@ class TurnBattleGame extends Game_1.default {
111
110
  getCurrentPhase() {
112
111
  return this.phaseSystem.phase;
113
112
  }
113
+ getFightDataMap() {
114
+ return this.gameContext.playerFightData;
115
+ }
116
+ logHurtData(attacker, fightType, hurt, skillId) {
117
+ if (this.gameModule.moduleState.logDetial) {
118
+ let id = attacker.callTopEntityId || attacker.ID;
119
+ let fightData = this.gameContext.playerFightData[attacker.playerId][id];
120
+ if (fightData) {
121
+ fightData.hurt += hurt;
122
+ }
123
+ }
124
+ }
125
+ logTakeDamage(defender, hurt) {
126
+ if (this.gameModule.moduleState.logDetial) {
127
+ let id = defender.ID;
128
+ let fightData = this.gameContext.playerFightData[defender.playerId][id];
129
+ if (fightData) {
130
+ fightData.takeDamage += hurt;
131
+ }
132
+ }
133
+ }
134
+ logHealData(caster, heal) {
135
+ if (this.gameModule.moduleState.logDetial) {
136
+ let id = caster.callTopEntityId || caster.ID;
137
+ let fightData = this.gameContext.playerFightData[caster.playerId][id];
138
+ if (fightData) {
139
+ fightData.heal += heal;
140
+ }
141
+ }
142
+ }
143
+ logShieldData(caster, shield) {
144
+ if (this.gameModule.moduleState.logDetial) {
145
+ let id = caster.callTopEntityId || caster.ID;
146
+ let fightData = this.gameContext.playerFightData[caster.playerId][id];
147
+ if (fightData) {
148
+ fightData.shield += shield;
149
+ }
150
+ }
151
+ }
114
152
  getRound() {
115
153
  return this.phaseSystem.round;
116
154
  }
@@ -161,13 +199,12 @@ class TurnBattleGame extends Game_1.default {
161
199
  // 维修先于 buff 结算,避免回复量被本回合的 buff 或 CD 推进影响
162
200
  this.processRepair();
163
201
  this.emit(GameEvent_1.GameEvent.StepBuff, 1);
164
- if (this.phaseSystem.round >= this.config.maxRounds) {
202
+ if (this.phaseSystem.round >= this.gameOptions.maxRounds) {
165
203
  //超过回合上限
166
- this.finishTurnBattle(battle_interface_2.CampType.ENEMY);
167
- this.endFight();
204
+ this.setGameFail();
168
205
  return;
169
206
  }
170
- this.addRoundEndDelay(1); //强制等待时间
207
+ this.addRoundEndDelay(0.3); //强制等待时间
171
208
  // 回合末表现(维修等)未播完时停在 ROUND_END,由 tickRoundEndDelay 推进到下一回合
172
209
  // if (this._roundEndDelay > 0) return;
173
210
  // this.enterNextRound();
@@ -398,7 +435,7 @@ class TurnBattleGame extends Game_1.default {
398
435
  return finalDamage;
399
436
  }
400
437
  calComboCount(attacker, defender) {
401
- let comboRatio = Property_1.PropertyHelper.turnComboRatio(attacker.property) - defender.property[50110];
438
+ let comboRatio = Property_1.PropertyHelper.turnComboRatio(attacker.property) - defender.property[50110] - defender.property[51810];
402
439
  attacker.curDoubleShootNum = 0;
403
440
  for (let i = 0; i < attacker.doubleShootNum; i++) {
404
441
  if (comboRatio <= 0) {
@@ -417,35 +454,39 @@ class TurnBattleGame extends Game_1.default {
417
454
  //触发破甲
418
455
  isTriggerCrit(attacker, defender) {
419
456
  const a = Property_1.PropertyHelper.turnCritRatio(attacker.property);
420
- const b = defender.property[50510];
457
+ const b = defender.property[50510] + defender.property[51810];
421
458
  let ratio = BattleUtils_1.BattleUtils.clampf(a - b, 0, 10000);
422
459
  return this.IsHitOrNot(ratio, 10000);
423
460
  }
424
461
  //是否触发闪避
425
462
  isTriggerMiss(attacker, defender) {
426
463
  const a = Property_1.PropertyHelper.turnMissRatio(defender.property);
427
- const b = attacker.property[50410];
464
+ const b = attacker.property[50410] + defender.property[51810];
465
+ ;
428
466
  let ratio = BattleUtils_1.BattleUtils.clampf(a - b, 0, this.proMaxMap.get(50400));
429
467
  return this.IsHitOrNot(ratio, 10000);
430
468
  }
431
469
  //是否触发击晕
432
470
  isTriggerStun(attacker, defender) {
433
471
  const a = Property_1.PropertyHelper.turnStunRatio(attacker.property);
434
- const b = defender.property[50310];
472
+ const b = defender.property[50310] + defender.property[51810];
473
+ ;
435
474
  let ratio = BattleUtils_1.BattleUtils.clampf(a - b, 0, this.proMaxMap.get(50300));
436
475
  return this.IsHitOrNot(ratio, 10000);
437
476
  }
438
477
  //是否触发反击
439
478
  isTriggerCounter(attacker, defender) {
440
479
  const a = Property_1.PropertyHelper.turnCounterRatio(attacker.property);
441
- const b = defender.property[50210];
480
+ const b = defender.property[50210] + defender.property[51810];
481
+ ;
442
482
  let ratio = BattleUtils_1.BattleUtils.clampf(a - b, 0, this.proMaxMap.get(50200));
443
483
  return this.IsHitOrNot(ratio, 10000);
444
484
  }
445
485
  //是否触发维修
446
486
  isTriggerRepair(attacker, defender) {
447
487
  const a = Property_1.PropertyHelper.turnShieldHeal(attacker.property);
448
- const b = defender.property[50610];
488
+ const b = defender.property[50610] + defender.property[51810];
489
+ ;
449
490
  let ratio = BattleUtils_1.BattleUtils.clampf(a - b, 0, this.proMaxMap.get(50600));
450
491
  return this.IsHitOrNot(ratio, 10000);
451
492
  }
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const battle_interface_1 = require("../battle.interface");
4
4
  const IGameModule_1 = require("../IGameModule");
5
5
  class TurnBattleModule extends IGameModule_1.GameModule {
6
- enemyPosIndexs = [[200, 0], [250, -200], [150, -200]];
6
+ enemyPosIndexs = [[170, 40], [250, -90], [140, -90]];
7
7
  init() {
8
8
  this.game.rolePosType = 1;
9
9
  this.moduleState.isTurn = true;
10
10
  this.moduleState.isPvp = true;
11
11
  this.moduleState.noPopSelectSkill = true;
12
12
  this.moduleState.autoFight = true;
13
- this.myPosIndexs = [[-200, 0], [-250, -200], [-150, -200]];
13
+ this.myPosIndexs = [[-170, 40], [-250, -90], [-140, -90]];
14
14
  }
15
15
  setFighterPosition(fighter, data) {
16
16
  if (fighter.subType === battle_interface_1.SubEntityType.ROLE || fighter.subType === battle_interface_1.SubEntityType.PET) {
@@ -15,11 +15,6 @@ export interface TurnBattleState {
15
15
  winner: CampType | 0;
16
16
  currentActorId: number;
17
17
  }
18
- export interface TurnBattleConfig {
19
- /** 最大回合数,超过按平局处理 */
20
- maxRounds: number;
21
- }
22
18
  export interface TurnBattleOptions extends GameOptions {
23
- turnConfig?: Partial<TurnBattleConfig>;
19
+ maxRounds?: number;
24
20
  }
25
- export declare const DEFAULT_TURN_BATTLE_CONFIG: TurnBattleConfig;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_TURN_BATTLE_CONFIG = exports.TurnPhase = void 0;
3
+ exports.TurnPhase = void 0;
4
4
  /** 阵营回合阶段 */
5
5
  var TurnPhase;
6
6
  (function (TurnPhase) {
@@ -10,6 +10,3 @@ var TurnPhase;
10
10
  TurnPhase[TurnPhase["ROUND_END"] = 3] = "ROUND_END";
11
11
  TurnPhase[TurnPhase["FINISHED"] = 4] = "FINISHED";
12
12
  })(TurnPhase || (exports.TurnPhase = TurnPhase = {}));
13
- exports.DEFAULT_TURN_BATTLE_CONFIG = {
14
- maxRounds: 25,
15
- };
@@ -10,8 +10,8 @@ var HitType;
10
10
  HitType[HitType["Normal"] = 0] = "Normal";
11
11
  HitType[HitType["Debuff"] = 1] = "Debuff";
12
12
  })(HitType || (exports.HitType = HitType = {}));
13
- exports.NoInMoveBuff = [BuffCfg_1.BuffDefine.Frozen, BuffCfg_1.BuffDefine.Dizziness, BuffCfg_1.BuffDefine.Paralysis];
14
- exports.NoInAttackBuff = [BuffCfg_1.BuffDefine.Frozen, BuffCfg_1.BuffDefine.Dizziness, BuffCfg_1.BuffDefine.Paralysis, BuffCfg_1.BuffDefine.Disarm];
13
+ exports.NoInMoveBuff = [BuffCfg_1.BuffDefine.Frozen, BuffCfg_1.BuffDefine.Dizziness, BuffCfg_1.BuffDefine.ForceDizziness, BuffCfg_1.BuffDefine.Paralysis];
14
+ exports.NoInAttackBuff = [BuffCfg_1.BuffDefine.Frozen, BuffCfg_1.BuffDefine.Dizziness, BuffCfg_1.BuffDefine.ForceDizziness, BuffCfg_1.BuffDefine.Paralysis, BuffCfg_1.BuffDefine.Disarm];
15
15
  exports.InvisibleBuff = [BuffCfg_1.BuffDefine.Invicible, BuffCfg_1.BuffDefine.Armor];
16
16
  function getSpineSkeletonDataMap(key) {
17
17
  if (!key)
@@ -22,6 +22,11 @@ export declare class BattleUtils {
22
22
  * @param seed
23
23
  */
24
24
  static getBornInfoByWavesId(lvModeId: number, type: number, seed: number): any[];
25
+ /**
26
+ * 根据机器人配置赋值相关对象
27
+ * @param playerData
28
+ */
29
+ static normalRobotBattlePlayer(playerData: PlayerProto.IBattlePlayer): void;
25
30
  /**
26
31
  * 解析战斗单位
27
32
  * @param roleId 角色id
@@ -38,7 +43,7 @@ export declare class BattleUtils {
38
43
  private static handleRelicSkill;
39
44
  private static handleSkinSkill;
40
45
  private static handleSkinId;
41
- private static handleVehicleId;
46
+ private static handleVehicleSkinId;
42
47
  private static handleEquipSkill;
43
48
  private static handleWeaponSkinId;
44
49
  private static handleVehicleSkill;
@@ -61,6 +66,7 @@ export declare class BattleUtils {
61
66
  static isInAtkAimAngle(entity: FighterData, target: FighterData, angle: number): boolean;
62
67
  static limitPosInScene(out: BVec2Like, game: Game): void;
63
68
  static getAimAnglePos(entity: FighterData, minDis: number, maxDis: number, angle: number): FighterData[];
69
+ static getTargetPosFighter(entity: FighterData, x: number, y: number): FighterData;
64
70
  static getEffectPath(effectId: number | EffectPathCfg, entity: FighterData): readonly string[];
65
71
  static getArrayIndexByWeight(data: readonly number[], game: Game, ignoreIndexs?: number[], extraWeight?: number[]): number;
66
72
  }
@@ -95,6 +95,43 @@ class BattleUtils {
95
95
  }
96
96
  return bronInfo;
97
97
  }
98
+ /**
99
+ * 根据机器人配置赋值相关对象
100
+ * @param playerData
101
+ */
102
+ static normalRobotBattlePlayer(playerData) {
103
+ if (!playerData.isRobot || playerData.baseInfo)
104
+ return;
105
+ let robotConfig = Cfg_1.Cfg.RobotConfig.get(playerData.robotId);
106
+ if (robotConfig) {
107
+ playerData.baseInfo = {
108
+ userId: "robot",
109
+ nickname: robotConfig.name,
110
+ decorationInfo: {
111
+ playerDecoration: {
112
+ avatar: robotConfig.avatar,
113
+ avatarFrame: robotConfig.avatarFrame,
114
+ }
115
+ }
116
+ };
117
+ playerData.petSlots = {};
118
+ playerData.pets = {};
119
+ if (robotConfig.petIds) {
120
+ for (let i = 0; i < robotConfig.petIds.length; i++) {
121
+ const petId = robotConfig.petIds[i];
122
+ playerData.pets[petId] = { id: petId, star: 1, slotId: i + 1 };
123
+ playerData.petSlots[i + 1] = { petId: petId, level: 1 };
124
+ }
125
+ }
126
+ if (robotConfig.equipId) {
127
+ playerData.equipPartMap = {};
128
+ for (let i = 1; i <= robotConfig.equipId.length; i++) {
129
+ const equipId = robotConfig.equipId[i - 1];
130
+ playerData.equipPartMap[i] = { partId: i, equipId: equipId, lv: 1 };
131
+ }
132
+ }
133
+ }
134
+ }
98
135
  /**
99
136
  * 解析战斗单位
100
137
  * @param roleId 角色id
@@ -117,7 +154,8 @@ class BattleUtils {
117
154
  y: 0,
118
155
  fashionId: 0,
119
156
  weaponFashionId: 0,
120
- vehicleId: 0,
157
+ vehicleId: Const_1.Const.vehicleRoleId,
158
+ vehicleFashionId: 0,
121
159
  };
122
160
  if (roleCfg.normalSkillId) {
123
161
  data.skills.push(...roleCfg.normalSkillId);
@@ -175,7 +213,8 @@ class BattleUtils {
175
213
  weaponFashionId: 0,
176
214
  comboSkillId: 0,
177
215
  counterSkillId: 0,
178
- vehicleId: 0,
216
+ vehicleId: Const_1.Const.vehicleRoleId,
217
+ vehicleFashionId: 0,
179
218
  };
180
219
  //处理宠物技能
181
220
  this.handlePetSkill(data, playerData, true);
@@ -184,6 +223,12 @@ class BattleUtils {
184
223
  data.skills.push(10020000);
185
224
  data.skills.push(10020031); //通用被动
186
225
  data.collision = [0, 100, 60];
226
+ if (playerData.isRobot) {
227
+ const robotCfg = Cfg_1.Cfg.RobotConfig.get(playerData.robotId);
228
+ if (robotCfg.skillIds) {
229
+ data.skills.push(...robotCfg.skillIds);
230
+ }
231
+ }
187
232
  //装备技能,连击反击
188
233
  this.handleEquipSkill(data, playerData, true);
189
234
  //处理皮肤id
@@ -192,12 +237,19 @@ class BattleUtils {
192
237
  this.handleSkinSkill(data, playerData);
193
238
  //武器皮肤
194
239
  this.handleWeaponSkinId(data, playerData);
195
- //处理载体id
196
- this.handleVehicleId(data, playerData);
240
+ //处理载体皮肤id
241
+ this.handleVehicleSkinId(data, playerData);
197
242
  //载具技能
198
243
  this.handleVehicleSkill(data, playerData, true);
199
244
  }
200
245
  else if (roleCfg.type === battle_interface_1.SubEntityType.PET) {
246
+ if (playerData.isRobot) {
247
+ const robotCfg = Cfg_1.Cfg.RobotConfig.get(playerData.robotId);
248
+ let index = robotCfg.petIds.indexOf(roleId);
249
+ if (robotCfg.petSkillIds && robotCfg.petSkillIds[index]) {
250
+ data.skills.push(...robotCfg.petSkillIds[index]);
251
+ }
252
+ }
201
253
  }
202
254
  return data;
203
255
  }
@@ -227,27 +279,6 @@ class BattleUtils {
227
279
  }
228
280
  }
229
281
  }
230
- /* else {
231
- let gemIds = Notifier.call(CallID.Gem_GetEquippedGems);
232
- if (!gemIds || !gemIds.length) return;
233
- for (let i = 0; i < gemIds.length; i++) {
234
- let gemId = gemIds[i];
235
- let gemCfg = Cfg.Gem.get(gemId);
236
- if (gemCfg && gemCfg.coreSkill) {
237
- let skillCfg = Cfg.Skill.get(gemCfg.coreSkill);
238
- if (skillCfg?.belong === roleId) {
239
- let type = skillCfg.impactType[0];
240
- if (type !== 1 || skillCfg.impactType.indexOf(roleId, 1) >= 1) {
241
- data.skills.push(gemCfg.coreSkill);
242
- }
243
- if (type === 1 && ((skillCfg.impactType.indexOf(roleId, 1) >= 1 && skillCfg.impactType.length > 2)
244
- || (skillCfg.impactType.indexOf(roleId, 1) === -1))) {
245
- data.waitCallSkills.push(gemCfg.coreSkill);
246
- }
247
- }
248
- }
249
- }
250
- }*/
251
282
  }
252
283
  static handleRelicSkill(data, playerData) {
253
284
  let roleId = data.id;
@@ -313,7 +344,7 @@ class BattleUtils {
313
344
  let roleId = data.id;
314
345
  let skinMap = null;
315
346
  let slotInfo = null;
316
- if (playerData) {
347
+ if (playerData && playerData.skinMap) {
317
348
  skinMap = BattlePlayerUtil_1.default.getAllSkinMap(playerData.skinMap);
318
349
  slotInfo = playerData.skinSlotMap;
319
350
  }
@@ -371,8 +402,8 @@ class BattleUtils {
371
402
  let roleId = data.id;
372
403
  //处理皮肤id
373
404
  let hasSkin = null;
374
- if (playerData) {
375
- let skinId = playerData.equipSkinMap[roleId];
405
+ if (playerData && playerData.equipSkinMap) {
406
+ let skinId = playerData.equipSkinMap[roleId] || 0;
376
407
  hasSkin = Cfg_1.Cfg.Skin.get(skinId);
377
408
  }
378
409
  /* else {
@@ -393,10 +424,10 @@ class BattleUtils {
393
424
  data.fashionId = hasSkin.id * 10 + (isMax ? 1 : 0);
394
425
  }
395
426
  }
396
- static handleVehicleId(data, playerData) {
427
+ static handleVehicleSkinId(data, playerData) {
397
428
  if (playerData) {
398
429
  let roleId = Const_1.Const.vehicleRoleId;
399
- if (playerData && playerData.equipSkinMap[roleId]) {
430
+ if (playerData && playerData.equipSkinMap && playerData.equipSkinMap[roleId]) {
400
431
  let skinId = playerData.equipSkinMap[roleId];
401
432
  const hasSkin = Cfg_1.Cfg.Skin.get(skinId);
402
433
  let isMax = false;
@@ -405,7 +436,7 @@ class BattleUtils {
405
436
  if (lvCfg && lvCfg.length) {
406
437
  isMax = lvCfg[lvCfg.length - 1].level == star;
407
438
  }
408
- data.vehicleId = hasSkin.id * 10 + (isMax ? 1 : 0);
439
+ data.vehicleFashionId = hasSkin.id * 10 + (isMax ? 1 : 0);
409
440
  }
410
441
  }
411
442
  }
@@ -461,8 +492,8 @@ class BattleUtils {
461
492
  return;
462
493
  let weaponType = equipCfg.type;
463
494
  let hasSkin = null;
464
- if (playerData) {
465
- let skinId = playerData.equipSkinMap[weaponType];
495
+ if (playerData && playerData.equipSkinMap) {
496
+ let skinId = playerData.equipSkinMap[weaponType] || 0;
466
497
  hasSkin = Cfg_1.Cfg.Skin.get(skinId);
467
498
  }
468
499
  else {
@@ -634,6 +665,9 @@ class BattleUtils {
634
665
  // BVecHelper.add(tempVec2, tempVec2, entity);
635
666
  return [{ ID: -1, x: entity.touchPos.x, y: entity.touchPos.y, anchorX: 0.5, anchorY: 0, game: entity.game, scaleX: 1, scaleY: 1 }];
636
667
  }
668
+ static getTargetPosFighter(entity, x, y) {
669
+ return { ID: -1, x: x, y: y, anchorX: 0.5, anchorY: 0, game: entity.game, scaleX: 1, scaleY: 1 };
670
+ }
637
671
  static getEffectPath(effectId, entity) {
638
672
  const skinId = entity.cfg.id === Const_1.Const.mainRoleId ? entity.weaponFashionId : entity.fashionId;
639
673
  const effectPathCfg = typeof effectId === "number" ? Cfg_1.Cfg.EffectPath.get(effectId) : effectId;
@@ -0,0 +1,11 @@
1
+ import TurnBattleModule from "../../../battle/turn/TurnBattleModule";
2
+ import { IGuildIsLandResultData } from "../../../module.interface";
3
+ export default class GuildIsLandBattleModule extends TurnBattleModule {
4
+ resultInfo: IGuildIsLandResultData;
5
+ getMode(): number;
6
+ onUpdate(dt: number): void;
7
+ gameWin(): void;
8
+ gameFail(): void;
9
+ setCross(): void;
10
+ gameFinish(): void;
11
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const Notifier_1 = require("db://assets/scripts/framework/notify/Notifier");
13
+ const ListenID_1 = require("db://assets/scripts/ListenID");
14
+ const TurnBattleModule_1 = __importDefault(require("../../../battle/turn/TurnBattleModule"));
15
+ const BattleUtils_1 = require("../../../battle/util/BattleUtils");
16
+ let GuildIsLandBattleModule = class GuildIsLandBattleModule extends TurnBattleModule_1.default {
17
+ resultInfo;
18
+ getMode() {
19
+ return 7;
20
+ }
21
+ onUpdate(dt) {
22
+ }
23
+ gameWin() {
24
+ super.gameWin();
25
+ this.gameFinish();
26
+ }
27
+ gameFail() {
28
+ super.gameFail();
29
+ this.gameFinish();
30
+ }
31
+ setCross() {
32
+ this.game.gameState = 3 /* GameState.OVER */;
33
+ this.gameFinish();
34
+ }
35
+ gameFinish() {
36
+ if (this.resultInfo) {
37
+ Notifier_1.Notifier.send(ListenID_1.ListenID.GuildCS_OpenBattleResultView, this.resultInfo, this.game);
38
+ }
39
+ }
40
+ };
41
+ GuildIsLandBattleModule = __decorate([
42
+ (0, BattleUtils_1.cacheFunction)("GuildIsLandBattleModule")
43
+ ], GuildIsLandBattleModule);
44
+ exports.default = GuildIsLandBattleModule;