def submit(self): if self.name_entry.get() == "": self.name_entry.delete(0, tk.END) self.name_entry.insert(0, self.table.get()) if self.name_entry.get() in self.combatant.get_attack_names(): self.name_duplicate_mb = tkm.showwarning( "Duplicate Name", "An attack with that name already exists. Please change the name." ) else: if self.attack: self.attack.update_attack( self.name_entry.get(), self.table.get(), int(self.ob_entry.get()), self.ranged.get(), # Need to code button for getting ranges with window, etc. []) self.parent.attacks_lbox.delete(self.attack_index) self.parent.attacks_lbox.insert(self.attack_index, str(self.attack)) else: self.attack = attack.Attack( self.name_entry.get(), self.table.get(), int(self.ob_entry.get()), self.ranged.get(), # Need to code button for getting ranges with window, etc. []) self.parent.combatant.add_attack(self.attack) self.parent.attacks_lbox.insert(tk.END, str(self.attack)) self.destroy()
def __init__(self): self.gamePad = pygame.display.set_mode((padWidth, padHeight)) pygame.display.set_caption('Kirby') #curby = pygame.image.load("images/fighter.png").convert_alpha() self.font = pygame.font.Font("font/KirbyL.ttf", 50) self.clock = pygame.time.Clock() self.user = player.kirby() self.ground = map.BACKGROUND() self.game_state = True self.attacks = [] self.f_s_acctack = attack.Attack(self.user.pos_x + 40, self.user.pos_y + 20, 10) #atteck class객체를 받아옴(x좌표,y좌표) self.item_eat = 0 self.moncount = 1 self.monsterheight = [(1000, 400), (1000, 200)] self.mon = enemy.MONSTER((1000, 400), 10) self.itemuse = 0 self.heart = 3 self.score = 0 self.itempresent = 0 self.item = items.ITEM() self.levelup = self.font.render("LEVELUP", 1, (255, 0, 0)) self.levelupcount = 11 self.sound = music.MUSIC()
def add_attack(self, *args): self.attacks.append(attack.Attack(self)) self.attacks[-1].grid(row=0, column=len(self.attacks) - 1) self.master.total.grid_forget() self.master.total.total_edv_label.grid_forget() self.master.total = total.Total(self.master, length=len(self.attacks)) self.master.total.grid(row=1)
def atf(wi, vi): if vi == 785: oled.fill(1) oled.text("Attack wifi", 0, 16, 0) oled.text(wi[0].decode("utf8"), 0, 32, 0) oled.show() attack.Attack(attack.sta_if(), wi, 1) else: pass
def doRoll(self, text, fullAttack=False): aLookup, bonuses, acExpr = self.parseAttackRoll(text) attacker = aLookup[0] try: attacker, weapon = attackLookup(self.gameState, aLookup[0], aLookup[1]) except LookupError as e: # Attack lookup failure, if either attack bonus or damage bonus is missing, we can't carry on. if None in bonuses: raise e # We got attack and damage bonuses.... ASSUME these are base values. else: weapon = attack.Attack(aLookup[1]) # bonuses are in the form (expr, "add"), strip out the add op attackBonusExpr = bonuses[0][0] damageBonusExpr = bonuses[1][0] # Excute attackBonusExpr to get value weapon.bonus = [attackBonusExpr] # We need damage in parsable form, use infix converter to transform it back. weapon.damageRoll = self.exprToInfix(damageBonusExpr, []) bonuses = (None, None) attackCount = weapon.getFullAttackCount() if fullAttack else 1 results = [] for attackNum in range(0, attackCount): weaponBonus = weapon.bonus[attackNum] attackAdjustment = bonuses[0] result = {"attacker": attacker, "attack": weapon.name} result.update( self.attackRoll(weaponBonus, attackAdjustment, acExpr)) if weapon.inCritRange( result["roll"]) and result["hit"] is not False: critResult = self.attackRoll(weaponBonus, attackAdjustment, acExpr) result["critical"] = critResult["hit"] is True result["criticalTotal"] = critResult["total"] result["criticalTrace"] = critResult["trace"] else: result["critical"] = False if result["hit"] is None or result["hit"]: result.update( self.damageRoll(weapon, bonuses[1], result["critical"])) results.append(result) return results
def melee_attack(self): damage = 1 ax, ay = self.get_melee_attack_location() att = attack.Attack(ax, ay, '/') self.attacks.append(att) for unit in self.units: if ax == unit.x and ay == unit.y: if unit.isKillable: unit.take_damage(damage)
def __init__(self, name): pygame.sprite.Sprite.__init__(self) self.name = name self.index = 0 self.frames = [] self.setStates() self.getImage() self.rect = self.image.get_rect() self.setPos() self.setSpeed() self.setTime() self.fall() self.image = self.frames[self.index] if name == 'mEndBoss': self.earth_attack = attack.Attack('eEarth')
def createAttack(self, attackData): a = attack.Attack(attackData["name"]) a.bonus = attack.attackBonus(attackData["attack"]) a.damageText = attackData["damage"] a.damageRoll = attack.getDamageRoll(attackData["damage"]) a.quantity = attackData.get("quantity") critRange = (20, 2) #a.criticalRange = critRange[0] #a.criticalMultiplier = critRange[1] #a.category = attackData.get("category") #a.equipped = attackData.get("equipped") a.damageType = attackData.get("typetext") return a
def load_models(self, d): models = {} for i in os.listdir(d): if '.' not in i: if 'attack' in i: f = open(d + '\\' + i + '\\' + 'info.txt') text = f.read() f.close() dmg, effects = int(text.split(';')[0]), text.split(';')[1].split(',') models[i] = attack.Attack(dmg, effects, [[d + '\\' + i + '\\default\\' + x for x in os.listdir(d + '\\' + i + '\\default')], [d + '\\' + i + '\\crouch\\' + x for x in os.listdir(d + '\\' + i + '\\crouch')]], self.size) else: models[i] = model.Model([[d + '\\' + i + '\\default\\' + x for x in os.listdir(d + '\\' + i + '\\default')], [d + '\\' + i + '\\crouch\\' + x for x in os.listdir(d + '\\' + i + '\\crouch')]], self.size) self.models = models
def InitiateAttack( self ): return attack.Attack()
def __init__(self, bot): self.bot = bot self.game = [] self.atk = attack.Attack(bot)