Go to the documentation of this file.00001 '''
00002 Anoria (c) Gsk 2010
00003 '''
00004
00005
00006 import random
00007
00008 from consts import *
00009
00010
00011 class AttackTable:
00012
00013 def __init__(self, i_owner=None):
00014 self.table = [0,0,0,0]
00015 self.owner = i_owner
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 def buildTable(self, atkSkills, defSkills):
00034 print 'AttackTable.buildTable()'
00035 current = BASE_MISS
00036 table = self.table
00037
00038 table[0] = current
00039
00040 current += BASE_EVADE
00041 table[1] = current
00042
00043 current += BASE_CRIT
00044 table[2] = current
00045
00046 current += BASE_CRUSH
00047 table[3] = current
00048
00049 return
00050
00051
00052
00053
00054
00055
00056 def getHit(self):
00057 rnd = random.randint(1, 10000)
00058 table = self.table
00059 if(rnd <= table[0]):
00060 return HIT_TYPE_MISS
00061 elif(rnd <= table[1]):
00062 return HIT_TYPE_EVADE
00063 elif(rnd <= table[2]):
00064 return HIT_TYPE_CRIT
00065 elif(rnd <= table[3]):
00066 return HIT_TYPE_CRUSH
00067
00068 return HIT_TYPE_NORMAL
00069
00070