Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def process_missile_event(target, gunner, origin, destination, missile, acrrng, intel, ecm, eccm):
- range, orange = 0.0, 0.0
- tecm, tecm, hit, roll, dskill, lskill = 0, 0, 0, 0
- # Where is the target now?
- orange = dsDistance(orgin, target.coords())
- range = dsDistance(destination, target.coords())
- if _DEBUG_SPACE
- cemit("debug", "Range: %2.2f acrrng: %2.2f", (range, acrrng))
- if orange > missle.maxrange():
- # Missile has expended it's fuel before reaching the target.
- dsNotifyAllShips(target, "Missile %s from %d has missed." % (missile.id, launcher))
- dsNotifyConsoles(launcher, "The missile targeting %s has missed." % target, mode=_CM_HELM)
- dsNotifyOfFire(launcher, target, 10, 50, _WM_MISSILE, 0)
- return
- if range > acrrng:
- dsNotifyConsoles(target, "Missile %d from %s has missed." % (missile.id, launcher))
- dsNotifyOfFire(launcher, target, 10, 50, _WM_MISSILE, 0)
- dsNotifyConsoles(launcher, "The missile you launched on %s has missed." % target)
- return
- # We might have a hit here!
- if target.checkflag("EWON"):
- #launcher vs target.
- tecm = target.helm.ecm
- else:
- tecm = 0
- if launcher.checkflag("EWON"):
- teccm = launcher.helm.eccm + eccm
- else:
- teccm = eccm
- if _DEBUG_SPACE:
- cemit("debug", "tecm: %d teccm: %d" % (tecm, teccm))
- # Give interceptor batteries a chance to take out any incomming missiles/torpedos
- if target.checkflag("INTERON"):
- if handle_interceptor(target, launcher, missile, teccm, tecm, destination):
- return
- hit = 50 + teccm - tecm + (intel - 50) + lskill - dskill
- roll = dsRandom() % 100
- roll++
- if _DEBUG_SPACE
- cemit("debug", "hit: %d roll: %d" % (hit, roll))
- if roll < hit:
- # a hit!
- if (!target.checkflag("DEAD"):
- dsNotifyAllShips(target, "Missile %d from %s has hit %s.", (missile.id, launcher, target))
- dsNotifyConsoles(launcher, "The missile you launched on %d has hit." % target, mode=_CM_HELM)
- dsShipNotifyOfFire(launcher, target, 10, 50, _WM_MISSILE, 1)
- if (missile.checkflag("STASIS"):
- target.take_damage(missle.damage, 2, dsGetArc(launcher, target))
- else:
- target.take_damage(missle.damage, 1, dsGetArc(launcher, target))
- if (missile.checkflag("AOE"):
- target.take_aoe_damage(missile)
- else:
- dsNotifyConsoles(launcher, "The ship your missle was targetting has been destroyed.", mode=_CM_HELM)
- else:
- if !target.checkflag("DEAD"):
- dsNotifyConsoles(target, "Missle from %d has missed." % launcher)
- dsShipNotifyOfFire(launcher, target, 10, 50, _WM_MISSILE, 0)
- dsNotifyConsoles(launcher, "The missile you launched on %s has missed." % target, mode=_CM_HELM)
- else:
- dsNotifyConsoles(launcher, "The ship your missle was targetting has been destroyed.", mode=_CM_HELM)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement