fix known issue:
-technique duration -anaxa technique -cerydra index technique
This commit is contained in:
parent
abd789a267
commit
8043986612
3 changed files with 95 additions and 10 deletions
|
@ -44,7 +44,7 @@ pub const buffs_unlocked = &[_]u32{
|
|||
131201, 131301, 131401, 131501, 131502, 131503, 131701, 131702, 140101,
|
||||
140102, 140201, 140202, 140301, 140401, 140501, 140601, 140701, 140801,
|
||||
140901, 200501, 200601, 220501, 221201, 800301, 800501, 101401, 101501,
|
||||
141001, 141201,
|
||||
141001,
|
||||
};
|
||||
|
||||
//TODO: update more Remembrance character in future
|
||||
|
|
|
@ -4,6 +4,7 @@ const Session = @import("../Session.zig");
|
|||
const Packet = @import("../Packet.zig");
|
||||
const Config = @import("../services/config.zig");
|
||||
const Data = @import("../data.zig");
|
||||
const Lineup = @import("../services/lineup.zig");
|
||||
const ChallengeData = @import("../services/challenge.zig");
|
||||
const NodeCheck = @import("../commands/value.zig");
|
||||
|
||||
|
@ -22,6 +23,43 @@ fn isInList(id: u32, list: []const u32) bool {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const Element = enum {
|
||||
Physical,
|
||||
Fire,
|
||||
Ice,
|
||||
Thunder,
|
||||
Wind,
|
||||
Quantum,
|
||||
Imaginary,
|
||||
None,
|
||||
};
|
||||
fn getAvatarElement(avatar_id: u32) Element {
|
||||
return switch (avatar_id) {
|
||||
1105, 1107, 1111, 1206, 1215, 1221, 1302, 1309, 1315, 1408, 1410, 8001, 8002 => .Physical,
|
||||
1003, 1009, 1109, 1112, 1210, 1218, 1222, 1225, 1301, 1310, 8003, 8004 => .Fire,
|
||||
1001, 1013, 1104, 1106, 1209, 1212, 1303, 1312, 1401, 8007, 8008 => .Ice,
|
||||
1005, 1008, 1103, 1202, 1204, 1211, 1223, 1308, 1402 => .Thunder,
|
||||
1002, 1014, 1101, 1108, 1205, 1217, 1220, 1307, 1405, 1409, 1412 => .Wind,
|
||||
1006, 1015, 1102, 1110, 1201, 1208, 1214, 1306, 1314, 1403, 1406, 1407 => .Quantum,
|
||||
1004, 1203, 1207, 1213, 1224, 1304, 1305, 1313, 1317, 1404, 8005, 8006 => .Imaginary,
|
||||
else => .None,
|
||||
};
|
||||
}
|
||||
fn getAttackerBuffId() u32 {
|
||||
const avatar_id = selectedAvatarID[Lineup.leader_slot];
|
||||
const element = getAvatarElement(avatar_id);
|
||||
return switch (element) {
|
||||
.Physical => 1000111,
|
||||
.Fire => 1000112,
|
||||
.Ice => 1000113,
|
||||
.Thunder => 1000114,
|
||||
.Wind => 1000115,
|
||||
.Quantum => 1000116,
|
||||
.Imaginary => 1000117,
|
||||
.None => 0,
|
||||
};
|
||||
}
|
||||
fn createBattleRelic(allocator: Allocator, id: u32, level: u32, main_affix_id: u32, stat1: u32, cnt1: u32, step1: u32, stat2: u32, cnt2: u32, step2: u32, stat3: u32, cnt3: u32, step3: u32, stat4: u32, cnt4: u32, step4: u32) !protocol.BattleRelic {
|
||||
var relic = protocol.BattleRelic{
|
||||
.id = id,
|
||||
|
@ -102,7 +140,7 @@ fn addTechniqueBuffs(allocator: Allocator, battle: *protocol.SceneBattleInfo, av
|
|||
.id = buffId,
|
||||
.level = 1,
|
||||
.owner_index = @intCast(avatar_index),
|
||||
.wave_flag = 1,
|
||||
.wave_flag = 0xFFFFFFFF,
|
||||
.target_index_list = targetIndexList,
|
||||
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
|
||||
};
|
||||
|
@ -116,7 +154,7 @@ fn addTechniqueBuffs(allocator: Allocator, battle: *protocol.SceneBattleInfo, av
|
|||
.id = 1000119, //for is_ignore toughness
|
||||
.level = 1,
|
||||
.owner_index = @intCast(avatar_index),
|
||||
.wave_flag = 1,
|
||||
.wave_flag = 0xFFFFFFFF,
|
||||
.target_index_list = targetIndexList,
|
||||
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
|
||||
};
|
||||
|
@ -129,7 +167,7 @@ fn addTechniqueBuffs(allocator: Allocator, battle: *protocol.SceneBattleInfo, av
|
|||
.id = 122401, //for hunt march 7th tech
|
||||
.level = 1,
|
||||
.owner_index = @intCast(avatar_index),
|
||||
.wave_flag = 1,
|
||||
.wave_flag = 0xFFFFFFFF,
|
||||
.target_index_list = targetIndexList,
|
||||
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
|
||||
};
|
||||
|
@ -145,7 +183,7 @@ fn addTechniqueBuffs(allocator: Allocator, battle: *protocol.SceneBattleInfo, av
|
|||
.id = 1000112, //for firefly tech
|
||||
.level = 1,
|
||||
.owner_index = @intCast(avatar_index),
|
||||
.wave_flag = 1,
|
||||
.wave_flag = 0xFFFFFFFF,
|
||||
.target_index_list = targetIndexList,
|
||||
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
|
||||
};
|
||||
|
@ -158,17 +196,43 @@ fn addTechniqueBuffs(allocator: Allocator, battle: *protocol.SceneBattleInfo, av
|
|||
.id = 800701, //for rmc tech
|
||||
.level = 1,
|
||||
.owner_index = @intCast(avatar_index),
|
||||
.wave_flag = 1,
|
||||
.wave_flag = 0xFFFFFFFF,
|
||||
.target_index_list = targetIndexList,
|
||||
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
|
||||
};
|
||||
try buff_rmc.dynamic_values.append(.{ .key = .{ .Const = "SkillIndex" }, .value = 0 });
|
||||
try battle.buff_list.append(buff_rmc);
|
||||
}
|
||||
|
||||
if (buffedAvatarId == 1412) {
|
||||
var buff_ce = protocol.BattleBuff{
|
||||
.id = 141201, //for cerydra core buff
|
||||
.level = 1,
|
||||
.owner_index = @intCast(avatar_index),
|
||||
.wave_flag = 0xFFFFFFFF,
|
||||
.target_index_list = targetIndexList,
|
||||
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
|
||||
};
|
||||
try buff_ce.dynamic_values.append(.{ .key = .{ .Const = "SkillIndex" }, .value = 0 });
|
||||
var buff_target = protocol.BattleBuff{
|
||||
.id = 141202, //for switch leader
|
||||
.level = 1,
|
||||
.owner_index = Lineup.leader_slot,
|
||||
.wave_flag = 0xFFFFFFFF,
|
||||
.target_index_list = targetIndexList,
|
||||
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
|
||||
};
|
||||
try buff_target.dynamic_values.appendSlice(&[_]protocol.BattleBuff.DynamicValuesEntry{
|
||||
.{ .key = .{ .Const = "1" }, .value = 1 },
|
||||
.{ .key = .{ .Const = "2" }, .value = 1 },
|
||||
});
|
||||
try battle.buff_list.append(buff_ce);
|
||||
try battle.buff_list.append(buff_target);
|
||||
}
|
||||
}
|
||||
|
||||
// Function to add future global buff.
|
||||
fn addGolbalPassive(allocator: Allocator, battle: *protocol.SceneBattleInfo, wave_flag: u32) !void {
|
||||
fn addGolbalPassive(allocator: Allocator, battle: *protocol.SceneBattleInfo) !void {
|
||||
if (isInList(1407, Data.AllAvatars)) { //support Castorice
|
||||
var targetIndexList = ArrayList(u32).init(allocator);
|
||||
try targetIndexList.append(0);
|
||||
|
@ -176,7 +240,7 @@ fn addGolbalPassive(allocator: Allocator, battle: *protocol.SceneBattleInfo, wav
|
|||
.id = 140703,
|
||||
.level = 1,
|
||||
.owner_index = 1,
|
||||
.wave_flag = wave_flag,
|
||||
.wave_flag = 0xFFFFFFFF,
|
||||
.target_index_list = targetIndexList,
|
||||
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
|
||||
};
|
||||
|
@ -184,6 +248,22 @@ fn addGolbalPassive(allocator: Allocator, battle: *protocol.SceneBattleInfo, wav
|
|||
try battle.buff_list.append(mazebuff_data);
|
||||
}
|
||||
}
|
||||
|
||||
// Function to add elemental hit when trigger battle .
|
||||
fn addTriggerAttack(allocator: Allocator, battle: *protocol.SceneBattleInfo) !void {
|
||||
var targetIndexList = ArrayList(u32).init(allocator);
|
||||
try targetIndexList.append(0);
|
||||
var attack = protocol.BattleBuff{
|
||||
.id = getAttackerBuffId(),
|
||||
.level = 1,
|
||||
.owner_index = Lineup.leader_slot,
|
||||
.wave_flag = 0xFFFFFFFF,
|
||||
.target_index_list = targetIndexList,
|
||||
.dynamic_values = ArrayList(protocol.BattleBuff.DynamicValuesEntry).init(allocator),
|
||||
};
|
||||
try attack.dynamic_values.append(.{ .key = .{ .Const = "SkillIndex" }, .value = 1 });
|
||||
try battle.buff_list.append(attack);
|
||||
}
|
||||
fn createBattleInfo(allocator: Allocator, config: Config.GameConfig, stage_monster_wave_len: u32, stage_id: u32, rounds_limit: u32) protocol.SceneBattleInfo {
|
||||
var battle = protocol.SceneBattleInfo.init(allocator);
|
||||
battle.battle_id = config.battle_config.battle_id;
|
||||
|
@ -292,8 +372,9 @@ pub const BattleManager = struct {
|
|||
break;
|
||||
}
|
||||
try addMonsterWaves(self.allocator, &battle, config.battle_config.monster_wave, config.battle_config.monster_level);
|
||||
try addTriggerAttack(self.allocator, &battle);
|
||||
try addStageBlessings(self.allocator, &battle, config.battle_config.blessings.items);
|
||||
try addGolbalPassive(self.allocator, &battle, @intCast(config.battle_config.monster_wave.items.len));
|
||||
try addGolbalPassive(self.allocator, &battle);
|
||||
try addBattleTargets(self.allocator, &battle);
|
||||
return battle;
|
||||
}
|
||||
|
@ -337,8 +418,9 @@ pub const ChallegeStageManager = struct {
|
|||
break;
|
||||
}
|
||||
try addMonsterWaves(self.allocator, &battle, stageConf.monster_list, stageConf.level);
|
||||
try addTriggerAttack(self.allocator, &battle);
|
||||
try addStageBlessings(self.allocator, &battle, ChallengeData.challenge_blessing);
|
||||
try addGolbalPassive(self.allocator, &battle, @intCast(stageConf.monster_list.items.len));
|
||||
try addGolbalPassive(self.allocator, &battle);
|
||||
try addBattleTargets(self.allocator, &battle);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ const BattleManager = @import("../manager/battle_mgr.zig");
|
|||
const Allocator = std.mem.Allocator;
|
||||
const CmdID = protocol.CmdID;
|
||||
|
||||
pub var leader_slot: u32 = 0;
|
||||
|
||||
pub fn onGetCurLineupData(session: *Session, _: *const Packet, allocator: Allocator) !void {
|
||||
var lineup_mgr = LineupManager.LineupManager.init(allocator);
|
||||
const lineup = try lineup_mgr.createLineup();
|
||||
|
@ -20,6 +22,7 @@ pub fn onGetCurLineupData(session: *Session, _: *const Packet, allocator: Alloca
|
|||
|
||||
pub fn onChangeLineupLeader(session: *Session, packet: *const Packet, allocator: Allocator) !void {
|
||||
const req = try packet.getProto(protocol.ChangeLineupLeaderCsReq, allocator);
|
||||
leader_slot = req.slot;
|
||||
try session.send(CmdID.CmdChangeLineupLeaderScRsp, protocol.ChangeLineupLeaderScRsp{
|
||||
.slot = req.slot,
|
||||
.retcode = 0,
|
||||
|
|
Loading…
Reference in a new issue