예제 #1
0
    def testEffect(self):
        multiplier = 1
        basic = 2
        desLife = self.desLc.lifeState.current

        effector = HealEffector(value=1)
        healCard1 = Card.card(CardType.Support, [effector])
        self.srcCardController.addCard(healCard1)
        healCard2 = Card.card(CardType.Support, [effector])
        self.srcCardController.addCard(healCard2)
        healCard3 = Card.card(CardType.Support, [effector])
        self.srcCardController.addCard(healCard3)

        effector = DamageViaCardCastEffector(cardType=CardType.Support, multiplier=multiplier, basic=basic,
                                             damageType=DamageType.Normal)
        damageCard1 = Card.card(CardType.Damage, [effector])
        self.srcCardController.addCard(damageCard1)
        damageCard2 = Card.card(CardType.Damage, [effector])
        self.srcCardController.addCard(damageCard2)

        self.turnSystem.beginTurn()
        self.srcCardController.castCard(healCard1.serial, self.srcLattice)
        self.srcCardController.castCard(healCard2.serial, self.srcLattice)
        self.srcCardController.castCard(healCard3.serial, self.srcLattice)
        self.srcCardController.castCard(damageCard1.serial, self.desLattice)
        self.turnSystem.endTurn()
        desLife -= (multiplier * 3 + basic)
        self.assertEqual(self.desLc.lifeState.current, desLife)

        self.turnSystem.beginTurn()
        self.srcCardController.castCard(damageCard2.serial, self.desLattice)
        self.turnSystem.endTurn()
        desLife -= basic
        self.assertEqual(self.desLc.lifeState.current, desLife)
예제 #2
0
    def testEffect(self):
        percent, damage = 0.5, 2
        desLife = self.desLc.lifeState.current

        self.turnSystem.beginTurn()
        # 使对方受到的伤害设置为percent
        effector = AlterDamageByPercentEffector(
            percent=percent, turn=1, alterType=ModifierAlterType.Suffer)
        # 打出该效果
        castInfo = CastInfo(self.srcEntity, self.desLattice, 0,
                            Card.card(CardType.Support, [effector]))
        self.world.eventCenter.fire(ClientCastEvent(castInfo))
        # 对对方造成伤害
        damageEffector = DamageEffector(value=damage,
                                        damageType=DamageType.Normal)
        # 打出该效果
        castInfo = CastInfo(self.srcEntity, self.desLattice, 0,
                            Card.card(CardType.Damage, [damageEffector]))
        self.world.eventCenter.fire(ClientCastEvent(castInfo))
        # 进入结算
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)

        self.turnSystem.beginTurn()
        self.world.eventCenter.fire(ClientCastEvent(castInfo))
        self.turnSystem.endTurn()
        desLife -= 2
        self.assertEqual(self.desLc.lifeState.current, desLife)
예제 #3
0
    def testEffect(self):
        self.desLc.lifeState.max = 100
        self.desLc.lifeState.current = 100
        desLife = self.desLc.lifeState.current

        effector = DamageEffector(value=1)
        damageCard1 = Card.card(CardType.Damage, [effector])
        self.srcCardController.addCard(damageCard1)
        damageCard2 = Card.card(CardType.Damage, [effector])
        self.srcCardController.addCard(damageCard2)

        skill = ConsSkill.skill(castor=OmnipotentCastor(), damage=1, cd=4,
                                cardTypeToUse=CardType.Damage, cardCountToUse=2)
        skill.attach(self.srcEntity)
        self.srcCc.character.skill = skill

        self.turnSystem.beginTurn()
        self.srcCc.castSkill(self.desLattice)
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)

        # turn 1
        self.turnSystem.beginTurn()
        self.srcCc.castSkill(self.desLattice)
        self.turnSystem.endTurn()
        self.assertEqual(self.desLc.lifeState.current, desLife)

        # turn 2
        self.turnSystem.beginTurn()
        self.srcCc.castSkill(self.desLattice)
        self.srcCardController.castCard(damageCard1.serial, self.desLattice)
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)

        # turn 3
        self.turnSystem.beginTurn()
        self.srcCc.castSkill(self.desLattice)
        self.srcCardController.castCard(damageCard2.serial, self.desLattice)
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)

        # turn 4
        self.turnSystem.beginTurn()
        self.srcCc.castSkill(self.desLattice)
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)
    def testEffect(self):
        self.desLc.lifeState.max = 100
        self.desLc.lifeState.current = 50
        desLife = self.desLc.lifeState.current

        info1 = CETSkillInfo(castor=OmnipotentCastor(), effectors=[HealEffector(value=1)])
        info2 = CETSkillInfo(castor=OmnipotentCastor(), effectors=[DamageEffector(value=1)])
        info3 = CETSkillInfo(castor=OmnipotentCastor(), effectors=[ModifyShieldEffector(value=2)])

        skill = ChangeEveryTurnSkill.skill(infos=[info1, info2, info3])
        skill.attach(self.srcEntity)
        self.srcCc.character.skill = skill

        effector = DamageEffector(value=3)
        damageCard = Card.card(CardType.Support, [effector])
        self.srcCardController.addCard(damageCard)

        self.turnSystem.beginTurn()
        self.srcCc.castSkill(self.desLattice)
        self.turnSystem.endTurn()
        desLife += 1
        self.assertEqual(self.desLc.lifeState.current, desLife)

        self.turnSystem.beginTurn()
        self.srcCc.castSkill(self.desLattice)
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)

        self.turnSystem.beginTurn()
        self.srcCardController.castCard(damageCard.serial, self.desLattice)
        self.srcCc.castSkill(self.desLattice)
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)
예제 #5
0
    def testEffect(self):
        self.desLc.lifeState.max = 100
        self.desLc.lifeState.current = 1
        desLife = self.desLc.lifeState.current

        effector = HealEffector(value=2)
        healCard1 = Card.card(CardType.Support, [effector])
        self.srcCardController.addCard(healCard1)

        skill = AmithSkill.skill(cd=0, castor=OmnipotentCastor(),
                                 cardType=CardType.Support, castCount=2)
        skill.attach(self.srcEntity)
        self.srcCc.character.skill = skill

        # 第一次释放,证明存在护盾
        self.turnSystem.beginTurn()
        self.srcCc.castSkill(self.srcLattice)
        self.srcCardController.castCard(healCard1.serial, self.desLattice)
        self.turnSystem.endTurn()
        desLife += 4
        self.assertEqual(self.desLc.lifeState.current, desLife)

        # 第二次释放,证明技能进入cd
        self.srcCardController.addCard(healCard1)
        self.turnSystem.beginTurn()
        self.srcCardController.castCard(healCard1.serial, self.desLattice)
        self.turnSystem.endTurn()
        desLife += 2
        self.assertEqual(self.desLc.lifeState.current, desLife)
예제 #6
0
    def testEffect(self):
        self.desLc.lifeState.max = 100
        self.desLc.lifeState.current = 100
        desLife = self.desLc.lifeState.current

        effector = HealEffector(value=1)
        healCard1 = Card.card(CardType.Support, [effector])
        self.srcCardController.addCard(healCard1)
        healCard2 = Card.card(CardType.Support, [effector])
        self.srcCardController.addCard(healCard2)

        skill = EastSkill.skill(cd=0,
                                castor=OmnipotentCastor(),
                                basic=2,
                                cardTypeToUse=CardType.Support,
                                increase=2)
        skill.attach(self.srcEntity)
        self.srcCc.character.skill = skill

        # 直接释放技能
        self.turnSystem.beginTurn()
        self.srcCc.castSkill(self.desLattice)
        self.turnSystem.endTurn()
        desLife -= 2
        self.assertEqual(self.desLc.lifeState.current, desLife)

        # 释放技能,释放辅助卡,注意技能在辅助卡之前所以此回合并未增加伤害
        self.turnSystem.beginTurn()
        self.srcCc.castSkill(self.desLattice)
        self.srcCardController.castCard(healCard1.serial, self.srcLattice)
        self.turnSystem.endTurn()
        desLife -= 2
        self.assertEqual(self.desLc.lifeState.current, desLife)

        # 释放技能,上回合释放过辅助卡,故伤害进行增加
        self.turnSystem.beginTurn()
        self.srcCc.castSkill(self.desLattice)
        self.turnSystem.endTurn()
        desLife -= 4
        self.assertEqual(self.desLc.lifeState.current, desLife)

        # 释放技能,上回合释放过技能,故伤害恢复
        self.turnSystem.beginTurn()
        self.srcCc.castSkill(self.desLattice)
        self.turnSystem.endTurn()
        desLife -= 2
        self.assertEqual(self.desLc.lifeState.current, desLife)
예제 #7
0
    def testEffect(self):
        desLife = self.desLc.lifeState.current

        effector = DamageEffector(value=1)
        damageCard1 = Card.card(
            CardType.Damage, [effector],
            castTargetType=CastorTargetType.CharacterEntity)
        self.srcCardController.addCard(damageCard1)
        damageCard2 = Card.card(
            CardType.Damage, [effector],
            castTargetType=CastorTargetType.CharacterEntity)
        self.srcCardController.addCard(damageCard2)
        damageCard3 = Card.card(
            CardType.Damage, [effector],
            castTargetType=CastorTargetType.CharacterEntity)
        self.srcCardController.addCard(damageCard3)

        effector = DodgeCardEffectEffector(probability=1, turn=1)
        dodgeCard = Card.card(CardType.Support, [effector],
                              castTargetType=CastorTargetType.CharacterEntity)
        self.srcCardController.addCard(dodgeCard)

        self.turnSystem.beginTurn()
        self.srcCardController.castCard(dodgeCard.serial, self.desLattice)
        self.srcCardController.castCard(damageCard1.serial, self.desLattice)
        self.srcCardController.castCard(damageCard2.serial, self.desLattice)
        self.turnSystem.endTurn()
        self.assertEqual(self.desLc.lifeState.current, desLife)

        self.turnSystem.beginTurn()
        self.srcCardController.castCard(damageCard3.serial, self.desLattice)
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)

        self.srcCardController.addCard(damageCard1)
        effector = DodgeCardEffectEffector(probability=0, turn=1)
        dodgeCard = Card.card(CardType.Support, [effector])
        self.srcCardController.addCard(dodgeCard)
        self.turnSystem.beginTurn()
        self.srcCardController.castCard(dodgeCard.serial, self.srcLattice)
        self.srcCardController.castCard(damageCard1.serial, self.desLattice)
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)
예제 #8
0
 def testAliveEffect(self):
     shield, damage = 8, 5
     desLife = self.desLc.lifeState.current
     effector = TurnedShieldEffector(value=shield, turn=2)
     castInfo = CastInfo(self.srcEntity, self.desLattice, 0,
                         Card.card(CardType.Support, [effector]))
     self.world.eventCenter.fire(ClientCastEvent(castInfo))
     damageEffector = DamageEffector(value=damage,
                                     damageType=DamageType.Normal)
     castInfo = CastInfo(self.srcEntity, self.desLattice, 0,
                         Card.card(CardType.Damage, [damageEffector]))
     self.world.eventCenter.fire(ClientCastEvent(castInfo))
     self.turnSystem.endTurn()
     self.assertEqual(self.desLc.lifeState.current, desLife)
     self.world.eventCenter.fire(ClientCastEvent(castInfo))
     self.turnSystem.endTurn()
     desLife -= 2
     self.assertEqual(self.desLc.lifeState.current, desLife)
     self.world.eventCenter.fire(ClientCastEvent(castInfo))
     self.turnSystem.endTurn()
     desLife -= 5
     self.assertEqual(self.desLc.lifeState.current, desLife)
예제 #9
0
    def testEffect(self):
        desLife = self.desLc.lifeState.current

        self.turnSystem.beginTurn()
        effector = TempModifyMaxLifeEffector(value=5, turn=-1)
        card1 = Card.card(CardType.Support, [effector])
        self.srcCardController.addCard(card1)

        effector = HealEffector(value=1)
        healCard1 = Card.card(CardType.Support, [effector])
        self.srcCardController.addCard(healCard1)

        self.turnSystem.beginTurn()
        self.srcCardController.castCard(healCard1.serial, self.desLattice)
        self.turnSystem.endTurn()
        self.assertEqual(self.desLc.lifeState.current, desLife)

        self.srcCardController.addCard(healCard1)
        self.turnSystem.beginTurn()
        self.srcCardController.castCard(card1.serial, self.desLattice)
        self.srcCardController.castCard(healCard1.serial, self.desLattice)
        self.turnSystem.endTurn()
        desLife += 1
        self.assertEqual(self.desLc.lifeState.current, desLife)
예제 #10
0
    def testAliveEffect(self):
        creator = TurnedDamageElementCreator(radius=1, damage=1, turn=2)
        desLife = self.desLc.lifeState.current
        castInfo = CastInfo(self.srcEntity, self.desLattice, 0,
                            Card.card(CardType.Damage, [creator]))

        self.turnSystem.beginTurn()
        self.world.eventCenter.fire(ClientCastEvent(castInfo))
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)

        self.turnSystem.beginTurn()
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)

        self.turnSystem.beginTurn()
        self.turnSystem.endTurn()
        self.assertEqual(self.desLc.lifeState.current, desLife)
예제 #11
0
    def test__alive_effect(self):
        desLife = self.desLc.lifeState.current

        effector = DamageOverTimeEffector(value=1, turn=2, damageType=DamageType.Normal)
        damageCard1 = Card.card(CardType.Damage, [effector])
        self.srcCardController.addCard(damageCard1)

        self.turnSystem.beginTurn()
        self.srcCardController.castCard(damageCard1.serial, self.desLattice)
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)

        self.turnSystem.beginTurn()
        self.turnSystem.endTurn()
        desLife -= 1
        self.assertEqual(self.desLc.lifeState.current, desLife)

        self.turnSystem.beginTurn()
        self.turnSystem.endTurn()
        self.assertEqual(self.desLc.lifeState.current, desLife)
예제 #12
0
    def testEffect(self):
        desCardLimit = self.desCardController.cardLimit

        self.turnSystem.beginTurn()
        effector = TempModifyCardLimitEffector(value=1, turn=-1)
        testCard = Card.card(CardType.Support, [effector])
        self.srcCardController.addCard(testCard)

        effector = HealEffector(value=1)
        self.desCardController.addCard(Card.card(CardType.Support, [effector]))
        self.desCardController.addCard(Card.card(CardType.Support, [effector]))
        self.desCardController.addCard(Card.card(CardType.Support, [effector]))
        self.desCardController.addCard(Card.card(CardType.Support, [effector]))
        self.desCardController.addCard(Card.card(CardType.Support, [effector]))
        self.desCardController.addCard(Card.card(CardType.Support, [effector]))
        self.desCardController.addCard(Card.card(CardType.Support, [effector]))

        self.turnSystem.beginTurn()
        self.turnSystem.endTurn()
        self.assertEqual(len(self.desCardController.cardsInHand()),
                         desCardLimit)

        self.desCardController.addCard(Card.card(CardType.Support, [effector]))
        self.desCardController.addCard(Card.card(CardType.Support, [effector]))
        self.turnSystem.beginTurn()
        self.srcCardController.castCard(testCard.serial, self.desLattice)
        self.turnSystem.endTurn()
        self.assertEqual(len(self.desCardController.cardsInHand()),
                         desCardLimit)

        self.desCardController.addCard(Card.card(CardType.Support, [effector]))
        self.desCardController.addCard(Card.card(CardType.Support, [effector]))
        self.turnSystem.beginTurn()
        self.srcCardController.castCard(testCard.serial, self.desLattice)
        self.turnSystem.endTurn()
        desCardLimit += 1
        self.assertEqual(len(self.desCardController.cardsInHand()),
                         desCardLimit)