123 lines
5.6 KiB
C#
123 lines
5.6 KiB
C#
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;
|
||
/// <summary>
|
||
/// 为 true 时,进入活动主界面会执行一次 <see cref="EventBossFightManager.ApplyPendingFightBootstrapIfNeeded"/>(满血满 Boss、清复活等待等)。
|
||
/// 不在「玩家阵亡」时置位;无 IAP 回第一关见 <see cref="EventBossFightManager.ResetStageProgress"/>。
|
||
/// 存档字段名仍为 IsFirstOrFail 以兼容旧数据。
|
||
/// </summary>
|
||
[JsonProperty("IsFirstOrFail")]
|
||
public bool PendingFightBootstrap = true;
|
||
public bool IsShowGuide=true;
|
||
public bool IsShowTips=true;
|
||
public bool IsRest;
|
||
|
||
public int LastAttackDamage;
|
||
public bool HasPendingLastAttack;
|
||
|
||
/// <summary>本期活动内已成功付费复活次数,用于从 EventBossFightIapList 取下标。</summary>
|
||
public int BossFightPaidReviveCount;
|
||
|
||
/// <summary>已阵亡且等待付费复活(未点放弃),此时不重置关卡进度。</summary>
|
||
public bool BossFightAwaitingPaidRevive;
|
||
|
||
/// <summary>活动开始时根据体力与 <see cref="EventBossFightInit.TargetGroupByHook"/> 锁定的档位(<see cref="EventBossFightInit.StageGroupList"/> 下标)。</summary>
|
||
public int BossFightStageGroupIndex;
|
||
|
||
/// <summary>本活动周期是否已完成体力分档与关卡组锁定。</summary>
|
||
public bool BossFightStageGroupLocked;
|
||
|
||
/// <summary>锁档时玩家当前体力快照(仅记录)。</summary>
|
||
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);
|
||
|
||
/// <summary>本周期实际关卡 id 列表(分档成功为 <see cref="EventBossFightInit.StageGroupList"/> 中一组,否则为 <see cref="EventBossFightInit.StageList"/>)。</summary>
|
||
public IReadOnlyList<int> GetResolvedStageIdList()
|
||
{
|
||
var init = InitConfig;
|
||
if (init == null)
|
||
return Array.Empty<int>();
|
||
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<int>();
|
||
}
|
||
|
||
[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;
|
||
}
|
||
}
|
||
} |