diff --git a/findterm_otp.py b/findterm_otp.py new file mode 100644 index 00000000..c15c3535 --- /dev/null +++ b/findterm_otp.py @@ -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('*****') \ No newline at end of file diff --git a/toontown/ai/CogSuitManagerAI.py b/toontown/ai/CogSuitManagerAI.py index 3e3e7468..db801e03 100644 --- a/toontown/ai/CogSuitManagerAI.py +++ b/toontown/ai/CogSuitManagerAI.py @@ -18,4 +18,9 @@ class CogSuitManagerAI: if CogDisguiseGlobals.isSuitComplete(parts, suitTrack): return recoveredParts recoveredParts[suitTrack] = toon.giveGenericCogPart(factoryType, suitTrack) - return recoveredParts \ No newline at end of file + return recoveredParts + + def removeParts(self, toon, suitDept): + parts = toon.getCogParts() + if CogDisguiseGlobals.isSuitComplete(parts, suitDept): + toon.loseCogParts(suitDept) diff --git a/toontown/coghq/CogDisguiseGlobals.py b/toontown/coghq/CogDisguiseGlobals.py index 9e9574a4..30c7cef6 100644 --- a/toontown/coghq/CogDisguiseGlobals.py +++ b/toontown/coghq/CogDisguiseGlobals.py @@ -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 \ No newline at end of file + return dept diff --git a/toontown/suit/DistributedSellbotBossAI.py b/toontown/suit/DistributedSellbotBossAI.py index abde9687..871c6ec4 100644 --- a/toontown/suit/DistributedSellbotBossAI.py +++ b/toontown/suit/DistributedSellbotBossAI.py @@ -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) diff --git a/toontown/toon/DistributedToonAI.py b/toontown/toon/DistributedToonAI.py index 8e7ce59c..24ad3e6c 100644 --- a/toontown/toon/DistributedToonAI.py +++ b/toontown/toon/DistributedToonAI.py @@ -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)