public void 利タイプ() { var param = new MonsterParams(prop, Type.Water); var dmg = DamageCalculator.Calculate(param, fireMove); Assert.That(dmg.value, Is.EqualTo(50)); }
public void 通常タイプ() { var param = new MonsterParams(prop, Type.Normal); var dmg = DamageCalculator.Calculate(param, normalMove); Assert.That(dmg.value, Is.EqualTo(100)); }
/// <inheritdoc /> public virtual ActionUseResult <TSource> Use <TSource>(Character user, IEnumerable <Character> otherCharacters) { if (ActionTargetCalculator.IsReactive) { EstablishTargets(user, otherCharacters); } if (!_targetsSet) { return(new ActionUseResult <TSource> { Success = false, Results = Enumerable.Empty <IActionResult <TSource> >(), Tags = new HashSet <string> { DamageActionResultTags.NoTargetsSet, }, }); } // action only succeeds if damage is calculated against all targets successfully var damageCalculations = DamageCalculator.Calculate(user, this, _targets.Where(c => !c.IsDead)); if (damageCalculations.Any(d => !d.Success)) { return(new ActionUseResult <TSource> { Success = false, Results = Enumerable.Empty <IActionResult <TSource> >(), Tags = new HashSet <string> { DamageActionResultTags.DamageCalculationFailed, }, }); } var results = new List <IActionResult <TSource> >(); foreach (var calculation in damageCalculations) { var result = calculation.Target.ReceiveDamage <TSource>(calculation.Amount, user); result.Action = this; foreach (var tag in Tags) { result.Tags.Add(tag); } results.Add(result); } _targetsSet = false; return(new ActionUseResult <TSource> { Success = true, Results = results, }); }
public void 相性倍率のダメージは切り捨てられる() { var fireMove2 = new MonsterMove(new MonsterMovePower(3), Type.Fire); var param = new MonsterParams(prop, Type.Water); var dmg = DamageCalculator.Calculate(param, fireMove2); // 1.5 が 切り捨てで 1 になる Assert.That(dmg.value, Is.EqualTo(1)); }