修复法典逻辑
This commit is contained in:
parent
e97557e182
commit
d103c3fdc7
@ -594,9 +594,6 @@ namespace Logic.Action
|
||||
};
|
||||
switch (gridMiscActionType)
|
||||
{
|
||||
case GridMiscActionType.UpgradeTemple:
|
||||
ActionLogicDict[commonActionId] = new GridMiscActionUpgradeTemple(commonActionId);
|
||||
continue;
|
||||
case GridMiscActionType.GrowForestOutside:
|
||||
ActionLogicDict[commonActionId] = new GridMiscActionGrowTreeOutside(commonActionId);
|
||||
continue;
|
||||
@ -1398,20 +1395,26 @@ namespace Logic.Action
|
||||
var player = actionParam.PlayerData;
|
||||
if (grid == null || map == null || player == null) return false;
|
||||
|
||||
//如果没有对应科技也会显示 钱不够也会显示
|
||||
//确认grid实际属于的player是谁
|
||||
map.GetPlayerDataByTerritoryGridId(actionParam.GridData.Id, out var gridPlayer);
|
||||
//如果不在我方领土,return false
|
||||
if (gridPlayer == null || player.Id != gridPlayer.Id) return false;
|
||||
|
||||
|
||||
//如果有非联盟的敌人站在上面
|
||||
if (grid.VisibleUnit(map,player, out var unit) && !map.CheckUnitIdBelongPlayerIdUnion(unit.Id, player.Id))
|
||||
return false;
|
||||
//如果techpool里就没有这个技能,不显示
|
||||
if (!Table.Instance.PlayerDataAssets.CheckActionInTechPool(_actionId, actionParam.PlayerData)) return false;
|
||||
|
||||
|
||||
return _actionId.ResourceType == actionParam.GridData.Resource;
|
||||
//资源类型不匹配,不显示
|
||||
if (_actionId.ResourceType != actionParam.GridData.Resource) return false;
|
||||
|
||||
//没有科技,显示为灰色锁定
|
||||
if (!player.TechTree.CheckActionCan(_actionId)) showType = ShowType.Locked;
|
||||
//钱不够,显示为Cost
|
||||
else if (GetCost(actionParam) > player.PlayerCoin) showType = ShowType.Cost;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override ActionShowState CheckShowState(CommonActionParams actionParams) { return ActionShowState.None; }
|
||||
|
||||
@ -410,71 +410,6 @@ namespace Logic.Action
|
||||
|
||||
}
|
||||
|
||||
public class GridMiscActionUpgradeTemple : GridMiscAction
|
||||
{
|
||||
public GridMiscActionUpgradeTemple(CommonActionId id) : base(id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override bool Execute(CommonActionParams actionParams)
|
||||
{
|
||||
if (!CheckCan(actionParams)) return false;
|
||||
//step #1 扣钱
|
||||
actionParams.PlayerData.SpendCoin(GetCost(actionParams));
|
||||
//step #2 办事 升级temple
|
||||
actionParams.GridData.buildingLevel++;
|
||||
|
||||
|
||||
if (Main.MapData.IsCurrentShowMap())
|
||||
PresentationManager.EnqueueGridUpdate(actionParams.MapData,actionParams.GridData,GridUpdateType.BuildingUpdate);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool CheckCan(CommonActionParams actionParam)
|
||||
{
|
||||
//step #1 check基本信息
|
||||
if (!GridMiscActionCheckBaseInfo(actionParam)) return false;
|
||||
//Step #2 check是否是temple
|
||||
if (!(actionParam.GridData.Resource is ResourceType.Temple or ResourceType.KingTemple
|
||||
or ResourceType.MountainTemple or ResourceType.WaterTemple or ResourceType.ForestTemple))
|
||||
return false;
|
||||
//step #3 check是否有科技
|
||||
if (!GridMiscActionCheckHasTech(actionParam)) return false;
|
||||
//step #4 check是否有钱
|
||||
if (!GridMiscActionCheckHasMoney(actionParam)) return false;
|
||||
//step #5 check是否在我方领土
|
||||
if (!GridMiscActionCheckInTerritory(actionParam)) return false;
|
||||
//step #6 check是否有敌人占领
|
||||
if (GridMiscActionCheckEnemyOccupy(actionParam)) return false;
|
||||
//step #7 check 是否已经满级
|
||||
if (actionParam.GridData.buildingLevel >= 5) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool CheckShow(CommonActionParams actionParam,out ShowType showType)
|
||||
{
|
||||
showType = ShowType.None;
|
||||
//step #1 check基本信息
|
||||
if (!GridMiscActionCheckBaseInfo(actionParam)) return false;
|
||||
//Step #2 check是否是temple
|
||||
if (!(actionParam.GridData.Resource is ResourceType.Temple or ResourceType.KingTemple
|
||||
or ResourceType.MountainTemple or ResourceType.WaterTemple or ResourceType.ForestTemple))
|
||||
return false;
|
||||
//step #3 check是否有科技
|
||||
if (!GridMiscActionCheckHasTech(actionParam)) return false;
|
||||
//step #4 check是否有钱
|
||||
//if (!GridMiscActionCheckHasMoney(actionParam)) return false;
|
||||
//step #5 check是否在我方领土
|
||||
if (!GridMiscActionCheckInTerritory(actionParam)) return false;
|
||||
//step #6 check是否有敌人占领
|
||||
if (GridMiscActionCheckEnemyOccupy(actionParam)) return false;
|
||||
//step #7 check 是否已经满级
|
||||
if (actionParam.GridData.buildingLevel >= 5) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class GridMiscActionGrowTreeOutside : GridMiscAction
|
||||
{
|
||||
|
||||
@ -1260,8 +1260,21 @@ namespace Logic
|
||||
{
|
||||
uint x = (uint)info.ChessType;
|
||||
playerData.giantExp[x] += grid.buildingLevel;
|
||||
//Debug.Log(playerData.giantExp[x] + " + " + grid.buildingLevel);
|
||||
}
|
||||
}
|
||||
|
||||
// Temple每2回合自动升1级,最高5级
|
||||
if (grid.Resource is ResourceType.Temple or ResourceType.KingTemple
|
||||
or ResourceType.ForestTemple or ResourceType.WaterTemple
|
||||
or ResourceType.MountainTemple)
|
||||
{
|
||||
if (grid.buildingLevel < 5
|
||||
&& playerData.Turn >= grid.BuildTime + 2
|
||||
&& (playerData.Turn - grid.BuildTime) % 2 == 0)
|
||||
{
|
||||
grid.buildingLevel++;
|
||||
Main.CityLogic.UpdateGrid_ViewOnly(mapData, grid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var addCoin = GetPlayerCoinPerTurn(mapData, playerData.Id);
|
||||
|
||||
@ -180,6 +180,15 @@ namespace TH1_UI.View.Info
|
||||
CircleBG.color = CircleGray;
|
||||
Title.color = TextRed;
|
||||
}
|
||||
//兜底:其他原因无法执行(如科技未解锁等),灰圈+隐藏cost
|
||||
else
|
||||
{
|
||||
CircleBG.color = CircleGray;
|
||||
CostBar.SetActive(false);
|
||||
BG.sprite = circleGround ? GroundGrayBG : GrayBG;
|
||||
locked = true;
|
||||
Title.color = TextGrey;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user