@@ -580,10 +580,16 @@ Real WeaponTemplate::estimateWeaponTemplateDamage(
580
580
return 0 .0f ;
581
581
}
582
582
583
+ const Real damageAmount = getPrimaryDamage (bonus);
584
+ if ( victimObj == NULL )
585
+ {
586
+ return damageAmount;
587
+ }
588
+
583
589
DamageType damageType = getDamageType ();
584
590
DeathType deathType = getDeathType ();
585
591
586
- if (victimObj && victimObj->isKindOf (KINDOF_SHRUBBERY))
592
+ if ( victimObj->isKindOf (KINDOF_SHRUBBERY) )
587
593
{
588
594
if (deathType == DEATH_BURNED)
589
595
{
@@ -610,7 +616,7 @@ Real WeaponTemplate::estimateWeaponTemplateDamage(
610
616
611
617
612
618
613
- if (damageType == DAMAGE_SURRENDER || m_allowAttackGarrisonedBldgs)
619
+ if ( damageType == DAMAGE_SURRENDER || m_allowAttackGarrisonedBldgs )
614
620
{
615
621
ContainModuleInterface* contain = victimObj->getContain ();
616
622
if ( contain && contain->getContainCount () > 0 && contain->isGarrisonable () && !contain->isImmuneToClearBuildingAttacks () )
@@ -620,46 +626,29 @@ Real WeaponTemplate::estimateWeaponTemplateDamage(
620
626
}
621
627
}
622
628
623
- if ( victimObj )
629
+ if ( damageType == DAMAGE_DISARM )
624
630
{
625
- if ( damageType == DAMAGE_DISARM )
626
- {
627
- if ( victimObj->isKindOf ( KINDOF_MINE ) || victimObj->isKindOf ( KINDOF_BOOBY_TRAP ) || victimObj->isKindOf ( KINDOF_DEMOTRAP ) )
628
- {
629
- // this is just a nonzero value, to ensure we can target mines with disarm weapons, regardless...
630
- return 1 .0f ;
631
- }
632
- return 0 .0f ;
633
- }
634
- if ( damageType == DAMAGE_DEPLOY && !victimObj->isAirborneTarget () )
631
+ if ( victimObj->isKindOf ( KINDOF_MINE ) || victimObj->isKindOf ( KINDOF_BOOBY_TRAP ) || victimObj->isKindOf ( KINDOF_DEMOTRAP ) )
635
632
{
633
+ // this is just a nonzero value, to ensure we can target mines with disarm weapons, regardless...
636
634
return 1 .0f ;
637
635
}
636
+ return 0 .0f ;
637
+ }
638
+ if ( damageType == DAMAGE_DEPLOY && !victimObj->isAirborneTarget () )
639
+ {
640
+ return 1 .0f ;
638
641
}
639
642
640
643
// @todo Kris need to examine the DAMAGE_HACK type for damage estimation purposes.
641
644
// Likely this damage type will have threat implications that won't properly be dealt with until resolved.
642
645
643
- // const Coord3D* sourcePos = sourceObj->getPosition();
644
- if (victimPos == NULL )
645
- {
646
- victimPos = victimObj->getPosition ();
647
- }
648
-
649
- Real damageAmount = getPrimaryDamage (bonus);
650
- if (victimObj == NULL )
651
- {
652
- return damageAmount;
653
- }
654
- else
655
- {
656
- DamageInfoInput damageInfo;
657
- damageInfo.m_damageType = damageType;
658
- damageInfo.m_deathType = deathType;
659
- damageInfo.m_sourceID = sourceObj->getID ();
660
- damageInfo.m_amount = damageAmount;
661
- return victimObj->estimateDamage (damageInfo);
662
- }
646
+ DamageInfoInput damageInfo;
647
+ damageInfo.m_damageType = damageType;
648
+ damageInfo.m_deathType = deathType;
649
+ damageInfo.m_sourceID = sourceObj->getID ();
650
+ damageInfo.m_amount = damageAmount;
651
+ return victimObj->estimateDamage (damageInfo);
663
652
}
664
653
665
654
// -------------------------------------------------------------------------------------------------
0 commit comments