示例#1
0
CString CCyberDeckClass::GetReference (const CItem *pItem, CSpaceObject *pInstalled)

//	GetReference
//
//	Returns reference information

	{
	return strPatternSubst("%s (%d); %s", 
			m_Program.sProgramName.GetASCIIZPointer(), 
			m_Program.iAILevel,
			GetReferencePower(pItem).GetASCIIZPointer());
	}
CString CCyberDeckClass::GetReference (CItemCtx &Ctx, int iVariant, DWORD dwFlags)

//	GetReference
//
//	Returns reference information

	{
	return strPatternSubst("%s (%d); %s", 
			m_Program.sProgramName, 
			m_Program.iAILevel,
			GetReferencePower(Ctx));
	}
示例#3
0
CString CShieldClass::GetReference (CItemCtx &Ctx, int iVariant, DWORD dwFlags)

//	GetReference
//
//	Returns a string that describes the basic attributes
//	of this shield
//
//	Example:
//
//		20 hp (average regen); 100MW

	{
	int i;

	CString sReference;
	CString sRegeneration;
	const CItemEnhancement &Mods = Ctx.GetMods();

	//	Compute the strength string

	int iMin, iMax;
	CalcMinMaxHP(Ctx, m_iMaxCharges, 0, 0, &iMin, &iMax);

	//	Compute the regeneration

	if (m_iRegenHP > 0)
		{
		int iRate = (int)((10.0 * g_TicksPerSecond * m_iRegenHP / m_iRegenRate) + 0.5);
		if (iRate == 0)
			sRegeneration = CONSTLIT("<0.1 hp/sec");
		else if ((iRate % 10) == 0)
			sRegeneration = strPatternSubst(CONSTLIT("%d hp/sec"), iRate / 10);
		else
			sRegeneration = strPatternSubst(CONSTLIT("%d.%d hp/sec"), iRate / 10, iRate % 10);
		}
	else
		sRegeneration = CONSTLIT("none");

	sReference = strPatternSubst("%s — regen @ %s", 
			GetReferencePower(Ctx),
			sRegeneration);

	//	Reflection

	for (i = 0; i < damageCount; i++)
		{
		if (m_Reflective.InSet((DamageTypes)i)
				|| (Mods.IsReflective() && Mods.GetDamageType() == i))
			sReference.Append(strPatternSubst(CONSTLIT(" — %s-reflecting"), GetDamageShortName((DamageTypes)i)));
		}

	return sReference;
	}
示例#4
0
CString CShieldClass::GetReference (CItemCtx &Ctx, int iVariant, DWORD dwFlags)

//	GetReference
//
//	Returns a string that describes the basic attributes
//	of this shield
//
//	Example:
//
//		20 hp (average regen); 100MW

	{
	int i;

	CString sReference;
	const CItemEnhancement &Mods = Ctx.GetMods();

	//	Compute the strength string

	int iMin, iMax;
	CalcMinMaxHP(Ctx, m_iMaxCharges, 0, 0, &iMin, &iMax);

	//	Compute the regeneration

	sReference = strPatternSubst("%s — regen @ %s", 
			GetReferencePower(Ctx),
			m_Regen.GetReferenceRate(CONSTLIT("hp/sec")));

	//	Reflection

	for (i = 0; i < damageCount; i++)
		{
		if (m_Reflective.InSet((DamageTypes)i)
				|| (Mods.IsReflective() && Mods.GetDamageType() == i))
			sReference.Append(strPatternSubst(CONSTLIT(" — %s-reflecting"), GetDamageShortName((DamageTypes)i)));
		}

	return sReference;
	}
示例#5
0
文件: Devices.cpp 项目: bmer/Mammoth
CString CDeviceClass::GetReference (CItemCtx &Ctx, int iVariant, DWORD dwFlags)

//	GetReference
//
//	Returns reference string

	{
	CString sReference;
	
	//	For a device we always add power and other properties.
	//	(If iVariant != -1 then it means that we're looking for reference on a
	//	missile or someting).
	
	if (iVariant == -1)
		{
		CInstalledDevice *pDevice = Ctx.GetDevice();

		//	Start with power requirements

		AppendReferenceString(&sReference, GetReferencePower(Ctx));

		//	Non-standard slots

		if (GetSlotsRequired() != 1)
			AppendReferenceString(&sReference, strPatternSubst(CONSTLIT("%d Slots"), GetSlotsRequired()));

		//	External devices

		if (IsExternal() || (pDevice && pDevice->IsExternal()))
			AppendReferenceString(&sReference, CONSTLIT("External"));
		}

	//	Combine with our subclass

	AppendReferenceString(&sReference, OnGetReference(Ctx, iVariant, dwFlags));
	return sReference;
	}