using System;
using System.Collections.Generic;
using cfg;
using Activity;
using Newtonsoft.Json;
namespace Event1v1Battle.Data
{
///
/// 1v1扇耳光大赛活动数据
///
public class Event1v1BattleSlapData : AEventData
{
#region 关卡进度
///
/// 历史关卡数据,id,胜利or失败
///
public Dictionary StageHistory=new Dictionary();
///
/// 当前关卡ID
///
public int CurrentStageID;
///
/// 当前轮次
///
public int CurrentRoundForm1 = 1;
///
/// 玩家剩余命数(新轮次重置为3)
///
public int PlayerLifeCount = 3;
///
/// 本轮内已成功付费复活次数;用于从 GlobalConfig.EventSlapIapList 取下标(第6次及以后用第5个 id)
///
public int SlapPaidReviveCount;
public bool IsOnGoing;
#endregion
#region 战斗状态
///
/// 玩家当前HP(进入关卡时初始化)
///
public int PlayerHp;
///
/// NPC当前HP
///
public int NpcHp;
///
/// 最大HP
///
public int MaxHp;
///
/// NPC名称
///
public string NpcName;
///
/// npc 头像
///
public string NpcIcon;
///
/// 下次NPC攻击时间戳(Unix时间戳,秒)
///
public long NextAttackTime = 0;
///
/// 战斗开始时间戳(Unix时间戳,秒),用于30分钟倒计时
///
public long BattleStartTime = 0;
///
/// 需要发奖的关卡id
///
public int needSendRewardStageID;
#endregion
#region Free Pack
public bool IsClaimedFreePack;
#endregion
#region 配置引用
[JsonIgnore]
public EventSlapInit InitConfig =>
Tables.TbEventSlapInit.GetOrDefault(FishingEvent?.RedirectID??0);
[JsonIgnore]
public EventSlapStage StageConfig =>
Tables.TbEventSlapStage.GetOrDefault(CurrentStageID);
#endregion
#region 状态判断
///
/// 是否有剩余生命
///
[JsonIgnore]
public bool HasLifeRemaining => PlayerLifeCount > 0;
///
/// 是否是第八关(最后一关)
///
[JsonIgnore]
public bool IsFinalStage => StageConfig.NextStage == InitConfig.InitialStage;
[JsonIgnore] public bool IsNeedSendReward => needSendRewardStageID > 0;
///
/// 是否需要开始新轮次
///
public bool ShouldStartNewRound()
{
// 条件1: 第八关结束(胜利或失败)
if (IsFinalStage && (PlayerHp <= 0 || NpcHp <= 0))
return true;
// 条件2: 三条命耗尽
return !HasLifeRemaining;
}
#endregion
}
}