Esempio n. 1
0
 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
Esempio n. 2
0
 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())
Esempio n. 3
0
 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
Esempio n. 4
0
 def oninteract(self, target, page):
     event(self, 'events/oninteract', {'character': self, 'page': page, 'target': target})
Esempio n. 5
0
 def onenter(self, player):
     event(self, "events/onenter", {'tile': self, 'messages':messages, 'player': player})
Esempio n. 6
0
    #    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)
Esempio n. 7
0
File: yield.py Progetto: sowuy/tHGG
    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 = []
Esempio n. 8
0
 def onstrike(self, player, target):
     event(self, "events/onstrike", {'item': self, 'player': player, 'target': target, 'messages': messages})
     debug("Item.onstrike save: %s" % target.savetoslot())
Esempio n. 9
0
 def onattack(self, player, target):
     event(self, "events/onattack", {'item': self, 'player': player, 'target': target, 'messages': messages})
Esempio n. 10
0
 def onunequip(self, player):
     event(self, "/events/onunequip", {'item': self, 'player': player, 'messages': messages})
Esempio n. 11
0
 def onpickup(self, player):
     event(self, "/events/onpickup", {'item': self, 'player': player, 'messages': messages})
Esempio n. 12
0
 def ondrop(self, player):
     event(self, "events/ondrop", {'item': self, 'player': player, 'messages': messages})
     player.savetoslot()