2X merit multiplier for factories

This commit is contained in:
John 2015-08-13 23:39:09 +03:00
parent 5f9592cdd7
commit be54eb19df
6 changed files with 8 additions and 9 deletions

View file

@ -15,12 +15,12 @@ class PromotionManagerAI:
def getPercentChance(self): def getPercentChance(self):
return 100.0 return 100.0
def recoverMerits(self, av, cogList, zoneId, multiplier = 1, extraMerits = None): def recoverMerits(self, av, cogList, zoneId, multiplier = 1, extraMerits = None, addInvasion = True):
avId = av.getDoId() avId = av.getDoId()
meritsRecovered = [0, 0, 0, 0] meritsRecovered = [0, 0, 0, 0]
if extraMerits is None: if extraMerits is None:
extraMerits = [0, 0, 0, 0] extraMerits = [0, 0, 0, 0]
if self.air.suitInvasionManager.getInvading(): if addInvasion and self.air.suitInvasionManager.getInvading():
multiplier *= getInvasionMultiplier() multiplier *= getInvasionMultiplier()
for i in xrange(len(extraMerits)): for i in xrange(len(extraMerits)):
if CogDisguiseGlobals.isSuitComplete(av.getCogParts(), i): if CogDisguiseGlobals.isSuitComplete(av.getCogParts(), i):

View file

@ -1,6 +1,5 @@
from direct.directnotify.DirectNotifyGlobal import * from direct.directnotify.DirectNotifyGlobal import *
import cPickle import cPickle
from pymongo.errors import AutoReconnect
from otp.ai.AIBaseGlobal import * from otp.ai.AIBaseGlobal import *
from toontown.building import DistributedBuildingAI from toontown.building import DistributedBuildingAI
@ -193,7 +192,7 @@ class DistributedBuildingMgrAI:
{'$setOnInsert': street, {'$setOnInsert': street,
'$set': {'buildings': buildings}}, '$set': {'buildings': buildings}},
upsert=True) upsert=True)
except AutoReconnect: # Something happened to our DB, but we can reconnect and retry. except: # Something happened to our DB, but we can reconnect and retry.
taskMgr.doMethodLater(config.GetInt('mongodb-retry-time', 2), self.save, 'retrySave', extraArgs=[]) taskMgr.doMethodLater(config.GetInt('mongodb-retry-time', 2), self.save, 'retrySave', extraArgs=[])
else: else:
@ -219,7 +218,7 @@ class DistributedBuildingMgrAI:
street = {'ai': self.air.districtId, 'branch': self.branchId} street = {'ai': self.air.districtId, 'branch': self.branchId}
try: try:
doc = self.air.dbGlobalCursor.streets.find_one(street) doc = self.air.dbGlobalCursor.streets.find_one(street)
except AutoReconnect: # We're failing over - normally we'd wait to retry, but this is on AI startup so we might want to retry (or refactor the bldgMgr so we can sanely retry). except: # We're failing over - normally we'd wait to retry, but this is on AI startup so we might want to retry (or refactor the bldgMgr so we can sanely retry).
return blocks return blocks
if not doc: if not doc:

View file

@ -29,7 +29,7 @@ class DistributedBattleFactoryAI(DistributedLevelBattleAI.DistributedLevelBattle
self.toonItems[toon.doId][1].extend(notRecovered) self.toonItems[toon.doId][1].extend(notRecovered)
meritArray = self.air.promotionMgr.recoverMerits( meritArray = self.air.promotionMgr.recoverMerits(
toon, self.suitsKilled, self.getTaskZoneId(), toon, self.suitsKilled, self.getTaskZoneId(),
getFactoryMeritMultiplier(self.getTaskZoneId())) getFactoryMeritMultiplier(self.getTaskZoneId()) * 2.0, addInvasion=False)
if toon.doId in self.helpfulToons: if toon.doId in self.helpfulToons:
self.toonMerits[toon.doId] = addListsByValue(self.toonMerits[toon.doId], meritArray) self.toonMerits[toon.doId] = addListsByValue(self.toonMerits[toon.doId], meritArray)
else: else:

View file

@ -34,7 +34,7 @@ class DistributedCountryClubBattleAI(DistributedLevelBattleAI.DistributedLevelBa
recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId()) recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId())
self.toonItems[toon.doId][0].extend(recovered) self.toonItems[toon.doId][0].extend(recovered)
self.toonItems[toon.doId][1].extend(notRecovered) self.toonItems[toon.doId][1].extend(notRecovered)
meritArray = self.air.promotionMgr.recoverMerits(toon, self.suitsKilled, self.getTaskZoneId(), getCountryClubCreditMultiplier(self.getTaskZoneId()), extraMerits=extraMerits) meritArray = self.air.promotionMgr.recoverMerits(toon, self.suitsKilled, self.getTaskZoneId(), getCountryClubCreditMultiplier(self.getTaskZoneId()) * 2.0, extraMerits=extraMerits, addInvasion=False)
if toon.doId in self.helpfulToons: if toon.doId in self.helpfulToons:
self.toonMerits[toon.doId] = addListsByValue(self.toonMerits[toon.doId], meritArray) self.toonMerits[toon.doId] = addListsByValue(self.toonMerits[toon.doId], meritArray)
else: else:

View file

@ -33,7 +33,7 @@ class DistributedMintBattleAI(DistributedLevelBattleAI.DistributedLevelBattleAI)
recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId()) recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId())
self.toonItems[toon.doId][0].extend(recovered) self.toonItems[toon.doId][0].extend(recovered)
self.toonItems[toon.doId][1].extend(notRecovered) self.toonItems[toon.doId][1].extend(notRecovered)
meritArray = self.air.promotionMgr.recoverMerits(toon, self.suitsKilled, self.getTaskZoneId(), getMintCreditMultiplier(self.getTaskZoneId()), extraMerits=extraMerits) meritArray = self.air.promotionMgr.recoverMerits(toon, self.suitsKilled, self.getTaskZoneId(), getMintCreditMultiplier(self.getTaskZoneId()) * 2.0, extraMerits=extraMerits, addInvasion=False)
if toon.doId in self.helpfulToons: if toon.doId in self.helpfulToons:
self.toonMerits[toon.doId] = addListsByValue(self.toonMerits[toon.doId], meritArray) self.toonMerits[toon.doId] = addListsByValue(self.toonMerits[toon.doId], meritArray)
else: else:

View file

@ -41,7 +41,7 @@ class DistributedStageBattleAI(DistributedLevelBattleAI.DistributedLevelBattleAI
recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId()) recovered, notRecovered = self.air.questManager.recoverItems(toon, self.suitsKilled, self.getTaskZoneId())
self.toonItems[toon.doId][0].extend(recovered) self.toonItems[toon.doId][0].extend(recovered)
self.toonItems[toon.doId][1].extend(notRecovered) self.toonItems[toon.doId][1].extend(notRecovered)
meritArray = self.air.promotionMgr.recoverMerits(toon, self.suitsKilled, self.getTaskZoneId(), getStageCreditMultiplier(self.level.getFloorNum()), extraMerits=extraMerits) meritArray = self.air.promotionMgr.recoverMerits(toon, self.suitsKilled, self.getTaskZoneId(), getStageCreditMultiplier(self.level.getFloorNum()) * 2.0, extraMerits=extraMerits, addInvasion=False)
if toon.doId in self.helpfulToons: if toon.doId in self.helpfulToons:
self.toonMerits[toon.doId] = addListsByValue(self.toonMerits[toon.doId], meritArray) self.toonMerits[toon.doId] = addListsByValue(self.toonMerits[toon.doId], meritArray)
else: else: