예제 #1
0
파일: moves.py 프로젝트: zakaviji/Pokedex5E
    def setup(self, csv_row):
        self.name = csv_row[self.header.index("Name")]
        self.output_data["Type"] = util.ensure_string(
            csv_row[self.header.index("Type")])
        self.output_data["Move Power"] = util.ensure_list(
            csv_row[self.header.index("Move Power")], "/")
        self.output_data["Move Time"] = util.ensure_string(
            csv_row[self.header.index("Move Time")])

        pp = csv_row[self.header.index("PP")]
        if pp == "Unlimited":
            self.output_data["PP"] = pp
        else:
            self.output_data["PP"] = util.ensure_int(pp)
        self.output_data["Duration"] = util.ensure_string(
            csv_row[self.header.index("Duration")])
        self.output_data["Range"] = util.ensure_string(
            csv_row[self.header.index("Range")])
        self.output_data["Description"] = util.ensure_string(
            csv_row[self.header.index("Description")])
        self.setup_extra(csv_row)
        self.setup_damage(csv_row)
        if self.name in util.MERGE_MOVE_DATA:
            util.merge(self.output_data, util.MERGE_MOVE_DATA[self.name])

        util.clean_object(self.output_data["Move Power"])
        if not self.output_data["Move Power"]:
            del self.output_data["Move Power"]

        remove_dice_in_description.remove_dice(self.output_data)
예제 #2
0
    def setup_moves(self, csv_row):
        self.output_data["Moves"] = {}
        self.output_data["Moves"]["Level"] = {}
        self.output_data["Moves"]["Starting Moves"] = []
        self.output_data["Moves"]["TM"] = []
        move_text = csv_row[self.header.index("Moves")]
        starting_moves = self.RE_STARTING_MOVES.match(move_text)
        if starting_moves:
            self.output_data["Moves"]["Starting Moves"] = util.ensure_list(
                starting_moves.group(1))

        lvl_moves = self.RE_LEVEL_MOVES.findall(move_text)
        if lvl_moves:
            for level, moves in lvl_moves:
                self.output_data["Moves"]["Level"][level] = [
                    x.replace(",", "") for x in moves.split(", ")
                    if x.replace(",", "")
                ]
        tm_moves = self.RE_TM_MOVES.search(move_text)
        if tm_moves:
            if "EVERY TM" in move_text:
                self.output_data["Moves"]["TM"] = [
                    int(x) for x in range(1, 101)
                ]
            else:
                self.output_data["Moves"]["TM"] = [
                    int(x) for x in re.findall(r"[0-9]+", tm_moves.group(1))
                ]
예제 #3
0
    def add(self, csv_row):
        species = fix_species_name(csv_row[self.header.index(POKEMON)])
        if species not in self.output_data:
            self.output_data[species] = {}
        self.output_data[species]["index"] = util.ensure_int(
            csv_row[self.header.index("Index Number")])

        self.output_data[species]["Type"] = util.ensure_list(
            csv_row[self.header.index("Type")], "/")
        self.output_data[species]["SR"] = util.ensure_float(
            csv_row[self.header.index("SR")])
        self.output_data[species]["MIN LVL FD"] = util.ensure_int(
            csv_row[self.header.index("MIN LVL FD")])

        if species in util.MERGE_FILTER_DATA:
            util.merge(self.output_data[species],
                       util.MERGE_FILTER_DATA[species])
예제 #4
0
 def setup_senses(self, csv_row):
     self.output_data["Senses"] = util.ensure_list(
         csv_row[self.header.index("Senses")])
예제 #5
0
 def setup_skill(self, csv_row):
     self.output_data["Skill"] = util.ensure_list(
         csv_row[self.header.index("Skill")])
예제 #6
0
 def setup_type(self, csv_row):
     self.output_data["Type"] = util.ensure_list(
         csv_row[self.header.index("Type")], "/")