Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

UT2004RPG.RW_Healing


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
class RW_Healing extends RPGWeapon
    HideDropDown
    CacheExempt;

static function bool AllowedFor(class<Weapon> Weapon, Pawn Other)
{
    local int x;
    local class<ProjectileFire> ProjFire;
    local RPGStatsInv StatsInv;

    // compatibility hack - old version clients don't have this class, so it's not allowed for them
    StatsInv = RPGStatsInv(Other.FindInventoryType(class'RPGStatsInv'));
    if (StatsInv != None && StatsInv.ClientVersion <= 12)
    {
        return false;
    }
    // if it's a team game, always allowed (no matter what it is player can use it to heal teammates)
    else if (Other.Level.Game.bTeamGame)
    {
        return true;
    }
    else
    {
        //otherwise only allowed on splash damage weapons
        for (x = 0; x < NUM_FIRE_MODES; x++)
            if (!ClassIsChildOf(Weapon.default.FireModeClass[x], class'InstantFire'))
            {
                ProjFire = class<ProjectileFire>(Weapon.default.FireModeClass[x]);
                if (ProjFire == None || ProjFire.default.ProjectileClass == None || ProjFire.default.ProjectileClass.default.DamageRadius > 0)
                {
                    return true;
                }
            }
    }

    return false;
}

function NewAdjustTargetDamage(out int Damage, int OriginalDamage, Actor Victim, vector HitLocation, out vector Momentum, class<DamageType> DamageType)
{
    local Pawn P;
    local int BestDamage;

    BestDamage = Max(Damage, OriginalDamage);
    if (BestDamage > 0)
    {
        P = Pawn(Victim);
        if (P != None && ( P == Instigator
                    || (P.Controller.IsA('FriendlyMonsterController') && FriendlyMonsterController(P.Controller).Master == Instigator.Controller)
                    || (P.GetTeam() == Instigator.GetTeam() && Instigator.GetTeam() != None) ) )
        {
            if (!bIdentified)
            {
                Identify();
            }
            P.GiveHealth(Max(1, BestDamage * (0.05 * Modifier)), P.HealthMax + 50);
            P.SetOverlayMaterial(ModifierOverlay, 1.0, false);
            Damage = 0;
            //I'd like to give EXP here, but some people would exploit it :(
        }
    }

    Super.NewAdjustTargetDamage(Damage, OriginalDamage, Victim, HitLocation, Momentum, DamageType);
}

defaultproperties
{
     ModifierOverlay=Shader'UTRPGTextures2.Overlays.PulseBlueShader1'
     MinModifier=1
     MaxModifier=3
     AIRatingBonus=0.020000
     PrefixPos="Healing "
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Sat 15/7/2006 17:15:16.000 - Creation time: Wed 7/2/2007 19:16:50.609 - Created with UnCodeX