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

DruidsRPGcvs.AbilityLoadedMonsters


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
class AbilityLoadedMonsters extends RPGAbility
    config(UT2004RPG)
    abstract;

struct MonsterConfig
{
    Var String FriendlyName;
    var Class<Monster> Monster;
    var int Adrenaline;
    var int MonsterPoints;
    var int Level;
};

var config Array<MonsterConfig> MonsterConfigs;

static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
{
    local bool ok;
    local int x;

    for (x = 0; x < Data.Abilities.length; x++)
        if (Data.Abilities[x] == class'ClassMonsterMaster')
            ok = true;
    if(!ok)
    {
        if(CurrentLevel > 0)
            log("Warning:"@data.Name@"has"@default.class@"Level"@CurrentLevel@"but does not have an associated Class to allow them to purchase it");
        return 0;
    }

    return super.Cost(Data, CurrentLevel);
}

static function ModifyPawn(Pawn Other, int AbilityLevel)
{
    local int i;
    local LoadedInv LoadedInv;
    Local RPGArtifact Artifact;
    Local bool PreciseLevel;

    LoadedInv = LoadedInv(Other.FindInventoryType(class'LoadedInv'));

    if(LoadedInv != None)
    {
        if(LoadedInv.type != 'Monsters')
        {
            LoadedInv.Destroy(); 
        }
        else if(LoadedInv.AbilityLevel != AbilityLevel)
        {
            LoadedInv.Destroy();//for when they buy a new level of this skill
            PreciseLevel = true; //only giving artifacts for this level.
        }
        else
        {
            return;
        }
    }

    LoadedInv = Other.spawn(class'LoadedInv');

    if(LoadedInv == None)
        return;

    LoadedInv.type = 'Monsters';
    LoadedInv.AbilityLevel = AbilityLevel;
    LoadedInv.GiveTo(Other);

    for(i = 0; i < Default.MonsterConfigs.length; i++)
    {
        if(Default.MonsterConfigs[i].Monster != None) //make sure the object is sane.
        {
            if(PreciseLevel && Default.MonsterConfigs[i].Level != AbilityLevel) //checkertrap for purchases during a game.
                continue;
            if(Default.MonsterConfigs[i].Level <= AbilityLevel)
            {
                Artifact = Other.spawn(class'DruidMonsterMasterArtifactMonsterSummon', Other,,, rot(0,0,0));
                if(Artifact == None)
                    continue; // wow.
                DruidMonsterMasterArtifactMonsterSummon(Artifact).Setup(Default.MonsterConfigs[i].FriendlyName, Default.MonsterConfigs[i].Monster, Default.MonsterConfigs[i].Adrenaline, Default.MonsterConfigs[i].MonsterPoints);
                Artifact.GiveTo(Other);
            }
        }
    }

    if(!PreciseLevel)
    {
        Artifact = Other.spawn(class'ArtifactKillAllPets', Other,,, rot(0,0,0));
        Artifact.GiveTo(Other);
        Artifact = Other.spawn(class'ArtifactKillOnePet', Other,,, rot(0,0,0));
        Artifact.GiveTo(Other);
    }
// I'm guessing that NextItem is here to ensure players don't start with
// no item selected.  So the if should stop wierd artifact scrambles.
    if(Other.SelectedItem == None)
        Other.NextItem();
}

defaultproperties
{
     AbilityName="Loaded Monsters"
     Description="Learn new monsters to summon with Monster Points. At each level, you can summon a better monster. (Max Level: 15)|You must be a Monster Master to purchase this skill.|Cost (per level): 2,3,4,5,6,7,8,9,10,11,12,13,14,15,16"
     StartingCost=2
     CostAddPerLevel=1
     MaxLevel=15
//I assume you'll either use the provided config, or come up with your own. This one is provided as reference.
     MonsterConfigs(0)=(FriendlyName="Pupae",Monster=Class'SkaarjPack.SkaarjPupae',Adrenaline=15,MonsterPoints=1,Level=1)
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Thu 19/10/2006 15:22:14.000 - Creation time: Wed 7/2/2007 19:16:32.125 - Created with UnCodeX