Skip to content

Commit

Permalink
Merge pull request #16 from shrimpza/604
Browse files Browse the repository at this point in the history
Monster Hunt 604
  • Loading branch information
shrimpza authored Jan 8, 2022
2 parents 754f260 + 4950b97 commit d51e43f
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 67 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 603 to 604:
- Fix saving of game rule settings
- Refactor scoring implementation, including default scores for more monster types
- Fix upgrade dispersion pistol (thanks SeriousBuggie)
- Fix zoom for old rifle (thanks SeriousBuggie)
- Prevent call endgame if game already ended (thanks SeriousBuggie)
- Fix destroy shadow for bugged monsters (thanks SeriousBuggie)
- Fix break broken team skins like Cow and Nali (thanks SeriousBuggie)
- Refactor Login function to work around bug with triggers in start areas (thanks SeriousBuggie)
- Fix killing friendly Nalis and Cows, and bots waking up Titans (thanks SeriousBuggie)

## 602 to 603:
- Decoupled monster difficulty from bot skill - difficulty is its own option on the Rules tab
- Add configurable Warmup time to Defence, before monsters start spawning
Expand Down
4 changes: 2 additions & 2 deletions buildscript/buildconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ SCRIPTS_DIR=$(dirname $(realpath $0))

export name="Monster Hunt"
export package=MonsterHunt
export build=603
export version=603
export build=604
export version=604
export packagefull=$package
export packagedist=$package$version
export debug=1
Expand Down
13 changes: 13 additions & 0 deletions resources/Help/MonsterHunt/ReadMe.html
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,19 @@ <h2 id="credits">Credits</h2>
<section>
<h2 id="history">Release History</h2>

<h3>Release 10 (604)</h3>
<ul>
<li>Fix saving of game rule settings
<li>Refactor scoring implementation, including default scores for more monster types
<li>Fix upgrade dispersion pistol (thanks SeriousBuggie)
<li>Fix zoom for old rifle (thanks SeriousBuggie)
<li>Prevent call endgame if game already ended (thanks SeriousBuggie)
<li>Fix destroy shadow for bugged monsters (thanks SeriousBuggie)
<li>Fix break broken team skins like Cow and Nali (thanks SeriousBuggie)
<li>Refactor Login function to work around bug with triggers in start areas (thanks SeriousBuggie)
<li>Fix killing friendly Nalis and Cows, and bots waking up Titans (thanks SeriousBuggie)
</ul>

<h3>Release 9 (603)</h3>
<ul>
<li>Decoupled monster difficulty from bot skill - difficulty is its own option on the Rules tab
Expand Down
156 changes: 93 additions & 63 deletions src/Classes/MonsterHunt.uc
Original file line number Diff line number Diff line change
Expand Up @@ -278,27 +278,28 @@ function PlayStartUpMessage(PlayerPawn NewPlayer) {
if (Level.NetMode == NM_Standalone) NewPlayer.SetProgressMessage(SingleWaitingMessage, i++);
}

function playerpawn Login(
function PlayerPawn Login(
string Portal,
string Options,
out string Error,
class<PlayerPawn> SpawnClass
) {
local PlayerPawn newPlayer;
local PlayerPawn NewPlayer;
local NavigationPoint StartSpot;

newPlayer = Super.Login(Portal, Options, Error, SpawnClass);
if (newPlayer == None) return None;

if (bSpawnInTeamArea) {
StartSpot = FindPlayerStart(NewPlayer, 0, Portal);
if (StartSpot != None) {
NewPlayer.SetLocation(StartSpot.Location);
NewPlayer.SetRotation(StartSpot.Rotation);
NewPlayer.ViewRotation = StartSpot.Rotation;
NewPlayer.ClientSetRotation(NewPlayer.Rotation);
StartSpot.PlayTeleportEffect(NewPlayer, true);
}
NewPlayer = Super(DeathMatchPlus).Login(Portal, Options, Error, SpawnClass);
if (NewPlayer == None) return None;

// force finding a red team start spot
StartSpot = FindPlayerStart(NewPlayer, 0, Portal);
if (StartSpot != None) {
NewPlayer.SetCollision(False); // don't collide actors, in case of triggers in start area
NewPlayer.SetLocation(StartSpot.Location);
NewPlayer.SetRotation(StartSpot.Rotation);
NewPlayer.ViewRotation = StartSpot.Rotation;
NewPlayer.ClientSetRotation(NewPlayer.Rotation);
StartSpot.PlayTeleportEffect(NewPlayer, true);
NewPlayer.SetCollision(True); // After setup, re-enable actor collision
}
PlayerTeamNum = NewPlayer.PlayerReplicationInfo.Team;

Expand All @@ -308,7 +309,7 @@ function playerpawn Login(

CountHunters();

return newPlayer;
return NewPlayer;
}

function bool RestartPlayer(pawn aPlayer) {
Expand Down Expand Up @@ -360,6 +361,11 @@ function bool RestartPlayer(pawn aPlayer) {
} else return Super.RestartPlayer(aPlayer);
}

function EndGame(string Reason) {
if (bGameEnded) return;
Super.EndGame(Reason);
}

function CheckEndGame() {
local Pawn PawnLink;
local bot B;
Expand Down Expand Up @@ -407,35 +413,44 @@ function Killed(pawn killer, pawn Other, name damageType) {
}

function ScoreKill(pawn Killer, pawn Other) {
local int Score;

if (Killer == None) return;

if (Killer == Other || !Other.bIsPlayer || (Killer.PlayerReplicationInfo.Team != Other.PlayerReplicationInfo.Team)) {
Super.ScoreKill(Killer, Other);
}
if (Killer != Other) Killer.KillCount ++;
if (Other != None) Other.DieCount ++;

if (Other.bIsPlayer && MonsterReplicationInfo(GameReplicationInfo).bUseLives) {
if (Other.bIsPlayer
&& Other.PlayerReplicationInfo != None
&& MonsterReplicationInfo(GameReplicationInfo).bUseLives
) {
Other.PlayerReplicationInfo.Deaths -= 1;
}

if (!Other.IsA('ScriptedPawn')) return;
BroadcastMessage(Killer.GetHumanName() @ "killed" $ Other.GetHumanName());

if (Killer != None) BroadcastMessage(Killer.GetHumanName() @ "killed" $ Other.GetHumanName());
// =========================================================================
// Score depending on which monster type the player kills
if (Killer.bIsPlayer && Killer.PlayerReplicationInfo != None) {
// by default, score 1 for all kills
Score = 1;

// =========================================================================
// Score depending on which monster type the player kills

if (Killer.bIsPlayer) {
if (Other.IsA('Titan') || Other.IsA('Queen') || Other.IsA('WarLord')) Killer.PlayerReplicationInfo.Score += 4;
else if (Other.IsA('GiantGasBag') || Other.IsA('GiantManta')) Killer.PlayerReplicationInfo.Score += 3;
else if (Other.IsA('SkaarjWarrior') || Other.IsA('MercenaryElite') || Other.IsA('Brute')) Killer.PlayerReplicationInfo.Score += 2;
if (Other.IsA('Titan') || Other.IsA('Queen') || Other.IsA('WarLord')) Score = 5;
else if (Other.IsA('GiantGasBag') || Other.IsA('GiantManta') || Other.IsA('SkaarjTrooper')) Score = 4;
else if (Other.IsA('SkaarjWarrior') || Other.IsA('MercenaryElite') || Other.IsA('Brute') || Other.IsA('GiantManta')) Score = 3;
else if (Other.IsA('Krall') || Other.IsA('Slith') || Other.IsA('GasBag')) Score = 2;
// Lose points for killing innocent creatures. Shame ;-)
else if (Other.IsA('Nali') || Other.IsA('Cow') || Other.IsA('NaliRabbit')) Killer.PlayerReplicationInfo.Score -= 6;
// be default, score 1 for all other kills
else Killer.PlayerReplicationInfo.Score += 1;
else if (Other.IsA('Nali') || Other.IsA('Cow')) {
if (!MaybeEvilFriendlyPawn(ScriptedPawn(Other), Killer)) Score = -5;
}

// Get 10 extra points for killing the boss!!
if ((Killer.bIsPlayer) && (ScriptedPawn(Other).bIsBoss)) Killer.PlayerReplicationInfo.Score += 9;
if ((ScriptedPawn(Other) != None && ScriptedPawn(Other).bIsBoss)) Score = 10;

Killer.PlayerReplicationInfo.Score += Score;
}

BaseMutator.ScoreKill(Killer, Other);
}

function AddToTeam(int num, Pawn Other) {
Expand Down Expand Up @@ -473,12 +488,9 @@ function AddToTeam(int num, Pawn Other) {

if (MonsterReplicationInfo(GameReplicationInfo).bUseTeamSkins) {
Other.static.GetMultiSkin(Other, SkinName, FaceName);
if (SkinName ~= "None")
SkinName = string(Other.Skin);
if (SkinName ~= "None")
SkinName = string(Other.MultiSkins[1]);
if (!(SkinName ~= "None"))
Other.static.SetMultiSkin(Other, SkinName, FaceName, 0);
if (SkinName ~= "None") SkinName = string(Other.Skin);
if (SkinName ~= "None") SkinName = string(Other.MultiSkins[1]);
if (!(SkinName ~= "None")) Other.static.SetMultiSkin(Other, SkinName, FaceName, 0);
}
}
}
Expand Down Expand Up @@ -511,7 +523,6 @@ function Timer() {

function bool FindSpecialAttractionFor(Bot aBot) {
local ScriptedPawn S;
local bool bEnemy;

if (aBot == None) return false;

Expand All @@ -523,25 +534,9 @@ function bool FindSpecialAttractionFor(Bot aBot) {
if (aBot.LastAttractCheck == Level.TimeSeconds) return false;

foreach AllActors(class'ScriptedPawn', S) {
if ( S.isA('Titan') && S.GetStateName() == 'Sitting' )
continue;
if ( S.IsA('Nali') || S.IsA('Cow') )
{
bEnemy = false;
switch (S.AttitudeToCreature(aBot))
{
case ATTITUDE_Hate:
case ATTITUDE_Frenzy:
bEnemy = true;
}
switch (S.AttitudeToPlayer)
{
case ATTITUDE_Hate:
case ATTITUDE_Frenzy:
bEnemy = true;
}
if (!bEnemy)
continue;
if (S.isA('Titan') && S.GetStateName() == 'Sitting') continue;
if (S.IsA('Nali') || S.IsA('Cow')) {
if (!MaybeEvilFriendlyPawn(S, aBot)) continue;
}
if (S.CanSee(aBot)) {
if (((S.Enemy == None) || ((S.Enemy.IsA('PlayerPawn')) && (FRand() >= 0.5))) && (S.Health >= 1)) {
Expand Down Expand Up @@ -800,11 +795,46 @@ function SetBotOrders(Bot NewBot) {
NewBot.SetOrders(DefaultBotOrders, None, true);
}
function EndGame( string Reason )
{
if ( bGameEnded )
return;
Super.EndGame(Reason);
/*
AssessBotAttitude returns a value that translates to an attitude
0 = ATTITUDE_Fear;
1 = return ATTITUDE_Hate;
2 = return ATTITUDE_Ignore;
3 = return ATTITUDE_Friendly;
*/
function byte AssessBotAttitude(Bot aBot, Pawn Other) {
if (Other.isA('Titan') && Other.GetStateName() == 'Sitting') return 2; // ATTITUDE_Ignore
if (!aBot.LineOfSightTo(Other)) return 2; // ATTITUDE_Ignore
if (Other.IsA('Nali') || Other.IsA('Cow')) {
if (MaybeEvilFriendlyPawn(ScriptedPawn(Other), aBot)) return 1; // ATTITUDE_Hate
else return 3; // ATTITUDE_Friendly
}
if (Other.bIsPlayer && Other.PlayerReplicationInfo != None && Other.PlayerReplicationInfo.Team == aBot.PlayerReplicationInfo.Team) {
return 3; // ATTITUDE_Friendly
}
if (Other.IsA('TeamCannon')) {
if (TeamCannon(Other).SameTeamAs(0)) return 3; // ATTITUDE_Friendly
if (Other.GetStateName() != 'ActiveCannon') return 2; // ATTITUDE_Ignore
}
if (!(Other.bIsPlayer && Other.PlayerReplicationInfo != None) && Other.CollisionHeight < 75) return 1; // ATTITUDE_Hate
if (!(Other.bIsPlayer && Other.PlayerReplicationInfo != None) && Other.CollisionHeight >= 75) return 0; // ATTITUDE_Fear
return super(DeathMatchPlus).AssessBotAttitude(aBot, Other);
}
function bool MaybeEvilFriendlyPawn(ScriptedPawn Pawn, Pawn Other) {
switch (Pawn.Default.AttitudeToPlayer) {
case ATTITUDE_Hate:
case ATTITUDE_Frenzy:
return true;
default:
switch (Pawn.AttitudeToCreature(Other)) {
case ATTITUDE_Hate:
case ATTITUDE_Frenzy:
return true;
}
}
return false;
}
defaultproperties {
Expand Down
5 changes: 5 additions & 0 deletions src/Classes/MonsterHuntDefenceRules.uc
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ function WarmupChanged() {
Class<MonsterHuntDefence>(BotmatchParent.GameClass).Default.WarmupTime = int(WarmupEdit.GetValue());
}

function SaveConfigs() {
Super.SaveConfigs();
class<MonsterHuntDefence>(BotmatchParent.GameClass).static.StaticSaveConfig();
}

defaultproperties {
EscapeesEdit=None
EscapeesText="Max Escapees"
Expand Down
8 changes: 6 additions & 2 deletions src/Classes/MonsterHuntRules.uc
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ function LoadCurrentValues() {
Super.LoadCurrentValues();
TimeEdit.SetValue(string(Class<MonsterHunt>(BotmatchParent.GameClass).Default.TimeLimit));

if (MaxPlayersEdit != None){
if (MaxPlayersEdit != None) {
MaxPlayersEdit.SetValue(string(Class<MonsterHunt>(BotmatchParent.GameClass).Default.MaxPlayers));
}

if (MaxSpectatorsEdit != None){
if (MaxSpectatorsEdit != None) {
MaxSpectatorsEdit.SetValue(string(Class<MonsterHunt>(BotmatchParent.GameClass).Default.MaxSpectators));
}

Expand Down Expand Up @@ -174,6 +174,10 @@ function DifficultyChanged() {
}

class<MonsterHunt>(BotmatchParent.GameClass).Default.MonsterSkill = skill;
}

function SaveConfigs() {
Super.SaveConfigs();
class<MonsterHunt>(BotmatchParent.GameClass).static.StaticSaveConfig();
}

Expand Down

0 comments on commit d51e43f

Please sign in to comment.