xpDad 4 Share Posted January 18, 2022 Hey was wondering if anyone came up with a solution for this. So what I want to do is to extend the NPC model to have my specific methods for it as : public class ExtNpc extends NPC { public ExtNpc(final NPC reference) { super(reference); } public void attack() { interact("Attack"); } public boolean isDead() { return getHealthPercent() == 0; } public boolean isUnderAttack(final Character character) { return !character.isInteracting(this); } } but the problem is that it doesn't work as supposed and throws null pointers at times or has bad reference. Any ideas on this? Link to comment Share on other sites More sharing options...
camelCase 257 Share Posted January 19, 2022 why do this in the first place? you are adding complexity to save like .5 seconds typing Link to comment Share on other sites More sharing options...
xpDad 4 Author Share Posted January 20, 2022 Well I believe that doing so will help save some time in the future and have a single point of access to do specific action which would help me to refactor or introduce new logic if needed. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.