Delete duplicate declared objects:ClubbedTroll

Trolls should not be re-declared: if I had a troll called Zac, one day I
gave him a weapon.I can not because he now has a weapon called him
Trundle. He is still Zac.
This commit is contained in:
OCN.Yang
2017-09-14 10:20:20 +08:00
parent 2e90f82cab
commit 6a560f7d15
2 changed files with 7 additions and 7 deletions

View File

@ -57,9 +57,9 @@ public class App {
// change the behavior of the simple troll by adding a decorator
LOGGER.info("A troll with huge club surprises you.");
Troll clubbed = new ClubbedTroll(troll);
clubbed.attack();
clubbed.fleeBattle();
LOGGER.info("Clubbed troll power {}.\n", clubbed.getAttackPower());
troll = new ClubbedTroll(troll);
troll.attack();
troll.fleeBattle();
LOGGER.info("Clubbed troll power {}.\n", troll.getAttackPower());
}
}