Skip to content

Commit

Permalink
Fixed that missiles did beam-damage (reduced by 50% against planets) …
Browse files Browse the repository at this point in the history
…instead of missile-damage. Fixed missing miss- and absorb-animations for missiles.
  • Loading branch information
Xilmi committed Oct 24, 2021
1 parent 6e08bfd commit 3685d0e
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/rotp/model/ships/ShipWeaponMissileType.java
Expand Up @@ -52,9 +52,17 @@ public void drawAttackEffect(CombatStack source, CombatStack target, Component c
@Override
public void fireUpon(CombatStack source, CombatStack target, int count) {
if (random() < target.autoMissPct())
{
if(target.mgr.showAnimations())
drawUnsuccessfulAttack(source, target);
return;
}
if (target.interceptsMissile(this))
{
if(target.mgr.showAnimations())
drawUnsuccessfulAttack(source, target);
return;
}

boolean isColony = target.isColony();
int minDamage = minDamage();
Expand All @@ -67,8 +75,10 @@ public void fireUpon(CombatStack source, CombatStack target, int count) {
float totalDamage = 0;
float damageLoss = damageLoss(source.distance);
float shieldMod = source.targetShieldMod(this)*shieldMod();
boolean successfullyHit = false;
for (int i=0;i<source.num;i++) {
if (random() <= hitPct) {
successfullyHit = true;
float damage = 0;
if (isColony)
damage = maxDamage;
Expand All @@ -77,11 +87,18 @@ public void fireUpon(CombatStack source, CombatStack target, int count) {

// adjust dmg for missiles that lose strength as they travel
damage = max(0,damage-damageLoss);
damage = target.takeBeamDamage(damage, shieldMod);
damage = target.takeMissileDamage(damage, shieldMod);
totalDamage += damage;
}
}
if (target.mgr.showAnimations() && (totalDamage >0))
tech().drawSuccessfulAttack(null, target, 0, totalDamage);
if (target.mgr.showAnimations())
{
if(totalDamage >0)
tech().drawSuccessfulAttack(null, target, 0, totalDamage);
else if (successfullyHit)
drawIneffectiveAttack(source, target);
else
drawUnsuccessfulAttack(source, target);
}
}
}

0 comments on commit 3685d0e

Please sign in to comment.