Пример #1
0
    def OnPlayerKilled(self, victim, killer, weapon):
        if victim == None:
            return
        # Disconnecting player_previous to prevent multiple penalties.
        flagindex = self.ft_flagindexbyplayer(victim)
        if flagindex >= 0:
            self.flaglist[flagindex].player_previous = 0
            GEUtil.EmitGameplayEvent("ld_flagdropped", str(victim.GetUserID()),
                                     str(killer.GetUserID()))

        vid = GEEntity.GetUID(victim)
        kid = GEEntity.GetUID(killer)
        ep_shout("[OPK] Victim %d, Killer %d, VFlag Index %d" %
                 (vid, kid, flagindex))
        bounty = min(self.flaglist[flagindex].earnings,
                     self.flaglist[flagindex].LEVEL_LIMIT)

        # Suicide
        if killer == None or killer.GetIndex(
        ) == 0 or vid == kid or GEMPGameRules.IsTeamplay(
        ) and victim.GetTeamNumber() == killer.GetTeamNumber():
            suicide_bounty = -choice(flagindex >= 0, bounty + bounty, 1)
            ep_incrementscore(victim, suicide_bounty)
            if flagindex >= 0:
                GEUtil.EmitGameplayEvent("ld_flagpoint",
                                         str(victim.GetUserID()), "-1",
                                         "suicide", str(suicide_bounty))
            return

        # slap and snatch TODO: Verify
        if weapon != None and weapon.GetClassname(
        ) == "weapon_slappers" and flagindex >= 0:
            delta = choice(flagindex >= 0, bounty, 0)
            if delta > 0:
                ep_incrementscore(victim, -delta)
                GEUtil.HudMessage(
                    victim, _(plural(delta, "#GES_GP_LD_LOSEPOINTS"), delta),
                    -1, -1, EP_SHOUT_COLOR, 2.0)
                ep_incrementscore(killer, delta)
                GEUtil.HudMessage(
                    killer, _(plural(delta, "#GES_GP_LD_STOLEPOINTS"), delta),
                    -1, -1, EP_SHOUT_COLOR, 2.0)
                GEUtil.EmitGameplayEvent("ld_flagpoint",
                                         str(victim.GetUserID()),
                                         str(killer.GetUserID()),
                                         "slapperkill", str(-delta))

        # credit if token will be removed from play. TODO: Verify
        if self.ft_flagdebt() < 0:
            if flagindex >= 0:
                ep_incrementscore(killer, self.flaglist[flagindex].level)
            else:
                ep_shout(
                    "[OPK] No flag index associated with slain carrier whose flag is removed."
                )
Пример #2
0
 def ft_perk_speed( self, flagindex ):
     if flagindex >= 0 and self.flaglist[flagindex].i_am_held():
         flag = self.flaglist[flagindex]
         player = ep_player_by_id( flag.player_id )
         perk = ( 1.0 + ( float( GEMPGameRules.GetNumActivePlayers() ) + ( float( flag.adrenaline ) * self.PERK_ADREN ) ) * self.PERK_SPEED ) ** 0.5
         ep_shout( "[Perk Speed] %f" % perk )
         player.SetSpeedMultiplier( min( perk, choice( GEMPGameRules.IsTeamplay(), 1.20, 1.35 ) ) )
Пример #3
0
    def OnTokenPicked(self, token, player):
        player.SetScoreBoardColor(GEGlobal.SB_COLOR_WHITE)
        GEMPGameRules.GetRadar().DropRadarContact(token)
        GEMPGameRules.GetRadar().AddRadarContact(
            player, GEGlobal.RADAR_TYPE_PLAYER, True, "sprites/hud/radar/run",
            choice(
                GEMPGameRules.IsTeamplay(),
                choice(player.GetTeamNumber() == GEGlobal.TEAM_MI6,
                       self.COLOR_H_MI, self.COLOR_H_JS), self.COLOR_HOLD))
        GEUtil.PlaySoundTo(player, "GEGamePlay.Token_Grab")
        GEUtil.EmitGameplayEvent("ld_flagpickup", str(player.GetUserID()))
        flagindex = self.ft_flagindexbytoken(token)
        if GEMPGameRules.IsTeamplay() and flagindex >= 0 and self.flaglist[
                flagindex].team_previous == player.GetTeamNumber():
            self.ft_associate(token, player)
        else:
            self.ft_coldflaglevel(self.ft_associate(token, player))

        # Support team colors!
        if GEMPGameRules.IsTeamplay():
            if player.GetTeamNumber() == GEGlobal.TEAM_MI6:
                skin = 1
                color = self.COLOR_MI6
            else:
                skin = 2
                color = self.COLOR_JS

            token.SetSkin(skin)
            GEMPGameRules.GetRadar().SetupObjective(player, GEGlobal.TEAM_NONE,
                                                    "!%s" % self.TokenClass,
                                                    "", color)
        else:
            GEMPGameRules.GetRadar().SetupObjective(player, GEGlobal.TEAM_NONE,
                                                    "!%s" % self.TokenClass,
                                                    "", self.COLOR_HOLD)

        health_coefficient = 2.0 * float(player.GetHealth() + player.GetArmor(
        )) / float(player.GetMaxHealth() + player.GetMaxArmor())
        player.SetHealth(int(GEGlobal.GE_MAX_HEALTH))
        player.SetArmor(int(GEGlobal.GE_MAX_ARMOR))
        # Suppress Armor pickup
        player.SetMaxArmor(0)
        self.flaglist[self.ft_flagindexbytoken(token)].age_item(
            3, health_coefficient)
        self.ft_teambalancebars()
        self.ft_showteamflags()
Пример #4
0
 def ft_perk_speed(self, flagindex):
     if flagindex >= 0 and self.flaglist[flagindex].i_am_held():
         flag = self.flaglist[flagindex]
         player = ep_player_by_id(flag.player_id)
         perk = (1.0 + (float(GEMPGameRules.GetNumActivePlayers()) +
                        (float(flag.adrenaline) * self.PERK_ADREN)) *
                 self.PERK_SPEED)**0.5
         ep_shout("[Perk Speed] %f" % perk)
         player.SetSpeedMultiplier(
             min(perk, choice(GEMPGameRules.IsTeamplay(), 1.20, 1.35)))
Пример #5
0
 def lld_baron_voodoo_recover( self, damage ):
     if GEUtil.GetCVarValue( self.CVAR_BLOODLUST ) == "0":
         return
     casts = self.lld_baron_voodoo_castsremaining()
     self.baron_voodoo += choice( damage >= 80, self.BARON_VOODOO_BLOODLUST_BODY, self.BARON_VOODOO_BLOODLUST_LIMB )
     self.baron_voodoo = clamp( self.baron_voodoo, 0, self.BARON_VOODOO_MAX )
     self.lld_baron_update_voodoobar()
     if casts < self.lld_baron_voodoo_castsremaining():
         baron = self.lld_Baron()
         if baron:
             GEUtil.PlaySoundTo( baron, "GEGamePlay.Token_Chime" )
Пример #6
0
 def lld_baron_update_voodoobar( self ):
     HUD_WIDTH = 80
     baron = self.lld_Baron()
     if baron:
         if self.baron_voodoo_recharge == 0:
             inflate = choice( GEUtil.GetCVarValue( self.CVAR_BLOODLUST ) != "0", 0, self.BARON_VOODOO_COST - 1 )
             width = choice( GEUtil.GetCVarValue( self.CVAR_BLOODLUST ) != "0", self.BARON_VOODOO_MAX, self.BARON_VOODOO_DEFAULT + inflate )
             casts = self.lld_baron_voodoo_castsremaining()
             if casts > 0:
                 barcolor = choice( self.baron_voodoo + inflate < self.BARON_VOODOO_MAX, self.BARON_PROGRESS_NORMAL, self.BARON_PROGRESS_FULL )
                 GEUtil.InitHudProgressBar( baron, 1, "%s\r%i" % ( self.CAPTION_VOODOO, casts ), GEGlobal.HUDPB_SHOWBAR, 1, -1, .72, 0, 0, barcolor )
                 GEUtil.InitHudProgressBar( baron, 0, "", GEGlobal.HUDPB_SHOWBAR, width, -1, .76, HUD_WIDTH, 10, barcolor )
             else:
                 GEUtil.InitHudProgressBar( baron, 1, self.CAPTION_EXHAUSTED, GEGlobal.HUDPB_SHOWBAR, 1, -1, .72, 0, 0, self.BARON_PROGRESS_EXHAUSTED )
                 GEUtil.InitHudProgressBar( baron, 0, "", GEGlobal.HUDPB_SHOWBAR, width, -1, .76, HUD_WIDTH, 10, self.BARON_PROGRESS_EXHAUSTED )
                 inflate = 0
             GEUtil.UpdateHudProgressBar( baron, 0, float( self.baron_voodoo + inflate ) )
         else:
             if self.baron_voodoo_recharge >= self.BARON_VOODOO_RECHARGE - 1:
                 GEUtil.InitHudProgressBar( baron, 1, choice( self.baron_voodoo > 0, self.CAPTION_REFRACTORY, self.CAPTION_EXHAUSTED ), GEGlobal.HUDPB_SHOWBAR, 1, -1, .72, 0, 0, self.BARON_PROGRESS_EXHAUSTED )
                 GEUtil.InitHudProgressBar( baron, 0, "", GEGlobal.HUDPB_SHOWBAR, self.BARON_VOODOO_RECHARGE - 1, -1, .76, HUD_WIDTH, 10, self.BARON_PROGRESS_EXHAUSTED )
             GEUtil.UpdateHudProgressBar( baron, 0, self.baron_voodoo_recharge )
Пример #7
0
    def OnPlayerKilled( self, victim, killer, weapon ):
        if victim == None:
            return
        # Disconnecting player_previous to prevent multiple penalties.
        flagindex = self.ft_flagindexbyplayer( victim )
        if flagindex >= 0:
            self.flaglist[flagindex].player_previous = 0
            GEUtil.EmitGameplayEvent( "ld_flagdropped", str( victim.GetUserID() ), str( killer.GetUserID() ) )

        vid = GEEntity.GetUID( victim )
        kid = GEEntity.GetUID( killer )
        ep_shout( "[OPK] Victim %d, Killer %d, VFlag Index %d" % ( vid, kid, flagindex ) )
        bounty = min( self.flaglist[flagindex].earnings, self.flaglist[flagindex].LEVEL_LIMIT )

        # Suicide
        if killer == None or killer.GetIndex() == 0 or vid == kid or GEMPGameRules.IsTeamplay() and victim.GetTeamNumber() == killer.GetTeamNumber():
            suicide_bounty = -choice( flagindex >= 0, bounty + bounty, 1 )
            ep_incrementscore( victim, suicide_bounty )
            if flagindex >= 0:
                GEUtil.EmitGameplayEvent( "ld_flagpoint", str( victim.GetUserID() ), "-1", "suicide", str( suicide_bounty ) )
            return

        # slap and snatch TODO: Verify
        if weapon != None and weapon.GetClassname() == "weapon_slappers" and flagindex >= 0:
            delta = choice( flagindex >= 0, bounty, 0 )
            if delta > 0:
                ep_incrementscore( victim, -delta )
                GEUtil.HudMessage( victim, _( plural( delta, "#GES_GP_LD_LOSEPOINTS" ), delta ), -1, -1, EP_SHOUT_COLOR, 2.0 )
                ep_incrementscore( killer, delta )
                GEUtil.HudMessage( killer, _( plural( delta, "#GES_GP_LD_STOLEPOINTS" ), delta ), -1, -1, EP_SHOUT_COLOR, 2.0 )
                GEUtil.EmitGameplayEvent( "ld_flagpoint", str( victim.GetUserID() ), str( killer.GetUserID() ), "slapperkill", str( -delta ) )

        # credit if token will be removed from play. TODO: Verify
        if self.ft_flagdebt() < 0:
            if flagindex >= 0:
                ep_incrementscore( killer, self.flaglist[flagindex].level )
            else:
                ep_shout( "[OPK] No flag index associated with slain carrier whose flag is removed." )
Пример #8
0
 def lld_progress( self ):
     if self.gamestate != self.GAMESTATE_SHUT and self.gamestate != self.GAMESTATE_OPEN:
         GEUtil.RemoveHudProgressBar( None, 3 )
     else:
         barcolor = choice( self.aug_holder != None, self.BARON_PROGRESS_NORMAL, self.BARON_PROGRESS_FULL )
         players_left = self.lld_num_inround_players() - 1
         if players_left > 1:
             GEUtil.InitHudProgressBar( GEGlobal.TEAM_NO_OBS, 3, "#GES_GP_FOES", GEGlobal.HUDPB_SHOWVALUE, self.bounty - 1, -1, self.PROGRESS_YLOC, 0, 10, barcolor, players_left )
             GEUtil.InitHudProgressBar( GEGlobal.TEAM_OBS, 3, "#GES_GP_FOES", GEGlobal.HUDPB_SHOWVALUE, self.bounty - 1, -1, self.PROGRESS_YLOC_OBS, 0, 10, barcolor, players_left )
         elif players_left == 1:
             GEUtil.InitHudProgressBar( GEGlobal.TEAM_NO_OBS, 3, "#GES_GP_SHOWDOWN", GEGlobal.HUDPB_SHOWBAR, self.bounty - 1, -1, self.PROGRESS_YLOC, 0, 10, barcolor )
             GEUtil.InitHudProgressBar( GEGlobal.TEAM_OBS, 3, "#GES_GP_SHOWDOWN", GEGlobal.HUDPB_SHOWBAR, self.bounty - 1, -1, self.PROGRESS_YLOC_OBS, 0, 10, barcolor )
         else:
             GEUtil.RemoveHudProgressBar( None, 3 )
Пример #9
0
    def CalculateCustomDamage( self, victim, info, health, armour ):
        impact = health + armour

        killer = GEPlayer.ToMPPlayer( info.GetAttacker() )
        if victim == None:
            return health, armour
        if killer == None or victim == killer:
            if self.lld_player_isbaron( victim ):
                armour = 0
                health = impact
            return health, armour
        if self.lld_player_isbaron( victim ) and killer != None:
            if ep_weapon_by_info( info ) == "weapon_golden_gun":
# Baron is hit with AuG
                self.baron_stats_hitbyaug += 1
                armour = 0
                health = impact * 0.02
                if health >= victim.GetHealth():
                    self.lld_eliminateplayer( victim )
            else:
                if impact >= victim.GetArmor():
# Baron is not eliminated, but is zeroed-out.
                    self.baron_health_cache = victim.GetHealth() + self.BARON_SPAWN_RECOVER
# TODO: Maybe move this to On Killed?
                    self.lld_baron_levelup()
                    self.baron_voodoo += choice( GEUtil.GetCVarValue( self.CVAR_BLOODLUST ) != "0", self.BARON_VOODOO_BLOODLUST_LEAD, 0 )
                    health = victim.GetHealth()
                    armour = victim.GetArmor()
                    return health, armour
                else:
# Baron is armor-damaged by player.
                    health = 0
                    armour = impact
                    return health, armour

        elif killer != None:
            if self.lld_player_isbaron( killer ):
# Player hit by Baron, test for bloodlust.
                if ep_weapon_by_info( info ) == self.BARON_MACHETE:
                    self.lld_baron_voodoo_recover( impact )

        return health, armour
Пример #10
0
    def OnTokenPicked( self, token, player ):
        player.SetScoreBoardColor( GEGlobal.SB_COLOR_WHITE )
        GEMPGameRules.GetRadar().DropRadarContact( token )
        GEMPGameRules.GetRadar().AddRadarContact( player, GEGlobal.RADAR_TYPE_PLAYER, True, "sprites/hud/radar/run", choice( GEMPGameRules.IsTeamplay(), choice( player.GetTeamNumber() == GEGlobal.TEAM_MI6, self.COLOR_H_MI, self.COLOR_H_JS ), self.COLOR_HOLD ) )
        GEUtil.PlaySoundTo( player, "GEGamePlay.Token_Grab" )
        GEUtil.EmitGameplayEvent( "ld_flagpickup", str( player.GetUserID() ) )
        flagindex = self.ft_flagindexbytoken( token )
        if GEMPGameRules.IsTeamplay() and flagindex >= 0 and self.flaglist[flagindex].team_previous == player.GetTeamNumber() :
            self.ft_associate( token, player )
        else:
            self.ft_coldflaglevel( self.ft_associate( token, player ) )

        # Support team colors!
        if GEMPGameRules.IsTeamplay():
            if player.GetTeamNumber() == GEGlobal.TEAM_MI6:
                skin = 1
                color = self.COLOR_MI6
            else:
                skin = 2
                color = self.COLOR_JS

            token.SetSkin( skin )
            GEMPGameRules.GetRadar().SetupObjective( player, GEGlobal.TEAM_NONE, "!%s" % self.TokenClass, "", color )
        else:
            GEMPGameRules.GetRadar().SetupObjective( player, GEGlobal.TEAM_NONE, "!%s" % self.TokenClass, "", self.COLOR_HOLD )

        health_coefficient = 2.0 * float( player.GetHealth() + player.GetArmor() ) / float( player.GetMaxHealth() + player.GetMaxArmor() )
        player.SetHealth( int( GEGlobal.GE_MAX_HEALTH ) )
        player.SetArmor( int( GEGlobal.GE_MAX_ARMOR ) )
        # Suppress Armor pickup
        player.SetMaxArmor( 0 )
        self.flaglist[self.ft_flagindexbytoken( token )].age_item( 3, health_coefficient )
        self.ft_teambalancebars()
        self.ft_showteamflags()