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.controls.ControlManager import CollisionHandlerRayStart
from direct.directnotify import DirectNotifyGlobal from direct.directnotify import DirectNotifyGlobal
from direct.directtools.DirectGeometry import CLAMP
from direct.distributed.ClockDelta import * from direct.distributed.ClockDelta import *
from direct.fsm import ClassicFSM
from direct.fsm import State
from direct.interval.IntervalGlobal import * from direct.interval.IntervalGlobal import *
from direct.task import Task 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.avatar import DistributedAvatar
from otp.otpbase import OTPGlobals from otp.otpbase import OTPGlobals
from toontown.battle import BattleProps from toontown.battle import BattleProps
from toontown.battle import DistributedBattle
from toontown.chat.ChatGlobals import * from toontown.chat.ChatGlobals import *
from toontown.nametag.NametagGlobals import * from toontown.nametag.NametagGlobals import *
from toontown.toonbase import TTLocalizer from toontown.toonbase import TTLocalizer, ToontownGlobals
from toontown.toonbase import ToontownBattleGlobals import Suit, SuitBase, SuitDialog, SuitTimings
from toontown.toonbase import ToontownGlobals import random
class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBase.SuitBase): class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBase.SuitBase):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedSuitBase') notify = DirectNotifyGlobal.directNotify.newCategory('DistributedSuitBase')
@ -84,7 +70,6 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
'dept': self.getStyleDept(), 'dept': self.getStyleDept(),
'level': self.getActualLevel()} 'level': self.getActualLevel()}
self.setDisplayName(nameInfo) self.setDisplayName(nameInfo)
return
def getSkeleRevives(self): def getSkeleRevives(self):
return self.skeleRevives return self.skeleRevives
@ -145,7 +130,6 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
self.cRayNodePath = None self.cRayNodePath = None
self.lifter = None self.lifter = None
self.cTrav = None self.cTrav = None
return
def setHeight(self, height): def setHeight(self, height):
Suit.Suit.setHeight(self, height) Suit.Suit.setHeight(self, height)
@ -172,7 +156,6 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
else: else:
head = self.find('**/joint_head') head = self.find('**/joint_head')
self.prop.reparentTo(head) self.prop.reparentTo(head)
return
def detachPropeller(self): def detachPropeller(self):
if self.prop: if self.prop:
@ -183,7 +166,6 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
self.propInSound = None self.propInSound = None
if self.propOutSound: if self.propOutSound:
self.propOutSound = None self.propOutSound = None
return
def beginSupaFlyMove(self, pos, moveIn, trackName, walkAfterLanding=True): def beginSupaFlyMove(self, pos, moveIn, trackName, walkAfterLanding=True):
skyPos = Point3(pos) skyPos = Point3(pos)
@ -228,7 +210,6 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
self.prop.hide() 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))) 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 Parallel(ParallelEndTogether(lerpPosTrack, shadowTrack, fadeOutTrack), actInt, propTrack, name=self.taskName('trackName'))
return
def enableBattleDetect(self, name, handler): def enableBattleDetect(self, name, handler):
if self.collTube: if self.collTube:
@ -247,7 +228,6 @@ class DistributedSuitBase(DistributedAvatar.DistributedAvatar, Suit.Suit, SuitBa
if self.collNodePath: if self.collNodePath:
self.collNodePath.removeNode() self.collNodePath.removeNode()
self.collNodePath = None self.collNodePath = None
return
def enableRaycast(self, enable = 1): def enableRaycast(self, enable = 1):
if not self.cTrav or not hasattr(self, 'cRayNode') or not self.cRayNode: 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 number != 0:
if self.hpText: if self.hpText:
self.hideHpText() self.hideHpText()
self.HpTextGenerator.setFont(OTPGlobals.getSignFont()) self.HpTextGenerator.setFont(OTPGlobals.getSignFont())
if number < 0: if number < 0:
self.HpTextGenerator.setText(str(number)) 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 self.sillySurgeText = True
absNum = abs(number) absNumber = int(abs(number) / 10)
if absNum > 0 and absNum <= 10:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[1]) if len(TTLocalizer.SillySurgeTerms) > absNumber:
elif absNum > 10 and absNum <= 20: self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.SillySurgeTerms[absNumber])
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])
else: 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: if self.interactivePropTrackBonus > -1 and self.interactivePropTrackBonus == attackTrack:
self.sillySurgeText = True self.sillySurgeText = True
if attackTrack in TTLocalizer.InteractivePropTrackBonusTerms: if attackTrack in TTLocalizer.InteractivePropTrackBonusTerms:
self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.InteractivePropTrackBonusTerms[attackTrack]) self.HpTextGenerator.setText(str(number) + '\n' + TTLocalizer.InteractivePropTrackBonusTerms[attackTrack])
else: else:
self.HpTextGenerator.setText('+' + str(number)) self.HpTextGenerator.setText('+' + str(number))
self.HpTextGenerator.clearShadow() self.HpTextGenerator.clearShadow()
self.HpTextGenerator.setAlign(TextNode.ACenter) self.HpTextGenerator.setAlign(TextNode.ACenter)
if bonus == 1: if bonus == 1:
r = 1.0 color = [1, 1, 0, 1]
g = 1.0
b = 0
a = 1
elif bonus == 2: elif bonus == 2:
r = 1.0 color = [1, 0.5, 0, 1]
g = 0.5
b = 0
a = 1
elif number < 0: elif number < 0:
r = 0.9 color = [0.9, 0, 0, 1]
g = 0
b = 0
a = 1
if self.interactivePropTrackBonus > -1 and self.interactivePropTrackBonus == attackTrack: if self.interactivePropTrackBonus > -1 and self.interactivePropTrackBonus == attackTrack:
r = 0 color = [0, 0, 1, 1]
g = 0
b = 1
a = 1
else: else:
r = 0 color = [0, 0.9, 0, 1]
g = 0.9
b = 0 self.HpTextGenerator.setTextColor(*color)
a = 1
self.HpTextGenerator.setTextColor(r, g, b, a)
self.hpTextNode = self.HpTextGenerator.generate() self.hpTextNode = self.HpTextGenerator.generate()
self.hpText = self.attachNewNode(self.hpTextNode) self.hpText = self.attachNewNode(self.hpTextNode)
self.hpText.setScale(scale) self.hpText.setScale(scale)
self.hpText.setBillboardPointEye() self.hpText.setBillboardPointEye()
self.hpText.setBin('fixed', 100) self.hpText.setBin('fixed', 100)
if self.sillySurgeText: if self.sillySurgeText:
self.nametag3d.setDepthTest(0) self.nametag3d.setDepthTest(0)
self.nametag3d.setBin('fixed', 99) self.nametag3d.setBin('fixed', 99)
self.hpText.setPos(0, 0, self.height / 2) 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)) color[3] = 0
seq.start() 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): def hideHpText(self):
DistributedAvatar.DistributedAvatar.hideHpText(self) DistributedAvatar.DistributedAvatar.hideHpText(self)
if self.sillySurgeText: if self.sillySurgeText:
self.nametag3d.clearDepthTest() self.nametag3d.clearDepthTest()
self.nametag3d.clearBin() 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.' 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!' 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!' CogdoExecutiveSuiteToonBye = 'Bye!'
SillySurgeTerms = {1: 'Amusing Ascent!', SillySurgeTerms = ['Amusing Ascent!',
2: 'Silly Surge!', 'Silly Surge!',
3: 'Ridiculous Rise!', 'Ridiculous Rise!',
4: 'Giggle Growth!', 'Giggle Growth!',
5: 'Funny Fueling!', 'Funny Fueling!',
6: 'Batty Boost!', 'Batty Boost!',
7: 'Crazy Climb!', 'Crazy Climb!',
8: 'Jolly Jump!', 'Jolly Jump!',
9: 'Loony Lift!', 'Loony Lift!',
10: 'Hilarity Hike!', 'Hilarity Hike!',
11: 'Insanity Increase!', 'Insanity Increase!',
12: 'Cracked-Uptick!'} 'Cracked-Uptick!']
InteractivePropTrackBonusTerms = {0: 'Super Toon-Up!', InteractivePropTrackBonusTerms = {0: 'Super Toon-Up!',
1: '', 1: '',
2: '', 2: '',