def get_dmg(self, other, move, atk_stage=0, dfn_stage=0, spc_a_stage=0, spc_d_stage=0, crit=None, roll=None, atk_boosts=0, dfn_boosts=0, spc_a_boosts=0, spc_d_boosts=0): move = dat.get_move(move) special = move.is_special() stats = self._stats() atk_o = stats[-1] if special else stats[1] effect = move.effectiveness(other) stab = move.stab(self) if special: atk_boosts = spc_a_boosts dfn_boosts = spc_d_boosts atk_stage = spc_a_stage dfn_stage = spc_d_stage power = move.get_power() if other.DV is None: # XXX could use some clean up tuples = [] crits = [] hp = [] for i in reversed(range(16)): other.DV = np.array([i] * 5) other_stats = other._stats() dfn_o = other_stats[-1] if special else other_stats[2] hp.append(other_stats[0]) tt = calc.damage_tuple(level=self.lvl, power=power, atk_o=atk_o, dfn_o=dfn_o, atk_stage=atk_stage, dfn_stage=dfn_stage, stab=stab, effect=effect, crit=crit, roll=roll, atk_boosts=atk_boosts, dfn_boosts=dfn_boosts) if crit is None: tuples.append(tt[0]) crits.append(tt[1]) else: tuples.append(tt) other.DV = None mean_hp = round(np.mean(hp), 2) mean_tuple = rounder(np.mean(tuples, axis=0)) if crits: mean_crit = rounder(np.mean(crits, axis=0)) return (str(zipper(tuples[0], tuples[-1], mean_tuple)) + " " + str(zipper(crits[0], crits[-1], mean_crit)) + " " + str((hp[-1], hp[0], mean_hp))) return (str(zipper(tuples[0], tuples[-1], mean_tuple)) + " " + str((hp[-1], hp[0], mean_hp))) other_stats = other._stats() dfn_o = other_stats[-1] if special else other_stats[2] dmg = calc.damage_tuple(level=self.lvl, power=power, atk_o=atk_o, dfn_o=dfn_o, atk_stage=atk_stage, dfn_stage=dfn_stage, stab=stab, effect=effect, crit=crit, roll=roll, atk_boosts=atk_boosts, dfn_boosts=dfn_boosts) if crit is None: return str(dmg[0]) + " " + str(dmg[1]) + " " + str(other_stats[0]) return str(dmg) + " " + str(other_stats[0])
def crit_chance(self, move_name): # XXX ugly return '(' + dat.get_move(move_name).crit_chance(self.poke.species.base_stats[3]) + ' crit)'