示例#1
0
    def CalculateCustomDamage(self, victim, info, health, armour):
        killer = GEPlayer.ToMPPlayer(info.GetAttacker())
        target = GEEntity.GetUniqueId(victim)
        killerid = GEEntity.GetUniqueId(GEPlayer.ToMPPlayer(
            info.GetAttacker()))
        red = victim.GetHealth()
        combo = health + armour

        if info.GetWeapon() is not None:
            attackerwep = (info.GetWeapon()).GetClassname()
        else:
            attackerwep = "explosive"

        if killerid != target and killer is not None:
            damage = self.FindWeaponDamage(combo, attackerwep)
            victim.SetHealth(int(red - damage))

        else:
            return

        armour = 0
        health = 0
        return health, armour
    def CalculateCustomDamage(self, victim, info, health, armor):
        killer = GEPlayer.ToMPPlayer(info.GetAttacker())
        killerid = GEEntity.GetUniqueId(GEPlayer.ToMPPlayer(
            info.GetAttacker()))
        target = GEEntity.GetUniqueId(victim)
        damage = health + armor
        health = 0

        # Full world damage
        if killer is None:
            armor = damage
        elif killerid == target:  # Half self-damage so I can ~rocket jump~
            armor = damage / 2

        # Have to do this here instead of "CanPlayerHaveItem" since if we do it there we don't actually pick the armor up.
        # This method's main purpose is to color the armor bar red, as an indicator to the player they can't pick up any more armor.
        if self.pltracker.GetValue(victim, ARMORKILLS) < self.KillsPerArmor:
            victim.SetMaxArmor(0)

        # We ran out of armor!  Time to die.
        if victim.GetArmor() <= armor:
            health = 160

        return health, armor