def cast(self): pygame.mixer.music.load( os.path.join( wzglobals.current_folder, 'misc', 'sounds', 'card_cast.ogg' ) ) wzglobals.playmusic()
def play_summon_sound(self): pygame.mixer.music.load( os.path.join( wzglobals.current_folder, 'misc', 'sounds', 'card_summon.ogg' ) ) wzglobals.playmusic() return
def onmousedown(self): wzglobals.selected_card = False for cardbox in wzglobals.cardboxes: cardbox.light = False pygame.mixer.music.stop() if self.element != wzglobals.selected_elem: wzglobals.selected_elem = self.element # self.default() exec("wzglobals." + wzglobals.cards_of_element_shower_element + "_element_button.default()") wzglobals.cards_in_deck.empty() wzglobals.cards_of_element_shower_element = self.element self.image = self.image_pressed self.surface_backup = self.image.copy() # elements sound wzglobals.set_element_sound(self.element) wzglobals.playmusic(time=2500)
def die(self): print("DEBUG: %s died" % self.name) for spell in self.spells: spell.unset(self) self.parent.card = self.parent.player self.parent.image.blit(self.parent.surface_backup, (0, 0)) self.kill() for card in self.get_enemy_cards() + self.get_self_cards(): card.card_died(self) try: pygame.mixer.music.load( os.path.join(wzglobals.current_folder, 'misc', 'sounds', 'card_die.ogg')) except: print("Unexpected error: while trying load die sound") wzglobals.playmusic() if self.image: del self.image
def onmousedown(self): wzglobals.selected_card = False for cardbox in wzglobals.cardboxes: cardbox.light = False pygame.mixer.music.stop() if self.element != wzglobals.selected_elem: wzglobals.selected_elem = self.element # self.default() exec( 'wzglobals.' + wzglobals.cards_of_element_shower_element + '_element_button.default()' ) wzglobals.cards_in_deck.empty() wzglobals.cards_of_element_shower_element = self.element self.image = self.image_pressed self.surface_backup = self.image.copy() # elements sound wzglobals.set_element_sound(self.element) wzglobals.playmusic(time=2500)
def die(self): print("DEBUG: %s died" % self.name) for spell in self.spells: spell.unset(self) self.parent.card = self.parent.player self.parent.image.blit(self.parent.surface_backup, (0, 0)) self.kill() for card in self.get_enemy_cards() + self.get_self_cards(): card.card_died(self) try: pygame.mixer.music.load( os.path.join( wzglobals.current_folder, 'misc', 'sounds', 'card_die.ogg' ) ) except: print("Unexpected error: while trying load die sound") wzglobals.playmusic() if self.image: del self.image
def cast(self): pygame.mixer.music.load( os.path.join(wzglobals.current_folder, 'misc', 'sounds', 'card_cast.ogg')) wzglobals.playmusic()
def play_summon_sound(self): pygame.mixer.music.load( os.path.join(wzglobals.current_folder, 'misc', 'sounds', 'card_summon.ogg')) wzglobals.playmusic() return
def me_finish_turn(): # Добавляем ману другому игроку. # wzglobals.attack_started = True wzglobals.attack_started.append(True) wzglobals.player.enemy.mana['water'] += 1 wzglobals.player.enemy.mana['fire'] += 1 wzglobals.player.enemy.mana['air'] += 1 wzglobals.player.enemy.mana['earth'] += 1 wzglobals.player.enemy.mana['life'] += 1 wzglobals.player.enemy.mana['death'] += 1 # Меняем игрока try: pygame.mixer.music.load(current_folder+'/misc/sounds/card_attack.ogg') except: print("Unexpected error: while trying play attack sound") wzglobals.playmusic() if wzglobals.player.id == 1: wzglobals.player = wzglobals.player2 wzglobals.player.action_points = True for card in wzglobals.ccards_1: # Атакуем kill = card.attack() if kill: card.enemy_die() card.used_cast = False # вызываем функцию повторения магия for spell in wzglobals.magic_cards: spell.periodical_cast() for card in wzglobals.ccards_2: card.turn() card.moves_alive += 1 for card in wzglobals.ccards_2: card.additional_turn_action() else: wzglobals.player = wzglobals.player1 wzglobals.player.action_points = True for card in wzglobals.ccards_2: # Атакуем kill = card.attack() if kill: card.enemy_die() card.used_cast = False # вызываем функцию повторения магия for spell in wzglobals.magic_cards: spell.periodical_cast() for card in wzglobals.ccards_1: card.turn() card.moves_alive += 1 for card in wzglobals.ccards_1: card.additional_turn_action() if wzglobals.player.ai: cb = ai.select_cardbox() if cb: c = ai.select_card(cb.card) # print 'SELECTED',c cb.card = c() cb.card.field = True wzglobals.player.mana[cb.card.element] -= cb.card.level cb.card.parent = cb if wzglobals.player.id == 1: wzglobals.ccards_1.add(cb.card) else: wzglobals.ccards_2.add(cb.card) cb.card.summon() finish_turn()