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

DruidsRPGcvs.DamageInv


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
class DamageInv extends Inventory;

var RPGRules Rules;
var int ExpPerSecond;
var vector CoreLocation;
var Controller DamagePlayerController;
var float EffectRadius;
var Material EffectOverlay;

replication
{
    reliable if (bNetInitial && Role == ROLE_Authority)
        DamagePlayerController,CoreLocation;
}

simulated function PostBeginPlay()
{
    Super.PostBeginPlay();

    SetTimer(1, true);
}

function SwitchOffDamage()
{
    // need to switch off invulnerability if we are the only source for this player
    // no other sphere will have started while we were running
    // if he started the globe, tough luck

    Pawn(Owner).DisableUDamage();
    if (PlayerController(Pawn(Owner).Controller) != None)
    {
        PlayerController(Pawn(Owner).Controller).ReceiveLocalizedMessage(class'DamageConditionMessage', 1);
    }
    Pawn(Owner).SetOverlayMaterial(EffectOverlay, -1, true);
}

simulated function Timer()
{
    local ArtifactSphereDamage InitiatingSphere;
    if (Role == ROLE_Authority)
    {

        if ((Owner == None) || (DamagePlayerController == None) || (Pawn(Owner) == None) || (Pawn(Owner).Controller == None))
        {   // got problems.
            Destroy();
            return;
        }

        if (!Pawn(Owner).HasUDamage())
        {   // if the owner hasn't got udamage anymore, then not active, so destroy
            Destroy();
            return;
        }

        if ((DamagePlayerController.Pawn == None) || (DamagePlayerController.Pawn.Health <= 0) || !DamagePlayerController.Pawn.HasUDamage() )
        {   // initiating player hasn't got udamage anymore, so artifact must have stopped
            SwitchOffDamage();
            Destroy();
            return;
        }

        // lets find the artifact
        InitiatingSphere = ArtifactSphereDamage(DamagePlayerController.Pawn.FindInventoryType(class'ArtifactSphereDamage'));

        // ok, lets check if still in range and artifact still active
        if ((VSize(Pawn(Owner).Location - CoreLocation) > EffectRadius) || (InitiatingSphere == None) || (!InitiatingSphere.bActive))
        {   // now out of range
            SwitchOffDamage();
            Destroy();
            return;
        }

        // ok, lets see if the initiator gets any xp
        if ((ExpPerSecond > 0) && (Rules != None))
        {
            Rules.ShareExperience(RPGStatsInv(DamagePlayerController.Pawn.FindInventoryType(class'RPGStatsInv')), ExpPerSecond);
        }
    }

    //dont call super. Bad things will happen.
}

defaultproperties
{
     EffectOverlay=Shader'XGameShaders.PlayerShaders.WeaponUDamageShader'
     bOnlyRelevantToOwner=False
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Sat 30/9/2006 20:30:50.000 - Creation time: Wed 7/2/2007 19:16:36.234 - Created with UnCodeX