Skip to content

Commit

Permalink
Merge pull request #1241 from Fate-JH/cerberus-off-damage
Browse files Browse the repository at this point in the history
Unchained Dog Bite
  • Loading branch information
Fate-JH authored Oct 1, 2024
2 parents 623a60d + 9bd9cb0 commit b8da7e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1783,7 +1783,7 @@ object GlobalDefinitionsProjectile {
spitfire_aa_ammo_projectile.Lifespan = 5f
ProjectileDefinition.CalculateDerivedFields(spitfire_aa_ammo_projectile)
spitfire_aa_ammo_projectile.Modifiers = List(
//FlakHit,
CerberusTurretWrongTarget,
FlakBurst,
MaxDistanceCutoff
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright (c) 2020 PSForever
package net.psforever.objects.vital.projectile

import net.psforever.objects.GlobalDefinitions
import net.psforever.objects.ballistics._
import net.psforever.objects.equipment.ChargeFireModeDefinition
import net.psforever.objects.sourcing.PlayerSource
import net.psforever.objects.sourcing.{PlayerSource, VehicleSource}
import net.psforever.objects.vital.base._
import net.psforever.objects.vital.damage.DamageModifierFunctions
import net.psforever.objects.vital.interaction.DamageInteraction
Expand Down Expand Up @@ -354,6 +355,19 @@ case object ShieldAgainstRadiation extends ProjectileDamageModifiers.Mod {
}
}

/** The Cerberus turret can not target any entities besides flying vehicles.
* An exception to this rule, however, happens when retaliating against something that damaged it first. */
case object CerberusTurretWrongTarget extends ProjectileDamageModifiers.Mod {
def calculate(damage: Int, data: DamageInteraction, cause: ProjectileReason): Int = {
data.target match {
case v: VehicleSource if GlobalDefinitions.isFlightVehicle(v.Definition) =>
damage
case _ =>
damage - (math.random() * 3d).toInt - 1
}
}
}

/* Functions */
object ProjectileDamageModifierFunctions {
/**
Expand Down

0 comments on commit b8da7e4

Please sign in to comment.