def test_basic(self): """ 1対1、通常攻撃で倒れる、先攻勝ち :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.EARTHQUAKE]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.MEGAKICK]) 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 : ダメージ56 self.assertEqual(field.parties[0].get().hp, 152 - 56) # BULBASAUR -> CHARMANDER: ダメージ96 self.assertEqual(field.parties[1].get().hp, 146 - 96) # 2ターン目でCHARMANDERが倒れる field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.GAME_END) self.assertEqual(field.winner, 0)
def test_fissure(self): """ 一撃必殺 素早さが低いと当たらない :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.FISSURE, Move.AGILITY]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.SPLASH]) 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().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: ダメージなし self.assertEqual(field.parties[0].get().hp, 152) # BULBASAUR -> CHARMANDER: ダメージなし self.assertEqual(field.parties[1].get().hp, 146) # 素早さを上げたので当たる 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.GAME_END) # CHARMANDER -> BULBASAUR: ダメージなし self.assertEqual(field.parties[0].get().hp, 152) # BULBASAUR -> CHARMANDER: 一撃必殺 self.assertEqual(field.parties[1].get().hp, 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.EMBER]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.TACKLE, Move.EMBER]) 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=1) ] 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) self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.EMPTY) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=1), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDER -> BULBASAUR : ダメージ17、スリップダメージ152//16=9 self.assertEqual(field.parties[0].get().hp, 152 - 50 - 9 - 17 - 9) # BULBASAUR -> CHARMANDER: ダメージ11(特殊技は攻撃ダウンなし) self.assertEqual(field.parties[1].get().hp, 146 - 9 - 11) # やけどしない self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.BURN) self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.EMPTY)
def test_basic(self): """ さいみんじゅつをかける。 行動不能。 目が覚めたターンも行動不能。 :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.TACKLE, Move.HYPNOSIS]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.TACKLE, Move.HYPNOSIS]) 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=1), FieldAction(FieldActionType.MOVE, move_idx=1)] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDER -> BULBASAUR : 眠らせた 1回眠る、残り1回起きる self.assertEqual(field.parties[0].get().hp, 152) # BULBASAUR -> CHARMANDER: 行動不能1 self.assertEqual(field.parties[1].get().hp, 146) 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=0), FieldAction(FieldActionType.MOVE, move_idx=1)] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDER -> BULBASAUR : もう一度眠らせようとしても効果がなく、眠りターン数は伸びない self.assertEqual(field.parties[0].get().hp, 152) # BULBASAUR -> CHARMANDER: 行動不能2(起きたターン) self.assertEqual(field.parties[1].get().hp, 146) self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.EMPTY) self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.EMPTY) 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) self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.EMPTY) self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.EMPTY)
def test_basic(self): """ じこさいせい :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.RECOVER]) # H:267,A:162,B:117,C:117,S:82 # カビゴン poke_def = PokeStatic.create(Dexno.SNORLAX, [Move.MEGAKICK, Move.SPLASH]) 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, 267) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # SNORLAX -> BULBASAUR: 回復なし、ダメージ129 self.assertEqual(field.parties[0].get().hp, 152 - 129) # BULBASAUR -> SNORLAX: ダメージなし self.assertEqual(field.parties[1].get().hp, 267) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=1) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # SNORLAX -> BULBASAUR: 回復152//2=76 self.assertEqual(field.parties[0].get().hp, 152 - 129 + 76) # BULBASAUR -> SNORLAX: ダメージなし self.assertEqual(field.parties[1].get().hp, 267) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=1) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # SNORLAX -> BULBASAUR: 回復152//2=76, HP上限でクリップ self.assertEqual(field.parties[0].get().hp, 152) # BULBASAUR -> SNORLAX: ダメージなし self.assertEqual(field.parties[1].get().hp, 267)
def test_basic(self): """ 最も基本的なダメージ計算 :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.MEGAKICK]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.DREAMEATER, Move.SPORE]) 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) # 眠っていなければ効果なし self.assertEqual(field.parties[0].get().hp, 152) # BULBASAUR -> CHARMANDER: ダメージ58 self.assertEqual(field.parties[1].get().hp, 146 - 58) 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, 152) self.assertEqual(field.parties[1].get().hp, 146 - 58) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDER -> BULBASAUR: ダメージ80(ばつぐん) self.assertEqual(field.parties[0].get().hp, 152 - 80) # 体力回復80//2=40 self.assertEqual(field.parties[1].get().hp, 146 - 58 + 40)
def test_basic(self): """ はねるがなにもしないことをテスト :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.SPLASH]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.SPLASH]) 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) self.assertEqual(field.parties[0].get().hp, 152) self.assertEqual(field.parties[1].get().hp, 146)
def test_basic(self): """ 最も基本的なダメージ計算 :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.MEGADRAIN]) # 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、回復16//2=8 self.assertEqual(field.parties[0].get().hp, 152 - 17 + 8) # BULBASAUR -> CHARMANDER: ダメージ16 self.assertEqual(field.parties[1].get().hp, 146 - 16)
def test_basic(self): """ 最も基本的なダメージ計算 :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.EXPLOSION]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.SPLASH]) 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.GAME_END) # CHARMANDER -> BULBASAUR : ダメージ0 self.assertEqual(field.parties[0].get().hp, 0) # BULBASAUR -> CHARMANDER: ダメージ162=ひんし self.assertEqual(field.parties[1].get().hp, 0) # 共倒れのとき、攻撃側が負け self.assertEqual(field.winner, 1)
def test_const(self): """ 最も基本的なダメージ計算 :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.SONICBOOM]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.DRAGONRAGE]) 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 : ダメージ40 self.assertEqual(field.parties[0].get().hp, 152 - 40) # BULBASAUR -> CHARMANDER: ダメージ20 self.assertEqual(field.parties[1].get().hp, 146 - 20)
def match_random_policy(parties: Tuple[Party, Party]) -> int: field = Field([copy.deepcopy(parties[0]), copy.deepcopy(parties[1])]) field.rng = GameRNGRandom() field.rng.set_field(field) field.put_record = lambda record: None winner = -1 next_phase = FieldPhase.BEGIN while True: actions = [] for p in range(2): legals = field.get_legal_actions(p) if len(legals) == 0: actions.append(None) else: actions.append(random.choice(legals)) if next_phase is FieldPhase.BEGIN: field.actions_begin = actions elif next_phase is FieldPhase.FAINT_CHANGE: field.actions_faint_change = actions next_phase = field.step() if next_phase is FieldPhase.GAME_END: winner = field.winner break if field.turn_number >= 64: break return winner
def test_type_match(self): """ タイプ相性が絡む場合 :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.VINEWHIP]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.VINEWHIP]) 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 : ダメージ3 特殊技 不一致1/4 self.assertEqual(field.parties[0].get().hp, 152 - 3) # BULBASAUR -> CHARMANDER: ダメージ14 一致1/2 self.assertEqual(field.parties[1].get().hp, 146 - 14)
def test_type_match(self): """ タイプ相性で無効、ばつぐんでもダメージは変わらない :return: """ # H:148 poke_atk = PokeStatic.create(Dexno.DRATINI, [Move.SONICBOOM]) # ミニリュウ # H:137 poke_def = PokeStatic.create(Dexno.GASTLY, [Move.DRAGONRAGE]) # ゴース 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, 148) self.assertEqual(field.parties[1].get().hp, 137) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # GASTLY -> DRATINI : ダメージ40 self.assertEqual(field.parties[0].get().hp, 148 - 40) # DRATINI -> GASTLY: ダメージ0 self.assertEqual(field.parties[1].get().hp, 137 - 0)
def test_basic(self): """ 最も基本的なダメージ計算 :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.QUICKATTACK]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.SLEEPPOWDER]) 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: ダメージ20 self.assertEqual(field.parties[1].get().hp, 146 - 20) self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.SLEEP) self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.EMPTY)
def test_basic(self): """ 反動の存在を確認 :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.HYPERBEAM]) # 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: ダメージ72 self.assertEqual(field.parties[1].get().hp, 146 - 72) 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 * 2) # BULBASAUR -> CHARMANDER: ダメージ0 (反動で動けない) self.assertEqual(field.parties[1].get().hp, 146 - 72 - 0) 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 * 3) # BULBASAUR -> CHARMANDER: ダメージ72 self.assertEqual(field.parties[1].get().hp, 146 - 72 * 2)
def test_basic(self): """ 最も基本的なダメージ計算 :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.BITE, Move.TACKLE]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.BITE, 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 : ダメージ29 self.assertEqual(field.parties[0].get().hp, 152 - 29) # 怯み発生 # 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 : ダメージ17 self.assertEqual(field.parties[0].get().hp, 152 - 29 - 17) # 怯みは解除済み # BULBASAUR -> CHARMANDER: ダメージ30 self.assertEqual(field.parties[1].get().hp, 146 - 30) # 後攻でひるませるが次ターンに影響なし 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 - 29 - 17 - 17) # BULBASAUR -> CHARMANDER: ダメージ18 self.assertEqual(field.parties[1].get().hp, 146 - 30 - 18)
def test_basic(self): """ :return: """ # H:146,A:104,B:95,C:102,S:117 poke_atk = PokeStatic.create(Dexno.CHARMANDER, [Move.TACKLE, Move.BLIZZARD]) # H:157,A:147,B:232,C:137,S:122 poke_def = PokeStatic.create(Dexno.CLOYSTER, [Move.TACKLE, Move.BLIZZARD]) 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, 146) self.assertEqual(field.parties[1].get().hp, 157) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=1), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # CLOYSTER -> CHARMANDER : ダメージ25 self.assertEqual(field.parties[0].get().hp, 146 - 25) # CHARMANDER -> CLOYSTER: ダメージ10 # こおりタイプなのでこおらない self.assertEqual(field.parties[1].get().hp, 157 - 10) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=1) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # CLOYSTER -> CHARMANDER : ダメージ54 # 氷→炎は当時等倍 self.assertEqual(field.parties[0].get().hp, 146 - 25 - 108) # CHARMANDER -> CLOYSTER: こおってうごかない self.assertEqual(field.parties[1].get().hp, 157 - 10) self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.FREEZE) self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.EMPTY)
def test_basic(self): """ あなをほる 1ターン目であなをほる状態になり、次でダメージを与える あなをほる状態では技が当たらない :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.BITE]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.DIG]) field = Field([Party([poke_atk]), Party([poke_def])]) rng = GameRNGFixed() field.rng = rng field.rng.set_field(field) pk_b = field.parties[0].get() pk_c = field.parties[1].get() self.assertEqual(pk_b.hp, 152) self.assertEqual(pk_c.hp, 146) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDERが先に動き、あなをほる状態になる self.assertEqual(pk_b.hp, 152) self.assertEqual(pk_c.hp, 146) self.assertEqual(pk_c.v_dig, True) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDER -> BULBASAUR : ダメージ46 相性相殺 self.assertEqual(pk_b.hp, 152 - 46) # BULBASAUR -> CHARMANDER: ダメージ30 self.assertEqual(pk_c.hp, 146 - 30) self.assertEqual(pk_c.v_dig, False)
def test_basic(self): """ かまいたち 1ターン目は何もせず、次でダメージを与える あなをほると違い、敵の攻撃が当たる :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.BITE]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.RAZORWIND]) field = Field([Party([poke_atk]), Party([poke_def])]) rng = GameRNGFixed() field.rng = rng field.rng.set_field(field) pk_b = field.parties[0].get() pk_c = field.parties[1].get() self.assertEqual(pk_b.hp, 152) self.assertEqual(pk_c.hp, 146) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDERが先に動き、ためる self.assertEqual(pk_b.hp, 152) # BULBASAUR -> CHARMANDER: ダメージ30 self.assertEqual(pk_c.hp, 146 - 30) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDER -> BULBASAUR : ダメージ38 self.assertEqual(pk_b.hp, 152 - 38) # BULBASAUR -> CHARMANDER: ダメージ30 self.assertEqual(pk_c.hp, 146 - 30 * 2)
def test_basic(self): """ 追加効果でどくになる。 スリップダメージを受ける。 どくタイプはやけどしない。 :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.TACKLE, Move.SLUDGE]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.TACKLE, Move.SLUDGE]) 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=1), FieldAction(FieldActionType.MOVE, move_idx=1)] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDER -> BULBASAUR : ダメージ31 self.assertEqual(field.parties[0].get().hp, 152 - 31) # どくにならない # BULBASAUR -> CHARMANDER: ダメージ48、まだスリップダメージなし self.assertEqual(field.parties[1].get().hp, 146 - 48) # どくになる self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.EMPTY) self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.POISON) 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 - 31 - 17) # BULBASAUR -> CHARMANDER: ダメージ18、スリップダメージ146//16=9 self.assertEqual(field.parties[1].get().hp, 146 - 48 - 18 - 9) self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.EMPTY) self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.POISON)
def test_basic(self): """ 相性無視 :return: """ # H:267,A:162,B:117,C:117,S:82 # カビゴン poke_atk = PokeStatic.create(Dexno.SNORLAX, [Move.PSYWAVE, Move.SUPERFANG]) # H:172,A:135,B:109,C:137,S:157 # エレブー poke_def = PokeStatic.create(Dexno.ELECTABUZZ, [Move.NIGHTSHADE]) 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=0), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # ELECTABUZZ -> SNORLAX: ダメージ50 self.assertEqual(field.parties[0].get().hp, 267 - 50) # SNORLAX -> ELECTABUZZ: ダメージ50*1.5-1=74 self.assertEqual(field.parties[1].get().hp, 172 - 74) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=1), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # ELECTABUZZ -> SNORLAX: ダメージ50 self.assertEqual(field.parties[0].get().hp, 267 - 50 * 2) # SNORLAX -> ELECTABUZZ: ダメージ98//2=49 self.assertEqual(field.parties[1].get().hp, 172 - 74 - 49)
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)
def test_basic(self): """ 2ターン攻撃、その直後混乱 :return: """ # H:152,A:101,B:101,C:117,S:97 pokest_0_0 = PokeStatic.create(Dexno.BULBASAUR, [Move.THRASH]) # 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.TACKLE, Move.CONFUSERAY, Move.EARTHQUAKE]) # ゴース pokest_1_1 = PokeStatic.create(Dexno.GASTLY, [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 : ダメージ17 self.assertEqual(field.parties[0].get().hp, 152 - 17) # BULBASAUR -> CHARMANDER: ダメージ44 self.assertEqual(field.parties[1].get().hp, 146 - 44) self.assertEqual(field.parties[0].get().v_confuse, False) 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 * 2) # BULBASAUR -> CHARMANDER: ダメージ44 self.assertEqual(field.parties[1].get().hp, 146 - 44 * 2) self.assertEqual(field.parties[0].get().v_confuse, True) # こんらんする
def test_basic(self): """ :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.LEECHSEED]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.TACKLE, Move.LEECHSEED]) 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: ダメージなし self.assertEqual(field.parties[1].get().hp, 146) # 後攻でやどりぎしているのでまだこのターンダメージなし self.assertFalse(field.parties[0].get().v_leechseed) self.assertTrue(field.parties[1].get().v_leechseed) field.actions_begin = [FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=1)] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDER -> BULBASAUR : ダメージ0、やどりぎ回復146//16=9 self.assertEqual(field.parties[0].get().hp, 152 - 17 + 9) # BULBASAUR -> CHARMANDER: ダメージなし self.assertEqual(field.parties[1].get().hp, 146 - 9) # 草タイプにはきかない self.assertFalse(field.parties[0].get().v_leechseed) self.assertTrue(field.parties[1].get().v_leechseed)
def test_change_cancel(self): """ 最終でないターンで外れたら混乱せず終了 :return: """ # H:152,A:101,B:101,C:117,S:97 pokest_0_0 = PokeStatic.create(Dexno.BULBASAUR, [Move.THRASH, Move.WATERGUN]) # 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.TACKLE, Move.CONFUSERAY, Move.EARTHQUAKE]) # H:137,A:87,B:82,C:152,S:132 # GASTLY ゴース pokest_1_1 = PokeStatic.create(Dexno.GASTLY, [Move.SPLASH]) 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.CHANGE, change_idx=1)] self.assertEqual(field.step(), FieldPhase.BEGIN) self.assertEqual(field.parties[0].get().hp, 152) self.assertEqual(field.parties[1].get().hp, 137) self.assertEqual(field.parties[0].get().v_confuse, False) field.actions_begin = [FieldAction(FieldActionType.MOVE, move_idx=1), FieldAction(FieldActionType.MOVE, move_idx=0)] self.assertEqual(field.step(), FieldPhase.BEGIN) # 混乱せず攻撃できる # GASTLY -> BULBASAUR : ダメージ0 self.assertEqual(field.parties[0].get().hp, 152) # BULBASAUR -> GASTLY: ダメージ15 self.assertEqual(field.parties[1].get().hp, 137 - 15)
def test_faint_change(self): """ 瀕死状態での交代 :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:185,A:136,B:130,C:137,S:152 pokest_1_0 = PokeStatic.create(Dexno.CHARIZARD, [Move.FIREBLAST, 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, 185) field.actions_begin = [FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=0)] self.assertEqual(field.step(), FieldPhase.FAINT_CHANGE) # CHARIZARD -> BULBASAUR : ダメージ188 self.assertEqual(field.parties[0].get().hp, 0) # BULBASAUR -> CHARMANDER: 攻撃機会なし self.assertEqual(field.parties[1].get().hp, 185) field.actions_faint_change = [FieldAction(FieldActionType.FAINT_CHANGE, faint_change_idx=1), None] self.assertEqual(field.step(), FieldPhase.BEGIN) self.assertEqual(field.parties[0].get().hp, 162) self.assertEqual(field.parties[1].get().hp, 185)
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)
def test_basic(self): """ 最も基本的なダメージ計算 :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.REFLECT, Move.LIGHTSCREEN]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.TACKLE, Move.SURF]) 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: ダメージ0 self.assertEqual(field.parties[1].get().hp, 146 - 0) self.assertEqual(field.parties[0].get().v_reflect, True) self.assertEqual(field.parties[0].get().v_lightscreen, False) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=0), FieldAction(FieldActionType.MOVE, move_idx=0) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDER -> BULBASAUR : ダメージ10 self.assertEqual(field.parties[0].get().hp, 152 - 17 - 10) # BULBASAUR -> CHARMANDER: ダメージ0 self.assertEqual(field.parties[1].get().hp, 146 - 0) self.assertEqual(field.parties[0].get().v_reflect, True) self.assertEqual(field.parties[0].get().v_lightscreen, False) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=1), FieldAction(FieldActionType.MOVE, move_idx=1) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDER -> BULBASAUR : ダメージ19(特殊技は効果なし) self.assertEqual(field.parties[0].get().hp, 152 - 17 - 10 - 19) # BULBASAUR -> CHARMANDER: ダメージ0 self.assertEqual(field.parties[1].get().hp, 146 - 0) self.assertEqual(field.parties[0].get().v_reflect, True) self.assertEqual(field.parties[0].get().v_lightscreen, True) field.actions_begin = [ FieldAction(FieldActionType.MOVE, move_idx=1), FieldAction(FieldActionType.MOVE, move_idx=1) ] self.assertEqual(field.step(), FieldPhase.BEGIN) # CHARMANDER -> BULBASAUR : ダメージ10 self.assertEqual(field.parties[0].get().hp, 152 - 17 - 10 - 19 - 10) # BULBASAUR -> CHARMANDER: ダメージ0 self.assertEqual(field.parties[1].get().hp, 146 - 0) self.assertEqual(field.parties[0].get().v_reflect, True) self.assertEqual(field.parties[0].get().v_lightscreen, True)
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_poisongas(self): """ どくガスをかける。 ターンを経てもダメージは変動せず。 毒タイプは効果なし。 :return: """ # H:152,A:101,B:101,C:117,S:97 poke_atk = PokeStatic.create(Dexno.BULBASAUR, [Move.POISONGAS]) # H:146,A:104,B:95,C:102,S:117 poke_def = PokeStatic.create(Dexno.CHARMANDER, [Move.POISONGAS]) 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.EMPTY) self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.POISON) 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: スリップダメージ1/16 self.assertEqual(field.parties[1].get().hp, 146 - 9) self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.EMPTY) self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.POISON) 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: スリップダメージ1/16 self.assertEqual(field.parties[1].get().hp, 146 - 9 - 9) self.assertEqual(field.parties[0].get().nv_condition, PokeNVCondition.EMPTY) self.assertEqual(field.parties[1].get().nv_condition, PokeNVCondition.POISON)