2025-05-13 19:22:01 +08:00

67 lines
2.0 KiB
C#

using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Godot;
using Godot.Bridge;
using Godot.Collections;
using Godot.NativeInterop;
[GlobalClass]
[ScriptPath("res://Scripts/Data/BattleBlurbs.cs")]
public partial class BattleBlurbs : Resource
{
[Export(PropertyHint.None, "")]
public bool cant;
[Export(PropertyHint.None, "")]
public int turn = -1;
[Export(PropertyHint.None, "")]
public int lastAct = -1;
[Export(PropertyHint.None, "")]
public int weight = 1;
[Export(PropertyHint.None, "")]
public int bulletBoardID = -1;
[Export(PropertyHint.None, "")]
public int overrideIndex = -1;
[Export(PropertyHint.None, "")]
public float hpPercent = -1f;
[Export(PropertyHint.None, "")]
public Vector2 size = new Vector2(55f, 32f);
[Export(PropertyHint.None, "")]
public Vector2 offset = new Vector2(-15f, 0f);
[ExportSubgroup("Flags", "")]
[Export(PropertyHint.None, "")]
public Array<StringName> internalNeed;
[Export(PropertyHint.None, "")]
public Array<StringName> internalLimit;
[Export(PropertyHint.None, "")]
public Array<StringName> battleNeed;
[Export(PropertyHint.None, "")]
public Array<StringName> battleLimit;
public bool Can(Battlers caller)
{
if (!cant && (turn <= -1 || BattleDR.current.turn == turn) && (hpPercent <= 0f || caller.HPPercent() <= hpPercent) && (lastAct <= -1 || caller.lastestAct.Contains(lastAct)) && (bulletBoardID <= -1 || bulletBoardID == BattleDR.current.lastBoard) && (internalNeed == null || internalNeed.Count == 0 || internalNeed.All((StringName x) => caller.internalFlags.Contains(x))) && (internalLimit == null || internalLimit.Count == 0 || !internalLimit.All((StringName x) => caller.internalFlags.Contains(x))) && (battleNeed == null || battleNeed.Count == 0 || battleNeed.All((StringName x) => BattleDR.current.tempFlags.Contains(x))))
{
if (battleLimit != null && battleLimit.Count != 0)
{
return !battleLimit.All((StringName x) => BattleDR.current.tempFlags.Contains(x));
}
return true;
}
return false;
}
}