pankration.py 4.96 KB
import random
import time

FIND_PERCENTAGE = 80


class HuntResponse:
    ERROR = -1
    FAILURE = 0
    SUCCESS = 1

    def __init__(self, result, message, monster):
        self.result = result
        self.message = message
        self.monster = monster


class Jobs:
    WAR = 1
    MNK = 2
    BLM = 3
    WHM = 4
    THF = 5
    RDM = 6
    PLD = 7
    DRK = 8
    BST = 9
    BRD = 10
    RNG = 11
    SAM = 12
    NIN = 13
    DRG = 14
    SMN = 15
    BLU = 16
    COR = 17
    PUP = 18
    DNC = 19
    SCH = 20
    GEO = 21
    RUN = 22

PhysicalDamageTypes = {
    'blunt': ['Hand-to-Hand', 'Club', 'Staff', 'Harlequin Frame', 'Stormwaker Frame', 'Sharpshot Frame'],
    'slashing': ['Axe', 'Great Axe', 'Great Sword', 'Sword', 'Scythe', 'Katana', 'Great Katana', 'Valoredge Frame'],
    'piercing': ['Dagger', 'Polearm', 'Archery', 'Marksmanship', 'Shuriken', 'Boomerang']
}

FeralSkills = {
    'Airy Shield': {'type': 'Enhancing', 'sub_type': 'arrow shield', 'shadows': 'ignore', 'range': None, 'aoe': False, 'spell': 'arrow shield'},
    'Binding Wave': {'type': 'Enfeebling', 'shadows': 'ignore', 'range': 15, 'aoe': True, 'spell': 'bind'},
    'Dire Straight': {'type': 'Physical', 'shadows': 'wipe', 'range': None, 'aoe': False},
    'Dismemberment': {'type': 'Piercing', 'shadows': 'absorb', 'range': None, 'aoe': False}, # causes the monster to lose a body part
    'Earthshatter': {'type': 'Piercing', 'shadows': 'wipe', 'range': None, 'aoe': True},
    'Eyes On Me': {'type': 'Magical', 'sub_type': 'Dark', 'mp_cost': 112, 'shadows': 'absorb', 'range': 13, 'aoe': False},
    'Hypnosis': {'type': 'Enfeebling', 'sub_type': 'sleep', 'shadows': 'ignore', 'range': 'gaze', 'aoe': True},
    'Magic Barrier': {'type': 'Magical', 'sub_type': 'Dark', 'mp_cost': 29, 'shadows': 'absorb', 'range': None, 'aoe': True},
    'Sinker Drill': {'type': 'Physical', 'sub_type': 'Piercing', 'shadows': 'absorb', 'range': None, 'aoe': False},
}
Families = {
    'acrolith': {
        'base_fp': 50,
        'fp_per_level': 0.1,
        'max_fp': 55,
        'main_job': Jobs.WAR,
        'support_job': None,
        'innate_feral_skills': ['Sinker Drill', 'Dire Straight', 'Dismemberment', 'Earthshatter'],
        'type': 'Arcana',
        'strong_vs': ['Dark'],
        'charmable': False,
        'aspir': False,
        'drain': False
    },
    'ahriman': {
        'base_fp': 65,
        'fp_per_level': 0.3,
        'max_fp': 80,
        'main_job': Jobs.WAR,
        'support_job': Jobs.BLM,
        'innate_feral_skills': ['Binding Wave', 'Magic Barrier', 'Hypnosis', 'Eyes On Me', 'Airy Shield'],
        'type': 'Demon',
        'traits': ['magic defence bonus +25%'],
        'charmable': False,
        'aspir': True,
        'drain': True
    }
}

Monsters = {
    'Mechanical Menace': {
        'family': 'acrolith',
        'zone': 'Abyssea - Uleguerand'
    },
    'Floating Eye': {
        'family': 'ahriman',
        'zone': 'Ranguemont Pass'
    }
}


class Pankration:
    def __init__(self):
        pass

    def start_battle(self, monster1, monster2, battle_type):
        pass

    def list_zones(self):
        zone_list = []
        for monster in Monsters.itervalues():
            if monster['zone'] not in zone_list:
                zone_list.append(monster['zone'])
        return zone_list

    def get_monsters(self, zone):
        monster_list = []
        for monster_name, monster in Monsters.iteritems():
            if monster['zone'] == zone:
                monster_list.append(monster_name)
        return monster_list

    def hunt_monster(self, zone):
        if random.randint(1, 100) > FIND_PERCENTAGE:
            return HuntResponse(HuntResponse.SUCCESS, "You captured the monster!",
                                random.choice(self.get_monsters(zone)))
        else:
            return HuntResponse(HuntResponse.FAILURE, "You were unable to capture a monster's soul.",
                                None)

    def get_action():
        return ""

class Monster:
    def __init__(self, monster_data):
        self.Family
        self.level
        self.main_job
        self.support_job
        self.FP_capacity
        self.innate_feral_skills = []
        self.equipped_feral_skills
        self.discipline_level
        self.temperament
        pass

    def calculate_fp_gain(self):
        pass

    def set_strategy(self, strategy_type):
        if strategy_type not in self.monster_data['strategies']:
            return False
        else:
            self.strategy = strategy_type

class Battle:
    pass

class Arena:
    pass

#print Families

p = Pankration()
print("Zones: \n\n{}".format('\n'.join(p.list_zones())))
hunt_zone = p.list_zones()[0]
print("Hunting for monster in zone: {}\n".format(hunt_zone))
hunt_response = p.hunt_monster(hunt_zone)
print("hunt_response")
print(str(hunt_response.result))
time.sleep(0.5)
if hunt_response.result == HuntResponse.SUCCESS:
    print('Success! {} - {}'.format(hunt_response.message, hunt_response.monster))
else:
    print(hunt_response.message)