Пример #1
0
    def __init__(self, air, dispatch):
        DistributedAvatarAI.__init__(self, air)
        BaseNPCAI.__init__(self, dispatch)
        self.setDispatch(dispatch)

        self.patrolTime = 0.0
        self.patrolDur = 10.0

        self.activities = {
            ACT_WAKE_ANGRY: 2.0,
            ACT_DIE: -1,
            ACT_GOON_SCAN: 6.0
        }

        self.schedules.update({
            "SCAN_AREA":
            Schedule([
                Task_StopMoving(self),
                Task_GetRandomPath(self),
                Task_RunPath(self),
                Task_AwaitMovement(self),
                Task_SetActivity(self, ACT_GOON_SCAN),
                Task_AwaitActivity(self)
            ],
                     interruptMask=COND_NEW_TARGET | COND_LIGHT_DAMAGE
                     | COND_HEAVY_DAMAGE)
        })

        self.brain = None
        self.spawnflags = 0

        self.health = 25
        self.maxHealth = 25
    def __init__(self, air):
        try:
            self.DistributedToonAI_initialized
            return
        except:
            self.DistributedToonAI_initialized = 1
        DistributedAvatarAI.__init__(self, air)
        ToonDNA.ToonDNA.__init__(self)
        self.avatarType = CIGlobals.Toon
        self.anim = "Happy"
        self.chat = ""
        self.health = 50
        self.height = 3
        self.gender = "boy"
        self.headtype = "dgm_skirt"
        self.head = "dog"
        self.legtype = "dgm"
        self.torsotype = "dgm_shorts"
        self.hr = 1
        self.hg = 1
        self.hb = 1
        self.tr = 1
        self.tg = 1
        self.tb = 1
        self.lr = 1
        self.lg = 1
        self.lb = 1
        self.shir = 1
        self.shig = 1
        self.shib = 1
        self.shor = 1
        self.shog = 1
        self.shob = 1
        self.shirt = "phase_3/maps/desat_shirt_1.mat"
        self.short = "phase_3/maps/desat_shorts_1.mat"
        self.sleeve = "phase_3/maps/desat_sleeve_1.mat"
        self.isdying = False
        self.isdead = False
        self.toon_legs = None
        self.toon_torso = None
        self.toon_head = None
        self.lookMode = 2  # LMOff

        self.activities = {
            ACT_DIE: 7.0,
            ACT_VICTORY_DANCE: 5.125,
            ACT_TOON_BOW: 4.0,
            ACT_JUMP: 2.5
        }

        return
Пример #3
0
 def __init__(self, air):
     DistributedAvatarAI.__init__(self, air)
     DistributedSmoothNodeAI.__init__(self, air)
     self.owner = 0
     self.mgr = None
     
     # This is to optimize the turrets.
     self.targets = []
     self.shooting = False
     
     # This is for abandoning targets.
     self.initialTargetHealth = 0
     self.piesShot = 0
     self.currentTarget = None
     self.deathEvent = None
 def __init__(self, air, charId):
     DistributedAvatarAI.__init__(self, air)
     self.fsm = ClassicFSM('DDCharAI',
                           [State('off', self.enterOff, self.exitOff),
                            State('neutral', self.enterNeutral, self.exitNeutral),
                            State('walking', self.enterWalking, self.exitWalking)],
                           'off', 'off')
     self.fsm.enterInitialState()
     self.charId = charId
     self.avatars = []
     self.inConvo = False
     self.chatsThisConvo = 0
     self.toonOfInterest = 0
     self.saidGoodbye = False
     self.currentPointLetter = None
     self.lastPointLetter = None
     self.talkEnabled = True
Пример #5
0
    def __init__(self, air, dispatch):
        DistributedAvatarAI.__init__(self, air, dispatch)
        BaseNPCAI.__init__(self, dispatch)

        self.activities = {ACT_RANGE_ATTACK1: 2.5}

        self.died = False

        self.laserVec = [Vec3(0), Vec3(0)]

        self.schedules.update({
            "RANGE_ATTACK1":
            Schedule([
                Task_StopMoving(self),
                Task_StopAttack(self),
                Task_FaceTarget(self),
                Task_SetActivity(self, ACT_RANGE_ATTACK1),
                Task_Func(self.setupLaserVec),
                Task_Wait(0.635),
                Task_Func(self.fireLaser),
                Task_AwaitActivity(self)
            ],
                     interruptMask=COND_SCHEDULE_DONE | COND_TASK_FAILED)
        })

        self.patrolTime = 0.0
        self.patrolDur = 10.0

        self.surfaceProp = "metal"

        self.health = 25
        self.maxHealth = 25

        self.hatType = 0
        self.idealEyeColor = self.IdleEyeColor

        self.didFadeOut = False

        # height
        self.hitboxData[2] = 4.0
Пример #6
0
    def __init__(self, air):
        try:
            self.DistributedToonAI_initialized
            return
        except:
            self.DistributedToonAI_initialized = 1
        DistributedAvatarAI.__init__(self, air)
        ToonDNA.ToonDNA.__init__(self)
        self.avatarType = CIGlobals.Toon
        self.anim = "Happy"

        self.lookMode = 2  # LMOff

        # Eyes stuff
        self.eyeLensNP = None
        self.eyeTarget = None
        self.targetIsNew = True
        self.lastEyeTarget = None
        self.eyeTargetLastPos = Point3(0)
        self.eyeTargetBoredTime = 0.0
        self.eyeTargetLastMove = 0
        self.eyeTargetTime = 0
        self.eyeStateTime = 0
        self.eyeState = ToonGlobals.EyeStateOpened
        self.eyesOpenDuration = 5
        self.eyeLookType = self.EyeLookType_Auto

        self.activities = {
            ACT_DIE: 7.0,
            ACT_VICTORY_DANCE: 5.125,
            ACT_TOON_BOW: 4.0,
            ACT_JUMP: 2.5,
            ACT_TOON_POINT: 10.0,
            ACT_TOON_PRESENT: 10.0,
            ACT_PRESS_BUTTON: 10.0,
            ACT_TOON_FALL: 2.5
        }

        return
Пример #7
0
    def __init__(self, air):
        DistributedAvatarAI.__init__(self, air)
        BaseNPCAI.__init__(self)
        self.track = None
        self.suitPlan = 0
        self.variant = Variant.NORMAL
        self.level = 0
        self.animStateChangeEvent = SuitGlobals.animStateChangeEvent

        self.surfaceProp = "metal"

        # This is for handling death.
        self.deathAnim = None
        self.deathTimeLeft = 0
        self.deathTaskName = None

        # This is for handling combos.
        # Combo data stores an avId and gag type pair.
        # Avatar Ids are cheaper to store, so we use those.
        # comboDataTaskName is the name of the task that clears the data.
        self.comboData = {}
        self.comboDataTaskName = None
        self.clearComboDataTime = 3
        self.showComboDamageTime = 0.75

        # These variables are for handling gag weaknesses.
        self.showWeaknessBonusDamageTime = 0.50

        # The variable that stores the special sequence that handles tactical attacks.
        self.tacticalSeq = None

        self.allowHits = True
        self.firstTimeDead = True
        self.stunned = False

        self.damagers = []

        from src.coginvasion.attack.Attacks import ATTACK_CLIPONTIE, ATTACK_BOMB, ATTACK_PICKPOCKET, ATTACK_FIRED, ATTACK_HALF_WINDSOR
        from src.coginvasion.attack.Attacks import ATTACK_EVIL_EYE, ATTACK_RED_TAPE, ATTACK_SACKED, ATTACK_HARDBALL, ATTACK_MARKET_CRASH
        from src.coginvasion.attack.Attacks import ATTACK_BITE

        self.attackIds = [
            ATTACK_RED_TAPE, ATTACK_CLIPONTIE, ATTACK_BOMB, ATTACK_PICKPOCKET,
            ATTACK_FIRED, ATTACK_EVIL_EYE, ATTACK_SACKED, ATTACK_HARDBALL,
            ATTACK_MARKET_CRASH, ATTACK_HALF_WINDSOR, ATTACK_BITE
        ]

        self.activities = {
            ACT_WAKE_ANGRY: 0.564,
            ACT_SMALL_FLINCH: 2.25,
            ACT_DIE: 6.0,
            ACT_VICTORY_DANCE: 9.0,
            ACT_COG_FLY_DOWN: 6.834
        }

        self.schedules.update({
            "VICTORY_TAUNT":
            Schedule([
                Task_StopMoving(self),
                Task_StopAttack(self),
                Task_Speak(self, 0.5, [
                    "Aha, Toon! You thought you could get past me!",
                    "Caught tweakin, jit!",
                    "I told you it was my turn to play on the XBOX!"
                ]),
                Task_SetActivity(self, ACT_VICTORY_DANCE),
                Task_AwaitActivity(self)
            ],
                     interruptMask=COND_LIGHT_DAMAGE | COND_HEAVY_DAMAGE),
            "SUPA_FLY_IN_MOVE":
            Schedule([
                Task_StopMoving(self),
                Task_StopAttack(self),
                Task_GetFlyDownPath(self),
                Task_SetActivity(self, ACT_COG_FLY_DOWN),
                Task_RunPath(self),
                Task_AwaitMovement(self, changeYaw=False),
                Task_AwaitActivity(self),
                Task_Func(self.resetFwdSpeed)
            ],
                     interruptMask=COND_SCHEDULE_DONE | COND_TASK_FAILED)
        })
 def __init__(self, air):
     try:
         self.DistributedToonAI_initialized
         return
     except:
         self.DistributedToonAI_initialized = 1
     DistributedAvatarAI.__init__(self, air)
     DistributedSmoothNodeAI.__init__(self, air)
     ToonDNA.ToonDNA.__init__(self)
     self.questManager = QuestManagerAI(self)
     self.avatarType = CIGlobals.Toon
     self.money = 0
     self.anim = "neutral"
     self.chat = ""
     self.health = 50
     self.damage = 0
     self.height = 3
     self.gender = "boy"
     self.headtype = "dgm_skirt"
     self.head = "dog"
     self.legtype = "dgm"
     self.torsotype = "dgm_shorts"
     self.hr = 1
     self.hg = 1
     self.hb = 1
     self.tr = 1
     self.tg = 1
     self.tb = 1
     self.lr = 1
     self.lg = 1
     self.lb = 1
     self.shir = 1
     self.shig = 1
     self.shib = 1
     self.shor = 1
     self.shog = 1
     self.shob = 1
     self.shirt = "phase_3/maps/desat_shirt_1.jpg"
     self.short = "phase_3/maps/desat_shorts_1.jpg"
     self.sleeve = "phase_3/maps/desat_sleeve_1.jpg"
     self.isdying = False
     self.isdead = False
     self.toon_legs = None
     self.toon_torso = None
     self.toon_head = None
     self.portal = None
     self.book = None
     self.token = -1
     self.ghost = 0
     self.attackers = []
     self.puInventory = []
     self.equippedPU = -1
     self.backpack = BackpackAI(self)
     self.quests = ""
     self.questHistory = []
     self.tier = -1
     self.friends = []
     self.tutDone = 0
     self.hoodsDiscovered = []
     self.teleportAccess = []
     self.lastHood = 0
     self.defaultShard = 0
     self.numGagSlots = 0
     self.trackExperience = dict(GagGlobals.DefaultTrackExperiences)
     return
Пример #9
0
    def __init__(self, air, dispatch=None):
        DistributedAvatarAI.__init__(self, air, dispatch)
        BaseNPCAI.__init__(self, dispatch)
        self.torsoYaw = 0.0

        self.name = "Senior V.P.\nSellbot"

        self.surfaceProp = "metal"

        self.schedules.update({
            "OPENING_SPEECH":
            Schedule([
                Task_Func(self.setCanStun, [False]),
                Task_Wait(3.0),
                Task_FaceIdeal(self),
                Task_Speak(self, 1.0, [
                    "What's this?! The captive has escaped! I order you back to your cage!"
                ]),
                Task_Wait(3.0),
                Task_Func(self.makeIdealYawToPlayer),
                Task_FaceIdeal(self),
                Task_Speak(self, 1.0,
                           ["And who is this? How did you get in here?!"]),
                Task_Wait(3.0),
                Task_Speak(self, 1.0, ["Wait a minute, they have Gags!"]),
                Task_Wait(2.5),
                Task_Speak(self, 1.0, ["Cogs... ATTACK!!"]),
                Task_Wait(2.0),
                Task_Func(self.dispatchOutput, ["OnFinishOpeningSpeech"]),
                Task_Func(self.setCanStun, [True]),
                Task_SuggestState(self, STATE_IDLE)
            ],
                     interruptMask=COND_SCHEDULE_DONE | COND_TASK_FAILED),
            "RANGE_ATTACK1":
            Schedule([
                Task_StopMoving(self),
                Task_StopAttack(self),
                Task_FaceTarget(self),
                Task_SetActivity(self, ACT_VP_THROW),
                Task_Wait(0.15),
                Task_Func(self.throwGearsAtTarget),
                Task_AwaitActivity(self)
            ]),
            "RANGE_ATTACK2":
            Schedule([
                Task_StopMoving(self),
                Task_StopAttack(self),
                Task_SetActivity(self, ACT_RANGE_ATTACK2),
                Task_Func(self.emitJumpSound),
                Task_Wait(1.25),
                Task_Func(self.doJump),
                Task_AwaitActivity(self)
            ],
                     interruptMask=COND_SCHEDULE_DONE | COND_TASK_FAILED),
            "DAMAGE_REACT":
            Schedule([
                Task_Func(self.setCanStun, [False]),
                Task_StopMoving(self),
                Task_StopAttack(self),
                Task_SetActivity(self, ACT_VP_DAMAGE_REACT),
                Task_AwaitActivity(self),
                Task_SetActivity(self, ACT_NONE),
                Task_Func(self.setCanStun, [True])
            ],
                     interruptMask=COND_SCHEDULE_DONE | COND_TASK_FAILED),
            "STUN":
            Schedule([
                Task_Func(self.setStunned, [True]),
                Task_StopMoving(self),
                Task_StopAttack(self),
                Task_SetActivity(self, ACT_VP_STUN),
                Task_AwaitActivity(self),
                Task_SetActivity(self, ACT_NONE),
                Task_Func(self.setStunned, [False])
            ],
                     interruptMask=COND_SCHEDULE_DONE | COND_TASK_FAILED),
            "DIE":
            Schedule([
                Task_StopMoving(self),
                Task_StopAttack(self),
                Task_SetActivity(self, ACT_DIE),
                Task_MakeExplosions(self),
                Task_AwaitActivity(self),
                Task_Func(self.requestDelete)
            ],
                     interruptMask=COND_SCHEDULE_DONE | COND_TASK_FAILED),
        })

        self.isStunned = False
        self.canStun = True
        self.currStunDamage = 0

        self.actTable = {ACT_NONE: ACT_IDLE}
        self.activities = {
            ACT_VP_THROW: 0.833333333333,
            ACT_IDLE: -1,
            ACT_NONE: -1,
            ACT_VP_DAMAGE_REACT: 5.5,
            ACT_VP_STUN: 10.0,
            ACT_DIE: 3.5,
            ACT_RANGE_ATTACK2: 3.0
        }

        self.setHeight(5)
        self.hitboxData[1] = 10

        self.version = 1

        self.lastSpawnTime = 0.0
        self.spawnIval = 0.0
        self.doorTime = 0.0
        self.doorState = 0

        self.maxSuits = 5
        self.numSuits = 0

        self.lastAttackTime = 0.0
        self.attackIval = 0.0

        self.idealYaw = 180