Page 1 of 1

AAVulnerability - Is it binary or cumulative?

Posted: Fri Sep 28, 2012 7:57 pm
by GottaLove88s
Pip/Iain,

Quick question gents. If a Hurricane has AAVulnerability of 50, is this a binary or a cumulative effect?

Meaning, if my enemy has 1x AA gun, my Hurricane has X% vulnerability. Does my risk of being shot down increase if the enemy has 2x or 3x AA guns on the map? Or is it just an on/off chance of being shot down, whenever the enemy has at least one AA?

Sorry. I can't find the code that processes this...

Thanks!
:-)

Re: AAVulnerability - Is it binary or cumulative?

Posted: Fri Sep 28, 2012 8:22 pm
by pipfromslitherine
The code is in Airstrike.bsf. It is a total of the AA guns, limited to a value of 90% - which is then affected by the vulnerablity of the attacking plane.

Cheers

Pip

Re: AAVulnerability - Is it binary or cumulative?

Posted: Fri Sep 28, 2012 8:38 pm
by GottaLove88s
Thanks Pip, Found the Airstrike.BSF.

It looks like it adds up all of the AAValues, eg. each 88 counts 35%, each Wirbelwind counts 50%, capped at 90%.
But I can't see where it compares the sum of the AAValues to the AAVulnerability... Sorry, I'm probably being blind...?

Is the shot down test just a simple product of AAVulnerability multiplied by total AAValue? So a Hurricane (AAVulnerability of 50%) vs. 2x 88s and 1x Wirbelwind (total AAValue of 120%, capped at 90%) has a 50% x 90% = 45% chance of being shot down?

Code: Select all

// if there is nothing on the targeted tile, we look for another target.
	i = FindAirTarget(x, y, 5, side) ;
	
	// kinda ugly, we have to send in the result in a single value.
	if( i != 0 )
	{
		x = i >> 12 ;
		y = i & 4095 ;
	}
	
	
	i = AAFire(x, y, side, 20, GetBonusValue("AAVulnerable", GetCurrentSide(), name)) ;

	effectX = x;
	effectY = y;
	
	AddVizCamCenter(x,y) ;
	AddVizDelay(30) ; // 1 second delay so we can see what is going on	
	AddVizFunctionCall("HideEffectMarker", markerID) ;


	effectX*=100;
	effectX += 50 ;
	effectY*=100 ;
	effectY+=50 ;
	
	// to force a shooting down 
	//i = 1000 ;

	if( i > Rand(0,100))
	{
		Log("Shooting down...") ;
		// shoot it down!
		StartWorkString() ;
		PrintWorkStringLiteral(mesh); 
		PrintWorkStringLiteral("_die") ;
		// play the _die version of the airstrike
		Log(GetWorkString()) ;
		AddVizFunctionCall("PlaySFX", effectX, effectY, 90) ;
		AddVizSpotAnim(effectX, effectY, GetWorkString(), 0, -1) ;		
	
		AddVizDelay(5) ;
		
		// this is very ugly indeed.  But otherwise we would need to have some way to store and release strings
		AddVizFunctionCall("StartWorkString", 11) ;
		AddVizFunctionCall("PrintWorkStringLiteral","BHead0Image:",11) ;
		AddVizFunctionCall("PrintWorkStringLiteral",name,11) ;
		
		AddVizFunctionCall("StartWorkString",12) ;
		AddVizFunctionCall("PrintWorkStringLiteral","IDS_BPOPDIE_", 12) ;
		AddVizFunctionCall("PrintWorkStringLiteral",name, 12) ;	
			
		AddVizFunctionCall("ShowUIScreen", "BattleHead0", "Anim1", GetWorkString(12), GetWorkString(11)) ;			
	}
	else
	{
		// attack success!
		if( GetBonusValue("IncomingSFX", GetCurrentSide(), name) != 0 )
		{
			AddVizFunctionCall("PlaySFX", effectX, effectY, GetBonusValue("IncomingSFX", GetCurrentSide(), name)) ;
		}
		AddVizSpotAnim(effectX, effectY, mesh, 0, 1000) ;		

		// attack tiles
		bx = x-GetBonusValue("BombFrontX", GetCurrentSide(), name) ;
		bmaxx = bx + GetBonusValue("BombLengthX", GetCurrentSide(), name) ;
		minX = x-GetBonusValue("FrontX", GetCurrentSide(), name) ;
		maxX = minX + GetBonusValue("LengthX", GetCurrentSide(), name) ;
		for (i=maxX; i>minX; i--)
		{
			tiley = y + Rand(-GetBonusValue("SpreadY", GetCurrentSide(), name), GetBonusValue("SpreadY", GetCurrentSide(), name)) ;

Re: AAVulnerability - Is it binary or cumulative?

Posted: Sat Sep 29, 2012 1:15 am
by pipfromslitherine
IIRC the function returns the cumulative value of (total AA capped at 90) x (vulnerability) and then if that is < Rand(0,100) then it gets shot down.

Cheers

Pip

Re: AAVulnerability - Is it binary or cumulative?

Posted: Sat Sep 29, 2012 6:22 am
by GottaLove88s
Thanks Pip, that makes sense