Implement phase-2 prevention/replacement triggers and sequence duration
This commit is contained in:
@@ -1100,7 +1100,7 @@
|
||||
private static readonly string[] MovementTypeValues = ["Walk", "Flight", "Jump", "Teleport"];
|
||||
private static readonly string[] DirectionValues = ["North", "South", "East", "West", "NorthEast", "NorthWest", "SouthEast", "SouthWest"];
|
||||
private static readonly string[] ComparatorValues = ["Equal", "NotEqual", "LessThan", "LessThanOrEqual", "GreaterThan", "GreaterThanOrEqual"];
|
||||
private static readonly string[] DurationTypeValues = ["Instant", "UntilEndOfTurn", "UntilStartOfOwnerTurn", "UntilStartOfSourceOwnerTurn", "ForNTurns", "WhileSourceOnBattlefield", "PermanentInMatch"];
|
||||
private static readonly string[] DurationTypeValues = ["Instant", "UntilEndOfTurn", "UntilStartOfOwnerTurn", "UntilStartOfSourceOwnerTurn", "ForNTurns", "UntilEndOfSequence", "WhileSourceOnBattlefield", "PermanentInMatch"];
|
||||
private static readonly string[] StatTargetValues = ["Current", "Base", "Max"];
|
||||
private static readonly string[] StatValues = ["Damage", "Defense", "Health", "MP"];
|
||||
private static readonly string[] PositionValues = ["Top", "Bottom"];
|
||||
@@ -1125,7 +1125,7 @@
|
||||
"OnTurnStart", "OnTurnEnd",
|
||||
"OnChanneled", "OnAscend", "OnTransition",
|
||||
"OnUnitMove", "OnUnitAttack", "OnUnitAbilityActivated", "OnUnitMPSpent",
|
||||
"OnDamageDealt", "OnDamagePrevented", "OnHealed",
|
||||
"OnDamageDealt", "OnDamagePrevented", "OnHealed", "BeforeDamageApplied", "BeforeUnitDeath",
|
||||
"OnUnitEnterBattlefield", "OnUnitLeaveBattlefield", "OnUnitDeath",
|
||||
"OnUnitSentToDiscard", "OnSpiritSacrificed", "OnTokenSummoned",
|
||||
"OnStatModified", "OnAbilityAdded", "OnAbilityRemoved", "OnGenusChanged",
|
||||
@@ -1142,7 +1142,7 @@
|
||||
|
||||
private static readonly EffectGroup[] EffectGroups =
|
||||
[
|
||||
new("Damage & Healing", ["DealDamage", "Heal", "DealDamageToSelf", "DOT", "HOT"]),
|
||||
new("Damage & Healing", ["DealDamage", "Heal", "DealDamageToSelf", "DOT", "HOT", "PreventDeath", "PreventNextDamage", "SetHealthMinimum"]),
|
||||
new("Stat Modification", ["ModifyHealth", "ModifyDefense", "ModifyDamage", "ModifyMP",
|
||||
"GrantAdditionalAttack", "SetAttackRange",
|
||||
"ModifyMinAttackRange", "ModifyMaxAttackRange",
|
||||
@@ -1184,7 +1184,7 @@
|
||||
|
||||
private static readonly HashSet<string> _amountBypassTypes = ["DealDamage", "DealDamageToSelf"];
|
||||
private static readonly HashSet<string> _amountOnlyTypes = ["Heal", "ModifyDamage", "ModifySP", "ModifyST", "ModifyCardsDrawnPerTurn", "ModifySPAccumulation",
|
||||
"ModifyMinAttackRange", "ModifyMaxAttackRange"];
|
||||
"ModifyMinAttackRange", "ModifyMaxAttackRange", "PreventNextDamage"];
|
||||
private static readonly HashSet<string> _amountStatTypes = ["ModifyHealth", "ModifyDefense", "ModifyMP"];
|
||||
private static readonly HashSet<string> _valueTypes = [
|
||||
"SetCanMove", "SetCanAttack", "SetCanDefend", "SetCanBeAttacked",
|
||||
@@ -1214,6 +1214,8 @@
|
||||
["OnDamageDealt"] = """{"$type":"OnDamageDealt","SourceOwnership":"Any","TargetOwnership":"Any"}""",
|
||||
["OnDamagePrevented"] = """{"$type":"OnDamagePrevented","TargetOwnership":"Any"}""",
|
||||
["OnHealed"] = """{"$type":"OnHealed","TargetOwnership":"Any"}""",
|
||||
["BeforeDamageApplied"] = """{"$type":"BeforeDamageApplied","SourceOwnership":"Any","TargetOwnership":"Any"}""",
|
||||
["BeforeUnitDeath"] = """{"$type":"BeforeUnitDeath","UnitType":"Unit","Ownership":"Any"}""",
|
||||
["OnUnitEnterBattlefield"] = """{"$type":"OnUnitEnterBattlefield","UnitType":"Unit","Ownership":"Any"}""",
|
||||
["OnUnitLeaveBattlefield"] = """{"$type":"OnUnitLeaveBattlefield","UnitType":"Unit","Ownership":"Any"}""",
|
||||
["OnUnitDeath"] = """{"$type":"OnUnitDeath","UnitType":"Unit","Ownership":"Any"}""",
|
||||
@@ -1444,9 +1446,9 @@
|
||||
{
|
||||
d.N = ReadInt("N"); d.Player = ReadStr("Player", "Owner");
|
||||
}
|
||||
else if (typeKey is "GrantAdditionalAttack" or "SearchDeck" or "RevealCards" or "GrantMovementControl")
|
||||
else if (typeKey is "GrantAdditionalAttack" or "SearchDeck" or "RevealCards" or "GrantMovementControl" or "SetHealthMinimum")
|
||||
{
|
||||
d.N = ReadInt("N");
|
||||
d.N = ReadInt(typeKey == "SetHealthMinimum" ? "Minimum" : "N");
|
||||
}
|
||||
else if (_valueTypes.Contains(typeKey))
|
||||
{
|
||||
@@ -1813,7 +1815,7 @@
|
||||
n["CardType"] = ab.TriggerCardType;
|
||||
}
|
||||
// Ownership + UnitType
|
||||
else if (t is "OnUnitEnterBattlefield" or "OnUnitLeaveBattlefield" or "OnUnitDeath")
|
||||
else if (t is "OnUnitEnterBattlefield" or "OnUnitLeaveBattlefield" or "OnUnitDeath" or "BeforeUnitDeath")
|
||||
{
|
||||
n["Ownership"] = ab.TriggerOwnership;
|
||||
n["UnitType"] = ab.TriggerUnitType;
|
||||
@@ -1833,6 +1835,11 @@
|
||||
if (ab.TriggerDamageType != "Any") n["DamageType"] = ab.TriggerDamageType;
|
||||
if (ab.TriggerAmount.HasValue) n["Amount"] = ab.TriggerAmount.Value;
|
||||
}
|
||||
else if (t == "BeforeDamageApplied")
|
||||
{
|
||||
n["SourceOwnership"] = ab.TriggerSourceOwnership;
|
||||
n["TargetOwnership"] = ab.TriggerTargetOwnership;
|
||||
}
|
||||
// TargetOwnership only
|
||||
else if (t == "OnDamagePrevented")
|
||||
{
|
||||
@@ -1913,6 +1920,10 @@
|
||||
{
|
||||
node["N"] = d.N;
|
||||
}
|
||||
else if (d.TypeKey == "SetHealthMinimum")
|
||||
{
|
||||
node["Minimum"] = d.N;
|
||||
}
|
||||
else if (_valueTypes.Contains(d.TypeKey))
|
||||
{
|
||||
node["Value"] = d.Value;
|
||||
@@ -2195,6 +2206,10 @@
|
||||
{
|
||||
BuildIntInput(__builder, d.N, v => { d.N = v; Compile(); }, 70, "N");
|
||||
}
|
||||
else if (t == "SetHealthMinimum")
|
||||
{
|
||||
BuildIntInput(__builder, d.N, v => { d.N = v; Compile(); }, 90, "Minimum");
|
||||
}
|
||||
else if (_valueTypes.Contains(t))
|
||||
{
|
||||
BuildCheckbox(__builder, "Value", d.Value, v => { d.Value = v; Compile(); });
|
||||
@@ -2412,7 +2427,7 @@
|
||||
v => { ab.TriggerCardType = v; Compile(); }, 120);
|
||||
}
|
||||
// Ownership + UnitType
|
||||
else if (t is "OnUnitEnterBattlefield" or "OnUnitLeaveBattlefield" or "OnUnitDeath")
|
||||
else if (t is "OnUnitEnterBattlefield" or "OnUnitLeaveBattlefield" or "OnUnitDeath" or "BeforeUnitDeath")
|
||||
{
|
||||
BuildSelect(__builder, OwnershipValues, ab.TriggerOwnership,
|
||||
v => { ab.TriggerOwnership = v; Compile(); }, 100);
|
||||
@@ -2445,6 +2460,17 @@
|
||||
BuildOptionalAmountInput(__builder, ab.TriggerAmount,
|
||||
v => { ab.TriggerAmount = v; Compile(); });
|
||||
}
|
||||
else if (t == "BeforeDamageApplied")
|
||||
{
|
||||
BuildSelect(__builder, OwnershipValues, ab.TriggerSourceOwnership,
|
||||
v => { ab.TriggerSourceOwnership = v; Compile(); }, 100);
|
||||
__builder.OpenElement(50, "span");
|
||||
__builder.AddAttribute(51, "class", "text-muted small");
|
||||
__builder.AddContent(52, "→");
|
||||
__builder.CloseElement();
|
||||
BuildSelect(__builder, OwnershipValues, ab.TriggerTargetOwnership,
|
||||
v => { ab.TriggerTargetOwnership = v; Compile(); }, 100);
|
||||
}
|
||||
// TargetOwnership only
|
||||
else if (t == "OnDamagePrevented")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user