Files
2026-05-23 22:10:14 +08:00

321 lines
13 KiB
JavaScript

// --------------------------------------------------------------------
// @author: shiraho@syg.com(必填, 创建模块的人员)
// @description:
// 战斗的常量控制
// <br/>Create: new Date().toISOString()
// --------------------------------------------------------------------
var BattleConst = {
// 界面匹配的战斗类型
ui_fight_type: {
normal: 0,
main_scene: 1,
partner: 2,
backpack: 3,
drama_scene: 4,
esecsice: 5,
guild: 6,
hallows: 7,
arena: 8, // 竞技场
guild_dun: 9, // 联盟副本
star_tower: 10, // 星命塔
endless: 11, // 无尽试炼
dungeon_stone: 14, // 材料副本
guildwar: 17, // 公会战
primusWar: 18, // 星河神殿
ladderwar: 19, // 天梯
expedit_fight: 20, //远征
limit_boss: 12, // 限时BOSS,暂时没有了
escort: 13, // 护送, 暂时没有了
godbattle: 15, // 众神战,暂时没有了
elementWar: 25, // 元素圣殿
heavenwar: 27, // 天界副本
crosschampion: 31, // 跨服冠軍賽
trainingcamp : 36, // 新手训练营
},
Fight_Type: {
Nil: 0,
Default: 1,
Arena: 2, //竞技场
Darma: 3, //剧情副本战斗
SingleBoss: 4, //个人Boss
WorldBoss: 5, //世界boss
Adventrue: 6, //殲星迷途
StarTower: 7, //星命塔
PK: 8, //切磋
GuildDun: 9, //帮会副本
Champion: 10, //冠军联赛
Endless: 11, //无尽试炼
LimitBoss: 12, //限时BOSS
Escort: 13, //护送
DungeonStone: 14, //宝石副本
Godbattle: 15, //众神战场
GuildWar: 16, //联盟战1
PrimusWar: 17, //荣耀神殿战
LadderWar: 18, //跨服天梯1
ExpeditFight: 21, //远征
EliteMatchWar: 23, //精英赛1
EliteKingMatchWar: 24, //王者赛1
ElementWar: 25, // 元素圣殿1
HeroTestWar: 26, // 英雄试玩
HeavenWar: 27, // 天界副本1
CrossArenaWar: 28, // 跨服竞技场1
LimitExercise: 29, // 试炼之境1
AdventrueMine: 30, //秘矿冒险
CrossChampion: 31, // 跨服冠军赛1
TermBegins: 32, // 开学季战斗类型
TermBeginsBoss: 33, // 开学季boos战斗类型
GuildSecretArea: 34, //公会秘境战斗1
Arean_Team: 35, //组队竞技场1
Training_Camp: 36, //新手训练营1
MonopolyWar_1: 101, // 大富翁第一阶段
MonopolyWar_2: 102, // 大富翁第二阶段
MonopolyWar_3: 103, // 大富翁第三阶段
MonopolyWar_4: 104, // 大富翁第四阶段
MonopolyBoss: 105, // 大富翁boss
Arenapeakchampion: 37, // 巅峰冠军赛1
// PlanesWar = 38, // 位面冒险
PlanesWar: 40, // 新位面冒险(定义覆盖旧的需要的时候再弄一个新的)1
YearMonsterWar: 39,//年兽活动
WhiteDayWar: 41, //女神试炼
AreanManyPeople: 42, //多人竞技场
PractiseTower: 43, //演武场试练塔活动
newRole: 44,
newHeroUse:45,
newYearBoss:46,//新年活动pve
newYearCross:47//新年活动pvp
},
// 战斗单位类型
Unit_Type: {
Role: 1, // 主角单位,暂时没有用了
Hero: 2, // 伙伴
Monster: 3, // 怪物
Hallows: 4, // 神器
Elfin: 5, //--精灵
},
Group_Type: {
Friend: 1,
Enemgy: 2,
},
Battle_Type_Conf: {
TYPE_ENEMY: - 1,
TYPE_ROLE: 1,
BATTLE_EXIT: 1
},
//战斗场上单位目标类型
BattleTargetTypeConf: {
ALIVE_ENEMY: 1, //--敌方存活单位
ALIVE_ALLY: 2, //--友方存活单位
DEAD_ALLY: 3, //--友方死亡单位
DEAD_ENEMY: 4, //--敌方死亡单位
ALIVE_SELF: 5, //--自己
ALIVE_EXEPT_SELF: 6, //--全场除自己
ALIVE_ALLY_EXCEPT_SELF: 7, //--友方存活单位除了自己
},
BattleSkillTypeConf: {
ACTIVE_SKILL: "active_skill", //主动技能
PASSIVE_SKILL: "passive_skill", //被动技能
EQM_PASSIVE_SKILL: "eqm_passive_skill", //装备被动技能
},
//--人物额外数据
BattleRoleExtendType: {
FASHION: 5, // -- 皮肤
RESONATE: 10, //-- 共鸣
CRYSTAL: 11, //-- 原力水晶上阵的英雄
},
// 战斗特效播放类型
Effect_Play_Type: {
ROLE: 1, // 自己
SCENE: 2, // 场景
ROLE_SCENE: 3, // 友方场景
ENEMY_SCENE: 4, // 敌方场景
TARGET: 5, // 敌方目标
},
// 是否在战斗中的类型
Battle_In_Type: {
Nil: 0, // 当前不在战斗
UnReal: 1, // 假战斗
Real: 2, // 真战斗
},
// 分享类型
ShareType: {
SharePk: 1, //轮播
SharePlunder: 2, //一直播
ShareLadder: 3, // 天梯
},
JumpType: {
Summon: 1, // 召唤
HeroBag: 2, // 英雄背包
Forge: 3, // 锻造屋
Hallows: 4, // 神器
},
// 根据战斗类型判断当前的ui类型
getUIFightByFightType: function (fight_type) {
switch (fight_type) {
case this.Fight_Type.Darma:
case this.Fight_Type.Nil:
return BattleConst.ui_fight_type.drama_scene;
case this.Fight_Type.StarTower:
return BattleConst.ui_fight_type.star_tower;
case this.Fight_Type.GuildDun:
return BattleConst.ui_fight_type.guild_dun;
case this.Fight_Type.Arena:
return BattleConst.ui_fight_type.arena;
case this.Fight_Type.LimitBoss:
return BattleConst.ui_fight_type.limit_boss;
case this.Fight_Type.GuildWar:
return BattleConst.ui_fight_type.guildwar;
case this.Fight_Type.PrimusWar:
return BattleConst.ui_fight_type.primusWar;
case this.Fight_Type.LadderWar:
return BattleConst.ui_fight_type.ladderwar;
case this.Fight_Type.Endless://无尽试炼
return BattleConst.ui_fight_type.endless;
case this.Fight_Type.ExpeditFight://远征
return BattleConst.ui_fight_type.expedit_fight;
case this.Fight_Type.DungeonStone:
return BattleConst.ui_fight_type.dungeon_stone;
case this.Fight_Type.ElementWar://元素圣殿
return BattleConst.ui_fight_type.dungeon_stone;
case this.Fight_Type.HeavenWar://天界副本
return BattleConst.ui_fight_type.heavenwar;
case this.Fight_Type.Adventrue://冒险
return BattleConst.ui_fight_type.sky_scene;
case this.Fight_Type.Training_Camp://新手训练营
return BattleConst.ui_fight_type.trainingcamp;
case this.Fight_Type.Arean_Team: //組隊競技場
return BattleConst.ui_fight_type.areanTeam;
case this.Fight_Type.CrossChampion: //組隊競技場
return BattleConst.ui_fight_type.crosschampion;
case this.Fight_Type.CrossChampion: //組隊競技場
return BattleConst.ui_fight_type.crosschampion;
case this.Fight_Type.newRole:
return 44;
case this.Fight_Type.newHeroUse:
return 45;
case this.Fight_Type.newYearBoss:
return 46;
case this.Fight_Type.newYearCross:
return 47;
default:
return BattleConst.ui_fight_type.drama_scene;
}
},
// 特殊类型的战斗,
isNoRequest: function (fight_type) {
return (fight_type == this.Fight_Type.Default || fight_type == this.Fight_Type.PK || fight_type == this.Fight_Type.HeroTestWar || fight_type == this.Fight_Type.newHeroUse);
},
// 是否是pvp战斗
isPvP: function (fight_type) {
return (fight_type == this.Fight_Type.Arena || fight_type == this.Fight_Type.Escort);
},
// 是否需要显示玩家名字的
isNeedName: function (fight_type) {
return (fight_type == this.Fight_Type.PK);
},
// 是否显示入场pk动画
isNeedSpecStart: function (fight_type) {
return fight_type == BattleConst.Fight_Type.Arena || fight_type == BattleConst.Fight_Type.Champion || fight_type == BattleConst.Fight_Type.PK || fight_type == BattleConst.Fight_Type.LadderWar
},
// 觀戰是否需要轉換組別
isNeedChangeGroup: function (type) {
return type == BattleConst.Fight_Type.TeamDungeon
},
// 是否可以进战斗,这个时候就需要判断当前战斗类型的面板类型跟主界面缓存的类型是否一致
canDoBattle: function (fight_type) {
var target_ui_fight_type = this.getUIFightByFightType(fight_type);
var BattleController = require("battle_controller");
var cur_ui_fight_type = BattleController.getInstance().getUIFightType();
return (cur_ui_fight_type == target_ui_fight_type) || this.isNoRequest(fight_type) || BattleController.getInstance().getWatchReplayStatus();
},
//战斗分组
BattleGroupTypeConf: {
TYPE_GROUP_ENEMY: 2, //敌方
TYPE_GROUP_ROLE: 1, //友方
},
// --战斗单位类型
BattleObjectType: {
Role: 1, //--角色(暂时没有了)
Pet: 2, //--伙伴(配置表取partern)
Unit: 3, //--单位(配置表取unit)
Hallows: 4, //--神器
Elfin: 5, //精靈
},
// -- 兼容旧的录像数据中阵营光环id(转为现在的id列表)
Old_Halo_Id_Change: {
[1]: [1],
[2]: [2],
[3]: [3],
[4]: [4],
[5]: [5],
[6]: [21],
[7]: [6],
[8]: [6],
[9]: [7],
[10]: [7],
[11]: [8],
[12]: [8],
[13]: [11, 18],
[14]: [13, 17],
[15]: [12, 16],
[16]: [14, 20],
[17]: [15, 19],
},
BattleHookData1: { "combat_type": 3, "bid": 20101, "partner_list": [{ "pos": 2, "speed": 77, "bid": 10401, "lev": 1, "star": 4, "quality": 0, "hp": 45200, "crit": 0, "skill_list": [{ "sid": 200901, "effect_list": [{ "eid": 2009001, "num": 1, "min_hurt": 76, "max_hurt": 86 }], "rand": 100 }], "use_skin": 0, "playing": 1 }], "wave_list": [{ "unit_list": [{ "pos": 2, "bid": 101011, "speed": 60, "hp": 10, "crit": 0, "skill_list": [{ "sid": 259001, "effect_list": [{ "eid": 2590001, "num": 1, "min_hurt": 1, "max_hurt": 2 }], "rand": 100 }] }] }], "dun_bid": 10010, "b_formation_type": 1 },
// 战斗里面的位
GIRD_POS_OFFSET : 9,
// 挂机怪出现位置序列
Pos_To_Col : [ 0, 1, 2, 0, 1, 2, 0, 1, 2 ],
// 战斗人物层级
BattleRoleZorder : [ [ 992, 995, 998, 993, 996, 999, 991, 994, 997, 990, 999 ], [ 992, 995, 998, 993, 996, 999, 991, 994, 997, 990, 999 ] ],
//戰鬥位置用比例尺計算,將屏幕切分為16單位長度X9單位長度
// 战斗左侧站位
Pos2GridLeft : [ { x: 29, y: 44 }, { x: 27, y: 29 }, { x: 25, y: 15 }, { x: 19, y: 44 }, { x: 17, y: 29 }, { x: 15, y: 15 }, { x: 9, y: 44 }, { x: 7, y: 29 }, { x: 5, y: 15 }, { x: 37, y: 43 }, { x: 10, y: 2 } ],
// 战斗右侧站位
Pos2GridRight : [ { x: 51, y: 44 }, { x: 53, y: 29 }, { x: 55, y: 15 }, { x: 61, y: 44 }, { x: 63, y: 29 }, { x: 65, y: 15 }, { x: 71, y: 44 }, { x: 73, y: 29 }, { x: 75, y: 15 }, { x: 43, y: 43 }, { x: 67, y: 2 } ],
// 假戰鬥左側站位
NormalPosGridLeft : [ { x: 39, y: 39 }, { x: 37, y: 29 }, { x: 35, y: 19 }, { x: 29, y: 39 }, { x: 27, y: 29 }, { x: 25, y: 19 }, { x: 19, y: 39 }, { x: 17, y: 29 }, { x: 15, y: 19 }, { x: 17, y: 56 } ],
// 假战斗的站位
NormalPosGridRight : [ { x: 62, y: 35 }, { x: 52, y: 25 }, { x: 62, y: 15 }, { x: 62, y: 35 }, { x: 62, y: 25 }, { x: 62, y: 15 }, { x: 62, y: 35 }, { x: 62, y: 25 }, { x: 62, y: 15 }, { x: 62, y: 56 } ],
BATTLE_VIEW_BACK_LAYER_Z : 0,
BATTLE_VIEW_BLACK_LAYER_Z0 : 3,
BATTLE_VIEW_UI_LAYER_Z : 40,
BATTLE_VIEW_UI_LAYER_TAG : 40,
BATTLE_VIEW_ROLE_LAYER_Z : 25,
BATTLE_VIEW_ROLE_LAYER_TAG : 20,
BATTLE_VIEW_TOP : 999,
BATTLE_VIEW_EFFECT_LAYER_Z0 : 20,
BATTLE_VIEW_EFFECT_LAYER_Z2 : 15,
};
module.exports = BattleConst;