Use VampireFangs instead of flat 2 damage
This commit is contained in:
parent
cce0b2891c
commit
c34b065ff5
6 changed files with 22 additions and 13 deletions
|
|
@ -92,7 +92,6 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
DecideEnemyTarget();
|
||||
StartHeroTurn();
|
||||
}
|
||||
|
||||
|
|
@ -128,19 +127,12 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
monster.ResetBlock();
|
||||
}
|
||||
|
||||
DealDamageEffect damageEffect = new DealDamageEffect(heroes[this.enemyTarget], 2);
|
||||
this.Apply(damageEffect);
|
||||
MonsterCard card = MonsterCardDatabase.CreateCard(MCardId.VampireFangs, this.monsters[0]);
|
||||
StartCoroutine(UseMonsterCard(card));
|
||||
|
||||
DecideEnemyTarget();
|
||||
StartHeroTurn();
|
||||
}
|
||||
|
||||
private int enemyTarget;
|
||||
private void DecideEnemyTarget() {
|
||||
this.enemyTarget = Random.Range(0, 3);
|
||||
Debug.Log("Will attack " + this.heroes[this.enemyTarget].GetDisplayName());
|
||||
}
|
||||
|
||||
public void NotifyHeroCardUsed(HeroCard card) {
|
||||
if (!CanUseHeroCard(card)) {
|
||||
throw new System.InvalidOperationException("Cannot use card " + card.GetDisplayName());
|
||||
|
|
@ -159,6 +151,11 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
}
|
||||
}
|
||||
|
||||
public IEnumerator UseMonsterCard(MonsterCard card) {
|
||||
yield return card.Use(this, this);
|
||||
// TODO: Manage monster deck.
|
||||
}
|
||||
|
||||
public void NotifyHeroTurnPassed() {
|
||||
if (this.heroTurn) {
|
||||
StartEnemyTurn();
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class CardDatabase
|
|||
{CardId.Thunderstorm, HeroId.Shaman},
|
||||
};
|
||||
|
||||
public static BaseCard CreateCard(CardId id, BattleParticipant owner) {
|
||||
public static HeroCard CreateCard(CardId id, BattleParticipant owner) {
|
||||
switch (id)
|
||||
{
|
||||
case CardId.CrashingPunch:
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MCardVampireFangs : MonsterCard
|
||||
public class VampireFangsMCard : MonsterCard
|
||||
{
|
||||
public MCardVampireFangs(BattleParticipant owner)
|
||||
public VampireFangsMCard(BattleParticipant owner)
|
||||
: base(owner, MCardId.VampireFangs, "VampireFangs", 2, CardType.Attack,
|
||||
"Steals 2 HP from target.") {
|
||||
}
|
||||
|
|
@ -8,4 +8,13 @@ public enum MCardId {
|
|||
|
||||
public static class MonsterCardDatabase
|
||||
{
|
||||
public static MonsterCard CreateCard(MCardId id, BattleParticipant owner) {
|
||||
switch (id)
|
||||
{
|
||||
case MCardId.VampireFangs:
|
||||
return new VampireFangsMCard(owner);
|
||||
default:
|
||||
throw new System.ArgumentException("MCardId unknown", "id");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue