public void OnEvaded_ApplyTwice_OnlyGeneratesOneReaction() { var target = TestMembers.Create(s => s.With(StatType.MaxHP, 10)); var attacker = TestMembers.Create(s => s.With(StatType.Attack, 1)); target.State.AdjustEvade(1); var reactionCardType = TestCards.Reaction( ReactiveMember.Possessor, ReactiveTargetScope.Self, new EffectData { EffectType = EffectType.AdjustStatAdditively, FloatAmount = new FloatReference(1), EffectScope = new StringReference("Armor"), NumberOfTurns = new IntReference(-1) }); AllEffects.Apply(new EffectData { EffectType = EffectType.OnEvaded, NumberOfTurns = new IntReference(3), ReactionSequence = reactionCardType }, new EffectContext(target, new Single(target))); ReactiveTestUtilities.ApplyEffectAndReactions(new EffectData { EffectType = EffectType.Attack, FloatAmount = new FloatReference(1), EffectScope = new StringReference(ReactiveTargetScope.Self.ToString()) }, attacker, target); Assert.AreEqual(10, target.State[TemporalStatType.HP]); Assert.AreEqual(1, target.State.Armor()); }
public void ReactiveTrigger_OnAttacked_AttackerHitForOneDamage() { var target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Attack, 1)); var attacker = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Attack, 1)); var reactionCardType = TestCards.Reaction( ReactiveMember.Originator, ReactiveTargetScope.Attacker, new EffectData { EffectType = EffectType.Attack, FloatAmount = new FloatReference(1) }); AllEffects.Apply(new EffectData { EffectType = EffectType.OnAttacked, NumberOfTurns = new IntReference(3), ReactionSequence = reactionCardType }, target, target); ReactiveTestUtilities.ApplyEffectAndReactions(new EffectData { EffectType = EffectType.Attack, FloatAmount = new FloatReference(1), EffectScope = new StringReference(ReactiveTargetScope.Self.ToString()) }, attacker, target); Assert.AreEqual(9, attacker.CurrentHp()); }
public void OnShieldBroken_Attacked_TriggersCorrectly(int startingShields, bool triggered) { var target = TestMembers.Create(x => x.With(StatType.MaxHP, 10).With(StatType.Toughness, 1)); var attacker = TestMembers.Create(s => s.With(StatType.Attack, 1)); target.State.GainShield(startingShields); var reactionCardType = TestCards.Reaction( ReactiveMember.Possessor, ReactiveTargetScope.Self, new EffectData { EffectType = EffectType.AdjustStatAdditively, FloatAmount = new FloatReference(1), EffectScope = new StringReference("Armor"), NumberOfTurns = new IntReference(-1) }); AllEffects.Apply(new EffectData { EffectType = EffectType.OnShieldBroken, NumberOfTurns = new IntReference(3), ReactionSequence = reactionCardType }, target, target); ReactiveTestUtilities.ApplyEffectAndReactions(new EffectData { EffectType = EffectType.Attack, FloatAmount = new FloatReference(1), EffectScope = new StringReference(ReactiveTargetScope.Self.ToString()) }, attacker, target); Assert.AreEqual(triggered ? 1 : 0, target.State.Armor()); }
public void ReactiveTrigger_OnAttacked_GainedOneArmor() { var target = TestMembers.Create(s => s.With(StatType.MaxHP, 10)); var attacker = TestMembers.Create(s => s.With(StatType.Attack, 1)); var reactionCardType = TestCards.Reaction( ReactiveMember.Possessor, ReactiveTargetScope.Self, new EffectData { EffectType = EffectType.AdjustStatAdditively, FloatAmount = new FloatReference(1), EffectScope = new StringReference("Armor"), NumberOfTurns = new IntReference(-1) }); AllEffects.Apply(new EffectData { EffectType = EffectType.OnAttacked, NumberOfTurns = new IntReference(3), ReactionSequence = reactionCardType }, target, target); ReactiveTestUtilities.ApplyEffectAndReactions(new EffectData { EffectType = EffectType.Attack, FloatAmount = new FloatReference(1), EffectScope = new StringReference(ReactiveTargetScope.Self.ToString()) }, attacker, target); Assert.AreEqual(1, target.State.Armor()); }
public void HealPrimaryResourceTests_ApplyEffect() { EffectData healPrimary = new EffectData { EffectType = EffectType.HealPrimaryResource }; Member performer = TestMembers.Create( s => { StatAddends addend = new StatAddends(); addend.ResourceTypes = addend.ResourceTypes.Concat( new InMemoryResourceType { Name = "Resource", StartingAmount = 0, MaxAmount = 2 } ).ToArray(); addend.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f); return(addend); } ); performer.State.TakeRawDamage(6); performer.State.GainPrimaryResource(2); AllEffects.Apply(healPrimary, performer, new Single(performer)); Assert.AreEqual( 6, performer.State[TemporalStatType.HP], "Did not healed primary resource quantity" ); }
public void HealFlat_ApplyEffect_DoesNotPassFullHealth() { Member target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); new Heal(5).Apply(TestMembers.Any(), new Single(target)); Assert.AreEqual(10, target.State[TemporalStatType.HP]); }
public void SpellFlatDamageEffect_DamageTargetWithResistance_DamageIsAppliedCorrectly() { var target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Resistance, 1)); new SpellFlatDamageEffect(2).Apply(TestMembers.Any(), target); Assert.AreEqual(9, target.CurrentHp()); }
public void PhysicalDamage_DamageArmoredTarget_ApplyEffect() { var target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Armor, 1)); new Damage(new PhysicalDamage(1)).Apply(_attacker, new Single(target)); Assert.AreEqual(9, target.State[TemporalStatType.HP]); }
public void ResourceFlat_ApplyEffect() { var performer = TestMembers.Create(s => s, Ammo); AllEffects.Apply(data, performer, new Single(performer)); Assert.AreEqual(5, performer.State[Ammo]); }
public void SpellFlatDamageEffect_DamageTargetWithNoResistance_DamageIsAppliedCorrectly() { Member attacker = TestMembers.Any(); Member target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); new SpellFlatDamageEffect(1).Apply(attacker, target); Assert.AreEqual(9, target.State[TemporalStatType.HP]); }
public void Attack_ApplyEffect_AttackIsAppliedCorrectly() { var attacker = TestMembers.Create(s => s.With(StatType.Attack, 1f)); var target = TestMembers.Create(s => s.With(StatType.MaxHP, 10)); new Attack(1).Apply(attacker, new Single(target)); Assert.AreEqual(9, target.State[TemporalStatType.HP]); }
public void PhysicalDamage_DamageUnarmoredTarget_ApplyEffect() { var attacker = TestMembers.With(StatType.Attack, 2); var target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); new Damage(new PhysicalDamage(1)).Apply(attacker, new MemberAsTarget(target)); Assert.AreEqual(8, target.State[TemporalStatType.HP]); }
public void HealFlat_Take6DamageAndThenHeal5_HpIsCorrect() { Member target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); target.State.TakeRawDamage(6); new Heal(5).Apply(TestMembers.Any(), new Single(target)); Assert.AreEqual(9, target.State[TemporalStatType.HP]); }
public void Attack_ApplyEffect_AttackIsAppliedCorrectly() { Member attacker = TestMembers.Create( s => s.With(StatType.Attack, 1f).With(StatType.MaxHP, 10).With(StatType.Damagability, 1f) ); Member target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); new Attack(1).Apply(attacker, target); Assert.AreEqual(9, target.State[TemporalStatType.HP]); }
public void AdjustStatAdditively_ApplyEffect_CharactersStatsAdjusted() { var adjustment = new EffectData { EffectType = EffectType.AdjustStatAdditively, EffectScope = new StringReference("Attack"), FloatAmount = new FloatReference(1), NumberOfTurns = new IntReference(0) }; var target = TestMembers.Create(s => s.With(StatType.Attack, 10)); AllEffects.Apply(adjustment, TestMembers.Any(), target); Assert.AreEqual(11, target.State[StatType.Attack]); }
public void DamageOnAttacker_ApplyEffect_AttackerIsNotDamagedOnAttackingOther() { Member paladin = TestMembers.Create(s => s.With(StatType.Attack, 1f)); Member ally = TestMembers.Any(); Member attacker = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); AllEffects.Apply(DamageAttackerOnAttack(1), paladin, new Single(ally)); new Attack(0).Apply(attacker, paladin); Assert.AreEqual(10, attacker.State[TemporalStatType.HP]); }
public void VulnerableMember_IsAttacked_TakesCorrectDamage() { var attacker = TestMembers.Create(s => s.With(StatType.Attack, 10)); var target = TestMembers.Create(s => s.With(StatType.MaxHP, 30)); AllEffects.Apply(Vulnerable(), attacker, target); new Attack(1).Apply(attacker, target); Assert.AreEqual(1.33f, target.State[StatType.Damagability]); Assert.AreEqual(16, target.CurrentHp()); }
public void PhysicalDamage_DamageMultipleEnemies_ApplyEffect() { var target = new[] { TestMembers.Create(s => s.With(StatType.MaxHP, 10)), TestMembers.Create(s => s.With(StatType.MaxHP, 10)) }; new Damage(new PhysicalDamage(1)).Apply(_attacker, new Multiple(target)); Assert.AreEqual(8, target[0].State[TemporalStatType.HP]); Assert.AreEqual(8, target[1].State[TemporalStatType.HP]); }
public void RemoveDebuffs_ApplyEffect_RemovesAdditiveEffect() { var removeDebuffs = new EffectData { EffectType = EffectType.RemoveDebuffs }; var target = TestMembers.Create(s => s.With(StatType.Attack, 10)); target.State.ApplyTemporaryAdditive(new AdjustedStats(new StatAddends().With(StatType.Attack, -5), 5, true, false, StatusTag.None)); AllEffects.Apply(removeDebuffs, TestMembers.Any(), target); Assert.AreEqual(10, target.State[StatType.Attack]); }
public void RemoveDebuffs_ApplyEffect_DoesNotRemoveBuff() { var removeDebuffs = new EffectData { EffectType = EffectType.RemoveDebuffs }; var target = TestMembers.Create(s => s); target.State.AddReactiveState(new ReactOnAttacked(false, 2, 2, ReactiveTriggerScope.All, new Dictionary <int, Member>(), 1, target, TestCards.AnyReaction())); AllEffects.Apply(removeDebuffs, TestMembers.Any(), target); Assert.True(target.State.HasStatus(StatusTag.CounterAttack)); }
public void ExcludeSelfFromEffect_ApplyEffect_ExcludeSelfAndApplyAlly() { var caster = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); var ally = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); caster.State.TakeRawDamage(1); ally.State.TakeRawDamage(1); new ExcludeSelfFromEffect(new Heal(5)).Apply(caster, new Multiple(new[] { caster, ally })); Assert.AreEqual(9, caster.State[TemporalStatType.HP], "Applied effect to self"); Assert.AreEqual(10, ally.State[TemporalStatType.HP], "Did not applied effect to ally"); }
public void With0Armor_ReduceArmor_ArmorIs0() { var member = TestMembers.Create(s => s.With(StatType.MaxHP, 10)); var attacker = TestMembers.Create(s => s.With(StatType.Attack, 5)); AllEffects.Apply(new EffectData { EffectType = EffectType.AdjustStatAdditively, EffectScope = new StringReference(StatType.Armor.ToString()), FloatAmount = new FloatReference(-1) }, attacker, member); Assert.AreEqual(0, member.Armor()); }
public void Evade_ApplyEffect_AttackIsEvaded() { Member evader = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); Member attacker = TestMembers.With(StatType.Attack, 1); new Evade().Apply(evader, new MemberAsTarget(evader)); new Attack(5).Apply(attacker, evader); Assert.AreEqual( 10, evader.State[TemporalStatType.HP], "Target did not evaded attack" ); }
public void ApplyOnShieldBelowValue_ApplyEffectWhenShieldIsBelowValue() { Member source = TestMembers.Any(); Member target = TestMembers.Create( s => s.With(StatType.MaxHP, 10) .With(StatType.Damagability, 1f) .With(StatType.Toughness, 1f) ); new ApplyOnShieldBelowValue( new SpellFlatDamageEffect(1), 1 ).Apply(source, new Single(target)); Assert.AreEqual(9, target.State[TemporalStatType.HP]); }
public void ApplyOnChanceTests_DoesNotApplyWhen0() { Member source = TestMembers.Any(); Member target = TestMembers.Create( s => s.With(StatType.MaxHP, 10) .With(StatType.Damagability, 1f) .With(StatType.Toughness, 1f) ); new ApplyOnChance( new SpellFlatDamageEffect(1), 0 ).Apply(source, new Single(target)); Assert.AreEqual(10, target.State[TemporalStatType.HP]); }
public void StealLifeOnAttack_ApplyEffect_LifeIsStolenCorrectly() { var caster = TestMembers.Any(); var attacker = TestMembers.Create( s => s.With(StatType.Attack, 1f).With(StatType.MaxHP, 10).With(StatType.Damagability, 1f) ); var target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); attacker.State.TakeRawDamage(6); AllEffects.Apply(StealLifeOnAttack(), caster, new Single(attacker)); new Attack(5).Apply(attacker, new Single(target)); Assert.AreEqual(9, attacker.State[TemporalStatType.HP]); }
public void OnNextTurnEffect_ApplyEffect_DoesNotApplyInCurrentTurn() { OnNextTurnEffect timedDamage = new OnNextTurnEffect( AllEffects.Create(DamageTarget(1)) ); Member attacker = TestMembers.With(StatType.Attack, 1); Member target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); timedDamage.Apply(attacker, new Single(target)); Assert.AreEqual( 10, target.State[TemporalStatType.HP], "Effect applied on current turn." ); }
public void Regeneration_ApplyEffect_RegenerateFlatForTurns() { Member attacker = TestMembers.With(StatType.Attack, 1); Member caster = TestMembers.Any(); Member target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); //creating damage new Attack(5).Apply(attacker, new Single(target)); Debug.Log("Target has " + target.State[TemporalStatType.HP] + "HP"); new HealFlatForTurnsOnTurnStart(1, 3).Apply(caster, new Single(target)); BattleEvent.Publish(new TurnEnd()); BattleEvent.Publish(new TurnStart()); Assert.AreEqual( 6, target.State[TemporalStatType.HP], "Effect did not applied on turn 1." ); BattleEvent.Publish(new TurnEnd()); BattleEvent.Publish(new TurnStart()); Assert.AreEqual( 7, target.State[TemporalStatType.HP], "Effect did not applied on turn 2." ); BattleEvent.Publish(new TurnEnd()); BattleEvent.Publish(new TurnStart()); Assert.AreEqual( 8, target.State[TemporalStatType.HP], "Effect did not applied on turn 3." ); BattleEvent.Publish(new TurnEnd()); BattleEvent.Publish(new TurnStart()); Assert.AreEqual( 8, target.State[TemporalStatType.HP], "Effect applied on turn 4." ); }
public void Recurrent_ApplyEffect_ApplyCorrectTimes() { Effect oneTimer = new Recurrent( AllEffects.Create(DamageTarget(1)) ); Member attacker = TestMembers.With(StatType.Attack, 1); Member target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); oneTimer.Apply(attacker, new Single(target)); oneTimer.Apply(attacker, new Single(target)); Assert.AreEqual( 9, target.State[TemporalStatType.HP], "Effect applied more than the repetition limit." ); }
public void OnNextTurnEffect_ApplyEffect_ApplyOnNextTurn() { OnNextTurnEffect timedDamage = new OnNextTurnEffect( AllEffects.Create(DamageTarget(1)) ); Member attacker = TestMembers.With(StatType.Attack, 1); Member target = TestMembers.Create(s => s.With(StatType.MaxHP, 10).With(StatType.Damagability, 1f)); BattleEvent.Publish(new TurnEnd()); timedDamage.Apply(attacker, new Single(target)); Assert.AreEqual( 9, target.State[TemporalStatType.HP], "Effect did not applied on next turn." ); }