2026-11-05 14:31:27 +00:00
using System.Collections ;
using System.Collections.Generic ;
using NUnit.Framework ;
using TKS.OutGame ;
using UnityEngine ;
using UnityEngine.SceneManagement ;
using UnityEngine.TestTools ;
namespace TKS.Tests
{
/// <summary>
2026-11-10 10:00:18 +00:00
/// 스킬(2026-11-10 #1112 · PD 엑셀 「장수 목록」 새 기획 · 효과 표 skill_effects.csv) — 효과 묶음별 동작:
/// 표 무결 · 진영 버프·부활 · 즉시 광역(피해·밀기·출혈 / 피해 없는 기절) · 재행동·반격 면역 · 무조건 치명타·흡혈 · 중독 중첩 · 혼란 · 출혈 · 무적 ·
/// 호위 · 기병 복귀 · 거대 화살 · 화염구(화상) · 회복·정화 · 위치 교환 · 아군 통과·탭 밀치기 · 보병 관통 · 가상 실행 복원.
/// 기대값은 효과 표 수치(SkillCatalog · Eff)와 자산 값에서 읽는다(C45 · 테스트에 수치 상수 없음 · 스킬 id 만 지정).
2026-11-05 14:31:27 +00:00
/// </summary>
public class SkillTests
{
BattleManager bm ;
BalanceConfig cfg ;
[UnitySetUp]
public IEnumerator SetUp ( )
{
WorldProgress . Reset ( ) ;
SaveStore . UseMemory ( true ) ;
SceneManager . LoadScene ( "Battle" ) ;
yield return null ;
yield return null ;
bm = BattleManager . Instance ;
Assert . IsNotNull ( bm ) ;
var wm = WorldMapScreen . Instance ;
if ( wm ! = null & & wm . HasData ) wm . EnterStage ( 0 , 0 ) ;
yield return null ;
cfg = bm . Config ;
2026-11-10 10:00:18 +00:00
SkillSystem . AutoTap = true ;
2026-11-05 14:31:27 +00:00
Time . timeScale = 20f ;
}
[UnityTearDown]
public IEnumerator TearDown ( )
{
2026-11-10 10:00:18 +00:00
SkillSystem . AutoTap = false ;
2026-11-05 14:31:27 +00:00
Time . timeScale = 1f ;
yield return null ;
}
IEnumerator Fresh ( )
{
bm . StopAllCoroutines ( ) ;
bm . ClearUnits ( ) ;
bm . ForcePhase ( BattlePhase . PlayerTurn ) ;
bm . SetTurnForTest ( 1 ) ;
yield return null ;
}
// ---------- 도우미 ----------
2026-11-10 10:00:18 +00:00
static SkillEffect Eff ( string skillId , string key )
2026-11-05 14:31:27 +00:00
{
var d = SkillCatalog . Get ( skillId ) ;
Assert . IsNotNull ( d , skillId ) ;
2026-11-10 10:00:18 +00:00
foreach ( var e in d . ScaledEffects ( 1 , 1f ) )
2026-11-05 14:31:27 +00:00
if ( e . Key = = key ) return e ;
Assert . Fail ( skillId + " 에 " + key + " 없음" ) ;
return null ;
}
2026-11-10 10:00:18 +00:00
Unit Spawn ( UnitType t , Faction f , float x , float y , string name )
2026-11-05 14:31:27 +00:00
{
2026-11-10 10:00:18 +00:00
return bm . SpawnUnit ( t , f , new Vector2 ( x , y ) , name , 1f , 1f , false ) ;
2026-11-05 14:31:27 +00:00
}
2026-11-10 10:00:18 +00:00
UnitSkills Give ( Unit u , string heroId )
2026-11-05 14:31:27 +00:00
{
2026-11-10 10:00:18 +00:00
var s = bm . Skills . AttachHero ( u , heroId ) ;
2026-11-05 14:31:27 +00:00
Assert . IsNotNull ( s , heroId ) ;
return s ;
}
2026-11-10 10:00:18 +00:00
void Begin ( )
2026-11-05 14:31:27 +00:00
{
2026-11-10 10:00:18 +00:00
bm . Skills . BeginBattle ( ) ;
2026-11-05 14:31:27 +00:00
}
2026-11-10 10:00:18 +00:00
IEnumerator Act ( Unit u , Vector2 target , ActionOutcome o )
2026-11-05 14:31:27 +00:00
{
2026-11-10 10:00:18 +00:00
yield return bm . ResolveForTest ( u , target , false , o ) ;
2026-11-05 14:31:27 +00:00
}
2026-11-10 10:00:18 +00:00
IEnumerator ActArmed ( Unit u , Vector2 target , ActionOutcome o )
2026-11-05 14:31:27 +00:00
{
2026-11-10 10:00:18 +00:00
bm . Skills . Of ( u ) . Reserved = true ;
yield return bm . ResolveForTest ( u , target , false , o ) ;
2026-11-05 14:31:27 +00:00
}
2026-11-10 10:00:18 +00:00
// ---------- 표 ----------
2026-11-05 14:31:27 +00:00
2026-11-10 10:00:18 +00:00
[UnityTest]
public IEnumerator Data_EveryHeroSkillHasEffects ( )
2026-11-05 14:31:27 +00:00
{
2026-11-10 10:00:18 +00:00
yield return Fresh ( ) ;
var db = OutGameData . Default ;
Assert . IsNotNull ( db ) ;
int skills = 0 ;
foreach ( var h in db . Heroes . heroes )
2026-11-05 14:31:27 +00:00
{
2026-11-10 10:00:18 +00:00
if ( h . isSoldier ) continue ;
foreach ( var sid in new [ ] { h . skillActive , h . skillPassive } )
2026-11-05 14:31:27 +00:00
{
2026-11-10 10:00:18 +00:00
var d = SkillCatalog . Get ( sid ) ;
Assert . IsNotNull ( d , sid ) ;
Assert . Greater ( d . Effects . Count , 0 , sid + " 효과 줄" ) ;
foreach ( var e in d . Effects ) Assert . IsTrue ( SkillKeys . Known ( e . Key ) , sid + " " + e . Key ) ;
skills + + ;
2026-11-05 14:31:27 +00:00
}
}
2026-11-10 10:00:18 +00:00
Assert . AreEqual ( db . Skills . skills . Count , skills ) ;
Assert . IsTrue ( db . Heroes . Get ( "diaochan" ) . Female ) ;
Assert . IsFalse ( db . Heroes . Get ( "lvbu" ) . Female ) ;
2026-11-05 14:31:27 +00:00
}
2026-11-10 10:00:18 +00:00
// ---------- 패시브: 진영 공격 · 부활 ----------
2026-11-05 14:31:27 +00:00
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator Passive_CampAttack_And_Revive ( )
2026-11-05 14:31:27 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var liu = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 3f , "유비" ) ;
Give ( liu , "liubei" ) ;
var shu = Spawn ( UnitType . Spear , Faction . Player , 2f , - 3f , "촉" ) ;
Give ( shu , "guanyu" ) ;
var wei = Spawn ( UnitType . Spear , Faction . Player , 4f , - 3f , "위" ) ;
Give ( wei , "zhanghe" ) ;
Begin ( ) ;
float camp = Eff ( "liubei_p" , SkillKeys . AtkPct ) . P ;
Assert . AreEqual ( 1f + camp , SkillMods . AttackMult ( liu ) , 1e-4f , "촉 진영 공격 +" ) ;
Assert . AreEqual ( 1f , SkillMods . AttackMult ( wei ) , 1e-4f , "위 진영은 안 받음" ) ;
var rv = Eff ( "liubei_p" , SkillKeys . Revive ) ;
int got = bm . Skills . Hit ( liu , liu . Hp + 50 , null , HitKind . Dot ) ;
Assert . IsTrue ( liu . IsAlive , "부활" ) ;
Assert . AreEqual ( Mathf . RoundToInt ( liu . MaxHp * rv . P ) , liu . Hp ) ;
Assert . Greater ( got , 0 ) ;
bm . Skills . Hit ( liu , liu . Hp + 50 , null , HitKind . Dot ) ;
Assert . IsFalse ( liu . IsAlive , "부활은 전투당 " + rv . Get ( 1 ) + "회" ) ;
2026-11-05 14:31:27 +00:00
}
2026-11-10 10:00:18 +00:00
// ---------- 즉시 광역 ----------
2026-11-05 14:31:27 +00:00
2026-11-10 10:00:18 +00:00
[UnityTest]
public IEnumerator Instant_AoeStrike_DamagePushBleed ( )
{
yield return Fresh ( ) ;
var gy = Spawn ( UnitType . Spear , Faction . Player , 0f , 0f , "관우" ) ;
var s = Give ( gy , "guanyu" ) ;
var aoe = Eff ( "guanyu_a" , SkillKeys . AoeStrike ) ;
2026-11-17 07:27:22 +00:00
float reach = SkillSystem . AoeRadius ( gy , aoe ) ; // p1 0 = 행동 반경(슬링 최대 거리 · 2026-11-11)
var near = Spawn ( UnitType . Infantry , Faction . Enemy , reach * 0.5f , 0f , "근처" ) ;
var far = Spawn ( UnitType . Infantry , Faction . Enemy , reach + 3f , 0f , "멀리" ) ;
2026-11-10 10:00:18 +00:00
Begin ( ) ;
int hp0 = near . Hp , farHp = far . Hp ;
float d0 = Vector2 . Distance ( gy . Position , near . Position ) ;
yield return bm . Skills . Instant ( s ) ;
yield return new WaitForSeconds ( 0.3f ) ;
Assert . Less ( near . Hp , hp0 , "반경 안 피해" ) ;
Assert . AreEqual ( farHp , far . Hp , "반경 밖 무사" ) ;
Assert . Greater ( Vector2 . Distance ( gy . Position , near . Position ) , d0 + 0.05f , "바깥으로 밀림" ) ;
Assert . IsTrue ( SkillStatus . Bleeding ( near ) , "출혈" ) ;
Assert . AreEqual ( 1 + s . Active . Cooldown , s . ReadyTurn , "쿨" ) ;
2026-11-05 14:31:27 +00:00
}
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator Instant_AoeStun_NoDamage ( )
2026-11-05 14:31:27 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var zf = Spawn ( UnitType . Cavalry , Faction . Player , 0f , 0f , "장비" ) ;
var s = Give ( zf , "zhangfei" ) ;
var aoe = Eff ( "zhangfei_a" , SkillKeys . AoeStrike ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , aoe . P * 0.5f , 0f , "적" ) ;
Begin ( ) ;
int hp0 = foe . Hp ;
yield return bm . Skills . Instant ( s ) ;
Assert . AreEqual ( hp0 , foe . Hp , "피해 없음(p2 0)" ) ;
Assert . IsTrue ( SkillStatus . Stunned ( foe ) , "기절" ) ;
2026-11-05 14:31:27 +00:00
}
2026-11-20 10:22:16 +00:00
[UnityTest]
public IEnumerator Instant_AoeHits_SplitDamage_PushAfterLastHit ( )
{
// PD 2026-11-19 능통 「회전하는 동안 최대 6회의 피해 · 이펙트 재생시간 동안 6회에 나눠서 · 밀려나는 시점은 6회 피격 마무리 시점에 튕겨야」 = 효과 표 aoe_hits
yield return Fresh ( ) ;
var lt = Spawn ( UnitType . Spear , Faction . Player , 0f , 0f , "능통" ) ;
var s = Give ( lt , "lingtong" ) ;
var aoe = Eff ( "lingtong_a" , SkillKeys . AoeStrike ) ;
int hits = Mathf . RoundToInt ( Eff ( "lingtong_a" , SkillKeys . AoeHits ) . P ) ;
Assert . Greater ( hits , 1 , "표의 다단 횟수" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , aoe . P * 0.5f , 0f , "적" ) ;
foe . MaxHp = foe . Hp = 100000 ; // 여러 번 맞아도 쓰러지지 않게(횟수 확인)
Begin ( ) ;
Vector2 p0 = foe . Position ;
int lastHp = foe . Hp , count = 0 ;
bool movedBeforeLast = false , done = false ;
bm . StartCoroutine ( Run ( bm . Skills . Instant ( s ) , ( ) = > done = true ) ) ;
float t0 = Time . time ;
while ( ! done & & Time . time - t0 < 5f )
{
if ( foe . Hp < lastHp )
{
count + + ;
lastHp = foe . Hp ;
}
if ( count < hits & & Vector2 . Distance ( foe . Position , p0 ) > 0.01f ) movedBeforeLast = true ;
yield return null ;
}
Assert . IsTrue ( done , "끝남" ) ;
Assert . AreEqual ( hits , count , "피해 = 표의 횟수만큼 나눠 들어감" ) ;
Assert . IsFalse ( movedBeforeLast , "마지막 히트 전에는 밀리지 않음" ) ;
Assert . Greater ( Vector2 . Distance ( foe . Position , p0 ) , 0.05f , "마지막 히트 뒤 바깥으로 밀림" ) ;
}
static IEnumerator Run ( IEnumerator body , System . Action end )
{
yield return body ;
end ( ) ;
}
2026-11-10 10:00:18 +00:00
// ---------- 다음 행동: 재행동 · 반격 면역 ----------
2026-11-05 14:31:27 +00:00
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator NextAction_ExtraAction_CounterImmune ( )
2026-11-05 14:31:27 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var liu = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 3f , "유비" ) ;
var s = Give ( liu , "liubei" ) ;
var foe = Spawn ( UnitType . Spear , Faction . Enemy , 0f , 0f , "적" ) ;
Begin ( ) ;
2026-11-05 14:31:27 +00:00
var o = new ActionOutcome ( ) ;
2026-11-10 10:00:18 +00:00
yield return ActArmed ( liu , new Vector2 ( 0f , 1f ) , o ) ;
Assert . AreEqual ( 0 , o . CounterTaken , "반격 안 받음" ) ;
Assert . AreEqual ( Mathf . RoundToInt ( Eff ( "liubei_a" , SkillKeys . ExtraAction ) . P ) , s . ReactCredits , "재행동" ) ;
Assert . IsTrue ( bm . Skills . TakeReaction ( liu ) ) ;
Assert . AreEqual ( 0f , SkillMods . CounterTakenMult ( liu , foe ) , 1e-4f , "1턴 반격 면역은 재행동에도" ) ;
2026-11-05 14:31:27 +00:00
}
2026-11-10 10:00:18 +00:00
// ---------- 치명타 · 흡혈 ----------
2026-11-05 14:31:27 +00:00
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator CritAlways_And_Lifesteal ( )
2026-11-05 14:31:27 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var mc = Spawn ( UnitType . Cavalry , Faction . Player , 0f , - 3f , "마초" ) ;
var s = Give ( mc , "machao" ) ;
2026-11-05 14:31:27 +00:00
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , 0f , "적" ) ;
2026-11-10 10:00:18 +00:00
Begin ( ) ;
s . Armed = true ;
Combat . Damage ( cfg , mc , foe , false , new System . Random ( 1 ) , true ) ;
Assert . IsTrue ( Combat . LastCrit , "무조건 치명타" ) ;
s . Armed = false ;
mc . Hp = mc . MaxHp / 2 ;
int before = mc . Hp ;
int dealt = bm . Skills . Hit ( foe , 40 , mc , HitKind . Attack ) ;
Assert . AreEqual ( Mathf . RoundToInt ( dealt * Eff ( "machao_p" , SkillKeys . Lifesteal ) . P ) , mc . Hp - before , "흡혈" ) ;
2026-11-05 14:31:27 +00:00
}
2026-11-10 10:00:18 +00:00
// ---------- 상태 이상 ----------
2026-11-05 14:31:27 +00:00
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator Poison_Stacks_And_Ticks ( )
2026-11-05 14:31:27 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var jx = Spawn ( UnitType . Strategist , Faction . Player , 0f , - 3f , "가후" ) ;
Give ( jx , "jiaxu" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , 3f , "적" ) ;
Begin ( ) ;
bm . Skills . ApplyHitStatuses ( jx , foe , false , HitKind . Attack ) ;
bm . Skills . ApplyHitStatuses ( jx , foe , false , HitKind . Attack ) ;
var st = bm . Skills . StatusOf ( foe ) ;
Assert . AreEqual ( 2 , st . PoisonStacks , "중첩" ) ;
var hp = Eff ( "jiaxu_p" , SkillKeys . HitPoison ) ;
int before = foe . Hp ;
yield return bm . Skills . TurnBegin ( Faction . Enemy ) ;
Assert . AreEqual ( Mathf . Max ( 1 , Mathf . RoundToInt ( foe . MaxHp * hp . Get ( 1 ) * 2 ) ) , before - foe . Hp , "턴 시작 중독 × 중첩" ) ;
2026-11-05 14:31:27 +00:00
}
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator Confuse_HalvesSling_ThenExpires ( )
2026-11-05 14:31:27 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , 3f , "적" ) ;
Begin ( ) ;
var c = Eff ( "zhangliao_a" , SkillKeys . HitConfuse ) ;
float base0 = SkillMods . SlingMax ( foe ) ;
bm . Skills . ApplyConfuse ( foe , Mathf . RoundToInt ( c . P ) , c . Get ( 1 ) ) ;
Assert . AreEqual ( base0 * c . Get ( 1 ) , SkillMods . SlingMax ( foe ) , 1e-3f , "혼란 = 이동 × 배율" ) ;
2026-11-17 07:27:22 +00:00
// PD 2026-11-13 「모든 턴 지속형 상태 이상 효과는 대상의 행동 턴이 종료된 후 다음 행동 턴이 시작될 때 소멸」 = n턴 상태는 대상이 그 상태로 행동 턴을 n번 마친 뒤 대상 진영의 다음 턴 시작에 해제
int n = Mathf . RoundToInt ( c . P ) ;
for ( int i = 0 ; i < n ; i + + )
{
yield return bm . Skills . TurnBegin ( Faction . Enemy ) ; // 대상의 행동 턴 시작
Assert . AreEqual ( base0 * c . Get ( 1 ) , SkillMods . SlingMax ( foe ) , 1e-3f , "대상의 행동 턴 동안 혼란" ) ;
yield return bm . Skills . TurnBegin ( Faction . Player ) ; // 대상의 행동 턴 끝 = 상대 턴
Assert . AreEqual ( base0 * c . Get ( 1 ) , SkillMods . SlingMax ( foe ) , 1e-3f , "행동 턴이 끝나도 다음 행동 턴이 시작될 때까지 남음" ) ;
}
yield return bm . Skills . TurnBegin ( Faction . Enemy ) ;
Assert . AreEqual ( base0 , SkillMods . SlingMax ( foe ) , 1e-3f , "대상의 다음 행동 턴 시작에 해제" ) ;
}
[UnityTest]
public IEnumerator Status_AppliedAfterTargetActed_SkipsThatTurn ( )
{
// PD 2026-11-13 「이미 행동을 마친 경우, 다음 행동 턴이 시작되어도 마친 상태가 아니므로 다음 턴이 시작되는 시점에 소멸」
yield return Fresh ( ) ;
var early = Spawn ( UnitType . Infantry , Faction . Enemy , - 2f , 3f , "행동 전" ) ;
var done = Spawn ( UnitType . Infantry , Faction . Enemy , 2f , 3f , "행동 마침" ) ;
Begin ( ) ;
var c = Eff ( "zhangliao_a" , SkillKeys . HitConfuse ) ;
int n = Mathf . RoundToInt ( c . P ) ;
bm . ForcePhase ( BattlePhase . EnemyTurn ) ; // 적 턴 도중에 걸림
done . MarkActed ( ) ;
bm . Skills . ApplyConfuse ( early , n , c . Get ( 1 ) ) ;
bm . Skills . ApplyConfuse ( done , n , c . Get ( 1 ) ) ;
for ( int i = 0 ; i < n ; i + + )
{
bm . ForcePhase ( BattlePhase . PlayerTurn ) ;
yield return bm . Skills . TurnBegin ( Faction . Player ) ;
bm . ForcePhase ( BattlePhase . EnemyTurn ) ;
yield return bm . Skills . TurnBegin ( Faction . Enemy ) ;
}
Assert . IsFalse ( SkillStatus . Confused ( early ) , "행동 전에 걸림 = 이번 턴이 1번째 → n번 마친 뒤 다음 자기 턴 시작에 해제" ) ;
Assert . IsTrue ( SkillStatus . Confused ( done ) , "행동을 마친 뒤 걸림 = 그 턴은 세지 않음" ) ;
bm . ForcePhase ( BattlePhase . PlayerTurn ) ;
yield return bm . Skills . TurnBegin ( Faction . Player ) ;
bm . ForcePhase ( BattlePhase . EnemyTurn ) ;
yield return bm . Skills . TurnBegin ( Faction . Enemy ) ;
Assert . IsFalse ( SkillStatus . Confused ( done ) , "그다음 자기 턴 시작에 해제" ) ;
}
[UnityTest]
public IEnumerator Buff_OnActedAlly_LastsThroughNextAction ( )
{
// PD 2026-11-13 「모든 턴 지속형 버프 효과는 효과 대상의 행동 종료 후 다음 플레이어의 턴이 시작될 때까지 유지 · 이미 행동이 종료 된 경우, 다음 행동 시작 시점을 기준으로 소멸 시점이 결정」
yield return Fresh ( ) ;
var src = Spawn ( UnitType . Spear , Faction . Player , 0f , - 3f , "황개" ) ;
var s = Give ( src , "huanggai" ) ;
var fresh = Spawn ( UnitType . Infantry , Faction . Player , - 1.5f , - 3f , "행동 전" ) ;
var done = Spawn ( UnitType . Infantry , Faction . Player , 1.5f , - 3f , "행동 마침" ) ;
Begin ( ) ;
var e = Eff ( "huanggai_a" , SkillKeys . DmgTakenPct ) ; // 값·지속 턴은 표에서(1턴 버프)
done . MarkActed ( ) ;
bm . Skills . AddBuff ( s , fresh , e . Key , e . P , e . Dur ) ;
bm . Skills . AddBuff ( s , done , e . Key , e . P , e . Dur ) ;
System . Func < Unit , bool > has = u = >
{
foreach ( var t in bm . Skills . TimedEffects )
if ( t . Targets ! = null & & t . Targets . Contains ( u ) & & t . Rounds > 0 ) return true ;
return false ;
} ;
for ( int i = 0 ; i < e . Dur ; i + + )
{
Assert . IsTrue ( has ( fresh ) & & has ( done ) , "다음 아군 턴이 시작될 때까지 둘 다 유지" ) ;
yield return bm . Skills . TurnBegin ( Faction . Enemy ) ;
yield return bm . Skills . TurnBegin ( Faction . Player ) ;
}
Assert . IsFalse ( has ( fresh ) , "행동 전에 받음 = 행동 뒤 다음 아군 턴 시작에 소멸" ) ;
Assert . IsTrue ( has ( done ) , "행동을 마친 뒤 받음 = 다음 행동을 기준으로 → 아직 유지" ) ;
yield return bm . Skills . TurnBegin ( Faction . Enemy ) ;
yield return bm . Skills . TurnBegin ( Faction . Player ) ;
Assert . IsFalse ( has ( done ) , "다음 행동 뒤 그다음 아군 턴 시작에 소멸" ) ;
2026-11-05 14:31:27 +00:00
}
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator Bleed_DamageByMovedDistance ( )
2026-11-05 14:31:27 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , 3f , "적" ) ;
Begin ( ) ;
var b = Eff ( "xuhuang_p" , SkillKeys . HitBleed ) ;
bm . Skills . ApplyBleedStatus ( foe , Mathf . RoundToInt ( b . P ) , b . Get ( 1 ) ) ;
int before = foe . Hp ;
2026-11-17 07:27:22 +00:00
float moved = foe . LaunchDistance * 0.5f ; // 쏘는 최대 거리(근접 병종 배율 포함 · 2026-11-16)의 절반
2026-11-10 10:00:18 +00:00
bm . Skills . ApplyBleed ( new Dictionary < Unit , float > { { foe , moved } } ) ;
Assert . AreEqual ( Mathf . Max ( 1 , Mathf . RoundToInt ( foe . MaxHp * b . Get ( 1 ) * 0.5f ) ) , before - foe . Hp , "출혈 = 거리 비례" ) ;
2026-11-05 14:31:27 +00:00
}
2026-11-10 10:00:18 +00:00
// ---------- 무적 · 호위 ----------
2026-11-05 14:31:27 +00:00
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator Invuln_Instant_BlocksDamageForRound ( )
2026-11-05 14:31:27 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var zj = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 3f , "장각" ) ;
var s = Give ( zj , "zhangjiao" ) ;
Begin ( ) ;
yield return bm . Skills . Instant ( s ) ;
int hp = zj . Hp ;
Assert . AreEqual ( 0 , bm . Skills . Hit ( zj , 30 , null , HitKind . Attack ) ) ;
Assert . AreEqual ( hp , zj . Hp , "무적" ) ;
yield return bm . Skills . TurnBegin ( Faction . Player ) ;
Assert . Greater ( bm . Skills . Hit ( zj , 30 , null , HitKind . Attack ) , 0 , "다음 자기 턴 시작에 끝" ) ;
2026-11-05 14:31:27 +00:00
}
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator Guard_TakesAllyDamage ( )
2026-11-05 14:31:27 +00:00
{
yield return Fresh ( ) ;
var gp = Spawn ( UnitType . Spear , Faction . Player , 0f , - 3f , "관평" ) ;
2026-11-17 07:27:22 +00:00
var gs = Give ( gp , "guanping" ) ;
2026-11-10 10:00:18 +00:00
var g = Eff ( "guanping_p" , SkillKeys . Guard ) ;
var ally = Spawn ( UnitType . Archer , Faction . Player , g . P * 0.5f , - 3f , "궁병" ) ;
var far = Spawn ( UnitType . Archer , Faction . Player , g . P + 4f , - 3f , "먼 궁병" ) ;
Begin ( ) ;
2026-11-17 07:27:22 +00:00
yield return bm . Skills . Instant ( gs ) ; // 관평 호위 = 자기 액티브(철벽 호위) 중에만(PD 2026-11-12 3차 · SkillSystem.Guarder)
2026-11-10 10:00:18 +00:00
int a0 = ally . Hp , g0 = gp . Hp , f0 = far . Hp ;
bm . Skills . Hit ( ally , 40 , null , HitKind . Attack ) ;
Assert . AreEqual ( a0 - Mathf . RoundToInt ( 40 * ( 1f - Mathf . Clamp01 ( g . Get ( 1 ) ) ) ) , ally . Hp , "호위 비율만큼 대신" ) ;
Assert . Less ( gp . Hp , g0 , "관평이 받음" ) ;
bm . Skills . Hit ( far , 40 , null , HitKind . Attack ) ;
Assert . AreEqual ( f0 - 40 , far . Hp , "반경 밖 = 그대로" ) ;
}
2026-11-05 14:31:27 +00:00
2026-11-10 10:00:18 +00:00
// ---------- 기병 복귀 · 보병 관통 · 교환 · 아군 통과 ----------
2026-11-05 14:31:27 +00:00
2026-11-10 10:00:18 +00:00
[UnityTest]
public IEnumerator Cavalry_ReturnsToOriginOnHit ( )
{
2026-11-05 14:31:27 +00:00
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var zy = Spawn ( UnitType . Cavalry , Faction . Player , 0f , - 4f , "조운" ) ;
Give ( zy , "zhaoyun" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1f , "적" ) ;
Begin ( ) ;
Vector2 origin = zy . Position ;
var o = new ActionOutcome ( ) ;
yield return Act ( zy , origin + Vector2 . up * zy . SlingMaxDistance * 0.9f , o ) ;
Assert . Contains ( foe , o . Attacked ) ;
Assert . IsTrue ( o . Returned , "복귀" ) ;
Assert . Less ( Vector2 . Distance ( zy . Position , origin ) , 0.3f , "출발 위치" ) ;
Assert . AreEqual ( 0 , o . CounterTaken , "반격 안 받음" ) ;
2026-11-05 14:31:27 +00:00
}
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator Infantry_PierceThrough_HitsAllOnPath ( )
2026-11-05 14:31:27 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var sj = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 4f , "손견" ) ;
Give ( sj , "sunjian" ) ;
var a = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 2.5f , "적1" ) ;
var b = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1f , "적2" ) ;
Begin ( ) ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( sj , sj . Position + Vector2 . up * sj . SlingMaxDistance * 0.95f , o ) ;
Assert . Contains ( a , o . Attacked ) ;
Assert . Contains ( b , o . Attacked ) ;
Assert . IsTrue ( SkillStatus . Bleeding ( a ) | | ! a . IsAlive , "출혈" ) ;
Assert . AreEqual ( 0 , bm . Skills . Hit ( sj , 30 , null , HitKind . Attack ) , "행동 뒤 1턴 무적" ) ;
2026-11-05 14:31:27 +00:00
}
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator Swap_OnHit_TargetToOrigin ( )
2026-11-05 14:31:27 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var wy = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 4f , "위연" ) ;
var s = Give ( wy , "weiyan" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1f , "적" ) ;
Begin ( ) ;
Vector2 origin = wy . Position ;
Vector2 foe0 = foe . Position ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( wy , foe0 , o ) ;
Assert . Less ( Vector2 . Distance ( foe . Position , origin ) , 0.05f , "적 → 출발 위치" ) ;
Assert . Less ( Vector2 . Distance ( wy . Position , foe0 ) , 0.05f , "위연 → 적 자리" ) ;
Assert . AreEqual ( Mathf . RoundToInt ( Eff ( "weiyan_a" , SkillKeys . ExtraAction ) . P ) , s . ReactCredits , "재행동" ) ;
2026-11-05 14:31:27 +00:00
}
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator PassAllies_ThenAimPush_NoSelfBounce ( )
2026-11-05 14:31:27 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var cc = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 5f , "조조" ) ;
Give ( cc , "caocao" ) ;
var ally = Spawn ( UnitType . Archer , Faction . Player , 0f , - 3.2f , "아군" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1.4f , "적" ) ;
Begin ( ) ;
Vector2 foe0 = foe . Position ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( cc , cc . Position + Vector2 . up * cc . SlingMaxDistance , o ) ;
Assert . Contains ( foe , o . Attacked , "아군 통과 → 적 명중" ) ;
Assert . IsFalse ( o . Pushed . Contains ( ally ) , "아군은 밀지 않음" ) ;
Assert . Greater ( foe . Position . y , foe0 . y + 0.05f , "자동 탭 = 슬링 방향으로 밀침" ) ;
2026-11-05 14:31:27 +00:00
}
2026-11-20 10:22:16 +00:00
/// <summary>
/// 조조 난세의 간웅 = 붙잡은 적을 다시 슬링(2026-11-19 PD 「슬링샷 방향으로 대상이 된 유닛을 날려야」): 손 조작 대기(Sling) 중 놓은 조준점 쪽으로 날아감 ·
/// 조조는 슬링과 다른 방향(위)으로 쳤으므로 오른쪽으로 움직였다면 슬링 결과.
/// </summary>
/// <remarks>2026-11-20 PD 「조조의 이동거리만큼 동일하게 · 조조의 반대 방향으로 날리려고 할 경우 금방 멈춰버림」 → 끈 거리(3) 그대로 · way 1 = 조조 쪽(아래)으로 날려도 조조에 막히지 않음.</remarks>
[UnityTest]
public IEnumerator AimPush_ManualSling_FlingsTowardDrag ( [ Values ( 0 , 1 ) ] int way )
{
yield return Fresh ( ) ;
var cc = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 5f , "조조" ) ;
Give ( cc , "caocao" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 2.5f , "적" ) ;
Begin ( ) ;
SkillSystem . AutoTap = false ;
bool end = false , asked = false ;
Vector2 p0 = Vector2 . zero , want = way = = 0 ? Vector2 . right : Vector2 . down ;
var o = new ActionOutcome ( ) ;
bm . StartCoroutine ( Run ( ActArmed ( cc , cc . Position + Vector2 . up * cc . SlingMaxDistance , o ) , ( ) = > end = true ) ) ;
for ( float t = 0f ; t < 6f & & ! end ; t + = Time . deltaTime )
{
if ( ! asked & & bm . Skills . PendingKind = = SkillSystem . TapKind . Sling )
{
asked = true ;
Assert . AreEqual ( foe , bm . Skills . PendingTarget , "붙잡힌 적 = 날릴 대상" ) ;
p0 = foe . Position ;
bm . Skills . SlingResult ( foe . Position + want * 3f ) ;
}
yield return null ;
}
SkillSystem . AutoTap = true ;
Assert . IsTrue ( asked , "적을 붙잡으면 슬링 대기" ) ;
Assert . IsTrue ( end , "놓으면 행동 끝" ) ;
Assert . Greater ( Vector2 . Dot ( foe . Position - p0 , want ) , 2.5f , "끈 방향으로 끈 거리(3)만큼 날아감" ) ;
}
/// <summary>전위 쌍철극 = 명중한 적이 밀리는 거리 3배(push_mult 3 · 2026-11-20 PD 「3배로 키워줘」 · 처음 2026-11-20 PD 「적 밀리는 거리가 2배로 멀리 튕겨나야 하는데 아무런 변화가 없는 것 같아」).</summary>
[UnityTest]
public IEnumerator Dianwei_PushMult_DoublesKnockback ( )
{
var moved = new float [ 2 ] ;
for ( int k = 0 ; k < 2 ; k + + )
{
yield return Fresh ( ) ;
var dw = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 5f , "전위" ) ;
Give ( dw , "dianwei" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 2.5f , "적" ) ;
foe . Hp = foe . MaxHp = 100000 ;
Begin ( ) ;
float y0 = foe . Position . y ;
var o = new ActionOutcome ( ) ;
if ( k = = 0 ) yield return Act ( dw , dw . Position + Vector2 . up * dw . SlingMaxDistance , o ) ;
else yield return ActArmed ( dw , dw . Position + Vector2 . up * dw . SlingMaxDistance , o ) ;
moved [ k ] = foe . Position . y - y0 ;
}
Debug . Log ( "전위 밀림 · 스킬 없음 " + moved [ 0 ] . ToString ( "0.00" ) + " · 쌍철극 " + moved [ 1 ] . ToString ( "0.00" ) ) ;
Assert . Greater ( moved [ 0 ] , 0.1f , "기본 공격도 밀림" ) ;
Assert . Greater ( moved [ 1 ] , moved [ 0 ] * 4.5f , "쌍철극 = 약 5배(PD 2026-11-20 「적이 더 크게 밀리도록」 · 3배 → 5배)" ) ;
}
/// <summary>여포 천하무쌍 단계 기운 = 시전 뒤 공격 전 「lvbu_a」(마초형 진홍) → 공격 뒤 효과가 남은 동안 「lvbu_a_after」(손견형) · 공격 키 「lvbu_a_atk」 행이 표에 있음(2026-11-20 PD).</summary>
[UnityTest]
public IEnumerator Lvbu_InstantThenAttack_AuraPhases ( )
{
yield return Fresh ( ) ;
var lb = Spawn ( UnitType . Cavalry , Faction . Player , 0f , - 5f , "여포" ) ;
Give ( lb , "lvbu" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 2.5f , "적" ) ;
foe . Hp = foe . MaxHp = 100000 ;
Begin ( ) ;
SkillVfxLoops . Ensure ( ) ;
yield return bm . Skills . Instant ( bm . Skills . Of ( lb ) ) ;
SkillVfxLoops . RefreshNow ( ) ;
Assert . IsTrue ( SkillVfxLoops . Wants ( lb , "aura|lvbu_a" ) , "시전 뒤 공격 전 = 마초형 기운" ) ;
Assert . IsTrue ( SkillVfx . Has ( "lvbu_a_atk" , SkillVfx . EventTravel ) , "공격 키 행(조운 창 진홍)" ) ;
var o = new ActionOutcome ( ) ;
yield return Act ( lb , lb . Position + Vector2 . up * 3f , o ) ;
SkillVfxLoops . RefreshNow ( ) ;
Assert . IsTrue ( SkillVfxLoops . Wants ( lb , "aura|lvbu_a_after" ) , "공격 뒤 무적이 남은 동안 = 손견형 기운" ) ;
Assert . IsFalse ( SkillVfxLoops . Wants ( lb , "aura|lvbu_a" ) , "공격 뒤엔 마초형 기운 없음" ) ;
}
/// <summary>동탁 폭정 = 유닛에는 튕기지 않고(밀쳐 내고 지나감) 전장 가장자리에서 튕김(2026-11-20 PD 「유닛에게는 튕겨지지 않지만 화면 가장자리나 맵 오브젝트에 닿을 경우 튕기게」).</summary>
[UnityTest]
public IEnumerator Dongzhuo_Rampage_BouncesOffEdgeNotUnits ( )
{
yield return Fresh ( ) ;
var dz = Spawn ( UnitType . Cavalry , Faction . Player , 0f , - 5f , "동탁" ) ;
Give ( dz , "dongzhuo" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 2f , - 5f , "적" ) ;
foe . Hp = foe . MaxHp = 100000 ;
Spawn ( UnitType . Infantry , Faction . Enemy , - 3f , 4f , "적2" ) . Hp = 100000 ;
Begin ( ) ;
var o = new ActionOutcome ( ) ;
var cam = Camera . main ;
Vector2 c0 = cam ! = null ? ( Vector2 ) cam . transform . position : Vector2 . zero ;
float hw = cam ! = null ? cam . orthographicSize * cam . aspect : 0f , hh = cam ! = null ? cam . orthographicSize : 0f ;
yield return ActArmed ( dz , dz . Position + Vector2 . right * dz . SlingMaxDistance , o ) ;
Debug . Log ( "동탁 폭정 · 경로 " + string . Join ( " → " , o . Path . ConvertAll ( p = > p . ToString ( "0.0" ) ) ) + " · 메모 " + string . Join ( "," , o . Notes ) ) ;
Assert . Contains ( foe , o . Pushed , "길 위 적 = 밀쳐 냄" ) ;
Assert . IsTrue ( o . Notes . Contains ( "튕김" ) , "가장자리에서 튕김" ) ;
if ( cam ! = null & & cam . orthographic )
{
foreach ( var p in o . Path )
Assert . LessOrEqual ( Mathf . Abs ( p . x - c0 . x ) , hw + 0.05f , "출발 순간 화면 밖으로 나가지 않음(화면 가장자리에서 튕김)" ) ;
// 39차: 튕긴 자리(마지막 점 제외)는 모두 출발 순간 화면 끝(유닛 반지름 안) 또는 전장 벽 — 빈 땅 한가운데서 튕기지 않음(카메라가 따라가도)
float r = dz . Radius ;
for ( int i = 0 ; i < o . Path . Count - 1 ; i + + )
{
var p = o . Path [ i ] ;
if ( ( p - new Vector2 ( 0f , - 5f ) ) . sqrMagnitude < 0.01f ) continue ; // 경로 첫 점 = 출발 자리
float edge = Mathf . Min ( Mathf . Min ( Mathf . Abs ( p . x - ( c0 . x - hw + r ) ) , Mathf . Abs ( p . x - ( c0 . x + hw - r ) ) ) , Mathf . Min ( Mathf . Abs ( p . y - ( c0 . y - hh + r ) ) , Mathf . Abs ( p . y - ( c0 . y + hh - r ) ) ) ) ;
bool wall = ( bm . Board . ClampInside ( p , r + 0.3f ) - p ) . sqrMagnitude > 1e-4f ;
Assert . IsTrue ( edge < 0.2f | | wall , "튕긴 자리 " + p . ToString ( "0.00" ) + " = 화면 끝·벽 근처여야 함" ) ;
}
}
}
/// <summary>이각 약탈 = 돌진이 끝나 멈춘 자리 반경 3 폭파 피해(길 밖 적도) · 준 피해 50 % 자신 회복(2026-11-20 PD 41차).</summary>
[UnityTest]
public IEnumerator Lijue_EndBlast_DamagesAroundStopAndHeals ( )
{
yield return Fresh ( ) ;
var lj = Spawn ( UnitType . Cavalry , Faction . Player , 0f , - 6f , "이각" ) ;
Give ( lj , "lijue" ) ;
lj . Hp = lj . MaxHp / 2 ;
var side = Spawn ( UnitType . Infantry , Faction . Enemy , 2f , - 3f , "옆 적" ) ;
side . Hp = side . MaxHp = 100000 ;
Begin ( ) ;
int hp0 = lj . Hp , s0 = side . Hp ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( lj , lj . Position + Vector2 . up * 3f , o ) ;
Debug . Log ( "이각 약탈 · 멈춘 자리 " + lj . Position . ToString ( "0.00" ) + " · 옆 적 피해 " + ( s0 - side . Hp ) + " · 회복 " + ( lj . Hp - hp0 ) ) ;
Assert . Less ( side . Hp , s0 , "멈춘 자리 반경 안 적 = 폭파 피해" ) ;
Assert . Greater ( lj . Hp , hp0 , "준 피해만큼 자신 회복" ) ;
}
/// <summary>맹획 남만왕 = 적과 부딪혀도 멈추지 않고 슬링 거리만큼 전진 · 적은 밀쳐 냄 · 자신은 튕기지 않음(2026-11-20 PD 39차).</summary>
[UnityTest]
public IEnumerator Menghuo_PushThrough_PassesEnemyFullDistance ( )
{
yield return Fresh ( ) ;
var mh = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 6f , "맹획" ) ;
Give ( mh , "menghuo" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 4.5f , "적" ) ;
foe . Hp = foe . MaxHp = 100000 ;
Begin ( ) ;
float y0 = mh . Position . y ;
float sling = mh . SlingMaxDistance ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( mh , mh . Position + Vector2 . up * sling , o ) ;
Debug . Log ( "맹획 · 이동 " + ( mh . Position . y - y0 ) . ToString ( "0.00" ) + " / 슬링 " + sling . ToString ( "0.00" ) + " · 적 " + foe . Position . ToString ( "0.00" ) ) ;
Assert . Contains ( foe , o . Pushed , "길 위 적 = 밀쳐 냄" ) ;
Assert . Greater ( mh . Position . y , foe . Position . y + 0.3f , "적을 지나 앞으로 감(멈추지 않음)" ) ;
Assert . Greater ( mh . Position . y - y0 , 3f , "적에서 멈추지 않고 멀리 전진" ) ;
}
/// <summary>우금 군령 = 맞힌(민) 행동 끝난 아군만 재행동 · 적은 재행동 없음(2026-11-20 PD 「우금의 재행동 효과가 적군에게는 발생하지 않도록」).</summary>
[UnityTest]
public IEnumerator Yujin_AllyHitReaction_AlliesOnly ( )
{
yield return Fresh ( ) ;
var yj = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 5f , "우금" ) ;
Give ( yj , "yujin" ) ;
var ally = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 3.2f , "아군" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 1.6f , - 1.6f , "적" ) ;
foe . Hp = foe . MaxHp = 100000 ;
Begin ( ) ;
ally . ActedThisTurn = true ;
foe . ActedThisTurn = true ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( yj , yj . Position + Vector2 . up * yj . SlingMaxDistance , o ) ;
Assert . Contains ( ally , o . Pushed , "아군을 밀침" ) ;
Assert . IsFalse ( ally . ActedThisTurn , "민 아군 = 재행동" ) ;
Assert . IsTrue ( foe . ActedThisTurn , "적 = 재행동 없음" ) ;
}
/// <summary>하후돈 맹장 = 행동 뒤 슬링으로 복귀(2026-11-20 PD 「조조와 마찬가지로 스킬 시전 후 한번 더 슬링샷 조작이 가능해야」).</summary>
[UnityTest]
public IEnumerator ReturnAim_ManualSling_MovesToDrag ( )
{
yield return Fresh ( ) ;
var hd = Spawn ( UnitType . Cavalry , Faction . Player , 0f , - 5f , "하후돈" ) ;
Give ( hd , "xiahoudun" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 2.5f , "적" ) ;
foe . Hp = foe . MaxHp = 100000 ;
Begin ( ) ;
SkillSystem . AutoTap = false ;
bool end = false , asked = false ;
Vector2 goal = Vector2 . zero ;
var o = new ActionOutcome ( ) ;
bm . StartCoroutine ( Run ( ActArmed ( hd , hd . Position + Vector2 . up * 4f , o ) , ( ) = > end = true ) ) ;
for ( float t = 0f ; t < 6f & & ! end ; t + = Time . deltaTime )
{
if ( ! asked & & bm . Skills . PendingKind = = SkillSystem . TapKind . Sling )
{
asked = true ;
Assert . AreEqual ( hd , bm . Skills . PendingTarget , "끌 유닛 = 하후돈 자신" ) ;
goal = hd . Position + Vector2 . right * 2.5f ;
bm . Skills . SlingResult ( goal ) ;
}
yield return null ;
}
SkillSystem . AutoTap = true ;
Assert . IsTrue ( asked , "행동 뒤 슬링 대기" ) ;
Assert . IsTrue ( end , "놓으면 복귀 후 행동 끝" ) ;
Assert . Less ( Vector2 . Distance ( hd . Position , goal ) , 0.4f , "끈 곳으로 복귀" ) ;
}
/// <summary>하후돈 맹장의 끌어 정한 복귀에도 패시브 회군 돌파(복귀 길 위 적을 함께 쓸어 감)가 적용.</summary>
/// <remarks>같은 날 PD 「회군 돌파를 액티브로 끌어 정한 복귀에도 적용되도록 복구」 → 쓸어 감이 적용되는지로 뒤집음(복귀 방향으로 밀려 감).</remarks>
[UnityTest]
public IEnumerator ReturnAim_SweepsEnemiesOnPath ( )
{
yield return Fresh ( ) ;
var hd = Spawn ( UnitType . Cavalry , Faction . Player , 0f , - 5f , "하후돈" ) ;
Give ( hd , "xiahoudun" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 2.5f , "적" ) ;
foe . Hp = foe . MaxHp = 100000 ;
Begin ( ) ;
SkillSystem . AutoTap = false ;
bool end = false , asked = false ;
Unit side = null ;
Vector2 side0 = Vector2 . zero ;
var o = new ActionOutcome ( ) ;
bm . StartCoroutine ( Run ( ActArmed ( hd , hd . Position + Vector2 . up * 4f , o ) , ( ) = > end = true ) ) ;
for ( float t = 0f ; t < 6f & & ! end ; t + = Time . deltaTime )
{
if ( ! asked & & bm . Skills . PendingKind = = SkillSystem . TapKind . Sling )
{
asked = true ;
side = Spawn ( UnitType . Infantry , Faction . Enemy , hd . Position . x + 1.6f , hd . Position . y , "복귀 길 위 적" ) ; // 복귀 길 한가운데
side . Hp = side . MaxHp = 100000 ;
side0 = side . Position ;
bm . Skills . SlingResult ( hd . Position + Vector2 . right * 3.4f ) ;
}
yield return null ;
}
SkillSystem . AutoTap = true ;
Assert . IsTrue ( asked & & end ) ;
Assert . Greater ( side . Position . x , side0 . x + 1f , "복귀 길 위 적 = 회군 돌파로 복귀 방향(오른쪽)으로 쓸려 감" ) ;
}
/// <summary>장합 변진 = 끌어 놓은 거리만큼 경로 위 적을 무시하고 이동(2026-11-20 PD 「슬링샷 조작으로 이동할 위치 · 어떤 적도 무시한 채 원하는 슬링샷 거리 만큼」).</summary>
[UnityTest]
public IEnumerator Teleport_ManualSling_PassesThroughUnits ( )
{
yield return Fresh ( ) ;
var zh = Spawn ( UnitType . Spear , Faction . Player , 0f , - 4f , "장합" ) ;
Give ( zh , "zhanghe" ) ;
Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 2.7f , "적1" ) ;
Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1.5f , "적2" ) ;
Begin ( ) ;
bm . Skills . TapActive ( zh ) ;
Unit who ;
float max ;
Assert . IsTrue ( bm . Skills . SlingWait ( out who , out max ) , "변진 = 끌기 대기" ) ;
Assert . AreEqual ( zh , who ) ;
Vector2 p0 = zh . Position ;
bm . Skills . SlingRelease ( zh . Position + Vector2 . up * 4f ) ;
for ( float t = 0f ; t < 2f ; t + = Time . deltaTime ) yield return null ;
Assert . Greater ( zh . Position . y , p0 . y + 3.5f , "적 둘을 지나 끈 거리(4)만큼" ) ;
Assert . AreEqual ( 0f , zh . Position . x , 0.05f ) ;
}
2026-11-10 10:00:18 +00:00
// ---------- 원거리 특수 사격 ----------
2026-11-05 14:31:27 +00:00
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator GiantArrow_IgnoresRange_Stuns ( )
2026-11-05 14:31:27 +00:00
{
2026-11-10 10:00:18 +00:00
yield return Fresh ( ) ;
var hz = Spawn ( UnitType . Archer , Faction . Player , 0f , - 10f , "황충" ) ;
Give ( hz , "huangzhong" ) ;
var ally = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 7f , "아군" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , hz . Position . y + SkillMods . Range ( hz ) * 2f + 2f , "먼 적" ) ;
Begin ( ) ;
int ally0 = ally . Hp , foe0 = foe . Hp ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( hz , hz . Position + Vector2 . up * 2f , o ) ;
Assert . AreEqual ( ally0 , ally . Hp , "아군 통과" ) ;
Assert . Less ( foe . Hp , foe0 , "사거리 밖 적 명중" ) ;
Assert . IsTrue ( SkillStatus . Stunned ( foe ) | | ! foe . IsAlive , "기절" ) ;
2026-11-05 14:31:27 +00:00
}
2026-11-05 15:22:54 +00:00
2026-11-09 02:11:20 +00:00
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator Fireball_Blast_Burns ( )
2026-11-09 02:11:20 +00:00
{
2026-11-10 10:00:18 +00:00
yield return Fresh ( ) ;
var xs = Spawn ( UnitType . Strategist , Faction . Player , 0f , - 4f , "서서" ) ;
Give ( xs , "xushu" ) ;
var bl = Eff ( "xushu_a" , SkillKeys . ShotBlast ) ;
var a = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1f , "적1" ) ;
var b = Spawn ( UnitType . Infantry , Faction . Enemy , bl . P * 0.6f , - 1f , "적2" ) ;
Begin ( ) ;
int a0 = a . Hp , b0 = b . Hp ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( xs , xs . Position + Vector2 . up * 2f , o ) ;
Assert . Less ( a . Hp , a0 ) ;
Assert . Less ( b . Hp , b0 , "폭발 반경" ) ;
Assert . Greater ( bm . Skills . StatusOf ( b ) . BurnTurns , 0 , "화상" ) ;
2026-11-09 02:11:20 +00:00
}
2026-11-17 07:27:22 +00:00
[UnityTest]
public IEnumerator Blast_MultiHit_SplitsSameTotalAcrossHits ( )
{
// PD 2026-11-13 주유 운석 「나눠서 주기」「실제 낙하 판정과 관계 없이 일정 간격으로 히트 되는 것」 = 효과 표 blast_hits(횟수 · 간격 · 첫 히트까지) · 총 피해는 한 번에 줄 때와 같음
yield return Fresh ( ) ;
var zy = Spawn ( UnitType . Strategist , Faction . Player , 0f , - 4f , "주유" ) ;
Give ( zy , "zhouyu" ) ;
var bl = Eff ( "zhouyu_a" , SkillKeys . ShotBlast ) ;
int hits = Mathf . RoundToInt ( Eff ( "zhouyu_a" , SkillKeys . BlastHits ) . P ) ;
Assert . Greater ( hits , 1 , "표의 다단 횟수" ) ;
var a = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1f , "적1" ) ;
var b = Spawn ( UnitType . Infantry , Faction . Enemy , bl . P * 0.6f , - 1f , "적2" ) ;
a . MaxHp = a . Hp = 100000 ; // 여러 번 맞아도 쓰러지지 않게(횟수 확인)
b . MaxHp = b . Hp = 100000 ;
Begin ( ) ;
int a0 = a . Hp , b0 = b . Hp ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( zy , zy . Position + Vector2 . up * 2f , o ) ;
int na = 0 , nb = 0 ;
foreach ( var x in o . Attacked )
{
if ( x = = a ) na + + ;
if ( x = = b ) nb + + ;
}
Assert . AreEqual ( hits , na , "명중 대상 = 표의 횟수만큼 히트" ) ;
Assert . AreEqual ( hits , nb , "폭발 반경 안의 다른 적도 같은 횟수" ) ;
Assert . AreEqual ( o . DamageDealt , ( a0 - a . Hp ) + ( b0 - b . Hp ) , "히트 피해 합 = 집계한 총 피해" ) ;
}
[UnityTest]
public IEnumerator Push_Chain_PushedEnemyPushesNextUnitWithLessForce ( )
{
// PD 2026-11-13 「슬링샷으로 적을 공격했을 때 다른 유닛에게 막힐 경우 다른 유닛도 물리적인 힘에 의해 튕겨질 수 있도록(당구처럼) · 밀리는 유닛이 증가할수록 밀리는 힘은 줄어들어야」
yield return Fresh ( ) ;
var sp = Spawn ( UnitType . Spear , Faction . Player , 0f , - 4f , "창병" ) ;
var a = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 4f + sp . Radius * 2f + 0.5f , "적 A" ) ;
var b = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , a . Position . y + a . Radius * 2f + 0.3f , "적 B" ) ;
a . MaxHp = a . Hp = 100000 ;
b . MaxHp = b . Hp = 100000 ;
Begin ( ) ;
Vector2 a0 = a . Position , b0 = b . Position ;
var o = new ActionOutcome ( ) ;
yield return Act ( sp , sp . Position + Vector2 . up * sp . SlingMaxDistance , o ) ; // 최대로 당겨 A 를 침
float movedA = Vector2 . Distance ( a0 , a . Position ) , movedB = Vector2 . Distance ( b0 , b . Position ) ;
Assert . Contains ( a , o . Pushed , "맞은 A 가 밀림" ) ;
Assert . Contains ( b , o . Pushed , "A 에 막힌 B 도 밀림(연쇄)" ) ;
Assert . Greater ( movedB , 0.05f , "B 가 실제로 움직임" ) ;
Assert . Greater ( b . Position . y , b0 . y , "밀린 방향 = A 가 밀려온 쪽" ) ;
Assert . Less ( a . Position . y + a . Radius + b . Radius , b . Position . y + 0.02f , "A 는 B 자리를 넘지 않음(닿은 자리에서 멈춤)" ) ;
float push = Mathf . Max ( 0f , sp . SlingMaxDistance - Mathf . Clamp01 ( cfg . impactFalloff ) * 0.5f ) * cfg . spearPushRatio ; // A 가 막히지 않았다면 밀렸을 거리(부딪히는 힘 = 쏜 거리 − 간 거리 0.5 × impactFalloff · PD 2026-11-16) × 창병 밀치기 비율
Assert . Less ( movedB , push , "B 가 밀린 거리 < A 가 받은 힘(뒤로 갈수록 줄어듦)" ) ;
}
[UnityTest]
public IEnumerator RepeatAction_FirstPushStaysWithinSecondDash ( )
{
// PD 2026-11-13 정보 연환격 「첫 타격 시 밀려나는 거리는 다음 연속 공격 가능한 거리만큼만 밀리도록(너무 멀리 밀려나면 연속 두번 공격이 불가능)」
yield return Fresh ( ) ;
var cp = Spawn ( UnitType . Spear , Faction . Player , 0f , - 4f , "정보" ) ;
Give ( cp , "chengpu" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 4f + cp . Radius * 2f + 0.6f , "적" ) ; // 바로 앞 = 남은 거리가 길어 예전엔 멀리 밀려남
foe . MaxHp = foe . Hp = 100000 ;
Begin ( ) ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( cp , cp . Position + Vector2 . up * cp . SlingMaxDistance , o ) ; // 최대로 당김
int n = 0 ;
foreach ( var x in o . Attacked )
if ( x = = foe ) n + + ;
Assert . AreEqual ( 2 , n , "같은 힘의 두 번째 돌진이 밀려난 적에게 닿음" ) ;
}
2026-11-10 11:36:58 +00:00
// ---------- PD 결정 반영(2026-11-10 #1112 · ⑧ ⑩ ⑬ ⑭) ----------
[UnityTest]
public IEnumerator Firewall_HitsAlliesToo ( )
{
yield return Fresh ( ) ;
var lx = Spawn ( UnitType . Strategist , Faction . Player , 0f , - 5f , "육손" ) ;
Give ( lx , "luxun" ) ;
var ally = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 3f , "아군" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1f , "적" ) ;
Begin ( ) ;
int a0 = ally . Hp , f0 = foe . Hp ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( lx , lx . Position + Vector2 . up * 2f , o ) ;
Assert . Less ( foe . Hp , f0 , "적 피해" ) ;
Assert . Less ( ally . Hp , a0 , "아군도 피해(결정 ⑬)" ) ;
Assert . Greater ( bm . Skills . StatusOf ( ally ) . BurnTurns , 0 , "아군도 화상" ) ;
Assert . AreEqual ( 1 , bm . Skills . Zones . Count , "장벽 지대" ) ;
Assert . IsTrue ( bm . Skills . Zones [ 0 ] . HitsAllies ) ;
}
2026-11-17 07:27:22 +00:00
[UnityTest]
public IEnumerator Firewall_BurnsWithoutPassiveConfuse ( )
{
// PD 2026-11-13 21차 「육손의 스킬에 명중 된 경우, 혼란이 발생하면 안돼(화상 효과여야 함)」 = 패시브 백면서생의 혼란(cond unarmed)은 스킬(불 장벽) 명중에는 걸리지 않음
yield return Fresh ( ) ;
var lx = Spawn ( UnitType . Strategist , Faction . Player , 0f , - 5f , "육손" ) ;
Give ( lx , "luxun" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1f , "적" ) ;
foe . MaxHp = foe . Hp = 100000 ;
Begin ( ) ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( lx , lx . Position + Vector2 . up * 2f , o ) ;
Assert . Greater ( bm . Skills . StatusOf ( foe ) . BurnTurns , 0 , "스킬 명중 = 화상" ) ;
Assert . IsFalse ( SkillStatus . Confused ( foe ) , "스킬 명중에는 혼란 없음" ) ;
}
[UnityTest]
public IEnumerator Luxun_PlainAttack_StillConfuses ( )
{
// 같은 패시브 = 스킬이 아닌 일반 공격에는 그대로 혼란
yield return Fresh ( ) ;
var lx = Spawn ( UnitType . Strategist , Faction . Player , 0f , - 5f , "육손" ) ;
Give ( lx , "luxun" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1f , "적" ) ;
foe . MaxHp = foe . Hp = 100000 ;
Begin ( ) ;
var o = new ActionOutcome ( ) ;
yield return Act ( lx , foe . Position , o ) ;
Assert . IsTrue ( o . Attacked . Contains ( foe ) , "일반 공격 명중" ) ;
Assert . IsTrue ( SkillStatus . Confused ( foe ) , "일반 공격 = 패시브 혼란" ) ;
}
2026-11-10 11:36:58 +00:00
[UnityTest]
public IEnumerator SplashHeal_HealsTargetWithoutDamage ( )
{
yield return Fresh ( ) ;
var sq = Spawn ( UnitType . Strategist , Faction . Player , 0f , - 4f , "손건" ) ;
Give ( sq , "sunqian" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1f , "적" ) ;
Begin ( ) ;
foe . Hp = foe . MaxHp / 2 ;
int f0 = foe . Hp ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( sq , foe . Position , o ) ;
Assert . Greater ( foe . Hp , f0 , "명중 대상도 피해 없이 회복(결정 ⑧)" ) ;
Assert . AreEqual ( 0 , o . DamageDealt ) ;
}
[UnityTest]
public IEnumerator Whirl_DealsDamageAndPushes ( )
{
yield return Fresh ( ) ;
var zj = Spawn ( UnitType . Strategist , Faction . Player , 0f , - 5f , "제갈근" ) ;
Give ( zj , "zhugejin" ) ;
var foe = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 2f , "적" ) ;
Begin ( ) ;
int f0 = foe . Hp ;
float y0 = foe . Position . y ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( zj , zj . Position + Vector2 . up * 2f , o ) ;
Assert . Less ( foe . Hp , f0 , "공격력 × p3 피해(결정 ⑭)" ) ;
Assert . Greater ( foe . Position . y , y0 + 0.5f , "진행 방향으로 밀림" ) ;
Assert . IsTrue ( SkillStatus . Confused ( foe ) , "혼란" ) ;
}
[UnityTest]
public IEnumerator Zombie_ActsAtNextOwnTurnThenVanishes ( )
{
yield return Fresh ( ) ;
var zl = Spawn ( UnitType . Strategist , Faction . Player , 0f , - 5f , "장로" ) ;
Give ( zl , "zhanglu" ) ;
var victim = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 2f , "약한 적" ) ;
var other = Spawn ( UnitType . Infantry , Faction . Enemy , 3f , 1f , "다른 적" ) ;
Begin ( ) ;
victim . Hp = 1 ;
int other0 = other . Hp ;
var o = new ActionOutcome ( ) ;
yield return Act ( zl , victim . Position , o ) ;
Assert . IsFalse ( victim . IsAlive ) ;
Unit zombie = null ;
foreach ( var u in bm . Units )
if ( u ! = null & & u . IsAlive & & SkillSystem . IsSummon ( u ) ) zombie = u ;
Assert . IsNotNull ( zombie , "망령 생성" ) ;
Assert . AreEqual ( Faction . Player , zombie . Faction ) ;
Assert . AreEqual ( other0 , other . Hp , "처치 직후에는 공격하지 않음(결정 ⑩)" ) ;
yield return bm . Skills . TurnBegin ( Faction . Player ) ;
Assert . IsFalse ( SkillSystem . IsSummon ( zombie ) & & zombie ! = null & & zombie . IsAlive , "자기 턴 시작에 1번 행동 후 소멸" ) ;
}
// ---------- Fable 검토 지적 수정(2026-11-10 · A1 · A2 · B1) ----------
[UnityTest]
public IEnumerator Infantry_SwordWave_PiercesLine ( )
{
yield return Fresh ( ) ;
var zt = Spawn ( UnitType . Infantry , Faction . Player , 0f , - 5f , "주태" ) ;
Give ( zt , "zhoutai" ) ;
var a = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 3f , "적1" ) ;
var b = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1.5f , "적2" ) ;
Begin ( ) ;
Vector2 start = zt . Position ;
int a0 = a . Hp , b0 = b . Hp ;
var o = new ActionOutcome ( ) ;
yield return ActArmed ( zt , zt . Position + Vector2 . up * 2f , o ) ;
Assert . IsTrue ( o . Fired , "보병 검기 = 사격" ) ;
Assert . Less ( a . Hp , a0 ) ;
Assert . Less ( b . Hp , b0 , "직선 위 전원" ) ;
Assert . Less ( Vector2 . Distance ( zt . Position , start ) , 0.05f , "주태는 제자리" ) ;
}
2026-11-20 10:22:16 +00:00
/// <summary>검기·회오리 = 닿는 순간 피격(2026-11-19 PD 「검기가 닿는 시점에 정확히 피격」 · 「회오리 이동 경로와 방향에 맞춰서 피격 및 밀려나도록」): 가까운 적이 먼 적보다 먼저 · 행동 끝보다 먼저.</summary>
[UnityTest]
public IEnumerator Shot_HitsEachTargetOnContact ( [ Values ( "zhoutai" , "zhugejin" ) ] string hero )
{
yield return Fresh ( ) ;
var me = Spawn ( hero = = "zhoutai" ? UnitType . Infantry : UnitType . Strategist , Faction . Player , 0f , - 5f , hero ) ;
Give ( me , hero ) ;
var near = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 3f , "가까운 적" ) ;
var far = Spawn ( UnitType . Infantry , Faction . Enemy , 0f , - 1f , "먼 적" ) ;
near . Hp = near . MaxHp = 100000 ;
far . Hp = far . MaxHp = 100000 ;
Begin ( ) ;
bool end = false ;
float tNear = - 1f , tFar = - 1f , tEnd = - 1f , clock = 0f ;
var o = new ActionOutcome ( ) ;
bm . StartCoroutine ( Run ( ActArmed ( me , me . Position + Vector2 . up * 2f , o ) , ( ) = > end = true ) ) ;
while ( ! end & & clock < 8f )
{
if ( tNear < 0f & & near . Hp < near . MaxHp ) tNear = clock ;
if ( tFar < 0f & & far . Hp < far . MaxHp ) tFar = clock ;
clock + = Time . deltaTime ;
yield return null ;
}
tEnd = clock ;
Assert . IsTrue ( end , "행동 끝" ) ;
Assert . GreaterOrEqual ( tNear , 0f , "가까운 적 맞음" ) ;
Assert . GreaterOrEqual ( tFar , 0f , "먼 적 맞음" ) ;
if ( hero = = "zhugejin" ) Assert . Less ( tNear , tFar , "가까운 적이 먼저(닿는 순서)" ) ;
else Assert . LessOrEqual ( tNear , tFar , "가까운 적이 먼 적보다 늦지 않음(검기는 빨라 테스트 한 프레임에 둘 다 지나갈 수 있음)" ) ;
Assert . Less ( tNear , tEnd - 0.05f , "날아가는 도중에 맞음" ) ;
}
2026-11-10 11:36:58 +00:00
[UnityTest]
public IEnumerator GrantReaction_ToSoldierWithoutSkills ( )
{
yield return Fresh ( ) ;
var gj = Spawn ( UnitType . Strategist , Faction . Player , 0f , - 3f , "곽가" ) ;
var s = Give ( gj , "guojia" ) ;
var soldier = Spawn ( UnitType . Infantry , Faction . Player , 1.5f , - 3f , "병사" ) ;
Begin ( ) ;
Assert . IsNull ( bm . Skills . Of ( soldier ) , "스킬 없는 병사" ) ;
yield return bm . Skills . Instant ( s ) ;
Assert . IsTrue ( bm . Skills . TakeReaction ( soldier ) , "행동 안 한 병사 = 행동 뒤 재행동" ) ;
}
[UnityTest]
public IEnumerator Hot_HealsEveryRoundForDuration ( )
{
yield return Fresh ( ) ;
var pt = Spawn ( UnitType . Strategist , Faction . Player , 0f , - 3f , "방통" ) ;
var s = Give ( pt , "pangtong" ) ;
var ally = Spawn ( UnitType . Infantry , Faction . Player , 1.5f , - 3f , "아군" ) ;
Begin ( ) ;
int rounds = Eff ( "pangtong_a" , SkillKeys . Hot ) . Dur ;
yield return bm . Skills . Instant ( s ) ;
int heals = 0 ;
for ( int i = 0 ; i < rounds + 1 ; i + + )
{
ally . Hp = 1 ;
2026-11-17 07:27:22 +00:00
yield return bm . Skills . TurnBegin ( Faction . Enemy ) ; // 아군 턴 끝 = 지속 회복(PD 2026-11-13 「턴 종료 시점에 한 번」 · 시전한 턴 포함 dur 번)
2026-11-10 11:36:58 +00:00
if ( ally . Hp > 1 ) heals + + ;
2026-11-17 07:27:22 +00:00
yield return bm . Skills . TurnBegin ( Faction . Player ) ; // 라운드 1 감소
2026-11-10 11:36:58 +00:00
}
Assert . AreEqual ( rounds , heals , "지속 턴 수만큼 회복" ) ;
}
2026-11-10 10:00:18 +00:00
// ---------- 회복 · 정화 ----------
2026-11-05 15:22:54 +00:00
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator Instant_HealAndCleanse_InRange ( )
2026-11-05 15:22:54 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var zg = Spawn ( UnitType . Strategist , Faction . Player , 0f , - 3f , "제갈량" ) ;
var s = Give ( zg , "zhugeliang" ) ;
var ally = Spawn ( UnitType . Infantry , Faction . Player , 1.5f , - 3f , "아군" ) ;
var far = Spawn ( UnitType . Infantry , Faction . Player , zg . SlingMaxDistance + 4f , - 3f , "먼 아군" ) ;
Begin ( ) ;
ally . Hp = ally . MaxHp / 3 ;
far . Hp = far . MaxHp / 3 ;
var burn = Eff ( "xushu_a" , SkillKeys . HitBurn ) ;
bm . Skills . ApplyBurn ( ally , Mathf . RoundToInt ( burn . P ) , burn . Get ( 1 ) ) ;
int a0 = ally . Hp , f0 = far . Hp ;
yield return bm . Skills . Instant ( s ) ;
Assert . Greater ( ally . Hp , a0 , "범위 안 회복" ) ;
Assert . AreEqual ( f0 , far . Hp , "범위 밖" ) ;
Assert . IsFalse ( SkillStatus . HasAny ( ally ) , "정화" ) ;
2026-11-05 15:22:54 +00:00
}
2026-11-10 10:00:18 +00:00
// ---------- 가상 실행(적 AI 예측) 복원 ----------
2026-11-05 15:22:54 +00:00
[UnityTest]
2026-11-10 10:00:18 +00:00
public IEnumerator Sim_RestoresSkillState ( )
2026-11-05 15:22:54 +00:00
{
yield return Fresh ( ) ;
2026-11-10 10:00:18 +00:00
var jx = Spawn ( UnitType . Strategist , Faction . Enemy , 0f , 3f , "가후" ) ;
Give ( jx , "jiaxu" ) ;
var p = Spawn ( UnitType . Infantry , Faction . Player , 0f , 0f , "아군" ) ;
Begin ( ) ;
var snap = Sim . Take ( bm ) ;
Sim . Active = true ;
try
{
var o = new ActionOutcome ( ) ;
Sim . Run ( bm . Resolver . Resolve ( jx , p . Position , false , o ) ) ;
}
finally
{
Sim . Active = false ;
Sim . Restore ( bm , snap ) ;
}
Assert . IsFalse ( SkillStatus . HasAny ( p ) , "가상 실행 중 걸린 중독이 남지 않음" ) ;
Assert . AreEqual ( p . MaxHp , p . Hp ) ;
2026-11-05 15:22:54 +00:00
}
2026-11-05 14:31:27 +00:00
}
}