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

DruidsRPGcvs.DruidArtifactLightningRod


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
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
class DruidArtifactLightningRod extends ArtifactLightningRod
    config(UT2004RPG);

var config float CostPerHit;
var config float HealthMultiplier;
var config int MaxDamagePerHit;
var config int MinDamagePerHit;

state Activated
{
    function Timer()
    {
        local Controller C, NextC;
        local int DamageDealt;
        local xEmitter HitEmitter;
        local int lCost;

        if(Instigator == None || Instigator.Controller == None)
            return; //must have a controller when active. (Otherwise they're probably ghosting)

        //need to be moving for it to do anything... so can't just sit somewhere and camp
        if (VSize(Instigator.Velocity) ~= 0)
            return;

        C = Level.ControllerList;
        while (C != None)
        {
            // get next controller here because C may be destroyed if it's a nonplayer and C.Pawn is killed
            NextC = C.NextController;
            
            //Is this just some sort of weird unreal script bug? Sometimes C is None
            if(C == None)
            {
                C = NextC;
                break;
            }
            
            if ( C.Pawn != None && C.Pawn != Instigator && C.Pawn.Health > 0 && !C.SameTeamAs(Instigator.Controller)
                 && VSize(C.Pawn.Location - Instigator.Location) < TargetRadius && FastTrace(C.Pawn.Location, Instigator.Location) )
            {
                //deviation from Mysterial's class to figure out the damage and adrenaline drain.
                DamageDealt = max(min(C.Pawn.HealthMax * HealthMultiplier, MaxDamagePerHit), MinDamagePerHit);
                
                lCost = DamageDealt * CostPerHit;
                
                if(lCost < 1)
                    lCost = 1;
                
                if(lCost < Instigator.Controller.Adrenaline)
                {
                    //Is this just some sort of weird unreal script bug? Sometimes C is None
                    if(C == None)
                    {
                        C = NextC;
                        break;
                    }

                    C.Pawn.TakeDamage(DamageDealt, Instigator, C.Pawn.Location, vect(0,0,0), class'DamTypeEnhLightningRod');
                    Instigator.Controller.Adrenaline -=lCost;

                    //Is this just some sort of weird unreal script bug? Sometimes C is None
                    if(C == None)
                    {
                        C = NextC;
                        break;
                    }

                    HitEmitter = spawn(HitEmitterClass,,, Instigator.Location, rotator(C.Pawn.Location - Instigator.Location));
                    if (HitEmitter != None)
                        HitEmitter.mSpawnVecA = C.Pawn.Location;
                }
            }
            C = NextC;
        }
    }

    function BeginState()
    {
        SetTimer(0.5, true);
        bActive = true;
    }

    function EndState()
    {
        SetTimer(0, false);
        bActive = false;
    }
}

defaultproperties
{
     TargetRadius=2000.000000
     //The actual damage per hit is calculated off the base health of the target
     MaxDamagePerHit=100
     MinDamagePerHit=5
     HitEmitterClass=Class'XEffects.LightningBolt'
     //deviation from Mysterial's class This is the slow drain when nothing is occurring.
     CostPerSec=1
     //CostPerHit is the amount of adrenaline drained when you do a point of damage to a monster
     CostPerHit=0.150000
     //HealthMultiplier is the percentage of life that will be taken from a single hit of the LR.
     HealthMultiplier=0.100000
     PickupClass=Class'DruidArtifactLightningRodPickup'
     IconMaterial=Texture'UTRPGTextures.Icons.LightningIcon'
     ItemName="Lightning Rod"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Sat 22/7/2006 14:07:56.000 - Creation time: Wed 7/2/2007 19:16:37.500 - Created with UnCodeX