def __init__(self, i_id, name, spritetype, spriteid, components, value, RNG, desc, aoe, weapontype, status, status_on_hold, status_on_equip, droppable=False, locked=False, event_combat=False): self.spritetype = spritetype # Consumable, Sword, Used for spriting in list of sprites self.spriteid = spriteid # Number of sprite to be picked from spritesheet list self.id = i_id self.owner = 0 self.name = str(name) self.value = int(value) # Value for one use of item, or for an infinite item self.RNG = parseRNG(RNG) # Comes in the form of looking like '1-2' or '1' or '2-3' or '3-10' self.strRNG = RNG # string version of RNG for display self.event_combat = event_combat self.droppable = droppable # Whether this item is given to its owner's killer upon death self.locked = locked # Whether this item can be traded, sold, or dropped. assert not(self.droppable == self.locked == True), "%s can't be both droppable and locked to a unit!" %(self.name) self.desc = desc # Text description of item # Status IDs self.status = status self.status_on_hold = status_on_hold self.status_on_equip = status_on_equip self.aoe = aoe self.TYPE = weapontype if self.TYPE: self.icon = Weapons.Icon(self.TYPE) else: self.icon = None # Creates component slots self.components = components # Consumable, Weapon, Spell Bigger Picture for component_key, component_value in self.components.items(): self.__dict__[component_key] = component_value self.loadSprites()
def __init__(self, playerId, x, y, mapId): self.playerId = playerId self.x = x self.y = y self.deg = 0 self.score = 0 self.speed = 5 self.energy = 100 self.shield = 100 self.weapon = Weapons.BasicWeapon(self) self.mapId = mapId self.map = Maps.maps[self.mapId] self.planet = self.map.planets[0] self.keyboard = RemoteKeyboard() self.mouse = RemoteMouse() self.ship = pygame.image.load(Misc.players[self.playerId]) self.shipRect = self.ship.get_rect(centerx=self.x, centery=self.y) self.rotatedShip = pygame.transform.rotate(self.ship, self.deg) self.rotatedRect = self.rotatedShip.get_rect(centerx=self.x, centery=self.y) self.radius = int( math.hypot(self.shipRect.x - self.shipRect.centerx, self.shipRect.y - self.shipRect.centery)) self.inPortal = None self.inRect = False self.direction = ''
def __init__(self, x, y, sprite): self.image = sprite.image self.spawnX = x self.spawnY = y self.x = x self.y = y + Level.yOffset self.width = sprite.width self.height = sprite.height self.rect = pygame.Rect(self.x, self.y, self.width, self.height) self.speed = 10 self.hp = 10 self.score = 0 self.xp = 0 self.level = 0 self.levelNum = Font.createTextObject(Font.smallCambria, str(self.level), Color.black) self.healthBar = Bar(self, self.hp, self.hp) self.levelBar = LevelBar(self, self.xp, 100, Color.purple, Color.white, yOffset=-2, height=2) self.inv = Inventory(self) self.weapon = Weapons.Flame(self) self.cooldown = 0
def FirstRoom(): goblin = Units.MakeGoblin() units = [goblin] sword = Weapons.MakeSword() rewards = [sword] return Room("Basic", "You have entered the first room", ["[1] option 1", "[2] option 2"], units, rewards)
def __init__(self, name="Player"): """ Constructor to initialize default values and call the Entity and Observable constructors to set up values """ self._name = name self._weapons = Weapons.generateRandomWeaponList(10, self) # call parent constructors Entity.__init__(self, attack=randint(10, 20)) Observable.__init__(self)
def __init__(self, unit, wexp, weapon_type): Banner.__init__(self) self.unit = unit self.item = Weapons.Icon(weapon_type) self.banner = [ unit.name, ' reached rank ', Weapons.EXP.number_to_letter(wexp) ] self.banner_font = ['text_blue', 'text_white', 'text_blue'] self.figure_out_size() self.sound = GC.SOUNDDICT['Item']
def begin(self, gameStateObj, metaDataObj): if not self.started: # Get units to display self.units = [unit for unit in gameStateObj.allunits if unit.position and unit.team == 'player'] self.bg_surf = Image_Modification.flickerImageTranslucent(GC.IMAGESDICT['UnitMenuBackground'], 10) self.title_bg = Image_Modification.flickerImageTranslucent(GC.IMAGESDICT['TitleBar'], 10) self.background = MenuFunctions.MovingBackground(GC.IMAGESDICT['RuneBackground']) self.states = [('Character', ['Class', 'Lv', 'Exp', 'HP', 'Max'], [4, 66, 89, 113, 133]), ('Fighting Skill', ['STR', 'MAG', 'SKL', 'SPD', 'LCK', 'DEF', 'RES'], [4, 26, 48, 71, 94, 119, 142]), ('Equipment', ['Equip', 'Atk', 'Hit', 'Avoid'], [16, 72, 103, 136]), ('Personal Data', ['MOV', 'CON', 'Aid', 'Rat', 'Trv'], [4, 33, 60, 82, 106]), ('Weapon Level', Weapons.TRIANGLE.types, [9 + idx*16 for idx in range(len(Weapons.TRIANGLE.types))])] if cf.CONSTANTS['support']: self.states.append(('Support Chance', ['Ally'], [0])) self.state_index = 0 self.prev_state_index = 0 self.unit_index = 1 # 0 means on banner self.scroll_index = 1 self.banner_index = 0 self.num_per_page = 6 self.state_scroll = 0 self.scroll_direction = 0 self.weapon_icons = [Weapons.Icon(weapon) for weapon in Weapons.TRIANGLE.types] self.help_boxes = [] self.info = False self.scroll_bar = GUIObjects.ScrollBar((233, 59)) self.left_arrow = GUIObjects.ScrollArrow('left', (7, 41)) self.right_arrow = GUIObjects.ScrollArrow('right', (GC.WINWIDTH - 7 - 8, 41), 0.5) # For sort self.current_sort = 'Name' self.descending = False self.sort_surf = MenuFunctions.CreateBaseMenuSurf((64, 24)) self.sort_surf = Image_Modification.flickerImageTranslucent(self.sort_surf, 10) self.sort_arrow_counter = Counters.ArrowCounter() self.sort_arrow_counter.arrow_anim = [0, 1, 2] self.sort() # Transition in: gameStateObj.stateMachine.changeState("transition_in") return 'repeat' else: chosen_unit = gameStateObj.info_menu_struct['chosen_unit'] if chosen_unit and chosen_unit in self.units: self.move_to_unit(chosen_unit) gameStateObj.info_menu_struct['chosen_unit'] = None
def __init__(self, x, y, sprite, hp): self.x = x self.y = y self.width = sprite.width self.height = sprite.height self.rect = pygame.Rect(self.x, self.y, self.width, self.height) self.sprite = sprite self.image = sprite.image self.hp = hp self.healthBar = Fighter.Bar(self, self.hp, self.hp) self.radius = 50 self.score = 0 self.weapon = Weapons.Flame(self) self.time = 0
def __init__(self, x, y, sprite): self.cooldown = 0 self.direction = 0 self.image = sprite.image self.x = x + 50 * random.gauss(0, 1) self.y = y + 20 * random.gauss(0, 1) + Level.yOffset self.width = sprite.width self.height = sprite.height self.rect = pygame.Rect(self.x, self.y, self.width, self.height) self.speed = 2 self.hp = 10 self.healthBar = Bar(self, self.hp, self.hp) self.stop = False self.defeated = False self.killer = None self.weapon = Weapons.Flame(self)
def set_attributes(self): self.attributes_set = True self.bab = self.level self.number_of_feats = self.level+1 self.roll_stats() self.number_of_skill_points = self.level*max(self.stat_mods['int'],1) if self.race == "human": self.number_of_feats += 1 self.number_of_skill_points += self.level self.calculate_saves() self.bravery = (self.level+2)/4 self.armor_training = (self.level+1)/4 self.weapon_training = (self.level-1)/4 self.weapon = Weapons.Random_Weapon(self.debug,self.seed) self.weapon.generate_weapon() self.feats = Feats.Random_Feats(self.number_of_feats,self.debug,self.seed) self.feats.generate_feat_list() return
import os import sys import functions as f import shutil import pathlib import csv_f import zlib import Flags from os import listdir from os.path import isfile, join #import pandas #import xlrd import Description as d import Weapons input = csv_f.make_list("input.csv") #input = csv_f.load_xlsx("input.xlsx") print(input) pack_name = 'Weapon_pack001' Weapons.newWeaponPack(input, pack_name)
# Instances of Weapon Objects import Weapons as w dirk = w.Weapon("dirk", 2, 7, "piercing", 1, "dagger") spear = w.Weapon("spear", 3, 10, "piercing", 2, "spear") axe = w.Weapon("axe", 4, 12, "bludgeoning", 3, "axe") longsword = w.Weapon("longsword", 1, 80, "slashing", 5, "sword") knife = w.Weapon("knife", 1, 60, "piercing", 1, "dagger")
def ArmyBase1(player): os.system("cls") q( "After a long period of walking down an empty, desolate road you stumble across a desolate army base.", 0.02, player) input() os.system("cls") q( "You peer around some of the corners, inspecting to see some zombies, but you don't.", 0.02, player) input() os.system("cls") q("\"Hello?\" You shout, but to no avail. No answer.", 0.02, player) input() os.system("cls") q( "You open the rusty gate and walk towards a cylindrically shaped building.", 0.02, player) input() os.system("cls") q("\"Weapons?\" For whatever reason you said that out loud.", 0.02, player) input() os.system("cls") q("\"Don't... move...\"", 0.06) input() os.system("cls") q("\"I'm not... I'm not...\"", 0.02, player) input() os.system("cls") q("\"Drop your weapon.\"", 0.02, player) input() os.system("cls") q("You drop your " + player.weapon + ".", 0.02, player) player.weapon = Weapons.Fist() input() os.system("cls") q("\"Good. Now. Come here.\"", 0.02, player) input() os.system("cls") ans = input("Now's your chance. Attack or leave it? (a/l) ") if ans.lower() == "a": os.system("color 0c") os.system("cls") print( "You grab the weapon pointed at your head and bring it to the side, providing a straight punch to the face." ) input() os.system("cls") player.health -= 5 print( "You take a swipe to the leg, but an upper cut to the bowel finishes them off." ) input() os.system("cls") q("\"Just... kill me.\"", 0.1) input() os.system("cls") q( "\"No, I don't kill people. I just need food and weapons, then I'll be on my way.\"", 0.02, player) input() os.system("cls") q("\"Here, there's loads of guns in the back.\"", 0.02, player) input() os.system("cls") q( "You're given a key to a door around the side. You help them up and proceed to walk towards the door.", 0.02, player) input() os.system("cls") q( "\"What's your name by the way? We could do with a fighter like you in our group.\"", 0.02, player) input() os.system("cls") q( "\"" + player.name + ". I ain't looking to join any groups though.\"", 0.02, player) input() os.system("cls") name = generateName() q( "\"Shame. My name is " + name + ". We're low on food anyway, but you can take some of our emergency supplies, especially if you are going to be going back out there. No one here even knows how long this crap's been going on for, days, weeks, or even months.\"", 0.02, player) input() os.system("cls") q("\"So what kind of weapons do you have here?\"", 0.02, player) input() os.system("cls") q( "\"Well, we have mainly guns, but we do have some larger tools as well.\"", 0.02, player) input() os.system("cls") q("\"Good.\"", 0.02, player) input() os.system("cls") q("Upon entering this room of weapons", 0.02, player)
def weekend(player): os.system("cls") print( "As your eyes slowly open, you drift in and out of consciousness, wishing for yourself to fall back asleep." ) input() os.system("cls") print( "You look towards your clock, it reads 8:30. 8:30 is not your usual awakening time." ) input() os.system("cls") print( "Upon further inspection, you notice that it's the weekend. You slept all through Friday. Wierd." ) input() os.system("cls") print( "You vaguely remember the smashing party you had, and how drunk you'd gotten." ) input() os.system("cls") print( "After sliding out of bed, you put on a shirt and walk into the kitchen." ) input() os.system("cls") print( "Here, it comes to your attention that somebody is knocking on the door. And has been for the last 4 minutes." ) input() os.system("cls") print( "You decide to answer them, but at 8:30 in the morning, they could just be someone drunk." ) input() os.system("cls") print( "You peer through your peep hole. You see a tall male, with a... deformed face." ) input() os.system("cls") print("\"Nice makeup!\" You shout through the door. No response.") input() os.system("cls") print("You turn around after locking the door. The banging resumes.") input() os.system("cls") if player.gender == "f": print( "You decide to get changed, so you take off your shirt and put on a bra, a jacket and a skirt." ) elif player.gender == "m": print( "You decide to get changed, so you take off your shirt and put on some underwear, a jumper and a pair of jeans." ) else: print( "You decide to get changed, so you take off your shirt and put on a bra, some underwear, a skirt and a pair of jeans." ) # xD if this is possible I s'pose input() os.system("cls") print("*CRASH*") input() os.system("cls") print( "You sprint towards your door, and see a mass of \'people\' barging into your apartment." ) input() os.system("cls") print( "Being on the 15th floor means windows aren't an option, so you sprint to the closet to grab a weapon" ) input() os.system("cls") print("You see a bunch of possible weapons.") input() print("1. A broom") input() print("2. A crowbar") input() print("3. A plastic box") input() print("4. A hammer") input() weaponPicked = str(input("Choose (number): ")) if weaponPicked == "1": player.weapon = Weapons.Broom() elif weaponPicked == "2": player.weapon = Weapons.Crowbar() elif weaponPicked == "3": player.weapon = Weapons.Box() elif weaponPicked == "4": player.weapon = Weapons.Hammer()
import sys import Weapons import Main import Map disk = Weapons.Weapon("Scratched Fortnite Disk", 2, "Blah") backpack = [disk] def showInv(): print ('You have ') for stuff in backpack: print(stuff.getName()) commandList = ['? - Help', 'go - Move direction', 'exit - Exit game', 'inventory - Open inventory', 'get - pick up object'] def listCommands(commandList): print ('\tYou can do the folowing: ') for x in commandList: print ('\t', x) print ("Hello, welcome to our house!") name = input("What\'s your name? ") print("\tHi", name) command = '' command = input("What would you like to do? ")
b.draw(screen) class TowerShop(Shop): pass map = Map(Sprite.map) bg = Map(Sprite.bg) alphabg = Map(Sprite.alphabg) alphabg2 = Map(Sprite.greyalpha, 600, 100) wave = Wave(5, FPS) offset = Offset(xOffset, yOffset) shop = Shop(0, height + yOffset, [ Weapons.Flame(Fighter.player), Weapons.Thunder(Fighter.player), Weapons.Icer(Fighter.player) ], [5, 10, 20]) skinsShop = Shop( width - 100, 200, [Sprite.zach, Sprite.victoriaGold, Sprite.allison, Sprite.ben], [1, 2, 3, 4], style=1) #Examples of Bad Object Oriented Programming Below #wave1 = Wave(5, FPS, 1) #wave2 = Wave(10, FPS * 1.1, 2) #wave3 = Wave(20, FPS * 1.2, 3)
import Weapons import Defends import Tools import Setting import hashlib,random def bckDoor(w): print(w.eachIp(w.trojTime)) print(w.eachIpArgs(w.runCmd,'*.php')) print(w.eachIpArgs(w.runCmd,'ls -al')) print(w.eachIpArgs(w.runTeamCmd,'system(\'whoami\')')) if __name__ == "__main__": print('script start') config=Setting.Config('default.json')[0] webtroj=Weapons.WebTroj(random.randint(1000,9999),config) ssh=Defends.SSH(Defends.SSH.configStart(config)) while not ssh.connected: ssh.connect() print(ssh.execCmd('cd /app;ls -al').getMsg()) cur_path=ssh.backupserver() print(ssh.execCmd('cd /app;ls -al').getMsg()) ssh.extractBackup(cur_path) codeReview=Defends.CodeReview(config) codeReview.start() #ssh.deploy('bck_20191013_151029.bck') ssh.redeploy() #print(ssh.execCmd('cd /app;ls -al').getMsg())