431 lines
13 KiB
C#
431 lines
13 KiB
C#
/*
|
|
* @Author: 白哉
|
|
* @Description: 技能类
|
|
* @Date: 2025年04月22日 星期二 17:04:44
|
|
* @Modify:
|
|
*/
|
|
|
|
|
|
using System;
|
|
using MemoryPack;
|
|
using RuntimeData;
|
|
using UnityEngine;
|
|
|
|
namespace Logic.Skill
|
|
{
|
|
public enum SkillDamageEvent
|
|
{
|
|
ActiveAttackBeforeStarted,
|
|
ActiveAttackFinished,
|
|
}
|
|
|
|
|
|
public interface ISkill
|
|
{
|
|
public SkillType GetSkillType();
|
|
|
|
// 事件触发生命周期 (事件已发生)
|
|
public void OnMove(UnitData self, GridData grid, MapData mapData, MoveType moveType);
|
|
// 伤害结算时
|
|
public void OnDamaged(MapData mapData, SettlementInfo info);
|
|
// 对他人伤害结算时
|
|
public void OnDamageOther(MapData mapData, SettlementInfo info);
|
|
|
|
// 事件触发生命周期 (时刻)
|
|
public void OnTurnStart(UnitData self, MapData mapData);
|
|
public void OnTurnStart(CityData city, MapData mapData);
|
|
public void OnTurnStart(PlayerData self, MapData mapData);
|
|
public void OnTurnStart(GridData self, MapData mapData);
|
|
public void OnTurnEnd(UnitData self, MapData mapData);
|
|
public void OnTurnEnd(CityData city, MapData mapData);
|
|
public void OnTurnEnd(PlayerData self, MapData mapData);
|
|
public void OnTurnEnd(GridData self, MapData mapData);
|
|
|
|
// 属性变化
|
|
// 是否限制自身移动
|
|
public bool IsLimitSelfMove(UnitData self, MapData mapData);
|
|
|
|
// 是否限制自身攻击
|
|
public bool IsLimitSelfAttack(UnitData self, MapData mapData);
|
|
|
|
// 是否限制敌方反击
|
|
public bool IsLimitTargetCounterAttack(UnitData self, MapData mapData);
|
|
|
|
// 是否限制自身反击
|
|
public bool IsLimitSelfCounterAttack(UnitData self, MapData mapData);
|
|
|
|
// 是否无视敌人控制区
|
|
public bool IsIgnoreControlArea(UnitData self, MapData mapData);
|
|
|
|
// 是否限制自身经验增长
|
|
public bool IsLimitSelfExp(UnitData self, MapData mapData);
|
|
|
|
// 是否无视树林和山脉
|
|
public bool IsIgnoreWoodAndMountains(UnitData self, MapData mapData);
|
|
|
|
// 是否能在指定海陆层移动
|
|
public bool IsCanMoveOnTerrain(UnitData self, MapData mapData, TerrainType terrainType);
|
|
|
|
// 是否能在指定地形层移动
|
|
public bool IsCanMoveOnFeature(UnitData self, MapData mapData, TerrainFeature featureType);
|
|
|
|
// 是否无视地形层移动减损
|
|
public bool IsIgnoreMoveLoss(UnitData self, MapData mapData, TerrainFeature terrainType);
|
|
|
|
// 是否无视植被层移动减损
|
|
public bool IsIgnoreMoveLoss(UnitData self, MapData mapData, Vegetation terrainType);
|
|
|
|
// 是否具备同类数量限制
|
|
public bool IsLimitCount(UnitData self, MapData mapData, out int count);
|
|
|
|
// 是否能移动到我方的无人城市
|
|
public bool IsCanMoveToNoUnitSelfCity(UnitData self, MapData mapData);
|
|
|
|
public bool IsCanMoveGiantNearbyGrid(UnitData self, MapData mapData);
|
|
|
|
// 能否被杀死
|
|
public bool IsCanBeKill(UnitData self, MapData mapData);
|
|
|
|
// 能否被伤害
|
|
public bool IsCanBeDamaged(UnitData self, MapData mapData, int dmg);
|
|
|
|
// 能否制造矿山
|
|
public bool IsCanBuildMine(UnitData self, MapData mapData);
|
|
|
|
// 是否隐身
|
|
public bool IsInvisible(UnitData self, MapData mapData);
|
|
|
|
|
|
// 值变化
|
|
// 获取额外防御(防御系数)
|
|
public float GetExtraDefense(UnitData self, MapData mapData);
|
|
|
|
// 获取额外视野(视野增加)
|
|
public int GetExtraSight(UnitData self, MapData mapData);
|
|
|
|
// 获得额外攻击
|
|
public float GetExtraAttack(UnitData self, MapData mapData);
|
|
|
|
// 获取暴击率
|
|
public float GetCriticalHitRate(UnitData self, MapData mapData);
|
|
|
|
|
|
// 全局技能
|
|
// 当有单位受伤结算时
|
|
public void OnUnitDamaged(IdentifierBase identifier, MapData mapData, SettlementInfo info);
|
|
|
|
|
|
// 当有单位移动时
|
|
public void OnOtherUnitMove(IdentifierBase identifier, UnitData moveUnit, GridData target, MapData mapData);
|
|
}
|
|
|
|
|
|
[MemoryPackable]
|
|
[MemoryPackUnion(1, typeof(AllYCounterSkill))]
|
|
[MemoryPackUnion(2, typeof(AllYTranSportSkill))]
|
|
[MemoryPackUnion(3, typeof(AutoHealSkill))]
|
|
[MemoryPackUnion(4, typeof(CarrySkill))]
|
|
[MemoryPackUnion(5, typeof(CatCartSkill))]
|
|
[MemoryPackUnion(6, typeof(CityTransportSkill))]
|
|
[MemoryPackUnion(7, typeof(ConvertSkill))]
|
|
[MemoryPackUnion(8, typeof(CreepSkill))]
|
|
[MemoryPackUnion(9, typeof(CriticalSkill))]
|
|
[MemoryPackUnion(10, typeof(CurseGodSkill))]
|
|
[MemoryPackUnion(11, typeof(DashSkill))]
|
|
[MemoryPackUnion(12, typeof(DuoSkill))]
|
|
[MemoryPackUnion(13, typeof(EscapeSkill))]
|
|
[MemoryPackUnion(14, typeof(EternitySkill))]
|
|
[MemoryPackUnion(15, typeof(ForestDefenseSkill))]
|
|
[MemoryPackUnion(16, typeof(FortifySkill))]
|
|
[MemoryPackUnion(17, typeof(GalaxyArrowSkill))]
|
|
[MemoryPackUnion(18, typeof(HealSkill))]
|
|
[MemoryPackUnion(19, typeof(IllusionSkill))]
|
|
[MemoryPackUnion(20, typeof(LaevatainPreySkill))]
|
|
[MemoryPackUnion(21, typeof(LaevatainSkill))]
|
|
[MemoryPackUnion(22, typeof(LuckSkill))]
|
|
[MemoryPackUnion(23, typeof(MoonPrincessSkill))]
|
|
[MemoryPackUnion(24, typeof(MountainDefenseSkill))]
|
|
[MemoryPackUnion(25, typeof(MountainGodSkill))]
|
|
[MemoryPackUnion(26, typeof(MountainMoveSkill))]
|
|
[MemoryPackUnion(27, typeof(NuclearFusionSkill))]
|
|
[MemoryPackUnion(28, typeof(NuclearSkill))]
|
|
[MemoryPackUnion(29, typeof(OceanDefenseSkill))]
|
|
[MemoryPackUnion(30, typeof(OceanMoveSkill))]
|
|
[MemoryPackUnion(31, typeof(PeaceSkill))]
|
|
[MemoryPackUnion(32, typeof(PersistSkill))]
|
|
[MemoryPackUnion(33, typeof(PhilostoneSkill))]
|
|
[MemoryPackUnion(34, typeof(PhoenixEggSkill))]
|
|
[MemoryPackUnion(35, typeof(PhoenixSkill))]
|
|
[MemoryPackUnion(36, typeof(PoisonedSkill))]
|
|
[MemoryPackUnion(37, typeof(PoorHealthSkill))]
|
|
[MemoryPackUnion(38, typeof(PowerUpSkill))]
|
|
[MemoryPackUnion(39, typeof(QuartetSkill))]
|
|
[MemoryPackUnion(40, typeof(RecycleSkill))]
|
|
[MemoryPackUnion(41, typeof(RengesyouControSkill))]
|
|
[MemoryPackUnion(42, typeof(RengesyouSkill))]
|
|
[MemoryPackUnion(43, typeof(RotaLFlamesProSkill))]
|
|
[MemoryPackUnion(44, typeof(RotaLFlamesSkill))]
|
|
[MemoryPackUnion(45, typeof(SatsujinkiSkill))]
|
|
[MemoryPackUnion(46, typeof(ScoutSkill))]
|
|
[MemoryPackUnion(47, typeof(SneakSkill))]
|
|
[MemoryPackUnion(48, typeof(SpeedUpSkill))]
|
|
[MemoryPackUnion(49, typeof(SplashSkill))]
|
|
[MemoryPackUnion(50, typeof(StaticSkill))]
|
|
[MemoryPackUnion(51, typeof(StiffSkill))]
|
|
[MemoryPackUnion(52, typeof(StompSkill))]
|
|
[MemoryPackUnion(53, typeof(SuperDashSkill))]
|
|
[MemoryPackUnion(54, typeof(SuperHideSkill))]
|
|
[MemoryPackUnion(55, typeof(SurpriseSkill))]
|
|
[MemoryPackUnion(56, typeof(SwapSkill))]
|
|
[MemoryPackUnion(57, typeof(TaiChiSkill))]
|
|
[MemoryPackUnion(58, typeof(ThirdEyeSkill))]
|
|
[MemoryPackUnion(59, typeof(TrioSkill))]
|
|
[MemoryPackUnion(60, typeof(UniqueSkill))]
|
|
[MemoryPackUnion(61, typeof(VampireProSkill))]
|
|
[MemoryPackUnion(62, typeof(VampireSkill))]
|
|
[MemoryPackUnion(63, typeof(WaterDefenseSkill))]
|
|
[MemoryPackUnion(64, typeof(WaterMoveSkill))]
|
|
[MemoryPackUnion(65, typeof(WindGodSkill))]
|
|
[MemoryPackUnion(66, typeof(WindPriestessSkill))]
|
|
public abstract partial class SkillBase : ISkill
|
|
{
|
|
[MemoryPackInclude]
|
|
protected bool IsPermanent;
|
|
[MemoryPackInclude]
|
|
protected uint Turns;
|
|
[MemoryPackInclude]
|
|
protected uint TurnsLimit;
|
|
[MemoryPackInclude]
|
|
protected float Score;
|
|
[MemoryPackInclude]
|
|
public int Level;
|
|
|
|
|
|
[MemoryPackConstructor]
|
|
public SkillBase()
|
|
{
|
|
Turns = 0;
|
|
Level = 0;
|
|
}
|
|
|
|
public abstract SkillType GetSkillType();
|
|
|
|
public virtual float GetScore()
|
|
{
|
|
return Score;
|
|
}
|
|
|
|
public virtual bool IsFinished()
|
|
{
|
|
Turns++;
|
|
return !IsPermanent && TurnsLimit < Turns;
|
|
}
|
|
|
|
public SkillBase GetCopySkill()
|
|
{
|
|
var skill = SkillFactory.GetSkillBySkillType(GetSkillType());
|
|
GetSkillCopy(skill);
|
|
return skill;
|
|
}
|
|
|
|
public virtual void GetSkillCopy(SkillBase skill)
|
|
{
|
|
skill.IsPermanent = IsPermanent;
|
|
skill.Turns = Turns;
|
|
skill.TurnsLimit = TurnsLimit;
|
|
skill.Score = Score;
|
|
}
|
|
|
|
public virtual void DeepCopy(SkillBase copySkill)
|
|
{
|
|
IsPermanent = copySkill.IsPermanent;
|
|
Turns = copySkill.Turns;
|
|
TurnsLimit = copySkill.TurnsLimit;
|
|
}
|
|
|
|
public virtual void OnMove(UnitData self, GridData grid, MapData mapData,MoveType moveType)
|
|
{
|
|
|
|
}
|
|
|
|
public virtual void OnDamaged(MapData mapData, SettlementInfo info)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
public virtual void OnTransformRemoved(UnitData self, MapData mapData)
|
|
{
|
|
}
|
|
|
|
public virtual void OnTransformAdded(UnitData self, MapData mapData)
|
|
{
|
|
|
|
}
|
|
public virtual void OnDamageOther(MapData mapData, SettlementInfo info)
|
|
{
|
|
|
|
}
|
|
|
|
public virtual void OnTurnStart(UnitData self, MapData mapData)
|
|
{
|
|
|
|
}
|
|
|
|
public virtual void OnTurnStart(GridData self, MapData mapData)
|
|
{
|
|
|
|
}
|
|
|
|
public virtual void OnTurnStart(CityData city, MapData mapData)
|
|
{
|
|
|
|
}
|
|
|
|
public virtual void OnTurnStart(PlayerData self, MapData mapData)
|
|
{
|
|
|
|
}
|
|
|
|
public virtual void OnTurnEnd(UnitData self, MapData mapData)
|
|
{
|
|
|
|
}
|
|
|
|
public virtual void OnTurnEnd(CityData city, MapData mapData)
|
|
{
|
|
|
|
}
|
|
|
|
public virtual void OnTurnEnd(PlayerData self, MapData mapData)
|
|
{
|
|
|
|
}
|
|
|
|
public virtual void OnTurnEnd(GridData self, MapData mapData)
|
|
{
|
|
|
|
}
|
|
|
|
public virtual bool IsLimitSelfMove(UnitData self, MapData mapData)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsLimitSelfAttack(UnitData self, MapData mapData)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsLimitTargetCounterAttack(UnitData self, MapData mapData)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsLimitSelfCounterAttack(UnitData self, MapData mapData)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsIgnoreControlArea(UnitData self, MapData mapData)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsLimitSelfExp(UnitData self, MapData mapData)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsIgnoreWoodAndMountains(UnitData self, MapData mapData)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsCanMoveOnTerrain(UnitData self, MapData mapData, TerrainType terrainType)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsCanMoveOnFeature(UnitData self, MapData mapData, TerrainFeature terrainType)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsIgnoreMoveLoss(UnitData self, MapData mapData, TerrainFeature terrainType)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsIgnoreMoveLoss(UnitData self, MapData mapData, Vegetation terrainType)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsLimitCount(UnitData self, MapData mapData, out int count)
|
|
{
|
|
count = -1;
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsCanMoveToNoUnitSelfCity(UnitData self, MapData mapData)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsCanMoveGiantNearbyGrid(UnitData self, MapData mapData)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsCanBeKill(UnitData self, MapData mapData)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public virtual bool IsCanBeDamaged(UnitData self, MapData mapData, int dmg)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public virtual bool IsCanBuildMine(UnitData self, MapData mapData)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual bool IsInvisible(UnitData self, MapData mapData)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public virtual float GetExtraDefense(UnitData self, MapData mapData)
|
|
{
|
|
return 1f;
|
|
}
|
|
|
|
public virtual int GetExtraSight(UnitData self, MapData mapData)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
public virtual float GetExtraAttack(UnitData self, MapData mapData)
|
|
{
|
|
return 1f;
|
|
}
|
|
|
|
public virtual float GetCriticalHitRate(UnitData self, MapData mapData)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
public virtual void OnUnitDamaged(IdentifierBase identifier, MapData mapData, SettlementInfo info)
|
|
{
|
|
|
|
}
|
|
|
|
public virtual void OnOtherUnitMove(IdentifierBase identifier, UnitData moveUnit, GridData target, MapData mapData)
|
|
{
|
|
|
|
}
|
|
}
|
|
} |