def test_basic(self):
        """
        最も基本的なダメージ計算
        :return:
        """

        # H:152,A:101,B:101,C:117,S:97
        poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.TACKLE])
        # H:146,A:104,B:95,C:102,S:117
        poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.TACKLE])
        field = Field([Party([poke_atk]), Party([poke_def])])
        rng = GameRNGFixed()
        field.rng = rng
        field.rng.set_field(field)

        self.assertEqual(field.parties[0].get().hp, 152)
        self.assertEqual(field.parties[1].get().hp, 146)
        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=0)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ17
        self.assertEqual(field.parties[0].get().hp, 152 - 17)
        # BULBASAUR -> CHARMANDER: ダメージ18
        self.assertEqual(field.parties[1].get().hp, 146 - 18)

        # 急所
        rng.enqueue_const(1, GameRNGReason.CRITICAL, 0)
        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=0)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ32(急所)
        self.assertEqual(field.parties[0].get().hp, 152 - 17 - 32)
        # BULBASAUR -> CHARMANDER: ダメージ18
        self.assertEqual(field.parties[1].get().hp, 146 - 18 * 2)
Beispiel #2
0
    def test_basic(self):
        """
        最も基本的なダメージ計算
        :return:
        """

        # H:152,A:101,B:101,C:117,S:97
        poke_atk = PokeStatic.create(
            Dexno.BULBASAUR,
            [Move.TACKLE, Move.VINEWHIP, Move.SWORDSDANCE, Move.AGILITY])
        # H:146,A:104,B:95,C:102,S:117
        poke_def = PokeStatic.create(
            Dexno.CHARMANDER,
            [Move.TACKLE, Move.WATERGUN, Move.AMNESIA, Move.DEFENSECURL])
        field = Field([Party([poke_atk]), Party([poke_def])])
        rng = GameRNGFixed()
        field.rng = rng
        field.rng.set_field(field)

        self.assertEqual(field.parties[0].get().hp, 152)
        self.assertEqual(field.parties[1].get().hp, 146)
        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=2),
            FieldAction(FieldActionType.MOVE, move_idx=2)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ0
        self.assertEqual(field.parties[0].get().hp, 152)
        # BULBASAUR -> CHARMANDER: ダメージ0
        self.assertEqual(field.parties[1].get().hp, 146)
        # BULBASAUR: A+2, CHARMANDER: C+2

        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=0)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ17
        self.assertEqual(field.parties[0].get().hp, 152 - 17)
        # BULBASAUR -> CHARMANDER: ダメージ34 A+2
        self.assertEqual(field.parties[1].get().hp, 146 - 34)

        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=3),
            FieldAction(FieldActionType.MOVE, move_idx=1)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ16 C+2
        self.assertEqual(field.parties[0].get().hp, 152 - 17 - 16)
        # BULBASAUR -> CHARMANDER: ダメージ0
        self.assertEqual(field.parties[1].get().hp, 146 - 34)
        # BULBASAUR: A+2, S+2, CHARMANDER: C+2

        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=3)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ0
        self.assertEqual(field.parties[0].get().hp, 152 - 17 - 16)
        # BULBASAUR -> CHARMANDER: ダメージ34
        # BULBASAURが先制するので、防御を上げる前に攻撃が通る
        self.assertEqual(field.parties[1].get().hp, 146 - 34 - 34)
        # BULBASAUR: A+2, S+2, CHARMANDER: C+2, B+1

        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=0)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ17
        self.assertEqual(field.parties[0].get().hp, 152 - 17 - 16 - 17)
        # BULBASAUR -> CHARMANDER: ダメージ23
        self.assertEqual(field.parties[1].get().hp, 146 - 34 - 34 - 23)
        # BULBASAUR: A+2, S+2, CHARMANDER: C+2, B+1

        # 急所: 補正無効
        rng.enqueue_const(0, GameRNGReason.CRITICAL, 0)
        rng.enqueue_const(1, GameRNGReason.CRITICAL, 0)
        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=0)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)
        # CHARMANDER -> BULBASAUR : ダメージ32
        self.assertEqual(field.parties[0].get().hp, 152 - 17 - 16 - 17 - 32)
        # BULBASAUR -> CHARMANDER: ダメージ33
        self.assertEqual(field.parties[1].get().hp, 146 - 34 - 34 - 23 - 33)
Beispiel #3
0
    def test_change(self):
        """
        交代。
        交代先に技が当たること、再度出した時にHPはそのまま、こんらんが治っていることを確認
        :return:
        """

        # H:152,A:101,B:101,C:117,S:97
        pokest_0_0 = PokeStatic.create(Dexno.BULBASAUR, [Move.TACKLE, Move.SWORDSDANCE])
        # H:162,A:102,B:97,C:187,S:172
        pokest_0_1 = PokeStatic.create(Dexno.ALAKAZAM, [Move.WATERGUN, Move.ROCKTHROW])
        # H:146,A:104,B:95,C:102,S:117
        pokest_1_0 = PokeStatic.create(Dexno.CHARMANDER, [Move.EMBER, Move.CONFUSERAY, Move.EARTHQUAKE])
        # H:267,A:162,B:117,C:117,S:82
        # カビゴン
        pokest_1_1 = PokeStatic.create(Dexno.SNORLAX, [Move.BODYSLAM])
        field = Field([Party([pokest_0_0, pokest_0_1]), Party([pokest_1_0, pokest_1_1])])
        rng = GameRNGFixed()
        field.rng = rng
        field.rng.set_field(field)

        self.assertEqual(field.parties[0].get().hp, 152)
        self.assertEqual(field.parties[1].get().hp, 146)
        field.actions_begin = [FieldAction(FieldActionType.MOVE, move_idx=0),
                               FieldAction(FieldActionType.MOVE, move_idx=0)]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ50、スリップダメージ152//16=9
        self.assertEqual(field.parties[0].get().hp, 152 - 50 - 9)
        # やけど
        # BULBASAUR -> CHARMANDER: ダメージ9(攻撃低下)
        self.assertEqual(field.parties[1].get().hp, 146 - 9)
        self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.BURN)

        rng.enqueue_const(1, GameRNGReason.CONFUSE_TURN, 3)  # 3回混乱で自傷の可能性がある
        rng.enqueue_const(0, GameRNGReason.MOVE_CONFUSE, 1)  # 自傷せず
        field.actions_begin = [FieldAction(FieldActionType.MOVE, move_idx=1),
                               FieldAction(FieldActionType.MOVE, move_idx=1)]
        self.assertEqual(field.step(), FieldPhase.BEGIN)
        self.assertEqual(field.parties[0].get().hp, 152 - 50 - 9 - 9)
        self.assertEqual(field.parties[1].get().hp, 146 - 9)
        self.assertEqual(field.parties[0].get().v_confuse, True)

        field.actions_begin = [FieldAction(FieldActionType.CHANGE, change_idx=1),
                               FieldAction(FieldActionType.MOVE, move_idx=2)]
        # ALAKAZAMに交代
        self.assertEqual(field.step(), FieldPhase.BEGIN)
        # CHARMANDER -> ALAKAZAM : ダメージ49
        self.assertEqual(field.parties[0].get().hp, 162 - 49)
        self.assertEqual(field.parties[1].get().hp, 146 - 9)
        self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.EMPTY)
        self.assertEqual(field.parties[0].get().v_confuse, False)

        field.actions_begin = [FieldAction(FieldActionType.CHANGE, change_idx=0),
                               FieldAction(FieldActionType.MOVE, move_idx=2)]
        # BULBASAURに交代
        self.assertEqual(field.step(), FieldPhase.BEGIN)
        # CHARMANDER -> BULBASAUR : ダメージ46
        self.assertEqual(field.parties[0].get().hp, 152 - 50 - 9 - 9 - 46 - 9)
        self.assertEqual(field.parties[1].get().hp, 146 - 9)
        self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.BURN)
        self.assertEqual(field.parties[0].get().v_confuse, False)
    def test_basic(self):
        """
        最も基本的なダメージ計算
        :return:
        """

        # H:152,A:101,B:101,C:117,S:97
        poke_atk = PokeStatic.create(
            Dexno.BULBASAUR,
            [Move.TACKLE, Move.VINEWHIP, Move.GROWL, Move.STRINGSHOT])
        # H:146,A:104,B:95,C:102,S:117
        poke_def = PokeStatic.create(
            Dexno.CHARMANDER,
            [Move.TACKLE, Move.WATERGUN, Move.SCREECH, Move.SANDATTACK])
        field = Field([Party([poke_atk]), Party([poke_def])])
        rng = GameRNGFixed()
        field.rng = rng
        field.rng.set_field(field)

        self.assertEqual(field.parties[0].get().hp, 152)
        self.assertEqual(field.parties[1].get().hp, 146)
        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=2),
            FieldAction(FieldActionType.MOVE, move_idx=2)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ0
        self.assertEqual(field.parties[0].get().hp, 152)
        # BULBASAUR -> CHARMANDER: ダメージ0
        self.assertEqual(field.parties[1].get().hp, 146)
        # BULBASAUR: B-2, CHARMANDER: A-1

        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=0)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ23 A-1 B-2
        self.assertEqual(field.parties[0].get().hp, 152 - 23)
        # BULBASAUR -> CHARMANDER: ダメージ18
        self.assertEqual(field.parties[1].get().hp, 146 - 18)

        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=1),
            FieldAction(FieldActionType.MOVE, move_idx=1)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ8
        self.assertEqual(field.parties[0].get().hp, 152 - 23 - 8)
        # BULBASAUR -> CHARMANDER: ダメージ14
        self.assertEqual(field.parties[1].get().hp, 146 - 18 - 14)

        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=3),
            FieldAction(FieldActionType.MOVE, move_idx=3)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)
        self.assertEqual(field.parties[0].get().rank_accuracy.value, -1)
        self.assertEqual(field.parties[1].get().eff_s(), 78)

        # 急所: 補正無効
        rng.enqueue_const(0, GameRNGReason.CRITICAL, 0)
        rng.enqueue_const(1, GameRNGReason.CRITICAL, 0)
        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=0)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ32
        self.assertEqual(field.parties[0].get().hp, 152 - 23 - 8 - 32)
        # BULBASAUR -> CHARMANDER: ダメージ33
        self.assertEqual(field.parties[1].get().hp, 146 - 18 - 14 - 33)
Beispiel #5
0
    def test_basic(self):
        """
        追加効果でまひになる。
        素早さが変化し攻撃順序が変わる。
        乱数によって行動不能。
        のしかかりでノーマルタイプはまひしない。
        :return:
        """

        # H:267,A:162,B:117,C:117,S:82
        # カビゴン
        poke_atk = PokeStatic.create(
            Dexno.SNORLAX, [Move.TACKLE, Move.THUNDERSHOCK, Move.BODYSLAM])
        # H:172,A:135,B:109,C:137,S:157
        # エレブー
        poke_def = PokeStatic.create(
            Dexno.ELECTABUZZ, [Move.TACKLE, Move.THUNDERSHOCK, Move.BODYSLAM])
        field = Field([Party([poke_atk]), Party([poke_def])])
        rng = GameRNGFixed()
        field.rng = rng
        field.rng.set_field(field)

        self.assertEqual(field.parties[0].get().hp, 267)
        self.assertEqual(field.parties[1].get().hp, 172)
        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=2),
            FieldAction(FieldActionType.MOVE, move_idx=2)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # ELECTABUZZ -> SNORLAX : ダメージ45
        self.assertEqual(field.parties[0].get().hp, 267 - 45)
        # ノーマルタイプなのでまひしない
        # SNORLAX -> ELECTABUZZ: ダメージ85
        # まひ
        self.assertEqual(field.parties[1].get().hp, 172 - 85)

        self.assertEqual(field.parties[0].get().nv_condition,
                         PokeNVCondition.EMPTY)
        self.assertEqual(field.parties[1].get().nv_condition,
                         PokeNVCondition.PARALYSIS)
        # すばやさが下がっている
        self.assertEqual(field.parties[1].get().eff_s(), 157 // 4)

        # まひだけど行動可能
        rng.enqueue_const(1, GameRNGReason.MOVE_PARALYSIS, 3)
        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=1)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # ELECTABUZZ -> SNORLAX : ダメージ33
        # まひ
        self.assertEqual(field.parties[0].get().hp, 267 - 45 - 33)
        # SNORLAX -> ELECTABUZZ: ダメージ85
        self.assertEqual(field.parties[1].get().hp, 172 - 85 - 36)

        # まひでお互い動けない
        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=1)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)
        self.assertEqual(field.parties[0].get().hp, 267 - 45 - 33)
        self.assertEqual(field.parties[1].get().hp, 172 - 85 - 36)
Beispiel #6
0
    def test_basic(self):
        """
        体力満タンなら状態異常でも眠れない
        :return:
        """

        # H:152,A:101,B:101,C:117,S:97
        poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.REST, Move.TACKLE])
        # H:146,A:104,B:95,C:102,S:117
        poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.THUNDERWAVE, Move.TACKLE])
        field = Field([Party([poke_atk]), Party([poke_def])])
        rng = GameRNGFixed()
        field.rng = rng
        field.rng.set_field(field)

        self.assertEqual(field.parties[0].get().hp, 152)
        self.assertEqual(field.parties[1].get().hp, 146)
        field.actions_begin = [FieldAction(FieldActionType.MOVE, move_idx=0),
                               FieldAction(FieldActionType.MOVE, move_idx=0)]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR
        self.assertEqual(field.parties[0].get().hp, 152)
        # BULBASAUR -> CHARMANDER
        self.assertEqual(field.parties[1].get().hp, 146)

        self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.PARALYSIS)
        self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.EMPTY)

        # まひだけど行動可能
        rng.enqueue_const(0, GameRNGReason.MOVE_PARALYSIS, 3)
        field.actions_begin = [FieldAction(FieldActionType.MOVE, move_idx=1),
                               FieldAction(FieldActionType.MOVE, move_idx=1)]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ17
        self.assertEqual(field.parties[0].get().hp, 152 - 17)
        # BULBASAUR -> CHARMANDER: ダメージ18
        self.assertEqual(field.parties[1].get().hp, 146 - 18)

        self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.PARALYSIS)
        self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.EMPTY)

        # まひだけど行動可能
        rng.enqueue_const(0, GameRNGReason.MOVE_PARALYSIS, 3)
        field.actions_begin = [FieldAction(FieldActionType.MOVE, move_idx=0),
                               FieldAction(FieldActionType.MOVE, move_idx=1)]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ17だがその後眠る回復
        self.assertEqual(field.parties[0].get().hp, 152)
        # BULBASAUR -> CHARMANDER: ダメージ18
        self.assertEqual(field.parties[1].get().hp, 146 - 18)

        self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.SLEEP)
        self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.EMPTY)

        field.actions_begin = [FieldAction(FieldActionType.MOVE, move_idx=1),
                               FieldAction(FieldActionType.MOVE, move_idx=1)]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ17
        self.assertEqual(field.parties[0].get().hp, 152 - 17)
        # BULBASAUR -> CHARMANDER: まだ寝てる
        self.assertEqual(field.parties[1].get().hp, 146 - 18)

        self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.SLEEP)
        self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.EMPTY)
        field.actions_begin = [FieldAction(FieldActionType.MOVE, move_idx=1),
                               FieldAction(FieldActionType.MOVE, move_idx=1)]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : ダメージ17
        self.assertEqual(field.parties[0].get().hp, 152 - 17 * 2)
        # BULBASAUR -> CHARMANDER: 起きただけ
        self.assertEqual(field.parties[1].get().hp, 146 - 18)

        self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.EMPTY)
        self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.EMPTY)
Beispiel #7
0
    def test_basic(self):
        """
        こんらんによる自滅
        自分のランク補正でダメージ変動
        :return:
        """

        # H:152,A:101,B:101,C:117,S:97
        poke_atk = PokeStatic.create(Dexno.BULBASAUR,
                                     [Move.TACKLE, Move.SWORDSDANCE])
        # H:146,A:104,B:95,C:102,S:117
        poke_def = PokeStatic.create(Dexno.CHARMANDER,
                                     [Move.CONFUSERAY, Move.LEER])
        field = Field([Party([poke_atk]), Party([poke_def])])
        rng = GameRNGFixed()
        field.rng = rng
        field.rng.set_field(field)

        rng.enqueue_const(1, GameRNGReason.CONFUSE_TURN, 3)  # 3回混乱で自傷の可能性がある
        rng.enqueue_const(0, GameRNGReason.MOVE_CONFUSE, 1)  # 自傷せず
        self.assertEqual(field.parties[0].get().hp, 152)
        self.assertEqual(field.parties[1].get().hp, 146)
        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=1),
            FieldAction(FieldActionType.MOVE, move_idx=0)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : 混乱させる、自傷せずA+2
        self.assertEqual(field.parties[0].get().hp, 152)
        # BULBASAUR -> CHARMANDER: 0
        self.assertEqual(field.parties[1].get().hp, 146)
        self.assertEqual(field.parties[0].get().v_confuse, True)

        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=0)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : 混乱させる、効果なし、自傷ダメージ37
        self.assertEqual(field.parties[0].get().hp, 152 - 37)
        # BULBASAUR -> CHARMANDER: 0
        self.assertEqual(field.parties[1].get().hp, 146)

        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=1)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : B-1、自傷ダメージ55
        self.assertEqual(field.parties[0].get().hp, 152 - 37 - 55)
        # BULBASAUR -> CHARMANDER: 0
        self.assertEqual(field.parties[1].get().hp, 146)
        self.assertEqual(field.parties[0].get().v_confuse, True)

        field.actions_begin = [
            FieldAction(FieldActionType.MOVE, move_idx=0),
            FieldAction(FieldActionType.MOVE, move_idx=1)
        ]
        self.assertEqual(field.step(), FieldPhase.BEGIN)

        # CHARMANDER -> BULBASAUR : 0
        self.assertEqual(field.parties[0].get().hp, 152 - 37 - 55)
        # BULBASAUR -> CHARMANDER: 混乱解消、ダメージ34
        self.assertEqual(field.parties[1].get().hp, 146 - 34)
        self.assertEqual(field.parties[0].get().v_confuse, False)