64 lines
1.7 KiB
C#
64 lines
1.7 KiB
C#
/*
|
||
* @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);
|
||
}
|
||
}
|
||
} |