-
Notifications
You must be signed in to change notification settings - Fork 0
Lit 142 #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lkno0705
wants to merge
20
commits into
development
Choose a base branch
from
LIT-142
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Lit 142 #22
Changes from 3 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
6080f51
Add equippedItem stats manipulation
lkno0705 94a23b1
Add Itemeffects, itemBonusStats Stat manipulation test, use healing P…
lkno0705 b2df374
fix unitTests
lkno0705 0382d61
add default case
lkno0705 736be04
change some codacy bs
lkno0705 5f515b6
change some more codacy bs
lkno0705 25762ae
change some more codacy bs
lkno0705 a193879
delete the best constructor in history
lkno0705 e46b6cd
Codacy BS
lkno0705 2d05f16
codacy bs
lkno0705 ca21093
codacy bs
lkno0705 3f836f9
codacy bs
lkno0705 db01225
codacy bs
lkno0705 f8293e9
Merge remote-tracking branch 'origin/LIT-142' into LIT-142
lkno0705 d6f9ef0
codacy BS
lkno0705 5fca4a3
codacy BS
lkno0705 b767925
codacy BS
lkno0705 d5a4a59
codacy BS
lkno0705 59e5f3e
codacy BS
lkno0705 644ffd5
fix unittests
lkno0705 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/main/java/calculationEngine/environment/CeItemEffects.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| package calculationEngine.environment; | ||
|
|
||
| import calculationEngine.entities.CeStats; | ||
| import config.BattleConstants; | ||
| import config.LootConfig; | ||
| import org.json.JSONObject; | ||
|
|
||
| public class CeItemEffects { | ||
|
|
||
| private effects effect; | ||
| private String description; | ||
| private int value; | ||
|
|
||
| private static final boolean debug = BattleConstants.battleDebug; | ||
|
|
||
| private enum effects{ | ||
| healing, | ||
| increaseSpeed, | ||
| increaseAttack, | ||
| increaseCritBonus, | ||
| increaseDefense, | ||
| catchBeast, | ||
| defaultEffect | ||
| } | ||
|
|
||
| public CeItemEffects(JSONObject effectObject){ | ||
| this.effect = effects.valueOf(effectObject.getString("type")); | ||
| this.value = effectObject.getInt("value"); | ||
| this.description = effectObject.getString("description"); | ||
| } | ||
|
|
||
| public void use(CeStats ceStats){ | ||
| switch (this.effect.name()){ | ||
| case "healing": | ||
| int hitPoints = ceStats.getCurrentHitPoints(); | ||
| hitPoints += this.value; | ||
| ceStats.setCurrentHitPoints(hitPoints); | ||
| if (debug) System.out.println("[CeItemEffects] healing by " + this.value + " points"); | ||
| break; | ||
| case "increaseSpeed": | ||
| int speed = ceStats.getSpeed(); | ||
| speed += this.value; | ||
| ceStats.setSpeed(speed); | ||
| break; | ||
| case "increaseAttack": | ||
| int attack = ceStats.getAttack(); | ||
| attack += this.value; | ||
| ceStats.setAttack(attack); | ||
| break; | ||
| case "increaseCritBonus": | ||
| int critBonus = ceStats.getCritBonus(); | ||
| critBonus += this.value; | ||
| ceStats.setCritBonus(critBonus); | ||
| break; | ||
| case "increaseDefense": | ||
| int defense = ceStats.getDefense(); | ||
| defense += this.value; | ||
| ceStats.setDefense(defense); | ||
| break; | ||
| } | ||
|
lkno0705 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| public effects getEffect() { | ||
| return effect; | ||
| } | ||
|
|
||
| public String getDescription() { | ||
| return description; | ||
| } | ||
|
|
||
| public int getValue() { | ||
| return value; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could create a method, "addToStat" in which you say to which stat you want to add (perhaps with ENUM) and how much you want to add.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's neccessary, because it doens't change the problem. For every stat that has to change, you have to call different methods. So if i add another Method this will result in a switch case which has another switch case in it. So you just duplicate the whole thing and you have it twice. IMO it makes it even worse.