Enemies drop energy before, intentions are more accurate
This commit is contained in:
parent
94b3309bb7
commit
737a851283
6 changed files with 64 additions and 13 deletions
|
|
@ -12,13 +12,15 @@ public class TurnIntentions<BaseCardT> where BaseCardT: BaseCard
|
|||
private bool mActive;
|
||||
private List<BaseCardT> mCardsToUse = new List<BaseCardT>();
|
||||
|
||||
public TurnIntentions(BattleDeck<BaseCardT> deck, EnergyPool energyPool) {
|
||||
public TurnIntentions(BattleDeck<BaseCardT> deck, EnergyPool energyPool,
|
||||
HandPlayability<BaseCardT> playability) {
|
||||
mDeck = deck;
|
||||
mEnergyPool = energyPool;
|
||||
mActive = true;
|
||||
|
||||
mDeck.OnDrawPileChanged += OnDependencyChanged;
|
||||
mEnergyPool.OnEnergyChanged += OnDependencyChanged;
|
||||
playability.OnPlayabilityChanged += OnDependencyChanged;
|
||||
}
|
||||
|
||||
public void ResumeIntentions() {
|
||||
|
|
@ -46,14 +48,23 @@ public class TurnIntentions<BaseCardT> where BaseCardT: BaseCard
|
|||
|
||||
private void UpdateState() {
|
||||
int projectedEnergy = mEnergyPool.Energy;
|
||||
// TODO: Account for emotions
|
||||
|
||||
mCardsToUse.Clear();
|
||||
|
||||
List<BaseCardT> hand = mDeck.GetHandPile();
|
||||
|
||||
for (int i = 0; i < hand.Count; i++) {
|
||||
BaseCardT card = hand[i];
|
||||
if (card.Owner.CanUseCard(card)
|
||||
if (card.Type == CardType.Emotion && card.Owner.CanUseCard(card)) {
|
||||
projectedEnergy ++;
|
||||
mCardsToUse.Add(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < hand.Count; i++) {
|
||||
BaseCardT card = hand[i];
|
||||
if (card.Type != CardType.Emotion
|
||||
&& card.Owner.CanUseCard(card)
|
||||
&& projectedEnergy >= card.GetCost()) {
|
||||
projectedEnergy -= card.GetCost();
|
||||
mCardsToUse.Add(card);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue