352 lines
10 KiB
C#
352 lines
10 KiB
C#
/*
|
||
* @Author: 白哉
|
||
* @Description:
|
||
* @Date: 2025年09月05日 星期五 15:09:36
|
||
* @Modify:
|
||
*/
|
||
|
||
|
||
using Logic;
|
||
using MemoryPack;
|
||
using RuntimeData;
|
||
|
||
|
||
namespace TH1_Logic.HeroTask
|
||
{
|
||
public enum HeroTaskContentType
|
||
{
|
||
// 累计承受伤害
|
||
AccumulateDamageTaken,
|
||
// 累计造成伤害
|
||
AccumulateDamageDealt,
|
||
// 累计杀人
|
||
AccumulateKills,
|
||
// 累计产生(自身或他人)治疗
|
||
AccumulateHealing,
|
||
// 累计开启遗迹
|
||
AccumulateRelicsOpened,
|
||
// 累计探索新地块
|
||
AccumulateAreasExplored,
|
||
// 累计占领新城市
|
||
AccumulateCitiesCaptured,
|
||
// 单位X 给任何单位增加N次技能A的层数,X的该计数+N
|
||
AddSkillStacks,
|
||
// 单位X 的技能A 生效时(接口,技能自定义),则该计数变化(技能自定义)
|
||
SkillActivation,
|
||
// 累计获得金钱(目前是tewi专用)
|
||
TewiAddCoin
|
||
}
|
||
|
||
|
||
[MemoryPackable]
|
||
[MemoryPackUnion(1, typeof(HeroTaskContentAccumulateDamageTaken))]
|
||
[MemoryPackUnion(2, typeof(HeroTaskContentAccumulateDamageDealt))]
|
||
[MemoryPackUnion(3, typeof(HeroTaskContentAccumulateKills))]
|
||
[MemoryPackUnion(4, typeof(HeroTaskContentAccumulateHealing))]
|
||
[MemoryPackUnion(5, typeof(HeroTaskContentAccumulateRelicsOpened))]
|
||
[MemoryPackUnion(6, typeof(HeroTaskContentAccumulateAreasExplored))]
|
||
[MemoryPackUnion(7, typeof(HeroTaskContentAccumulateCitiesCaptured))]
|
||
[MemoryPackUnion(8, typeof(HeroTaskContentAddSkillStacks))]
|
||
[MemoryPackUnion(9, typeof(HeroTaskContentSkillActivation))]
|
||
[MemoryPackUnion(10, typeof(HeroTaskContentTewiAddCoin))]
|
||
public abstract partial class HeroTaskContentBase
|
||
{
|
||
public uint Level;
|
||
public uint TargetLevel;
|
||
public SkillType SkillType;
|
||
public abstract HeroTaskContentType GetContentType();
|
||
|
||
|
||
[MemoryPackConstructor]
|
||
public HeroTaskContentBase()
|
||
{
|
||
Level = 0;
|
||
TargetLevel = 1;
|
||
}
|
||
|
||
public abstract HeroTaskContentBase GetCopyHeroTaskContent();
|
||
|
||
public virtual bool CheckFinished()
|
||
{
|
||
return Level >= TargetLevel;
|
||
}
|
||
|
||
public virtual void OnCoinAdd(MapData mapData, uint value)
|
||
{
|
||
|
||
}
|
||
|
||
public virtual void OnDamageOther(MapData mapData, SettlementInfo info)
|
||
{
|
||
|
||
}
|
||
|
||
public virtual void OnDamaged(MapData mapData, SettlementInfo info)
|
||
{
|
||
|
||
}
|
||
|
||
public virtual void OnHealthReturn(MapData mapData, int value)
|
||
{
|
||
|
||
}
|
||
|
||
public virtual void OnTreasure(MapData mapData)
|
||
{
|
||
|
||
}
|
||
|
||
public virtual void OnCaptureCity(MapData mapData)
|
||
{
|
||
|
||
}
|
||
|
||
public virtual void OnExploredGrids(MapData mapData, int count)
|
||
{
|
||
|
||
}
|
||
|
||
public virtual void OnAddSkillLevels(MapData mapData, SkillType skillType, uint addLevels)
|
||
{
|
||
|
||
}
|
||
|
||
public virtual void OnSkillActivation(MapData mapData, SkillType skillType, uint addLevels)
|
||
{
|
||
|
||
}
|
||
}
|
||
|
||
|
||
[MemoryPackable]
|
||
public partial class HeroTaskContentAccumulateDamageTaken : HeroTaskContentBase
|
||
{
|
||
public override HeroTaskContentType GetContentType()
|
||
{
|
||
return HeroTaskContentType.AccumulateDamageTaken;
|
||
}
|
||
|
||
public override HeroTaskContentBase GetCopyHeroTaskContent()
|
||
{
|
||
var newContent = new HeroTaskContentAccumulateDamageTaken();
|
||
newContent.Level = Level;
|
||
newContent.TargetLevel = TargetLevel;
|
||
return newContent;
|
||
}
|
||
|
||
public override void OnDamaged(MapData mapData, SettlementInfo info)
|
||
{
|
||
Level += (uint)info.DamageValue;
|
||
}
|
||
}
|
||
|
||
|
||
[MemoryPackable]
|
||
public partial class HeroTaskContentAccumulateDamageDealt : HeroTaskContentBase
|
||
{
|
||
public override HeroTaskContentType GetContentType()
|
||
{
|
||
return HeroTaskContentType.AccumulateDamageDealt;
|
||
}
|
||
|
||
public override HeroTaskContentBase GetCopyHeroTaskContent()
|
||
{
|
||
var newContent = new HeroTaskContentAccumulateDamageDealt();
|
||
newContent.Level = Level;
|
||
newContent.TargetLevel = TargetLevel;
|
||
return newContent;
|
||
}
|
||
|
||
public override void OnDamageOther(MapData mapData, SettlementInfo info)
|
||
{
|
||
Level += (uint)info.DamageValue;
|
||
}
|
||
}
|
||
|
||
|
||
[MemoryPackable]
|
||
public partial class HeroTaskContentAccumulateKills : HeroTaskContentBase
|
||
{
|
||
public override HeroTaskContentType GetContentType()
|
||
{
|
||
return HeroTaskContentType.AccumulateKills;
|
||
}
|
||
|
||
public override HeroTaskContentBase GetCopyHeroTaskContent()
|
||
{
|
||
var newContent = new HeroTaskContentAccumulateKills();
|
||
newContent.Level = Level;
|
||
newContent.TargetLevel = TargetLevel;
|
||
return newContent;
|
||
}
|
||
|
||
public override void OnDamageOther(MapData mapData, SettlementInfo info)
|
||
{
|
||
if (info.IsKill && info.DamageType != DamageType.KillSelf) Level++;
|
||
}
|
||
}
|
||
|
||
|
||
[MemoryPackable]
|
||
public partial class HeroTaskContentAccumulateHealing : HeroTaskContentBase
|
||
{
|
||
public override HeroTaskContentType GetContentType()
|
||
{
|
||
return HeroTaskContentType.AccumulateHealing;
|
||
}
|
||
|
||
public override HeroTaskContentBase GetCopyHeroTaskContent()
|
||
{
|
||
var newContent = new HeroTaskContentAccumulateHealing();
|
||
newContent.Level = Level;
|
||
newContent.TargetLevel = TargetLevel;
|
||
return newContent;
|
||
}
|
||
|
||
public override void OnHealthReturn(MapData mapData, int value)
|
||
{
|
||
Level += (uint)value;
|
||
}
|
||
}
|
||
|
||
|
||
[MemoryPackable]
|
||
public partial class HeroTaskContentAccumulateRelicsOpened : HeroTaskContentBase
|
||
{
|
||
public override HeroTaskContentType GetContentType()
|
||
{
|
||
return HeroTaskContentType.AccumulateRelicsOpened;
|
||
}
|
||
|
||
public override HeroTaskContentBase GetCopyHeroTaskContent()
|
||
{
|
||
var newContent = new HeroTaskContentAccumulateRelicsOpened();
|
||
newContent.Level = Level;
|
||
newContent.TargetLevel = TargetLevel;
|
||
return newContent;
|
||
}
|
||
|
||
public override void OnTreasure(MapData mapData)
|
||
{
|
||
Level++;
|
||
}
|
||
}
|
||
|
||
|
||
[MemoryPackable]
|
||
public partial class HeroTaskContentAccumulateAreasExplored : HeroTaskContentBase
|
||
{
|
||
public override HeroTaskContentType GetContentType()
|
||
{
|
||
return HeroTaskContentType.AccumulateAreasExplored;
|
||
}
|
||
|
||
public override HeroTaskContentBase GetCopyHeroTaskContent()
|
||
{
|
||
var newContent = new HeroTaskContentAccumulateAreasExplored();
|
||
newContent.Level = Level;
|
||
newContent.TargetLevel = TargetLevel;
|
||
return newContent;
|
||
}
|
||
|
||
public override void OnExploredGrids(MapData mapData, int count)
|
||
{
|
||
Level += (uint)count;
|
||
}
|
||
}
|
||
|
||
|
||
[MemoryPackable]
|
||
public partial class HeroTaskContentAccumulateCitiesCaptured : HeroTaskContentBase
|
||
{
|
||
public override HeroTaskContentType GetContentType()
|
||
{
|
||
return HeroTaskContentType.AccumulateCitiesCaptured;
|
||
}
|
||
|
||
public override HeroTaskContentBase GetCopyHeroTaskContent()
|
||
{
|
||
var newContent = new HeroTaskContentAccumulateCitiesCaptured();
|
||
newContent.Level = Level;
|
||
newContent.TargetLevel = TargetLevel;
|
||
return newContent;
|
||
}
|
||
|
||
public override void OnCaptureCity(MapData mapData)
|
||
{
|
||
Level++;
|
||
}
|
||
}
|
||
|
||
|
||
[MemoryPackable]
|
||
public partial class HeroTaskContentAddSkillStacks : HeroTaskContentBase
|
||
{
|
||
public override HeroTaskContentType GetContentType()
|
||
{
|
||
return HeroTaskContentType.AddSkillStacks;
|
||
}
|
||
|
||
public override HeroTaskContentBase GetCopyHeroTaskContent()
|
||
{
|
||
var newContent = new HeroTaskContentAddSkillStacks();
|
||
newContent.Level = Level;
|
||
newContent.TargetLevel = TargetLevel;
|
||
newContent.SkillType = SkillType;
|
||
return newContent;
|
||
}
|
||
|
||
public virtual void OnAddSkillLevels(MapData mapData, SkillType skillType, uint addLevels)
|
||
{
|
||
if (skillType != SkillType) return;
|
||
Level += addLevels;
|
||
}
|
||
}
|
||
|
||
|
||
[MemoryPackable]
|
||
public partial class HeroTaskContentSkillActivation : HeroTaskContentBase
|
||
{
|
||
public override HeroTaskContentBase GetCopyHeroTaskContent()
|
||
{
|
||
var newContent = new HeroTaskContentSkillActivation();
|
||
newContent.Level = Level;
|
||
newContent.TargetLevel = TargetLevel;
|
||
newContent.SkillType = SkillType;
|
||
return newContent;
|
||
}
|
||
|
||
public override HeroTaskContentType GetContentType()
|
||
{
|
||
return HeroTaskContentType.SkillActivation;
|
||
}
|
||
|
||
public virtual void OnSkillActivation(MapData mapData, SkillType skillType, uint addLevels)
|
||
{
|
||
if (skillType != SkillType) return;
|
||
Level += addLevels;
|
||
}
|
||
}
|
||
[MemoryPackable]
|
||
public partial class HeroTaskContentTewiAddCoin : HeroTaskContentBase
|
||
{
|
||
public override HeroTaskContentType GetContentType()
|
||
{
|
||
return HeroTaskContentType.TewiAddCoin;
|
||
}
|
||
|
||
public override HeroTaskContentBase GetCopyHeroTaskContent()
|
||
{
|
||
var newContent = new HeroTaskContentTewiAddCoin();
|
||
newContent.Level = Level;
|
||
newContent.TargetLevel = TargetLevel;
|
||
newContent.SkillType = SkillType;
|
||
return newContent;
|
||
}
|
||
|
||
public override void OnCoinAdd(MapData mapData, uint value)
|
||
{
|
||
Level += value;
|
||
}
|
||
}
|
||
} |