更新
This commit is contained in:
@@ -20,6 +20,7 @@ namespace Continentis.MainGame.Card
|
||||
/// </summary>
|
||||
public virtual void Targeting(CharacterBase target)
|
||||
{
|
||||
currentTextTarget = target;
|
||||
eventSubmodule.onTargeting.Invoke(target);
|
||||
}
|
||||
|
||||
@@ -29,6 +30,7 @@ namespace Continentis.MainGame.Card
|
||||
/// </summary>
|
||||
public virtual void Untargeting()
|
||||
{
|
||||
currentTextTarget = null;
|
||||
eventSubmodule.onUntargeting.Invoke();
|
||||
}
|
||||
}
|
||||
@@ -136,11 +138,26 @@ namespace Continentis.MainGame.Card
|
||||
}
|
||||
else
|
||||
{
|
||||
while (targets.Count < maximumTargets && valid.Count > 0)
|
||||
bool allowDuplicate = HasKeyword(CardKeywords.AllowDuplicateTargets);
|
||||
|
||||
if (allowDuplicate)
|
||||
{
|
||||
CharacterBase target = valid[Random.Range(0, valid.Count)];
|
||||
valid.Remove(target);
|
||||
targets.Add(target);
|
||||
// 放回抽样:可重复选中同一目标
|
||||
for (int i = 0; i < maximumTargets; i++)
|
||||
{
|
||||
targets.Add(valid[Random.Range(0, valid.Count)]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 不放回抽样(原逻辑)
|
||||
List<CharacterBase> pool = new List<CharacterBase>(valid);
|
||||
while (targets.Count < maximumTargets && pool.Count > 0)
|
||||
{
|
||||
CharacterBase target = pool[Random.Range(0, pool.Count)];
|
||||
pool.Remove(target);
|
||||
targets.Add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,13 +166,13 @@ namespace Continentis.MainGame.Card
|
||||
|
||||
public virtual bool CheckBeforePlay()
|
||||
{
|
||||
if (!user.CheckEnoughStamina(GetAttribute("StaminaCost")))
|
||||
if (!user.CheckEnoughStamina(GetAttribute(CardAttributes.StaminaCost)))
|
||||
{
|
||||
MainGameManager.Instance.basePrefabs.GenerateInfoText("Not Enough Stamina", user.characterView);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!user.CheckEnoughMana(GetAttribute("ManaCost")))
|
||||
if (!user.CheckEnoughMana(GetAttribute(CardAttributes.ManaCost)))
|
||||
{
|
||||
MainGameManager.Instance.basePrefabs.GenerateInfoText("Not Enough Mana", user.characterView);
|
||||
return false;
|
||||
@@ -192,13 +209,13 @@ namespace Continentis.MainGame.Card
|
||||
{
|
||||
if (!noConsumption)
|
||||
{
|
||||
this.user.ModifyStamina(-GetAttribute("StaminaCost"));
|
||||
this.user.ModifyMana(-GetAttribute("ManaCost"));
|
||||
this.user.ModifyStamina(-GetAttribute(CardAttributes.StaminaCost));
|
||||
this.user.ModifyMana(-GetAttribute(CardAttributes.ManaCost));
|
||||
}
|
||||
|
||||
Debug.Log($"Starting to play card: {contentSubmodule.cardName}");
|
||||
|
||||
CommandQueueManager.Instance.AddCommand(new Cmd_Function(() =>
|
||||
CommandQueueManager.Instance.AddCommand(Cmd.Do(() =>
|
||||
{
|
||||
playSubmodule.isDuringPlayEffect = true;
|
||||
eventSubmodule.onBeforePlay.Invoke(targetList);
|
||||
@@ -211,7 +228,7 @@ namespace Continentis.MainGame.Card
|
||||
|
||||
CommandQueueManager.Instance.AddCommand(PlayEffect(targetList));
|
||||
CommandQueueManager.Instance.AddCommand(cardLogic.PlayEffect(targetList));
|
||||
CommandQueueManager.Instance.AddCommand(new Cmd_Function(() =>
|
||||
CommandQueueManager.Instance.AddCommand(Cmd.Do(() =>
|
||||
{
|
||||
eventSubmodule.onAfterPlay.Invoke(targetList);
|
||||
combatBuffSubmodule.buffList.For(buff => buff.usageSubmodule?.UpdateModule());
|
||||
@@ -308,6 +325,8 @@ namespace Continentis.MainGame.Card
|
||||
KeyValuePair<string, List<CardInstance>> currentPile = deck.GetCardLocation(this, out int index);
|
||||
if (!cardData.upgradeNode.isTerminalNode)
|
||||
{
|
||||
// 先 Dispose 旧 Logic,再替换,避免旧 Logic 的托管订阅泄漏
|
||||
cardLogic?.Dispose();
|
||||
DestroyHandCardView();
|
||||
|
||||
CardData newData = cardData.upgradeNode.upgradeCards[0]; //后续可改为选择升级方向
|
||||
|
||||
Reference in New Issue
Block a user