Skip to content

Commit

Permalink
Update score (#38)
Browse files Browse the repository at this point in the history
* 33% reduction in score awarded for nanning

I was seeing scores for nan scout too high when playing real games.

* Rework points from repair

Points are awarded baswed on percental of hull repaired so healing anything from 0 to 100% is worth 10 points.  Also fixed an error that was inflating scores from healing.
  • Loading branch information
Xynth22 authored and pvandommelen committed Nov 14, 2017
1 parent 8522d34 commit 70e3c40
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 14 deletions.
7 changes: 4 additions & 3 deletions src/FedSrv/CSteamAchievements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,12 @@ void CSteamAchievements::AddUserStats(PlayerScoreObject* ppso, IshipIGC * pIshi
SetStat(EStats::PLAYER_LOSS, tempStat + 1);
}

if (pIship->GetRepair() > 0.0)
int repair = floor(100 * ppso->GetRepair());
if (repair > 0.0)
{
getSucceed = GetStat(EStats::REPAIR_AMOUNT, &tempStat);
getSucceed = GetStat(EStats::REPAIR_PERCENT, &tempStat);
if (getSucceed)
SetStat(EStats::REPAIR_AMOUNT, tempStat + floor(pIship->GetRepair()));
SetStat(EStats::REPAIR_PERCENT, tempStat + repair);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/FedSrv/CSteamAchievements.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ enum EStats
PLAYER_RANK = 6,
PLAYER_WINS = 7,
PLAYER_LOSS = 8,
REPAIR_AMOUNT = 9
REPAIR_PERCENT = 9

// Don't forget to update g_nMaximumSteamStatCount and m_Stats!
};
Expand Down Expand Up @@ -107,7 +107,7 @@ class CSteamAchievements
"PLAYER_RANK",
"PLAYER_WINS",
"PLAYER_LOSS",
"REPAIR_AMOUNT"
"REPAIR_PERCENT"
};

bool GetAchievement(EAchievements achievement);
Expand Down
2 changes: 1 addition & 1 deletion src/FedSrv/FedSrv.CPP
Original file line number Diff line number Diff line change
Expand Up @@ -3662,7 +3662,7 @@ void SendShipUpdates(CFSMission * pfsMission)
if ((pship->GetAchievementMask() & c_achmProbeSpot) > 0)
pso->AddProbeSpot();
if ((pship->GetAchievementMask() & c_achmNewRepair) > 0)
pso->SetRepair(int(pship->GetRepair()));
pso->SetRepair(pship->GetRepair());

pSteamAchievements->AwardIGCAchievements(pship->GetAchievementMask());
pship->ClearAchievementMask();
Expand Down
2 changes: 1 addition & 1 deletion src/Igc/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2557,7 +2557,7 @@ void PlayerScoreObject::CalculateScore(ImissionIGC* pmission)
float(m_cArtifacts) * pmission->GetFloatConstant(c_fcidPointsArtifacts) +
float(m_cFlags) * pmission->GetFloatConstant(c_fcidPointsFlags) +
float(m_cProbeSpot) * 10 +
float(m_cRepair) * 0.0004;
float(m_cRepair) * 10;

if (m_bWin)
m_fScore *= 2.0f;
Expand Down
11 changes: 8 additions & 3 deletions src/Igc/igc.h
Original file line number Diff line number Diff line change
Expand Up @@ -5605,9 +5605,14 @@ class PlayerScoreObject
{
m_cProbeSpot++;
}
void SetRepair(int repair)
void SetRepair(float repair)
{
m_cRepair += repair;
m_cRepair = repair;
}

float GetRepair(void) const
{
return m_cRepair;
}


Expand Down Expand Up @@ -5868,7 +5873,7 @@ class PlayerScoreObject
float m_cBaseKills;
float m_cBaseCaptures;
short m_cProbeSpot;
int m_cRepair;
float m_cRepair;

short m_cTechsRecovered;
short m_cFlags;
Expand Down
11 changes: 8 additions & 3 deletions src/Igc/shipIGC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,7 @@ DamageResult CshipIGC::ReceiveDamage(DamageTypeID type,

float maxHP = m_myHullType.GetHitPoints();
float dtmArmor = GetMyMission()->GetDamageConstant(type, m_myHullType.GetDefenseType());
float repairFraction;
assert (dtmArmor >= 0.0f);

float leakage;
Expand All @@ -1234,18 +1235,22 @@ DamageResult CshipIGC::ReceiveDamage(DamageTypeID type,
m_fraction -= amount * dtmArmor / maxHP;
if (m_fraction > 1.0f)
{
amount += (m_fraction - 1.0) * maxHP / dtmArmor; //Set amount to amount that had effect for stat
amount += (m_fraction - 1.0) * maxHP / dtmArmor; //Set amount to amount that had effect for stat
m_fraction = 1.0f;
}
GetThingSite ()->RemoveDamage (m_fraction);

if (GetMyMission()->GetMissionParams()->bAllowFriendlyFire || //no points when FF is on
!((pside == launcher->GetSide()) || IsideIGC::AlliedSides(pside, launcher->GetSide()))) //no points for healing the enemy
repairFraction = 0;
else
repairFraction = fabs(amount * dtmArmor / maxHP);
leakage = 0.0f;
dr = c_drNoDamage;
if (launcher->GetObjectType() == OT_ship && (pside == launcher->GetSide()) || IsideIGC::AlliedSides(pside, launcher->GetSide()))
{

IshipIGC * pIship = ((IshipIGC*)launcher);
pIship->AddRepair(-amount);
pIship->AddRepair(repairFraction);
pIship->SetAchievementMask(c_achmNewRepair);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Igc/shipIGC.h
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ class CshipIGC : public TmodelIGC<IshipIGC>
}
virtual void AddRepair(float repair)
{
m_repair += repair; //Xynth amount of nanning performed by ship
m_repair += repair; //Xynth amount of nanning performed by ship as a fraction of hull repaired
}
virtual float GetRepair(void) const
{
Expand Down

0 comments on commit 70e3c40

Please sign in to comment.