Monsters play emotions from hand

This commit is contained in:
henriquenakashima 2020-09-30 19:25:38 -04:00
parent 959458ad74
commit d513657396
8 changed files with 140 additions and 11 deletions

View file

@ -35,6 +35,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
private EnergyPool monsterEnergy;
private InsightLevel insightLevel;
private HandPlayability<HeroCard> heroHandPlayability;
private HandPlayability<MonsterCard> monsterHandPlayability;
private delegate void BattleStateChangedAction();
private event BattleStateChangedAction OnBattleStateChanged;
@ -129,6 +130,9 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
this.heroHandPlayability = new HandPlayability<HeroCard>(
this.state, this.heroEnergy, TeamChoice.Heroes, this.heroDeck);
this.OnBattleStateChanged += this.heroHandPlayability.NotifyBattleStateChanged;
this.monsterHandPlayability = new HandPlayability<MonsterCard>(
this.state, this.monsterEnergy, TeamChoice.Monsters, this.monsterDeck);
this.OnBattleStateChanged += this.monsterHandPlayability.NotifyBattleStateChanged;
this.battlePlayerControls.Init(
this.heroDeck, this.monsterDeck, this.playArea, this.insightLevel,
@ -220,10 +224,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
yield return new WaitForSeconds(0.5f);
// Start of monster turn
// TODO: Play emotions from hand
if (this.monsterEnergy.MaxEnergy < 9) {
this.monsterEnergy.DropOneEmotion();
}
foreach (BattleMonster monster in this.monsters) {
monster.ResetBlock();
}
@ -288,7 +288,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
}
public bool CanUseMonsterCard(MonsterCard card) {
return !this.state.HeroTurn && card.Owner.CanUseCard(card) && this.monsterEnergy.CanPayForCard(card);
return this.monsterHandPlayability.IsPlayable(card);
}
public BattleDeck<HeroCard> GetHeroDeck() {

View file

@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EagernessMCard : MonsterCard
{
public EagernessMCard(BattleParticipant owner)
: base(owner, MCardId.Eagerness, "Eagerness", 0, CardType.Emotion,
"1 Energy") {
}
public override IEnumerator Use(IBattleEffectApplier effectApplier,
MonsterViewpoint viewpoint) {
effectApplier.Apply(new DropEmotionEffect(1, this.owner.Team));
yield break;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0b071ea4a665da14989cc845ee07936a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -42,24 +42,31 @@ public class CheatBattle: MonoBehaviour
MonsterId.Bat,
};
MCardId[] mCardIds = new MCardId[10] {
MCardId[] mCardIds = new MCardId[17] {
MCardId.Eagerness,
MCardId.Eagerness,
MCardId.Eagerness,
MCardId.GraniteDefense,
MCardId.GraniteDefense,
MCardId.GolemCharge,
MCardId.GolemFist,
MCardId.Eagerness,
MCardId.Eagerness,
MCardId.VampireFangs,
MCardId.VampireFangs,
MCardId.Whirlwind,
MCardId.Eagerness,
MCardId.Eagerness,
MCardId.VampireFangs,
MCardId.VampireFangs,
MCardId.Whirlwind,
};
int[] mCardOwnerIndexes = new int[10] {
0, 0, 0, 0,
1, 1, 1,
2, 2, 2,
int[] mCardOwnerIndexes = new int[17] {
0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
2, 2, 2, 2, 2,
};
BattleParameters parameters = new BattleParameters();
parameters.SetHeroes(heroIds, hCardIds, hCardOwnerIndexes);

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
public enum MCardId {
Eagerness,
QuickSwiftDeath,
VampireFangs,
Whirlwind,
@ -21,6 +22,8 @@ public class MonsterCardDatabase : CardDatabase<MonsterCard>
MCardId monsterCardId = (MCardId) id;
switch (monsterCardId)
{
case MCardId.Eagerness:
return new EagernessMCard(owner);
case MCardId.QuickSwiftDeath:
return new QuickSwiftDeathMCard(owner);
case MCardId.VampireFangs: