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
|
|
@ -6,8 +6,8 @@ using UnityEngine.SceneManagement;
|
|||
|
||||
public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffectResolver, MonsterViewpoint
|
||||
{
|
||||
private bool STABLE_HAND_STYLE = false;
|
||||
private int STARTING_INSIGHT = 1;
|
||||
private bool STABLE_HAND_STYLE = true;
|
||||
private int STARTING_INSIGHT = 3;
|
||||
|
||||
// Inspector public
|
||||
public HeroInfoUI heroUIPrefab;
|
||||
|
|
@ -139,7 +139,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
this.OnBattleStateChanged += this.monsterHandPlayability.NotifyBattleStateChanged;
|
||||
|
||||
this.monsterIntentions = new TurnIntentions<MonsterCard>(
|
||||
this.monsterDeck, this.monsterEnergy);
|
||||
this.monsterDeck, this.monsterEnergy, this.monsterHandPlayability);
|
||||
|
||||
this.battlePlayerControls.Init(
|
||||
this.heroDeck, this.monsterDeck, this.playArea, this.insightLevel,
|
||||
|
|
@ -170,6 +170,14 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
cheat.OnInsightCode += delegate {
|
||||
this.insightLevel.Modify(+5);
|
||||
};
|
||||
cheat.OnOneHPCode += delegate {
|
||||
foreach (BattleMonster m in this.monsters) {
|
||||
if (m.IsAlive()) {
|
||||
m.DealDamage(m.GetHP() - 1);
|
||||
}
|
||||
}
|
||||
OnBattleStateChanged();
|
||||
};
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
|
@ -260,13 +268,25 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
}
|
||||
OnBattleStateChanged();
|
||||
|
||||
// Monsters act until they pass
|
||||
// Monsters play an emotion
|
||||
List<MonsterCard> monsterHand = this.monsterDeck.GetHandPile();
|
||||
for (int i = 0; i < monsterHand.Count; i++) {
|
||||
MonsterCard monsterCard = monsterHand[i];
|
||||
if (CanUseMonsterCard(monsterCard)) {
|
||||
if (monsterCard.Type == CardType.Emotion && CanUseMonsterCard(monsterCard)) {
|
||||
yield return UseMonsterCard(monsterCard);
|
||||
}
|
||||
}
|
||||
|
||||
// Monsters play as many actions from the top as possible
|
||||
bool anyCardPlayed = true;
|
||||
while (anyCardPlayed) {
|
||||
anyCardPlayed = false;
|
||||
|
||||
MonsterCard monsterCard = FirstMonsterActionToPlay();
|
||||
if (monsterCard != null) {
|
||||
yield return UseMonsterCard(monsterCard);
|
||||
OnBattleStateChanged();
|
||||
anyCardPlayed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -282,6 +302,18 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
OnBattleStateChanged();
|
||||
}
|
||||
|
||||
private MonsterCard FirstMonsterActionToPlay() {
|
||||
List<MonsterCard> monsterHand = monsterHand = this.monsterDeck.GetHandPile();
|
||||
|
||||
for (int i = 0; i < monsterHand.Count; i++) {
|
||||
MonsterCard monsterCard = monsterHand[i];
|
||||
if (monsterCard.Type != CardType.Emotion && CanUseMonsterCard(monsterCard)) {
|
||||
return monsterCard;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IEnumerator UseHeroCard(HeroCard card) {
|
||||
if (!CanUseHeroCard(card)) {
|
||||
throw new System.InvalidOperationException("Cannot use card " + card.GetDisplayName());
|
||||
|
|
@ -298,8 +330,8 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
this.heroDeck.MoveCardToDiscard(card);
|
||||
}
|
||||
|
||||
OnBattleStateChanged();
|
||||
CheckState();
|
||||
OnBattleStateChanged();
|
||||
}
|
||||
|
||||
public IEnumerator UseMonsterCard(MonsterCard card) {
|
||||
|
|
@ -316,6 +348,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
CheckState();
|
||||
OnBattleStateChanged();
|
||||
}
|
||||
|
||||
public bool CanUseHeroCard(HeroCard card) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue