Comments (8)
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.
Just so others know, I started to implement the slots and the armour equipping, so we don't get any overlap.
from jadventure.
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.
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.
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.
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.
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.
closing in favor of #73
from jadventure.
Related Issues (20)
- NPC health carries over when reverting save HOT 8
- Selling to guide and then killing him causes negative gold drop HOT 5
- Creating new profiles deletes equipped armors in all other profiles HOT 2
- Saving after killing an NPC on one profile saves NPC death on all profiles HOT 1
- Items should cost more when you sell them to the npc HOT 4
- Merge json/ and json/original_data HOT 1
- Conversation menu infinite loop HOT 5
- when buy things with Guide,it will always loop.[BUG] HOT 1
- Standalone jar doesn't recognize external libraries HOT 4
- Use Adapt for Intent Parsing HOT 2
- i lost my file HOT 3
- prices display while selling HOT 1
- Save Selection Should be Clearer HOT 1
- Debug Error Reporting
- Link github pages site on title HOT 2
- Small amount of Dead code in Main Menu class HOT 4
- QueueProvider rework suggestion HOT 3
- Trading into menus package
- Jacoco breaks build
- Cucumber tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jadventure.