def onmousedown(self):
     globals.selected_card = False
     for cardbox in globals.cardboxes:
         cardbox.light = False
     pygame.mixer.music.stop()
     if self.element != globals.selected_elem:
         globals.selected_elem = self.element
         #self.default()
         exec('globals.'+globals.cards_of_element_shower_element+'_element_button.default()')
         globals.cards_in_deck.empty()
         globals.cards_of_element_shower_element = self.element
         self.image = self.image_pressed
         self.surface_backup = self.image.copy()
         #elements sound
         globals.set_element_sound(self.element) 
         globals.playmusic(time=2500);
Пример #2
0
def me_finish_turn():
    #Добавляем ману другому игроку.
    globals.attack_started = True
    globals.player.enemy.water_mana += 1
    globals.player.enemy.fire_mana += 1
    globals.player.enemy.air_mana += 1
    globals.player.enemy.earth_mana += 1
    globals.player.enemy.life_mana += 1
    globals.player.enemy.death_mana += 1
    #Меняем игрока
    pygame.mixer.music.load(current_folder+'/misc/sounds/card_attack.mp3')
    globals.playmusic()
    if globals.player.id == 1:
        globals.player = globals.player2
        globals.player.action_points = True
        for card in globals.ccards_1: #Атакуем
            kill = card.attack()
            if kill:
                card.enemy_die()
            card.used_cast = False
        for spell in globals.magic_cards: #вызываем функцию повторения магия
            spell.periodical_cast()
        for card in globals.ccards_2:
            card.turn()
        for card in globals.ccards_2:
            card.additional_turn_action()
    else:
        globals.player = globals.player1
        globals.player.action_points = True
        for card in globals.ccards_2: #Атакуем
            kill = card.attack()
            if kill:
                card.enemy_die()
            card.used_cast = False
        for spell in globals.magic_cards: #вызываем функцию повторения магия
            spell.periodical_cast()
        for card in globals.ccards_1:
            card.turn()
        for card in globals.ccards_1:
            card.additional_turn_action()
Пример #3
0
def me_finish_turn():
    #Добавляем ману другому игроку.
    #globals.attack_started = True
    globals.attack_started.append(True)
    globals.player.enemy.mana['water'] += 1
    globals.player.enemy.mana['fire'] += 1
    globals.player.enemy.mana['air'] += 1
    globals.player.enemy.mana['earth'] += 1
    globals.player.enemy.mana['life'] += 1
    globals.player.enemy.mana['death'] += 1
    #Меняем игрока
    try:
        pygame.mixer.music.load(current_folder+'/misc/sounds/card_attack.mp3')
    except:
        print "Unexpected error: while trying play attack sound"
    globals.playmusic()
    if globals.player.id == 1:
        globals.player = globals.player2
        globals.player.action_points = True
        for card in globals.ccards_1: #Атакуем
            kill = card.attack()
            if kill:
                card.enemy_die()
            card.used_cast = False
        for spell in globals.magic_cards: #вызываем функцию повторения магия
            spell.periodical_cast()
        for card in globals.ccards_2:
            card.turn()
            card.moves_alive += 1
        for card in globals.ccards_2:
            card.additional_turn_action()
    else:
        globals.player = globals.player1
        globals.player.action_points = True
        for card in globals.ccards_2: #Атакуем
            kill = card.attack()
            if kill:
                card.enemy_die()
            card.used_cast = False
        for spell in globals.magic_cards: #вызываем функцию повторения магия
            spell.periodical_cast()
        for card in globals.ccards_1:
            card.turn()
            card.moves_alive += 1
        for card in globals.ccards_1:
            card.additional_turn_action()
    if globals.player.ai:
        cb = ai.select_cardbox()
        if cb:
            c = ai.select_card(cb.card)
            #print 'SELECTED',c
            cb.card = c()
            cb.card.field = True
            globals.player.mana[cb.card.element] -= cb.card.level
            cb.card.parent = cb
            if globals.player.id == 1:
                globals.ccards_1.add(cb.card)
            else:
                globals.ccards_2.add(cb.card)
            cb.card.summon()
        finish_turn()