本文整理汇总了C++中PlayerInfo::GetCondition方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerInfo::GetCondition方法的具体用法?C++ PlayerInfo::GetCondition怎么用?C++ PlayerInfo::GetCondition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerInfo
的用法示例。
在下文中一共展示了PlayerInfo::GetCondition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DemandTribute
// Demand tribute, and get the planet's response.
string Planet::DemandTribute(PlayerInfo &player) const
{
if(player.GetCondition("tribute: " + name))
return "We are already paying you as much as we can afford.";
if(!tribute || !defenseFleet || !defenseCount || player.GetCondition("combat rating") < defenseThreshold)
return "Please don't joke about that sort of thing.";
// The player is scary enough for this planet to take notice. Check whether
// this is the first demand for tribute, or not.
if(!isDefending)
{
isDefending = true;
GameData::GetPolitics().Offend(defenseFleet->GetGovernment(), ShipEvent::PROVOKE);
GameData::GetPolitics().Offend(GetGovernment(), ShipEvent::PROVOKE);
return "Our defense fleet will make short work of you.";
}
// The player has already demanded tribute. Have they killed off the entire
// defense fleet?
bool isDefeated = (defenseDeployed == defenseCount);
for(const shared_ptr<Ship> &ship : defenders)
if(!ship->IsDisabled() && !ship->IsYours())
{
isDefeated = false;
break;
}
if(!isDefeated)
return "We're not ready to surrender yet.";
player.Conditions()["tribute: " + name] = tribute;
GameData::GetPolitics().DominatePlanet(this);
return "We surrender. We will pay you " + Format::Number(tribute) + " credits per day to leave us alone.";
}
示例2: DemandTribute
// Demand tribute, and get the planet's response.
string Planet::DemandTribute(PlayerInfo &player) const
{
if(player.GetCondition("tribute: " + name))
return "We are already paying you as much as we can afford.";
if(!tribute || defenseFleets.empty())
return "Please don't joke about that sort of thing.";
if(player.GetCondition("combat rating") < defenseThreshold)
return "You're not worthy of our time.";
// The player is scary enough for this planet to take notice. Check whether
// this is the first demand for tribute, or not.
if(!isDefending)
{
isDefending = true;
set<const Government *> toProvoke;
for(const auto &fleet : defenseFleets)
toProvoke.insert(fleet->GetGovernment());
for(const auto &gov : toProvoke)
gov->Offend(ShipEvent::PROVOKE);
// Terrorizing a planet is not taken lightly by it or its allies.
GetGovernment()->Offend(ShipEvent::ATROCITY);
return "Our defense fleet will make short work of you.";
}
// The player has already demanded tribute. Have they defeated the entire defense fleet?
bool isDefeated = (defenseDeployed == defenseFleets.size());
for(const shared_ptr<Ship> &ship : defenders)
if(!ship->IsDisabled() && !ship->IsYours())
{
isDefeated = false;
break;
}
if(!isDefeated)
return "We're not ready to surrender yet.";
player.Conditions()["tribute: " + name] = tribute;
GameData::GetPolitics().DominatePlanet(this);
return "We surrender. We will pay you " + Format::Credits(tribute) + " credits per day to leave us alone.";
}