示例#1
0
 def AddSkillCSV(self, csvLine, points=0):
     """
   Attempt to add a skill from the CSV format
   """
     if (self.HasSkill(csvLine[0])):
         return
     self.Skills.append(skill.Skill(csvLine, points))
示例#2
0
    def readSkillList(xmlPath: str):
        """Read a skill tree from an XML file and turn it into a list of Skill objects."""

        xmlRoot = xml.etree.ElementTree.parse(xmlPath).getroot()
        skills = SkillList()
        for xmlNode in xmlRoot.getchildren():
            skills.registerSkill(skill.Skill(xmlNode))
        return skills
示例#3
0
        def ParseSkill(f):
            i = skill.Skill()

            i.name = f.GetLine()

            while not f.EOF():
                t = f.Next().lower()

                if t == 'desc':
                    s = f.GetLine()
                    while s != 'end':
                        i.desc += s
                        s = f.GetLine()

                elif t == 'type':
                    e = f.Next()
                    if e not in skill.types:
                        raise XiException('Unknown skill type '+`e`)
                    i.type = e

                elif t == 'leadsto':
                    s = f.GetLine()
                    while s != 'end':
                       i.leadsto.append(s)
                       s = f.GetLine()

                elif t == 'useby':
                    s = f.Next().lower()
                    while s != 'end':
                       i.useby.append(s)
                       s = f.Next().lower()

                elif t == 'basic':          i.basic = True
                elif t == 'minlevel':       i.minlevel = int(f.Next())
                elif t == 'mp':             i.mp = int(f.Next())
                elif t == 'fieldeffect':
                    try:
                        effectName = f.Next()
                        i.fieldeffect  = fieldeffects.__dict__[effectName]
                    except KeyError:
                        raise XiException('Unable to find field effect %s for skill %s' % (`effectName`, `i.name`))
                    
                elif t == 'battleeffect':
                    try:
                        effectName = f.Next()
                        i.battleeffect = battleeffects.__dict__[effectName]
                    except KeyError:
                        raise XiException('Unable to find battle effect %s for skill %s' % (`effectName`, `i.name`))

                elif t == 'end':
                    break
                else:
                    raise XiException('Unknown skills.dat directive ' + `t`)

            return i
示例#4
0
 def AddSkillTXT(self, newSkill):
     if (self.HasSkill(newSkill, regex=True)):
         return
     tmp = skill.Skill(newSkill, format='text')
     if (hasattr(tmp, 'Name')):
         self.Skills.append(tmp)
     else:
         print "Attemped to add:", newSkill
         print "Current Skills:", self.Skills
         print "Skill failed to generate!"
         print "Press enter to continue"
         raw_input()
示例#5
0
文件: hero.py 项目: CryoSky/pySLG
def initiate_hero_pool(db):
    hero_list = db.list_heros()
    for h in hero_list:

        new_hero = Hero(h['_id'], h['render_id'], h['face_id'], h['name'],
                        h['type'], h['health'], h['strength'], h['agility'],
                        h['intelligence'], h['level'], h['quote'])
        hero_skill_list = db.get_hero_skill_list(h['_id'])
        for s in hero_skill_list:
            hero_skill = skill.Skill(s['_id'], s['name'], s['type'],
                                     s['is_active'], s['passive_type'],
                                     s['effect_range'], s['trigger_function'])
            new_hero.skills.append(hero_skill)
        hero_pool[new_hero.cid] = new_hero
示例#6
0
 def __init__(self,
              entity=None,
              owner=None,
              duration=9999,
              name="Aura",
              area=None,
              status=None):
     super(Aura, self).__init__(entity, owner, duration, name)
     self.area = area
     self.tbt = 10
     self.timer = 0
     status.duration = self.tbt + 2
     self.skill = skill.Skill(owner,
                              skill.apply_status,
                              0, [status],
                              area=area)
示例#7
0
    def PromptLoad(self):
        files = glob.glob("*.json")
        print "\n\nSelect file to load\n"
        for idx, val in enumerate(files):
            print "[%d] %s" % (idx + 1, val)
        print "\nEnter index to load, or blank to cancel"
        try:
            selection = input(">") - 1
        except (NameError, SyntaxError):
            return

        print "\n***WARNING***"
        print "Loading this file will delete all unsaved data!"
        print "Continue? (y/n)"
        if (not raw_input(">") in ['y', 'Y', 'Yes', 'yes', '1']):
            print "Did not get a yes, exit load!"
            print "Press enter to continue"
            raw_input()
            return

        with open(files[selection], 'r') as fp:
            data = json.load(fp)
            self.STp = data['Stats']['STp']
            self.DXp = data['Stats']['DXp']
            self.IQp = data['Stats']['IQp']
            self.HTp = data['Stats']['HTp']
            self.HPp = data['Stats']['HPp']
            self.WILLp = data['Stats']['WILLp']
            self.PERp = data['Stats']['PERp']
            self.FPp = data['Stats']['FPp']

            # Process Skills
            self.Skills = list()
            for i in data['Skills']:
                self.Skills.append(skill.Skill(i, format='json'))

            self.Advantages = data['Advantages']
            self.Disadvantages = data['Disadvantages']
            self.Languages = data['Languages']
            self.Cultures = data['Cultures']
            self.ReactionMods = data['ReactionMods']
            self.Height = data['Height']
            self.Weight = data['Weight']
            self.Age = data['Age']
            self.PointsTotal = data['PointsTotal']
            self.PointsUnspent = data['PointsUnspent']
def AdaptNewObject(obj):
    if isinstance(obj, en.Entity):
        new_obj = en.Entity()
    elif isinstance(obj, it.Item):
        new_obj = it.Item()
    elif isinstance(obj, sk.Skill):
        new_obj = sk.Skill()
    elif isinstance(obj, ef.Effect):
        new_obj = ef.Effect()
    for attribute in vars(new_obj).keys():
        if hasattr(obj, attribute):
            if not isinstance(getattr(obj, attribute), dict):
                setattr(new_obj, attribute, getattr(obj, attribute))
            else:
                for sub_attribute, value in getattr(obj,
                                                    attribute).iteritems():
                    getattr(new_obj, attribute)[sub_attribute] = value
    return new_obj
示例#9
0
 def __init__(self,
              entity=None,
              owner=None,
              duration=9999,
              name="Lifted",
              land_area=None,
              land_status=None):
     super(Lifted, self).__init__(entity, owner, duration, name)
     self.land_area = land_area
     self.land_status = land_status
     self.skill = skill.Skill(owner,
                              skill.apply_status,
                              0, [land_status],
                              area=land_area)
     if entity:
         effect.TempEffect(entity.bg,
                           x=entity.x,
                           y=entity.y,
                           char='^',
                           color=owner.color,
                           duration=duration)
示例#10
0
#!/usr/bin/env python
# -----------------------------------------------------------------------------
# HSS skill implementation
# Copyright (c) 2020 - Patrick Fial
# -----------------------------------------------------------------------------
# main.py
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------

import skill

# ------------------------------------------------------------------------------
# main
# ------------------------------------------------------------------------------

if __name__ == "__main__":
    skill = skill.Skill()
    skill.run()

    # res = skill.handle("message", "", "default", "s710:isHeatingOn", {"room_id": "arbeitszimmer"})
    # print(res)
def MakeSkill():
    new_skill = skill.Skill()
    OutputPrint("Created new skill")
    AddSkillToList(new_skill)
示例#12
0
        def parseSkill(f):
            i = skill.Skill()

            i.name = f.GetLine()

            while not f.EOF():
                t = f.Next().lower()

                if t == 'desc':
                    d = []
                    s = f.GetLine()
                    while s != 'end':
                        d.append(s.strip())
                        s = f.GetLine()

                    i.desc='\n'.join(d)

                elif t == 'type':
                    e = f.Next()
                    if e not in skill.types:
                        raise XiException('Unknown skill type '+`e`)
                    i.type = e

                elif t == 'leadsto':
                    s = f.GetLine()
                    while s != 'end':
                       i.leadsto.append(s)
                       s = f.GetLine()

                elif t == 'useby':
                    s = f.Next().lower()
                    while s != 'end':
                        i.useby.append(s)
                        s = f.Next().lower()

                elif t == 'target':
                    s = f.Next().lower()
                    while s != 'end':
                        i.target.append(s)
                        s = f.Next().lower()

                elif t == 'basic':          i.basic = True
                elif t == 'minlevel':       i.minlevel = int(f.Next())
                elif t == 'mp':             i.mp = int(f.Next())
                elif t == 'fieldeffect':
                    if fieldEffects:
                        try:
                            effectName = f.Next()
                            i.fieldEffect  = getattr(fieldEffects, effectName)
                        except KeyError:
                            raise XiException('Unable to find field effect %s for skill %s' % (`effectName`, `i.name`))
                    else:
                        i.fieldEffect = f.Next()

                elif t == 'battleeffect':
                    if battleEffects:
                        try:
                            effectName = f.Next()
                            i.battleEffect = getattr(battleEffects, effectName)
                        except KeyError:
                            raise XiException('Unable to find battle effect %s for skill %s' % (`effectName`, `i.name`))
                    else:
                        i.battleEffect = f.Next()

                elif t == 'end':
                    break
                else:
                    raise XiException('Unknown skills.dat directive ' + `t`)

            return i
示例#13
0
    result = {}
    result['self'] = {
        'category': 'bonus',
        'name': 'Insight',
        'time': 9,
        'mult_damage': 0.02
    }
    result['target'] = {
        'category': 'hit',
        'name': 'fire',
        'type': 'magic',
        'damage': damage
    }
    return result


mySkill = skill.Skill(name='fire',
                      cast=0.5,
                      coldown=0,
                      start=myStart,
                      finish=myFinish,
                      mult=0.2)

time = 0
while time < 1:
    print(mySkill.active)
    if not mySkill.active:
        print(mySkill.start(time))
        time += mySkill.cast
    else:
        print(mySkill.finish(1))
示例#14
0
def NewRandomSkill(type = None, elements = []):
    ns = sk.Skill(RandomName())
    return ns
示例#15
0
add(
    Job(name='Beginner',
        main_stat='str',
        sub_stat='str',
        weapon_types=['sword'],
        skills=[]))

add(
    Job(name='Hero',
        main_stat='str',
        sub_stat='dex',
        weapon_types=['sword', 'axe'],
        skills=[
            skill.Skill(id='',
                        name='Weapon Mastery',
                        type=constant.SkillType.att),
            skill.Skill(id='',
                        name='Physical Training',
                        type=constant.SkillType.stat),
            skill.Skill(id='',
                        name='Raging Blow',
                        type=constant.SkillType.attack),
            skill.Skill(id='',
                        name='Combo Attack',
                        type=constant.SkillType.buff),
            skill.Skill(id='',
                        name='Worldreaver',
                        type=constant.SkillType.iframe)
        ]))
示例#16
0
 def __init__(self, stats):
     self.stats = stats
     self.weapon = weapon.Weapon(stats['WEAPON'])
     self.armor = armor.Armor(stats['ARMOR'])
     self.skill = skill.Skill(stats['SKILL'])
     self.isbot = False