Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion source/server/damage.qc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ float(float current_health_delay, float current_perks) Gamemode_GetHealthRegenDe
#define DMG_SCORE_GRENADE 50 // Death by Grenade.
#define DMG_SCORE_EXPLOSIVE 60 // Death by Explosive Weapon.
#define DMG_SCORE_TESLA 50 // Death by Tesla.
#define DMG_SCORE_FLOPPER 50 // Death by PhD Flopper
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gamemode_Festive_ScoreForDamage will need modified to add support for this type and return 90 points.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood

#define DMG_SCORE_STDDAMAGE 10 // Standard Damage reward.

void() Barrel_Hit;
Expand Down Expand Up @@ -274,6 +275,9 @@ void(entity attacker, float d_style) DieHandler =
case DMG_TYPE_UPPERTORSO:
points_earned = DMG_SCORE_UPPERTORSO;
break;
case DMG_TYPE_FLOPPER:
points_earned = DMG_SCORE_FLOPPER;
break;
default:
if (cvar("developer"))
bprint(PRINT_HIGH, "DieHandler: Received invalid style\n");
Expand Down Expand Up @@ -580,7 +584,7 @@ void(entity inflictor, entity attacker, float damage2, float mindamage, float ra
} else if (inflictor.classname == "player") {
// phd flopper.
final_damage = calculate_proximity_value(mindamage, damage2, inflictor.origin, ent.origin, radius);
damage_style = DMG_TYPE_GRENADE;
damage_style = DMG_TYPE_FLOPPER;
} else {
r = rounds;
multi = 1.07;
Expand Down
1 change: 1 addition & 0 deletions source/server/gamemodes/core.qc
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ void(entity attacker, float death_style) Gamemode_DieHandler =
{
switch(current_gamemode) {
case GAMEMODE_STICKSNSTONES: Gamemode_Sticks_DieHandler(attacker, death_style); break;
case GAMEMODE_GUNGAME: Gamemode_GunGame_DieHandler(attacker, death_style); break;
default: break;
}
};
Expand Down
2 changes: 2 additions & 0 deletions source/server/gamemodes/festive.qc
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ float(float current_earned_score, float damage_style) Gamemode_Festive_ScoreForD
case DMG_TYPE_GRENADE:
case DMG_TYPE_TESLA:
return 90;
case DMG_TYPE_FLOPPER:
return 90;
}

return current_earned_score;
Expand Down
10 changes: 10 additions & 0 deletions source/server/gamemodes/gun_game.qc
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,14 @@ void(float score_earned) Gamemode_GunGame_PlayerAddScore =
}
}
}
};

void(entity attacker, float death_style) Gamemode_GunGame_DieHandler =
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flopper isn't a guaranteed kill in the later rounds. Do you get points awarded for non-killing PhD damage too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it does not currently. Should it be that way?

{

// possible fix for PHD Flopper giving points toward your weapon
switch(death_style) {
case DMG_TYPE_FLOPPER:
return 0;
}
};
42 changes: 40 additions & 2 deletions source/server/tests/test_score.qc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ void() Test_AddScore_DamageTypes =
DMG_TYPE_GRENADE,
DMG_TYPE_EXPLOSIVE,
DMG_TYPE_LOWERTORSO,
DMG_TYPE_UPPERTORSO
DMG_TYPE_UPPERTORSO,
DMG_TYPE_FLOPPER
};

float scores[] = {
Expand All @@ -66,7 +67,8 @@ void() Test_AddScore_DamageTypes =
DMG_SCORE_GRENADE,
DMG_SCORE_EXPLOSIVE,
DMG_SCORE_LOWERTORSO,
DMG_SCORE_UPPERTORSO
DMG_SCORE_UPPERTORSO,
DMG_SCORE_FLOPPER
};

for (float i = 0; i < styles.length; i++) {
Expand Down Expand Up @@ -110,4 +112,40 @@ void() Test_AddScore_MysteryBoxLeave =

remove(mystery_box_ent);
remove(owner_ent);
};


//
// Test_AddScore_PhD_GunGame()
// Asserts we are giving correct amount
// of score for PhD Flopper in gun game
// Should return 0
// (https://github.com/nzp-team/nzportable/issues/1363)
//
void() Test_AddScore_PhD_GunGame =
{
float score_pre = self.points;

Gamemode_GunGame_DieHandler(self, DMG_TYPE_FLOPPER);

float score_post = self.points;
float score_delta = score_post - score_pre;



Test_Assert((score_delta == 0), sprintf("Unexpected score earned, expected 0 but got [%d]!", score_delta));
};

//
// Test_AddScore_PhD_Festive()
// Asserts we are giving correct amount
// of score for PhD Flopper in Festive
// Should return 90
// (https://github.com/nzp-team/nzportable/issues/1363)
//
void() Test_AddScore_PhD_Festive =
{
float pointsEarned = Gamemode_Festive_ScoreForDamage(DMG_SCORE_FLOPPER, DMG_TYPE_FLOPPER);

Test_Assert((pointsEarned == 90), sprintf("Unexpected score earned, expected 90 but got [%d]!", pointsEarned));
};
6 changes: 3 additions & 3 deletions source/server/weapons/weapon_core.qc
Original file line number Diff line number Diff line change
Expand Up @@ -1841,8 +1841,8 @@ void() CheckPlayer =
traceline(self.origin, self.origin + (v_up * -40), 0, self);

if (trace_ent.classname == "player") {
DamageHandler(self, trace_ent, 100000, DMG_TYPE_OTHER);
DamageHandler(trace_ent, self, 100000, DMG_TYPE_OTHER);
DamageHandler(self, trace_ent, 100000, DMG_TYPE_FLOPPER);
DamageHandler(trace_ent, self, 100000, DMG_TYPE_FLOPPER);
}
}

Expand Down Expand Up @@ -1874,7 +1874,7 @@ void() CheckPlayer =
float damage = over * 0.68;
if (damage > 98) damage = 98;

DamageHandler (self, other, damage, DMG_TYPE_OTHER);
DamageHandler (self, other, damage, DMG_TYPE_FLOPPER);

if (self.health <= 5)
GiveAchievement(7, self);
Expand Down
1 change: 1 addition & 0 deletions source/shared/shared_defs.qc
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ float map_compatibility_mode;
#define DMG_TYPE_ZOMBIESWIPE 9 // Zombie-inflicted: Any attack on Player
#define DMG_TYPE_ELECTRICTRAP 10 // Trap-inflicted: Electric trap damage
#define DMG_TYPE_OTHER 11 // For use with misc. damage infliction
#define DMG_TYPE_FLOPPER 12 // Player-inflicted: PhD Flopper explosion

//Perk types
#define P_JUG 1
Expand Down