Forums have fallen into disuse, and discord is where the community is at. Please visit us on discord!
Code: [Select]private void InitializeFirePower( bool SetFull ) { long firepower = 0; if ( this.BaseAttackPower == 0 || this.BaseAttackRechargeSeconds == 0 ) firepower = 0; else { firepower = this.BaseAttackPower; if ( firepower > 400000 && !SetFull ) firepower = 400000; if ( !this.ExplosionsEqualsDeath ) //make sure not to overvalue autobombs, etc { firepower *= 20; // firepower <= BaseAttackPower before this line, and BaseAttackPower is an Int32, so no danger of overflowing an Int64 firepower /= this.BaseAttackRechargeSeconds; } firepower = firepower * ( 1 + this.NumberSecondaryShots ); if ( this.IsSelfDamaging ) //make sure not to overvalue cutlasses, etc { if ( firepower > this.BaseMaxHealth ) firepower = this.BaseMaxHealth; } } switch ( this.ShipType ) { case ShipType.Launched_Missile: case ShipType.Mine: firepower = 0; break; case ShipType.SpireCityFacility: if ( !SetFull ) firepower /= 2; //account for the general high difficulty of the spire campaign overall break; } firepower /= 50; if ( SetFull ) { if ( this.BaseAttackPower > 0 && firepower <= 0 ) firepower = 1; if ( firepower > Int32.MaxValue ) firepower = Int32.MaxValue; this.FullFirePower = (int)firepower; firepower = firepower + firepower + firepower; if ( firepower > Int32.MaxValue ) firepower = Int32.MaxValue; this.TripleFullFirePower = (int)firepower; } else { if ( this.BaseMoveSpeed <= 0 && !this.ShotIsSniper ) firepower /= 10; if ( this.IsUnableToHitFleetShips ) firepower /= 10; if ( this.BaseAttackPower > 0 && firepower <= 0 ) firepower = 1; if ( firepower > Int32.MaxValue ) firepower = Int32.MaxValue; this.AICheckFirePower = (int)firepower; } }Note that it doesn't account for other forms of "multiple shots per salvo" and thus drastically underestimates heavy beam cannons (but not spire photon lances), most aoe (particularly lightning), etc. Also pays no attention to vs-hull-type bonuses or the wacko bonuses like the polarizer, IRE, and vulture. May fix that one of these days The AICheckFirePower is used for:- the reinforcements "am I outnumbered" calculation in evaluating enemy firepower- for part of the threat-ball "should we keep waiting here?" -- basically it takes "total FullFirePower of allies on current planet - AICheckFirepower of enemies on current planet" + "the FullFirepower of the threat-ball itself" and if that is > "the FullFirePower of allies on target planet - AICheckFirepower of enemies on target planet" then it goes for it- for the "should we retreat?" logic in evaluating enemy firepower- for the hybrids' "ready to execute attack mission?" logic in evaluating enemy firepower; that was added in the past couple months or so (it used to just wait until 7/8ths of everyone who was coming was there)FullFirePower is used for everything else, including:- computing NearbyMilitaryUnitPower on the AI thread. I don't know much about what it does with that, but I think it's used for stuff like "can I take down that Fact-IV on my planet".Munitions boosts are sometimes considered, and sometimes not (threat-ball power doesn't use it since they'd be moving).
private void InitializeFirePower( bool SetFull ) { long firepower = 0; if ( this.BaseAttackPower == 0 || this.BaseAttackRechargeSeconds == 0 ) firepower = 0; else { firepower = this.BaseAttackPower; if ( firepower > 400000 && !SetFull ) firepower = 400000; if ( !this.ExplosionsEqualsDeath ) //make sure not to overvalue autobombs, etc { firepower *= 20; // firepower <= BaseAttackPower before this line, and BaseAttackPower is an Int32, so no danger of overflowing an Int64 firepower /= this.BaseAttackRechargeSeconds; } firepower = firepower * ( 1 + this.NumberSecondaryShots ); if ( this.IsSelfDamaging ) //make sure not to overvalue cutlasses, etc { if ( firepower > this.BaseMaxHealth ) firepower = this.BaseMaxHealth; } } switch ( this.ShipType ) { case ShipType.Launched_Missile: case ShipType.Mine: firepower = 0; break; case ShipType.SpireCityFacility: if ( !SetFull ) firepower /= 2; //account for the general high difficulty of the spire campaign overall break; } firepower /= 50; if ( SetFull ) { if ( this.BaseAttackPower > 0 && firepower <= 0 ) firepower = 1; if ( firepower > Int32.MaxValue ) firepower = Int32.MaxValue; this.FullFirePower = (int)firepower; firepower = firepower + firepower + firepower; if ( firepower > Int32.MaxValue ) firepower = Int32.MaxValue; this.TripleFullFirePower = (int)firepower; } else { if ( this.BaseMoveSpeed <= 0 && !this.ShotIsSniper ) firepower /= 10; if ( this.IsUnableToHitFleetShips ) firepower /= 10; if ( this.BaseAttackPower > 0 && firepower <= 0 ) firepower = 1; if ( firepower > Int32.MaxValue ) firepower = Int32.MaxValue; this.AICheckFirePower = (int)firepower; } }