NicePack/sources/NiceGameType.uc
Anton Tarasenko 9bb40e03c8 Updated 006
[Changed]
- Dual pistols' spread was reduced by half (down to 250 from 500)
- Commando no longer passively grants zed-time extensions
- Commando's skill 'Perfect execution': zed-time granted by this skill can no longer be extended
- Commando's skill 'Overclocking': now grants 4 additional zed-time extensions
- Demolitionist's weapons: ammo cost doubled, max ammo reduced to about 2/3rds of previous values (except for harpoon that was unchanged, m32 that still has the same max ammo and L.A.W. that got its ammo halved and rocket cost raised fom 13 to 40)
- Removed Hardcore level broadcasting bullshit
2021-12-01 04:10:42 +07:00

313 lines
12 KiB
Ucode

// made to fix KFStoryGameInfo loading for KFO maps
class NiceGameType extends ScrnGameType;
var NicePack NicePackMutator;
var bool lessDramatic;
var float LesserZedTimeSlomoScale;
function RegisterMutator(NicePack activePack){
NicePackMutator = activePack;
}
function OverrideMonsterHealth(KFMonster M){}
/*event InitGame(string Options, out string Error){
local int i, j;
if(ScrnGameLength == none)
ScrnGameLength = new(none, string(KFGameLength)) class'ScrnGameLength';
for(i = 0;i < ScrnGameLength.
}*/
function int SpawnSquad(ZombieVolume ZVol, out array< class<KFMonster> > Squad, optional bool bLogSpawned ){
local int i, j;
local array<NicePack.ZedRecord> zedDatabase;
if(NicePackMutator != none){
zedDatabase = NicePackMutator.zedDatabase;
for(i = 0;i < zedDatabase.Length;i ++){
for(j = 0;j < Squad.Length;j ++){
if(zedDatabase[i].bNeedsReplacement && zedDatabase[i].ZedType == Squad[j])
Squad[j] = zeddatabase[i].MeanZedType;
}
}
}
return super.SpawnSquad(ZVol, Squad, bLogSpawned);
}
function SetupWave(){
Super.SetupWave();
// Event call
NicePackMutator.WaveStart();
}
function RestartPlayer(Controller aPlayer){
Super.RestartPlayer(aPlayer);
if(aPlayer.Pawn != none && NicePlayerController(aPlayer) != none)
NicePlayerController(aPlayer).PawnSpawned();
}
State MatchInProgress{
function BeginState(){
Super(Invasion).BeginState();
WaveNum = InitialWave;
InvasionGameReplicationInfo(GameReplicationInfo).WaveNumber = WaveNum;
if(NicePackMutator.bInitialTrader) {
WaveCountDown = NicePackMutator.initialTraderTime + 5;
NicePackMutator.TraderStart();
}
else
WaveCountDown = 10;
SetupPickups();
if(ScrnGameLength != none && !ScrnGameLength.LoadWave(WaveNum))
DoWaveEnd();
// Event call
NicePackMutator.MatchBegan();
}
function DoWaveEnd(){
Super.DoWaveEnd();
// Event call
NicePackMutator.TraderStart();
}
function StartWaveBoss(){
Super.StartWaveBoss();
// Event call
NicePackMutator.WaveStart();
}
}
function ScoreKill(Controller Killer, Controller Other)
{
local PlayerReplicationInfo OtherPRI;
local float KillScore;
local Controller C;
OtherPRI = Other.PlayerReplicationInfo;
if ( OtherPRI != None )
{
OtherPRI.NumLives++;
OtherPRI.Score -= (OtherPRI.Score * (GameDifficulty * 0.05)); // you Lose 35% of your current cash on Hell on Earth, 15% on normal.
OtherPRI.Team.Score -= (OtherPRI.Score * (GameDifficulty * 0.05));
if (OtherPRI.Score < 0 )
OtherPRI.Score = 0;
if (OtherPRI.Team.Score < 0 )
OtherPRI.Team.Score = 0;
OtherPRI.Team.NetUpdateTime = Level.TimeSeconds - 1;
OtherPRI.bOutOfLives = true;
if( Killer!=None && Killer.PlayerReplicationInfo!=None && Killer.bIsPlayer )
BroadcastLocalizedMessage(class'KFInvasionMessage',1,OtherPRI,Killer.PlayerReplicationInfo);
else if( Killer==None || Monster(Killer.Pawn)==None )
BroadcastLocalizedMessage(class'KFInvasionMessage',1,OtherPRI);
else BroadcastLocalizedMessage(class'KFInvasionMessage',1,OtherPRI,,Killer.Pawn.Class);
CheckScore(None);
}
if ( GameRulesModifiers != None )
GameRulesModifiers.ScoreKill(Killer, Other);
if ( MonsterController(Killer) != None )
return;
if( (killer == Other) || (killer == None) )
{
if ( Other.PlayerReplicationInfo != None )
{
Other.PlayerReplicationInfo.Score -= 1;
Other.PlayerReplicationInfo.NetUpdateTime = Level.TimeSeconds - 1;
ScoreEvent(Other.PlayerReplicationInfo,-1,"self_frag");
}
}
if ( Killer==None || !Killer.bIsPlayer || (Killer==Other) )
return;
if ( Other.bIsPlayer )
{
Killer.PlayerReplicationInfo.Score -= 5;
Killer.PlayerReplicationInfo.Team.Score -= 2;
Killer.PlayerReplicationInfo.NetUpdateTime = Level.TimeSeconds - 1;
Killer.PlayerReplicationInfo.Team.NetUpdateTime = Level.TimeSeconds - 1;
ScoreEvent(Killer.PlayerReplicationInfo, -5, "team_frag");
return;
}
if ( LastKilledMonsterClass == None )
KillScore = 1;
else if(Killer.PlayerReplicationInfo !=none)
{
KillScore = LastKilledMonsterClass.Default.ScoringValue;
// Scale killscore by difficulty
if ( GameDifficulty >= 5.0 ) // Suicidal and Hell on Earth
{
KillScore *= 0.65;
}
else if ( GameDifficulty >= 4.0 ) // Hard
{
KillScore *= 0.85;
}
else if ( GameDifficulty >= 2.0 ) // Normal
{
KillScore *= 1.0;
}
else //if ( GameDifficulty == 1.0 ) // Beginner
{
KillScore *= 2.0;
}
// Increase score in a short game, so the player can afford to buy cool stuff by the end
if( KFGameLength == GL_Short )
{
KillScore *= 1.75;
}
KillScore = Max(1,int(KillScore));
if (NicePackMutator.bUseProgresiveCash) {
KillScore = 0;
}
Killer.PlayerReplicationInfo.Kills++;
ScoreKillAssists(KillScore, Other, Killer);
Killer.PlayerReplicationInfo.Team.Score += KillScore;
Killer.PlayerReplicationInfo.NetUpdateTime = Level.TimeSeconds - 1;
Killer.PlayerReplicationInfo.Team.NetUpdateTime = Level.TimeSeconds - 1;
TeamScoreEvent(Killer.PlayerReplicationInfo.Team.TeamIndex, 1, "tdm_frag");
}
if (Killer.PlayerReplicationInfo !=none && Killer.PlayerReplicationInfo.Score < 0)
Killer.PlayerReplicationInfo.Score = 0;
/* Begin Marco's Kill Messages */
if( Class'HUDKillingFloor'.Default.MessageHealthLimit<=Other.Pawn.Default.Health ||
Class'HUDKillingFloor'.Default.MessageMassLimit<=Other.Pawn.Default.Mass )
{
for( C=Level.ControllerList; C!=None; C=C.nextController )
{
if( C.bIsPlayer && xPlayer(C)!=None )
{
xPlayer(C).ReceiveLocalizedMessage(Class'KillsMessage',1,Killer.PlayerReplicationInfo,,Other.Pawn.Class);
}
}
}
else
{
if( xPlayer(Killer)!=None )
{
xPlayer(Killer).ReceiveLocalizedMessage(Class'KillsMessage',,,,Other.Pawn.Class);
}
}
/* End Marco's Kill Messages */
}
function DramaticEvent(float BaseZedTimePossibility, optional float DesiredZedTimeDuration){
local bool bWasZedTime;
bWasZedTime = bZEDTimeActive;
if (lessDramatic)
{
if (bZEDTimeActive) {
return;
}
else {
ZedTimeSlomoScale = LesserZedTimeSlomoScale;
}
}
Super.DramaticEvent(BaseZedTimePossibility, DesiredZedTimeDuration);
ZedTimeSlomoScale = default.ZedTimeSlomoScale;
// Call event
if(!bWasZedTime && bZEDTimeActive)
NicePackMutator.ZedTimeActivated();
}
event Tick(float DeltaTime){
local float TrueTimeFactor;
local Controller C;
if(bZEDTimeActive){
TrueTimeFactor = 1.1 / Level.TimeDilation;
CurrentZEDTimeDuration -= DeltaTime * TrueTimeFactor;
if(CurrentZEDTimeDuration < (ZEDTimeDuration*0.166) && CurrentZEDTimeDuration > 0 ){
if(!bSpeedingBackUp){
bSpeedingBackUp = true;
for(C = Level.ControllerList;C != none;C = C.NextController){
if(KFPlayerController(C)!= none)
KFPlayerController(C).ClientExitZedTime();
}
}
SetGameSpeed(Lerp( (CurrentZEDTimeDuration/(ZEDTimeDuration*0.166)), 1.0, 0.2 ));
}
if(CurrentZEDTimeDuration <= 0){
if(bZEDTimeActive)
NicePackMutator.ZedTimeDeactivated();
lessDramatic = false;
bZEDTimeActive = false;
bSpeedingBackUp = false;
SetGameSpeed(1.0);
ZedTimeExtensionsUsed = 0;
}
}
}
function Killed(Controller Killer, Controller Killed, Pawn KilledPawn, class<DamageType> dmgType){
local GameRules rules;
local NicePlayerController nicePlayer;
local NiceAvoidMarkerCarnage AvoidArea;
local ScrnGameRules scrnRules;
local KFSteamStatsAndAchievements StatsAndAchievements;
Super.Killed(Killer, Killed, KilledPawn, dmgType);
if(PlayerController(Killer) != none){
nicePlayer = NicePlayerController(killer);
if(NiceMonster(KilledPawn) != none && Killed != Killer){
// Brutal carnage
if (nicePlayer != none && killer.pawn != none && nicePlayer.abilityManager != none && nicePlayer.abilityManager.IsAbilityActive("carnage"))
{
AvoidArea = Spawn(class'NiceAvoidMarkerCarnage', killer.pawn);
AvoidArea.SetLocation(KilledPawn.location);
AvoidArea.healthLevel = killedPawn.default.health;
AvoidArea.SetCollisionSize( class'NicePack.NiceSkillEnforcerBrutalCarnageA'.default.avoidRadius,
class'NicePack.NiceSkillEnforcerBrutalCarnageA'.default.avoidRadius);
AvoidArea.StartleBots();
}
// Rest
StatsAndAchievements = KFSteamStatsAndAchievements(PlayerController(Killer).SteamStatsAndAchievements);
if(StatsAndAchievements != none){
if(KilledPawn.IsA('NiceZombieStalker') || KilledPawn.IsA('MeanZombieStalker')){
if(class<NiceDamTypeWinchester>(dmgType) != none)
StatsAndAchievements.AddStalkerKillWithLAR();
}
else if(KilledPawn.IsA('NiceZombieClot') || KilledPawn.IsA('MeanZombieClot')){
if(class<NiceDamTypeWinchester>(dmgType) != none)
KFSteamStatsAndAchievements(PlayerController(Killer).SteamStatsAndAchievements).AddClotKillWithLAR();
}
if(class<NiceWeaponDamageType>(dmgType) != none){
for(rules = Level.Game.GameRulesModifiers;rules != none;rules = rules.NextGameRules)
if(ScrnGameRules(rules) != none){
scrnRules = ScrnGameRules(rules);
break;
}
if(scrnRules != none)
class<NiceWeaponDamageType>(dmgType).Static.AwardNiceKill(StatsAndAchievements, KFPlayerController(Killer), KFMonster(KilledPawn), scrnRules.HardcoreLevel);
}
}
}
}
}
// Reloaded to award damage
function int ReduceDamage(int Damage, pawn injured, pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType){
local NiceMonster niceZed;
local KFPlayerController PC;
niceZed = NiceMonster(Injured);
if(niceZed != none){
if(instigatedBy != none){
PC = KFPlayerController(instigatedBy.Controller);
if(class<NiceWeaponDamageType>(damageType) != none && PC != none)
class<NiceWeaponDamageType>(damageType).Static.AwardNiceDamage(KFSteamStatsAndAchievements(PC.SteamStatsAndAchievements), Clamp(Damage, 1, Injured.Health), niceZed.scrnRules.HardcoreLevel);
}
}
return Super.ReduceDamage(Damage, injured, InstigatedBy, HitLocation, Momentum, DamageType);
}
defaultproperties
{
GameName="Nice Floor"
Description="Nice Edition of ScrN Killing Floor game mode (ScrnGameType)."
ZedTimeSlomoScale=0.4
LesserZedTimeSlomoScale=0.6
}