From 17abdbc5e0d89706f62bb3d91ba0636b6a980df9 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 15 Feb 2015 08:58:20 +0100 Subject: [PATCH] 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 --- src/lib/commands/mfir.c | 2 +- src/lib/commands/torp.c | 5 +++-- tests/fire/journal.log | 12 ++++++------ tests/retreat/journal.log | 8 ++++---- tests/torpedo/journal.log | 26 +++++++++++++------------- 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/lib/commands/mfir.c b/src/lib/commands/mfir.c index d74b25d6..57c41623 100644 --- a/src/lib/commands/mfir.c +++ b/src/lib/commands/mfir.c @@ -481,7 +481,7 @@ do_defdam(struct emp_qelem *list, double odds) if (vict) wu(0, vict, "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); putship(ship.shp_uid, &ship); } else { diff --git a/src/lib/commands/torp.c b/src/lib/commands/torp.c index b7f29665..7c0902da 100644 --- a/src/lib/commands/torp.c +++ b/src/lib/commands/torp.c @@ -178,7 +178,8 @@ torp(void) pr("BOOM!...\n"); if (vshipown != 0) 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); pr("Torpedo hit %s for %d damage.\n", prsub(&vship), dam); if (!(mchr[vship.shp_type].m_flags & M_SUB)) { @@ -338,7 +339,7 @@ char * prsub(struct shpstr *sp) { if (mchr[(int)sp->shp_type].m_flags & M_SUB) - return "sub"; + return prbuf("sub #%d", sp->shp_uid); else return prship(sp); } diff --git a/tests/fire/journal.log b/tests/fire/journal.log index fa05d455..70622022 100644 --- a/tests/fire/journal.log +++ b/tests/fire/journal.log @@ -779,30 +779,30 @@ 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 \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 input fire sh 6 12 Play#1 command 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 \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 input fire sh 5 11 Play#1 command 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 \007Kawhomp!!! - Play#1 output Play#1 1 Shells hit sub in 6,0 for 37 damage. - Play#1 output Play#1 1 sub sunk! + Play#1 output Play#1 1 Shells hit sub #11 in 6,0 for 37 damage. + Play#1 output Play#1 1 sub #11 sunk! Play#1 output Play#1 6 0 546 Play#1 input fire sh 6 10 Play#1 command 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 \007Kawhomp!!! - Play#1 output Play#1 1 Shells hit sub in 2,2 for 34 damage. - Play#1 output Play#1 1 sub sunk! + Play#1 output Play#1 1 Shells hit sub #10 in 2,2 for 34 damage. + Play#1 output Play#1 1 sub #10 sunk! Play#1 output Play#1 6 0 545 Play#1 input navi 5 jh Play#1 command navigate diff --git a/tests/retreat/journal.log b/tests/retreat/journal.log index 16343a97..d57d80b7 100644 --- a/tests/retreat/journal.log +++ b/tests/retreat/journal.log @@ -277,21 +277,21 @@ 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 \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 input fire sh 5 51 Play#1 command 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 \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 input fire sh 5 52 Play#1 command 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 \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 input navi 5 gyuh 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 range is 2.00 (1.33) 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 Defenders fire back! Play#1 output Play#1 1 Return fire hit dd destroyer (#5) in -5,-1 for 6 damage. diff --git a/tests/torpedo/journal.log b/tests/torpedo/journal.log index 1d2e4ff0..0a5a2e54 100644 --- a/tests/torpedo/journal.log +++ b/tests/torpedo/journal.log @@ -104,7 +104,7 @@ 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 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 input torp 10 50 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 Whooosh... Hitchance = 45% 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 input torp 15 61 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 Whooosh... Hitchance = 45% 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 input torp 15 63 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 Whooosh... Hitchance = 36% 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 sub sunk! + Play#1 output Play#1 1 Torpedo hit sub #66 for 114 damage. + Play#1 output Play#1 1 sub #66 sunk! Play#1 output Play#1 6 0 550 Play#1 input torp 11 67 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 Whooosh... Hitchance = 36% 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 input torp 11 68 Play#1 command torpedo @@ -566,20 +566,20 @@ 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 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 dd destroyer (#76) depth charged 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 #25 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 af asw frigate (#71) @ 2,6 torpedoed sub - Play#0 output Play#0 1 dd destroyer (#76) depth charged 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 #26 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 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 bb battleship (#75) takes 37 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 dd destroyer (#76) depth charged sub + 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 #28 Play#0 output Play#0 6 0 638 Play#0 input read 3 Play#0 command read