mirror of
https://git.neonteam.dev/amizing/robinsr.git
synced 2025-03-12 03:28:30 -04:00
feat(battle): allow more than 4 avatar in battle
This commit is contained in:
parent
60651768d0
commit
88f3025333
@ -79,14 +79,10 @@ async fn create_battle_info() -> SceneBattleInfo {
|
||||
};
|
||||
|
||||
// avatars
|
||||
for i in 0..4 {
|
||||
let avatar_id = &player.lineups.get(&i).unwrap_or(&0);
|
||||
if **avatar_id == 0 {
|
||||
continue;
|
||||
}
|
||||
for (i, avatar_id) in player.lineups.iter() {
|
||||
if let Some(avatar) = player.avatars.get(avatar_id) {
|
||||
let (battle_avatar, techs) = avatar.to_battle_avatar_proto(
|
||||
i,
|
||||
*i,
|
||||
player
|
||||
.lightcones
|
||||
.iter()
|
||||
@ -108,7 +104,7 @@ async fn create_battle_info() -> SceneBattleInfo {
|
||||
id: 122401,
|
||||
level: 3,
|
||||
wave_flag: 0xffffffff,
|
||||
owner_id: i,
|
||||
owner_id: *i,
|
||||
dynamic_values: HashMap::from([
|
||||
(String::from("#ADF_1"), 3f32),
|
||||
(String::from("#ADF_2"), 3f32),
|
||||
|
||||
@ -35,7 +35,7 @@ pub async fn on_get_cur_lineup_data_cs_req(
|
||||
_body: &GetCurLineupDataCsReq,
|
||||
) -> Result<()> {
|
||||
let player = tools::FreesrData::load().await;
|
||||
let mut lineup = LineupInfo {
|
||||
let lineup = LineupInfo {
|
||||
extra_lineup_type: ExtraLineupType::LineupNone.into(),
|
||||
name: "Squad 1".to_string(),
|
||||
mp: 5,
|
||||
@ -46,27 +46,6 @@ pub async fn on_get_cur_lineup_data_cs_req(
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let avatar_ids = player
|
||||
.avatars
|
||||
.values()
|
||||
.map(|v| v.avatar_id)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let mut avatars = player
|
||||
.lineups
|
||||
.iter()
|
||||
.filter(|(_slot, v)| v > &&0 && avatar_ids.contains(v))
|
||||
.map(|(slot, avatar_id)| {
|
||||
player
|
||||
.avatars
|
||||
.get(avatar_id)
|
||||
.unwrap()
|
||||
.to_lineup_avatar_proto(*slot)
|
||||
})
|
||||
.collect::<Vec<LineupAvatar>>();
|
||||
|
||||
lineup.avatar_list.append(&mut avatars);
|
||||
|
||||
session
|
||||
.send(
|
||||
CMD_GET_CUR_LINEUP_DATA_SC_RSP,
|
||||
|
||||
@ -139,7 +139,7 @@ impl AvatarJson {
|
||||
player
|
||||
.lineups
|
||||
.iter()
|
||||
.filter(|(_slot, v)| v > &&0 && avatar_ids.contains(v))
|
||||
.filter(|(slot, v)| **slot < 4 && v > &&0 && avatar_ids.contains(v))
|
||||
.map(|(slot, avatar_id)| {
|
||||
player
|
||||
.avatars
|
||||
|
||||
Loading…
Reference in New Issue
Block a user