Implement Echolocation

This commit is contained in:
henriquenakashima 2020-10-13 00:42:55 -04:00
parent 5962ea9fd6
commit 939b3e2664
6 changed files with 149 additions and 16 deletions

View file

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EcholocationMCard : MonsterCard
{
public EcholocationMCard(BattleParticipant owner)
: base(owner, MCardId.Echolocation, "Echolocation", 1, CardType.Skill,
"Block 1 damage on all Bats.") {
}
public override IEnumerator Use(IBattleEffectApplier effectApplier, MonsterViewpoint monsterViewpoint) {
yield return new WaitForSeconds(0.6f);
foreach (BattleMonster monster in monsterViewpoint.Monsters) {
if (monster.Id == MonsterId.Bat) {
effectApplier.Apply(new BlockEffect(monster, 1));
yield return new WaitForSeconds(0.3f);
}
}
}
}

View file

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

View file

@ -46,7 +46,7 @@ public class CheatBattle: MonoBehaviour
MonsterId.Bat, MonsterId.Bat,
}; };
MCardId[] mCardIds = new MCardId[17] { MCardId[] mCardIds = new MCardId[19] {
MCardId.Eagerness, MCardId.Eagerness,
MCardId.Eagerness, MCardId.Eagerness,
MCardId.Eagerness, MCardId.Eagerness,
@ -57,20 +57,22 @@ public class CheatBattle: MonoBehaviour
MCardId.Eagerness, MCardId.Eagerness,
MCardId.Eagerness, MCardId.Eagerness,
MCardId.Echolocation,
MCardId.VampireFangs, MCardId.VampireFangs,
MCardId.VampireFangs, MCardId.VampireFangs,
MCardId.Whirlwind, MCardId.Whirlwind,
MCardId.Eagerness, MCardId.Eagerness,
MCardId.Eagerness, MCardId.Eagerness,
MCardId.Echolocation,
MCardId.VampireFangs, MCardId.VampireFangs,
MCardId.VampireFangs, MCardId.VampireFangs,
MCardId.Whirlwind, MCardId.Whirlwind,
}; };
int[] mCardOwnerIndexes = new int[17] { int[] mCardOwnerIndexes = new int[19] {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 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

@ -8,7 +8,7 @@ public enum MCardId {
VampireFangs, VampireFangs,
Whirlwind, Whirlwind,
BlanketOfDarkness, BlanketOfDarkness,
Sonar, Echolocation,
GolemFist, GolemFist,
GraniteDefense, GraniteDefense,
SelfRepair, SelfRepair,
@ -18,28 +18,35 @@ public enum MCardId {
public class MonsterCardDatabase : CardDatabase<MonsterCard> public class MonsterCardDatabase : CardDatabase<MonsterCard>
{ {
public override MonsterCard CreateCard(int id, BattleParticipant owner) { private System.Type GetCardClass(MCardId id) {
MCardId monsterCardId = (MCardId) id; switch (id)
switch (monsterCardId)
{ {
case MCardId.Eagerness: case MCardId.Eagerness:
return new EagernessMCard(owner); return typeof(EagernessMCard);
case MCardId.QuickSwiftDeath: case MCardId.QuickSwiftDeath:
return new QuickSwiftDeathMCard(owner); return typeof(QuickSwiftDeathMCard);
case MCardId.VampireFangs: case MCardId.VampireFangs:
return new VampireFangsMCard(owner); return typeof(VampireFangsMCard);
case MCardId.Whirlwind: case MCardId.Whirlwind:
return new WhirlwindMCard(owner); return typeof(WhirlwindMCard);
case MCardId.Echolocation:
return typeof(EcholocationMCard);
case MCardId.GolemFist: case MCardId.GolemFist:
return new GolemFistMCard(owner); return typeof(GolemFistMCard);
case MCardId.GraniteDefense: case MCardId.GraniteDefense:
return new GraniteDefenseMCard(owner); return typeof(GraniteDefenseMCard);
case MCardId.GolemCharge: case MCardId.GolemCharge:
return new GolemChargeMCard(owner); return typeof(GolemChargeMCard);
case MCardId.GolemBerserk: case MCardId.GolemBerserk:
return new GolemBerserkMCard(owner); return typeof(GolemBerserkMCard);
default: default:
throw new System.ArgumentException("MCardId unknown", "id"); throw new System.ArgumentException("MCardId unknown", "id");
} }
} }
public override MonsterCard CreateCard(int id, BattleParticipant owner) {
MCardId monsterCardId = (MCardId) id;
System.Type cardClass = GetCardClass(monsterCardId);
return (MonsterCard) System.Activator.CreateInstance(cardClass, owner);
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View file

@ -0,0 +1,92 @@
fileFormatVersion: 2
guid: e1faf9a77d617ba41a6f3f3b66f8b95c
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: