10% chance for a Silly Surge

This commit is contained in:
John 2015-06-09 23:00:11 +03:00 committed by Loudrob
parent d6ee7af8df
commit 9416b70e91
2 changed files with 42 additions and 84 deletions

View file

@ -1,31 +1,17 @@
import copy
from pandac.PandaModules import *
from direct.controls.ControlManager import CollisionHandlerRayStart
from direct.directnotify import DirectNotifyGlobal
from direct.directtools.DirectGeometry import CLAMP
from direct.distributed.ClockDelta import *
from direct.fsm import ClassicFSM
from direct.fsm import State
from direct.interval.IntervalGlobal import *
from direct.task import Task
import math
from pandac.PandaModules import *
import DistributedSuitPlanner
import Suit
import SuitBase
import SuitDNA
import SuitDialog
import SuitTimings
from otp.avatar import DistributedAvatar
from otp.otpbase import OTPGlobals
from toontown.battle import BattleProps
from toontown.battle import DistributedBattle
from toontown.chat.ChatGlobals import *
from toontown.nametag.NametagGlobals import *
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownBattleGlobals
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer, ToontownGlobals
import Suit, SuitBase, SuitDialog, SuitTimings
import random
class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBase.SuitBase):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedSuitBase')
@ -84,7 +70,6 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
'dept': self.getStyleDept(),
'level': self.getActualLevel()}
self.setDisplayName(nameInfo)
return
def getSkeleRevives(self):
return self.skeleRevives
@ -145,7 +130,6 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
self.cRayNodePath = None
self.lifter = None
self.cTrav = None
return
def setHeight(self, height):
Suit.Suit.setHeight(self, height)
@ -172,7 +156,6 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
else:
head = self.find('**/joint_head')
self.prop.reparentTo(head)
return
def detachPropeller(self):
if self.prop:
@ -183,7 +166,6 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
self.propInSound = None
if self.propOutSound:
self.propOutSound = None
return
def beginSupaFlyMove(self, pos, moveIn, trackName, walkAfterLanding=True):
skyPos = Point3(pos)
@ -228,7 +210,6 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
self.prop.hide()
propTrack = Parallel(SoundInterval(self.propOutSound, duration=waitTime + dur, node=self), Sequence(Func(self.prop.show), ActorInterval(self.prop, 'propeller', endTime=openTime, startTime=propDur), ActorInterval(self.prop, 'propeller', constrainedLoop=1, duration=propDur - openTime, startTime=spinTime, endTime=0.0), Func(self.detachPropeller)))
return Parallel(ParallelEndTogether(lerpPosTrack, shadowTrack, fadeOutTrack), actInt, propTrack, name=self.taskName('trackName'))
return
def enableBattleDetect(self, name, handler):
if self.collTube:
@ -247,7 +228,6 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
if self.collNodePath:
self.collNodePath.removeNode()
self.collNodePath = None
return
def enableRaycast(self, enable = 1):
if not self.cTrav or not hasattr(self, 'cRayNode') or not self.cRayNode:
@ -375,84 +355,62 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
if number != 0:
if self.hpText:
self.hideHpText()
self.HpTextGenerator.setFont(OTPGlobals.getSignFont())
if number < 0:
self.HpTextGenerator.setText(str(number))
if base.cr.newsManager.isHolidayRunning(ToontownGlobals.SILLY_SURGE_HOLIDAY):
if config.GetBool('silly-surge-text', True) and random.randrange(0, 100) < config.GetInt('silly-surge-chance', 10):
self.sillySurgeText = True
absNum = abs(number)
if absNum > 0 and absNum <= 10:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[1])
elif absNum > 10 and absNum <= 20:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[2])
elif absNum > 20 and absNum <= 30:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[3])
elif absNum > 30 and absNum <= 40:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[4])
elif absNum > 40 and absNum <= 50:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[5])
elif absNum > 50 and absNum <= 60:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[6])
elif absNum > 60 and absNum <= 70:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[7])
elif absNum > 70 and absNum <= 80:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[8])
elif absNum > 80 and absNum <= 90:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[9])
elif absNum > 90 and absNum <= 100:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[10])
elif absNum > 100 and absNum <= 110:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[11])
absNumber = int(abs(number) / 10)
if len(TTLocalizer.SillySurgeTerms) > absNumber:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[absNumber])
else:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[12])
self.HpTextGenerator.setText(str(number) + '\n' + random.choice(TTLocalizer.SillySurgeTerms))
if self.interactivePropTrackBonus > -1 and self.interactivePropTrackBonus == attackTrack:
self.sillySurgeText = True
if attackTrack in TTLocalizer.InteractivePropTrackBonusTerms:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.InteractivePropTrackBonusTerms[attackTrack])
else:
self.HpTextGenerator.setText('+' + str(number))
self.HpTextGenerator.clearShadow()
self.HpTextGenerator.setAlign(TextNode.ACenter)
if bonus == 1:
r = 1.0
g = 1.0
b = 0
a = 1
color = [1, 1, 0, 1]
elif bonus == 2:
r = 1.0
g = 0.5
b = 0
a = 1
color = [1, 0.5, 0, 1]
elif number < 0:
r = 0.9
g = 0
b = 0
a = 1
color = [0.9, 0, 0, 1]
if self.interactivePropTrackBonus > -1 and self.interactivePropTrackBonus == attackTrack:
r = 0
g = 0
b = 1
a = 1
color = [0, 0, 1, 1]
else:
r = 0
g = 0.9
b = 0
a = 1
self.HpTextGenerator.setTextColor(r, g, b, a)
color = [0, 0.9, 0, 1]
self.HpTextGenerator.setTextColor(*color)
self.hpTextNode = self.HpTextGenerator.generate()
self.hpText = self.attachNewNode(self.hpTextNode)
self.hpText.setScale(scale)
self.hpText.setBillboardPointEye()
self.hpText.setBin('fixed', 100)
if self.sillySurgeText:
self.nametag3d.setDepthTest(0)
self.nametag3d.setBin('fixed', 99)
self.hpText.setPos(0, 0, self.height / 2)
seq = Sequence(self.hpText.posInterval(1.0, Point3(0, 0, self.height + 1.5), blendType='easeOut'), Wait(0.85), self.hpText.colorInterval(0.1, Vec4(r, g, b, 0), 0.1), Func(self.hideHpText))
seq.start()
color[3] = 0
Sequence(self.hpText.posInterval(1.0, Point3(0, 0, self.height + 1.5), blendType='easeOut'), Wait(0.85), self.hpText.colorInterval(0.1, Vec4(*color), 0.1), Func(self.hideHpText)).start()
def hideHpText(self):
DistributedAvatar.DistributedAvatar.hideHpText(self)
if self.sillySurgeText:
self.nametag3d.clearDepthTest()
self.nametag3d.clearBin()

View file

@ -8334,18 +8334,18 @@ CogdoExecutiveSuiteIntroMessage = "Oh no, they've got the shop keeper!\nDefeat t
CogdoExecutiveSuiteToonThankYou = 'Thanks for the rescue!\nIf you need help in a fight, use this SOS card to call my friend %s.'
CogdoExecutiveSuiteToonThankYouLawbot = 'Thanks for the rescue!\nThe Lawbots have left behind some sprocket awards that you can use to buy new things in your cattlelog!'
CogdoExecutiveSuiteToonBye = 'Bye!'
SillySurgeTerms = {1: 'Amusing Ascent!',
2: 'Silly Surge!',
3: 'Ridiculous Rise!',
4: 'Giggle Growth!',
5: 'Funny Fueling!',
6: 'Batty Boost!',
7: 'Crazy Climb!',
8: 'Jolly Jump!',
9: 'Loony Lift!',
10: 'Hilarity Hike!',
11: 'Insanity Increase!',
12: 'Cracked-Uptick!'}
SillySurgeTerms = ['Amusing Ascent!',
'Silly Surge!',
'Ridiculous Rise!',
'Giggle Growth!',
'Funny Fueling!',
'Batty Boost!',
'Crazy Climb!',
'Jolly Jump!',
'Loony Lift!',
'Hilarity Hike!',
'Insanity Increase!',
'Cracked-Uptick!']
InteractivePropTrackBonusTerms = {0: 'Super Toon-Up!',
1: '',
2: '',