def onround(self, player): targetindex = self.get('/target', 0) try: target = messages.characterlist[targetindex] except: return debug("[DEBUG] Item.onround: self: %s, player: %s, target: %s" % (self.displayname(), player.displayname(), target)) if self.get('/in_use', False): rounds = self.get('/rounds_per_charge', 0) current_rounds_performed = self.get('/current_rounds_performed', 0) debug("[DEBUG] item.onround: current_rounds_performed: %s, round: %s" % (current_rounds_performed, rounds)) if current_rounds_performed < rounds: current_rounds_performed += 1 self.put('/current_rounds_performed', current_rounds_performed) if current_rounds_performed < rounds: debug("[DEBUG] item.onround: run onround event") event(self, "/events/onround", {'item': self, 'player': player, 'target': target, 'messages': messages}) else: debug("[DEBUG] item.onround: running onfinish") self.onfinish(player=player) try: target = messages.characterlist[targetindex] debug("Item.onround save: %s" % target.savetoslot()) except: return
def onuse(self, player, target): debug("[DEBUG] Item.onuse: player %s, target %s" % (player.displayname(), target.displayname())) charges = self.get('/charges', 0) if charges == 0: return if self.itemtype() == 'spell': success = player.spell_success() messages.message(success[1]) if not success[0]: return self.put('/in_use', True) #TODO - expect the next line to break in use. Needs to be redone once the #new game class is finished self.put('/target', target) event(self, "/events/onuse", {'item': self, 'player': player, 'target': target, 'messages': messages}) try: target = messages.characterlist[target.index] debug("Item.onround save: %s" % target.savetoslot()) except: return messages.error("Item.onuse save: %s" % target.savetoslot())
def onfinish(self, player): debug("[DEBUG] item.onfinish player %s" % player.displayname()) targetindex = self.get('/target', 0) debug("[DEBUG] item.onfinish target %s" % targetindex) try: target = messages.characterlist[targetindex] except: return debug("[DEBUG] item.onfinish target %s" % target.displayname()) self.put('/in_use', False) self.put('/target', None) charges = self.get('/charges', 0) debug("[DEBUG] item.onfinish charges %s" % charges) if charges > 0: charges -= 1 self.put('/charges', charges) self.put('/current_rounds_performed', 0) debug("[DEBUG] item.onfinish before event") event(self, "/events/onfinish", {'item': self, 'player': player, 'target': target, 'messages': messages}) try: target = messages.characterlist[targetindex] debug("Item.onfinish save: %s" % target.savetoslot()) except: return
def oninteract(self, target, page): event(self, 'events/oninteract', {'character': self, 'page': page, 'target': target})
def onenter(self, player): event(self, "events/onenter", {'tile': self, 'messages':messages, 'player': player})
# dl = mva.mva(gtr, options.model, 'xgb') # tmva = mva.mva(gtr, options.model, 'tmva') ie = 0 print 'Create datasets ..' for ev in gtr: ie = ie + 1 if (ie > int(options.nmax) and (int(options.nmax) >= 0)): break Electrons, Muons = [], [] Event = obj.event(ev) nLep = ev.__getattr__("_nL") for i in range(0, nLep): lepType = ev.__getattr__("_lFlavor")[i] if lepType == 0: lep = obj.electron(ev, i) if lep.passed: Electrons.append(lep) elif lepType == 1: lep = obj.muon(ev, i) if lep.passed: Muons.append(lep) Electrons = obj.removeOverlap(Electrons, Muons)
cut1_wNorm = [] cut2_wNorm = [] cut3_wNorm = [] cut4_wNorm = [] cut5_wNorm = [] cut2_wNorm_succ = [] cut3_wNorm_succ = [] cut4_wNorm_succ = [] cut5_wNorm_succ = [] stat = 0 ieT = 0 for ev in tr: ieT = ieT + 1 #if (ieT > int(options.nmax) and (int(options.nmax) >= 0)): # break Event = obj.event(ev, isdata) stat += Event.weight print "stat : ", stat ie = 0 for ev in tr: ie = ie + 1 #if ie!=9741: # continue if (ie > int(options.nmax) and (int(options.nmax) >= 0)): break Jets = [] JetsBTagLoose = [] JetsBTagMedium = [] JetsBTagTight = [] Leptons = []
def onstrike(self, player, target): event(self, "events/onstrike", {'item': self, 'player': player, 'target': target, 'messages': messages}) debug("Item.onstrike save: %s" % target.savetoslot())
def onattack(self, player, target): event(self, "events/onattack", {'item': self, 'player': player, 'target': target, 'messages': messages})
def onunequip(self, player): event(self, "/events/onunequip", {'item': self, 'player': player, 'messages': messages})
def onpickup(self, player): event(self, "/events/onpickup", {'item': self, 'player': player, 'messages': messages})
def ondrop(self, player): event(self, "events/ondrop", {'item': self, 'player': player, 'messages': messages}) player.savetoslot()