Giter Site home page Giter Site logo

Comments (8)

projectdelphai avatar projectdelphai commented on August 24, 2024

Equipped items do take up backpack "space". Inventory is determined not by space but by weight, so if you're wearing armour or items, then you're still carrying them which adds to your carried weight.

from jadventure.

pthayer3 avatar pthayer3 commented on August 24, 2024

Just so others know, I started to implement the slots and the armour equipping, so we don't get any overlap.

from jadventure.

pthayer3 avatar pthayer3 commented on August 24, 2024

Hey all, I am getting an error when I compile the code I changed to permit equipping.dequipping of armor.

"BUILD FAILED
C:\cygwin64\home\Patrick Thayer\JAdventure\build.xml:40: Test com.jadventure.game.PlayerTest failed"

I am unsure what is going on. My code is on my repository. I don't really know what a playertest is.

from jadventure.

projectdelphai avatar projectdelphai commented on August 24, 2024

There's a PlayerTest.java file in the test section of the repo (versus the main section) which holds some tests. Basically it instantiates a new player and an old player. It checks whether they were created properly. The error probably explain better what is going on, but basically something you wrote broke creating a new player which is good to know now so that you know something is broken. Since you're working with armour you may have changed the method getArmour which is what PlayerTest checks to see whether the new recruit is created properly. Either that or you changed the test json file.

It's definitely something with the code you just wrote, because it compiles properly for me using a unedited jadventure cop.

from jadventure.

pthayer3 avatar pthayer3 commented on August 24, 2024

I eliminated one error by updating the test json file with the new stats I added. But I still get another, a whole bunch of NullPointerExceptions. It appears to happen primarily in the getInstance() method. Interestingly, when I change the test to run with the "sewarrat" string and armour = 0, I get much less Exceptions. I never directly edited the getArmour method, I set up the armour equipping similar to the weapon equipping.

java.lang.NullPointerException
at com.jadventure.game.items.Item.lookUpItem(Item.java:89)
at com.jadventure.game.items.Item.(Item.java:32)
at com.jadventure.game.entities.Player.setUpVariables(Player.java:135)
at com.jadventure.game.entities.Player.getInstance(Player.java:120)
at com.jadventure.game.PlayerTest.newPlayer(PlayerTest.java:13)

EDIT: I think it may have to do with me using a String in the switch statement

EDIT: Maybe not, i'm not sure. Could someone look at it and see if I am missing something obvious?

from jadventure.

projectdelphai avatar projectdelphai commented on August 24, 2024

I would say remove/comment out the test methods in playertest and see if it still breaks in the actual game. If it does, then it's not a problem with playertest. If so, then it's a problem with your code.

I may have some extra time to test your code later today

from jadventure.

projectdelphai avatar projectdelphai commented on August 24, 2024

So basically all those aren't errors, they're just the path the java compiler was taking until it broke. So the last thing it ran was line 89 in the Item.java file under the method lookUpItem. If you look at that line, it's getting the bodypart section from the json file. However, not every item has that property so it breaks when it searches for it. You need to check whether the item json has "bodypart" and if it does THEN assign it to bodypart. You need something like:

if (json.has("bodypart")) {

}

I believe that's the proper code. Similar things are going on in the LocationManager file if you want to see an example.

And drop by IRC so you can ask these questions and get answers more easily.

from jadventure.

projectdelphai avatar projectdelphai commented on August 24, 2024

closing in favor of #73

from jadventure.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.