示例#1
0
    def takeDamage(self, damage, mod):
        if (mod.name == "NerdBombs"):
            self.health -= damage * 5
        else:
            self.health -= damage

        if (self.getHealth() <= 0):
            print("\rThe targeted Ghoul has been defeated!")
            Observable.updateObservable(self)
示例#2
0
    def takeDamage(self, damage, mod):
        if ((mod.name == "ChocolateBars") or (mod.name == "SourStraws")):
            self.health -= 0
        else:
            self.health -= damage

        if (self.getHealth() <= 0):
            print("\rThe targeted Werewolf has been defeated!")
            Observable.updateObservable(self)
示例#3
0
    def takeDamage(self, damage, mod):
        if (mod.name == "SourStraws"):
            self.health -= damage * 2
        else:
            self.health -= damage

        if (self.getHealth() <= 0):
            print("\rThe targeted Zombie has been defeated!")
            Observable.updateObservable(self)
示例#4
0
    def __init__(self):
        Observable.__init__(self)
        self.rows = 5
        self.cols = 5
        self.houses = []
        for i in range(self.rows * self.cols):
            holder = House()
            Observable.add_observer(holder, self)
            self.houses.append(holder)

        self.housesLeft = len(self.houses)
        print(self.housesLeft)
示例#5
0
 def __init__(self):
     #list of 0-10 monsters
     Observable.__init__(self)
     self._monsters = []
     monster_types = "PZVGW"
     for i in range(0, 10):
         rand_monster = random.choice(monster_types)
         monster = None
         if rand_monster == "P":
             monster = Person()
         elif rand_monster == "Z":
             monster = Zombie()
         elif rand_monster == "V":
             monster = Vampire()
         elif rand_monster == "G":
             monster = Ghoul()
         elif rand_monster == "W":
             monster = Werewolve()
         monster.add_observer(self)
         self._monsters.append(monster)
示例#6
0
    def engageHouse(self, thePlayer):
        while (self.getUserSelection() != 0 and self.getMonsters() != 0):
            print("\rYour health is: %s. " % thePlayer.getHealth(), end="")
            try:
                self.setUserSelection(
                    int(input("""What will you do?
					0: Run			1: Fight""")))
                if (self.getUserSelection() == 0
                        or self.getUserSelection() == 1):
                    if (self.getUserSelection() == 0):
                        pass
                    else:
                        self.fight(thePlayer)
                else:
                    print("Please enter in either 0 or 1.")
            except ValueError:
                print("Please enter in either 0 or 1.")

        if (self.getMonsters() == 0):
            Observable.updateObservable(self)
        self.setUserSelection(1)
示例#7
0
 def iniciateMemberList(self):
     for i in range(self.monsters):
         choice = randint(0, 3)
         if (choice == 0):
             holder = Zombie()
             Observable.add_observer(holder, self)
             self.getMembers().append(holder)
         elif (choice == 1):
             holder = Vampire()
             Observable.add_observer(holder, self)
             self.getMembers().append(holder)
         elif (choice == 2):
             holder = Ghoul()
             Observable.add_observer(holder, self)
             self.getMembers().append(holder)
         elif (choice == 3):
             holder = Werewolf()
             Observable.add_observer(holder, self)
             self.getMembers().append(holder)
示例#8
0
 def __init__(self, name, attack_modifier, uses):
     Observable.__init__(self)
     self._name = name
     self._attack_modifier = attack_modifier
     self._uses = uses
示例#9
0
 def __init__(self):
     """Monster Constructor."""
     Observable.__init__(self)
     self.attackRange = []
     self.healthPoints = 0
示例#10
0
parser = argparse.ArgumentParser()
parser.add_argument('--log-file-prefix', help='log-file-prefix 日志文件名')
args = parser.parse_args()

if args.log_file_prefix is not None:
    logging.basicConfig(
        level=logging.INFO,
        filename=args.log_file_prefix,
        filemode='a',
        format=
        '%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s'
    )

persons = config.Persons

ob_ad_list = Observable()


def get_otc_data(params):
    headers = {
        'content-type':
        'application/json',
        'User-Agent':
        'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:22.0) Gecko/20100101 Firefox/22.0'
    }

    try:
        r = requests.get(config.URL, params=params, headers=headers)
        res = json.loads(r.text)
        return res.get('datas')
    except Exception as e:
示例#11
0
 def __init__(self, name, health, lowDmg, highDmg):
     Observable.__init__(self)
     self.name = name
     self.health = health
     self.lowDmg = lowDmg
     self.highDmg = highDmg
示例#12
0
 def updateObserver(self, updater):
     self.getMembers().remove(updater)
     self.getMembers().append(Person())
     self.decrimentMonsters()
     if (self.getMonsters() == 0):
         Observable.updateObservable(self)
示例#13
0
 def __init__(self):
     Observable.__init__(self)
     self.monsters = randint(0, 10)
     self.memberList = []
     self.userSelection = 1
     self.iniciateMemberList()
 def __init__(self):
     Observable.__init__(self)
     threading.Thread.__init__(self)
示例#15
0
 def __init__(self, hp):
     Observable.__init__(self)
     self._hp = hp
     self._type = "monster"