From b7551ebbe79c8b894f80b39dd7403d37f1de3aaf Mon Sep 17 00:00:00 2001 From: xianyi Date: Tue, 26 Aug 2025 17:12:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B7=A6=E4=BE=A7&=E5=8F=B3?= =?UTF-8?q?=E4=BE=A7=E7=9B=AE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/TcgEngine/Scripts/Data/AbilityData.cs | 28 ++++++++++++++++++- .../TcgEngine/Scripts/Effects/EffectAttack.cs | 20 +++++++++++++ .../Scripts/Effects/EffectAttackRedirect.cs | 18 ++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/Assets/TcgEngine/Scripts/Data/AbilityData.cs b/Assets/TcgEngine/Scripts/Data/AbilityData.cs index 8b8dfe6..25511a1 100644 --- a/Assets/TcgEngine/Scripts/Data/AbilityData.cs +++ b/Assets/TcgEngine/Scripts/Data/AbilityData.cs @@ -362,6 +362,30 @@ namespace TcgEngine targets.Add(target); } + if (target == AbilityTarget.LastTargetedLeft) + { + Card lastTarget = data.GetCard(data.last_target); + if (lastTarget != null && lastTarget.slot.x > Slot.x_min) + { + Slot leftSlot = new Slot(lastTarget.slot.x - 1, lastTarget.slot.y, lastTarget.slot.p); + Card leftCard = data.GetSlotCard(leftSlot); + if (leftCard != null && AreTargetConditionsMet(data, caster, leftCard)) + targets.Add(leftCard); + } + } + + if (target == AbilityTarget.LastTargetedRight) + { + Card lastTarget = data.GetCard(data.last_target); + if (lastTarget != null && lastTarget.slot.x < Slot.x_max) + { + Slot rightSlot = new Slot(lastTarget.slot.x + 1, lastTarget.slot.y, lastTarget.slot.p); + Card rightCard = data.GetSlotCard(rightSlot); + if (rightCard != null && AreTargetConditionsMet(data, caster, rightCard)) + targets.Add(rightCard); + } + } + if (target == AbilityTarget.LastSummoned) { Card target = data.GetCard(data.last_summoned); @@ -684,7 +708,9 @@ namespace TcgEngine LastPlayed = 70, //Last card that was played LastTargeted = 72, //Last card that was targeted with an ability - LastDestroyed = 74, //Last card that was killed + LastTargetedLeft = 73, //Last card that was targeted with an ability and is on the left side of the board + LastTargetedRight = 74, //Last card that was targeted with an ability and is on the right side of the board + LastDestroyed = 75, //Last card that was killed LastSummoned = 77, //Last card that was summoned or created } diff --git a/Assets/TcgEngine/Scripts/Effects/EffectAttack.cs b/Assets/TcgEngine/Scripts/Effects/EffectAttack.cs index c7a0e86..c18aae4 100644 --- a/Assets/TcgEngine/Scripts/Effects/EffectAttack.cs +++ b/Assets/TcgEngine/Scripts/Effects/EffectAttack.cs @@ -42,6 +42,24 @@ namespace TcgEngine return gdata.GetCard(gdata.last_played); if (attacker_type == EffectAttackerType.LastTargeted) return gdata.GetCard(gdata.last_target); + if (attacker_type == EffectAttackerType.LastTargetedLeft) + { + Card lastTarget = gdata.GetCard(gdata.last_target); + if (lastTarget != null && lastTarget.slot.x > Slot.x_min) + { + Slot leftSlot = new Slot(lastTarget.slot.x - 1, lastTarget.slot.y, lastTarget.slot.p); + return gdata.GetSlotCard(leftSlot); + } + } + if (attacker_type == EffectAttackerType.LastTargetedRight) + { + Card lastTarget = gdata.GetCard(gdata.last_target); + if (lastTarget != null && lastTarget.slot.x < Slot.x_max) + { + Slot rightSlot = new Slot(lastTarget.slot.x + 1, lastTarget.slot.y, lastTarget.slot.p); + return gdata.GetSlotCard(rightSlot); + } + } return null; } } @@ -52,5 +70,7 @@ namespace TcgEngine AbilityTriggerer = 25, LastPlayed = 70, LastTargeted = 72, + LastTargetedLeft = 73, + LastTargetedRight = 74, } } \ No newline at end of file diff --git a/Assets/TcgEngine/Scripts/Effects/EffectAttackRedirect.cs b/Assets/TcgEngine/Scripts/Effects/EffectAttackRedirect.cs index 613db0b..dcce86a 100644 --- a/Assets/TcgEngine/Scripts/Effects/EffectAttackRedirect.cs +++ b/Assets/TcgEngine/Scripts/Effects/EffectAttackRedirect.cs @@ -42,6 +42,24 @@ namespace TcgEngine return gdata.GetCard(gdata.last_played); if (attacker_type == EffectAttackerType.LastTargeted) return gdata.GetCard(gdata.last_target); + if (attacker_type == EffectAttackerType.LastTargetedLeft) + { + Card lastTarget = gdata.GetCard(gdata.last_target); + if (lastTarget != null && lastTarget.slot.x > Slot.x_min) + { + Slot leftSlot = new Slot(lastTarget.slot.x - 1, lastTarget.slot.y, lastTarget.slot.p); + return gdata.GetSlotCard(leftSlot); + } + } + if (attacker_type == EffectAttackerType.LastTargetedRight) + { + Card lastTarget = gdata.GetCard(gdata.last_target); + if (lastTarget != null && lastTarget.slot.x < Slot.x_max) + { + Slot rightSlot = new Slot(lastTarget.slot.x + 1, lastTarget.slot.y, lastTarget.slot.p); + return gdata.GetSlotCard(rightSlot); + } + } return null; } }