torpedo fire: Reveal sub hit by return fire or depth charge

This partly reverts a change made in Empire 2.3 to tell a submarine's
opponent only that he's dealing with a "sub" instead of the
submarine's UID and type.  Hiding submarines is done by prsub().
Uses:

* Command torpedo: defender depth charges or torpedoes an attacking
  submarine

  If you can attack a submarine reactively, you should be able to
  attack it actively, too.  But that requires its UID.  Reveal it
  again, but keep the type hidden.

* Command fire: defender fires back at a submarine using its deck gun

  Submarines need to surface to fire deck guns, so they shouldn't be
  treated any different than surface ships.  Revert Empire 2.3's
  change entirely there, i.e. defender learns type as well as UID.

* Command torpedo: attacking submarine hits its target

  Keep the submarine hidden.

* Commands torpedo and fire: attacking ship hits a submarine

  The attacker passed the UID as command argument, so it doesn't
  matter whether we print it or not.  Printing it is simpler to code,
  so do that.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-02-15 08:58:20 +01:00
parent 76214dbfbd
commit 17abdbc5e0
5 changed files with 27 additions and 26 deletions

View file

@ -481,7 +481,7 @@ do_defdam(struct emp_qelem *list, double odds)
if (vict) if (vict)
wu(0, vict, wu(0, vict,
"Return fire hit %s in %s for %d damage.\n", "Return fire hit %s in %s for %d damage.\n",
prsub(&ship), xyas(ship.shp_x, ship.shp_y, vict), dam); prship(&ship), xyas(ship.shp_x, ship.shp_y, vict), dam);
shipdamage(&ship, dam); shipdamage(&ship, dam);
putship(ship.shp_uid, &ship); putship(ship.shp_uid, &ship);
} else { } else {

View file

@ -178,7 +178,8 @@ torp(void)
pr("BOOM!...\n"); pr("BOOM!...\n");
if (vshipown != 0) if (vshipown != 0)
wu(0, vshipown, "%s in %s torpedoed %s for %d damage.\n", wu(0, vshipown, "%s in %s torpedoed %s for %d damage.\n",
prsub(&sub), xyas(sub.shp_x, sub.shp_y, vshipown), sub_mcp->m_flags & M_SUB ? "sub" : prship(&sub),
xyas(sub.shp_x, sub.shp_y, vshipown),
prship(&vship), dam); prship(&vship), dam);
pr("Torpedo hit %s for %d damage.\n", prsub(&vship), dam); pr("Torpedo hit %s for %d damage.\n", prsub(&vship), dam);
if (!(mchr[vship.shp_type].m_flags & M_SUB)) { if (!(mchr[vship.shp_type].m_flags & M_SUB)) {
@ -338,7 +339,7 @@ char *
prsub(struct shpstr *sp) prsub(struct shpstr *sp)
{ {
if (mchr[(int)sp->shp_type].m_flags & M_SUB) if (mchr[(int)sp->shp_type].m_flags & M_SUB)
return "sub"; return prbuf("sub #%d", sp->shp_uid);
else else
return prship(sp); return prship(sp);
} }

View file

@ -779,30 +779,30 @@
Play#1 output Play#1 1 dd destroyer (#5) ready to fire Play#1 output Play#1 1 dd destroyer (#5) ready to fire
Play#1 output Play#1 1 range is 2.00 (1.50) Play#1 output Play#1 1 range is 2.00 (1.50)
Play#1 output Play#1 1 \007Kawhomp!!! Play#1 output Play#1 1 \007Kawhomp!!!
Play#1 output Play#1 1 Shells hit sub in 6,0 for 35 damage. Play#1 output Play#1 1 Shells hit sub #13 in 6,0 for 35 damage.
Play#1 output Play#1 6 0 548 Play#1 output Play#1 6 0 548
Play#1 input fire sh 6 12 Play#1 input fire sh 6 12
Play#1 command fire Play#1 command fire
Play#1 output Play#1 1 dd destroyer (#6) ready to fire Play#1 output Play#1 1 dd destroyer (#6) ready to fire
Play#1 output Play#1 1 range is 2.00 (1.50) Play#1 output Play#1 1 range is 2.00 (1.50)
Play#1 output Play#1 1 \007Kawhomp!!! Play#1 output Play#1 1 \007Kawhomp!!!
Play#1 output Play#1 1 Shells hit sub in 2,2 for 40 damage. Play#1 output Play#1 1 Shells hit sub #12 in 2,2 for 40 damage.
Play#1 output Play#1 6 0 547 Play#1 output Play#1 6 0 547
Play#1 input fire sh 5 11 Play#1 input fire sh 5 11
Play#1 command fire Play#1 command fire
Play#1 output Play#1 1 dd destroyer (#5) ready to fire Play#1 output Play#1 1 dd destroyer (#5) ready to fire
Play#1 output Play#1 1 range is 2.00 (1.50) Play#1 output Play#1 1 range is 2.00 (1.50)
Play#1 output Play#1 1 \007Kawhomp!!! Play#1 output Play#1 1 \007Kawhomp!!!
Play#1 output Play#1 1 Shells hit sub in 6,0 for 37 damage. Play#1 output Play#1 1 Shells hit sub #11 in 6,0 for 37 damage.
Play#1 output Play#1 1 sub sunk! Play#1 output Play#1 1 sub #11 sunk!
Play#1 output Play#1 6 0 546 Play#1 output Play#1 6 0 546
Play#1 input fire sh 6 10 Play#1 input fire sh 6 10
Play#1 command fire Play#1 command fire
Play#1 output Play#1 1 dd destroyer (#6) ready to fire Play#1 output Play#1 1 dd destroyer (#6) ready to fire
Play#1 output Play#1 1 range is 2.00 (1.50) Play#1 output Play#1 1 range is 2.00 (1.50)
Play#1 output Play#1 1 \007Kawhomp!!! Play#1 output Play#1 1 \007Kawhomp!!!
Play#1 output Play#1 1 Shells hit sub in 2,2 for 34 damage. Play#1 output Play#1 1 Shells hit sub #10 in 2,2 for 34 damage.
Play#1 output Play#1 1 sub sunk! Play#1 output Play#1 1 sub #10 sunk!
Play#1 output Play#1 6 0 545 Play#1 output Play#1 6 0 545
Play#1 input navi 5 jh Play#1 input navi 5 jh
Play#1 command navigate Play#1 command navigate

View file

@ -277,21 +277,21 @@
Play#1 output Play#1 1 dd destroyer (#5) ready to fire Play#1 output Play#1 1 dd destroyer (#5) ready to fire
Play#1 output Play#1 1 range is 1.00 (1.33) Play#1 output Play#1 1 range is 1.00 (1.33)
Play#1 output Play#1 1 \007Kawhomp!!! Play#1 output Play#1 1 \007Kawhomp!!!
Play#1 output Play#1 1 Shells hit sub in -5,1 for 42 damage. Play#1 output Play#1 1 Shells hit sub #50 in -5,1 for 42 damage.
Play#1 output Play#1 6 0 613 Play#1 output Play#1 6 0 613
Play#1 input fire sh 5 51 Play#1 input fire sh 5 51
Play#1 command fire Play#1 command fire
Play#1 output Play#1 1 dd destroyer (#5) ready to fire Play#1 output Play#1 1 dd destroyer (#5) ready to fire
Play#1 output Play#1 1 range is 1.00 (1.33) Play#1 output Play#1 1 range is 1.00 (1.33)
Play#1 output Play#1 1 \007Kawhomp!!! Play#1 output Play#1 1 \007Kawhomp!!!
Play#1 output Play#1 1 Shells hit sub in -5,1 for 45 damage. Play#1 output Play#1 1 Shells hit sub #51 in -5,1 for 45 damage.
Play#1 output Play#1 6 0 612 Play#1 output Play#1 6 0 612
Play#1 input fire sh 5 52 Play#1 input fire sh 5 52
Play#1 command fire Play#1 command fire
Play#1 output Play#1 1 dd destroyer (#5) ready to fire Play#1 output Play#1 1 dd destroyer (#5) ready to fire
Play#1 output Play#1 1 range is 2.00 (1.33) Play#1 output Play#1 1 range is 2.00 (1.33)
Play#1 output Play#1 1 \007Kawhomp!!! Play#1 output Play#1 1 \007Kawhomp!!!
Play#1 output Play#1 1 Shells hit sub in -5,1 for 34 damage. Play#1 output Play#1 1 Shells hit sub #52 in -5,1 for 34 damage.
Play#1 output Play#1 6 0 611 Play#1 output Play#1 6 0 611
Play#1 input navi 5 gyuh Play#1 input navi 5 gyuh
Play#1 command navigate Play#1 command navigate
@ -303,7 +303,7 @@
Play#1 output Play#1 1 dd destroyer (#5) ready to fire Play#1 output Play#1 1 dd destroyer (#5) ready to fire
Play#1 output Play#1 1 range is 2.00 (1.33) Play#1 output Play#1 1 range is 2.00 (1.33)
Play#1 output Play#1 1 \007Kawhomp!!! Play#1 output Play#1 1 \007Kawhomp!!!
Play#1 output Play#1 1 Shells hit sub in -4,-2 for 34 damage. Play#1 output Play#1 1 Shells hit sub #53 in -4,-2 for 34 damage.
Play#1 output Play#1 1 \007 Play#1 output Play#1 1 \007
Play#1 output Play#1 1 Defenders fire back! Play#1 output Play#1 1 Defenders fire back!
Play#1 output Play#1 1 Return fire hit dd destroyer (#5) in -5,-1 for 6 damage. Play#1 output Play#1 1 Return fire hit dd destroyer (#5) in -5,-1 for 6 damage.

View file

@ -104,7 +104,7 @@
Play#1 output Play#1 1 Effective torpedo range is 1.0 Play#1 output Play#1 1 Effective torpedo range is 1.0
Play#1 output Play#1 1 Whooosh... Hitchance = 90% Play#1 output Play#1 1 Whooosh... Hitchance = 90%
Play#1 output Play#1 1 BOOM!... Play#1 output Play#1 1 BOOM!...
Play#1 output Play#1 1 Torpedo hit sub for 46 damage. Play#1 output Play#1 1 Torpedo hit sub #45 for 46 damage.
Play#1 output Play#1 6 0 592 Play#1 output Play#1 6 0 592
Play#1 input torp 10 50 Play#1 input torp 10 50
Play#1 command torpedo Play#1 command torpedo
@ -176,7 +176,7 @@
Play#1 output Play#1 1 Effective torpedo range is 1.0 Play#1 output Play#1 1 Effective torpedo range is 1.0
Play#1 output Play#1 1 Whooosh... Hitchance = 45% Play#1 output Play#1 1 Whooosh... Hitchance = 45%
Play#1 output Play#1 1 BOOM!... Play#1 output Play#1 1 BOOM!...
Play#1 output Play#1 1 Torpedo hit sub for 70 damage. Play#1 output Play#1 1 Torpedo hit sub #60 for 70 damage.
Play#1 output Play#1 6 0 565 Play#1 output Play#1 6 0 565
Play#1 input torp 15 61 Play#1 input torp 15 61
Play#1 command torpedo Play#1 command torpedo
@ -193,7 +193,7 @@
Play#1 output Play#1 1 Effective torpedo range is 1.0 Play#1 output Play#1 1 Effective torpedo range is 1.0
Play#1 output Play#1 1 Whooosh... Hitchance = 45% Play#1 output Play#1 1 Whooosh... Hitchance = 45%
Play#1 output Play#1 1 BOOM!... Play#1 output Play#1 1 BOOM!...
Play#1 output Play#1 1 Torpedo hit sub for 67 damage. Play#1 output Play#1 1 Torpedo hit sub #62 for 67 damage.
Play#1 output Play#1 6 0 559 Play#1 output Play#1 6 0 559
Play#1 input torp 15 63 Play#1 input torp 15 63
Play#1 command torpedo Play#1 command torpedo
@ -216,8 +216,8 @@
Play#1 output Play#1 1 Effective torpedo range is 3.0 Play#1 output Play#1 1 Effective torpedo range is 3.0
Play#1 output Play#1 1 Whooosh... Hitchance = 36% Play#1 output Play#1 1 Whooosh... Hitchance = 36%
Play#1 output Play#1 1 BOOM!... Play#1 output Play#1 1 BOOM!...
Play#1 output Play#1 1 Torpedo hit sub for 114 damage. Play#1 output Play#1 1 Torpedo hit sub #66 for 114 damage.
Play#1 output Play#1 1 sub sunk! Play#1 output Play#1 1 sub #66 sunk!
Play#1 output Play#1 6 0 550 Play#1 output Play#1 6 0 550
Play#1 input torp 11 67 Play#1 input torp 11 67
Play#1 command torpedo Play#1 command torpedo
@ -225,7 +225,7 @@
Play#1 output Play#1 1 Effective torpedo range is 3.0 Play#1 output Play#1 1 Effective torpedo range is 3.0
Play#1 output Play#1 1 Whooosh... Hitchance = 36% Play#1 output Play#1 1 Whooosh... Hitchance = 36%
Play#1 output Play#1 1 BOOM!... Play#1 output Play#1 1 BOOM!...
Play#1 output Play#1 1 Torpedo hit sub for 81 damage. Play#1 output Play#1 1 Torpedo hit sub #67 for 81 damage.
Play#1 output Play#1 6 0 547 Play#1 output Play#1 6 0 547
Play#1 input torp 11 68 Play#1 input torp 11 68
Play#1 command torpedo Play#1 command torpedo
@ -566,20 +566,20 @@
Play#0 output Play#0 1 dd destroyer (#70) sunk! Play#0 output Play#0 1 dd destroyer (#70) sunk!
Play#0 output Play#0 1 sub in 2,6 torpedoed bb battleship (#75) for 64 damage. Play#0 output Play#0 1 sub in 2,6 torpedoed bb battleship (#75) for 64 damage.
Play#0 output Play#0 1 bb battleship (#75) takes 32 Play#0 output Play#0 1 bb battleship (#75) takes 32
Play#0 output Play#0 1 af asw frigate (#71) @ 2,6 torpedoed sub Play#0 output Play#0 1 af asw frigate (#71) @ 2,6 torpedoed sub #25
Play#0 output Play#0 1 dd destroyer (#76) depth charged sub Play#0 output Play#0 1 dd destroyer (#76) depth charged sub #25
Play#0 output Play#0 1 sub in 2,6 torpedoed bb battleship (#75) for 79 damage. Play#0 output Play#0 1 sub in 2,6 torpedoed bb battleship (#75) for 79 damage.
Play#0 output Play#0 1 bb battleship (#75) takes 40 Play#0 output Play#0 1 bb battleship (#75) takes 40
Play#0 output Play#0 1 af asw frigate (#71) @ 2,6 torpedoed sub Play#0 output Play#0 1 af asw frigate (#71) @ 2,6 torpedoed sub #26
Play#0 output Play#0 1 dd destroyer (#76) depth charged sub Play#0 output Play#0 1 dd destroyer (#76) depth charged sub #26
Play#0 output Play#0 1 sub in 2,6 torpedoed bb battleship (#75) for 60 damage. Play#0 output Play#0 1 sub in 2,6 torpedoed bb battleship (#75) for 60 damage.
Play#0 output Play#0 1 bb battleship (#75) takes 30 Play#0 output Play#0 1 bb battleship (#75) takes 30
Play#0 output Play#0 1 af asw frigate (#71) @ 2,6 torpedoed sub Play#0 output Play#0 1 af asw frigate (#71) @ 2,6 torpedoed sub #27
Play#0 output Play#0 1 sub in 2,6 torpedoed bb battleship (#75) for 73 damage. Play#0 output Play#0 1 sub in 2,6 torpedoed bb battleship (#75) for 73 damage.
Play#0 output Play#0 1 bb battleship (#75) takes 37 Play#0 output Play#0 1 bb battleship (#75) takes 37
Play#0 output Play#0 1 bb battleship (#75) sunk! Play#0 output Play#0 1 bb battleship (#75) sunk!
Play#0 output Play#0 1 af asw frigate (#71) missed sub with a torpedo at 2,6 Play#0 output Play#0 1 af asw frigate (#71) missed sub #28 with a torpedo at 2,6
Play#0 output Play#0 1 dd destroyer (#76) depth charged sub Play#0 output Play#0 1 dd destroyer (#76) depth charged sub #28
Play#0 output Play#0 6 0 638 Play#0 output Play#0 6 0 638
Play#0 input read 3 Play#0 input read 3
Play#0 command read Play#0 command read