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
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
DecideEnemyTarget();
|
|
||||||
StartHeroTurn();
|
StartHeroTurn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,19 +127,12 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
||||||
monster.ResetBlock();
|
monster.ResetBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
DealDamageEffect damageEffect = new DealDamageEffect(heroes[this.enemyTarget], 2);
|
MonsterCard card = MonsterCardDatabase.CreateCard(MCardId.VampireFangs, this.monsters[0]);
|
||||||
this.Apply(damageEffect);
|
StartCoroutine(UseMonsterCard(card));
|
||||||
|
|
||||||
DecideEnemyTarget();
|
|
||||||
StartHeroTurn();
|
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) {
|
public void NotifyHeroCardUsed(HeroCard card) {
|
||||||
if (!CanUseHeroCard(card)) {
|
if (!CanUseHeroCard(card)) {
|
||||||
throw new System.InvalidOperationException("Cannot use card " + card.GetDisplayName());
|
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() {
|
public void NotifyHeroTurnPassed() {
|
||||||
if (this.heroTurn) {
|
if (this.heroTurn) {
|
||||||
StartEnemyTurn();
|
StartEnemyTurn();
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ public class CardDatabase
|
||||||
{CardId.Thunderstorm, HeroId.Shaman},
|
{CardId.Thunderstorm, HeroId.Shaman},
|
||||||
};
|
};
|
||||||
|
|
||||||
public static BaseCard CreateCard(CardId id, BattleParticipant owner) {
|
public static HeroCard CreateCard(CardId id, BattleParticipant owner) {
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case CardId.CrashingPunch:
|
case CardId.CrashingPunch:
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
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,
|
: base(owner, MCardId.VampireFangs, "VampireFangs", 2, CardType.Attack,
|
||||||
"Steals 2 HP from target.") {
|
"Steals 2 HP from target.") {
|
||||||
}
|
}
|
||||||
|
|
@ -8,4 +8,13 @@ public enum MCardId {
|
||||||
|
|
||||||
public static class MonsterCardDatabase
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
TODO.txt
3
TODO.txt
|
|
@ -1 +1,4 @@
|
||||||
- Make API of IBattleEffectResolver take in effects instead of params
|
- Make API of IBattleEffectResolver take in effects instead of params
|
||||||
|
- Make VampireFangs hit hero with highest HP
|
||||||
|
- Control flow of battle with state machine or coroutines
|
||||||
|
- Make battle end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue