TH1/Unity/Assets/Scripts/TH1_Logic/Skill/AllSkill/ForestStartDashSkill.cs
2026-03-31 15:28:39 +08:00

64 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* @Author: 白哉
* @Description:
* @Date: 2025年04月23日 星期三 21:04:18
* @Modify:
*/
using RuntimeData;
using System;
using System.Collections.Generic;
using MemoryPack;
using UnityEngine;
namespace Logic.Skill
{
//在forest开始回合的时候拥有一次Dash机会
public partial class ForestStartDashSkill : SkillBase
{
public bool IsTrigger = false;
public override void OnTurnStart(IdentifierBase identifier, MapData mapData)
{
var self = identifier as UnitData;
if (self == null) return;
IsTrigger = true;
var grid = self.Grid(mapData);
if (grid == null) return;
bool selfCity = mapData.GetCityDataByGid(grid.Id, out var city) &&
city.Player(mapData) == self.Player(mapData);
if (grid.Vegetation == Vegetation.Trees || selfCity)
IsTrigger = false;
}
public ForestStartDashSkill()
{
IsTrigger = true;
IsPermanent = true;
TurnsLimit = 0;
Score = 4;
}
public override SkillType GetSkillType()
{
return SkillType.FORESTSTARTDASH;
}
public override void OnDamageOther(MapData mapData, SettlementInfo info)
{
if (info.DamageType != DamageType.ActiveAttack) return;
IsTrigger = true;
}
public override void OnMove(UnitData self, GridData grid, MapData mapData, MoveType moveType, List<Vector2Int> path = null)
{
if (IsTrigger) return;
if (moveType == MoveType.ActiveMove) self.AddActionPoint(ActionPointType.Attack);
}
}
}