def infos(self): infos = dict() n = 0 self._read_hexes(self.cur_hexes) for my in self.myarr: ind = self.cur_hexes[my[0], my[1], 1] champ = find_name(int(ind)) infos[my] = [champ, 1, self.cur_hexes[my[0], my[1], -1]] n += 1 for opp in self.opparr: ind = self.cur_hexes[opp[0], opp[1], 1] champ = find_name(int(ind)) infos[opp] = [champ, -1, self.cur_hexes[opp[0], opp[1], -1]] n += 1 return infos
def _mana(self,hexes,arr,hit=True): ''' hit : 10 mana damaged by opp : 4 if skill, next tic skill activate ''' cur_mana = hexes[arr[0],arr[1],3] tot_mana = self.start_hexes[arr[0],arr[1],3] nm = find_name(int(hexes[arr[0],arr[1],1])) #print('{} mana refill {}/{}'.format(nm,cur_mana,tot_mana)) if tot_mana == 0: hexes[arr[0],arr[1],9] = 1 return hexes if hit: cur_mana += 5 * hexes[arr[0],arr[1],6] else: cur_mana += 2 if cur_mana >= tot_mana: hexes[arr[0],arr[1],9] = 1 cur_mana = 0 hexes[arr[0],arr[1],3] = cur_mana return hexes
def _assign_hexes(self,hexes,mynum,myarr,myitems,mysyn,myinfo, oppnum,opparr,oppitems,oppsyn,oppinfo,max=True): ''' ''' if max: mana = 1 else: mana = 0 n = 0 for ou,on,oa,oitem,oinf in zip(self.oppunits,oppnum,opparr,oppitems,oppinfo): n += 1 hexes[oa[0],oa[1],-1] = n hexes[oa[0],oa[1],0] = -1 hexes[oa[0],oa[1],1] = on print(find_name(on),oinf['mana'][mana],mana) hexes[oa[0],oa[1],2] = oinf['health'] hexes[oa[0],oa[1],3] = oinf['mana'][mana] hexes[oa[0],oa[1],4] = oinf['attack_range'] hexes[oa[0],oa[1],5] = oinf['attack_damage'] hexes[oa[0],oa[1],6] = oinf['attack_speed'] hexes[oa[0],oa[1],7] = oinf['armor'] hexes[oa[0],oa[1],8] = oinf['magical_resistance'] # index 9 is is_skill # index 10 is sklll damage - config hexes[oa[0],oa[1],11] = 0.5 hexes[oa[0],oa[1],12] = oinf['dodge'] hexes[oa[0],oa[1],13] = oinf['critical'] hexes[oa[0],oa[1],14] = oinf['synergy'][0] hexes[oa[0],oa[1],15] = oinf['synergy'][1] if len(oinf['synergy']) == 3: hexes[oa[0],oa[1],16] = oinf['synergy'][2] else: hexes[oa[0],oa[1],16] = -1 hexes[oa[0],oa[1],17] = int(ou[-1]) # index 18 is stunned time for c,o in enumerate(oitem): hexes[oa[0],oa[1],19+c] = o # index 25 is skill shield # index 26 is shield remain time # index 26 is skill own buff # index 27 is skill remain time for mu,mn,ma,mitem,minf in zip(self.myunits,mynum,myarr,myitems,myinfo): n += 1 hexes[ma[0],ma[1],-1] = n hexes[ma[0],ma[1],0] = 1 hexes[ma[0],ma[1],1] = mn print(find_name(mn),minf['mana'][mana],mana) hexes[ma[0],ma[1],2] = minf['health'] hexes[ma[0],ma[1],3] = minf['mana'][mana] hexes[ma[0],ma[1],4] = minf['attack_range'] hexes[ma[0],ma[1],5] = minf['attack_damage'] hexes[ma[0],ma[1],6] = minf['attack_speed'] hexes[ma[0],ma[1],7] = minf['armor'] hexes[ma[0],ma[1],8] = minf['magical_resistance'] # index 9 is is_skill # index 10 is sklll damage - config hexes[ma[0],ma[1],11] = 0.5 # critical damagepercent hexes[ma[0],ma[1],12] = minf['dodge'] hexes[ma[0],ma[1],13] = minf['critical'] # critical prob hexes[ma[0],ma[1],14] = minf['synergy'][0] hexes[ma[0],ma[1],15] = minf['synergy'][1] if len(minf['synergy']) == 3: hexes[ma[0],ma[1],16] = minf['synergy'][2] else: hexes[ma[0],ma[1],16] = -1 hexes[ma[0],ma[1],17] = int(mu[-1]) # level # index 18 is stunned time for c,m in enumerate(mitem): hexes[ma[0],ma[1],19+c] = m # index 25 is skill shield # index 26 is shield remain time # index 26 is skill own buff # index 27 is skill remain time return hexes