Christmas Patriarch

KF Random Zeds Mutator. Мутатор случайных зомби

Данный мутатор выбирает случайный набор зомби для каждой карты. Используются разнообразные эвент зомби (Цирк, Хеллоуин, Рождество)

class KFMutRandomZEDS extends Mutator;
function PostBeginPlay()
{
    SetTimer(0.1,false);
}
function PreBeginPlay()
{
    local float r;
    AddToPackageMap();

    r = frand();
    if( r < 0.2 ){
        KFGameType(Level.Game).MonsterCollection.default.EndGameBossClass = string(Class'ZombieBoss_CIRCUS');
        KFGameType(Level.Game).EndGameBossClass = string(Class'ZombieBoss_CIRCUS');
        return;
    }
    else if( r < 0.4 ){
        KFGameType(Level.Game).MonsterCollection.default.EndGameBossClass = string(Class'ZombieBoss_HALLOWEEN');
        KFGameType(Level.Game).EndGameBossClass = string(Class'ZombieBoss_HALLOWEEN');
        return;
    }
    else if( r < 0.6 ){
        KFGameType(Level.Game).MonsterCollection.default.EndGameBossClass = string(Class'ZombieBoss_HALLOWEEN_OLD');
        KFGameType(Level.Game).EndGameBossClass = string(Class'ZombieBoss_HALLOWEEN_OLD');
        return;
    }
    else if( r < 0.8 ){
        KFGameType(Level.Game).MonsterCollection.default.EndGameBossClass = string(Class'ZombieBoss_XMas');
        KFGameType(Level.Game).EndGameBossClass = string(Class'ZombieBoss_XMas');
        return;
    }
    else{
        KFGameType(Level.Game).MonsterCollection.default.EndGameBossClass = string(Class'ZombieBoss');
        KFGameType(Level.Game).EndGameBossClass = string(Class'ZombieBoss');
        return;
    }
}
function Timer()
{
    InitMut();
    Destroy();
}
final function InitMut()
{
    local KFGameType KF;
    local int i,j;
    KF = KFGameType(Level.Game);
    if ( KF!=None )
    {
        for( i=0; i<KF.InitSquads.Length; i++ )
        {
            for( j=0; j<KF.InitSquads[i].MSquad.Length; j++ )
                KF.InitSquads[i].MSquad[j] = GetReplaceClass(KF.InitSquads[i].MSquad[j]);
        }
        for( i=0; i<KF.SpecialSquads.Length; i++ )
        {
            for( j=0; j<KF.SpecialSquads[i].ZedClass.Length; j++ )
                ReplaceMonsterStr(KF.SpecialSquads[i].ZedClass[j]);
        }
        for( i=0; i<KF.FinalSquads.Length; i++ )
        {
            for( j=0; j<KF.FinalSquads[i].ZedClass.Length; j++ )
                ReplaceMonsterStr(KF.FinalSquads[i].ZedClass[j]);
        }
        KF.FallbackMonster = GetReplaceClass( Class<KFMonster>(KF.FallbackMonster) );
    }
}
final function Class<KFMonster> GetReplaceClass( Class<KFMonster> MC )
{
    local float r;
    r = frand();
    switch( MC )
    {
    case Class'ZombieClot':
        if( r < 0.2  )
            return class'ZombieClot_CIRCUS';
        else if( r < 0.4 )
            return class'ZombieClot_Halloween';
        else if( r < 0.6 )
            return class'ZombieClot_HALLOWEEN_OLD';
        else if( r < 0.8 )
            return class'ZombieCLot_XMas';
        return Class'ZombieClot';
    case Class'ZombieBloat':
        if( r < 0.2  )
            return class'ZombieBloat_CIRCUS';
        else if( r < 0.4 )
            return class'ZombieBloat_Halloween';
        else if( r < 0.6 )
            return class'ZombieBloat_HALLOWEEN_OLD';
        else if( r < 0.8 )
            return class'ZombieBloat_XMas';
        return Class'ZombieBloat';
    case Class'ZombieCrawler':
        if( r < 0.2  )
            return class'ZombieCrawler_CIRCUS';
        else if( r < 0.4 )
            return class'ZombieCrawler_Halloween';
        else if( r < 0.6 )
            return class'ZombieCrawler_HALLOWEEN_OLD';
        else if( r < 0.8 )
            return class'ZombieCrawler_Xmas';
        return Class'ZombieCrawler';
    case Class'ZombieHusk':
        if( r < 0.2  )
            return class'ZombieHusk_CIRCUS';
        else if( r < 0.4 )
            return class'ZombieHusk_Halloween';
        else if( r < 0.6 )
            return class'ZombieHusk_HALLOWEEN_OLD';
        else if( r < 0.8 )
            return class'ZombieHusk_Xmas';
        return Class'ZombieHusk';
    case Class'ZombieStalker':
        if( r < 0.2  )
            return class'ZombieStalker_CIRCUS';
        else if( r < 0.4 )
            return class'ZombieStalker_Halloween';
        else if( r < 0.6 )
            return class'ZombieStalker_HALLOWEEN_OLD';
        else if( r < 0.8 )
            return class'ZombieStalker_XMas';
        return Class'ZombieStalker';
    case Class'ZombieSiren':
        if( r < 0.2  )
            return class'ZombieSiren_CIRCUS';
        else if( r < 0.4 )
            return class'ZombieSiren_Halloween';
        else if( r < 0.6 )
            return class'ZombieSiren_HALLOWEEN_OLD';
        else if( r < 0.8 )
            return class'ZombieSiren_Xmas';
        return Class'ZombieSiren';
    case Class'ZombieScrake':
        if( r < 0.2  )
            return class'ZombieScrake_CIRCUS';
        else if( r < 0.4 )
            return class'ZombieScrake_Halloween';
        else if( r < 0.6 )
            return class'ZombieScrake_HALLOWEEN_OLD';
        else if( r < 0.8 )
            return class'ZombieScrake_Xmas';
        return Class'ZombieScrake';
    case Class'ZombieFleshPound':
        if( r < 0.2  )
            return class'ZombieFleshPound_CIRCUS';
        else if( r < 0.4 )
            return class'ZombieFleshPound_Halloween';
        else if( r < 0.6 )
            return class'ZombieFleshPound_HALLOWEEN_OLD';
        else if( r < 0.8 )
            return class'ZombieFleshPound_XMas';
        return Class'ZombieFleshPound';
    case Class'ZombieGorefast':
        if( r < 0.2  )
            return class'ZombieGorefast_CIRCUS';
        else if( r < 0.4 )
            return class'ZombieGorefast_Halloween';
        else if( r < 0.6 )
            return class'ZombieGorefast_HALLOWEEN_OLD';
        else if( r < 0.8 )
            return class'ZombieGorefast_XMas';
        return Class'ZombieGorefast';
    default:
        return MC;
    }
}
final function ReplaceMonsterStr( out string MC )
{
    MC = string(GetReplaceClass(Class<KFMonster>(DynamicLoadObject(MC,Class'Class'))));
}
defaultproperties
{
     GroupName="KF-RandomZEDSMut"
     FriendlyName="Random ZEDS"
     Description="Replace the ZEDS with random Event versions"
}

Автор: Marco