示例#1
0
    def chain_lightning(self, player):
        last_target = player
        targets = self._find_chain_players(player, 500, 3)

        if targets[0] == None:
            send_wcs_saytext_by_index(self._msg_failed, player.index)
            return

        for target in targets:
            if not target:
                continue
            target.take_damage(20 + 5 * self.level,
                               attacker_index=player.index,
                               skip_hooks=True)
            location1 = last_target.origin.copy()
            location2 = target.origin.copy()
            location1.z += 40
            location2.z += 40
            self.beam.create(start_point=location1,
                             end_point=location2,
                             halo=self.laser,
                             model=self.laser)
            last_target = target

        chain_sound.index = player.index
        chain_sound.origin = player.origin
        chain_sound.play()

        self.cooldowns['ultimate'] = 30

        send_wcs_saytext_by_index(self._msg_chain, player.index)
示例#2
0
    def roots(self, player):
        last_target = player
        targets = self._find_players_within(player, self.range)

        if len(targets) == 0:
            send_wcs_saytext_by_index(self._msg_failed, player.index)
            return

        for target in targets:
            if not target:
                continue
            target.stuck = True
            target.delay(self.duration,
                         target.__setattr__,
                         args=('stuck', False))
            location1 = last_target.origin.copy()
            location2 = target.origin.copy()
            location1.z += 40
            location2.z += 40
            self.beam2.create(start_point=location1,
                              end_point=location2,
                              halo=self.laser,
                              model=self.laser)
            last_target = target
            self.effect.create(center=target.origin)
            self.effect.create(center=target.origin, start_radius=80)

        root_sound.index = player.index
        root_sound.origin = player.origin
        root_sound.play()

        self.cooldowns['ultimate'] = 20

        send_wcs_saytext_by_index(self._msg_chain, player.index)
    def _on_player_ultimate(self, player, **eargs):
        if self.level == 0:
            return

        _cooldown = self.cooldowns['ultimate']
        if _cooldown <= 0:
            duration = (self.level * 0.5) + 1
            self._godmode = True
            Delay(duration, self.__setattr__, args=('_godmode', False))

            effect = Entity.create('env_sprite')

            location = player.origin
            location.z += 40
            effect.teleport(location, None, None)
            effect.add_output('model sprites/halo.vmt')
            effect.add_output('scale 10')
            effect.call_input('ShowSprite')
            attach_entity_to_player(player, effect)
            Delay(duration, self.kill_effect, args=(effect, ))

            send_wcs_saytext_by_index(self._msg_a.format(time=duration),
                                      player.index)

            godmode_sound.index = player.index
            godmode_sound.origin = player.origin
            godmode_sound.play()

            self.cooldowns['ultimate'] = 30
        else:
            send_wcs_saytext_by_index(self._msg_c.format(time=_cooldown),
                                      player.index)
    def _on_player_ability(self, player, **kwargs):
        if self.level == 0:
            return

        _cooldown = self.cooldowns['ability']
        if _cooldown <= 0:
            player.health = min(player.health + self.health, 150)
            send_wcs_saytext_by_index(self._msg_a.format(amount=self.health),
                                      player.index)

            location = player.origin
            location.z += 40
            self._effect = TempEntity('GlowSprite',
                                      model_index=self._model.index,
                                      life_time=0.8,
                                      amplitude=6,
                                      origin=location,
                                      scale=1.5,
                                      brightness=255)
            self._effect.create()

            heal_sound.index = player.index
            heal_sound.origin = location
            heal_sound.play()

            self.cooldowns['ability'] = 10

        else:
            send_wcs_saytext_by_index(self._msg_c.format(time=int(_cooldown)),
                                      player.index)
示例#5
0
 def health_boost(self, player):
     if player.health < 200:
         health = self.calc_health(player)
         player.health += health
         send_wcs_saytext_by_index(self._msg_healed.format(health=health),
                                   player.index)
         self.cooldowns['ultimate'] = 20
示例#6
0
    def _on_player_ultimate(self, player, **kwargs):
        if self.level == 0:
            return

        _cooldown = self.cooldowns['ultimate']
        if _cooldown <= 0:
            self._godmode = True
            Delay(self.duration, self.__setattr__, args=('_godmode', False))

            self.effect.create(life_time=self.duration, entity=player)

            send_wcs_saytext_by_index(self._msg_a.format(time=self.duration),
                                      player.index)
            Delay(self.duration - 1,
                  send_wcs_saytext_by_index,
                  args=(self._msg_b, player.index))

            godmode_sound.index = player.index
            godmode_sound.origin = player.origin
            godmode_sound.play()

            self.cooldowns['ultimate'] = (30 - self.level)
        else:
            send_wcs_saytext_by_index(self._msg_c.format(time=_cooldown),
                                      player.index)
示例#7
0
    def _on_player_attack(self, attacker, victim, **kwargs):
        if randint(0, 101) < self.chance:
            for index in attacker.weapon_indexes():
                break

            v1 = attacker.origin

            damaged = False

            for target in player_dict.values():
                if target.index == victim.index or target.team == attacker.team or target.dead:
                    continue

                v2 = target.origin

                if v1.get_distance(v2) < self.range:
                    ricochet = TempEntity('Armor Ricochet',
                                          position=victim.origin)
                    ricochet.create()
                    target.take_damage(self.damage,
                                       attacker_index=attacker.index,
                                       weapon_index=index,
                                       skip_hooks=True)
                    damaged = True

            if damaged:
                send_wcs_saytext_by_index(self._msg_a, attacker.index)
示例#8
0
    def _on_player_ultimate(self, player, **eargs):
        if self.level == 0:
            return

        _cooldown = self.cooldowns['ultimate']
        if _cooldown <= 0:
            if self._status:
                for weapon in player.weapons(not_filters='knife'):
                    self._weapons.append(weapon.class_name)
                player.restrict_weapons(*_knifeonly)
                player.speed = 1.5
                player.health += 15 * self.level
                color = player.color
                color.a = 255 - 20 * self.level
                player.color = color
                self._status = False
            else:
                player.unrestrict_weapons(*_knifeonly)
                for weapon in self._weapons:
                    player.delay(0.2,
                                 player.give_named_item,
                                 args=(weapon, 0, None, True))
                self._weapons.clear()
                player.speed = 1
                player.health = 100
                color = player.color
                color.a = 255
                player.color = color
                self._status = True
            self.cooldowns['ultimate'] = 10
        else:
            send_wcs_saytext_by_index(self._msg_c.format(time=_cooldown),
                                      player.index)
示例#9
0
    def _on_player_spawn(self, player, **kwargs):
        for target in player_dict.values():
            if target.team == player.team and not target.dead:
                target.health += self.health

        send_wcs_saytext_by_index(self._msg_spawn.format(health=self.health),
                                  player.index)
示例#10
0
    def _on_player_pre_victim(self, victim, info, **eargs):
        if randint(1, 100) > self._chance or self.level == 0:
            return

        send_wcs_saytext_by_index(self._msg_a.format(damage=info.damage),
                                  victim.index)
        info.damage = 0
示例#11
0
    def _on_player_spawn(self, attacker, victim, **kwargs):
        if self.level == 0 or randint(0, 101) > self.chance:
            return

        victim.set_property_int("m_iFOV", 500)
        victim.delay(0.5, attacker.set_property_int, args=("m_iFOV", 0))
        send_wcs_saytext_by_index(self._msg_flip, attacker.index)
示例#12
0
    def _on_player_use_ultimate(self, player, **eargs):
        if self.level == 0:
            return

        _cooldown = self.cooldowns['ultimate']
        if _cooldown <= 0:
            view_vector = player.view_vector
            origin = player.origin.copy()
            teleport_vector = origin + (view_vector * self.distance)
            origin.z += 50

            check1, check2 = self.validate_teleport(player, origin,
                                                    teleport_vector)

            if check1.did_hit() or check2.did_hit():
                teleport_vector = check1.end_position - (view_vector * 50)
                check3, check4 = self.validate_teleport(
                    player, origin, teleport_vector)
                if check3.did_hit() or check4.did_hit():
                    send_wcs_saytext_by_index(self._msg_f, player.index)
                else:
                    player.teleport(teleport_vector, None, None)
                    teleport_sound.play(player.index)
                    self.cooldowns['ultimate'] = self.cooldown
            else:
                player.teleport(teleport_vector, None, None)
                teleport_sound.play(player.index)
                self.cooldowns['ultimate'] = self.cooldown
        else:
            send_wcs_saytext_by_index(self._msg_c.format(time=_cooldown),
                                      player.index)
示例#13
0
    def _on_player_pre_attack(self, attacker, victim, **kwargs):
        if randint(1, 100) > 20 or self.cooldowns['blizzard'] > 0 or self.level == 0:
            return

        self._center = victim.origin
        self._player = attacker
        self._players_hit.clear()
        self._repeater = Repeat(self._repeat)
        self._repeater.start(0.1)

        self._effect = TempEntity('BeamRingPoint', center=self._center, start_radius=self.range,
            end_radius=self.range+1, model_index=self._model.index, halo_index=self._model.index,
            life_time=7, amplitude=10, red=200, green=200, blue=255, alpha=245, flags=0,
            start_width=10, end_width=10)
        self._effect.create()

        self._stack = Entity.create('env_smokestack')

        self._stack.teleport(self._center, QAngle(0, 180, 0), None)
        self._stack.base_spread = self.range / 2
        self._stack.spread_speed = 10
        self._stack.start_size = 2
        self._stack.end_size = 1
        self._stack.jet_length = 100
        self._stack.angles = QAngle(0, 0, 0)
        self._stack.rate = 600
        self._stack.speed = 100
        self._stack.twist = 180
        self._stack.render_mode = RenderMode.TRANS_COLOR
        self._stack.render_amt = 100
        self._stack.render_color = Color(200, 200, 255)
        self._stack.add_output('SmokeMaterial particle/rain.vmt')
        self._stack.turn_on()

        self._stack2 = Entity.create('env_smokestack')

        self._stack2.teleport(self._center, None, QAngle(0, 180, 0))
        self._stack2.base_spread = self.range / 4
        self._stack2.spread_speed = self.range / 2
        self._stack2.start_size = 2
        self._stack2.end_size = 1
        self._stack2.jet_length = 100
        self._stack2.angles = QAngle(0, 180, 0)
        self._stack2.rate = 600
        self._stack2.speed = 100
        self._stack2.twist = 120
        self._stack2.render_mode = RenderMode.TRANS_COLOR
        self._stack2.render_amt = 100
        self._stack2.render_color = Color(200, 200, 255)
        self._stack2.add_output('SmokeMaterial particle/rain.vmt')
        self._stack2.turn_on()

        send_wcs_saytext_by_index(self._msg_a.format(name=victim.name), attacker.index)

        self._stack.delay(7, self._stack.turn_off)
        self._stack2.delay(7, self._stack2.turn_off)
        Delay(7, self._repeater.stop)

        self.cooldowns['blizzard'] = 10
示例#14
0
    def _on_player_attack(self, attacker, victim, **kwargs):
        if randint(0, 101) > self.chance or self.level == 0:
            return

        Fade(self.duration - 2,
             self.duration - (self.level * 0.5)).send(victim.index)
        send_wcs_saytext_by_index(self._msg_blind.format(name=victim.name),
                                  attacker.index)
示例#15
0
    def _on_player_hurt_shake(self, attacker, victim, **eargs):
        if self.level == 0:
            return

        if randint(0, 101) <= self.level * 2:
            Shake(100, 1.5).send(victim.index)
            send_wcs_saytext_by_index(self._msg_a.format(name=victim.name),
                                      attacker.index)
示例#16
0
    def _on_any_death(self, player, **kwargs):
        if self.level == 0:
            return

        if self._should_respawn and player.team == self.parent.parent.team:
            send_wcs_saytext_by_index(self._msg_a, player.index)
            Delay(1, player.spawn)
            self._should_respawn = False
示例#17
0
    def _on_player_spawn(self, player, **kwargs):
        if self.level == 0:
            return

        self.repeater.start(self.duration)
        send_wcs_saytext_by_index(
            self._msg_a.format(health=self.health, duration=self.duration),
            player.index)
示例#18
0
    def _on_player_hurt_remove_invis(self, attacker, victim, **kwargs):
        if victim.color.a < 255 and randint(0, 101) < self.chance:
            color = victim.color
            color.a += 30 if color.a <= 225 else (255 - color.a)
            victim.color = color

            send_wcs_saytext_by_index(self._msg_a.format(name=victim.name),
                                      attacker.index)
            send_wcs_saytext_by_index(self._msg_b, victim.index)
示例#19
0
    def _on_player_pre_victim(self, victim, info, **kwargs):
        if randint(
                1, 101
        ) > self.chance or self.level == 0 or victim.hitgroup != HitGroup.HEAD:
            return

        send_wcs_saytext_by_index(self._msg_a.format(damage=info.damage),
                                  victim.index)
        info.damage = 0
示例#20
0
    def _on_player_spawn(self, player, **kwargs):
        if randint(0, 101) > self.chance or self.level == 0:
            return

        if player.team_index == 2:  ## Is Terrorist
            player.model = self._find_first_player_model(3)
        elif player.team_index == 3:  ## Is Counter-Terrorist
            player.model = self._find_first_player_model(2)
        send_wcs_saytext_by_index(self._msg_disguise, player.index)
    def _on_player_ultimate(self, player, **kwargs):
        if self.level == 0:
            return

        _cooldown = self.cooldowns['ultimate']
        if _cooldown <= 0:
            origin = player.eye_location
            view_vector = player.view_vector
            view_trace = self._get_trace(origin, origin + view_vector * 10000,
                                         ContentMasks.ALL, player, GameTrace())
            if view_trace.did_hit_world():
                wall = view_trace.end_position

            if origin.get_distance(wall) > 200:
                send_wcs_saytext_by_index(self._msg_f, player.index)
                return

            teleport_vector = None

            for i in range(1, 4):
                tmp_vector = wall + view_vector * (100 * i)
                tmp_trace = self._get_trace(tmp_vector, wall, ContentMasks.ALL,
                                            player, GameTrace())
                if tmp_trace.did_hit_world():
                    teleport_vector = tmp_trace.end_position + view_vector * 80
                    break

            if not teleport_vector:
                send_wcs_saytext_by_index(self._msg_f2, player.index)
                return

            teleport_vector.z -= 40

            safety_vector1 = safety_vector2 = teleport_vector
            safety_vector1.z += 80
            safety_vector1.x += 40
            safety_vector1.y -= 40
            safety_vector2.x -= 40
            safety_vector2.y += 40

            safety = self._get_trace(safety_vector1, safety_vector2,
                                     ContentMasks.ALL, player, GameTrace())

            if safety.did_hit_world():
                send_wcs_saytext_by_index(self._msg_f3, player.index)
                return

            if engine_trace.is_point_outside_of_world(teleport_vector):
                send_wcs_saytext_by_index(self._msg_f4, player.index)
                return

            player.teleport(teleport_vector, None, None)
            teleport_sound.play(player.index)
            self.cooldowns['ultimate'] = 10
        else:
            send_wcs_saytext_by_index(self._msg_c.format(time=_cooldown),
                                      player.index)
示例#22
0
    def _on_player_spawn(self, player, **kwargs):
        if self.level == 0:
            return

        for ally in PlayerIter():
            if ally.team == player.team:
                ally.cash = int(ally.cash * self.multiplier)
                send_wcs_saytext_by_index(self._msg_b.format(name=player.name, percent=100*self.multiplier), ally.index)

        send_wcs_saytext_by_index(self._msg_a, player.index)
示例#23
0
    def _on_player_pre_attack(self, attacker, victim, info, **kwargs):
        if victim.dead or randint(0,
                                  101) > (self.level + 7) or self.level == 0:
            return

        extra_damage = (5 + (self.level * 2))
        info.damage += extra_damage
        send_wcs_saytext_by_index(
            self._msg_a.format(damage=extra_damage, name=victim.name),
            attacker.index)
示例#24
0
    def _on_player_attack(self, player, victim, **eargs):
        if randint(0, 101) > 30 or self.level == 0:
            return

        victim.ignite_lifetime(self.level)

        send_wcs_saytext_by_index(self._msg_a.format(name=victim.name),
                                  player.index)
        send_wcs_saytext_by_index(self._msg_b.format(name=player.name),
                                  victim.index)
示例#25
0
    def _on_player_attack(self, player, victim, **eargs):
        if randint(0, 101) > (45 + (2 * self.level)) or self.level == 0:
            return

        victim.drop_weapon(victim.active_weapon.pointer, None, None)

        send_wcs_saytext_by_index(self._msg_a.format(name=victim.name),
                                  player.index)
        send_wcs_saytext_by_index(self._msg_b.format(name=player.name),
                                  victim.index)
示例#26
0
    def _on_player_pre_victim(self, attacker, victim, info, **eargs):
        if self.level == 0:
            return

        if victim.ground_entity == -1:
            info.damage *= 1 - 0.06 * self.level
            send_wcs_saytext_by_index(self._msg_a.format(name=attacker.name),
                                      victim.index)
            ricochet = TempEntity('Armor Ricochet', position=victim.origin)
            ricochet.create()
示例#27
0
    def _on_player_pre_attack(self, attacker, victim, info, **kwargs):
        if victim.dead or randint(0, 101) > self.chance or self.level == 0:
            return

        damage = randint(5, self.extra_damage)
        info.damage += damage
        send_wcs_saytext_by_index(
            self._msg_a.format(damage=damage, name=victim.name),
            attacker.index)
        self.effect.create(center=victim.origin)
示例#28
0
def _on_levelbank_players_choose(menu, index, choice):
    player_levelbank, amount = choice.value
    player_levelbank.levels += amount
    session.commit()

    send_wcs_saytext_by_index(
        f"{{PALE_GREEN}}You have given the user {amount} levels.", index)

    menu.description = f"Bank Levels: {player_levelbank.levels}"
    return menu
示例#29
0
    def _on_player_attack(self, attacker, victim, **kwargs):
        if randint(1, 100) > 30 or victim.cash < self._cash or self.level == 0:
            return

        victim.cash -= self._cash
        send_wcs_saytext_by_index(self._msg_a.format(cash=self._cash),
                                  victim.index)
        send_wcs_saytext_by_index(
            self._msg_b.format(cash=self._cash, name=victim.name),
            attacker.index)
示例#30
0
    def _on_player_ultimate(self, player, **kwargs):
        if self.level == 0 or self.ultimate_index == -1:
            send_wcs_saytext_by_index(self._msg_none, player.index)
            return

        _cooldown = self.cooldowns['ultimate']
        if _cooldown <= 0:
            self.ultimates[self.ultimate_index](player)
        else:
            send_wcs_saytext_by_index(self._msg_c.format(time=_cooldown),
                                      player.index)