Card爆改!
This commit is contained in:
@@ -300,20 +300,20 @@ namespace Continentis.MainGame.Character
|
||||
{
|
||||
bool CanAfford(CardInstance card, int stamina, int mana)
|
||||
{
|
||||
return card.cardLogic.GetAttribute("StaminaCost") <= stamina &&
|
||||
card.cardLogic.GetAttribute("ManaCost") <= mana;
|
||||
return card.GetAttribute("StaminaCost") <= stamina &&
|
||||
card.GetAttribute("ManaCost") <= mana;
|
||||
}
|
||||
|
||||
bool CheckAvailabilityAndSetTargets(CardInstance card, out List<CharacterBase> targets)
|
||||
{
|
||||
card.cardLogic.DetectTargetsValidity(out List<CharacterBase> valid, out _, out _);
|
||||
if (valid.Count == 0 || !card.cardLogic.CheckBeforePlay())
|
||||
card.DetectTargetsValidity(out List<CharacterBase> valid, out _, out _);
|
||||
if (valid.Count == 0 || !card.CheckBeforePlay())
|
||||
{
|
||||
targets = null;
|
||||
return false; // 无有效目标或无法使用则跳过
|
||||
}
|
||||
|
||||
targets = card.cardLogic.SetRandomTargets(valid);
|
||||
targets = card.SetRandomTargets(valid);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -331,7 +331,7 @@ namespace Continentis.MainGame.Character
|
||||
|
||||
foreach (CardInstance card in availableCards)
|
||||
{
|
||||
if (card.cardLogic.weightSubmodule.forceUse)
|
||||
if (card.weightSubmodule.forceUse)
|
||||
{
|
||||
forced.Add(card);
|
||||
}
|
||||
@@ -360,8 +360,8 @@ namespace Continentis.MainGame.Character
|
||||
}
|
||||
|
||||
intended.Add(new IntendedCard(card, targets));
|
||||
remainingStamina -= card.cardLogic.GetAttribute("StaminaCost");
|
||||
remainingMana -= card.cardLogic.GetAttribute("ManaCost");
|
||||
remainingStamina -= card.GetAttribute("StaminaCost");
|
||||
remainingMana -= card.GetAttribute("ManaCost");
|
||||
}
|
||||
// 行动力不足则跳过该卡
|
||||
}
|
||||
@@ -377,7 +377,7 @@ namespace Continentis.MainGame.Character
|
||||
break;
|
||||
}
|
||||
|
||||
float totalWeight = affordableCards.Sum(card => card.cardLogic.weightSubmodule.currentWeight);
|
||||
float totalWeight = affordableCards.Sum(card => card.weightSubmodule.currentWeight);
|
||||
if (totalWeight <= 0f) break;
|
||||
|
||||
float r = Random.value * totalWeight;
|
||||
@@ -385,7 +385,7 @@ namespace Continentis.MainGame.Character
|
||||
CardInstance chosen = null;
|
||||
foreach (CardInstance card in affordableCards)
|
||||
{
|
||||
accum += card.cardLogic.weightSubmodule.currentWeight;
|
||||
accum += card.weightSubmodule.currentWeight;
|
||||
if (r <= accum)
|
||||
{
|
||||
chosen = card;
|
||||
@@ -403,8 +403,8 @@ namespace Continentis.MainGame.Character
|
||||
|
||||
intended.Add(new IntendedCard(chosen, targets));
|
||||
normal.Remove(chosen);
|
||||
remainingStamina -= chosen.cardLogic.GetAttribute("StaminaCost");
|
||||
remainingMana -= chosen.cardLogic.GetAttribute("ManaCost");
|
||||
remainingStamina -= chosen.GetAttribute("StaminaCost");
|
||||
remainingMana -= chosen.GetAttribute("ManaCost");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user