DealDamage and AddBlock are effects
This commit is contained in:
parent
8b33f3ff5a
commit
cbc8c8b6cd
9 changed files with 71 additions and 3 deletions
|
|
@ -212,4 +212,12 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
||||||
this.GetHeroDeck().ShuffleDrawPile();
|
this.GetHeroDeck().ShuffleDrawPile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DealDamage(BattleParticipant target, int amount) {
|
||||||
|
target.DealDamage(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddBlock(BattleParticipant target, int amount) {
|
||||||
|
target.AddBlock(amount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,6 @@ public class CardCover : BaseCard
|
||||||
SingleTargeting singleTargeting = new SingleTargeting(new OtherHeroTargetPolicy(this.owner));
|
SingleTargeting singleTargeting = new SingleTargeting(new OtherHeroTargetPolicy(this.owner));
|
||||||
yield return playerControls.StartCoroutine(playerControls.ChooseTarget(singleTargeting));
|
yield return playerControls.StartCoroutine(playerControls.ChooseTarget(singleTargeting));
|
||||||
BattleParticipant target = singleTargeting.GetTarget();
|
BattleParticipant target = singleTargeting.GetTarget();
|
||||||
target.AddBlock(3);
|
effectApplier.Apply(new BlockEffect(target, 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,6 @@ public class CardCrashingPunch : BaseCard
|
||||||
SingleTargeting singleTargeting = new SingleTargeting(new AnyTargetPolicy());
|
SingleTargeting singleTargeting = new SingleTargeting(new AnyTargetPolicy());
|
||||||
yield return playerControls.StartCoroutine(playerControls.ChooseTarget(singleTargeting));
|
yield return playerControls.StartCoroutine(playerControls.ChooseTarget(singleTargeting));
|
||||||
BattleParticipant target = singleTargeting.GetTarget();
|
BattleParticipant target = singleTargeting.GetTarget();
|
||||||
target.DealDamage(3);
|
effectApplier.Apply(new DealDamageEffect(target, 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,6 @@ public class CardLightningStrike : BaseCard
|
||||||
SingleTargeting singleTargeting = new SingleTargeting(new AnyTargetPolicy());
|
SingleTargeting singleTargeting = new SingleTargeting(new AnyTargetPolicy());
|
||||||
yield return playerControls.StartCoroutine(playerControls.ChooseTarget(singleTargeting));
|
yield return playerControls.StartCoroutine(playerControls.ChooseTarget(singleTargeting));
|
||||||
BattleParticipant target = singleTargeting.GetTarget();
|
BattleParticipant target = singleTargeting.GetTarget();
|
||||||
target.DealDamage(3);
|
effectApplier.Apply(new DealDamageEffect(target, 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
Assets/Battle/Effects/BlockEffect.cs
Normal file
18
Assets/Battle/Effects/BlockEffect.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class BlockEffect : IBattleEffect
|
||||||
|
{
|
||||||
|
private BattleParticipant target;
|
||||||
|
private int amount;
|
||||||
|
|
||||||
|
public BlockEffect(BattleParticipant target, int amount) {
|
||||||
|
this.target = target;
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Apply(IBattleEffectResolver resolver) {
|
||||||
|
resolver.AddBlock(this.target, this.amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Battle/Effects/BlockEffect.cs.meta
Normal file
11
Assets/Battle/Effects/BlockEffect.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 12a289ee3f02ea141bf1897114ad3a6c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
18
Assets/Battle/Effects/DealDamageEffect.cs
Normal file
18
Assets/Battle/Effects/DealDamageEffect.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class DealDamageEffect : IBattleEffect
|
||||||
|
{
|
||||||
|
private BattleParticipant target;
|
||||||
|
private int amount;
|
||||||
|
|
||||||
|
public DealDamageEffect(BattleParticipant target, int amount) {
|
||||||
|
this.target = target;
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Apply(IBattleEffectResolver resolver) {
|
||||||
|
resolver.DealDamage(this.target, this.amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Battle/Effects/DealDamageEffect.cs.meta
Normal file
11
Assets/Battle/Effects/DealDamageEffect.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2ca9576d2f24db743ab8e8048fbce7c1
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public interface IBattleEffectResolver {
|
public interface IBattleEffectResolver {
|
||||||
|
void DealDamage(BattleParticipant target, int amount);
|
||||||
|
void AddBlock(BattleParticipant target, int amount);
|
||||||
void IncreaseHeroMaxEnergy(int delta);
|
void IncreaseHeroMaxEnergy(int delta);
|
||||||
void AcquireHeroCards(CardId[] cardIds, BattleZone zone, BattleHero owner);
|
void AcquireHeroCards(CardId[] cardIds, BattleZone zone, BattleHero owner);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue