Fix: Lineup loading bug and story buff

This commit is contained in:
WatchAndyTW
2024-05-21 23:02:09 +08:00
parent 0c2690ec08
commit bdd6aa21ac
6 changed files with 22 additions and 29 deletions

View File

@@ -43,6 +43,12 @@ namespace EggLink.DanhengServer.Data.Excel
return StoryExcel != null;
}
public void SetStoryExcel(ChallengeStoryExtraExcel storyExcel)
{
StoryExcel = storyExcel;
ChallengeCountDown = storyExcel.TurnLimit;
}
public override void Loaded()
{
// Cache challenge monsters

View File

@@ -19,7 +19,7 @@
if (GameData.ChallengeConfigData.ContainsKey(ID))
{
var challengeExcel = GameData.ChallengeConfigData[ID];
challengeExcel.StoryExcel = this;
challengeExcel.SetStoryExcel(this);
}
}
}

View File

@@ -76,7 +76,7 @@ namespace EggLink.DanhengServer.Database.Challenge
public int Stars { get; set; }
public int ScoreStage1 { get; set; }
public int ScoreStage2 { get; set; }
public List<int>? StoryBuffs { get; set; }
public List<int>? BossBuffs { get; set; }
public List<int> StoryBuffs { get; set; } = [];
public List<int> BossBuffs { get; set; } = [];
}
}

View File

@@ -36,8 +36,8 @@ namespace EggLink.DanhengServer.Game.Challenge
[JsonIgnore]
ChallengeConfigExcel Excel { get; set; }
public List<int>? StoryBuffs { get; set; }
public List<int>? BossBuffs { get; set; }
public List<int> StoryBuffs { get; set; } = [];
public List<int> BossBuffs { get; set; } = [];
public ChallengeInstance(PlayerInstance player, ChallengeConfigExcel excel)
{
@@ -120,27 +120,6 @@ namespace EggLink.DanhengServer.Game.Challenge
#region Management
public void AddStoryBuff(int storyBuff)
{
// Add story buffs
if (StoryBuffs == null)
{
StoryBuffs = new List<int>();
}
StoryBuffs.Add(storyBuff);
}
public void AddBossBuff(int bossBuff)
{
if (BossBuffs == null)
{
BossBuffs = new List<int>();
}
BossBuffs.Add(bossBuff);
}
public void OnBattleStart(BattleInstance battle)
{
battle.RoundLimit = RoundsLeft;
@@ -200,7 +179,11 @@ namespace EggLink.DanhengServer.Game.Challenge
ExtraLineupType = (ExtraLineupType)CurrentExtraLineup
};
// TODO: story buffs
if (StoryBuffs != null && StoryBuffs.Count >= (CurrentStage - 1))
{
proto.PlayerInfo = new ChallengeStoryInfo() { CurStoryBuff = new ChallengeStoryBuffInfo() { } };
proto.PlayerInfo.CurStoryBuff.BuffList.Add((uint)StoryBuffs[CurrentStage - 1]);
}
return proto;
}

View File

@@ -101,8 +101,8 @@ namespace EggLink.DanhengServer.Game.Challenge
if (Excel.IsStory() && storyBuffs != null)
{
instance.AddStoryBuff((int)storyBuffs.AKEOMNPOJCE);
instance.AddStoryBuff((int)storyBuffs.GPPEGLNNGNJ);
instance.StoryBuffs.Add((int)storyBuffs.GPPEGLNNGNJ); // StoryBuffOne
instance.StoryBuffs.Add((int)storyBuffs.AKEOMNPOJCE); // StoryBuffTwo
}
// Early implementation for 2.3

View File

@@ -296,6 +296,10 @@ namespace EggLink.DanhengServer.Game.Lineup
if (req.ExtraLineupType != Proto.ExtraLineupType.LineupNone)
{
LineupData.CurExtraLineup = (int)req.ExtraLineupType + 10;
if (!LineupData.Lineups.ContainsKey(LineupData.CurExtraLineup))
{
SetExtraLineup(req.ExtraLineupType, []);
}
}
LineupInfo lineup;