package cfvbaibai.cardfantasy.test;

import org.junit.After;
import org.junit.Assert;
import org.junit.Test;

import cfvbaibai.cardfantasy.StaticRandomizer;
import cfvbaibai.cardfantasy.engine.CardInfo;
import cfvbaibai.cardfantasy.engine.RuneInfo;

public class SummonSkillTest {
    private static StaticRandomizer random = FeatureValidationTests.getRandom();

    @After
    public void afterTest() {
        random.reset();
    }

    /**
     * 降临技能在符文发动和结算之前发动
     */
    @Test
    public void test降临摧毁_焚天() {
        FeatureTestContext context = FeatureValidationTests.prepare(50, 50, "独眼巨人", "焚天", "凤凰-5*2");
        context.addToHand(0, 0).setSummonDelay(0);
        RuneInfo r焚天 = context.addToRune(0, 0);
        context.addToField(1, 1);
        context.addToField(2, 1);
        context.startGame();

        random.addNextPicks(0); // 独眼巨人摧毁
        context.proceedOneRound();

        // 降临技能先结算，杀死一只凤凰，对方场上只剩一张森林卡，无法激活焚天
        Assert.assertFalse("焚天应该未激活", r焚天.isActivated());
        Assert.assertEquals(1, context.getPlayer(1).getField().size());
    }
    
    /**
     * 有多张卡牌等待时间相同的情况下，降临传送会杀死其中最靠前的那张
     */
    @Test
    public void test降临传送_相同等待时间() {
        FeatureTestContext context = FeatureValidationTests.prepare(50, 50, "隐世先知", "金属巨龙-5", "凤凰-5");
        context.addToHand(0, 0).setSummonDelay(0);
        CardInfo c金属巨龙 = context.addToField(1, 1).setSummonDelay(3);
        CardInfo c凤凰 = context.addToField(2, 1).setSummonDelay(3);
        context.startGame();

        context.proceedOneRound();

        Assert.assertFalse("凤凰应该还活着", c凤凰.isDead());
        Assert.assertTrue("金属巨龙应该死了", c金属巨龙.isDead());
    }
}

@@ -26,24 +26,48 @@
 tasy.test;%0A%0A
+import java.util.List;%0A%0A
 import org.j
@@ -1385,28 +1385,27 @@
 ontext.addTo
-Fiel
+Han
 d(1, 1).setS
@@ -1451,28 +1451,27 @@
 ontext.addTo
-Fiel
+Han
 d(2, 1).setS
@@ -1563,49 +1563,135 @@
     
-Assert.assertFalse(%22%E5%87%A4%E5%87%B0%E5%BA%94%E8%AF%A5%E8%BF%98%E6%B4%BB%E7%9D%80%22, c%E5%87%A4%E5%87%B0.isDead(
+List%3CCardInfo%3E handListB = context.getPlayer(1).getHand().toList();%0A        Assert.assertTrue(%22%E5%87%A4%E5%87%B0%E5%BA%94%E8%AF%A5%E8%BF%98%E6%B4%BB%E7%9D%80%22, handListB.contains(c%E5%87%A4%E5%87%B0
 ));%0A
@@ -1711,19 +1711,20 @@
 t.assert
-Tru
+Fals
 e(%22%E9%87%91%E5%B1%9E%E5%B7%A8%E9%BE%99%E5%BA%94
@@ -1733,21 +1733,32 @@
 %E4%BA%86%22, 
-c%E9%87%91%E5%B1%9E%E5%B7%A8%E9%BE%99.isDead(
+handListB.contains(c%E9%87%91%E5%B1%9E%E5%B7%A8%E9%BE%99
 ));%0A

Fix test issue in test降临传送_相同等待时间