Esempio n. 1
0
def dual_wield_damage(lvl, start_mod, weapon_bonus, enemy, power_atk):

    num_asis = get_num_asis(lvl)
    final_mod, num_asis = max_mod(start_mod, num_asis)
    action_attacks = get_num_attacks(lvl)
    prof = proficiency(lvl)

    weapon_die = "1d6"
    if num_asis >= 1:
        # dual wielder feat (sigh...)
        weapon_die = "1d8"

    damage_mod = final_mod + weapon_bonus
    weapon_dmg = Damage(weapon_die + " + " + str(damage_mod))

    to_hit = final_mod + weapon_bonus + prof
    hit_bonus = Constant(to_hit)

    attack = Attack(hit_bonus, enemy)
    attack.add_damage(weapon_dmg)

    round_dmg = MultiAttack()

    bonus_attacks = 1
    #bonus_attacks = action_attacks

    for i in range(action_attacks + bonus_attacks):
        round_dmg.add_attack(attack.copy())

    dmg = round_dmg.get_dmg_rv()

    return dmg
Esempio n. 2
0
def archery_damage(lvl, start_mod, weapon_bonus, enemy, power_atk):

    num_asis = get_num_asis(lvl)
    final_mod, num_asis = max_mod(start_mod, num_asis)
    action_attacks = get_num_attacks(lvl)
    prof = proficiency(lvl)

    sharpshooter = False
    if num_asis >= 1:
        sharpshooter = True

    damage_mod = final_mod + weapon_bonus
    weapon_dmg = Damage("1d8 + " + str(damage_mod))
    if sharpshooter and power_atk:
        weapon_dmg = Damage("1d8 + " + str(damage_mod + 10))

    to_hit = final_mod + 2 + weapon_bonus + prof
    hit_bonus = Constant(to_hit)
    if sharpshooter and power_atk:
        hit_bonus = Constant(to_hit - 5)

    attack = Attack(hit_bonus, enemy)
    attack.add_damage(weapon_dmg)

    round_dmg = MultiAttack()

    for i in range(action_attacks):
        round_dmg.add_attack(attack.copy())

    dmg = round_dmg.get_dmg_rv()

    return dmg
Esempio n. 3
0
def longsword_damage(lvl, start_mod, weapon_bonus, enemy, power_atk):

    num_asis = get_num_asis(lvl)
    final_mod, num_asis = max_mod(start_mod, num_asis)
    action_attacks = get_num_attacks(lvl)
    prof = proficiency(lvl)

    if num_asis >= 1:
        # get shield master, assume the shove knocks prone always
        # this isn't the best assumption, but I don't have a way
        # to handle this conditional yet.
        enemy.apply_hit_type(HitType.ADVANTAGE)

    damage_mod = final_mod + weapon_bonus + 2
    weapon_dmg = Damage("1d8 + " + str(damage_mod))

    to_hit = final_mod + weapon_bonus + prof
    hit_bonus = Constant(to_hit)

    attack = Attack(hit_bonus, enemy)
    attack.add_damage(weapon_dmg)

    round_dmg = MultiAttack()

    for i in range(action_attacks):
        round_dmg.add_attack(attack.copy())

    dmg = round_dmg.get_dmg_rv()

    return dmg
Esempio n. 4
0
def callAttack(filepath, attack, **kargs):
    """
    """
    mono = kargs.get('mono', True)
    x, sr = librosa.load(filepath, sr=44100, mono=False)

    if attack == 'transcode':
        dest_format = kargs.get('dest_format', 'mp3')
        y = atk.transcode(filepath, dest_format, mono)
        status = 'transcode' + dest_format
    elif attack == 'noise':
        snr = kargs.get('snr', 10)
        y = atk.noise(x, snr)
        status = 'noise' + str(snr) + 'dB'
    elif attack == 'cropping':
        duration = kargs.get('duration', 5)
        start = kargs.get('start', 0)
        sr = kargs.get('sr', 44100)
        y = atk.cropping(x, duration, start, sr)
        status = 'cropping-' + 'start-' + str(start) + '-duration-' + str(duration)
    elif attack == 'amplitude':
        magnification = kargs.get('magnification', 2)
        y = atk.amplitude(x, magnification)
        status = 'amplitude' + str(magnification)
    else:
        y = x
        status = 'None'
    return y, sr, status
Esempio n. 5
0
    def create_attack_dict():
        attack_dict = {
            (0, 0): A.Attack("Bite", 20, 90, 8),
            (1, 0): A.Attack("Lunge", 40, 60, 14),
            (0, 1): None,
            (1, 1): None
        }

        return attack_dict
Esempio n. 6
0
    def create_attack_dict():
        attack_dict = {
            (0, 0): A.Attack("Stab", 10, 90, 8),
            (1, 0): A.Attack("Slash", 20, 60, 14),
            (0, 1): A.Attack("Leaping Strike", 30, 70, 20),
            (1, 1): A.Attack("Flurry", 40, 80, 30),
            "Text": "Attack"
        }

        return attack_dict
Esempio n. 7
0
def halberd_damage(lvl, start_mod, weapon_bonus, enemy, power_atk):

    num_asis = get_num_asis(lvl)
    final_mod, num_asis = max_mod(start_mod, num_asis)
    action_attacks = get_num_attacks(lvl)
    prof = proficiency(lvl)

    gwm = False
    if num_asis >= 1:
        gwm = True
        num_asis -= 1

    pam = False
    if num_asis >= 1:
        pam = True

    damage_mod = final_mod + weapon_bonus
    weapon_dmg = Damage("1d10r2 + " + str(damage_mod))
    pommel_dmg = Damage("1d4r2 + " + str(damage_mod))
    if gwm and power_atk:
        weapon_dmg = Damage("1d10r2 + " + str(damage_mod + 10))
        pommel_dmg = Damage("1d4r2 + " + str(damage_mod + 10))

    to_hit = final_mod + weapon_bonus + prof
    hit_bonus = Constant(to_hit)
    if gwm and power_atk:
        hit_bonus = Constant(to_hit - 5)

    attack = Attack(hit_bonus, enemy)
    attack.add_damage(weapon_dmg)

    round_dmg = MultiAttack()

    for i in range(action_attacks):
        round_dmg.add_attack(attack.copy())

    # technically, you can wait to use the pam bonus action
    # until you don't crit your normal attacks, otherwise you
    # get a 1d10 bonus action attack from gwm rather than 1d4
    # however, that is much more complicated to simulate
    # and unlikely to change the result much
    if pam:
        pommel_atk = Attack(hit_bonus, enemy)
        pommel_atk.add_damage(pommel_dmg)

        round_dmg.add_attack(pommel_atk)
    elif gwm:
        round_dmg.add_crit_extra_attack(attack.copy())

    dmg = round_dmg.get_dmg_rv()

    return dmg
Esempio n. 8
0
    def __init__(self, name, initiative):
        """
        Creates a Fighter object.

        Calls the superclass init method with name, HP, DEF,
        MAG DEF, and initiative.

        Also adds a variable melee that references an instance of the
        Attack class. For our simple game, this lets us create fixed
        attacks such as Attack(”Slash”, 1, 8, ”physical”).
        """
        super().__init__(name, Fighter._HP, Fighter._DEF, Fighter._MAG_DEF,
                         initiative)
        self._melee = Attack("Slash", 1, 8, "physical")
Esempio n. 9
0
    def __init__(self, name, initiative):
        """
        Creates a Wizard object. This is done in exactly the same way as
        it was done in the Fighter class.

        Calls the superclass init method with name, HP,
        DEF, MAG DEF, and initiative.

        Also adds a variable spell that references an instance of the
        Attack class. For our simple game, this lets us create fixed
        attacks such as Attack(”Fireball”, 3, 6, ”magic”).
        """
        super().__init__(name, Wizard._HP, Wizard._DEF, Wizard._MAG_DEF,
                         initiative)
        self._melee = Attack("Fireball", 3, 6, "magic")
Esempio n. 10
0
def load_data(attacks: []) -> int:
    try:
        with open('/home/tzdybel/PycharmProjects/projekt2/Project2/globalterrorismdb.csv', 'r', encoding="ISO-8859-1") as csvfile:
            print("Loading data...")
            reader = csv.reader(csvfile, delimiter=',')
            for row in reader:
                if row[3] == 'iday':
                    continue

                try:
                    attkres = ar.AttackResult(bool(row[26]), bool(row[27]), int(row[98]), int(row[101]))
                except ValueError:
                    attkres = ar.AttackResult(bool(row[26]), bool(row[27]), 0, 0)

                date = d.Date(int(row[3]), int(row[2]), int(row[1]))
                place = p.Place(row[12], row[8], getTypeFromEnum(int(row[9]), p.Region))
                attkdet = ad.AttackDetails(getTypeFromEnum(int(row[28]), ad.AttackType),
                                           getTypeFromEnum(int(row[34]), ad.TargetType),
                                           getTypeFromEnum(int(row[81]), ad.WeaponType),
                                           row[64])

                attack = att.Attack(date, place, attkdet, attkres)
                attacks.append(attack)
    except FileNotFoundError:
        print("File name is invalid")
        # exit(1)

    print("Loaded " + len(attacks).__str__() + " records!")
    return len(attacks)
Esempio n. 11
0
def attack_subset(n0, n1, ORwith, ORwo, err=.001):
    n = n0 + n1
    poss = at.attack_no_covar(n0, n1, ORwo, err)
    ret = []
    for gen in poss:
        y = [1 for i in range(0, n + 1)]
        for i in range(0, n0):
            y[i] = 0
            lr = LR(C=1e9)
            i0 = gen[0]
            i1 = gen[1]
            i2 = gen[2]
            j0 = gen[3]
            j1 = gen[4]
            j2 = gen[5]
            x = [0 for i in range(0, n + 1)]

            x[:i0] = [2 for i in range(0, i0)]
            cur = i0
            x[cur:cur + i1] = [1 for i in range(0, i1)]
            cur = cur + i1
            cur = cur + i2
            x[cur:cur + j0] = [2 for i in range(0, j0)]
            cur = cur + j0
            x[cur:cur + j1] = [1 for i in range(0, j1)]
            for i in range(0, 3):
                x[-1] = i
                lr.fit(np.asarray([x]).T, y)
                OR_cur = math.exp(float(lr.coef_))
                if abs(OR_cur - ORwith) < err:
                    ret.append(i)
                    print "match!\n"
    print len(ret)
    print len(poss)
    print ret
Esempio n. 12
0
def main():
    intro()

    print ""
    print ADDED + "Enter target ros ip address"

    while True:
        inputIP = raw_input('ros > ')

        if (is_ipv4(inputIP)):
            break
        else:
            print ERROR + "Invalid ip address.."
            print ERROR + "Try again..."

    attack = Attack.Attack()
    attack.PortScanning(inputIP)
    print ADDED + "Port scanning complete"

    while True:
        menu()
        cmd = raw_input('menu > ')
        if cmd == '1':
            attack.FingerPrinting()
        elif cmd == '2':
            attack.shutdown()
        elif cmd == '3':
            attack.XxeDosAttack()
        elif cmd == '4':
            attack.findPack()
        else:
            print ERROR + "menu select number error"
Esempio n. 13
0
 def handleFinalKeyInput(self, move):
     print("Move: " + move)
     self.combos.append(move)
     print("Combos: ")
     print(self.combos)
     print(self.moveset_tree.getNumber())
     if self.moveset_tree.getNumber() == 6:
         print("Attack ready to be executed!")
         print(self.combos)
         hand = self.combos[1]
         magnitude = self.combos[2]
         region = self.combos[3]
         if region == "Target: head" or region == "Target: torso":
             specRegion = None
             isSpecAttack = False
             move = self.combos[4]
         else:
             specRegion = self.combos[4]
             isSpecAttack = False
             move = self.combos[5]
         statEffectBonus = False
         attack = Attack(self.player, self.enemy, hand, magnitude, region, specRegion, isSpecAttack, move)
         #self.logAttack(attack)
         #self.attackVisuals()
         self.newMethod(attack)
         damage = attack.calculateDamage()
         #self.logDamage(damage, attack.player.name, attack.enemy.name)
         self.logAttack(attack, damage)
         self.game.callUpdateStatusBar(-1 * damage, 2)
         self.moveset_tree.resetCurrentTree()
         self.eraseCurrentTree()
         self.displayCurrentMoves()
         self.displayCurrentKeyCombos()
         self.combos = []
     elif self.moveset_tree.getNumber() == 4:
         print("Blocked!")
         if self.pendingAttack != None:
             isValidBlock = False
             if self.pendingAttack.region == "Target: head" or self.pendingAttack.region == "Target: torso":
                 if self.combos[3] == "High block":
                     isValidBlock = True
             elif self.pendingAttack.region == "Target: arms" or self.pendingAttack.region == "Target: legs":
                 if self.combos[3] == "Low block":
                     isValidBlock = True
             if isValidBlock == True:
                 self.blockAttack()
             self.moveset_tree.resetCurrentTree()
Esempio n. 14
0
def execute(server, iterator, source):
    charid = iterator.getString()

    party = server.parties[server.sessions[source]['party']]

    attackables = Attack.GetAttackables(party, charid)

    server.send.ATTACKABLES_LIST(charid, attackables, source)
Esempio n. 15
0
 def __init__(self, type, health, name, level=1):
     self.type = Type(type)
     self.moveList = [Attack("Tackle", "NORMAL", 100, 5)] # default move is tackle
     self.currentHealth = health
     self.maxHealth = health
     self.isDead = False
     self.name = name
     self.level = level
Esempio n. 16
0
    def attack(self, mainCharX, mainCharY, mainCharZ):
        char = [mainCharX, mainCharY, mainCharZ]
        enemy = [self.posX, self.posY, self.posZ]

        self.att = Attack("ENEMY", "POTATOES", self, char)
        self.attacking = True

    #end attack


#end class CMain
Esempio n. 17
0
def greatsword_damage(lvl, start_mod, weapon_bonus, enemy, power_atk):

    num_asis = get_num_asis(lvl)
    final_mod, num_asis = max_mod(start_mod, num_asis)
    action_attacks = get_num_attacks(lvl)
    prof = proficiency(lvl)

    gwm = False
    if num_asis >= 1:
        gwm = True

    damage_mod = final_mod + weapon_bonus
    weapon_dmg = Damage("2d6r2 + " + str(damage_mod))
    if gwm and power_atk:
        weapon_dmg = Damage("2d6r2 + " + str(damage_mod + 10))

    to_hit = final_mod + weapon_bonus + prof
    hit_bonus = Constant(to_hit)
    if gwm and power_atk:
        hit_bonus = Constant(to_hit - 5)

    attack = Attack(hit_bonus, enemy)
    attack.add_damage(weapon_dmg)

    round_dmg = MultiAttack()

    for i in range(action_attacks):
        round_dmg.add_attack(attack.copy())

    if gwm:
        round_dmg.add_crit_extra_attack(attack.copy())

    dmg = round_dmg.get_dmg_rv()

    return dmg
Esempio n. 18
0
    def taskSpriteAttack(self, task):
        if task.time > 1:
            # Making disappear the sprite information attack
            self.hideBlackboard()

            if self.attacking == True:
                # If we draw correctly and we have the correct power item
                self.att = Attack(self.type, "-", self.level.enemies,
                                  self.char)
                self.attacking = False
                self.char.attacking = True

            self.busy = False

            # Making move the enemies again
            for x in self.level.enemies:
                x.stopEnemy(False)

            # Making move the character again
            taskMgr.add(self.taskMove, 'taskMove')
            return task.done
        else:
            return task.cont
Esempio n. 19
0
def fireAttack(button, x, y, shipList):
    global turnLabel
    global attackLabel
    if (Attack.checkHit(shipList, x, y) == True):
        changeColour(button, "red")
        attackLabel["text"] = "Attack Again!"
    else:
        changeColour(button, "grey")
        if shipList == Main.shipList1:
            turnLabel["text"] = "Player 2's turn"
            attackLabel["text"] = ""
        else:
            turnLabel["text"] = "Player 1's turn"
            attackLabel["text"] = ""
Esempio n. 20
0
    def __init__(self, logDir, k_threshold):
        self.gridSize = option.getGridSize()
        self.maxNumLoops = option.getMaxNumLoops()
        self.skipFollow = option.getSkipFollow()
        self.maxNumId = option.getMaxNumId()

        self.k_threshold = k_threshold
        self.grid = Grid(logDir, self.gridSize)
        self.logDir = logDir

        self.attack = Attack.Attack(logDir=self.logDir, gridSize=self.gridSize)

        self.followEachUser()
        self.dumpResult(logDir + "/kanonymity")
        return
Esempio n. 21
0
class Wizard(Adventurer):
    """
    Wizards have 20 HP, defense of 4, and magic defense of 10, all
    stored as class variables using the same naming conventions as Fighter.
    """
    _HP = 20
    _DEF = 4
    _MAG_DEF = 10

    def __init__(self, name, initiative):
        """
        Creates a Wizard object. This is done in exactly the same way as
        it was done in the Fighter class.

        Calls the superclass init method with name, HP,
        DEF, MAG DEF, and initiative.

        Also adds a variable spell that references an instance of the
        Attack class. For our simple game, this lets us create fixed
        attacks such as Attack(”Fireball”, 3, 6, ”magic”).
        """
        super().__init__(name, Wizard._HP, Wizard._DEF, Wizard._MAG_DEF,
                         initiative)
        self._melee = Attack("Fireball", 3, 6, "magic")

    def cast(self):
        """
        Calculates and returns information about a spell from this object.

        Returns a tuple, consisting of a damage value and a damage type. The
        values are obtained by calling get damage() and get attack type() on
        spell.

        Also prints out information about the attack, much like in Fighter’s
        attack method.
        """
        damage = self._melee.get_damage()
        attack_type = self._melee.get_type()

        print(
            str(self.get_name()) + " attacks with " +
            str(self._melee.get_name()) + " for " + str(damage) + " " +
            str(attack_type) + " damage.")

        return (damage, attack_type)

    def __str__(self):
        """
        Returns a string representation of this object, much like
        in Fighter’s str method.
        """
        s = (str(self.get_name()) + " with " + str(self._HP) +
             " hit points and a " + str(self._melee.get_name()) + " attack (" +
             str(self._melee.get_number()) + "d" +
             str(self._melee.get_sides()) + ")")
        return s
Esempio n. 22
0
    def enemy_turn(self):
        available_enemy_attacks = self.enemy.attack_moves

        attack_index = randint(0, len(available_enemy_attacks) - 1)

        attack = available_enemy_attacks[attack_index] #randomly generate an attack to use
        print("Attack choice:")
        print(attack.name)
        is_successful = attack.hitDeterminer()

        if(is_successful): #if the attack doesn't miss
            dmg = attack.getDMG()
            dmg_type = attack.getDMGType()
            elemental = attack.getElemental()
            isCrit = attack.critDeterminer()
            if isCrit == True:
                dmg *= 2
            regions = ["Target: arms", "Target: legs", "Target: head", "Target: torso"]
            sides = ["Left", "Right"]
            body_part_index = randint(0, len(regions) - 1)
            body_part = regions[body_part_index]
            specific_body_part_index = None
            specific_body_part = None
            if body_part_index == 0 or body_part_index == 1:
                specific_body_part_index = randint(0, 1)
                specific_body_part = sides[specific_body_part_index]

            magnitudes = ["Light attack", "Heavy attack", "Charged attack"]
            magnitude_index = randint(0, len(magnitudes) - 1)
            magnitude = magnitudes[magnitude_index]
            #self.player.takeDamage(dmg, dmg_type, body_part, elemental)
            attack = Attack(self.enemy, self.player, "Enemy attack", magnitude, body_part, specific_body_part, False, attack)  
            print("Bruh")

            self.pendingAttack = attack
            self.chooseAnimation("attacking", None, None)
            self.isAttacking = True
            self.isIdling = False
            self.isHurt = False
            
            #damage = attack.calculateDamage()
            #print("Damage taken!")
            #self.game.callUpdateStatusBar(-1 * damage, 1)
        else:
            print("Attack missed!")
            pass
Esempio n. 23
0
    def __init__(self, logDir, emd_thresold):
        self.gridSize = option.getGridSize()
        self.maxNumLoops = option.getMaxNumLoops()
        self.skipFollow = option.getSkipFollow()
        self.maxNumId = option.getMaxNumId()

        self.logDir = logDir
        self.emd_thresold = emd_thresold

        self.attack = Attack.Attack(logDir=self.logDir, gridSize=self.gridSize)

        self.grid = Grid.Grid(logDir, self.gridSize)
        self.numLocTypes = self.grid.getNumLocTypes()

        print "numLocTypes : ", self.numLocTypes
        print "numStayPoints : ", sum(
            [len(x) for x in self.grid.clusteredStayPoints])
        self.followEachUser()

        self.dumpResult(logDir + "/closeness")

        return
Esempio n. 24
0
 def taskSpriteAttack(self, task):
     if task.time>1:            
         # Making disappear the sprite information attack
         self.hideBlackboard()
         
         if self.attacking == True:
             # If we draw correctly and we have the correct power item
             self.att = Attack(self.type,"-",self.level.enemies,self.char)
             self.attacking = False
             self.char.attacking = True
             
         self.busy = False
         
         # Making move the enemies again
         for x in self.level.enemies:
             x.stopEnemy(False)
         
         # Making move the character again
         taskMgr.add(self.taskMove, 'taskMove')
         return task.done
     else:
         return task.cont
Esempio n. 25
0
def execute(server, iterator, source):
    charid1 = iterator.getString()
    charid2 = iterator.getString()
    party = server.parties[server.sessions[source]['party']]
    char1 = party['chars'][charid1]
    char2 = party['chars'][charid2]

    damages = char1['pa'] * char1['br'] / 100 * char1['pa']

    char2['hp'] = char2['hp'] - damages * 4
    if char2['hp'] < 0:
        char2['hp'] = 0

    char1['canact'] = False

    server.send.ATTACK_SUCCESS(charid1, charid2, damages, source)

    attackables = Attack.GetAttackables(party, charid1)

    for playerid, playerlogin in enumerate(party['players']):
        if playerid != server.sessions[source]['player']:
            server.send.ATTACK_PASSIVE(charid1, charid2, damages, attackables,
                                       server.players[playerlogin])
Esempio n. 26
0
def BegAttck():
    TargetIP = TargetIP_var.get()
    FakeIP = FakeIP_var.get()
    Attack.ddos(TargetIP, FakeIP)
Esempio n. 27
0
#!/usr/bin/python3

from Common import *
from Attack import *
from Enemy import *
from Damage import *
from math import sqrt

if __name__ == "__main__":

    damage = Damage("2d6r2 + 3")
    hit_bonus = Constant(5)  # str + prof = 3 + 2

    armor_class = 13
    hit_type = HitType.NORMAL
    resisted = False

    enemy = Enemy(armor_class, hit_type)
    damage.set_resisted(resisted)
    attack = Attack(hit_bonus, enemy)
    attack.add_damage(damage)
    attack.finish_setup()

    attack.describe_attack()
Esempio n. 28
0
 def mainLoop(self):
     while True:
         os.system('cls')
         print("1.Play\n2.Load\n3.Exit")
         ip = input(">>")
         if (ip == '1'):
             player_start = playerStart()
             player_start.char_selection()
             break
         if (ip == '2'):
             flag = sv.loadgame()
             if flag == 0:
                 break
             else:
                 print("Wrong Password\n")
         if (ip == '3'):
             print("Bye!")
             sys.exit()
         else:
             print("Enter Valid Options")
     os.system('cls')
     print("Type !help for list of commands")
     while True:
         cmd = input(">>")
         os.system('cls')
         if (cmd == "!stats"):  #stats
             player.status()
         elif (cmd == "!help"):  #Help
             os.system('cls')
             print(
                 "!explore, !stats, !inv !quit !save !location !equipment !use !uprade !shop"
             )
         elif (cmd == "!quit"):  #Quit
             os.system('cls')
             qans = input("Quit Game : [Y/N] ?")
             if (qans == 'Y' or qans == "y"):
                 sys.exit()
             else:
                 pass
         elif (cmd == "!inv"):  #Inventory
             os.system('cls')
             print("1.List 2.Equip 3.Unequip 4.Back")
             while True:
                 ii = input(f"{term.limegreen}<>{term.normal}")
                 if ii == '1':
                     pinv.inv_list()
                 elif ii == '2':
                     pinv.equip()
                 elif ii == '3':
                     print("1.Weapon 2.Armour 3.Back")
                     pinv.unequip(input("<<>"))
                 elif ii == '4':
                     break
                 else:
                     print("Enter Valid Option!")
         elif (cmd == "!explore"):  #Explore
             os.system('cls')
             os.system("cls")
             atk = Attack()
             atk.attackloop()
             del atk
         elif (cmd == "!save"):  #Save
             os.system('cls')
             sv.savegame(
                 player.name,
                 player.HP,
                 player.MP,
                 player.STR,
                 player.INT,
                 player.DEX,
                 player.DEF,
                 player.LUCK,
                 player.XP,
                 player.GOLD,
                 player.MAX_HP,
                 player.MAX_MP,
                 player.eq_wep,
                 player.eq_arm,
             )
         elif (cmd == "!location"):  #Location
             os.system('cls')
             pass
         elif (cmd == "!debug"):  #Debug
             os.system('cls')
             Debug.debug(self)
         elif (cmd == '!equipment'):  #Equipment
             os.system('cls')
             player.equipments()
             input("Press Enter To go back")
         elif (cmd == '!use'):  #Equipment
             os.system('cls')
             pinv.use_potion()
         elif (cmd == '!upgrade'):  #Equipment
             os.system('cls')
             pass
         elif (cmd == '!shop'):  #Equipment
             os.system('cls')
             shop = Shop()
         else:
             print("Type !help for more info")
Esempio n. 29
0
    def readAttack(self, xml):
        self.varlist = []
        attack = Attack.Attack()
        attack.id = int(xml.get('id'))
        # A state contains 4 direct child nodes:
        # broken, system, variables and semitrace
        # optionally a fifth: dot
        for event in xml.getchildren():
            if event.tag == 'broken':
                attack.broken.append((self.readTerm(event.find('claim')),
                                      self.readTerm(event.find('label'))))
            elif event.tag == 'system':
                attack.match = int(event.find('match').text)
                for term in event.find('commandline'):
                    if term.text != None:
                        if attack.commandline != '':
                            attack.commandline += ' '
                        attack.commandline += term.text
                for term in event.find('untrusted').find('termlist'):
                    attack.untrusted.append(str(self.readTerm(term)))
                for term in event.find('initialknowledge').find('termlist'):
                    attack.initialKnowledge.append(self.readTerm(term))
                for keypair in event.find('inversekeys'):
                    inverse = []
                    for term in keypair:
                        inverse.append(self.readTerm(term))
                    assert (len(inverse) == 0 or len(inverse) == 2)
                    attack.inverseKeys.append(inverse)
                # TODO why is protocol name a term??
                for protocolxml in event.findall('protocol'):
                    protocol = str(self.readTerm(protocolxml.find('name')))
                    descr = Trace.ProtocolDescription(protocol)
                    attack.protocoldescr[protocol] = descr
                    for rolexml in protocolxml.findall('role'):
                        roledescr = self.readRoleDescr(rolexml)
                        descr.roledescr[roledescr.role] = roledescr

            elif event.tag == 'semitrace':
                for runxml in event:
                    run = self.readRun(runxml)
                    run.attack = attack
                    attack.semiTrace.runs.append(run)

            elif event.tag == 'dot':
                # Apparently Scyther already generated dot output,
                # store
                attack.scytherDot = event.text

            elif event.tag == 'variables':
                # Read the variables one by one
                for varxml in event:
                    if varxml.get('typeflaw') == 'true':
                        attack.typeflaws = True
                    var = self.readTerm(varxml.find('name').find('term'))
                    var.types = self.readTypeList(varxml.find('name'))

                    substxml = varxml.find('substitution')
                    # Read substitution if present
                    if substxml != None:
                        subst = self.readTerm(substxml.find('term'))
                        subst.types = self.readTypeList(substxml)
                        newvar = Term.TermVariable(var.name, subst)
                        newvar.types = var.types
                        var = newvar

                    attack.variables.append(var)

                # When all have been read set self.varlist so that when
                # we read terms in the attacks they can be filled in using
                # this list
                self.varlist = attack.variables
            else:
                print >> sys.stderr, "Warning unknown tag in attack: %s" % event.tag
        return attack
Esempio n. 30
0
    hit_type = HitType.SUPER_ADVANTAGE
    crit_lb = 19

    enemy = Enemy(armor_class, hit_type)

    sword_dmg = Damage("1d10r2 + 5 + 6")
    #sword_dmg = Damage("1d8 + 5 + 2")

    deadly_ambush_dmg = Damage("1d10r2 + 1d8 + 5 + 6")
    #deadly_ambush_dmg = Damage("2d8 + 5 + 2")

    eldritch_blast_dmg = Damage("1d10 + 5 + 6")

    cha_hit = Constant(11)  # 5 cha + 6 prof

    sword_atk = Attack(cha_hit, enemy, crit_lb)
    sword_atk.add_damage(sword_dmg)

    deadly_ambush_atk = Attack(cha_hit, enemy, crit_lb)
    deadly_ambush_atk.add_damage(deadly_ambush_dmg)

    eldritch_blast_atk = Attack(cha_hit, enemy, crit_lb)
    eldritch_blast_atk.add_damage(eldritch_blast_dmg)

    sword_atks = 2
    deadly_ambush_atks = 2
    eldritch_blast_atks = 8

    round_dmg = MultiAttack()

    for atk in range(sword_atks):
Esempio n. 31
0
#STATS

pkm1_stats = Stats(45, 60, 40, 70, 50,
                   54)  #HP, Attack, Defense, SpAttack, SpDefense, Speed
pkm2_stats = Stats(40, 45, 30, 65, 55,
                   70)  #HP, Attack, Defense, SpAttack, SpDefense, Speed

#POKEMONS

pkm1 = Pokemon("Treecko", Grass, NONE, pkm2_stats, 5, 65, "Parabolic")
pkm2 = Pokemon("Torchic", Fire, NONE, pkm1_stats, 5, 65, "Parabolic")

#ATTACKS
pkm1.setAttacks([
    Attack("Destructor", Normal, PHYSICAL, 35, 40, 100),
    Attack("Malicioso", Normal, STATE, 30, 0, 100)
])
pkm2.setAttacks([
    Attack("Arañazo", Normal, PHYSICAL, 35, 40, 100),
    Attack("Gruñido", Normal, STATE, 40, 0, 100)
])

jugador.addPokemon(pkm1)

#BATTLE

batalla = Battle(jugador, pkm2, "s")

while not batalla.Huir() and not batalla.is_finished():
    batalla.Comando()
Esempio n. 32
0
class Game(DirectObject):
    def __init__(self, background, cursor, pointer):
        #-----------------------------------------------------------------------------------------------------------------------------------------------
        #---------------------------------------------------VARIABLE DECLARATION------------------------------------------------------------------------
        #-----------------------------------------------------------------------------------------------------------------------------------------------
        # Timers
        self.jumpTiming = 0
        self.jumpTime = 0
        self.lastTimeEnergy = 0
        self.energyTimer = None
        
        # Booleans
        self.jumping = False
        self.drawing = False
        self.attacking = False
        self.busy = False       #true if there are some image on screen making note something
        self.isGameOver = False
        
        # Auxiliar calculations
        self.vecX = 0
        self.vecY = 0
        
        # Graphic components
        #Blackboard
        self.blackboard = OnscreenImage(image="./tex/blackboard.png", pos = (0, 0, 0),hpr=None, scale = (1.25,1.0,0.90), color=None, parent=None, sort=0)
        self.blackboard.setTransparency(TransparencyAttrib.MAlpha)
        self.blackboard.hide()
        self.distXPointDraw = 0.0
        self.distYPointDraw = 0.0
        #Level
        self.level = Level_1(background)
        #Main Character
        self.char = CMain(-18,-5,59)
        #Energy Bar
        self.energyBar = BEnergy()
        self.energyBar.increase(50);
        #Life Bar
        self.lifes = BLifes()
        self.lifes.increase(1)
        self.lifes.increase(1)
        self.lifes.increase(1)
        #Special Items Bar
        self.specialItems = BSpecial()
        #Abilies Bar
        self.grainAbility = BAbility("GRAIN")
        self.fruitAbility = BAbility("FRUIT")
        self.milkAbility = BAbility("MILK")
        self.vegetableAbility = BAbility("VEGETABLE")
        self.fishAbility = BAbility("FISH")
        #Info
        self.infError = OnscreenImage(image="./tex/wrong_attack.png", pos = (0.4, 0, 0),hpr=None, scale=(0.47,1.0,0.55), color=None, parent=None, sort=5)
        self.infError.setTransparency(TransparencyAttrib.MAlpha)
        self.infError.hide()
        self.infCereal = OnscreenImage(image="./tex/cereal_attack.png", pos = (0.4, 0, 0),hpr=None, scale=0.45, color=None, parent=None, sort=5)
        self.infCereal.setTransparency(TransparencyAttrib.MAlpha)
        self.infCereal.hide()
        self.infCerealError = OnscreenImage(image="./tex/cereal_not_attack.png", pos = (0.4, 0, 0),hpr=None, scale=0.45, color=None, parent=None, sort=5)
        self.infCerealError.setTransparency(TransparencyAttrib.MAlpha)
        self.infCerealError.hide()
        self.infFish = OnscreenImage(image="./tex/fish_attack.png", pos = (0.4, 0, 0),hpr=None, scale=0.5, color=None, parent=None, sort=5)
        self.infFish.setTransparency(TransparencyAttrib.MAlpha)
        self.infFish.hide()
        self.infFishError = OnscreenImage(image="./tex/fish_not_attack.png", pos = (0.4, 0, 0),hpr=None, scale=0.5, color=None, parent=None, sort=5)
        self.infFishError.setTransparency(TransparencyAttrib.MAlpha)
        self.infFishError.hide()
        self.infMilk = OnscreenImage(image="./tex/milk_attack.png", pos = (0.4, 0, 0),hpr=None, scale=0.5, color=None, parent=None, sort=5)
        self.infMilk.setTransparency(TransparencyAttrib.MAlpha)
        self.infMilk.hide()
        self.infMilkError = OnscreenImage(image="./tex/milk_not_attack.png", pos = (0.4, 0, 0),hpr=None, scale=0.5, color=None, parent=None, sort=5)
        self.infMilkError.setTransparency(TransparencyAttrib.MAlpha)
        self.infMilkError.hide()
        self.infVege = OnscreenImage(image="./tex/vege_attack.png", pos = (0.4, 0, 0),hpr=None, scale=0.4, color=None, parent=None, sort=5)
        self.infVege.setTransparency(TransparencyAttrib.MAlpha)
        self.infVege.hide()
        self.infVegeError = OnscreenImage(image="./tex/vege_not_attack.png", pos = (0.4, 0, 0),hpr=None, scale=0.4, color=None, parent=None, sort=5)
        self.infVegeError.setTransparency(TransparencyAttrib.MAlpha)
        self.infVegeError.hide()
        self.infFruit = OnscreenImage(image="./tex/fruit_attack.png", pos = (0.4, 0, 0),hpr=None, scale=0.4, color=None, parent=None, sort=5)
        self.infFruit.setTransparency(TransparencyAttrib.MAlpha)
        self.infFruit.hide()
        self.infFruitError = OnscreenImage(image="./tex/fruit_not_attack.png", pos = (0.4, 0, 0),hpr=None, scale=0.4, color=None, parent=None, sort=5)
        self.infFruitError.setTransparency(TransparencyAttrib.MAlpha)
        self.infFruitError.hide()
        #Logo
        self.logo = OnscreenImage(image="./tex/laSalleAlpha.png", pos = (1.05, 0, -0.85),hpr=None, scale=(0.22,1.0,0.075), color=None, parent=None, sort=5)
        self.logo.setTransparency(TransparencyAttrib.MAlpha)
        
        # Sounds
        self.winMusic = base.loadMusic('./sound/win.wav')
        self.winMusic.setVolume(.5)
        self.winMusic.setLoopCount(1)
        self.gameOverMusic = base.loadMusic('./sound/lose.wav')
        self.gameOverMusic.setVolume(.5)
        self.gameOverMusic.setLoopCount(1)
        self.allSpecial = base.loadSfx('./sound/win_mysterious.wav')
        self.allSpecial.setVolume(.7)
        self.allSpecialPlayed = False
                        
        # Others
        self.type = "NONE"
        self.gameover = None
        self.gameActive = True
        
        #-----------------------------------------------------------------------------------------------------------------------------------------------
        #----------------------------------------------------------------GAME INIT----------------------------------------------------------------------
        #-----------------------------------------------------------------------------------------------------------------------------------------------        
        # Glove gestures configuration
        self.cursor = cursor
        self.gestureHandler = GestureRecognition("Gesture_Handler", 
                                                 [("1",0), ("2",0), ("3",0), ("4",0), ("6",0), ("7",0), ("8",0), ("9",0),                               #NONE
                                                  ("12",0), ("13",0), ("16",0), ("18",0), ("17",0), ("14",0),                                           #NONE
                                                  ("23",0), ("26",0), ("29",0), ("27",0), ("24",0), ("21",0),                                           #NONE
                                                  ("36",0), ("39",0), ("38",0), ("34",0), ("31",0), ("32",0),                                           #NONE
                                                  ("41",0), ("42",0), ("43",0), ("49",0), ("48",0), ("47",0),                                           #NONE
                                                  ("69",0), ("68",0), ("67",0), ("61",0), ("62",0), ("63",0),                                           #NONE
                                                  ("74",0), ("71",0), ("72",0), ("76",0), ("79",0), ("78",0),                                           #NONE
                                                  ("87",0), ("84",0), ("81",0), ("83",0), ("86",0), ("89",0),                                           #NONE
                                                  ("98",0), ("97",0), ("94",0), ("92",0), ("93",0), ("96",0),                                           #NONE
                                                  ("93934",1),                                                                                          #FRUIT
                                                  ("7624",2),                                                                                           #MILK
                                                  ("67616",3),                                                                                          #VEGETABLE
                                                  ("183",4),                                                                                            #FISH
                                                  ("3434",5)],                                                                                          #CEREAL
                                                 self.cursor, True, 1, 0, 0)
                                                 
        self.accept("Gesture_Handler", self.gestureProcessing)
        
        # Cursor init
        self.pointer = pointer
        
        # Start tasks
        taskMgr.add(self.taskMove, 'taskMove')
        taskMgr.add(self.taskCollision, 'taskCollision' )
        taskMgr.add(self.taskEnergy, 'taskEnergy' )
        taskMgr.add(self.taskLevels, 'taskLevels')
    
        # Events declaration
        self.accept("WM_BUTTON_PRESSED", self.handleBtnPress)
        self.accept("WM_BUTTON_RELEASED", self.handleBtnRelease)
        
    #end __init__
        
    #-----------------------------------------------------------------------------------------------------------------------------------------------
    #----------------------------------------------------------------FUNCTIONS----------------------------------------------------------------------
    #-----------------------------------------------------------------------------------------------------------------------------------------------
    # Called when we start drawing, set ready the drawing interface  
    def showBlackboard(self):
        if self.char.attacking == False:
            # There isn't another character attack on course        
            if self.busy == False:
                # The screen is empty of sprites information, like abilty attacks
                self.drawing = True
                
                self.blackboard.show()
                self.specialItems.hide()
                self.char.walking = False
                self.energyBar.hide()
                self.lifes.hide()
                
                taskMgr.remove('taskMove')
                
                # Stop the enemies
                for x in self.level.enemies:
                    x.stopEnemy(True)
    #end showBlackboard
    
    # It hides the blackboard and makes appear the disappeared elements
    def hideBlackboard(self):
        self.drawing = False
        self.blackboard.hide()
        self.specialItems.show()
        self.char.walking = True
        self.energyBar.show()
        self.lifes.show()
        self.infError.hide()
        self.infCereal.hide()
        self.infCerealError.hide()
        self.infFish.hide()
        self.infFishError.hide()
        self.infMilk.hide()
        self.infMilkError.hide()
        self.infVege.hide()
        self.infVegeError.hide()
        self.infFruit.hide()
        self.infFruitError.hide()
    #end hideBlackboard
    
    # It stops drawing
    def stopAttack(self):
        if self.char.attacking == False:
            if self.busy == False:
                self.gestureHandler.endGesture()
    #end stopAttack
    
    # WiiMote button pressed handler
    def handleBtnPress(self, btn, dev, index):
        if(index == 1):
            if(btn == wiiuse.BUTTON_A):
                if(self.gameActive == True):
                    if self.drawing == True:        
                        if self.busy == False:  self.gestureHandler.beginGesture()
    #end handleBrnPress
    
    # WiiMote button released handler
    def handleBtnRelease(self, btn, dev, index):
        if(index == 1):
            if(btn == wiiuse.BUTTON_A):
                if(self.gameActive == True):
                    if self.drawing == True:        self.stopAttack()
                    else:                           self.showBlackboard()
    #end handleBtnRelease
    
    # Identify the information drawed on drawing process and if this is well drawed and we have enough ability power prepare's the attack.
    def gestureProcessing(self, id, x, y):
        if(self.gameActive == True):  
            #------------------------------------------------------------------FRUIT---------------------------------------------------------------------
            if id==1:
                if self.char.power[1] < 1:
                    self.infFruitError.show()
                else:
                    self.infFruit.show()
                    self.char.power[1] = self.char.power[1] - 1
                    self.fruitAbility.powerUsed(1);
                    self.attacking = True
                    self.type="FRUIT"
                    
            #------------------------------------------------------------------MILK----------------------------------------------------------------------
            elif id==2:
                if self.char.power[2] < 1:
                    self.infMilkError.show()
                else:
                    self.infMilk.show()
                    self.char.power[2] = self.char.power[2] - 1
                    self.milkAbility.powerUsed(1);
                    self.attacking = True
                    self.type="MILK"
            
            #---------------------------------------------------------------VEGETABLE-------------------------------------------------------------------
            elif id==3:
                if self.char.power[3] < 1:
                    self.infVegeError.show()
                else:
                    self.infVege.show()
                    self.char.power[3] = self.char.power[3] - 1
                    self.vegetableAbility.powerUsed(1);
                    self.attacking = True
                    self.type="VEGETABLE"
                    
            #------------------------------------------------------------------FISH---------------------------------------------------------------------
            elif id==4:
                if self.char.power[4] < 1:
                    self.infFishError.show()
                else:
                    self.infFish.show()
                    self.char.power[4] = self.char.power[4] - 1
                    self.fishAbility.powerUsed(1);
                    self.attacking = True
                    self.type="FISH"
                    
            #----------------------------------------------------------------CEREAL--------------------------------------------------------------------
            elif id==5:
                if self.char.power[0] < 1:
                   self.infCerealError.show() 
                else:
                    self.infCereal.show()
                    self.char.power[0] = self.char.power[0] - 1
                    self.grainAbility.powerUsed(1);
                    self.attacking = True
                    self.type="GRAIN"
                    
            #------------------------------------------------------------------NONE-------------------------------------------------------------------
            else:
                self.infError.show()
            
            #Shows on the screen the result of the drawing process
            taskMgr.add(self.taskSpriteAttack, 'taskSpriteAttack' )
            self.busy = True
            self.gestureHandler.clearGestures();
    #end gestureProcessing
    
    # Process the damage for the character
    def damage(self):
            self.char.life = self.char.life - 1
            if self.char.life >= 0:
                    self.char.soundDamage.play()
                    self.lifes.decrease(1)
                    self.char.setInvincible(True)
                    if self.char.life <= 0:
                            self.setGameOver()
    #end damage
    
    # Configures the game for Game Over process
    def setGameOver(self):
        self.gameover = OnscreenImage(image="./tex/gameover.png", pos = (0, 0, 0),hpr=None, scale = (1.4,1.0,1.0), color=None, parent=None, sort=30)
        self.isGameOver = True
        self.gameOverMusic.play()
        self.level.state = 2
        self.level.removeAll()
        taskMgr.remove('taskLevel')
        taskMgr.remove('taskLevels')
        taskMgr.remove('taskMove')
        taskMgr.add(self.taskChangeLevel, 'taskChangeLevel')
        self.energyBar.hide()
        self.specialItems.hide()
        self.grainAbility.hide()
        self.fruitAbility.hide()
        self.milkAbility.hide()
        self.vegetableAbility.hide()
        self.fishAbility.hide()
        self.lifes.hide()
    #end setGameOver
    
    #-----------------------------------------------------------------------------------------------------------------------------------------------
    #----------------------------------------------------------------TASKS,THREADS------------------------------------------------------------------
    #-----------------------------------------------------------------------------------------------------------------------------------------------
    # It moves the main character to the sun pointer point.
    def taskMove(self, task):
        mpos = self.cursor.getCursorPos()
        if(self.drawing == False):
            # We're not drawing.
            if(self.level.movingBackground != False):
                # We're on a transition sequence
                self.level.moveBackground(mpos.getX(),mpos.getY())
        
            # Moving the main character
            self.char.movement(mpos.getX(),mpos.getY())
        
        # We have all special items
        if( (self.specialItems.hasAllSpecial() == True) and (self.allSpecialPlayed == False) ):
            self.allSpecial.play()
            self.allSpecialPlayed = True
            self.lifes.increase(1)
            self.char.life = self.char.life + 1
        
        # We're run out of energy
        if self.energyBar.amount <= 0:
            self.setGameOver()
            
        return task.cont
    #end taskCursor
    
    # It holds ability's information on screen for 1 second and then throws the attack to the enemy.
    def taskSpriteAttack(self, task):
        if task.time>1:            
            # Making disappear the sprite information attack
            self.hideBlackboard()
            
            if self.attacking == True:
                # If we draw correctly and we have the correct power item
                self.att = Attack(self.type,"-",self.level.enemies,self.char)
                self.attacking = False
                self.char.attacking = True
                
            self.busy = False
            
            # Making move the enemies again
            for x in self.level.enemies:
                x.stopEnemy(False)
            
            # Making move the character again
            taskMgr.add(self.taskMove, 'taskMove')
            return task.done
        else:
            return task.cont
    #end taskAttack
    
    # It checks Character-Item, Character-Enemy, Character-Enemy Attack and Enemy-Character Attack collision every frame.
    def taskCollision(self, task):
        if self.isGameOver == True: return task.done
        else:
            #Character-Item collision
            for x in self.level.items:
                if x.collide(self.char):
                    self.char.itemCollect(x)
                    self.level.items.remove(x)
                    x.posX = -100
                    x.model.setX(x.posX)
                    x.posY = -100
                    x.model.setZ(x.posY)
                    x.collectIt = True
                    
                    self.energyBar.increase(x.energy)
                    
                    if x.specialItem==True: self.specialItems.itemCollected(x.type)
                    
                    #Abilites bar
                    if x.type == "GRAIN":
                        self.grainAbility.itemCollected(1)
                    if x.type == "FRUIT":
                        self.fruitAbility.itemCollected(1)
                    if x.type == "MILK":
                        self.milkAbility.itemCollected(1)
                    if x.type == "VEGETABLE":
                        self.vegetableAbility.itemCollected(1)
                    if x.type == "FISH":
                        self.fishAbility.itemCollected(1)
            
            #Character-Enemy collision, Character-Enemy Attack collision
            for x in self.level.enemies:
                if x.collide(self.char):
                    if self.char.isInvincible == False:
                        self.damage()
                                
                if x.attacking == True:
                    if x.att.char_enAttCollide(self.char):
                        if self.char.isInvincible == True:
                            if x.att.isexploding == False:
                                x.att.destroyAttack()
                        else:
                            if( x.att != None ):
                                x.att.explode()
                            self.damage()
                                
            #Enemy-Character Attack collision
            if self.char.attacking == True:
                for x in self.level.enemies:
                    if self.att.en_charAttCollide(x)==True:
                        x.life = x.life - 1
                        self.level.enemies.remove(x)
                        self.att.destroyAttack()
           
            return task.cont
    #end taskCollision
    
    # It decreases character energy every frame, only when he's moving over the screen.
    def taskEnergy(self, task):
        if self.isGameOver == True: 
            return task.done
        else:
            if self.char.walking:
                if (task.time-self.lastTimeEnergy) > 1: 
                    self.lastTimeEnergy = task.time
                    self.energyBar.decrease(3)
            else:
                if (task.time-self.lastTimeEnergy) > 1: 
                    self.lastTimeEnergy = task.time
                    self.energyBar.decrease(1)
            return task.cont
    #end taskEnergy
    
    # It waits for a level finalization (YOU WIN) and prepares the application for the next level
    def taskLevels(self, task):
        if self.level.state == 1:
            taskMgr.add(self.taskChangeLevel, 'taskChangeLevel')
            self.winMusic.play()
            self.level.state = 2
        return task.cont
    #end taskLevels
    
    # It change the level.
    # The next level if the user has won the game or a reinit if it is a game over.
    def taskChangeLevel(self, task):
        if(task.time > 4.0):
            if( self.isGameOver == True ):      self.gameover.hide()
            else:                               self.level.hideLevel()
            
            back = self.level.back
            
            if( self.isGameOver == True ):      num_level = 0
            else:                               num_level = self.level.num_level
            
            self.level = None
            
            self.grainAbility.setEmpty()
            self.fruitAbility.setEmpty()
            self.milkAbility.setEmpty()
            self.vegetableAbility.setEmpty()
            self.fishAbility.setEmpty()
            
            self.char.power[0] = 0
            self.char.power[1] = 0
            self.char.power[2] = 0
            self.char.power[3] = 0
            self.char.power[4] = 0
            
            if( self.isGameOver == False ): self.specialItems.reInit()
            self.allSpecialPlayed = False
            
            if(num_level == 0):
                self.char.model.hide()
                self.gameActive = False
                Game(back,self.cursor,self.pointer)
            if(num_level == 1): self.level = Level_2(back)
            if(num_level == 2): self.level = Level_3(back)
            if(num_level == 3): self.level = Level_4(back)
            if(num_level == 4): self.level = Level_5(back)
            if(num_level == 5): self.level = Level_6(back)

            return task.done
        else:
            return task.cont
    #end taskChangeLevel