Can lose parts in the VP.

This commit is contained in:
Loudrob 2015-04-09 18:54:38 -04:00
parent 168ae65d1e
commit e40c8561a9
5 changed files with 52 additions and 2 deletions

19
findterm_otp.py Normal file
View file

@ -0,0 +1,19 @@
import glob
def processFile(f,t):
data = open(f,'rb').read()
lines = data.replace('\r\n','\n').split('\n')
lines_found = []
for i,x in enumerate(lines):
if t in x:
lines_found.append(i+1)
return lines_found
term = raw_input('>')
for x in glob.glob('otp/*/*.py'):
r = processFile(x,term)
if r:
print x,r
raw_input('*****')

View file

@ -18,4 +18,9 @@ class CogSuitManagerAI:
if CogDisguiseGlobals.isSuitComplete(parts, suitTrack):
return recoveredParts
recoveredParts[suitTrack] = toon.giveGenericCogPart(factoryType, suitTrack)
return recoveredParts
return recoveredParts
def removeParts(self, toon, suitDept):
parts = toon.getCogParts()
if CogDisguiseGlobals.isSuitComplete(parts, suitDept):
toon.loseCogParts(suitDept)

View file

@ -14,6 +14,8 @@ PartsPerSuitBitmasks = (131071,
56447,
56411)
AllBits = 131071
MinPartLoss = 1
MaxPartLoss = 2
leftLegUpper = 1
leftLegLower = 2
leftLegFoot = 4
@ -204,4 +206,4 @@ def asNumber(bitstring):
def dept2deptIndex(dept):
if type(dept) == types.StringType:
dept = SuitDNA.suitDepts.index(dept)
return dept
return dept

View file

@ -28,6 +28,7 @@ class DistributedSellbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS
self.bossMaxDamage = ToontownGlobals.SellbotBossMaxDamage
self.recoverRate = 0
self.recoverStartTime = 0
self.punishedToons = []
def delete(self):
return DistributedBossCogAI.DistributedBossCogAI.delete(self)
@ -194,6 +195,13 @@ class DistributedSellbotBossAI(DistributedBossCogAI.DistributedBossCogAI, FSM.FS
return self.invokeSuitPlanner(10, 1)
def removeToon(self, avId):
av = self.air.doId2do.get(avId)
if not av is None:
if av.getHp() <= 0:
if avId not in self.punishedToons:
self.air.cogSuitMgr.removeParts(av, self.deptIndex)
self.punishedToons.append(avId)
toon = simbase.air.doId2do.get(avId)
if toon:
toon.b_setNumPies(0)

View file

@ -1344,6 +1344,22 @@ class DistributedToonAI(DistributedPlayerAI.DistributedPlayerAI, DistributedSmoo
parts[dept] = parts[dept] ^ part
self.b_setCogParts(parts)
def loseCogParts(self, dept):
loseCount = random.randrange(CogDisguiseGlobals.MinPartLoss, CogDisguiseGlobals.MaxPartLoss + 1)
parts = self.getCogParts()
partBitmask = parts[dept]
partList = range(17)
while loseCount > 0 and partList:
losePart = random.choice(partList)
partList.remove(losePart)
losePartBit = 1 << losePart
if partBitmask & losePartBit:
partBitmask &= ~losePartBit
loseCount -= 1
parts[dept] = partBitmask
self.b_setCogParts(parts)
def b_setCogMerits(self, merits):
self.setCogMerits(merits)
self.d_setCogMerits(merits)