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 EnergyPool monsterEnergy;
private InsightLevel insightLevel; private InsightLevel insightLevel;
private HandPlayability<HeroCard> heroHandPlayability; private HandPlayability<HeroCard> heroHandPlayability;
private HandPlayability<MonsterCard> monsterHandPlayability;
private delegate void BattleStateChangedAction(); private delegate void BattleStateChangedAction();
private event BattleStateChangedAction OnBattleStateChanged; private event BattleStateChangedAction OnBattleStateChanged;
@ -129,6 +130,9 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
this.heroHandPlayability = new HandPlayability<HeroCard>( this.heroHandPlayability = new HandPlayability<HeroCard>(
this.state, this.heroEnergy, TeamChoice.Heroes, this.heroDeck); this.state, this.heroEnergy, TeamChoice.Heroes, this.heroDeck);
this.OnBattleStateChanged += this.heroHandPlayability.NotifyBattleStateChanged; 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.battlePlayerControls.Init(
this.heroDeck, this.monsterDeck, this.playArea, this.insightLevel, this.heroDeck, this.monsterDeck, this.playArea, this.insightLevel,
@ -220,10 +224,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
yield return new WaitForSeconds(0.5f); yield return new WaitForSeconds(0.5f);
// Start of monster turn // Start of monster turn
// TODO: Play emotions from hand
if (this.monsterEnergy.MaxEnergy < 9) {
this.monsterEnergy.DropOneEmotion();
}
foreach (BattleMonster monster in this.monsters) { foreach (BattleMonster monster in this.monsters) {
monster.ResetBlock(); monster.ResetBlock();
} }
@ -288,7 +288,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
} }
public bool CanUseMonsterCard(MonsterCard card) { 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() { 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, MonsterId.Bat,
}; };
MCardId[] mCardIds = new MCardId[10] { MCardId[] mCardIds = new MCardId[17] {
MCardId.Eagerness,
MCardId.Eagerness,
MCardId.Eagerness,
MCardId.GraniteDefense, MCardId.GraniteDefense,
MCardId.GraniteDefense, MCardId.GraniteDefense,
MCardId.GolemCharge, MCardId.GolemCharge,
MCardId.GolemFist, MCardId.GolemFist,
MCardId.Eagerness,
MCardId.Eagerness,
MCardId.VampireFangs, MCardId.VampireFangs,
MCardId.VampireFangs, MCardId.VampireFangs,
MCardId.Whirlwind, MCardId.Whirlwind,
MCardId.Eagerness,
MCardId.Eagerness,
MCardId.VampireFangs, MCardId.VampireFangs,
MCardId.VampireFangs, MCardId.VampireFangs,
MCardId.Whirlwind, MCardId.Whirlwind,
}; };
int[] mCardOwnerIndexes = new int[10] { int[] mCardOwnerIndexes = new int[17] {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2,
}; };
BattleParameters parameters = new BattleParameters(); BattleParameters parameters = new BattleParameters();
parameters.SetHeroes(heroIds, hCardIds, hCardOwnerIndexes); parameters.SetHeroes(heroIds, hCardIds, hCardOwnerIndexes);

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -0,0 +1,92 @@
fileFormatVersion: 2
guid: f5269cc882165b047a6e278062455e87
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -3,7 +3,6 @@ Battle
- Do not Highlight unusable cards - Do not Highlight unusable cards
- Show which cards enemies will use - Show which cards enemies will use
- Show on who enemies will use the cards - Show on who enemies will use the cards
- Extend BattleState to be more than hero turn true/false
- Highlight which card is targeting - Highlight which card is targeting
- Allow cancelling targeting - Allow cancelling targeting