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

DruidsRPGcvs.DruidGhost


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
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
class DruidGhost extends RPGDeathAbility
    abstract
    config(UT2004RPG);

var config int level1;
var config int level2;
var config int level3;

static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
{
    local int x;
    if(Data == None)
        return 0;

    if (Data.HealthBonus < 200 || Data.Defense < 50)
        return 0;
    for (x = 0; x < Data.Abilities.length; x++)
        if (Data.Abilities[x] == class'AbilityUltima')
            return 0;
        else if (Data.Abilities[x] == class'AbilityGhost')
            return 0;


    if (CurrentLevel == 0)
        return default.level1;
    if (CurrentLevel == 1)
        return default.level2;
    if (CurrentLevel == 2)
        return default.level3;
    return 0;
}

static function bool GenuinePreventDeath(Pawn Killed, Controller Killer, class<DamageType> DamageType, vector HitLocation, int AbilityLevel)
{
    local DruidGhostInv Inv;
    local Vehicle V;

    Local NullEntropyInv NInv;
    Local KnockbackInv KInv;

    //Deviation from Mysterial's code. I dont think I need this.
    //if (Killed.Location.Z < Killed.Region.Zone.KillZ || Killed.PhysicsVolume.IsA('ConvoyPhysicsVolume'))
    //	return false;

    //spacefighters destroy all their inventory on possess, so if we do anything here it will never die
    //because our marker will get destroyed afterward
    if ( Killed.IsA('ASVehicle_SpaceFighter')
         || (Killed.DrivenVehicle != None && Killed.DrivenVehicle.IsA('ASVehicle_SpaceFighter')) )
        return false;

    //this ability doesn't work with SVehicles or any kind of turret (can't change their physics)

// Okay um.  This seems to work for monsters!  Fix that!
    if (Killed.IsA('Monster'))
        return false;

    if (Killed.bStationary || Killed.IsA('SVehicle'))
    {
        //but maybe we can save the driver!
        V = Vehicle(Killed);
        if (V != None && !V.bRemoteControlled && !V.bEjectDriver && V.Driver != None)
            V.Driver.Died(Killer, DamageType, HitLocation);
        return false;
    }

    Inv = DruidGhostInv(Killed.FindInventoryType(class'DruidGhostInv'));
    if (Inv != None)
        return false;

    //ability won't work if pawn is still attached to the vehicle
    if (Killed.DrivenVehicle != None)
    {
        Killed.Health = 1; //so vehicle will properly kick pawn out
        Killed.DrivenVehicle.KDriverLeave(true);
    }

// ULTIMA REMOVED.  Shouldn't be needed in RPGDeathAbility.
    
    KInv = KnockbackInv(Killed.FindInventoryType(class'KnockbackInv'));
    if(KInv != None)
    {
        KInv.PawnOwner = None;
        KInv.Destroy();
    }
    NInv = NullEntropyInv(Killed.FindInventoryType(class'NullEntropyInv'));
    if(NInv != None)
    {
        NInv.PawnOwner = None;
        NInv.Destroy();
    }   

    Inv = Killed.spawn(class'DruidGhostInv', Killed,,, rot(0,0,0));
    Inv.OwnerAbilityLevel = AbilityLevel;
    Inv.GiveTo(Killed);
    return true;
}

static function bool PreventSever(Pawn Killed, name boneName, int Damage, class<DamageType> DamageType, int AbilityLevel)
{
    local DruidGhostInv Inv;

    Inv = DruidGhostInv(Killed.FindInventoryType(class'DruidGhostInv'));
    if (Inv != None)
        return false;

    return true;
}

defaultproperties
{
    AbilityName="Ghost"
     level1=40
     level2=25
     level3=20
     Description="The first time each spawn that you take damage that would kill you, instead of dying you will become non-corporeal and move to a new location, where you will continue your life. At level 1 you will move slowly as a ghost and return with a health of 1. At level 2 you will move somewhat more quickly and will return with 100 health. At level 3 you will move fastest and will return with your normal starting health. You need to have at least 200 Health Bonus and 50 Damage Reduction to purchase this ability. (Max Level: 3)|Cost (per level): 40,25,20"
    MaxLevel=3
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 23/10/2006 14:16:12.000 - Creation time: Wed 7/2/2007 19:16:37.671 - Created with UnCodeX