当前位置: 首页>>代码示例>>C++>>正文


C++ cGangManager::gangs_on_mission方法代码示例

本文整理汇总了C++中cGangManager::gangs_on_mission方法的典型用法代码示例。如果您正苦于以下问题:C++ cGangManager::gangs_on_mission方法的具体用法?C++ cGangManager::gangs_on_mission怎么用?C++ cGangManager::gangs_on_mission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cGangManager的用法示例。


在下文中一共展示了cGangManager::gangs_on_mission方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gettext

cGirlGangFight::cGirlGangFight(sGirl *girl)
{
	m_girl = girl;
	m_girl_stats = 0;
	/*
	 *	set this up on the basis that she refuses to fight
	 */
	m_goon_stats = 0;
	m_max_goons = 0;
	//	m_ratio	 		= 0.0;
	//	m_dead_goons 	= 0;
	m_girl_fights = false;
	m_girl_wins = false;
	m_wipeout = false;
	m_unopposed = false;
	m_player_wins = false;
	/*
	 *	decide if she's going to fight or flee
	 */
	if (!g_Brothels.FightsBack(m_girl)) {
		return;
	}
	m_girl_fights = true;
	/*
	 *	ok, she fights. Find all the gangs on guard duty
	 */
	m_girl_wins = false;
	vector<sGang*> v = g_Gangs.gangs_on_mission(MISS_GUARDING);
	/*
	 *	no gang, so girl wins. PC combat is outside this class ATM
	 */
	if (v.size() == 0) {
		m_girl_wins = true;
		m_unopposed = true;
		return;
	}
	/*
	 *	we'll take goons from a random gang - distributes the casualties a bit
	 *	more evenly for multi-select brandings and the like
	 */
	int index = g_Dice.in_range(0, v.size() - 1);
	l.ss() << gettext("\ncGirlGangFight: random gang index = ") << index;
	l.ssend();
	sGang *gang = v[index];
	l.ss() << gettext("\ncGirlGangFight: gang = ") << gang->m_Name;
	l.ssend();
	/*
	 *	4 + 1 for each gang on guard duty
	 *	that way there's a benefit to multiple gangs guarding
	 */
	m_max_goons = 4 + v.size();
	/*
	 *	to the maximum of the number in the gang
	 */
	if (m_max_goons > gang->m_Num) {
		m_max_goons = gang->m_Num;
	}
	/*
	 *	now - sum the girl and gang stats
	 *	we're not going to average the gangs.
	 *	yes this gives them an unfair advantage
	 *	that's the point of having 5:1 odds :)
	 */
	m_girl_stats = m_girl->combat() + m_girl->magic() + m_girl->intelligence();
	/*
	 *	Now the gangs. I'm not factoring the girl's health
	 *	because there's something dramatically satisfying
	 *	about her breeaking out of the dungeon after being
	 *	tortured near unto death, and then still beating the
	 *	thugs up. You'd buy into it in a Hollywood blockbuster...
	 *
	 *	Annnnyway....
	 */
	m_goon_stats = *g_Gangs.GetWeaponLevel() * 5 * m_max_goons;
	for (int i = 0; i < m_max_goons; i++) {
		m_goon_stats += gang->combat() +
			gang->magic() +
			gang->intelligence()
			;
	}
	/*
	 *	the girl's base chance of winning is determined by the stat ratio
	 */
	m_odds = 1.0 * m_girl_stats / (m_goon_stats + m_girl_stats);
	/*
	 *	let's add some trait based bonuses
	 *	I'm not going to do any that are already reflected in stat values
	 *	(so no "Psychic" bonus, no "Tough" either)
	 *	we can streamline this with the trait overhaul
	 */
	if (m_girl->has_trait("Clumsy"))		m_odds -= 0.05;
	if (m_girl->has_trait("Broken Will"))	m_odds -= 0.10;
	if (m_girl->has_trait("Meek"))		m_odds -= 0.05;
	if (m_girl->has_trait("Dependant"))	m_odds -= 0.10;
	if (m_girl->has_trait("Fearless"))	m_odds += 0.10;
	if (m_girl->has_trait("Fleet of Foot"))	m_odds += 0.10;
	/*
	 *	get it back into the 0 <= N <= 1 range
	 */
	if (m_odds < 0) m_odds = 0;
//.........这里部分代码省略.........
开发者ID:taukita,项目名称:crazys-wm-mod,代码行数:101,代码来源:cGirlGangFight.cpp


注:本文中的cGangManager::gangs_on_mission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。