修复技能bug

This commit is contained in:
kawagiri 2026-04-12 15:48:52 +08:00
parent e559bad72a
commit ee0e08440e
16 changed files with 55850 additions and 19942 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 62b20948fe3cb9f4fade15782dd03c0d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -548,12 +548,18 @@ namespace RuntimeData
public void SetUnitDataDie(UnitData unitData)
{
unitData.SetDie();
// 在清除绑定前获取所属城市id用于刷新CityInfo
UnitToCityDict.TryGetValue(unitData.Id, out var cityId);
// 清除数据层绑定
RemoveUnitData(unitData.Id);
if (GetGridIdByUnitId(unitData.Id, out var gridId))
_gridToUnitDict.Remove(gridId);
// 刷新所属城市的CityInfo人口数变化
if (cityId != 0 && CityMap.GetCityById(cityId, out var cityData))
cityData.CityInfoRenderer(this)?.InstantUpdateCityInfo();
}
//改变小兵到城市的所属关系
@ -1078,6 +1084,9 @@ namespace RuntimeData
//看情况是否显示,是否播放雾效
if(tmpUnit.Renderer(this)?.InstantUpdateUnit(true)??false)
tmpUnit.Grid(Main.MapData)?.Renderer(Main.MapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Fog));
//刷新所属城市的CityInfo人口数变化
if (CityMap.GetCityById(cid, out var cityData))
cityData.CityInfoRenderer(this)?.InstantUpdateCityInfo();
},waitTime,"REISEN ILLUSION ADDUNITDATA");
}
else
@ -1087,6 +1096,9 @@ namespace RuntimeData
//看情况是否显示,是否播放雾效
if(newUnit.Renderer(this)?.InstantUpdateUnit(true)??false)
newUnit.Grid(Main.MapData)?.Renderer(Main.MapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Fog));
//刷新所属城市的CityInfo人口数变化
if (CityMap.GetCityById(cid, out var cityData))
cityData.CityInfoRenderer(this)?.InstantUpdateCityInfo();
}
if (GetPlayerDataByUnitId(newUnit.Id, out var playerData))

View File

@ -213,7 +213,6 @@ namespace Logic.Action
Main.UnitLogic.UnitUnnaturalDie(actionParams.MapData,actionParams.UnitData);
if (city != null)
{
city.CityInfoRenderer(actionParams.MapData)?.InstantUpdateCityInfo();
ret = true;
}
}

View File

@ -108,13 +108,8 @@ namespace Logic.Skill
// 失去2层
_level -= 2;
// 对自己造成伤害(仅非死亡触发时,死亡时不再额外伤害)
if (!isDeathExplode)
{
Main.UnitLogic.DamageSettlement(map, self, self, 2, DamageType.KillSelf);
}
// 对周围1格范围造成伤害
// 先对周围1格范围造成伤害必须在自伤之前否则自伤死亡会清除grid绑定
// 导致后续DamageSettlement因找不到origin的grid而失败
var arounds = map.GridMap.GetAroundGridData(1, 1, grid);
foreach (var around in arounds)
{
@ -144,6 +139,12 @@ namespace Logic.Skill
}
}
}
// 再对自己造成伤害(仅非死亡触发时,死亡时不再额外伤害)
if (!isDeathExplode)
{
Main.UnitLogic.DamageSettlement(map, self, self, 2, DamageType.KillSelf);
}
}
else
{

View File

@ -48,7 +48,6 @@ namespace Logic.Skill
if(!damaged.Add(unit)) continue;
if (mapData.IsLeagueUnitByUnit(unit.Id, self.Id)) continue;
var dmg = Table.Instance.CalcDamage(mapData, self, unit);
var city = unit.City(mapData);
Main.UnitLogic.DamageSettlement(mapData, self, unit, Mathf.FloorToInt(dmg * 0.5f), DamageType.Splash);
//TODO 动画系统要接管
@ -61,8 +60,6 @@ namespace Logic.Skill
roundGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Hurt));
roundGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Fog));
//更新unit所属的city的cityInfo
city?.CityInfoRenderer(mapData)?.InstantUpdateCityInfo();
//更新unit的显示 ,unit即使已经死了也可以访问到renderer
unit.Renderer(mapData)?.InstantUpdateUnit(false);
unit.Renderer(mapData)?.InstantUpdateTryDie();

View File

@ -47,7 +47,6 @@ namespace Logic.Skill
info.IsFinished = true;
//提前记录unitRednerer(可能会死亡)
var unitRenderer = unit.Renderer(Main.MapData);
var cityinfoRenderer = unit.City(Main.MapData)?.CityInfoRenderer(Main.MapData);
var gridRenderer = unit.Grid(Main.MapData)?.Renderer(Main.MapData);
Main.UnitLogic.DamageSettlement(mapData, info.DamageOrigin, unit,info.DamageValue / 2, DamageType.Splash);
//脱离presentation体系 播放sakuya动画 TODO 这里有一点动画隐患之后要纳入presentation体系
@ -66,7 +65,6 @@ namespace Logic.Skill
else
unitRenderer.Die();
}
cityinfoRenderer?.InstantUpdateCityInfo();
},0.3f,"SAKUYA GUARD VFX");
return;
}

View File

@ -56,8 +56,7 @@ namespace Logic.Skill
if (mapData.IsLeagueUnitByUnit(unit.Id, info.DamageOrigin.Id)) continue;
// 计算攻击伤害
var damage = Table.Instance.CalcDamage(mapData, info.DamageOrigin, unit, damagePara:0.5f);
var city = unit.City(mapData);
unit.Renderer(mapData)?.InstantUpdateUnit(true);
unit.Renderer(mapData)?.InstantUpdateUnit(true);
Main.UnitLogic.DamageSettlement(mapData, info.DamageOrigin, unit, damage, DamageType.Splash);
//TODO 动画系统要接管
@ -71,7 +70,6 @@ namespace Logic.Skill
: 0.5f;
Timer.Instance.TimerRegister(this, () =>
{
city?.CityInfoRenderer(mapData)?.InstantUpdateCityInfo();
u.Renderer(mapData)?.InstantUpdateUnit(true);
u.Renderer(mapData)?.InstantUpdateTryDie();
g.Renderer(mapData)?.InstantUpdateGrid();

View File

@ -59,7 +59,6 @@ namespace Logic.Skill
// 计算攻击伤害,执行伤害逻辑
var damage = Table.Instance.CalcDamage(mapData, self, unit, damagePara:0.5f);
var targetGrid = unit.Grid(mapData);
var city = unit.City(mapData);
Main.UnitLogic.DamageSettlement(mapData, self, unit, damage, DamageType.Splash);
//TODO 动画系统要接管
@ -68,8 +67,6 @@ namespace Logic.Skill
//播放伤害数字特效
roundGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Damage,damage));
//更新unit所属的city的cityInfo
city?.CityInfoRenderer(mapData)?.InstantUpdateCityInfo();
//更新unit的显示 ,unit即使已经死了也可以访问到renderer
unit.Renderer(mapData)?.InstantUpdateUnit(false);
unit.Renderer(mapData)?.InstantUpdateTryDie();

View File

@ -79,13 +79,11 @@ namespace Logic.Skill
var splashDmg = Table.Instance.CalcDamage(mapData, selfUnit, splashTarget, damagePara: 0.5f);
var splashGrid = splashTarget.Grid(mapData);
var splashCity = splashTarget.City(mapData);
Main.UnitLogic.DamageSettlement(mapData, selfUnit, splashTarget, splashDmg, DamageType.Splash);
if (splashGrid != null && splashGrid.InMainSight())
{
splashGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Damage, splashDmg));
splashGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Hurt));
splashCity?.CityInfoRenderer(mapData)?.InstantUpdateCityInfo();
splashTarget.Renderer(mapData)?.InstantUpdateUnit(false);
if (!splashTarget.IsAlive())
splashGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Die));
@ -105,13 +103,11 @@ namespace Logic.Skill
{
var dmg = Table.Instance.CalcDamage(mapData, selfUnit, hitUnit);
var targetGrid = hitUnit.Grid(mapData);
var targetCity = hitUnit.City(mapData);
Main.UnitLogic.DamageSettlement(mapData, selfUnit, hitUnit, dmg, DamageType.DelayAttack);
if (targetGrid != null && targetGrid.InMainSight())
{
targetGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Damage, dmg));
targetGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Hurt));
targetCity?.CityInfoRenderer(mapData)?.InstantUpdateCityInfo();
hitUnit.Renderer(mapData)?.InstantUpdateUnit(false);
if (!hitUnit.IsAlive())
targetGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Die));
@ -139,14 +135,12 @@ namespace Logic.Skill
var dmg = Table.Instance.CalcDamage(mapData, selfUnit, targetUnit);
var targetGrid = targetUnit.Grid(mapData);
var targetCity = targetUnit.City(mapData);
Main.UnitLogic.DamageSettlement(mapData, selfUnit, targetUnit, dmg, DamageType.DelayAttack);
// 更新被伤害单位的视觉
if (targetGrid != null && targetGrid.InMainSight())
{
targetGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Damage, dmg));
targetGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Hurt));
targetCity?.CityInfoRenderer(mapData)?.InstantUpdateCityInfo();
targetUnit.Renderer(mapData)?.InstantUpdateUnit(false);
if (!targetUnit.IsAlive())
{

View File

@ -59,13 +59,11 @@ namespace Logic.Skill
var splashDmg = Table.Instance.CalcDamage(mapData, selfUnit, splashTarget, damagePara: 0.5f);
var splashGrid = splashTarget.Grid(mapData);
var splashCity = splashTarget.City(mapData);
Main.UnitLogic.DamageSettlement(mapData, selfUnit, splashTarget, splashDmg, DamageType.Splash);
if (splashGrid != null && splashGrid.InMainSight())
{
splashGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Damage, splashDmg));
splashGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Hurt));
splashCity?.CityInfoRenderer(mapData)?.InstantUpdateCityInfo();
splashTarget.Renderer(mapData)?.InstantUpdateUnit(false);
if (!splashTarget.IsAlive())
splashGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Die));
@ -147,13 +145,11 @@ namespace Logic.Skill
{
var dmg = Table.Instance.CalcDamage(mapData, selfUnit, targetUnit);
var targetGrid = targetUnit.Grid(mapData);
var targetCity = targetUnit.City(mapData);
Main.UnitLogic.DamageSettlement(mapData, selfUnit, targetUnit, dmg, DamageType.DelayAttack);
if (targetGrid != null && targetGrid.InMainSight())
{
targetGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Damage, dmg));
targetGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Hurt));
targetCity?.CityInfoRenderer(mapData)?.InstantUpdateCityInfo();
targetUnit.Renderer(mapData)?.InstantUpdateUnit(false);
if (!targetUnit.IsAlive())
targetGrid.Renderer(mapData)?.PlayVFXInSight(new GridVFXParams(GridVFXType.Die));

View File

@ -1537,11 +1537,14 @@ namespace Logic
int score = -1;
var gridList = mapData.GridMap.GetAroundGridData(1,1,gridData);
foreach (var targetGrid in gridList)
{
{
if (targetGrid == gridData)
continue;
if (!CheckUnitAbleForGrid_RealTimeStatus(mapData, unitData, targetGrid))
continue;
//被动推移必须检查真实占位(包括隐身单位),不能推到有隐身单位的格子上
if (targetGrid.RealUnit(mapData, out _))
continue;
var tmpScore = mapData.GridMap.CalcManhattanDistance(targetGrid, cityGrid);
//TODO MORIYAKNIGHT 特判
@ -1578,7 +1581,7 @@ namespace Logic
}
//判断一个unit 目前是否能直接站在那个grid上要考虑grid目前的状态例如盟友的城市中心有人的格子 等等)
//判断一个unit 目前是否能直接站在那个grid上要考虑grid目前的状态例如盟友的城市中心有人的格子 等等),但是不考虑隐身!
public bool CheckUnitAbleForGrid_RealTimeStatus(MapData mapData, UnitData unitData, GridData gridData)
{