using System; using System.Collections.Generic; using cfg; using game; using Newtonsoft.Json; namespace EventBossFight { public class EventBossFightData:AEventData { public long BossAttackTime; public int StageCountFrom1=1; public int RoundCountFrom1=1; public int BossRemainHp; public int PlayerRemainHp; public int PlayerHpBeforeLastAttack; public int PlayerShieldCount; public int PlayerShieldBeforeLastAttack; /// /// 为 true 时,进入活动主界面会执行一次 (满血满 Boss、清复活等待等)。 /// 不在「玩家阵亡」时置位;无 IAP 回第一关见 。 /// 存档字段名仍为 IsFirstOrFail 以兼容旧数据。 /// [JsonProperty("IsFirstOrFail")] public bool PendingFightBootstrap = true; public bool IsShowGuide=true; public bool IsShowTips=true; public bool IsRest; public int LastAttackDamage; public bool HasPendingLastAttack; /// 本期活动内已成功付费复活次数,用于从 EventBossFightIapList 取下标。 public int BossFightPaidReviveCount; /// 已阵亡且等待付费复活(未点放弃),此时不重置关卡进度。 public bool BossFightAwaitingPaidRevive; /// 活动开始时根据体力与 锁定的档位( 下标)。 public int BossFightStageGroupIndex; /// 本活动周期是否已完成体力分档与关卡组锁定。 public bool BossFightStageGroupLocked; /// 锁档时玩家当前体力快照(仅记录)。 public int BossFightHookEnergySnapshot; [JsonIgnore]public int PlayerShowHp=>PlayerHpBeforeLastAttack>0?PlayerHpBeforeLastAttack:PlayerRemainHp; [JsonIgnore]public int PlayerShowShield=>PlayerShieldBeforeLastAttack>0?PlayerShieldBeforeLastAttack:PlayerShieldCount; [JsonIgnore] public int Magnification=1; [JsonIgnore] public EventBossFightInit InitConfig => Tables.TbEventBossFightInit.GetOrDefault(CycleItem.RedirectID); /// 本周期实际关卡 id 列表(分档成功为 中一组,否则为 )。 public IReadOnlyList GetResolvedStageIdList() { var init = InitConfig; if (init == null) return Array.Empty(); if (BossFightStageGroupLocked && init.StageGroupList != null && init.StageGroupList.Count > 0 && BossFightStageGroupIndex >= 0 && BossFightStageGroupIndex < init.StageGroupList.Count) { var grp = init.StageGroupList[BossFightStageGroupIndex]; if (grp != null && grp.Count > 0) return grp; } return init.StageList != null && init.StageList.Count > 0 ? init.StageList : Array.Empty(); } [JsonIgnore] public EventBossFightStage StageConfig { get { var list = GetResolvedStageIdList(); if (list.Count == 0 || StageCountFrom1 < 1 || StageCountFrom1 > list.Count) return Tables.TbEventBossFightStage.GetOrDefault(0); return Tables.TbEventBossFightStage.GetOrDefault(list[StageCountFrom1 - 1]); } } [JsonIgnore] public bool IsLastStage { get { var n = GetResolvedStageIdList().Count; return n > 0 && StageCountFrom1 == n; } } public override void SetData(IEventData data) { base.SetData(data); if (data is not EventBossFightData eventBossFightData) return; IsRest = eventBossFightData.IsRest; PendingFightBootstrap = eventBossFightData.PendingFightBootstrap; IsShowGuide=eventBossFightData.IsShowGuide; BossRemainHp = eventBossFightData.BossRemainHp; InflationRate = eventBossFightData.InflationRate; BossAttackTime = eventBossFightData.BossAttackTime; PlayerRemainHp = eventBossFightData.PlayerRemainHp; StageCountFrom1 = eventBossFightData.StageCountFrom1; RoundCountFrom1 = eventBossFightData.RoundCountFrom1; PlayerShieldCount = eventBossFightData.PlayerShieldCount; // 致命攻击相关字段 LastAttackDamage = eventBossFightData.LastAttackDamage; HasPendingLastAttack = eventBossFightData.HasPendingLastAttack; IsShowTips=eventBossFightData.IsShowTips; PlayerHpBeforeLastAttack=eventBossFightData.PlayerHpBeforeLastAttack; PlayerShieldBeforeLastAttack=eventBossFightData.PlayerShieldBeforeLastAttack; BossFightPaidReviveCount = eventBossFightData.BossFightPaidReviveCount; BossFightAwaitingPaidRevive = eventBossFightData.BossFightAwaitingPaidRevive; BossFightStageGroupIndex = eventBossFightData.BossFightStageGroupIndex; BossFightStageGroupLocked = eventBossFightData.BossFightStageGroupLocked; BossFightHookEnergySnapshot = eventBossFightData.BossFightHookEnergySnapshot; } } }