def do_turn(self, target): chance = base.D20.roll() if chance > 10: target.statuses.append( s.Poison(3, (chance * self.level - 10 * self.level) / 4)) base.put('[STATUS] ' + target.name + "has been poisoned by" + self.owner.name)
def do_turn(self,target,damage): chance = base.D40.roll() if chance > 39: base.put('Power surges through your body giving you increased armor and health!') self.owner.owner.health*=3 damage/=4 return damage
def do_turn(self): super(Spiderling, self).do_turn() if base.D6.roll() == 1: base.put('a spiderling has reproduced!') child = Spiderling(self.level) child.action_points = 0 self.owner.things.append(child)
def buy_item(self,item): if self.gold >= item.get_cost(): self.gold -= item.get_cost() self.inventory.append(item) return True base.put("you don't have enough gold for that!") return False
def do_turn(self, option): if option == self.options[0]: go = True while (go): mod_list = self.owner.inventory.get_list([self]) new_li = [a for a in mod_list if isinstance(a, i.Item)] item_index = base.make_choice([a.to_str() for a in new_li]) item_object = new_li[item_index] option_index = base.make_choice(item_object.item_options) if option_index is not None: item_opt = item_object.item_options[option_index] if item_opt == 'examine': # each item needs to define self.descr, which is what will be printed here. base.put(item_object.examine()) if item_opt == 'equip': item_object.equip() # this isn't quiote implemented if item_opt == 'give': choice = base.make_choice( self.owner.party.inventory.get_list([self.owner])) other_player = self.owner.party.inventory.get_list( [self.owner])[choice] ans = base.make_choice(['continue', 'done']) if ans == 0: go = True else: go = False
def do_turn(self, options): base.put('[STATUS] %s is blinded, and will not hit!' % self.owner.to_str()) if self.turns > 0: self.owner.action_points = 0 self.turns -= 1 else: self.owner.statuses.remove(self)
def do_turn(self, option): if self.turns > 0: self.owner.health -= self.damage base.put('[STATUS] %s takes %f burn damage' % (self.owner.name, self.damage)) self.turns -= 1 else: self.owner.statuses.remove(self)
def do_turn(self,target,damage): chance=base.D40.roll() if chance>39: base.put("A blinding light flashes from the Heavens and blinds and reveals all enemies in the room!") for a in self.owner.owner.party.current_dungeon.active_room.things: if isinstance(a,Monster): a.statuses.append(s.Blind(6)) return damage
def do_turn(self, option): if option == 'open sack': de = '' for a in self.contents: self.owner.inventory.append(a) de += '%s, ' % a.name base.put('you open the sack and find %s' % de[:-2]) self.owner.inventory.remove(self)
def do_turn(self, options): if self.turns > 0: base.put( '[STATUS] %s is stunned, and cannot move for another %d turns' % (self.owner.to_str(), self.turns)) self.owner.action_points = 0 self.turns -= 1 else: self.owner.statuses.remove(self)
def do_turn(self, target, damage): chance = base.D40.roll() if chance > 39: base.put( 'Power surges through your body giving you increased damage and speed!' ) self.owner.owner.action_points += 3 damage *= 4 target.take_damage(self.owner.owner, damage)
def do_turn(self, options): chance = base.D20.roll() if chance > 16: self.owner.statuses.remove(self) base.put('[STATUS] %s has awoken!' % (self.owner.to_str())) else: base.put('[STATUS] %s is asleep, and cannot move!' % (self.owner.to_str())) self.owner.action_points = 0
def breathefire(self): self.reveal() base.put('Zearth breathes a sea of fire at his enemies!') for player in self.owner.party.inventory: roll=base.D20.roll() if roll<12: player.take_damage(self,self.power/3) player.statuses.append(p_status.Burn(math.ceil(self.level/4),self.power*(self.level/2.0))) else: base.put('%s has dodged the flames!' %player.name)
def get_current_release(self): latest = None try: import requests latest = requests.get( 'https://api.github.com/repos/microwaveabletoaster/dunces-and-dungeons/releases/latest' ).json()['tag_name'] except: base.put("could not reach the update service :'(") return latest
def do_turn(self,target,damage): chance = base.D40.roll() if chance > 39: base.put('Heavenly Fire leaps from the body of your enemy, striking all enemies in the room') # base.put('Hey if there is an error its on 354 of item_modification.py') for a in self.owner.owner.party.current_dungeon.active_room.things: if isinstance(a,Monster): a.take_damage(self.owner,20*self.owner.level) chance2=base.D20.roll() if chance2>14: a.statuses.append(s.Burn(self.owner.level,self.owner.level*8))
def sleep(self): self.reveal() base.put('Zearth locks eyes with one in the party and sends them into a deep sleep') if self.action_points > 0: if not self.aggroed: self.select_aggro() if self.aggro.alive: self.aggro.statuses.append(p_status.Sleep()) else: self.select_aggro() self.agro.statuses.append(p_status.Sleep())
def do_turn(self, options): if self.turns > 0: hp_restored = self.owner.max_health * .10 self.owner.health += hp_restored if self.owner.health > self.owner.max_health: self.owner.health = self.owner.max_health base.put("[STATUS] healed %s for %d" % (self.owner.name, hp_restored)) self.turns -= 1 else: self.owner.statuses.remove(self)
def do_turn(self,option): if self.turns < 3: if not self.applied and not self.owner.statuses.contains_type(OgreEnrage): self.owner.power *= 1.2 self.owner.health *= 1.2 self.applied = True self.turns += 1 else: base.put("[STATUS] the ogre is no longer enraged!") self.owner.power /= 1.2 self.owner.health -= (self.owner.health * .2) self.owner.statuses.remove(self)
def retaliate(self,target): try: if(isinstance(self.equipment['left'],weapons.Weapon) and isinstance(self.equipment['right'],weapons.Weapon)): return (self.equipment['left'].standard_attack(target)/10+self.equipment['right'].standard_attack(target)/10) elif(isinstance(self.equipment['left'],weapons.Weapon)): return (self.equipment['left'].standard_attack(target)/7) elif(isinstance(self.equipment['right'],weapons.Weapon)): return (self.equipment['right'].standard_attack(target)/7) else: return self.attributes['strength']/4 except: base.put("error here, 374 players.py") return self.attributes['strength']/4
def do_turn(self, target, damage): chance = base.D40.roll() if chance > 39: base.put( "A blinding light flashes from the Heavens and blinds and reveals all enemies in the room!" ) base.put( 'Hey if there is an error its on 323 of self.owner_modification.py' ) for a in self.owner.owner.party.current_dungeon.active_room.things: if isinstance(a, Monster): a.statuses.append(s.Blind(6)) target.take_damage(self.owner.owner, damage)
def do_turn(self,target,damage): chance=base.D100.roll() if chance >99: base.put('The Arch Powers of the World infuse your body!') base.put('Mortal Blast!') target.statuses.append(s.Burn(self.owner.level,100)) target.statuses.append(s.Poison(self.owner.level,120)) target.statuses.append(s.Bleeding(self.owner.level,1000)) target.statuses.append(s.Maim(self.owner.level)) target.statuses.append(s.Stun(self.owner.level/2)) target.statuses.append(s.Sleep()) target.statuses.append(s.Blind(self.owner.level*2)) for a in self.owner.owner.party.inventory: a.statuses.append(s.Healing()) damage=0
def cast_fireball(self): self.reveal() roll=base.D6.roll() base.put("Carl summons a mass of fire!") if self.action_points > 0: if not self.aggroed: self.select_aggro() if self.aggro.alive: self.attack(self.aggro,self.power) self.aggro.statuses.append(p_status.Burn(math.ceil(roll/2),self.power/8*roll)) else: self.select_aggro() self.attack(self.aggro,self.power) self.aggro.statuses.append(p_status.Burn(math.ceil(roll/2),self.power/8*roll))
def main(self): target = self.owner.select_target() if target: amount = target.power / 5 roll = base.D20.roll() roll = roll + (self.owner.attributes['luck'] / (100.0 / self.owner.level)) if roll > 15: self.owner.gold = self.owner.gold + amount base.put('successfully pickpocketed the %s for %d gold' % (target.name, amount)) else: amo = (self.owner.max_health / 3 + target.power / 10) self.owner.health -= amo base.put( 'critical failure pickpocketing! %s loses %d health!' % (self.owner.name, amo))
def do_turn(self,arg): if arg is self.options[0]: self.map = [] self.populate_map_matrix() # this is for brevity. rooms = self.owner.party.current_dungeon.rooms for row in range(len(rooms)): for col in range(len(rooms[row])): # check first if there is a room at that position if rooms[col][row] and rooms[col][row].entered: # check to see if theyre in the room self.map[col][row] = 'R ' if rooms[col][row].contains_chest(): self.map[col][row] = 'C ' if rooms[col][row].cords == self.owner.party.current_dungeon.active_room.cords: self.map[col][row] = 'X ' if rooms[col][row].contains_exit(): self.map[col][row] = 'L ' base.put(self.format_output())
def do_turn(self): for a in self.statuses: a.do_turn(None) if self.check_if_alive(): self.owner.things.remove(self) if self.action_points > 0: roll = base.D6.roll() if roll is 1: self.smash() if roll is 2: self.enrage() if roll is 3: self.autoattack() if roll is 4: self.feast() if roll is 5 or roll is 6: base.put("the ogre looks around, apparently confused.") # base.put(self.health) self.action_points -= 1
def do_turn(self, option): # effectiveness coefficient ec = self.owner.attributes['mana'] / 5 if option == self.options[0]: p = base.make_choice([ 'cast %s' % self.name, 'rename %s' % self.name, 'examine %s' % self.name ]) if p == 1: name = base.get_input('enter a new name for %s' % self.name) self.name = name self.options = ['%s' % self.name] if p == 2: base.put(self.ploop()) if p == 0: if not self.on_cooldown: if not self.is_healing: if not self.aoe: self.murder(self.owner.select_target()) self.owner.statuses.append( s.Cooldown(self, self.cooldown_time)) else: self.owner.do_aoe_monster(self.murder) self.owner.statuses.append( s.Cooldown(self, self.cooldown_time)) else: if not self.aoe: self.murder(self.owner.select_player_target()) self.owner.statuses.append( s.Cooldown(self, self.cooldown_time)) else: self.owner.do_aoe_player(self.murder) self.owner.statuses.append( s.Cooldown(self, self.cooldown_time)) else: base.put('%s is on cooldown!' % self.name)
def cast_cosmicBlast(self): num=0 for a in self.owner.things: if isinstance(a,m.Monster): a.conceal() num+=1 self.conceal() base.put("The rooms is plunged into darkness as a all light is gathered into a ball") base.put("Carl seems to have disappeared along with all other monsters!") if self.action_points > 0: if not self.aggroed: self.select_aggro() if self.aggro.alive: self.attack(self.aggro,self.power*(2+num)) self.aggro.statuses.append(p_status.Stun(base.D3.roll())) self.aggro.statuses.append(p_status.Burn(base.D3.roll(),num*(self.power/5))) else: self.select_aggro() self.attack(self.aggro,self.power*(2+num)) self.aggro.statuses.append(p_status.Burn(base.D3.roll(),num*(self.power/5))) self.aggro.statuses.append(p_status.Stun(base.D3.roll()))
def main(self): target = self.owner.select_target() roll = base.D20.roll() if roll < 11: stat = [] for a in self.owner.statuses: a.owner = target stat.append(a) self.owner.statuses = [] stat1 = [] for a in target.statuses: a.owner = self.owner stat1.append[a] target.statuses = [] self.owner.statuses = stat1 target.statuses = stat #target.statuses, self.owner.statuses = self.owner.statuses, target.statuses print 'You successfully swap your statuses with the Enemies!' else: times = len(self.owner.statuses) base.put('Woops! You doubled your own statuses!') for a in range(times): self.owner.statuses.append(self.owner.statuses[a])
def test_ablities(self): for name, obj in inspect.getmembers(player_abilities): if inspect.isclass(obj): if name not in ['Ability', 'ShieldBash']: self.setUp() # we want the abilities to be able to proc base.IS_TEST = False for a in range(6): spidey = monsters.Spider(1) weak = monster_mods.Weak() spidey.modifiers.append(weak) weak.apply() self.dung.rooms[0][0].things.append(spidey) ability = obj() self.player.inventory.append(ability) self.party.current_dungeon = self.dung base.put('========testing ability======== %s ' % ability) self.dung.start() self.party.handle_player_turn() self.tearDown() self.setUp() self.player.attributes['mana'] = 5 base.IS_TEST = False for a in range(6): spidey = monsters.Spider(1) weak = monster_mods.Weak() spidey.modifiers.append(weak) weak.apply() self.dung.rooms[0][0].things.append(spidey) sp = spell.SpellBook(2) self.player.inventory.append(player_inv.InventoryHandler()) self.player.inventory.append(sp) sp.equip() self.party.current_dungeon = self.dung self.dung.start() self.party.handle_player_turn()
def main(self): roll = base.D10.roll() if roll > 5: # if the roll is 10, you do damage to all monsters based on half your strength. if roll == 10: base.put('primal roar critical success!') self.owner.do_aoe_monster(self.action_damage) else: base.put('primal roar successfully cast!') self.owner.do_aoe_monster(self.action) # if the roll is one, you do the damage to all your party. elif roll == 1: base.put('primal roar critical fail!') for party_member in self.owner.party.inventory: party_member.take_damage( self.owner, self.owner.attributes['strength'] * .5) else: base.put('the primal roar was unsuccessful.')